summaryrefslogtreecommitdiff
path: root/drm/nouveau_fence.c
diff options
context:
space:
mode:
authorBen Skeggs <bskeggs@redhat.com>2014-08-10 04:10:20 +1000
committerBen Skeggs <bskeggs@redhat.com>2014-08-10 04:43:27 +1000
commit737a951e675b0b0bdd96423b762e2e5b26c3aeb3 (patch)
tree993752b32238c0cc9bce7cd4725a42a6767d4e07 /drm/nouveau_fence.c
parent7a6217d8dd327130e937a5235e14742eaf04bc6f (diff)
downloadnouveau-737a951e675b0b0bdd96423b762e2e5b26c3aeb3.tar.gz
core: rework event interface
This is a lot of prep-work for being able to send event notifications back to userspace. Events now contain data, rather than a "something just happened" signal. Handler data is now embedded into a containing structure, rather than being kmalloc()'d, and can optionally have the notify routine handled in a workqueue. Various races between suspend/unload with display HPD/DP IRQ handlers automagically solved as a result. Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
Diffstat (limited to 'drm/nouveau_fence.c')
-rw-r--r--drm/nouveau_fence.c26
1 files changed, 16 insertions, 10 deletions
diff --git a/drm/nouveau_fence.c b/drm/nouveau_fence.c
index ab5ea3b0d..c5efe25d0 100644
--- a/drm/nouveau_fence.c
+++ b/drm/nouveau_fence.c
@@ -165,12 +165,18 @@ nouveau_fence_done(struct nouveau_fence *fence)
return !fence->channel;
}
+struct nouveau_fence_wait {
+ struct nouveau_fence_priv *priv;
+ struct nvkm_notify notify;
+};
+
static int
-nouveau_fence_wait_uevent_handler(void *data, u32 type, int index)
+nouveau_fence_wait_uevent_handler(struct nvkm_notify *notify)
{
- struct nouveau_fence_priv *priv = data;
- wake_up_all(&priv->waiting);
- return NVKM_EVENT_KEEP;
+ struct nouveau_fence_wait *wait =
+ container_of(notify, typeof(*wait), notify);
+ wake_up_all(&wait->priv->waiting);
+ return NVKM_NOTIFY_KEEP;
}
static int
@@ -180,16 +186,16 @@ nouveau_fence_wait_uevent(struct nouveau_fence *fence, bool intr)
struct nouveau_channel *chan = fence->channel;
struct nouveau_fifo *pfifo = nouveau_fifo(chan->drm->device);
struct nouveau_fence_priv *priv = chan->drm->fence;
- struct nouveau_eventh *handler;
+ struct nouveau_fence_wait wait = { .priv = priv };
int ret = 0;
- ret = nouveau_event_new(pfifo->uevent, 1, 0,
- nouveau_fence_wait_uevent_handler,
- priv, &handler);
+ ret = nvkm_notify_init(&pfifo->uevent,
+ nouveau_fence_wait_uevent_handler, false,
+ NULL, 0, 0, &wait.notify);
if (ret)
return ret;
- nouveau_event_get(handler);
+ nvkm_notify_get(&wait.notify);
if (fence->timeout) {
unsigned long timeout = fence->timeout - jiffies;
@@ -221,7 +227,7 @@ nouveau_fence_wait_uevent(struct nouveau_fence *fence, bool intr)
}
}
- nouveau_event_ref(NULL, &handler);
+ nvkm_notify_fini(&wait.notify);
if (unlikely(ret < 0))
return ret;