]> git.kernelconcepts.de Git - karo-tx-linux.git/blob - drivers/gpu/drm/nouveau/core/include/core/event.h
drm/nouveau/core: allow event source to handle multiple event types per index
[karo-tx-linux.git] / drivers / gpu / drm / nouveau / core / include / core / event.h
1 #ifndef __NVKM_EVENT_H__
2 #define __NVKM_EVENT_H__
3
4 /* return codes from event handlers */
5 #define NVKM_EVENT_DROP 0
6 #define NVKM_EVENT_KEEP 1
7
8 /* nouveau_eventh.flags bit #s */
9 #define NVKM_EVENT_ENABLE 0
10
11 struct nouveau_eventh {
12         struct nouveau_event *event;
13         struct list_head head;
14         unsigned long flags;
15         u32 types;
16         int index;
17         int (*func)(void *, u32, int);
18         void *priv;
19 };
20
21 struct nouveau_event {
22         void *priv;
23         int (*check)(struct nouveau_event *, u32 type, int index);
24         void (*enable)(struct nouveau_event *, int type, int index);
25         void (*disable)(struct nouveau_event *, int type, int index);
26
27         int types_nr;
28         int index_nr;
29
30         spinlock_t list_lock;
31         struct list_head *list;
32         spinlock_t refs_lock;
33         int refs[];
34 };
35
36 int  nouveau_event_create(int types_nr, int index_nr, struct nouveau_event **);
37 void nouveau_event_destroy(struct nouveau_event **);
38 void nouveau_event_trigger(struct nouveau_event *, u32 types, int index);
39
40 int  nouveau_event_new(struct nouveau_event *, u32 types, int index,
41                        int (*func)(void *, u32, int), void *,
42                        struct nouveau_eventh **);
43 void nouveau_event_ref(struct nouveau_eventh *, struct nouveau_eventh **);
44 void nouveau_event_get(struct nouveau_eventh *);
45 void nouveau_event_put(struct nouveau_eventh *);
46
47 #endif