diff options
author | Karol Herbst <kherbst@redhat.com> | 2021-08-03 19:29:04 +0200 |
---|---|---|
committer | Karol Herbst <kherbst@redhat.com> | 2022-05-03 11:23:30 +0000 |
commit | 678a32b98fc39fe385b3bb824d58d2927821c5f6 (patch) | |
tree | 74ac57491d3dd4e3ea349a61a06eb42e86679165 | |
parent | d95b12e7e3ed6a22f284afbc5d2356365b820ea8 (diff) |
nouveau: add ioctl wrapper to check for dead channels
v2: explicitly set nr_push to 0 as well
Signed-off-by: Karol Herbst <kherbst@redhat.com>
-rw-r--r-- | nouveau/nouveau-symbols.txt | 1 | ||||
-rw-r--r-- | nouveau/nouveau.h | 4 | ||||
-rw-r--r-- | nouveau/pushbuf.c | 16 |
3 files changed, 21 insertions, 0 deletions
diff --git a/nouveau/nouveau-symbols.txt b/nouveau/nouveau-symbols.txt index ef8032f2..598465f1 100644 --- a/nouveau/nouveau-symbols.txt +++ b/nouveau/nouveau-symbols.txt @@ -12,6 +12,7 @@ nouveau_bufctx_mthd nouveau_bufctx_new nouveau_bufctx_refn nouveau_bufctx_reset +nouveau_check_dead_channel nouveau_client_del nouveau_client_new nouveau_device_del diff --git a/nouveau/nouveau.h b/nouveau/nouveau.h index 335ce77d..0c632feb 100644 --- a/nouveau/nouveau.h +++ b/nouveau/nouveau.h @@ -273,4 +273,8 @@ struct nv04_notify { uint32_t offset; uint32_t length; }; + +bool +nouveau_check_dead_channel(struct nouveau_drm *, struct nouveau_object *chan); + #endif diff --git a/nouveau/pushbuf.c b/nouveau/pushbuf.c index 5fadd7a9..5d54f21d 100644 --- a/nouveau/pushbuf.c +++ b/nouveau/pushbuf.c @@ -782,3 +782,19 @@ nouveau_pushbuf_kick(struct nouveau_pushbuf *push, struct nouveau_object *chan) pushbuf_flush(push); return pushbuf_validate(push, false); } + +drm_public bool +nouveau_check_dead_channel(struct nouveau_drm *drm, struct nouveau_object *chan) +{ + struct drm_nouveau_gem_pushbuf req = {}; + struct nouveau_fifo *fifo = chan->data; + int ret; + + req.channel = fifo->channel; + req.nr_push = 0; + + ret = drmCommandWriteRead(drm->fd, DRM_NOUVEAU_GEM_PUSHBUF, + &req, sizeof(req)); + /* nouveau returns ENODEV once the channel was killed */ + return ret == -ENODEV; +} |