xref: /linux/drivers/gpu/drm/nouveau/nvkm/engine/sw/chan.h (revision a940daa52167e9db8ecce82213813b735a9d9f23)
1 /* SPDX-License-Identifier: MIT */
2 #ifndef __NVKM_SW_CHAN_H__
3 #define __NVKM_SW_CHAN_H__
4 #define nvkm_sw_chan(p) container_of((p), struct nvkm_sw_chan, object)
5 #include <core/object.h>
6 #include <core/event.h>
7 
8 #include "priv.h"
9 
10 struct nvkm_sw_chan {
11 	const struct nvkm_sw_chan_func *func;
12 	struct nvkm_object object;
13 	struct nvkm_sw *sw;
14 	struct nvkm_chan *fifo;
15 	struct list_head head;
16 
17 #define NVKM_SW_CHAN_EVENT_PAGE_FLIP BIT(0)
18 	struct nvkm_event event;
19 };
20 
21 struct nvkm_sw_chan_func {
22 	void *(*dtor)(struct nvkm_sw_chan *);
23 	bool (*mthd)(struct nvkm_sw_chan *, int subc, u32 mthd, u32 data);
24 };
25 
26 int nvkm_sw_chan_ctor(const struct nvkm_sw_chan_func *, struct nvkm_sw *,
27 		      struct nvkm_chan *, const struct nvkm_oclass *,
28 		      struct nvkm_sw_chan *);
29 bool nvkm_sw_chan_mthd(struct nvkm_sw_chan *, int subc, u32 mthd, u32 data);
30 #endif
31