Module: Mesa
Branch: main
Commit: 9342544ca5c9ec2d7c100fe80f3cb6ac41547231
URL:    
http://cgit.freedesktop.org/mesa/mesa/commit/?id=9342544ca5c9ec2d7c100fe80f3cb6ac41547231

Author: Christian Gmeiner <cgmei...@igalia.com>
Date:   Tue Nov  7 08:57:49 2023 +0100

etnaviv: rs: Call etna_rs_gen_clear_surface(..) when needed

Calling etna_rs_gen_clear_surface(..) during surface creation could end
in the following assert:
   etna_rs_gen_clear_surface: Assertion `!"" "bpp not supported for clear by 
RS"'

Lets call etna_rs_gen_clear_surface(..) only when it is needed.

Signed-off-by: Christian Gmeiner <cgmei...@igalia.com>
Tested-by: Marek Vasut <ma...@denx.de>
Acked-by: David Heidelberg <david.heidelb...@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/26096>

---

 src/etnaviv/ci/etnaviv-gc2000-fails.txt       | 8 ++------
 src/gallium/drivers/etnaviv/etnaviv_rs.c      | 7 +++++++
 src/gallium/drivers/etnaviv/etnaviv_rs.h      | 1 +
 src/gallium/drivers/etnaviv/etnaviv_surface.c | 3 ---
 4 files changed, 10 insertions(+), 9 deletions(-)

diff --git a/src/etnaviv/ci/etnaviv-gc2000-fails.txt 
b/src/etnaviv/ci/etnaviv-gc2000-fails.txt
index 43657731254..ee10ea1dbdc 100644
--- a/src/etnaviv/ci/etnaviv-gc2000-fails.txt
+++ b/src/etnaviv/ci/etnaviv-gc2000-fails.txt
@@ -319,11 +319,9 @@ spec@ext_framebuffer_multisample@accuracy all_samples 
stencil_draw small depthst
 spec@ext_framebuffer_multisample@accuracy all_samples stencil_resolve 
depthstencil,Fail
 spec@ext_framebuffer_multisample@accuracy all_samples stencil_resolve small 
depthstencil,Fail
 
-spec@ext_framebuffer_object@fbo-alphatest-formats,Crash
 spec@ext_framebuffer_object@fbo-blending-format-quirks,Fail
-spec@ext_framebuffer_object@fbo-blending-formats,Crash
-spec@ext_framebuffer_object@fbo-clear-formats,Crash
-spec@ext_framebuffer_object@fbo-colormask-formats,Crash
+spec@ext_framebuffer_object@fbo-blending-formats,Fail
+spec@ext_framebuffer_object@fbo-blending-formats@GL_RGB10,Fail
 spec@ext_framebuffer_object@fbo-copyteximage,Fail
 spec@ext_framebuffer_object@fbo-copyteximage-simple,Fail
 spec@ext_framebuffer_object@fbo-cubemap,Fail
@@ -382,7 +380,6 @@ spec@ext_texture_format_bgra8888@api-errors,Fail
 
 spec@ext_texture_lod_bias@lodbias,Fail
 
-spec@ext_texture_srgb@fbo-alphatest-formats,Crash
 spec@ext_texture_srgb@texwrap formats bordercolor,Fail
 spec@ext_texture_srgb@texwrap formats bordercolor@GL_SLUMINANCE8_ALPHA8- 
border color only,Fail
 spec@ext_texture_srgb@texwrap formats bordercolor@GL_SLUMINANCE8- border color 
only,Fail
@@ -1860,7 +1857,6 @@ spec@!opengl 
1.1@clipflat@glDrawElements(GL_TRIANGLE_STRIP)- glFrontFace(GL_CW)-
 spec@!opengl 1.1@clipflat@glDrawElements(GL_TRIANGLE_STRIP)- 
glFrontFace(GL_CW)- glPolygonMode(GL_LINE)- quadrant: right middle PV: LAST,Fail
 spec@!opengl 1.1@clipflat@glDrawElements(GL_TRIANGLE_STRIP)- 
glFrontFace(GL_CW)- glPolygonMode(GL_LINE)- quadrant: right top PV: FIRST,Fail
 spec@!opengl 1.1@clipflat@glDrawElements(GL_TRIANGLE_STRIP)- 
glFrontFace(GL_CW)- glPolygonMode(GL_LINE)- quadrant: right top PV: LAST,Fail
-spec@!opengl 1.1@getteximage-luminance,Crash
 spec@!opengl 1.1@gl-1.1-xor-copypixels,Fail
 spec@!opengl 1.1@gl-1.1-xor,Fail
 spec@!opengl 1.1@line-flat-clip-color,Fail
diff --git a/src/gallium/drivers/etnaviv/etnaviv_rs.c 
b/src/gallium/drivers/etnaviv/etnaviv_rs.c
index 659ed0d7762..b7af8b796fb 100644
--- a/src/gallium/drivers/etnaviv/etnaviv_rs.c
+++ b/src/gallium/drivers/etnaviv/etnaviv_rs.c
@@ -181,6 +181,7 @@ etna_compile_rs_state(struct etna_context *ctx, struct 
compiled_rs_state *cs,
       cs->RS_KICKER_INPLACE = rs->tile_count;
    }
    cs->source_ts_valid = rs->source_ts_valid;
+   cs->valid = true;
 }
 
 /* modify the clear bits value in the compiled RS state */
@@ -332,6 +333,9 @@ etna_blit_clear_color_rs(struct pipe_context *pctx, struct 
pipe_surface *dst,
    struct etna_surface *surf = etna_surface(dst);
    uint64_t new_clear_value = etna_clear_blit_pack_rgba(surf->base.format, 
color);
 
+   if (!surf->clear_command.valid)
+      etna_rs_gen_clear_surface(ctx, surf, surf->level->clear_value);
+
    if (surf->level->ts_size) { /* TS: use precompiled clear command */
       ctx->framebuffer.TS_COLOR_CLEAR_VALUE = new_clear_value;
       ctx->framebuffer.TS_COLOR_CLEAR_VALUE_EXT = new_clear_value >> 32;
@@ -371,6 +375,9 @@ etna_blit_clear_zs_rs(struct pipe_context *pctx, struct 
pipe_surface *dst,
    uint32_t new_clear_value = translate_clear_depth_stencil(surf->base.format, 
depth, stencil);
    uint32_t new_clear_bits = 0, clear_bits_depth, clear_bits_stencil;
 
+   if (!surf->clear_command.valid)
+      etna_rs_gen_clear_surface(ctx, surf, surf->level->clear_value);
+
    /* Get the channels to clear */
    switch (surf->base.format) {
    case PIPE_FORMAT_Z16_UNORM:
diff --git a/src/gallium/drivers/etnaviv/etnaviv_rs.h 
b/src/gallium/drivers/etnaviv/etnaviv_rs.h
index 5b326d39654..09456fb349b 100644
--- a/src/gallium/drivers/etnaviv/etnaviv_rs.h
+++ b/src/gallium/drivers/etnaviv/etnaviv_rs.h
@@ -65,6 +65,7 @@ struct rs_state {
 
 /* treat this as opaque structure */
 struct compiled_rs_state {
+   uint8_t valid : 1;
    uint8_t source_ts_valid : 1;
    uint32_t RS_CONFIG;
    uint32_t RS_SOURCE_STRIDE;
diff --git a/src/gallium/drivers/etnaviv/etnaviv_surface.c 
b/src/gallium/drivers/etnaviv/etnaviv_surface.c
index 32ead17515e..a8ff3aa618e 100644
--- a/src/gallium/drivers/etnaviv/etnaviv_surface.c
+++ b/src/gallium/drivers/etnaviv/etnaviv_surface.c
@@ -177,9 +177,6 @@ etna_create_surface(struct pipe_context *pctx, struct 
pipe_resource *prsc,
             .clear_bits = 0xffff
          });
       }
-   } else {
-      if (!screen->specs.use_blt)
-         etna_rs_gen_clear_surface(ctx, surf, surf->level->clear_value);
    }
 
    return &surf->base;

Reply via email to