xref: /linux/drivers/gpu/drm/nouveau/dispnv50/wndw.h (revision ccd27db8c731817ef36e75de2b5fdc2e79550213)
1 #ifndef __NV50_KMS_WNDW_H__
2 #define __NV50_KMS_WNDW_H__
3 #define nv50_wndw(p) container_of((p), struct nv50_wndw, plane)
4 #include "disp.h"
5 #include "atom.h"
6 
7 #include <nvif/notify.h>
8 
9 struct nv50_wndw_ctxdma {
10 	struct list_head head;
11 	struct nvif_object object;
12 };
13 
14 struct nv50_wndw {
15 	const struct nv50_wndw_func *func;
16 	const struct nv50_wimm_func *immd;
17 	int id;
18 
19 	struct {
20 		struct nvif_object *parent;
21 		struct list_head list;
22 	} ctxdma;
23 
24 	struct drm_plane plane;
25 
26 	struct nv50_dmac wndw;
27 	struct nv50_dmac wimm;
28 
29 	struct nvif_notify notify;
30 	u16 ntfy;
31 	u16 sema;
32 	u32 data;
33 };
34 
35 int nv50_wndw_new_(const struct nv50_wndw_func *, struct drm_device *,
36 		   enum drm_plane_type, const char *name, int index,
37 		   const u32 *format, struct nv50_wndw **);
38 void nv50_wndw_init(struct nv50_wndw *);
39 void nv50_wndw_fini(struct nv50_wndw *);
40 u32 nv50_wndw_flush_set(struct nv50_wndw *, u32 interlock,
41 			struct nv50_wndw_atom *);
42 u32 nv50_wndw_flush_clr(struct nv50_wndw *, u32 interlock, bool flush,
43 			struct nv50_wndw_atom *);
44 void nv50_wndw_ntfy_enable(struct nv50_wndw *, struct nv50_wndw_atom *);
45 int nv50_wndw_wait_armed(struct nv50_wndw *, struct nv50_wndw_atom *);
46 
47 struct nv50_wndw_func {
48 	int (*acquire)(struct nv50_wndw *, struct nv50_wndw_atom *asyw,
49 		       struct nv50_head_atom *asyh);
50 	void (*release)(struct nv50_wndw *, struct nv50_wndw_atom *asyw,
51 			struct nv50_head_atom *asyh);
52 	void (*prepare)(struct nv50_wndw *, struct nv50_head_atom *asyh,
53 			struct nv50_wndw_atom *asyw);
54 
55 	void (*sema_set)(struct nv50_wndw *, struct nv50_wndw_atom *);
56 	void (*sema_clr)(struct nv50_wndw *);
57 	void (*ntfy_reset)(struct nouveau_bo *, u32 offset);
58 	void (*ntfy_set)(struct nv50_wndw *, struct nv50_wndw_atom *);
59 	void (*ntfy_clr)(struct nv50_wndw *);
60 	int (*ntfy_wait_begun)(struct nouveau_bo *, u32 offset,
61 			       struct nvif_device *);
62 	void (*image_set)(struct nv50_wndw *, struct nv50_wndw_atom *);
63 	void (*image_clr)(struct nv50_wndw *);
64 	void (*lut)(struct nv50_wndw *, struct nv50_wndw_atom *);
65 
66 	u32 (*update)(struct nv50_wndw *, u32 interlock);
67 };
68 
69 extern const struct drm_plane_funcs nv50_wndw;
70 
71 struct nv50_wimm_func {
72 	void (*point)(struct nv50_wndw *, struct nv50_wndw_atom *);
73 
74 	u32 (*update)(struct nv50_wndw *, u32 interlock);
75 };
76 #endif
77