diff options
author | Ben Skeggs <bskeggs@redhat.com> | 2014-08-10 04:10:20 +1000 |
---|---|---|
committer | Ben Skeggs <bskeggs@redhat.com> | 2014-08-10 04:43:27 +1000 |
commit | 737a951e675b0b0bdd96423b762e2e5b26c3aeb3 (patch) | |
tree | 993752b32238c0cc9bce7cd4725a42a6767d4e07 /nvif | |
parent | 7a6217d8dd327130e937a5235e14742eaf04bc6f (diff) | |
download | nouveau-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 'nvif')
-rw-r--r-- | nvif/event.h | 28 | ||||
-rw-r--r-- | nvif/unpack.h | 24 |
2 files changed, 52 insertions, 0 deletions
diff --git a/nvif/event.h b/nvif/event.h new file mode 100644 index 000000000..6daced098 --- /dev/null +++ b/nvif/event.h @@ -0,0 +1,28 @@ +#ifndef __NVIF_EVENT_H__ +#define __NVIF_EVENT_H__ + +struct nvif_notify_head_req_v0 { + __u8 version; + __u8 head; +}; + +struct nvif_notify_head_rep_v0 { + __u8 version; +}; + +struct nvif_notify_conn_req_v0 { + __u8 version; +#define NVIF_NOTIFY_CONN_V0_PLUG 0x01 +#define NVIF_NOTIFY_CONN_V0_UNPLUG 0x02 +#define NVIF_NOTIFY_CONN_V0_IRQ 0x04 +#define NVIF_NOTIFY_CONN_V0_ANY 0x07 + __u8 mask; + __u8 conn; +}; + +struct nvif_notify_conn_rep_v0 { + __u8 version; + __u8 mask; +}; + +#endif diff --git a/nvif/unpack.h b/nvif/unpack.h new file mode 100644 index 000000000..5933188b4 --- /dev/null +++ b/nvif/unpack.h @@ -0,0 +1,24 @@ +#ifndef __NVIF_UNPACK_H__ +#define __NVIF_UNPACK_H__ + +#define nvif_unvers(d) ({ \ + ret = (size == sizeof(d)) ? 0 : -ENOSYS; \ + (ret == 0); \ +}) + +#define nvif_unpack(d,vl,vh,m) ({ \ + if ((vl) == 0 || ret == -ENOSYS) { \ + int _size = sizeof(d); \ + if (_size <= size && (d).version >= (vl) && \ + (d).version <= (vh)) { \ + data = (u8 *)data + _size; \ + size = size - _size; \ + ret = ((m) || !size) ? 0 : -E2BIG; \ + } else { \ + ret = -ENOSYS; \ + } \ + } \ + (ret == 0); \ +}) + +#endif |