11590700dSBen Skeggs #ifndef __NV50_KMS_H__ 21590700dSBen Skeggs #define __NV50_KMS_H__ 31590700dSBen Skeggs #include <nvif/mem.h> 41590700dSBen Skeggs 51590700dSBen Skeggs #include "nouveau_display.h" 61590700dSBen Skeggs 71590700dSBen Skeggs struct nv50_disp { 81590700dSBen Skeggs struct nvif_disp *disp; 91590700dSBen Skeggs struct nv50_core *core; 101590700dSBen Skeggs 111590700dSBen Skeggs #define NV50_DISP_SYNC(c, o) ((c) * 0x040 + (o)) 121590700dSBen Skeggs #define NV50_DISP_CORE_NTFY NV50_DISP_SYNC(0 , 0x00) 131590700dSBen Skeggs #define NV50_DISP_WNDW_SEM0(c) NV50_DISP_SYNC(1 + (c), 0x00) 141590700dSBen Skeggs #define NV50_DISP_WNDW_SEM1(c) NV50_DISP_SYNC(1 + (c), 0x10) 151590700dSBen Skeggs #define NV50_DISP_WNDW_NTFY(c) NV50_DISP_SYNC(1 + (c), 0x20) 161590700dSBen Skeggs #define NV50_DISP_BASE_SEM0(c) NV50_DISP_WNDW_SEM0(0 + (c)) 171590700dSBen Skeggs #define NV50_DISP_BASE_SEM1(c) NV50_DISP_WNDW_SEM1(0 + (c)) 181590700dSBen Skeggs #define NV50_DISP_BASE_NTFY(c) NV50_DISP_WNDW_NTFY(0 + (c)) 19*2ce7f386SBen Skeggs #define NV50_DISP_OVLY_SEM0(c) NV50_DISP_WNDW_SEM0(4 + (c)) 20*2ce7f386SBen Skeggs #define NV50_DISP_OVLY_SEM1(c) NV50_DISP_WNDW_SEM1(4 + (c)) 21*2ce7f386SBen Skeggs #define NV50_DISP_OVLY_NTFY(c) NV50_DISP_WNDW_NTFY(4 + (c)) 221590700dSBen Skeggs struct nouveau_bo *sync; 231590700dSBen Skeggs 241590700dSBen Skeggs struct mutex mutex; 251590700dSBen Skeggs }; 261590700dSBen Skeggs 271590700dSBen Skeggs static inline struct nv50_disp * 281590700dSBen Skeggs nv50_disp(struct drm_device *dev) 291590700dSBen Skeggs { 301590700dSBen Skeggs return nouveau_display(dev)->priv; 311590700dSBen Skeggs } 321590700dSBen Skeggs 3353e0a3e7SBen Skeggs struct nv50_disp_interlock { 3453e0a3e7SBen Skeggs enum nv50_disp_interlock_type { 3553e0a3e7SBen Skeggs NV50_DISP_INTERLOCK_CORE = 0, 3653e0a3e7SBen Skeggs NV50_DISP_INTERLOCK_CURS, 3753e0a3e7SBen Skeggs NV50_DISP_INTERLOCK_BASE, 3853e0a3e7SBen Skeggs NV50_DISP_INTERLOCK_OVLY, 3953e0a3e7SBen Skeggs NV50_DISP_INTERLOCK__SIZE 4053e0a3e7SBen Skeggs } type; 4153e0a3e7SBen Skeggs u32 data; 4253e0a3e7SBen Skeggs }; 4353e0a3e7SBen Skeggs 441590700dSBen Skeggs struct nv50_chan { 451590700dSBen Skeggs struct nvif_object user; 461590700dSBen Skeggs struct nvif_device *device; 471590700dSBen Skeggs }; 481590700dSBen Skeggs 491590700dSBen Skeggs struct nv50_dmac { 501590700dSBen Skeggs struct nv50_chan base; 511590700dSBen Skeggs 521590700dSBen Skeggs struct nvif_mem push; 531590700dSBen Skeggs u32 *ptr; 541590700dSBen Skeggs 551590700dSBen Skeggs struct nvif_object sync; 561590700dSBen Skeggs struct nvif_object vram; 571590700dSBen Skeggs 581590700dSBen Skeggs /* Protects against concurrent pushbuf access to this channel, lock is 591590700dSBen Skeggs * grabbed by evo_wait (if the pushbuf reservation is successful) and 601590700dSBen Skeggs * dropped again by evo_kick. */ 611590700dSBen Skeggs struct mutex lock; 621590700dSBen Skeggs }; 631590700dSBen Skeggs 641590700dSBen Skeggs int nv50_dmac_create(struct nvif_device *device, struct nvif_object *disp, 651590700dSBen Skeggs const s32 *oclass, u8 head, void *data, u32 size, 661590700dSBen Skeggs u64 syncbuf, struct nv50_dmac *dmac); 671590700dSBen Skeggs void nv50_dmac_destroy(struct nv50_dmac *); 681590700dSBen Skeggs 691590700dSBen Skeggs u32 *evo_wait(struct nv50_dmac *, int nr); 701590700dSBen Skeggs void evo_kick(u32 *, struct nv50_dmac *); 711590700dSBen Skeggs 721590700dSBen Skeggs #define evo_mthd(p, m, s) do { \ 731590700dSBen Skeggs const u32 _m = (m), _s = (s); \ 741590700dSBen Skeggs if (drm_debug & DRM_UT_KMS) \ 751590700dSBen Skeggs pr_err("%04x %d %s\n", _m, _s, __func__); \ 761590700dSBen Skeggs *((p)++) = ((_s << 18) | _m); \ 771590700dSBen Skeggs } while(0) 781590700dSBen Skeggs 791590700dSBen Skeggs #define evo_data(p, d) do { \ 801590700dSBen Skeggs const u32 _d = (d); \ 811590700dSBen Skeggs if (drm_debug & DRM_UT_KMS) \ 821590700dSBen Skeggs pr_err("\t%08x\n", _d); \ 831590700dSBen Skeggs *((p)++) = _d; \ 841590700dSBen Skeggs } while(0) 851590700dSBen Skeggs #endif 86