Commit | Line | Data |
---|---|---|
1590700d BS |
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" | |
119608a7 | 6 | #include "lut.h" |
1590700d BS |
7 | |
8 | #include <nvif/notify.h> | |
9 | ||
10 | struct nv50_wndw_ctxdma { | |
11 | struct list_head head; | |
12 | struct nvif_object object; | |
13 | }; | |
14 | ||
15 | struct nv50_wndw { | |
16 | const struct nv50_wndw_func *func; | |
17 | const struct nv50_wimm_func *immd; | |
18 | int id; | |
53e0a3e7 | 19 | struct nv50_disp_interlock interlock; |
1590700d BS |
20 | |
21 | struct { | |
22 | struct nvif_object *parent; | |
23 | struct list_head list; | |
24 | } ctxdma; | |
25 | ||
26 | struct drm_plane plane; | |
27 | ||
119608a7 BS |
28 | struct nv50_lut ilut; |
29 | ||
1590700d BS |
30 | struct nv50_dmac wndw; |
31 | struct nv50_dmac wimm; | |
32 | ||
33 | struct nvif_notify notify; | |
34 | u16 ntfy; | |
35 | u16 sema; | |
36 | u32 data; | |
37 | }; | |
38 | ||
39 | int nv50_wndw_new_(const struct nv50_wndw_func *, struct drm_device *, | |
40 | enum drm_plane_type, const char *name, int index, | |
53e0a3e7 BS |
41 | const u32 *format, enum nv50_disp_interlock_type, |
42 | u32 interlock_data, u32 heads, struct nv50_wndw **); | |
1590700d BS |
43 | void nv50_wndw_init(struct nv50_wndw *); |
44 | void nv50_wndw_fini(struct nv50_wndw *); | |
53e0a3e7 BS |
45 | void nv50_wndw_flush_set(struct nv50_wndw *, u32 *interlock, |
46 | struct nv50_wndw_atom *); | |
47 | void nv50_wndw_flush_clr(struct nv50_wndw *, u32 *interlock, bool flush, | |
48 | struct nv50_wndw_atom *); | |
ccd27db8 | 49 | void nv50_wndw_ntfy_enable(struct nv50_wndw *, struct nv50_wndw_atom *); |
1590700d BS |
50 | int nv50_wndw_wait_armed(struct nv50_wndw *, struct nv50_wndw_atom *); |
51 | ||
52 | struct nv50_wndw_func { | |
53 | int (*acquire)(struct nv50_wndw *, struct nv50_wndw_atom *asyw, | |
54 | struct nv50_head_atom *asyh); | |
55 | void (*release)(struct nv50_wndw *, struct nv50_wndw_atom *asyw, | |
56 | struct nv50_head_atom *asyh); | |
57 | void (*prepare)(struct nv50_wndw *, struct nv50_head_atom *asyh, | |
58 | struct nv50_wndw_atom *asyw); | |
59 | ||
34cf8cae | 60 | int (*sema_set)(struct nv50_wndw *, struct nv50_wndw_atom *); |
c686051a | 61 | int (*sema_clr)(struct nv50_wndw *); |
ccd27db8 | 62 | void (*ntfy_reset)(struct nouveau_bo *, u32 offset); |
fe8a2eec | 63 | int (*ntfy_set)(struct nv50_wndw *, struct nv50_wndw_atom *); |
bcae99c2 | 64 | int (*ntfy_clr)(struct nv50_wndw *); |
ccd27db8 BS |
65 | int (*ntfy_wait_begun)(struct nouveau_bo *, u32 offset, |
66 | struct nvif_device *); | |
13199270 | 67 | bool (*ilut)(struct nv50_wndw *, struct nv50_wndw_atom *, int); |
88b70352 IM |
68 | void (*csc)(struct nv50_wndw *, struct nv50_wndw_atom *, |
69 | const struct drm_color_ctm *); | |
72587dca | 70 | int (*csc_set)(struct nv50_wndw *, struct nv50_wndw_atom *); |
cfb4120d | 71 | int (*csc_clr)(struct nv50_wndw *); |
cb55cd0c | 72 | bool ilut_identity; |
13199270 | 73 | int ilut_size; |
119608a7 | 74 | bool olut_core; |
222439eb | 75 | int (*xlut_set)(struct nv50_wndw *, struct nv50_wndw_atom *); |
34838908 | 76 | int (*xlut_clr)(struct nv50_wndw *); |
6d6e11e2 | 77 | int (*image_set)(struct nv50_wndw *, struct nv50_wndw_atom *); |
8944d8b3 | 78 | int (*image_clr)(struct nv50_wndw *); |
0a4693e8 | 79 | int (*scale_set)(struct nv50_wndw *, struct nv50_wndw_atom *); |
85bdfcd4 | 80 | int (*blend_set)(struct nv50_wndw *, struct nv50_wndw_atom *); |
1590700d | 81 | |
3afb4db7 | 82 | int (*update)(struct nv50_wndw *, u32 *interlock); |
1590700d BS |
83 | }; |
84 | ||
85 | extern const struct drm_plane_funcs nv50_wndw; | |
86 | ||
2ce7f386 | 87 | void base507c_ntfy_reset(struct nouveau_bo *, u32); |
fe8a2eec | 88 | int base507c_ntfy_set(struct nv50_wndw *, struct nv50_wndw_atom *); |
bcae99c2 | 89 | int base507c_ntfy_clr(struct nv50_wndw *); |
2ce7f386 | 90 | int base507c_ntfy_wait_begun(struct nouveau_bo *, u32, struct nvif_device *); |
8944d8b3 | 91 | int base507c_image_clr(struct nv50_wndw *); |
3afb4db7 | 92 | int base507c_update(struct nv50_wndw *, u32 *); |
2ce7f386 | 93 | |
dffa4878 BS |
94 | void base907c_csc(struct nv50_wndw *, struct nv50_wndw_atom *, |
95 | const struct drm_color_ctm *); | |
96 | ||
1590700d | 97 | struct nv50_wimm_func { |
bea8395c | 98 | int (*point)(struct nv50_wndw *, struct nv50_wndw_atom *); |
1590700d | 99 | |
9659be21 | 100 | int (*update)(struct nv50_wndw *, u32 *interlock); |
1590700d | 101 | }; |
2ce7f386 BS |
102 | |
103 | extern const struct nv50_wimm_func curs507a; | |
374b5580 | 104 | bool curs507a_space(struct nv50_wndw *); |
facaed62 | 105 | |
bea8395c BS |
106 | static inline __must_check int |
107 | nvif_chan_wait(struct nv50_dmac *dmac, u32 size) | |
108 | { | |
109 | struct nv50_wndw *wndw = container_of(dmac, typeof(*wndw), wimm); | |
110 | return curs507a_space(wndw) ? 0 : -ETIMEDOUT; | |
111 | } | |
112 | ||
facaed62 BS |
113 | int wndwc37e_new(struct nouveau_drm *, enum drm_plane_type, int, s32, |
114 | struct nv50_wndw **); | |
563737c5 BS |
115 | int wndwc37e_new_(const struct nv50_wndw_func *, struct nouveau_drm *, |
116 | enum drm_plane_type type, int index, s32 oclass, u32 heads, | |
117 | struct nv50_wndw **); | |
118 | int wndwc37e_acquire(struct nv50_wndw *, struct nv50_wndw_atom *, | |
119 | struct nv50_head_atom *); | |
120 | void wndwc37e_release(struct nv50_wndw *, struct nv50_wndw_atom *, | |
121 | struct nv50_head_atom *); | |
34cf8cae | 122 | int wndwc37e_sema_set(struct nv50_wndw *, struct nv50_wndw_atom *); |
c686051a | 123 | int wndwc37e_sema_clr(struct nv50_wndw *); |
fe8a2eec | 124 | int wndwc37e_ntfy_set(struct nv50_wndw *, struct nv50_wndw_atom *); |
bcae99c2 | 125 | int wndwc37e_ntfy_clr(struct nv50_wndw *); |
8944d8b3 | 126 | int wndwc37e_image_clr(struct nv50_wndw *); |
85bdfcd4 | 127 | int wndwc37e_blend_set(struct nv50_wndw *, struct nv50_wndw_atom *); |
3afb4db7 | 128 | int wndwc37e_update(struct nv50_wndw *, u32 *); |
563737c5 BS |
129 | |
130 | int wndwc57e_new(struct nouveau_drm *, enum drm_plane_type, int, s32, | |
131 | struct nv50_wndw **); | |
8ef23b6f BS |
132 | bool wndwc57e_ilut(struct nv50_wndw *, struct nv50_wndw_atom *, int); |
133 | int wndwc57e_ilut_set(struct nv50_wndw *, struct nv50_wndw_atom *); | |
134 | int wndwc57e_ilut_clr(struct nv50_wndw *); | |
135 | int wndwc57e_csc_set(struct nv50_wndw *, struct nv50_wndw_atom *); | |
136 | int wndwc57e_csc_clr(struct nv50_wndw *); | |
137 | ||
138 | int wndwc67e_new(struct nouveau_drm *, enum drm_plane_type, int, s32, | |
139 | struct nv50_wndw **); | |
facaed62 BS |
140 | |
141 | int nv50_wndw_new(struct nouveau_drm *, enum drm_plane_type, int index, | |
142 | struct nv50_wndw **); | |
1590700d | 143 | #endif |