diff --git a/src/gallium/drivers/iris/driinfo_iris.h b/src/gallium/drivers/iris/driinfo_iris.h index d4d4a081b90..f7dadc19c88 100644 --- a/src/gallium/drivers/iris/driinfo_iris.h +++ b/src/gallium/drivers/iris/driinfo_iris.h @@ -6,6 +6,7 @@ DRI_CONF_SECTION_DEBUG DRI_CONF_ALWAYS_FLUSH_CACHE(false) DRI_CONF_OPT_B(sync_compile, false, "Always compile synchronously (will cause stalls)") DRI_CONF_LIMIT_TRIG_INPUT_RANGE(false) + DRI_CONF_MHT_ROBOT_SHADOW_SHADER_ELIMINATION(false) DRI_CONF_SECTION_END DRI_CONF_SECTION_PERFORMANCE diff --git a/src/gallium/drivers/iris/iris_clear.c b/src/gallium/drivers/iris/iris_clear.c index 81ced574f1c..61a7a91ce22 100644 --- a/src/gallium/drivers/iris/iris_clear.c +++ b/src/gallium/drivers/iris/iris_clear.c @@ -561,6 +561,8 @@ fast_clear_depth(struct iris_context *ice, ISL_AUX_STATE_CLEAR); ice->state.dirty |= IRIS_DIRTY_DEPTH_BUFFER; ice->state.stage_dirty |= IRIS_ALL_STAGE_DIRTY_BINDINGS; + struct pipe_resource *p_res = (void *) res; + p_res->last_operation_is_clear = true; } static void diff --git a/src/gallium/drivers/iris/iris_context.h b/src/gallium/drivers/iris/iris_context.h index 3d14600451a..a1a99367469 100644 --- a/src/gallium/drivers/iris/iris_context.h +++ b/src/gallium/drivers/iris/iris_context.h @@ -866,6 +866,8 @@ struct iris_context { /** Resource holding the pixel pipe hashing tables. */ struct pipe_resource *pixel_hashing_tables; + + bool skipManhattanRobotShadowShader; } state; }; diff --git a/src/gallium/drivers/iris/iris_draw.c b/src/gallium/drivers/iris/iris_draw.c index de4e834b993..ccbe50a6689 100644 --- a/src/gallium/drivers/iris/iris_draw.c +++ b/src/gallium/drivers/iris/iris_draw.c @@ -296,6 +296,10 @@ iris_draw_vbo(struct pipe_context *ctx, const struct pipe_draw_info *info, stage, true); } iris_predraw_resolve_framebuffer(ice, batch, draw_aux_buffer_disabled); + if (screen->driconf.mht_robot_shadow_shader_elimination && ice->state.skipManhattanRobotShadowShader) { + ice->state.skipManhattanRobotShadowShader = false; + return; + }; } if (ice->state.dirty & IRIS_DIRTY_RENDER_MISC_BUFFER_FLUSHES) { diff --git a/src/gallium/drivers/iris/iris_resolve.c b/src/gallium/drivers/iris/iris_resolve.c index 7f0c9597165..fe9e5f2feca 100644 --- a/src/gallium/drivers/iris/iris_resolve.c +++ b/src/gallium/drivers/iris/iris_resolve.c @@ -97,7 +97,15 @@ resolve_sampler_views(struct iris_context *ice, continue; struct iris_sampler_view *isv = shs->textures[i]; - + if (isv->res->base.b.last_operation_is_clear) { + isv->res->base.b.last_operation_is_clear = false; + struct iris_screen *screen = (struct iris_screen*)ice->ctx.screen; + if (screen->driconf.mht_robot_shadow_shader_elimination && + (*(uint32_t*)ice->shaders.uncompiled[MESA_SHADER_FRAGMENT]->nir->info.source_sha1 == 880113298 || + *(uint32_t*)ice->shaders.uncompiled[MESA_SHADER_FRAGMENT]->nir->info.source_sha1 == 2932317437)) { + ice->state.skipManhattanRobotShadowShader = true; + } + } if (isv->res->base.b.target != PIPE_BUFFER) { if (consider_framebuffer) { disable_rb_aux_buffer(ice, draw_aux_buffer_disabled, isv->res, @@ -215,6 +223,9 @@ iris_predraw_resolve_framebuffer(struct iris_context *ice, if (zs_surf) { struct iris_resource *z_res, *s_res; iris_get_depth_stencil_resources(zs_surf->texture, &z_res, &s_res); + if (z_res->base.b.last_operation_is_clear) { + z_res->base.b.last_operation_is_clear = false; + } unsigned num_layers = zs_surf->u.tex.last_layer - zs_surf->u.tex.first_layer + 1; diff --git a/src/gallium/drivers/iris/iris_screen.c b/src/gallium/drivers/iris/iris_screen.c index 933cf95c099..338f1e49e16 100644 --- a/src/gallium/drivers/iris/iris_screen.c +++ b/src/gallium/drivers/iris/iris_screen.c @@ -845,6 +845,8 @@ iris_screen_create(int fd, const struct pipe_screen_config *config) driQueryOptionb(config->options, "limit_trig_input_range"); screen->driconf.lower_depth_range_rate = driQueryOptionf(config->options, "lower_depth_range_rate"); + screen->driconf.mht_robot_shadow_shader_elimination = + driQueryOptionf(config->options, "mht_robot_shadow_shader_elimination"); screen->precompile = debug_get_bool_option("shader_precompile", true); diff --git a/src/gallium/drivers/iris/iris_screen.h b/src/gallium/drivers/iris/iris_screen.h index ce0931c5b7e..329f66657e3 100644 --- a/src/gallium/drivers/iris/iris_screen.h +++ b/src/gallium/drivers/iris/iris_screen.h @@ -183,6 +183,7 @@ struct iris_screen { bool sync_compile; bool limit_trig_input_range; float lower_depth_range_rate; + bool mht_robot_shadow_shader_elimination; } driconf; /** Does the kernel support various features (KERNEL_HAS_* bitfield)? */ diff --git a/src/gallium/include/pipe/p_state.h b/src/gallium/include/pipe/p_state.h index 5194011d30e..30ad9454a9f 100644 --- a/src/gallium/include/pipe/p_state.h +++ b/src/gallium/include/pipe/p_state.h @@ -565,6 +565,7 @@ struct pipe_resource uint16_t height0; /* Textures: The maximum height/depth/array_size is 16k. */ uint16_t depth0; uint16_t array_size; + bool last_operation_is_clear; enum pipe_format format:16; /**< PIPE_FORMAT_x */ enum pipe_texture_target target:8; /**< PIPE_TEXTURE_x */ diff --git a/src/util/00-mesa-defaults.conf b/src/util/00-mesa-defaults.conf index b3797743405..6efefa3e187 100644 --- a/src/util/00-mesa-defaults.conf +++ b/src/util/00-mesa-defaults.conf @@ -980,6 +980,15 @@ TODO: document the other workarounds. + + + + + + diff --git a/src/util/driconf.h b/src/util/driconf.h index bcc6d8190e4..8f390b0ad85 100644 --- a/src/util/driconf.h +++ b/src/util/driconf.h @@ -302,6 +302,10 @@ DRI_CONF_OPT_B(limit_trig_input_range, def, \ "Limit trig input range to [-2p : 2p] to improve sin/cos calculation precision on Intel") +#define DRI_CONF_MHT_ROBOT_SHADOW_SHADER_ELIMINATION(def) \ + DRI_CONF_OPT_B(mht_robot_shadow_shader_elimination, def, \ + "Eliminate draw call for Gfxbench Manhattan3.0 robot shadow when conditions apply.") + /** * \brief Image quality-related options */