1 1.1 riastrad /* $NetBSD: wndw.h,v 1.2 2021/12/18 23:45:32 riastradh Exp $ */ 2 1.1 riastrad 3 1.1 riastrad #ifndef __NV50_KMS_WNDW_H__ 4 1.1 riastrad #define __NV50_KMS_WNDW_H__ 5 1.1 riastrad #define nv50_wndw(p) container_of((p), struct nv50_wndw, plane) 6 1.1 riastrad #include "disp.h" 7 1.1 riastrad #include "atom.h" 8 1.1 riastrad #include "lut.h" 9 1.1 riastrad 10 1.1 riastrad #include <nvif/notify.h> 11 1.1 riastrad 12 1.1 riastrad struct nv50_wndw_ctxdma { 13 1.1 riastrad struct list_head head; 14 1.1 riastrad struct nvif_object object; 15 1.1 riastrad }; 16 1.1 riastrad 17 1.1 riastrad struct nv50_wndw { 18 1.1 riastrad const struct nv50_wndw_func *func; 19 1.1 riastrad const struct nv50_wimm_func *immd; 20 1.1 riastrad int id; 21 1.1 riastrad struct nv50_disp_interlock interlock; 22 1.1 riastrad 23 1.1 riastrad struct { 24 1.1 riastrad struct nvif_object *parent; 25 1.1 riastrad struct list_head list; 26 1.1 riastrad } ctxdma; 27 1.1 riastrad 28 1.1 riastrad struct drm_plane plane; 29 1.1 riastrad 30 1.1 riastrad struct nv50_lut ilut; 31 1.1 riastrad 32 1.1 riastrad struct nv50_dmac wndw; 33 1.1 riastrad struct nv50_dmac wimm; 34 1.1 riastrad 35 1.1 riastrad struct nvif_notify notify; 36 1.1 riastrad u16 ntfy; 37 1.1 riastrad u16 sema; 38 1.1 riastrad u32 data; 39 1.1 riastrad }; 40 1.1 riastrad 41 1.1 riastrad int nv50_wndw_new_(const struct nv50_wndw_func *, struct drm_device *, 42 1.1 riastrad enum drm_plane_type, const char *name, int index, 43 1.1 riastrad const u32 *format, enum nv50_disp_interlock_type, 44 1.1 riastrad u32 interlock_data, u32 heads, struct nv50_wndw **); 45 1.1 riastrad void nv50_wndw_init(struct nv50_wndw *); 46 1.1 riastrad void nv50_wndw_fini(struct nv50_wndw *); 47 1.1 riastrad void nv50_wndw_flush_set(struct nv50_wndw *, u32 *interlock, 48 1.1 riastrad struct nv50_wndw_atom *); 49 1.1 riastrad void nv50_wndw_flush_clr(struct nv50_wndw *, u32 *interlock, bool flush, 50 1.1 riastrad struct nv50_wndw_atom *); 51 1.1 riastrad void nv50_wndw_ntfy_enable(struct nv50_wndw *, struct nv50_wndw_atom *); 52 1.1 riastrad int nv50_wndw_wait_armed(struct nv50_wndw *, struct nv50_wndw_atom *); 53 1.1 riastrad 54 1.1 riastrad struct nv50_wndw_func { 55 1.1 riastrad int (*acquire)(struct nv50_wndw *, struct nv50_wndw_atom *asyw, 56 1.1 riastrad struct nv50_head_atom *asyh); 57 1.1 riastrad void (*release)(struct nv50_wndw *, struct nv50_wndw_atom *asyw, 58 1.1 riastrad struct nv50_head_atom *asyh); 59 1.1 riastrad void (*prepare)(struct nv50_wndw *, struct nv50_head_atom *asyh, 60 1.1 riastrad struct nv50_wndw_atom *asyw); 61 1.1 riastrad 62 1.1 riastrad void (*sema_set)(struct nv50_wndw *, struct nv50_wndw_atom *); 63 1.1 riastrad void (*sema_clr)(struct nv50_wndw *); 64 1.1 riastrad void (*ntfy_reset)(struct nouveau_bo *, u32 offset); 65 1.1 riastrad void (*ntfy_set)(struct nv50_wndw *, struct nv50_wndw_atom *); 66 1.1 riastrad void (*ntfy_clr)(struct nv50_wndw *); 67 1.1 riastrad int (*ntfy_wait_begun)(struct nouveau_bo *, u32 offset, 68 1.1 riastrad struct nvif_device *); 69 1.1 riastrad bool (*ilut)(struct nv50_wndw *, struct nv50_wndw_atom *, int); 70 1.1 riastrad void (*csc)(struct nv50_wndw *, struct nv50_wndw_atom *, 71 1.1 riastrad const struct drm_color_ctm *); 72 1.1 riastrad void (*csc_set)(struct nv50_wndw *, struct nv50_wndw_atom *); 73 1.1 riastrad void (*csc_clr)(struct nv50_wndw *); 74 1.1 riastrad bool ilut_identity; 75 1.1 riastrad int ilut_size; 76 1.1 riastrad bool olut_core; 77 1.1 riastrad void (*xlut_set)(struct nv50_wndw *, struct nv50_wndw_atom *); 78 1.1 riastrad void (*xlut_clr)(struct nv50_wndw *); 79 1.1 riastrad void (*image_set)(struct nv50_wndw *, struct nv50_wndw_atom *); 80 1.1 riastrad void (*image_clr)(struct nv50_wndw *); 81 1.1 riastrad void (*scale_set)(struct nv50_wndw *, struct nv50_wndw_atom *); 82 1.1 riastrad void (*blend_set)(struct nv50_wndw *, struct nv50_wndw_atom *); 83 1.1 riastrad 84 1.1 riastrad void (*update)(struct nv50_wndw *, u32 *interlock); 85 1.1 riastrad }; 86 1.1 riastrad 87 1.1 riastrad extern const struct drm_plane_funcs nv50_wndw; 88 1.1 riastrad 89 1.1 riastrad void base507c_ntfy_reset(struct nouveau_bo *, u32); 90 1.1 riastrad int base507c_ntfy_wait_begun(struct nouveau_bo *, u32, struct nvif_device *); 91 1.1 riastrad 92 1.1 riastrad void base907c_csc(struct nv50_wndw *, struct nv50_wndw_atom *, 93 1.1 riastrad const struct drm_color_ctm *); 94 1.1 riastrad 95 1.1 riastrad struct nv50_wimm_func { 96 1.1 riastrad void (*point)(struct nv50_wndw *, struct nv50_wndw_atom *); 97 1.1 riastrad 98 1.1 riastrad void (*update)(struct nv50_wndw *, u32 *interlock); 99 1.1 riastrad }; 100 1.1 riastrad 101 1.1 riastrad extern const struct nv50_wimm_func curs507a; 102 1.1 riastrad 103 1.1 riastrad int wndwc37e_new(struct nouveau_drm *, enum drm_plane_type, int, s32, 104 1.1 riastrad struct nv50_wndw **); 105 1.1 riastrad int wndwc37e_new_(const struct nv50_wndw_func *, struct nouveau_drm *, 106 1.1 riastrad enum drm_plane_type type, int index, s32 oclass, u32 heads, 107 1.1 riastrad struct nv50_wndw **); 108 1.1 riastrad int wndwc37e_acquire(struct nv50_wndw *, struct nv50_wndw_atom *, 109 1.1 riastrad struct nv50_head_atom *); 110 1.1 riastrad void wndwc37e_release(struct nv50_wndw *, struct nv50_wndw_atom *, 111 1.1 riastrad struct nv50_head_atom *); 112 1.1 riastrad void wndwc37e_sema_set(struct nv50_wndw *, struct nv50_wndw_atom *); 113 1.1 riastrad void wndwc37e_sema_clr(struct nv50_wndw *); 114 1.1 riastrad void wndwc37e_ntfy_set(struct nv50_wndw *, struct nv50_wndw_atom *); 115 1.1 riastrad void wndwc37e_ntfy_clr(struct nv50_wndw *); 116 1.1 riastrad void wndwc37e_image_clr(struct nv50_wndw *); 117 1.1 riastrad void wndwc37e_blend_set(struct nv50_wndw *, struct nv50_wndw_atom *); 118 1.1 riastrad void wndwc37e_update(struct nv50_wndw *, u32 *); 119 1.1 riastrad 120 1.1 riastrad int wndwc57e_new(struct nouveau_drm *, enum drm_plane_type, int, s32, 121 1.1 riastrad struct nv50_wndw **); 122 1.1 riastrad 123 1.1 riastrad int nv50_wndw_new(struct nouveau_drm *, enum drm_plane_type, int index, 124 1.1 riastrad struct nv50_wndw **); 125 1.1 riastrad #endif 126