162306a36Sopenharmony_ci#ifndef __NV50_KMS_WNDW_H__ 262306a36Sopenharmony_ci#define __NV50_KMS_WNDW_H__ 362306a36Sopenharmony_ci#define nv50_wndw(p) container_of((p), struct nv50_wndw, plane) 462306a36Sopenharmony_ci#include "disp.h" 562306a36Sopenharmony_ci#include "atom.h" 662306a36Sopenharmony_ci#include "lut.h" 762306a36Sopenharmony_ci 862306a36Sopenharmony_cistruct nv50_wndw_ctxdma { 962306a36Sopenharmony_ci struct list_head head; 1062306a36Sopenharmony_ci struct nvif_object object; 1162306a36Sopenharmony_ci}; 1262306a36Sopenharmony_ci 1362306a36Sopenharmony_cistruct nv50_wndw { 1462306a36Sopenharmony_ci const struct nv50_wndw_func *func; 1562306a36Sopenharmony_ci const struct nv50_wimm_func *immd; 1662306a36Sopenharmony_ci int id; 1762306a36Sopenharmony_ci struct nv50_disp_interlock interlock; 1862306a36Sopenharmony_ci 1962306a36Sopenharmony_ci struct { 2062306a36Sopenharmony_ci struct nvif_object *parent; 2162306a36Sopenharmony_ci struct list_head list; 2262306a36Sopenharmony_ci } ctxdma; 2362306a36Sopenharmony_ci 2462306a36Sopenharmony_ci struct drm_plane plane; 2562306a36Sopenharmony_ci 2662306a36Sopenharmony_ci struct nv50_lut ilut; 2762306a36Sopenharmony_ci 2862306a36Sopenharmony_ci struct nv50_dmac wndw; 2962306a36Sopenharmony_ci struct nv50_dmac wimm; 3062306a36Sopenharmony_ci 3162306a36Sopenharmony_ci u16 ntfy; 3262306a36Sopenharmony_ci u16 sema; 3362306a36Sopenharmony_ci u32 data; 3462306a36Sopenharmony_ci}; 3562306a36Sopenharmony_ci 3662306a36Sopenharmony_ciint nv50_wndw_new_(const struct nv50_wndw_func *, struct drm_device *, 3762306a36Sopenharmony_ci enum drm_plane_type, const char *name, int index, 3862306a36Sopenharmony_ci const u32 *format, u32 heads, 3962306a36Sopenharmony_ci enum nv50_disp_interlock_type, u32 interlock_data, 4062306a36Sopenharmony_ci struct nv50_wndw **); 4162306a36Sopenharmony_civoid nv50_wndw_flush_set(struct nv50_wndw *, u32 *interlock, 4262306a36Sopenharmony_ci struct nv50_wndw_atom *); 4362306a36Sopenharmony_civoid nv50_wndw_flush_clr(struct nv50_wndw *, u32 *interlock, bool flush, 4462306a36Sopenharmony_ci struct nv50_wndw_atom *); 4562306a36Sopenharmony_civoid nv50_wndw_ntfy_enable(struct nv50_wndw *, struct nv50_wndw_atom *); 4662306a36Sopenharmony_ciint nv50_wndw_wait_armed(struct nv50_wndw *, struct nv50_wndw_atom *); 4762306a36Sopenharmony_ci 4862306a36Sopenharmony_cistruct nv50_wndw_func { 4962306a36Sopenharmony_ci int (*acquire)(struct nv50_wndw *, struct nv50_wndw_atom *asyw, 5062306a36Sopenharmony_ci struct nv50_head_atom *asyh); 5162306a36Sopenharmony_ci void (*release)(struct nv50_wndw *, struct nv50_wndw_atom *asyw, 5262306a36Sopenharmony_ci struct nv50_head_atom *asyh); 5362306a36Sopenharmony_ci void (*prepare)(struct nv50_wndw *, struct nv50_head_atom *asyh, 5462306a36Sopenharmony_ci struct nv50_wndw_atom *asyw); 5562306a36Sopenharmony_ci 5662306a36Sopenharmony_ci int (*sema_set)(struct nv50_wndw *, struct nv50_wndw_atom *); 5762306a36Sopenharmony_ci int (*sema_clr)(struct nv50_wndw *); 5862306a36Sopenharmony_ci void (*ntfy_reset)(struct nouveau_bo *, u32 offset); 5962306a36Sopenharmony_ci int (*ntfy_set)(struct nv50_wndw *, struct nv50_wndw_atom *); 6062306a36Sopenharmony_ci int (*ntfy_clr)(struct nv50_wndw *); 6162306a36Sopenharmony_ci int (*ntfy_wait_begun)(struct nouveau_bo *, u32 offset, 6262306a36Sopenharmony_ci struct nvif_device *); 6362306a36Sopenharmony_ci void (*ilut)(struct nv50_wndw *wndw, struct nv50_wndw_atom *asyh, int size); 6462306a36Sopenharmony_ci void (*csc)(struct nv50_wndw *, struct nv50_wndw_atom *, 6562306a36Sopenharmony_ci const struct drm_color_ctm *); 6662306a36Sopenharmony_ci int (*csc_set)(struct nv50_wndw *, struct nv50_wndw_atom *); 6762306a36Sopenharmony_ci int (*csc_clr)(struct nv50_wndw *); 6862306a36Sopenharmony_ci bool ilut_identity; 6962306a36Sopenharmony_ci int ilut_size; 7062306a36Sopenharmony_ci bool olut_core; 7162306a36Sopenharmony_ci int (*xlut_set)(struct nv50_wndw *, struct nv50_wndw_atom *); 7262306a36Sopenharmony_ci int (*xlut_clr)(struct nv50_wndw *); 7362306a36Sopenharmony_ci int (*image_set)(struct nv50_wndw *, struct nv50_wndw_atom *); 7462306a36Sopenharmony_ci int (*image_clr)(struct nv50_wndw *); 7562306a36Sopenharmony_ci int (*scale_set)(struct nv50_wndw *, struct nv50_wndw_atom *); 7662306a36Sopenharmony_ci int (*blend_set)(struct nv50_wndw *, struct nv50_wndw_atom *); 7762306a36Sopenharmony_ci 7862306a36Sopenharmony_ci int (*update)(struct nv50_wndw *, u32 *interlock); 7962306a36Sopenharmony_ci}; 8062306a36Sopenharmony_ci 8162306a36Sopenharmony_ciextern const struct drm_plane_funcs nv50_wndw; 8262306a36Sopenharmony_ci 8362306a36Sopenharmony_civoid base507c_ntfy_reset(struct nouveau_bo *, u32); 8462306a36Sopenharmony_ciint base507c_ntfy_set(struct nv50_wndw *, struct nv50_wndw_atom *); 8562306a36Sopenharmony_ciint base507c_ntfy_clr(struct nv50_wndw *); 8662306a36Sopenharmony_ciint base507c_ntfy_wait_begun(struct nouveau_bo *, u32, struct nvif_device *); 8762306a36Sopenharmony_ciint base507c_image_clr(struct nv50_wndw *); 8862306a36Sopenharmony_ciint base507c_update(struct nv50_wndw *, u32 *); 8962306a36Sopenharmony_ci 9062306a36Sopenharmony_civoid base907c_csc(struct nv50_wndw *, struct nv50_wndw_atom *, 9162306a36Sopenharmony_ci const struct drm_color_ctm *); 9262306a36Sopenharmony_ci 9362306a36Sopenharmony_cistruct nv50_wimm_func { 9462306a36Sopenharmony_ci int (*point)(struct nv50_wndw *, struct nv50_wndw_atom *); 9562306a36Sopenharmony_ci 9662306a36Sopenharmony_ci int (*update)(struct nv50_wndw *, u32 *interlock); 9762306a36Sopenharmony_ci}; 9862306a36Sopenharmony_ci 9962306a36Sopenharmony_ciextern const struct nv50_wimm_func curs507a; 10062306a36Sopenharmony_cibool curs507a_space(struct nv50_wndw *); 10162306a36Sopenharmony_ci 10262306a36Sopenharmony_cistatic inline __must_check int 10362306a36Sopenharmony_cinvif_chan_wait(struct nv50_dmac *dmac, u32 size) 10462306a36Sopenharmony_ci{ 10562306a36Sopenharmony_ci struct nv50_wndw *wndw = container_of(dmac, typeof(*wndw), wimm); 10662306a36Sopenharmony_ci return curs507a_space(wndw) ? 0 : -ETIMEDOUT; 10762306a36Sopenharmony_ci} 10862306a36Sopenharmony_ci 10962306a36Sopenharmony_ciint wndwc37e_new(struct nouveau_drm *, enum drm_plane_type, int, s32, 11062306a36Sopenharmony_ci struct nv50_wndw **); 11162306a36Sopenharmony_ciint wndwc37e_new_(const struct nv50_wndw_func *, struct nouveau_drm *, 11262306a36Sopenharmony_ci enum drm_plane_type type, int index, s32 oclass, u32 heads, 11362306a36Sopenharmony_ci struct nv50_wndw **); 11462306a36Sopenharmony_ciint wndwc37e_acquire(struct nv50_wndw *, struct nv50_wndw_atom *, 11562306a36Sopenharmony_ci struct nv50_head_atom *); 11662306a36Sopenharmony_civoid wndwc37e_release(struct nv50_wndw *, struct nv50_wndw_atom *, 11762306a36Sopenharmony_ci struct nv50_head_atom *); 11862306a36Sopenharmony_ciint wndwc37e_sema_set(struct nv50_wndw *, struct nv50_wndw_atom *); 11962306a36Sopenharmony_ciint wndwc37e_sema_clr(struct nv50_wndw *); 12062306a36Sopenharmony_ciint wndwc37e_ntfy_set(struct nv50_wndw *, struct nv50_wndw_atom *); 12162306a36Sopenharmony_ciint wndwc37e_ntfy_clr(struct nv50_wndw *); 12262306a36Sopenharmony_ciint wndwc37e_image_clr(struct nv50_wndw *); 12362306a36Sopenharmony_ciint wndwc37e_blend_set(struct nv50_wndw *, struct nv50_wndw_atom *); 12462306a36Sopenharmony_ciint wndwc37e_update(struct nv50_wndw *, u32 *); 12562306a36Sopenharmony_ci 12662306a36Sopenharmony_ciint wndwc57e_new(struct nouveau_drm *, enum drm_plane_type, int, s32, 12762306a36Sopenharmony_ci struct nv50_wndw **); 12862306a36Sopenharmony_civoid wndwc57e_ilut(struct nv50_wndw *, struct nv50_wndw_atom *, int); 12962306a36Sopenharmony_ciint wndwc57e_ilut_set(struct nv50_wndw *, struct nv50_wndw_atom *); 13062306a36Sopenharmony_ciint wndwc57e_ilut_clr(struct nv50_wndw *); 13162306a36Sopenharmony_ciint wndwc57e_csc_set(struct nv50_wndw *, struct nv50_wndw_atom *); 13262306a36Sopenharmony_ciint wndwc57e_csc_clr(struct nv50_wndw *); 13362306a36Sopenharmony_ci 13462306a36Sopenharmony_ciint wndwc67e_new(struct nouveau_drm *, enum drm_plane_type, int, s32, 13562306a36Sopenharmony_ci struct nv50_wndw **); 13662306a36Sopenharmony_ci 13762306a36Sopenharmony_ciint nv50_wndw_new(struct nouveau_drm *, enum drm_plane_type, int index, 13862306a36Sopenharmony_ci struct nv50_wndw **); 13962306a36Sopenharmony_ci#endif 140