xref: /linux/drivers/gpu/drm/nouveau/dispnv50/wndw.h (revision 53e0a3e70de69dc9f498d26c6b5495b2771ee374)
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 	struct nv50_disp_interlock interlock;
19 
20 	struct {
21 		struct nvif_object *parent;
22 		struct list_head list;
23 	} ctxdma;
24 
25 	struct drm_plane plane;
26 
27 	struct nv50_dmac wndw;
28 	struct nv50_dmac wimm;
29 
30 	struct nvif_notify notify;
31 	u16 ntfy;
32 	u16 sema;
33 	u32 data;
34 };
35 
36 int nv50_wndw_new_(const struct nv50_wndw_func *, struct drm_device *,
37 		   enum drm_plane_type, const char *name, int index,
38 		   const u32 *format, enum nv50_disp_interlock_type,
39 		   u32 interlock_data, u32 heads, struct nv50_wndw **);
40 void nv50_wndw_init(struct nv50_wndw *);
41 void nv50_wndw_fini(struct nv50_wndw *);
42 void nv50_wndw_flush_set(struct nv50_wndw *, u32 *interlock,
43 			 struct nv50_wndw_atom *);
44 void nv50_wndw_flush_clr(struct nv50_wndw *, u32 *interlock, bool flush,
45 			 struct nv50_wndw_atom *);
46 void nv50_wndw_ntfy_enable(struct nv50_wndw *, struct nv50_wndw_atom *);
47 int nv50_wndw_wait_armed(struct nv50_wndw *, struct nv50_wndw_atom *);
48 
49 struct nv50_wndw_func {
50 	int (*acquire)(struct nv50_wndw *, struct nv50_wndw_atom *asyw,
51 		       struct nv50_head_atom *asyh);
52 	void (*release)(struct nv50_wndw *, struct nv50_wndw_atom *asyw,
53 			struct nv50_head_atom *asyh);
54 	void (*prepare)(struct nv50_wndw *, struct nv50_head_atom *asyh,
55 			struct nv50_wndw_atom *asyw);
56 
57 	void (*sema_set)(struct nv50_wndw *, struct nv50_wndw_atom *);
58 	void (*sema_clr)(struct nv50_wndw *);
59 	void (*ntfy_reset)(struct nouveau_bo *, u32 offset);
60 	void (*ntfy_set)(struct nv50_wndw *, struct nv50_wndw_atom *);
61 	void (*ntfy_clr)(struct nv50_wndw *);
62 	int (*ntfy_wait_begun)(struct nouveau_bo *, u32 offset,
63 			       struct nvif_device *);
64 	void (*image_set)(struct nv50_wndw *, struct nv50_wndw_atom *);
65 	void (*image_clr)(struct nv50_wndw *);
66 	void (*lut)(struct nv50_wndw *, struct nv50_wndw_atom *);
67 
68 	void (*update)(struct nv50_wndw *, u32 *interlock);
69 };
70 
71 extern const struct drm_plane_funcs nv50_wndw;
72 
73 struct nv50_wimm_func {
74 	void (*point)(struct nv50_wndw *, struct nv50_wndw_atom *);
75 
76 	void (*update)(struct nv50_wndw *, u32 *interlock);
77 };
78 #endif
79