From 95763e20cea3e85e7886421a73be7a68a84b5c80 Mon Sep 17 00:00:00 2001 From: Christian Gmeiner Date: Sat, 21 Mar 2020 11:16:37 +0100 Subject: [PATCH] etnaviv: get rid of SE_CLIP_* The only difference between e.g. SE_SCISSOR_RIGHT and SE_CLIP_RIGHT is the used margin value. With that information we can remove SE_CLIP_* and apply the different margins during emit time. Signed-off-by: Christian Gmeiner Reviewed-by: Jonathan Marek Part-of: --- src/gallium/drivers/etnaviv/etnaviv_emit.c | 16 +++++++-------- .../drivers/etnaviv/etnaviv_internal.h | 6 ------ src/gallium/drivers/etnaviv/etnaviv_state.c | 20 ++++++------------- 3 files changed, 14 insertions(+), 28 deletions(-) diff --git a/src/gallium/drivers/etnaviv/etnaviv_emit.c b/src/gallium/drivers/etnaviv/etnaviv_emit.c index c626254373a..74a295f323d 100644 --- a/src/gallium/drivers/etnaviv/etnaviv_emit.c +++ b/src/gallium/drivers/etnaviv/etnaviv_emit.c @@ -416,8 +416,8 @@ etna_emit_state(struct etna_context *ctx) /*00C00*/ EMIT_STATE_FIXP(SE_SCISSOR_LEFT, scissor_left); /*00C04*/ EMIT_STATE_FIXP(SE_SCISSOR_TOP, scissor_top); - /*00C08*/ EMIT_STATE_FIXP(SE_SCISSOR_RIGHT, scissor_right); - /*00C0C*/ EMIT_STATE_FIXP(SE_SCISSOR_BOTTOM, scissor_bottom); + /*00C08*/ EMIT_STATE_FIXP(SE_SCISSOR_RIGHT, scissor_right + ETNA_SE_SCISSOR_MARGIN_RIGHT); + /*00C0C*/ EMIT_STATE_FIXP(SE_SCISSOR_BOTTOM, scissor_bottom + ETNA_SE_SCISSOR_MARGIN_BOTTOM); } if (unlikely(dirty & (ETNA_DIRTY_RASTERIZER))) { struct etna_rasterizer_state *rasterizer = etna_rasterizer_state(ctx->rasterizer); @@ -431,17 +431,17 @@ etna_emit_state(struct etna_context *ctx) struct etna_rasterizer_state *rasterizer = etna_rasterizer_state(ctx->rasterizer); uint32_t clip_right = - MIN2(ctx->framebuffer.SE_CLIP_RIGHT, ctx->viewport.SE_CLIP_RIGHT); + MIN2(ctx->framebuffer.SE_SCISSOR_RIGHT, ctx->viewport.SE_SCISSOR_RIGHT); uint32_t clip_bottom = - MIN2(ctx->framebuffer.SE_CLIP_BOTTOM, ctx->viewport.SE_CLIP_BOTTOM); + MIN2(ctx->framebuffer.SE_SCISSOR_BOTTOM, ctx->viewport.SE_SCISSOR_BOTTOM); if (rasterizer->scissor) { - clip_right = MIN2(ctx->scissor.SE_CLIP_RIGHT, clip_right); - clip_bottom = MIN2(ctx->scissor.SE_CLIP_BOTTOM, clip_bottom); + clip_right = MIN2(ctx->scissor.SE_SCISSOR_RIGHT, clip_right); + clip_bottom = MIN2(ctx->scissor.SE_SCISSOR_BOTTOM, clip_bottom); } - /*00C20*/ EMIT_STATE_FIXP(SE_CLIP_RIGHT, clip_right); - /*00C24*/ EMIT_STATE_FIXP(SE_CLIP_BOTTOM, clip_bottom); + /*00C20*/ EMIT_STATE_FIXP(SE_CLIP_RIGHT, clip_right + ETNA_SE_CLIP_MARGIN_RIGHT); + /*00C24*/ EMIT_STATE_FIXP(SE_CLIP_BOTTOM, clip_bottom + ETNA_SE_CLIP_MARGIN_BOTTOM); } if (unlikely(dirty & (ETNA_DIRTY_SHADER))) { /*00E00*/ EMIT_STATE(RA_CONTROL, ctx->shader_state.RA_CONTROL); diff --git a/src/gallium/drivers/etnaviv/etnaviv_internal.h b/src/gallium/drivers/etnaviv/etnaviv_internal.h index bdaa7ad6521..562c2cbccf4 100644 --- a/src/gallium/drivers/etnaviv/etnaviv_internal.h +++ b/src/gallium/drivers/etnaviv/etnaviv_internal.h @@ -163,8 +163,6 @@ struct compiled_scissor_state { uint32_t SE_SCISSOR_TOP; uint32_t SE_SCISSOR_RIGHT; uint32_t SE_SCISSOR_BOTTOM; - uint32_t SE_CLIP_RIGHT; - uint32_t SE_CLIP_BOTTOM; }; /* Compiled pipe_viewport_state */ @@ -179,8 +177,6 @@ struct compiled_viewport_state { uint32_t SE_SCISSOR_TOP; uint32_t SE_SCISSOR_RIGHT; uint32_t SE_SCISSOR_BOTTOM; - uint32_t SE_CLIP_RIGHT; - uint32_t SE_CLIP_BOTTOM; uint32_t PE_DEPTH_NEAR; uint32_t PE_DEPTH_FAR; }; @@ -203,8 +199,6 @@ struct compiled_framebuffer_state { uint32_t SE_SCISSOR_TOP; uint32_t SE_SCISSOR_RIGHT; uint32_t SE_SCISSOR_BOTTOM; - uint32_t SE_CLIP_RIGHT; - uint32_t SE_CLIP_BOTTOM; uint32_t RA_MULTISAMPLE_UNK00E04; uint32_t RA_MULTISAMPLE_UNK00E10[VIVS_RA_MULTISAMPLE_UNK00E10__LEN]; uint32_t RA_CENTROID_TABLE[VIVS_RA_CENTROID_TABLE__LEN]; diff --git a/src/gallium/drivers/etnaviv/etnaviv_state.c b/src/gallium/drivers/etnaviv/etnaviv_state.c index f15353fa737..9d97fe0c38a 100644 --- a/src/gallium/drivers/etnaviv/etnaviv_state.c +++ b/src/gallium/drivers/etnaviv/etnaviv_state.c @@ -351,10 +351,8 @@ etna_set_framebuffer_state(struct pipe_context *pctx, /* Scissor setup */ cs->SE_SCISSOR_LEFT = 0; /* affected by rasterizer and scissor state as well */ cs->SE_SCISSOR_TOP = 0; - cs->SE_SCISSOR_RIGHT = (fb->width << 16) + ETNA_SE_SCISSOR_MARGIN_RIGHT; - cs->SE_SCISSOR_BOTTOM = (fb->height << 16) + ETNA_SE_SCISSOR_MARGIN_BOTTOM; - cs->SE_CLIP_RIGHT = (fb->width << 16) + ETNA_SE_CLIP_MARGIN_RIGHT; - cs->SE_CLIP_BOTTOM = (fb->height << 16) + ETNA_SE_CLIP_MARGIN_BOTTOM; + cs->SE_SCISSOR_RIGHT = (fb->width << 16); + cs->SE_SCISSOR_BOTTOM = (fb->height << 16); cs->TS_MEM_CONFIG = ts_mem_config; cs->PE_MEM_CONFIG = pe_mem_config; @@ -392,10 +390,8 @@ etna_set_scissor_states(struct pipe_context *pctx, unsigned start_slot, ctx->scissor_s = *ss; cs->SE_SCISSOR_LEFT = (ss->minx << 16); cs->SE_SCISSOR_TOP = (ss->miny << 16); - cs->SE_SCISSOR_RIGHT = (ss->maxx << 16) + ETNA_SE_SCISSOR_MARGIN_RIGHT; - cs->SE_SCISSOR_BOTTOM = (ss->maxy << 16) + ETNA_SE_SCISSOR_MARGIN_BOTTOM; - cs->SE_CLIP_RIGHT = (ss->maxx << 16) + ETNA_SE_CLIP_MARGIN_RIGHT; - cs->SE_CLIP_BOTTOM = (ss->maxy << 16) + ETNA_SE_CLIP_MARGIN_BOTTOM; + cs->SE_SCISSOR_RIGHT = (ss->maxx << 16); + cs->SE_SCISSOR_BOTTOM = (ss->maxy << 16); ctx->dirty |= ETNA_DIRTY_SCISSOR; } @@ -433,12 +429,8 @@ etna_set_viewport_states(struct pipe_context *pctx, unsigned start_slot, */ cs->SE_SCISSOR_LEFT = etna_f32_to_fixp16(MAX2(vs->translate[0] - fabsf(vs->scale[0]), 0.0f)); cs->SE_SCISSOR_TOP = etna_f32_to_fixp16(MAX2(vs->translate[1] - fabsf(vs->scale[1]), 0.0f)); - uint32_t right_fixp = etna_f32_to_fixp16(MAX2(vs->translate[0] + fabsf(vs->scale[0]), 0.0f)); - uint32_t bottom_fixp = etna_f32_to_fixp16(MAX2(vs->translate[1] + fabsf(vs->scale[1]), 0.0f)); - cs->SE_SCISSOR_RIGHT = right_fixp + ETNA_SE_SCISSOR_MARGIN_RIGHT; - cs->SE_SCISSOR_BOTTOM = bottom_fixp + ETNA_SE_SCISSOR_MARGIN_BOTTOM; - cs->SE_CLIP_RIGHT = right_fixp + ETNA_SE_CLIP_MARGIN_RIGHT; - cs->SE_CLIP_BOTTOM = bottom_fixp + ETNA_SE_CLIP_MARGIN_BOTTOM; + cs->SE_SCISSOR_RIGHT = etna_f32_to_fixp16(MAX2(vs->translate[0] + fabsf(vs->scale[0]), 0.0f)); + cs->SE_SCISSOR_BOTTOM = etna_f32_to_fixp16(MAX2(vs->translate[1] + fabsf(vs->scale[1]), 0.0f)); cs->PE_DEPTH_NEAR = fui(0.0); /* not affected if depth mode is Z (as in GL) */ cs->PE_DEPTH_FAR = fui(1.0); -- 2.30.2