From 72587dca9658a0428518e658247c4490a0e0a09f Mon Sep 17 00:00:00 2001 From: Ben Skeggs Date: Sat, 20 Jun 2020 08:39:21 +1000 Subject: [PATCH] drm/nouveau/kms/nv50-: convert wndw csc_set() to new push macros Signed-off-by: Ben Skeggs Reviewed-by: Lyude Paul --- drivers/gpu/drm/nouveau/dispnv50/base907c.c | 21 ++++++++++++--------- drivers/gpu/drm/nouveau/dispnv50/wndw.h | 2 +- drivers/gpu/drm/nouveau/dispnv50/wndwc37e.c | 17 +++++++++-------- drivers/gpu/drm/nouveau/dispnv50/wndwc57e.c | 18 ++++++++++-------- 4 files changed, 32 insertions(+), 26 deletions(-) diff --git a/drivers/gpu/drm/nouveau/dispnv50/base907c.c b/drivers/gpu/drm/nouveau/dispnv50/base907c.c index 224a34c340fe..182da01fd62f 100644 --- a/drivers/gpu/drm/nouveau/dispnv50/base907c.c +++ b/drivers/gpu/drm/nouveau/dispnv50/base907c.c @@ -21,6 +21,8 @@ */ #include "base.h" +#include + static void base907c_image_set(struct nv50_wndw *wndw, struct nv50_wndw_atom *asyw) { @@ -136,17 +138,18 @@ base907c_csc_clr(struct nv50_wndw *wndw) } } -static void +static int base907c_csc_set(struct nv50_wndw *wndw, struct nv50_wndw_atom *asyw) { - u32 *push, i; - if ((push = evo_wait(&wndw->wndw, 13))) { - evo_mthd(push, 0x0140, 12); - evo_data(push, asyw->csc.matrix[0] | 0x80000000); - for (i = 1; i < 12; i++) - evo_data(push, asyw->csc.matrix[i]); - evo_kick(push, &wndw->wndw); - } + struct nvif_push *push = wndw->wndw.push; + int ret; + + if ((ret = PUSH_WAIT(push, 13))) + return ret; + + PUSH_NVSQ(push, NV907C, 0x0140, asyw->csc.matrix[0] | 0x80000000, + 0x0144, &asyw->csc.matrix[1], 11); + return 0; } const struct nv50_wndw_func diff --git a/drivers/gpu/drm/nouveau/dispnv50/wndw.h b/drivers/gpu/drm/nouveau/dispnv50/wndw.h index d632a30022e4..aacabd966b6c 100644 --- a/drivers/gpu/drm/nouveau/dispnv50/wndw.h +++ b/drivers/gpu/drm/nouveau/dispnv50/wndw.h @@ -67,7 +67,7 @@ struct nv50_wndw_func { bool (*ilut)(struct nv50_wndw *, struct nv50_wndw_atom *, int); void (*csc)(struct nv50_wndw *, struct nv50_wndw_atom *, const struct drm_color_ctm *); - void (*csc_set)(struct nv50_wndw *, struct nv50_wndw_atom *); + int (*csc_set)(struct nv50_wndw *, struct nv50_wndw_atom *); void (*csc_clr)(struct nv50_wndw *); bool ilut_identity; int ilut_size; diff --git a/drivers/gpu/drm/nouveau/dispnv50/wndwc37e.c b/drivers/gpu/drm/nouveau/dispnv50/wndwc37e.c index 2dded1a8407a..aebaf409a355 100644 --- a/drivers/gpu/drm/nouveau/dispnv50/wndwc37e.c +++ b/drivers/gpu/drm/nouveau/dispnv50/wndwc37e.c @@ -34,16 +34,17 @@ wndwc37e_csc_clr(struct nv50_wndw *wndw) { } -static void +static int wndwc37e_csc_set(struct nv50_wndw *wndw, struct nv50_wndw_atom *asyw) { - u32 *push, i; - if ((push = evo_wait(&wndw->wndw, 13))) { - evo_mthd(push, 0x02bc, 12); - for (i = 0; i < 12; i++) - evo_data(push, asyw->csc.matrix[i]); - evo_kick(push, &wndw->wndw); - } + struct nvif_push *push = wndw->wndw.push; + int ret; + + if ((ret = PUSH_WAIT(push, 13))) + return ret; + + PUSH_NVSQ(push, NVC37E, 0x02bc, asyw->csc.matrix, 12); + return 0; } static void diff --git a/drivers/gpu/drm/nouveau/dispnv50/wndwc57e.c b/drivers/gpu/drm/nouveau/dispnv50/wndwc57e.c index 1d64741595ba..9d155a7f14bf 100644 --- a/drivers/gpu/drm/nouveau/dispnv50/wndwc57e.c +++ b/drivers/gpu/drm/nouveau/dispnv50/wndwc57e.c @@ -27,6 +27,7 @@ #include #include +#include static void wndwc57e_image_set(struct nv50_wndw *wndw, struct nv50_wndw_atom *asyw) @@ -82,16 +83,17 @@ wndwc57e_csc_clr(struct nv50_wndw *wndw) } } -static void +static int wndwc57e_csc_set(struct nv50_wndw *wndw, struct nv50_wndw_atom *asyw) { - u32 *push, i; - if ((push = evo_wait(&wndw->wndw, 13))) { - evo_mthd(push, 0x0400, 12); - for (i = 0; i < 12; i++) - evo_data(push, asyw->csc.matrix[i]); - evo_kick(push, &wndw->wndw); - } + struct nvif_push *push = wndw->wndw.push; + int ret; + + if ((ret = PUSH_WAIT(push, 13))) + return ret; + + PUSH_NVSQ(push, NVC57E, 0x0400, asyw->csc.matrix, 12); + return 0; } static void