xref: /linux/drivers/gpu/drm/nouveau/include/nvif/event.h (revision 5e0266f0e5f57617472d5aac4013f58a3ef264ac)
1 /* SPDX-License-Identifier: MIT */
2 #ifndef __NVIF_EVENT_H__
3 #define __NVIF_EVENT_H__
4 #include <nvif/object.h>
5 #include <nvif/if000e.h>
6 struct nvif_event;
7 
8 #define NVIF_EVENT_KEEP 0
9 #define NVIF_EVENT_DROP 1
10 typedef int (*nvif_event_func)(struct nvif_event *, void *repv, u32 repc);
11 
12 struct nvif_event {
13 	struct nvif_object object;
14 	nvif_event_func func;
15 };
16 
17 static inline bool
18 nvif_event_constructed(struct nvif_event *event)
19 {
20 	return nvif_object_constructed(&event->object);
21 }
22 
23 int nvif_event_ctor_(struct nvif_object *, const char *, u32, nvif_event_func, bool,
24 		     struct nvif_event_v0 *, u32, bool, struct nvif_event *);
25 
26 static inline int
27 nvif_event_ctor(struct nvif_object *parent, const char *name, u32 handle, nvif_event_func func,
28 		bool wait, struct nvif_event_v0 *args, u32 argc, struct nvif_event *event)
29 {
30 	return nvif_event_ctor_(parent, name, handle, func, wait, args, argc, true, event);
31 }
32 
33 void nvif_event_dtor(struct nvif_event *);
34 int nvif_event_allow(struct nvif_event *);
35 int nvif_event_block(struct nvif_event *);
36 #endif
37