1 #ifndef __NV50_KMS_H__ 2 #define __NV50_KMS_H__ 3 #include <linux/workqueue.h> 4 #include <nvif/mem.h> 5 6 #include "nouveau_display.h" 7 8 struct nv50_msto; 9 struct nouveau_encoder; 10 11 struct nv50_disp { 12 struct nvif_disp *disp; 13 struct nv50_core *core; 14 struct nvif_object caps; 15 16 #define NV50_DISP_SYNC(c, o) ((c) * 0x040 + (o)) 17 #define NV50_DISP_CORE_NTFY NV50_DISP_SYNC(0 , 0x00) 18 #define NV50_DISP_WNDW_SEM0(c) NV50_DISP_SYNC(1 + (c), 0x00) 19 #define NV50_DISP_WNDW_SEM1(c) NV50_DISP_SYNC(1 + (c), 0x10) 20 #define NV50_DISP_WNDW_NTFY(c) NV50_DISP_SYNC(1 + (c), 0x20) 21 #define NV50_DISP_BASE_SEM0(c) NV50_DISP_WNDW_SEM0(0 + (c)) 22 #define NV50_DISP_BASE_SEM1(c) NV50_DISP_WNDW_SEM1(0 + (c)) 23 #define NV50_DISP_BASE_NTFY(c) NV50_DISP_WNDW_NTFY(0 + (c)) 24 #define NV50_DISP_OVLY_SEM0(c) NV50_DISP_WNDW_SEM0(4 + (c)) 25 #define NV50_DISP_OVLY_SEM1(c) NV50_DISP_WNDW_SEM1(4 + (c)) 26 #define NV50_DISP_OVLY_NTFY(c) NV50_DISP_WNDW_NTFY(4 + (c)) 27 struct nouveau_bo *sync; 28 29 struct mutex mutex; 30 }; 31 32 static inline struct nv50_disp * 33 nv50_disp(struct drm_device *dev) 34 { 35 return nouveau_display(dev)->priv; 36 } 37 38 struct nv50_disp_interlock { 39 enum nv50_disp_interlock_type { 40 NV50_DISP_INTERLOCK_CORE = 0, 41 NV50_DISP_INTERLOCK_CURS, 42 NV50_DISP_INTERLOCK_BASE, 43 NV50_DISP_INTERLOCK_OVLY, 44 NV50_DISP_INTERLOCK_WNDW, 45 NV50_DISP_INTERLOCK_WIMM, 46 NV50_DISP_INTERLOCK__SIZE 47 } type; 48 u32 data; 49 u32 wimm; 50 }; 51 52 void corec37d_ntfy_init(struct nouveau_bo *, u32); 53 54 void head907d_olut_load(struct drm_color_lut *, int size, void __iomem *); 55 56 struct nv50_chan { 57 struct nvif_object user; 58 struct nvif_device *device; 59 }; 60 61 struct nv50_dmac { 62 struct nv50_chan base; 63 64 struct nvif_mem push; 65 u32 *ptr; 66 67 struct nvif_object sync; 68 struct nvif_object vram; 69 70 /* Protects against concurrent pushbuf access to this channel, lock is 71 * grabbed by evo_wait (if the pushbuf reservation is successful) and 72 * dropped again by evo_kick. */ 73 struct mutex lock; 74 }; 75 76 struct nv50_outp_atom { 77 struct list_head head; 78 79 struct drm_encoder *encoder; 80 bool flush_disable; 81 82 union nv50_outp_atom_mask { 83 struct { 84 bool ctrl:1; 85 }; 86 u8 mask; 87 } set, clr; 88 }; 89 90 int nv50_dmac_create(struct nvif_device *device, struct nvif_object *disp, 91 const s32 *oclass, u8 head, void *data, u32 size, 92 u64 syncbuf, struct nv50_dmac *dmac); 93 void nv50_dmac_destroy(struct nv50_dmac *); 94 95 /* 96 * For normal encoders this just returns the encoder. For active MST encoders, 97 * this returns the real outp that's driving displays on the topology. 98 * Inactive MST encoders return NULL, since they would have no real outp to 99 * return anyway. 100 */ 101 struct nouveau_encoder *nv50_real_outp(struct drm_encoder *encoder); 102 103 u32 *evo_wait(struct nv50_dmac *, int nr); 104 void evo_kick(u32 *, struct nv50_dmac *); 105 106 extern const u64 disp50xx_modifiers[]; 107 extern const u64 disp90xx_modifiers[]; 108 extern const u64 wndwc57e_modifiers[]; 109 110 #define evo_mthd(p, m, s) do { \ 111 const u32 _m = (m), _s = (s); \ 112 if (drm_debug_enabled(DRM_UT_KMS)) \ 113 pr_err("%04x %d %s\n", _m, _s, __func__); \ 114 *((p)++) = ((_s << 18) | _m); \ 115 } while(0) 116 117 #define evo_data(p, d) do { \ 118 const u32 _d = (d); \ 119 if (drm_debug_enabled(DRM_UT_KMS)) \ 120 pr_err("\t%08x\n", _d); \ 121 *((p)++) = _d; \ 122 } while(0) 123 #endif 124