diff options
author | Ben Skeggs <bskeggs@redhat.com> | 2020-06-20 02:20:17 +0300 |
---|---|---|
committer | Ben Skeggs <bskeggs@redhat.com> | 2020-07-24 11:50:53 +0300 |
commit | 6d6e11e2844015a5f6c3d0373966fd4a459add8b (patch) | |
tree | be9a3cf55f5ec297ceecd79b826993a9a5d82e2d | |
parent | 34838908f62a0160d2c12c12be6c3be910d17b85 (diff) | |
download | linux-6d6e11e2844015a5f6c3d0373966fd4a459add8b.tar.xz |
drm/nouveau/kms/nv50-: convert wndw image_set() to new push macros
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
Reviewed-by: Lyude Paul <lyude@redhat.com>
-rw-r--r-- | drivers/gpu/drm/nouveau/dispnv50/base507c.c | 54 | ||||
-rw-r--r-- | drivers/gpu/drm/nouveau/dispnv50/base827c.c | 54 | ||||
-rw-r--r-- | drivers/gpu/drm/nouveau/dispnv50/base907c.c | 38 | ||||
-rw-r--r-- | drivers/gpu/drm/nouveau/dispnv50/ovly507e.c | 43 | ||||
-rw-r--r-- | drivers/gpu/drm/nouveau/dispnv50/ovly827e.c | 41 | ||||
-rw-r--r-- | drivers/gpu/drm/nouveau/dispnv50/ovly907e.c | 42 | ||||
-rw-r--r-- | drivers/gpu/drm/nouveau/dispnv50/wndw.h | 2 | ||||
-rw-r--r-- | drivers/gpu/drm/nouveau/dispnv50/wndwc37e.c | 53 | ||||
-rw-r--r-- | drivers/gpu/drm/nouveau/dispnv50/wndwc57e.c | 53 |
9 files changed, 185 insertions, 195 deletions
diff --git a/drivers/gpu/drm/nouveau/dispnv50/base507c.c b/drivers/gpu/drm/nouveau/dispnv50/base507c.c index 760ee65613a7..ae1c5cc00957 100644 --- a/drivers/gpu/drm/nouveau/dispnv50/base507c.c +++ b/drivers/gpu/drm/nouveau/dispnv50/base507c.c @@ -56,37 +56,35 @@ base507c_image_clr(struct nv50_wndw *wndw) } } -static void +static int base507c_image_set(struct nv50_wndw *wndw, struct nv50_wndw_atom *asyw) { - u32 *push; - if ((push = evo_wait(&wndw->wndw, 13))) { - evo_mthd(push, 0x0084, 1); - evo_data(push, asyw->image.mode << 8 | - asyw->image.interval << 4); - evo_mthd(push, 0x00c0, 1); - evo_data(push, asyw->image.handle[0]); - if (asyw->image.format == 0xca) { - evo_mthd(push, 0x0110, 2); - evo_data(push, 1); - evo_data(push, 0x6400); - } else { - evo_mthd(push, 0x0110, 2); - evo_data(push, 0); - evo_data(push, 0); - } - evo_mthd(push, 0x0800, 5); - evo_data(push, asyw->image.offset[0] >> 8); - evo_data(push, 0x00000000); - evo_data(push, asyw->image.h << 16 | asyw->image.w); - evo_data(push, asyw->image.layout << 20 | - (asyw->image.pitch[0] >> 8) << 8 | - asyw->image.blocks[0] << 8 | - asyw->image.blockh); - evo_data(push, asyw->image.kind << 16 | - asyw->image.format << 8); - 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, NV507C, 0x0084, asyw->image.mode << 8 | + asyw->image.interval << 4); + PUSH_NVSQ(push, NV507C, 0x00c0, asyw->image.handle[0]); + if (asyw->image.format == 0xca) { + PUSH_NVSQ(push, NV507C, 0x0110, 1, + 0x0114, 0x6400); + } else { + PUSH_NVSQ(push, NV507C, 0x0110, 0, + 0x0114, 0); } + PUSH_NVSQ(push, NV507C, 0x0800, asyw->image.offset[0] >> 8, + 0x0804, 0x00000000, + 0x0808, asyw->image.h << 16 | asyw->image.w, + 0x080c, asyw->image.layout << 20 | + (asyw->image.pitch[0] >> 8) << 8 | + asyw->image.blocks[0] << 8 | + asyw->image.blockh, + 0x0810, asyw->image.kind << 16 | + asyw->image.format << 8); + return 0; } int diff --git a/drivers/gpu/drm/nouveau/dispnv50/base827c.c b/drivers/gpu/drm/nouveau/dispnv50/base827c.c index f4c05949dd62..c1995194aa7b 100644 --- a/drivers/gpu/drm/nouveau/dispnv50/base827c.c +++ b/drivers/gpu/drm/nouveau/dispnv50/base827c.c @@ -21,36 +21,36 @@ */ #include "base.h" -static void +#include <nvif/push507c.h> + +static int base827c_image_set(struct nv50_wndw *wndw, struct nv50_wndw_atom *asyw) { - u32 *push; - if ((push = evo_wait(&wndw->wndw, 13))) { - evo_mthd(push, 0x0084, 1); - evo_data(push, asyw->image.mode << 8 | - asyw->image.interval << 4); - evo_mthd(push, 0x00c0, 1); - evo_data(push, asyw->image.handle[0]); - if (asyw->image.format == 0xca) { - evo_mthd(push, 0x0110, 2); - evo_data(push, 1); - evo_data(push, 0x6400); - } else { - evo_mthd(push, 0x0110, 2); - evo_data(push, 0); - evo_data(push, 0); - } - evo_mthd(push, 0x0800, 5); - evo_data(push, asyw->image.offset[0] >> 8); - evo_data(push, 0x00000000); - evo_data(push, asyw->image.h << 16 | asyw->image.w); - evo_data(push, asyw->image.layout << 20 | - (asyw->image.pitch[0] >> 8) << 8 | - asyw->image.blocks[0] << 8 | - asyw->image.blockh); - evo_data(push, asyw->image.format << 8); - 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, NV827C, 0x0084, asyw->image.mode << 8 | + asyw->image.interval << 4); + PUSH_NVSQ(push, NV827C, 0x00c0, asyw->image.handle[0]); + if (asyw->image.format == 0xca) { + PUSH_NVSQ(push, NV827C, 0x0110, 1, + 0x0114, 0x6400); + } else { + PUSH_NVSQ(push, NV827C, 0x0110, 0, + 0x0114, 0); } + PUSH_NVSQ(push, NV827C, 0x0800, asyw->image.offset[0] >> 8, + 0x0804, 0x00000000, + 0x0808, asyw->image.h << 16 | asyw->image.w, + 0x080c, asyw->image.layout << 20 | + (asyw->image.pitch[0] >> 8) << 8 | + asyw->image.blocks[0] << 8 | + asyw->image.blockh, + 0x0810, asyw->image.format << 8); + return 0; } static const struct nv50_wndw_func diff --git a/drivers/gpu/drm/nouveau/dispnv50/base907c.c b/drivers/gpu/drm/nouveau/dispnv50/base907c.c index d50fa80f3c99..c88a924d7d09 100644 --- a/drivers/gpu/drm/nouveau/dispnv50/base907c.c +++ b/drivers/gpu/drm/nouveau/dispnv50/base907c.c @@ -23,27 +23,27 @@ #include <nvif/push507c.h> -static void +static int base907c_image_set(struct nv50_wndw *wndw, struct nv50_wndw_atom *asyw) { - u32 *push; - if ((push = evo_wait(&wndw->wndw, 10))) { - evo_mthd(push, 0x0084, 1); - evo_data(push, asyw->image.mode << 8 | - asyw->image.interval << 4); - evo_mthd(push, 0x00c0, 1); - evo_data(push, asyw->image.handle[0]); - evo_mthd(push, 0x0400, 5); - evo_data(push, asyw->image.offset[0] >> 8); - evo_data(push, 0x00000000); - evo_data(push, asyw->image.h << 16 | asyw->image.w); - evo_data(push, asyw->image.layout << 24 | - (asyw->image.pitch[0] >> 8) << 8 | - asyw->image.blocks[0] << 8 | - asyw->image.blockh); - evo_data(push, asyw->image.format << 8); - evo_kick(push, &wndw->wndw); - } + struct nvif_push *push = wndw->wndw.push; + int ret; + + if ((ret = PUSH_WAIT(push, 10))) + return ret; + + PUSH_NVSQ(push, NV907C, 0x0084, asyw->image.mode << 8 | + asyw->image.interval << 4); + PUSH_NVSQ(push, NV907C, 0x00c0, asyw->image.handle[0]); + PUSH_NVSQ(push, NV907C, 0x0400, asyw->image.offset[0] >> 8, + 0x0404, 0x00000000, + 0x0408, asyw->image.h << 16 | asyw->image.w, + 0x040c, asyw->image.layout << 24 | + (asyw->image.pitch[0] >> 8) << 8 | + asyw->image.blocks[0] << 8 | + asyw->image.blockh, + 0x0410, asyw->image.format << 8); + return 0; } static int diff --git a/drivers/gpu/drm/nouveau/dispnv50/ovly507e.c b/drivers/gpu/drm/nouveau/dispnv50/ovly507e.c index 151064aa19e1..e182f376900f 100644 --- a/drivers/gpu/drm/nouveau/dispnv50/ovly507e.c +++ b/drivers/gpu/drm/nouveau/dispnv50/ovly507e.c @@ -28,6 +28,7 @@ #include <nvif/cl507e.h> #include <nvif/event.h> +#include <nvif/push507c.h> void ovly507e_update(struct nv50_wndw *wndw, u32 *interlock) @@ -66,30 +67,28 @@ ovly507e_image_clr(struct nv50_wndw *wndw) } } -static void +static int ovly507e_image_set(struct nv50_wndw *wndw, struct nv50_wndw_atom *asyw) { - u32 *push; - if ((push = evo_wait(&wndw->wndw, 12))) { - evo_mthd(push, 0x0084, 1); - evo_data(push, asyw->image.interval << 4); - evo_mthd(push, 0x00c0, 1); - evo_data(push, asyw->image.handle[0]); - evo_mthd(push, 0x0100, 1); - evo_data(push, 0x00000002); - evo_mthd(push, 0x0800, 1); - evo_data(push, asyw->image.offset[0] >> 8); - evo_mthd(push, 0x0808, 3); - evo_data(push, asyw->image.h << 16 | asyw->image.w); - evo_data(push, asyw->image.layout << 20 | - (asyw->image.pitch[0] >> 8) << 8 | - asyw->image.blocks[0] << 8 | - asyw->image.blockh); - evo_data(push, asyw->image.kind << 16 | - asyw->image.format << 8 | - asyw->image.colorspace); - evo_kick(push, &wndw->wndw); - } + struct nvif_push *push = wndw->wndw.push; + int ret; + + if ((ret = PUSH_WAIT(push, 12))) + return ret; + + PUSH_NVSQ(push, NV507E, 0x0084, asyw->image.interval << 4); + PUSH_NVSQ(push, NV507E, 0x00c0, asyw->image.handle[0]); + PUSH_NVSQ(push, NV507E, 0x0100, 0x00000002); + PUSH_NVSQ(push, NV507E, 0x0800, asyw->image.offset[0] >> 8); + PUSH_NVSQ(push, NV507E, 0x0808, asyw->image.h << 16 | asyw->image.w, + 0x080c, asyw->image.layout << 20 | + (asyw->image.pitch[0] >> 8) << 8 | + asyw->image.blocks[0] << 8 | + asyw->image.blockh, + 0x0810, asyw->image.kind << 16 | + asyw->image.format << 8 | + asyw->image.colorspace); + return 0; } void diff --git a/drivers/gpu/drm/nouveau/dispnv50/ovly827e.c b/drivers/gpu/drm/nouveau/dispnv50/ovly827e.c index 37e37a7d4ba9..cb0f372cbcf7 100644 --- a/drivers/gpu/drm/nouveau/dispnv50/ovly827e.c +++ b/drivers/gpu/drm/nouveau/dispnv50/ovly827e.c @@ -24,31 +24,30 @@ #include <nouveau_bo.h> +#include <nvif/push507c.h> #include <nvif/timer.h> -static void +static int ovly827e_image_set(struct nv50_wndw *wndw, struct nv50_wndw_atom *asyw) { - u32 *push; - if ((push = evo_wait(&wndw->wndw, 12))) { - evo_mthd(push, 0x0084, 1); - evo_data(push, asyw->image.interval << 4); - evo_mthd(push, 0x00c0, 1); - evo_data(push, asyw->image.handle[0]); - evo_mthd(push, 0x0100, 1); - evo_data(push, 0x00000002); - evo_mthd(push, 0x0800, 1); - evo_data(push, asyw->image.offset[0] >> 8); - evo_mthd(push, 0x0808, 3); - evo_data(push, asyw->image.h << 16 | asyw->image.w); - evo_data(push, asyw->image.layout << 20 | - (asyw->image.pitch[0] >> 8) << 8 | - asyw->image.blocks[0] << 8 | - asyw->image.blockh); - evo_data(push, asyw->image.format << 8 | - asyw->image.colorspace); - evo_kick(push, &wndw->wndw); - } + struct nvif_push *push = wndw->wndw.push; + int ret; + + if ((ret = PUSH_WAIT(push, 12))) + return ret; + + PUSH_NVSQ(push, NV827E, 0x0084, asyw->image.interval << 4); + PUSH_NVSQ(push, NV827E, 0x00c0, asyw->image.handle[0]); + PUSH_NVSQ(push, NV827E, 0x0100, 0x00000002); + PUSH_NVSQ(push, NV827E, 0x0800, asyw->image.offset[0] >> 8); + PUSH_NVSQ(push, NV827E, 0x0808, asyw->image.h << 16 | asyw->image.w, + 0x080c, asyw->image.layout << 20 | + (asyw->image.pitch[0] >> 8) << 8 | + asyw->image.blocks[0] << 8 | + asyw->image.blockh, + 0x0810, asyw->image.format << 8 | + asyw->image.colorspace); + return 0; } int diff --git a/drivers/gpu/drm/nouveau/dispnv50/ovly907e.c b/drivers/gpu/drm/nouveau/dispnv50/ovly907e.c index 73fb5d4eb343..6b83daff1560 100644 --- a/drivers/gpu/drm/nouveau/dispnv50/ovly907e.c +++ b/drivers/gpu/drm/nouveau/dispnv50/ovly907e.c @@ -22,29 +22,29 @@ #include "ovly.h" #include "atom.h" -static void +#include <nvif/push507c.h> + +static int ovly907e_image_set(struct nv50_wndw *wndw, struct nv50_wndw_atom *asyw) { - u32 *push; - if ((push = evo_wait(&wndw->wndw, 12))) { - evo_mthd(push, 0x0084, 1); - evo_data(push, asyw->image.interval << 4); - evo_mthd(push, 0x00c0, 1); - evo_data(push, asyw->image.handle[0]); - evo_mthd(push, 0x0100, 1); - evo_data(push, 0x00000002); - evo_mthd(push, 0x0400, 1); - evo_data(push, asyw->image.offset[0] >> 8); - evo_mthd(push, 0x0408, 3); - evo_data(push, asyw->image.h << 16 | asyw->image.w); - evo_data(push, asyw->image.layout << 24 | - (asyw->image.pitch[0] >> 8) << 8 | - asyw->image.blocks[0] << 8 | - asyw->image.blockh); - evo_data(push, asyw->image.format << 8 | - asyw->image.colorspace); - evo_kick(push, &wndw->wndw); - } + struct nvif_push *push = wndw->wndw.push; + int ret; + + if ((ret = PUSH_WAIT(push, 12))) + return ret; + + PUSH_NVSQ(push, NV907E, 0x0084, asyw->image.interval << 4); + PUSH_NVSQ(push, NV907E, 0x00c0, asyw->image.handle[0]); + PUSH_NVSQ(push, NV907E, 0x0100, 0x00000002); + PUSH_NVSQ(push, NV907E, 0x0400, asyw->image.offset[0] >> 8); + PUSH_NVSQ(push, NV907E, 0x0408, asyw->image.h << 16 | asyw->image.w, + 0x040c, asyw->image.layout << 24 | + (asyw->image.pitch[0] >> 8) << 8 | + asyw->image.blocks[0] << 8 | + asyw->image.blockh, + 0x0410, asyw->image.format << 8 | + asyw->image.colorspace); + 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 6baf27090fc2..d6e1c29da379 100644 --- a/drivers/gpu/drm/nouveau/dispnv50/wndw.h +++ b/drivers/gpu/drm/nouveau/dispnv50/wndw.h @@ -74,7 +74,7 @@ struct nv50_wndw_func { bool olut_core; int (*xlut_set)(struct nv50_wndw *, struct nv50_wndw_atom *); int (*xlut_clr)(struct nv50_wndw *); - void (*image_set)(struct nv50_wndw *, struct nv50_wndw_atom *); + int (*image_set)(struct nv50_wndw *, struct nv50_wndw_atom *); void (*image_clr)(struct nv50_wndw *); void (*scale_set)(struct nv50_wndw *, struct nv50_wndw_atom *); void (*blend_set)(struct nv50_wndw *, struct nv50_wndw_atom *); diff --git a/drivers/gpu/drm/nouveau/dispnv50/wndwc37e.c b/drivers/gpu/drm/nouveau/dispnv50/wndwc37e.c index eab1c322eccb..24cb4e9b356e 100644 --- a/drivers/gpu/drm/nouveau/dispnv50/wndwc37e.c +++ b/drivers/gpu/drm/nouveau/dispnv50/wndwc37e.c @@ -125,37 +125,34 @@ wndwc37e_image_clr(struct nv50_wndw *wndw) } } -static void +static int wndwc37e_image_set(struct nv50_wndw *wndw, struct nv50_wndw_atom *asyw) { - u32 *push; + struct nvif_push *push = wndw->wndw.push; + int ret; - if (!(push = evo_wait(&wndw->wndw, 17))) - return; - - evo_mthd(push, 0x0308, 1); - evo_data(push, asyw->image.mode << 4 | asyw->image.interval); - evo_mthd(push, 0x0224, 4); - evo_data(push, asyw->image.h << 16 | asyw->image.w); - evo_data(push, asyw->image.layout << 4 | asyw->image.blockh); - evo_data(push, asyw->csc.valid << 17 | - asyw->image.colorspace << 8 | - asyw->image.format); - evo_data(push, asyw->image.blocks[0] | (asyw->image.pitch[0] >> 6)); - evo_mthd(push, 0x0240, 1); - evo_data(push, asyw->image.handle[0]); - evo_mthd(push, 0x0260, 1); - evo_data(push, asyw->image.offset[0] >> 8); - evo_mthd(push, 0x0290, 1); - evo_data(push, (asyw->state.src_y >> 16) << 16 | - (asyw->state.src_x >> 16)); - evo_mthd(push, 0x0298, 1); - evo_data(push, (asyw->state.src_h >> 16) << 16 | - (asyw->state.src_w >> 16)); - evo_mthd(push, 0x02a4, 1); - evo_data(push, asyw->state.crtc_h << 16 | - asyw->state.crtc_w); - evo_kick(push, &wndw->wndw); + if ((ret = PUSH_WAIT(push, 17))) + return ret; + + PUSH_NVSQ(push, NVC37E, 0x0308, asyw->image.mode << 4 | + asyw->image.interval); + PUSH_NVSQ(push, NVC37E, 0x0224, asyw->image.h << 16 | asyw->image.w, + 0x0228, asyw->image.layout << 4 | + asyw->image.blockh, + 0x022c, asyw->csc.valid << 17 | + asyw->image.colorspace << 8 | + asyw->image.format, + 0x0230, asyw->image.blocks[0] | + (asyw->image.pitch[0] >> 6)); + PUSH_NVSQ(push, NVC37E, 0x0240, asyw->image.handle[0]); + PUSH_NVSQ(push, NVC37E, 0x0260, asyw->image.offset[0] >> 8); + PUSH_NVSQ(push, NVC37E, 0x0290,(asyw->state.src_y >> 16) << 16 | + (asyw->state.src_x >> 16)); + PUSH_NVSQ(push, NVC37E, 0x0298,(asyw->state.src_h >> 16) << 16 | + (asyw->state.src_w >> 16)); + PUSH_NVSQ(push, NVC37E, 0x02a4, asyw->state.crtc_h << 16 | + asyw->state.crtc_w); + return 0; } int diff --git a/drivers/gpu/drm/nouveau/dispnv50/wndwc57e.c b/drivers/gpu/drm/nouveau/dispnv50/wndwc57e.c index f393399baab1..687cb7378c69 100644 --- a/drivers/gpu/drm/nouveau/dispnv50/wndwc57e.c +++ b/drivers/gpu/drm/nouveau/dispnv50/wndwc57e.c @@ -29,36 +29,33 @@ #include <nvif/clc37e.h> #include <nvif/pushc37b.h> -static void +static int wndwc57e_image_set(struct nv50_wndw *wndw, struct nv50_wndw_atom *asyw) { - u32 *push; - - if (!(push = evo_wait(&wndw->wndw, 17))) - return; - - evo_mthd(push, 0x0308, 1); - evo_data(push, asyw->image.mode << 4 | asyw->image.interval); - evo_mthd(push, 0x0224, 4); - evo_data(push, asyw->image.h << 16 | asyw->image.w); - evo_data(push, asyw->image.layout << 4 | asyw->image.blockh); - evo_data(push, asyw->image.colorspace << 8 | - asyw->image.format); - evo_data(push, asyw->image.blocks[0] | (asyw->image.pitch[0] >> 6)); - evo_mthd(push, 0x0240, 1); - evo_data(push, asyw->image.handle[0]); - evo_mthd(push, 0x0260, 1); - evo_data(push, asyw->image.offset[0] >> 8); - evo_mthd(push, 0x0290, 1); - evo_data(push, (asyw->state.src_y >> 16) << 16 | - (asyw->state.src_x >> 16)); - evo_mthd(push, 0x0298, 1); - evo_data(push, (asyw->state.src_h >> 16) << 16 | - (asyw->state.src_w >> 16)); - evo_mthd(push, 0x02a4, 1); - evo_data(push, asyw->state.crtc_h << 16 | - asyw->state.crtc_w); - evo_kick(push, &wndw->wndw); + struct nvif_push *push = wndw->wndw.push; + int ret; + + if ((ret = PUSH_WAIT(push, 17))) + return ret; + + PUSH_NVSQ(push, NVC57E, 0x0308, asyw->image.mode << 4 | + asyw->image.interval); + PUSH_NVSQ(push, NVC57E, 0x0224, asyw->image.h << 16 | asyw->image.w, + 0x0228, asyw->image.layout << 4 | + asyw->image.blockh, + 0x022c, asyw->image.colorspace << 8 | + asyw->image.format, + 0x0230, asyw->image.blocks[0] | + (asyw->image.pitch[0] >> 6)); + PUSH_NVSQ(push, NVC57E, 0x0240, asyw->image.handle[0]); + PUSH_NVSQ(push, NVC57E, 0x0260, asyw->image.offset[0] >> 8); + PUSH_NVSQ(push, NVC57E, 0x0290,(asyw->state.src_y >> 16) << 16 | + (asyw->state.src_x >> 16)); + PUSH_NVSQ(push, NVC57E, 0x0298,(asyw->state.src_h >> 16) << 16 | + (asyw->state.src_w >> 16)); + PUSH_NVSQ(push, NVC57E, 0x02a4, asyw->state.crtc_h << 16 | + asyw->state.crtc_w); + return 0; } static int |