wndw.h revision 1.1 1 /* $NetBSD: wndw.h,v 1.1 2021/12/18 20:15:37 riastradh Exp $ */
2
3 #ifndef __NV50_KMS_WNDW_H__
4 #define __NV50_KMS_WNDW_H__
5 #define nv50_wndw(p) container_of((p), struct nv50_wndw, plane)
6 #include "disp.h"
7 #include "atom.h"
8 #include "lut.h"
9
10 #include <nvif/notify.h>
11
12 struct nv50_wndw_ctxdma {
13 struct list_head head;
14 struct nvif_object object;
15 };
16
17 struct nv50_wndw {
18 const struct nv50_wndw_func *func;
19 const struct nv50_wimm_func *immd;
20 int id;
21 struct nv50_disp_interlock interlock;
22
23 struct {
24 struct nvif_object *parent;
25 struct list_head list;
26 } ctxdma;
27
28 struct drm_plane plane;
29
30 struct nv50_lut ilut;
31
32 struct nv50_dmac wndw;
33 struct nv50_dmac wimm;
34
35 struct nvif_notify notify;
36 u16 ntfy;
37 u16 sema;
38 u32 data;
39 };
40
41 int nv50_wndw_new_(const struct nv50_wndw_func *, struct drm_device *,
42 enum drm_plane_type, const char *name, int index,
43 const u32 *format, enum nv50_disp_interlock_type,
44 u32 interlock_data, u32 heads, struct nv50_wndw **);
45 void nv50_wndw_init(struct nv50_wndw *);
46 void nv50_wndw_fini(struct nv50_wndw *);
47 void nv50_wndw_flush_set(struct nv50_wndw *, u32 *interlock,
48 struct nv50_wndw_atom *);
49 void nv50_wndw_flush_clr(struct nv50_wndw *, u32 *interlock, bool flush,
50 struct nv50_wndw_atom *);
51 void nv50_wndw_ntfy_enable(struct nv50_wndw *, struct nv50_wndw_atom *);
52 int nv50_wndw_wait_armed(struct nv50_wndw *, struct nv50_wndw_atom *);
53
54 struct nv50_wndw_func {
55 int (*acquire)(struct nv50_wndw *, struct nv50_wndw_atom *asyw,
56 struct nv50_head_atom *asyh);
57 void (*release)(struct nv50_wndw *, struct nv50_wndw_atom *asyw,
58 struct nv50_head_atom *asyh);
59 void (*prepare)(struct nv50_wndw *, struct nv50_head_atom *asyh,
60 struct nv50_wndw_atom *asyw);
61
62 void (*sema_set)(struct nv50_wndw *, struct nv50_wndw_atom *);
63 void (*sema_clr)(struct nv50_wndw *);
64 void (*ntfy_reset)(struct nouveau_bo *, u32 offset);
65 void (*ntfy_set)(struct nv50_wndw *, struct nv50_wndw_atom *);
66 void (*ntfy_clr)(struct nv50_wndw *);
67 int (*ntfy_wait_begun)(struct nouveau_bo *, u32 offset,
68 struct nvif_device *);
69 bool (*ilut)(struct nv50_wndw *, struct nv50_wndw_atom *, int);
70 void (*csc)(struct nv50_wndw *, struct nv50_wndw_atom *,
71 const struct drm_color_ctm *);
72 void (*csc_set)(struct nv50_wndw *, struct nv50_wndw_atom *);
73 void (*csc_clr)(struct nv50_wndw *);
74 bool ilut_identity;
75 int ilut_size;
76 bool olut_core;
77 void (*xlut_set)(struct nv50_wndw *, struct nv50_wndw_atom *);
78 void (*xlut_clr)(struct nv50_wndw *);
79 void (*image_set)(struct nv50_wndw *, struct nv50_wndw_atom *);
80 void (*image_clr)(struct nv50_wndw *);
81 void (*scale_set)(struct nv50_wndw *, struct nv50_wndw_atom *);
82 void (*blend_set)(struct nv50_wndw *, struct nv50_wndw_atom *);
83
84 void (*update)(struct nv50_wndw *, u32 *interlock);
85 };
86
87 extern const struct drm_plane_funcs nv50_wndw;
88
89 void base507c_ntfy_reset(struct nouveau_bo *, u32);
90 int base507c_ntfy_wait_begun(struct nouveau_bo *, u32, struct nvif_device *);
91
92 void base907c_csc(struct nv50_wndw *, struct nv50_wndw_atom *,
93 const struct drm_color_ctm *);
94
95 struct nv50_wimm_func {
96 void (*point)(struct nv50_wndw *, struct nv50_wndw_atom *);
97
98 void (*update)(struct nv50_wndw *, u32 *interlock);
99 };
100
101 extern const struct nv50_wimm_func curs507a;
102
103 int wndwc37e_new(struct nouveau_drm *, enum drm_plane_type, int, s32,
104 struct nv50_wndw **);
105 int wndwc37e_new_(const struct nv50_wndw_func *, struct nouveau_drm *,
106 enum drm_plane_type type, int index, s32 oclass, u32 heads,
107 struct nv50_wndw **);
108 int wndwc37e_acquire(struct nv50_wndw *, struct nv50_wndw_atom *,
109 struct nv50_head_atom *);
110 void wndwc37e_release(struct nv50_wndw *, struct nv50_wndw_atom *,
111 struct nv50_head_atom *);
112 void wndwc37e_sema_set(struct nv50_wndw *, struct nv50_wndw_atom *);
113 void wndwc37e_sema_clr(struct nv50_wndw *);
114 void wndwc37e_ntfy_set(struct nv50_wndw *, struct nv50_wndw_atom *);
115 void wndwc37e_ntfy_clr(struct nv50_wndw *);
116 void wndwc37e_image_clr(struct nv50_wndw *);
117 void wndwc37e_blend_set(struct nv50_wndw *, struct nv50_wndw_atom *);
118 void wndwc37e_update(struct nv50_wndw *, u32 *);
119
120 int wndwc57e_new(struct nouveau_drm *, enum drm_plane_type, int, s32,
121 struct nv50_wndw **);
122
123 int nv50_wndw_new(struct nouveau_drm *, enum drm_plane_type, int index,
124 struct nv50_wndw **);
125 #endif
126