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 <cgmeiner@igalia.com>
Tested-by: Marek Vasut <marex@denx.de>
Acked-by: David Heidelberg <david.heidelberg@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/26096>
This commit is contained in:
Christian Gmeiner 2023-11-07 08:57:49 +01:00 committed by Marge Bot
parent 945288ffae
commit 9342544ca5
4 changed files with 10 additions and 9 deletions

View file

@ -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

View file

@ -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:

View file

@ -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;

View file

@ -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;