1 1.3 riastrad /* $NetBSD: disp.h,v 1.3 2021/12/19 10:49:47 riastradh Exp $ */ 2 1.1 riastrad 3 1.1 riastrad #ifndef __NV50_KMS_H__ 4 1.1 riastrad #define __NV50_KMS_H__ 5 1.1 riastrad #include <nvif/mem.h> 6 1.1 riastrad 7 1.1 riastrad #include "nouveau_display.h" 8 1.1 riastrad 9 1.1 riastrad struct nv50_msto; 10 1.1 riastrad 11 1.1 riastrad struct nv50_disp { 12 1.1 riastrad struct nvif_disp *disp; 13 1.1 riastrad struct nv50_core *core; 14 1.1 riastrad 15 1.1 riastrad #define NV50_DISP_SYNC(c, o) ((c) * 0x040 + (o)) 16 1.1 riastrad #define NV50_DISP_CORE_NTFY NV50_DISP_SYNC(0 , 0x00) 17 1.1 riastrad #define NV50_DISP_WNDW_SEM0(c) NV50_DISP_SYNC(1 + (c), 0x00) 18 1.1 riastrad #define NV50_DISP_WNDW_SEM1(c) NV50_DISP_SYNC(1 + (c), 0x10) 19 1.1 riastrad #define NV50_DISP_WNDW_NTFY(c) NV50_DISP_SYNC(1 + (c), 0x20) 20 1.1 riastrad #define NV50_DISP_BASE_SEM0(c) NV50_DISP_WNDW_SEM0(0 + (c)) 21 1.1 riastrad #define NV50_DISP_BASE_SEM1(c) NV50_DISP_WNDW_SEM1(0 + (c)) 22 1.1 riastrad #define NV50_DISP_BASE_NTFY(c) NV50_DISP_WNDW_NTFY(0 + (c)) 23 1.1 riastrad #define NV50_DISP_OVLY_SEM0(c) NV50_DISP_WNDW_SEM0(4 + (c)) 24 1.1 riastrad #define NV50_DISP_OVLY_SEM1(c) NV50_DISP_WNDW_SEM1(4 + (c)) 25 1.1 riastrad #define NV50_DISP_OVLY_NTFY(c) NV50_DISP_WNDW_NTFY(4 + (c)) 26 1.1 riastrad struct nouveau_bo *sync; 27 1.1 riastrad 28 1.1 riastrad struct mutex mutex; 29 1.1 riastrad }; 30 1.1 riastrad 31 1.1 riastrad static inline struct nv50_disp * 32 1.1 riastrad nv50_disp(struct drm_device *dev) 33 1.1 riastrad { 34 1.1 riastrad return nouveau_display(dev)->priv; 35 1.1 riastrad } 36 1.1 riastrad 37 1.1 riastrad struct nv50_disp_interlock { 38 1.1 riastrad enum nv50_disp_interlock_type { 39 1.1 riastrad NV50_DISP_INTERLOCK_CORE = 0, 40 1.1 riastrad NV50_DISP_INTERLOCK_CURS, 41 1.1 riastrad NV50_DISP_INTERLOCK_BASE, 42 1.1 riastrad NV50_DISP_INTERLOCK_OVLY, 43 1.1 riastrad NV50_DISP_INTERLOCK_WNDW, 44 1.1 riastrad NV50_DISP_INTERLOCK_WIMM, 45 1.1 riastrad NV50_DISP_INTERLOCK__SIZE 46 1.1 riastrad } type; 47 1.1 riastrad u32 data; 48 1.1 riastrad u32 wimm; 49 1.1 riastrad }; 50 1.1 riastrad 51 1.1 riastrad void corec37d_ntfy_init(struct nouveau_bo *, u32); 52 1.1 riastrad 53 1.3 riastrad #ifdef __NetBSD__ 54 1.3 riastrad # define __lut_iomem volatile 55 1.3 riastrad # define __iomem __lut_iomem 56 1.3 riastrad #endif 57 1.3 riastrad 58 1.1 riastrad void head907d_olut_load(struct drm_color_lut *, int size, void __iomem *); 59 1.1 riastrad 60 1.3 riastrad #ifdef __NetBSD__ 61 1.3 riastrad # undef __iomem 62 1.3 riastrad #endif 63 1.3 riastrad 64 1.1 riastrad struct nv50_chan { 65 1.1 riastrad struct nvif_object user; 66 1.1 riastrad struct nvif_device *device; 67 1.1 riastrad }; 68 1.1 riastrad 69 1.1 riastrad struct nv50_dmac { 70 1.1 riastrad struct nv50_chan base; 71 1.1 riastrad 72 1.1 riastrad struct nvif_mem push; 73 1.1 riastrad u32 *ptr; 74 1.1 riastrad 75 1.1 riastrad struct nvif_object sync; 76 1.1 riastrad struct nvif_object vram; 77 1.1 riastrad 78 1.1 riastrad /* Protects against concurrent pushbuf access to this channel, lock is 79 1.1 riastrad * grabbed by evo_wait (if the pushbuf reservation is successful) and 80 1.1 riastrad * dropped again by evo_kick. */ 81 1.2 riastrad struct spinlock lock; 82 1.1 riastrad }; 83 1.1 riastrad 84 1.1 riastrad int nv50_dmac_create(struct nvif_device *device, struct nvif_object *disp, 85 1.1 riastrad const s32 *oclass, u8 head, void *data, u32 size, 86 1.1 riastrad u64 syncbuf, struct nv50_dmac *dmac); 87 1.1 riastrad void nv50_dmac_destroy(struct nv50_dmac *); 88 1.1 riastrad 89 1.1 riastrad u32 *evo_wait(struct nv50_dmac *, int nr); 90 1.1 riastrad void evo_kick(u32 *, struct nv50_dmac *); 91 1.1 riastrad 92 1.1 riastrad #define evo_mthd(p, m, s) do { \ 93 1.1 riastrad const u32 _m = (m), _s = (s); \ 94 1.1 riastrad if (drm_debug_enabled(DRM_UT_KMS)) \ 95 1.1 riastrad pr_err("%04x %d %s\n", _m, _s, __func__); \ 96 1.1 riastrad *((p)++) = ((_s << 18) | _m); \ 97 1.1 riastrad } while(0) 98 1.1 riastrad 99 1.1 riastrad #define evo_data(p, d) do { \ 100 1.1 riastrad const u32 _d = (d); \ 101 1.1 riastrad if (drm_debug_enabled(DRM_UT_KMS)) \ 102 1.1 riastrad pr_err("\t%08x\n", _d); \ 103 1.1 riastrad *((p)++) = _d; \ 104 1.1 riastrad } while(0) 105 1.1 riastrad #endif 106