11590700dSBen Skeggs #ifndef __NV50_KMS_H__ 21590700dSBen Skeggs #define __NV50_KMS_H__ 312885ecbSLyude Paul #include <linux/workqueue.h> 41590700dSBen Skeggs #include <nvif/mem.h> 52853ccf0SBen Skeggs #include <nvif/push.h> 61590700dSBen Skeggs 71590700dSBen Skeggs #include "nouveau_display.h" 81590700dSBen Skeggs 95ff0cb1cSLyude Paul struct nv50_msto; 1012885ecbSLyude Paul struct nouveau_encoder; 115ff0cb1cSLyude Paul 121590700dSBen Skeggs struct nv50_disp { 131590700dSBen Skeggs struct nvif_disp *disp; 141590700dSBen Skeggs struct nv50_core *core; 154a2cb418SLyude Paul struct nvif_object caps; 161590700dSBen Skeggs 171590700dSBen Skeggs #define NV50_DISP_SYNC(c, o) ((c) * 0x040 + (o)) 181590700dSBen Skeggs #define NV50_DISP_CORE_NTFY NV50_DISP_SYNC(0 , 0x00) 191590700dSBen Skeggs #define NV50_DISP_WNDW_SEM0(c) NV50_DISP_SYNC(1 + (c), 0x00) 201590700dSBen Skeggs #define NV50_DISP_WNDW_SEM1(c) NV50_DISP_SYNC(1 + (c), 0x10) 211590700dSBen Skeggs #define NV50_DISP_WNDW_NTFY(c) NV50_DISP_SYNC(1 + (c), 0x20) 221590700dSBen Skeggs #define NV50_DISP_BASE_SEM0(c) NV50_DISP_WNDW_SEM0(0 + (c)) 231590700dSBen Skeggs #define NV50_DISP_BASE_SEM1(c) NV50_DISP_WNDW_SEM1(0 + (c)) 241590700dSBen Skeggs #define NV50_DISP_BASE_NTFY(c) NV50_DISP_WNDW_NTFY(0 + (c)) 252ce7f386SBen Skeggs #define NV50_DISP_OVLY_SEM0(c) NV50_DISP_WNDW_SEM0(4 + (c)) 262ce7f386SBen Skeggs #define NV50_DISP_OVLY_SEM1(c) NV50_DISP_WNDW_SEM1(4 + (c)) 272ce7f386SBen Skeggs #define NV50_DISP_OVLY_NTFY(c) NV50_DISP_WNDW_NTFY(4 + (c)) 281590700dSBen Skeggs struct nouveau_bo *sync; 291590700dSBen Skeggs 301590700dSBen Skeggs struct mutex mutex; 311590700dSBen Skeggs }; 321590700dSBen Skeggs 331590700dSBen Skeggs static inline struct nv50_disp * 341590700dSBen Skeggs nv50_disp(struct drm_device *dev) 351590700dSBen Skeggs { 361590700dSBen Skeggs return nouveau_display(dev)->priv; 371590700dSBen Skeggs } 381590700dSBen Skeggs 3953e0a3e7SBen Skeggs struct nv50_disp_interlock { 4053e0a3e7SBen Skeggs enum nv50_disp_interlock_type { 4153e0a3e7SBen Skeggs NV50_DISP_INTERLOCK_CORE = 0, 4253e0a3e7SBen Skeggs NV50_DISP_INTERLOCK_CURS, 4353e0a3e7SBen Skeggs NV50_DISP_INTERLOCK_BASE, 4453e0a3e7SBen Skeggs NV50_DISP_INTERLOCK_OVLY, 45facaed62SBen Skeggs NV50_DISP_INTERLOCK_WNDW, 46facaed62SBen Skeggs NV50_DISP_INTERLOCK_WIMM, 4753e0a3e7SBen Skeggs NV50_DISP_INTERLOCK__SIZE 4853e0a3e7SBen Skeggs } type; 4953e0a3e7SBen Skeggs u32 data; 50d2434e4dSBen Skeggs u32 wimm; 5153e0a3e7SBen Skeggs }; 5253e0a3e7SBen Skeggs 53facaed62SBen Skeggs void corec37d_ntfy_init(struct nouveau_bo *, u32); 54facaed62SBen Skeggs 55cb55cd0cSBen Skeggs void head907d_olut_load(struct drm_color_lut *, int size, void __iomem *); 56cb55cd0cSBen Skeggs 571590700dSBen Skeggs struct nv50_chan { 581590700dSBen Skeggs struct nvif_object user; 591590700dSBen Skeggs struct nvif_device *device; 601590700dSBen Skeggs }; 611590700dSBen Skeggs 621590700dSBen Skeggs struct nv50_dmac { 631590700dSBen Skeggs struct nv50_chan base; 641590700dSBen Skeggs 652853ccf0SBen Skeggs struct nvif_push _push; 662853ccf0SBen Skeggs struct nvif_push *push; 671590700dSBen Skeggs u32 *ptr; 681590700dSBen Skeggs 691590700dSBen Skeggs struct nvif_object sync; 701590700dSBen Skeggs struct nvif_object vram; 711590700dSBen Skeggs 721590700dSBen Skeggs /* Protects against concurrent pushbuf access to this channel, lock is 731590700dSBen Skeggs * grabbed by evo_wait (if the pushbuf reservation is successful) and 741590700dSBen Skeggs * dropped again by evo_kick. */ 751590700dSBen Skeggs struct mutex lock; 76*0a960996SBen Skeggs 77*0a960996SBen Skeggs u32 cur; 78*0a960996SBen Skeggs u32 put; 79*0a960996SBen Skeggs u32 max; 801590700dSBen Skeggs }; 811590700dSBen Skeggs 82ebec8847SLyude Paul struct nv50_outp_atom { 83ebec8847SLyude Paul struct list_head head; 84ebec8847SLyude Paul 85ebec8847SLyude Paul struct drm_encoder *encoder; 86ebec8847SLyude Paul bool flush_disable; 87ebec8847SLyude Paul 88ebec8847SLyude Paul union nv50_outp_atom_mask { 89ebec8847SLyude Paul struct { 90ebec8847SLyude Paul bool ctrl:1; 91ebec8847SLyude Paul }; 92ebec8847SLyude Paul u8 mask; 93ebec8847SLyude Paul } set, clr; 94ebec8847SLyude Paul }; 95ebec8847SLyude Paul 961590700dSBen Skeggs int nv50_dmac_create(struct nvif_device *device, struct nvif_object *disp, 971590700dSBen Skeggs const s32 *oclass, u8 head, void *data, u32 size, 981590700dSBen Skeggs u64 syncbuf, struct nv50_dmac *dmac); 991590700dSBen Skeggs void nv50_dmac_destroy(struct nv50_dmac *); 1001590700dSBen Skeggs 10112885ecbSLyude Paul /* 10212885ecbSLyude Paul * For normal encoders this just returns the encoder. For active MST encoders, 10312885ecbSLyude Paul * this returns the real outp that's driving displays on the topology. 10412885ecbSLyude Paul * Inactive MST encoders return NULL, since they would have no real outp to 10512885ecbSLyude Paul * return anyway. 10612885ecbSLyude Paul */ 10712885ecbSLyude Paul struct nouveau_encoder *nv50_real_outp(struct drm_encoder *encoder); 10812885ecbSLyude Paul 1091590700dSBen Skeggs u32 *evo_wait(struct nv50_dmac *, int nr); 1101590700dSBen Skeggs void evo_kick(u32 *, struct nv50_dmac *); 1111590700dSBen Skeggs 112c586f30bSJames Jones extern const u64 disp50xx_modifiers[]; 113c586f30bSJames Jones extern const u64 disp90xx_modifiers[]; 114c586f30bSJames Jones extern const u64 wndwc57e_modifiers[]; 1151590700dSBen Skeggs #endif 116