From: Kenneth Graunke Date: Thu, 20 Jun 2019 23:28:58 +0000 (-0500) Subject: iris: Mark cbuf0 as not needing uploading every single time X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=ebc8c20b3e688edf7b0157774572251444d33b04;p=mesa.git iris: Mark cbuf0 as not needing uploading every single time I neglected to mark cbuf0_needs_upload = false after uploading it. The obvious fix regressed user clip plane tests, because of a second bug: we also forgot to mark that they may need re-uploading when changing shader programs (which may have more or less system values). Thanks to Timur Kristóf for catching the original issue. Signed-off-by: Kenneth Graunke Reviewed-by: Timur Kristóf --- diff --git a/src/gallium/drivers/iris/iris_program.c b/src/gallium/drivers/iris/iris_program.c index 4bb2a7b96e3..1eef88f1ba3 100644 --- a/src/gallium/drivers/iris/iris_program.c +++ b/src/gallium/drivers/iris/iris_program.c @@ -970,6 +970,7 @@ iris_compile_vs(struct iris_context *ice, static void iris_update_compiled_vs(struct iris_context *ice) { + struct iris_shader_state *shs = &ice->state.shaders[MESA_SHADER_VERTEX]; struct iris_uncompiled_shader *ish = ice->shaders.uncompiled[MESA_SHADER_VERTEX]; struct iris_screen *screen = (struct iris_screen *)ice->ctx.screen; @@ -994,6 +995,8 @@ iris_update_compiled_vs(struct iris_context *ice) IRIS_DIRTY_BINDINGS_VS | IRIS_DIRTY_CONSTANTS_VS | IRIS_DIRTY_VF_SGVS; + shs->cbuf0_needs_upload = true; + const struct brw_vs_prog_data *vs_prog_data = (void *) shader->prog_data; const bool uses_draw_params = vs_prog_data->uses_firstvertex || @@ -1175,6 +1178,7 @@ iris_compile_tcs(struct iris_context *ice, static void iris_update_compiled_tcs(struct iris_context *ice) { + struct iris_shader_state *shs = &ice->state.shaders[MESA_SHADER_TESS_CTRL]; struct iris_uncompiled_shader *tcs = ice->shaders.uncompiled[MESA_SHADER_TESS_CTRL]; struct iris_screen *screen = (struct iris_screen *)ice->ctx.screen; @@ -1207,6 +1211,7 @@ iris_update_compiled_tcs(struct iris_context *ice) ice->state.dirty |= IRIS_DIRTY_TCS | IRIS_DIRTY_BINDINGS_TCS | IRIS_DIRTY_CONSTANTS_TCS; + shs->cbuf0_needs_upload = true; if (!tcs) { /* We're binding a passthrough TCS, which doesn't have uniforms. @@ -1218,9 +1223,6 @@ iris_update_compiled_tcs(struct iris_context *ice) * data and try and read a dangling cbuf0->user_buffer pointer. * Just zero out the stale constants to avoid the upload. */ - struct iris_shader_state *shs = - &ice->state.shaders[MESA_SHADER_TESS_CTRL]; - memset(&shs->cbuf0, 0, sizeof(shs->cbuf0)); } } @@ -1300,6 +1302,7 @@ iris_compile_tes(struct iris_context *ice, static void iris_update_compiled_tes(struct iris_context *ice) { + struct iris_shader_state *shs = &ice->state.shaders[MESA_SHADER_TESS_EVAL]; struct iris_uncompiled_shader *ish = ice->shaders.uncompiled[MESA_SHADER_TESS_EVAL]; struct iris_screen *screen = (struct iris_screen *)ice->ctx.screen; @@ -1324,6 +1327,7 @@ iris_update_compiled_tes(struct iris_context *ice) ice->state.dirty |= IRIS_DIRTY_TES | IRIS_DIRTY_BINDINGS_TES | IRIS_DIRTY_CONSTANTS_TES; + shs->cbuf0_needs_upload = true; } /* TODO: Could compare and avoid flagging this. */ @@ -1408,6 +1412,7 @@ iris_compile_gs(struct iris_context *ice, static void iris_update_compiled_gs(struct iris_context *ice) { + struct iris_shader_state *shs = &ice->state.shaders[MESA_SHADER_GEOMETRY]; struct iris_uncompiled_shader *ish = ice->shaders.uncompiled[MESA_SHADER_GEOMETRY]; struct iris_compiled_shader *old = ice->shaders.prog[IRIS_CACHE_GS]; @@ -1434,6 +1439,7 @@ iris_update_compiled_gs(struct iris_context *ice) ice->state.dirty |= IRIS_DIRTY_GS | IRIS_DIRTY_BINDINGS_GS | IRIS_DIRTY_CONSTANTS_GS; + shs->cbuf0_needs_upload = true; } } @@ -1504,6 +1510,7 @@ iris_compile_fs(struct iris_context *ice, static void iris_update_compiled_fs(struct iris_context *ice) { + struct iris_shader_state *shs = &ice->state.shaders[MESA_SHADER_FRAGMENT]; struct iris_uncompiled_shader *ish = ice->shaders.uncompiled[MESA_SHADER_FRAGMENT]; struct iris_screen *screen = (struct iris_screen *)ice->ctx.screen; @@ -1534,6 +1541,7 @@ iris_update_compiled_fs(struct iris_context *ice) IRIS_DIRTY_WM | IRIS_DIRTY_CLIP | IRIS_DIRTY_SBE; + shs->cbuf0_needs_upload = true; } } @@ -1762,6 +1770,7 @@ iris_compile_cs(struct iris_context *ice, void iris_update_compiled_compute_shader(struct iris_context *ice) { + struct iris_shader_state *shs = &ice->state.shaders[MESA_SHADER_COMPUTE]; struct iris_uncompiled_shader *ish = ice->shaders.uncompiled[MESA_SHADER_COMPUTE]; @@ -1785,6 +1794,7 @@ iris_update_compiled_compute_shader(struct iris_context *ice) ice->state.dirty |= IRIS_DIRTY_CS | IRIS_DIRTY_BINDINGS_CS | IRIS_DIRTY_CONSTANTS_CS; + shs->cbuf0_needs_upload = true; } } diff --git a/src/gallium/drivers/iris/iris_state.c b/src/gallium/drivers/iris/iris_state.c index b8d76bc8e12..64103b3b4cf 100644 --- a/src/gallium/drivers/iris/iris_state.c +++ b/src/gallium/drivers/iris/iris_state.c @@ -2630,6 +2630,7 @@ upload_uniforms(struct iris_context *ice, cbuf->buffer_size = upload_size; iris_upload_ubo_ssbo_surf_state(ice, cbuf, &shs->constbuf_surf_state[0], false); + shs->cbuf0_needs_upload = false; } /**