1 #ifndef __NV50_KMS_ATOM_H__ 2 #define __NV50_KMS_ATOM_H__ 3 #define nv50_atom(p) container_of((p), struct nv50_atom, state) 4 #include <drm/drm_atomic.h> 5 6 struct nv50_atom { 7 struct drm_atomic_state state; 8 9 struct list_head outp; 10 bool lock_core; 11 bool flush_disable; 12 }; 13 14 #define nv50_head_atom(p) container_of((p), struct nv50_head_atom, state) 15 16 struct nv50_head_atom { 17 struct drm_crtc_state state; 18 19 struct { 20 u32 mask; 21 u32 olut; 22 } wndw; 23 24 struct { 25 u16 iW; 26 u16 iH; 27 u16 oW; 28 u16 oH; 29 } view; 30 31 struct nv50_head_mode { 32 bool interlace; 33 u32 clock; 34 struct { 35 u16 active; 36 u16 synce; 37 u16 blanke; 38 u16 blanks; 39 } h; 40 struct { 41 u32 active; 42 u16 synce; 43 u16 blanke; 44 u16 blanks; 45 u16 blank2s; 46 u16 blank2e; 47 u16 blankus; 48 } v; 49 } mode; 50 51 struct { 52 bool visible; 53 u32 handle; 54 u64 offset:40; 55 u8 buffer:1; 56 u8 mode:4; 57 u16 size:11; 58 u8 range:2; 59 u8 output_mode:2; 60 void (*load)(struct drm_color_lut *, int size, void __iomem *); 61 } olut; 62 63 struct { 64 bool visible; 65 u32 handle; 66 u64 offset:40; 67 u8 format; 68 u8 kind:7; 69 u8 layout:1; 70 u8 blockh:4; 71 u16 blocks:12; 72 u32 pitch:20; 73 u16 x; 74 u16 y; 75 u16 w; 76 u16 h; 77 } core; 78 79 struct { 80 bool visible; 81 u32 handle; 82 u64 offset:40; 83 u8 layout:2; 84 u8 format:8; 85 } curs; 86 87 struct { 88 u8 depth; 89 u8 cpp; 90 u16 x; 91 u16 y; 92 u16 w; 93 u16 h; 94 } base; 95 96 struct { 97 u8 cpp; 98 } ovly; 99 100 struct { 101 bool enable:1; 102 u8 bits:2; 103 u8 mode:4; 104 } dither; 105 106 struct { 107 struct { 108 u16 cos:12; 109 u16 sin:12; 110 } sat; 111 } procamp; 112 113 struct { 114 u8 nhsync:1; 115 u8 nvsync:1; 116 u8 depth:4; 117 } or; 118 119 union nv50_head_atom_mask { 120 struct { 121 bool olut:1; 122 bool core:1; 123 bool curs:1; 124 bool view:1; 125 bool mode:1; 126 bool base:1; 127 bool ovly:1; 128 bool dither:1; 129 bool procamp:1; 130 bool or:1; 131 }; 132 u16 mask; 133 } set, clr; 134 }; 135 136 static inline struct nv50_head_atom * 137 nv50_head_atom_get(struct drm_atomic_state *state, struct drm_crtc *crtc) 138 { 139 struct drm_crtc_state *statec = drm_atomic_get_crtc_state(state, crtc); 140 if (IS_ERR(statec)) 141 return (void *)statec; 142 return nv50_head_atom(statec); 143 } 144 145 #define nv50_wndw_atom(p) container_of((p), struct nv50_wndw_atom, state) 146 147 struct nv50_wndw_atom { 148 struct drm_plane_state state; 149 150 struct drm_property_blob *ilut; 151 bool visible; 152 153 struct { 154 u32 handle; 155 u16 offset:12; 156 bool awaken:1; 157 } ntfy; 158 159 struct { 160 u32 handle; 161 u16 offset:12; 162 u32 acquire; 163 u32 release; 164 } sema; 165 166 struct { 167 u32 handle; 168 struct { 169 u64 offset:40; 170 u8 buffer:1; 171 u8 enable:2; 172 u8 mode:4; 173 u16 size:11; 174 u8 range:2; 175 u8 output_mode:2; 176 void (*load)(struct drm_color_lut *, int size, 177 void __iomem *); 178 } i; 179 } xlut; 180 181 struct { 182 u8 mode:2; 183 u8 interval:4; 184 185 u8 colorspace:2; 186 u8 format; 187 u8 kind:7; 188 u8 layout:1; 189 u8 blockh:4; 190 u16 blocks[3]; 191 u32 pitch[3]; 192 u16 w; 193 u16 h; 194 195 u32 handle[6]; 196 u64 offset[6]; 197 } image; 198 199 struct { 200 u16 sx; 201 u16 sy; 202 u16 sw; 203 u16 sh; 204 u16 dw; 205 u16 dh; 206 } scale; 207 208 struct { 209 u16 x; 210 u16 y; 211 } point; 212 213 union nv50_wndw_atom_mask { 214 struct { 215 bool ntfy:1; 216 bool sema:1; 217 bool xlut:1; 218 bool image:1; 219 bool scale:1; 220 bool point:1; 221 }; 222 u8 mask; 223 } set, clr; 224 }; 225 #endif 226