diff options
author | Ben Skeggs <bskeggs@redhat.com> | 2014-08-10 04:10:20 +1000 |
---|---|---|
committer | Ben Skeggs <bskeggs@redhat.com> | 2014-08-10 05:13:02 +1000 |
commit | 79ca27706a034b683196c85f5c6901b78e5ab8f0 (patch) | |
tree | c06ff32b983e4456b3af679288dad97bfe79cfe9 /drivers/gpu/drm/nouveau/core/engine/device | |
parent | 4d681b666d4c1452139a06504df2ec101a4efc7e (diff) |
drm/nouveau/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 'drivers/gpu/drm/nouveau/core/engine/device')
-rw-r--r-- | drivers/gpu/drm/nouveau/core/engine/device/acpi.c | 2 | ||||
-rw-r--r-- | drivers/gpu/drm/nouveau/core/engine/device/base.c | 23 |
2 files changed, 22 insertions, 3 deletions
diff --git a/drivers/gpu/drm/nouveau/core/engine/device/acpi.c b/drivers/gpu/drm/nouveau/core/engine/device/acpi.c index 79a2e4d4731..4dbf0ba89e5 100644 --- a/drivers/gpu/drm/nouveau/core/engine/device/acpi.c +++ b/drivers/gpu/drm/nouveau/core/engine/device/acpi.c @@ -33,7 +33,7 @@ nvkm_acpi_ntfy(struct notifier_block *nb, unsigned long val, void *data) struct acpi_bus_event *info = data; if (!strcmp(info->device_class, "ac_adapter")) - nouveau_event_trigger(device->ntfy, 1, NVKM_DEVICE_NTFY_POWER); + nvkm_event_send(&device->event, 1, 0, NULL, 0); return NOTIFY_DONE; } diff --git a/drivers/gpu/drm/nouveau/core/engine/device/base.c b/drivers/gpu/drm/nouveau/core/engine/device/base.c index 6c16dabe13b..ac31a6d685c 100644 --- a/drivers/gpu/drm/nouveau/core/engine/device/base.c +++ b/drivers/gpu/drm/nouveau/core/engine/device/base.c @@ -364,6 +364,7 @@ nouveau_devobj_ofuncs = { /****************************************************************************** * nouveau_device: engine functions *****************************************************************************/ + static struct nouveau_oclass nouveau_device_sclass[] = { { 0x0080, &nouveau_devobj_ofuncs }, @@ -371,6 +372,23 @@ nouveau_device_sclass[] = { }; static int +nouveau_device_event_ctor(void *data, u32 size, struct nvkm_notify *notify) +{ + if (!WARN_ON(size != 0)) { + notify->size = 0; + notify->types = 1; + notify->index = 0; + return 0; + } + return -EINVAL; +} + +static const struct nvkm_event_func +nouveau_device_event_func = { + .ctor = nouveau_device_event_ctor, +}; + +static int nouveau_device_fini(struct nouveau_object *object, bool suspend) { struct nouveau_device *device = (void *)object; @@ -445,7 +463,7 @@ nouveau_device_dtor(struct nouveau_object *object) { struct nouveau_device *device = (void *)object; - nouveau_event_destroy(&device->ntfy); + nvkm_event_fini(&device->event); mutex_lock(&nv_devices_mutex); list_del(&device->head); @@ -545,7 +563,8 @@ nouveau_device_create_(void *dev, enum nv_bus_type type, u64 name, nv_engine(device)->sclass = nouveau_device_sclass; list_add(&device->head, &nv_devices); - ret = nouveau_event_create(1, NVKM_DEVICE_NTFY, &device->ntfy); + ret = nvkm_event_init(&nouveau_device_event_func, 1, 1, + &device->event); done: mutex_unlock(&nv_devices_mutex); return ret; |