diff options
author | Ilia Mirkin <imirkin@alum.mit.edu> | 2021-02-07 12:20:00 -0500 |
---|---|---|
committer | Marge Bot <eric+marge@anholt.net> | 2021-02-08 15:47:47 +0000 |
commit | 8930ecd3cedda7e099ac10b0398cfbd2dfd805d3 (patch) | |
tree | 0c68a6c9ca5cbb34bb98c5f5e49a978f781ee3d1 /src/gallium/drivers/nouveau/nv50/nv50_surface.c | |
parent | 23340b959cfe854dd2eb6cc820134f9e0dbd850c (diff) |
nv50,nvc0: add scissored clear support
Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu>
Reviewed-by: Karol Herbst <kherbst@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8901>
Diffstat (limited to 'src/gallium/drivers/nouveau/nv50/nv50_surface.c')
-rw-r--r-- | src/gallium/drivers/nouveau/nv50/nv50_surface.c | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/src/gallium/drivers/nouveau/nv50/nv50_surface.c b/src/gallium/drivers/nouveau/nv50/nv50_surface.c index b133997641a..97bc4f2c9fe 100644 --- a/src/gallium/drivers/nouveau/nv50/nv50_surface.c +++ b/src/gallium/drivers/nouveau/nv50/nv50_surface.c @@ -538,6 +538,19 @@ nv50_clear(struct pipe_context *pipe, unsigned buffers, const struct pipe_scisso if (!nv50_state_validate_3d(nv50, NV50_NEW_3D_FRAMEBUFFER)) return; + if (scissor_state) { + uint32_t minx = scissor_state->minx; + uint32_t maxx = MIN2(fb->width, scissor_state->maxx); + uint32_t miny = scissor_state->miny; + uint32_t maxy = MIN2(fb->height, scissor_state->maxy); + if (maxx <= minx || maxy <= miny) + return; + + BEGIN_NV04(push, NV50_3D(SCREEN_SCISSOR_HORIZ), 2); + PUSH_DATA (push, minx | (maxx - minx) << 16); + PUSH_DATA (push, miny | (maxy - miny) << 16); + } + /* We have to clear ALL of the layers, not up to the min number of layers * of any attachment. */ BEGIN_NV04(push, NV50_3D(RT_ARRAY_MODE), 1); @@ -602,6 +615,13 @@ nv50_clear(struct pipe_context *pipe, unsigned buffers, const struct pipe_scisso /* restore the array mode */ BEGIN_NV04(push, NV50_3D(RT_ARRAY_MODE), 1); PUSH_DATA (push, nv50->rt_array_mode); + + /* restore screen scissor */ + if (scissor_state) { + BEGIN_NV04(push, NV50_3D(SCREEN_SCISSOR_HORIZ), 2); + PUSH_DATA (push, fb->width << 16); + PUSH_DATA (push, fb->height << 16); + } } static void |