drm/nouveau/kms/gf119-: add ctm property support
Subsystems (3)
PATCH v2 1/1 drm/nouveau/kms/gf119-: add ctm property support
This adds support on GF119:GV100 (exclusive) for CTM (aka CSC).
Signed-off-by Ilia Mirkin <[email protected]>
---
v1 -> v2:
- ctm -> csc
- mark csc.valid = false when there is no ctm property
drivers/gpu/drm/nouveau/dispnv50/atom.h | 6 ++ drivers/gpu/drm/nouveau/dispnv50/base907c.c | 65 +++++++++++++++++++++ drivers/gpu/drm/nouveau/dispnv50/wndw.c | 16 +++++ drivers/gpu/drm/nouveau/dispnv50/wndw.h | 4 ++ 4 files changed, 91 insertions(+)
drivers/gpu/drm/nouveau/dispnv50/atom.h +6 -0
@@ -184,6 +184,11 @@ struct nv50_wndw_atom { } i; } xlut; +struct { +u32 matrix[12 ]; +bool valid; + } csc; +struct {u8 mode:2 ;u8 interval:4 ;
@@ -221,6 +226,7 @@ struct nv50_wndw_atom { bool ntfy:1; bool sema:1; bool xlut:1; + bool csc:1; bool image:1; bool scale:1; bool point:1;
drivers/gpu/drm/nouveau/dispnv50/base907c.c +65 -0
77 lines not on this page · raw message
drivers/gpu/drm/nouveau/dispnv50/wndw.c +16 -0
@@ -118,6 +118,7 @@ nv50_wndw_flush_clr(struct nv50_wndw *wndw, u32 *interlock, bool flush,if (clr.sema ) wndw->func->sema_clr (wndw);if (clr.ntfy ) wndw->func->ntfy_clr (wndw);if (clr.xlut ) wndw->func->xlut_clr (wndw); +if (clr.csc ) wndw->func->csc_clr (wndw);if (clr.image) wndw->func->image_clr (wndw); interlock[wndw->interlock.type] |= wndw->interlock.data;
@@ -145,6 +146,7 @@ nv50_wndw_flush_set(struct nv50_wndw *wndw, u32 *interlock, wndw->func->xlut_set (wndw, asyw); } +if (asyw->set.csc ) wndw->func->csc_set (wndw, asyw);if (asyw->set.scale) wndw->func->scale_set (wndw, asyw);if (asyw->set.point) {if (asyw->set.point = false, asyw->set.mask)
@@ -334,6 +336,8 @@ nv50_wndw_atomic_check_lut(struct nv50_wndw *wndw, asyw->xlut.handle = wndw->wndw.vram.handle; asyw->xlut.i.buffer = !asyw->xlut.i.buffer; asyw->set.xlut = true; + }else { + asyw->clr.xlut = armw->xlut.handle !=0 ;; }/* Handle setting base SET_OUTPUT_LUT_LO_ENABLE_USE_CORE_LUT. */
@@ -341,6 +345,16 @@ nv50_wndw_atomic_check_lut(struct nv50_wndw *wndw, (!armw->visible || (armw->xlut.handle && !asyw->xlut.handle))) asyw->set.xlut = true; +if (wndw->func->csc && asyh->state.ctm) { +const struct drm_color_ctm *ctm = asyh->state.ctm->data; + wndw->func->csc (wndw, asyw, ctm); + asyw->csc.valid = true; + asyw->set.csc = true; + }else { + asyw->csc.valid = false; + asyw->clr.csc = armw->csc.valid; + } +/* Can't do an immediate flip while changing the LUT. */ asyh->state.pageflip_flags &= ~DRM_MODE_PAGE_FLIP_ASYNC ; }
@@ -410,6 +424,7 @@ nv50_wndw_atomic_check(struct drm_plane *plane, struct drm_plane_state *state) asyw->clr.ntfy = armw->ntfy.handle !=0 ; asyw->clr.sema = armw->sema.handle !=0 ; asyw->clr.xlut = armw->xlut.handle !=0 ; + asyw->clr.csc = armw->csc.valid;if (wndw->func->image_clr) asyw->clr.image = armw->image.handle[0 ] !=0 ; }
@@ -501,6 +516,7 @@ nv50_wndw_atomic_duplicate_state(struct drm_plane *plane) asyw->ntfy = armw->ntfy; asyw->ilut =NULL ; asyw->xlut = armw->xlut; + asyw->csc = armw->csc; asyw->image = armw->image; asyw->point = armw->point; asyw->clr.mask =0 ;
drivers/gpu/drm/nouveau/dispnv50/wndw.h +4 -0
@@ -65,6 +65,10 @@ struct nv50_wndw_func {int (*ntfy_wait_begun)(struct nouveau_bo *,u32 offset,struct nvif_device *);void (*ilut)(struct nv50_wndw *,struct nv50_wndw_atom *); +void (*csc)(struct nv50_wndw *,struct nv50_wndw_atom *, +const struct drm_color_ctm *); +void (*csc_set)(struct nv50_wndw *,struct nv50_wndw_atom *); +void (*csc_clr)(struct nv50_wndw *);bool ilut_identity;bool olut_core;void (*xlut_set)(struct nv50_wndw *,struct nv50_wndw_atom *);
Signature · 6 lines
2.21.0 _______________________________________________ Nouveau mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/nouveau