From bc5af56a8f184dd8acdaa7faea245cdf677f4a03 Mon Sep 17 00:00:00 2001 From: Ben Skeggs Date: Sun, 21 Jun 2020 09:17:11 +1000 Subject: [PATCH] drm/nouveau/kms/nv50-: convert core head_curs_clr() to new push macros Signed-off-by: Ben Skeggs Reviewed-by: Lyude Paul --- drivers/gpu/drm/nouveau/dispnv50/head.h | 6 +++--- drivers/gpu/drm/nouveau/dispnv50/head507d.c | 18 ++++++++++-------- drivers/gpu/drm/nouveau/dispnv50/head827d.c | 21 +++++++++++---------- drivers/gpu/drm/nouveau/dispnv50/head907d.c | 21 +++++++++++---------- drivers/gpu/drm/nouveau/dispnv50/headc37d.c | 21 +++++++++++---------- 5 files changed, 46 insertions(+), 41 deletions(-) diff --git a/drivers/gpu/drm/nouveau/dispnv50/head.h b/drivers/gpu/drm/nouveau/dispnv50/head.h index e49ef06e8f5f..6e1067f89938 100644 --- a/drivers/gpu/drm/nouveau/dispnv50/head.h +++ b/drivers/gpu/drm/nouveau/dispnv50/head.h @@ -40,7 +40,7 @@ struct nv50_head_func { int (*curs_format)(struct nv50_head *, struct nv50_wndw_atom *, struct nv50_head_atom *); int (*curs_set)(struct nv50_head *, struct nv50_head_atom *); - void (*curs_clr)(struct nv50_head *); + int (*curs_clr)(struct nv50_head *); void (*base)(struct nv50_head *, struct nv50_head_atom *); void (*ovly)(struct nv50_head *, struct nv50_head_atom *); void (*dither)(struct nv50_head *, struct nv50_head_atom *); @@ -75,7 +75,7 @@ int head907d_olut_clr(struct nv50_head *); int head907d_core_set(struct nv50_head *, struct nv50_head_atom *); int head907d_core_clr(struct nv50_head *); int head907d_curs_set(struct nv50_head *, struct nv50_head_atom *); -void head907d_curs_clr(struct nv50_head *); +int head907d_curs_clr(struct nv50_head *); void head907d_ovly(struct nv50_head *, struct nv50_head_atom *); void head907d_procamp(struct nv50_head *, struct nv50_head_atom *); void head907d_or(struct nv50_head *, struct nv50_head_atom *); @@ -89,7 +89,7 @@ int headc37d_view(struct nv50_head *, struct nv50_head_atom *); int headc37d_curs_format(struct nv50_head *, struct nv50_wndw_atom *, struct nv50_head_atom *); int headc37d_curs_set(struct nv50_head *, struct nv50_head_atom *); -void headc37d_curs_clr(struct nv50_head *); +int headc37d_curs_clr(struct nv50_head *); void headc37d_dither(struct nv50_head *, struct nv50_head_atom *); void headc37d_static_wndw_map(struct nv50_head *, struct nv50_head_atom *); diff --git a/drivers/gpu/drm/nouveau/dispnv50/head507d.c b/drivers/gpu/drm/nouveau/dispnv50/head507d.c index 2cdbf498c555..8b9ec5beef8f 100644 --- a/drivers/gpu/drm/nouveau/dispnv50/head507d.c +++ b/drivers/gpu/drm/nouveau/dispnv50/head507d.c @@ -105,16 +105,18 @@ head507d_base(struct nv50_head *head, struct nv50_head_atom *asyh) } } -static void +static int head507d_curs_clr(struct nv50_head *head) { - struct nv50_dmac *core = &nv50_disp(head->base.base.dev)->core->chan; - u32 *push; - if ((push = evo_wait(core, 2))) { - evo_mthd(push, 0x0880 + head->base.index * 0x400, 1); - evo_data(push, 0x05000000); - evo_kick(push, core); - } + struct nvif_push *push = nv50_disp(head->base.base.dev)->core->chan.push; + const int i = head->base.index; + int ret; + + if ((ret = PUSH_WAIT(push, 2))) + return ret; + + PUSH_NVSQ(push, NV507D, 0x0880 + (i * 0x400), 0x05000000); + return 0; } static int diff --git a/drivers/gpu/drm/nouveau/dispnv50/head827d.c b/drivers/gpu/drm/nouveau/dispnv50/head827d.c index 6b1b683331b9..66bacb4bb712 100644 --- a/drivers/gpu/drm/nouveau/dispnv50/head827d.c +++ b/drivers/gpu/drm/nouveau/dispnv50/head827d.c @@ -24,18 +24,19 @@ #include -static void +static int head827d_curs_clr(struct nv50_head *head) { - struct nv50_dmac *core = &nv50_disp(head->base.base.dev)->core->chan; - u32 *push; - if ((push = evo_wait(core, 4))) { - evo_mthd(push, 0x0880 + head->base.index * 0x400, 1); - evo_data(push, 0x05000000); - evo_mthd(push, 0x089c + head->base.index * 0x400, 1); - evo_data(push, 0x00000000); - evo_kick(push, core); - } + struct nvif_push *push = nv50_disp(head->base.base.dev)->core->chan.push; + const int i = head->base.index; + int ret; + + if ((ret = PUSH_WAIT(push, 4))) + return ret; + + PUSH_NVSQ(push, NV827D, 0x0880 + (i * 0x400), 0x05000000); + PUSH_NVSQ(push, NV827D, 0x089c + (i * 0x400), 0x00000000); + return 0; } static int diff --git a/drivers/gpu/drm/nouveau/dispnv50/head907d.c b/drivers/gpu/drm/nouveau/dispnv50/head907d.c index 32dd0de81219..e3b30142b6f5 100644 --- a/drivers/gpu/drm/nouveau/dispnv50/head907d.c +++ b/drivers/gpu/drm/nouveau/dispnv50/head907d.c @@ -130,18 +130,19 @@ head907d_base(struct nv50_head *head, struct nv50_head_atom *asyh) } } -void +int head907d_curs_clr(struct nv50_head *head) { - struct nv50_dmac *core = &nv50_disp(head->base.base.dev)->core->chan; - u32 *push; - if ((push = evo_wait(core, 4))) { - evo_mthd(push, 0x0480 + head->base.index * 0x300, 1); - evo_data(push, 0x05000000); - evo_mthd(push, 0x048c + head->base.index * 0x300, 1); - evo_data(push, 0x00000000); - evo_kick(push, core); - } + struct nvif_push *push = nv50_disp(head->base.base.dev)->core->chan.push; + const int i = head->base.index; + int ret; + + if ((ret = PUSH_WAIT(push, 4))) + return ret; + + PUSH_NVSQ(push, NV907D, 0x0480 + (i * 0x300), 0x05000000); + PUSH_NVSQ(push, NV907D, 0x048c + (i * 0x300), 0x00000000); + return 0; } int diff --git a/drivers/gpu/drm/nouveau/dispnv50/headc37d.c b/drivers/gpu/drm/nouveau/dispnv50/headc37d.c index 89ac5d7e83c0..2ecfcf45f8a8 100644 --- a/drivers/gpu/drm/nouveau/dispnv50/headc37d.c +++ b/drivers/gpu/drm/nouveau/dispnv50/headc37d.c @@ -84,18 +84,19 @@ headc37d_dither(struct nv50_head *head, struct nv50_head_atom *asyh) } } -void +int headc37d_curs_clr(struct nv50_head *head) { - struct nv50_dmac *core = &nv50_disp(head->base.base.dev)->core->chan; - u32 *push; - if ((push = evo_wait(core, 4))) { - evo_mthd(push, 0x209c + head->base.index * 0x400, 1); - evo_data(push, 0x000000cf); - evo_mthd(push, 0x2088 + head->base.index * 0x400, 1); - evo_data(push, 0x00000000); - evo_kick(push, core); - } + struct nvif_push *push = nv50_disp(head->base.base.dev)->core->chan.push; + const int i = head->base.index; + int ret; + + if ((ret = PUSH_WAIT(push, 4))) + return ret; + + PUSH_NVSQ(push, NVC37D, 0x209c + (i * 0x400), 0x000000cf); + PUSH_NVSQ(push, NVC37D, 0x2088 + (i * 0x400), 0x00000000); + return 0; } int