Skip to content
This repository was archived by the owner on Jan 27, 2026. It is now read-only.

Commit 1db5e70

Browse files
committed
Gfxbench Manhattan3.0 optimization
Eliminate draw call for Manhattan robot shadow when conditions apply. The performance of Gfxbench 1080pManhattan3.0 offscreen can be improved 2.4%. Tracked-On: OAM-122053 Signed-off-by: Huang Rui <rui1.huang@intel.com>
1 parent ccc6905 commit 1db5e70

10 files changed

Lines changed: 35 additions & 1 deletion

File tree

src/gallium/drivers/iris/driinfo_iris.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ DRI_CONF_SECTION_DEBUG
66
DRI_CONF_ALWAYS_FLUSH_CACHE(false)
77
DRI_CONF_OPT_B(sync_compile, false, "Always compile synchronously (will cause stalls)")
88
DRI_CONF_LIMIT_TRIG_INPUT_RANGE(false)
9+
DRI_CONF_MHT_ROBOT_SHADOW_SHADER_ELIMINATION(false)
910
DRI_CONF_SECTION_END
1011

1112
DRI_CONF_SECTION_PERFORMANCE

src/gallium/drivers/iris/iris_clear.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -561,6 +561,8 @@ fast_clear_depth(struct iris_context *ice,
561561
ISL_AUX_STATE_CLEAR);
562562
ice->state.dirty |= IRIS_DIRTY_DEPTH_BUFFER;
563563
ice->state.stage_dirty |= IRIS_ALL_STAGE_DIRTY_BINDINGS;
564+
struct pipe_resource *p_res = (void *) res;
565+
p_res->depth_cleared = true;
564566
}
565567

566568
static void

src/gallium/drivers/iris/iris_context.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -866,6 +866,8 @@ struct iris_context {
866866

867867
/** Resource holding the pixel pipe hashing tables. */
868868
struct pipe_resource *pixel_hashing_tables;
869+
870+
bool skipManhattanRobotShadowShader;
869871
} state;
870872
};
871873

src/gallium/drivers/iris/iris_draw.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -296,6 +296,10 @@ iris_draw_vbo(struct pipe_context *ctx, const struct pipe_draw_info *info,
296296
stage, true);
297297
}
298298
iris_predraw_resolve_framebuffer(ice, batch, draw_aux_buffer_disabled);
299+
if (screen->driconf.mht_robot_shadow_shader_elimination && ice->state.skipManhattanRobotShadowShader) {
300+
ice->state.skipManhattanRobotShadowShader = false;
301+
return;
302+
};
299303
}
300304

301305
if (ice->state.dirty & IRIS_DIRTY_RENDER_MISC_BUFFER_FLUSHES) {

src/gallium/drivers/iris/iris_resolve.c

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,15 @@ resolve_sampler_views(struct iris_context *ice,
9797
continue;
9898

9999
struct iris_sampler_view *isv = shs->textures[i];
100-
100+
if (isv->res->base.b.depth_cleared) {
101+
isv->res->base.b.depth_cleared = false;
102+
struct iris_screen *screen = (struct iris_screen*)ice->ctx.screen;
103+
if ( screen->driconf.mht_robot_shadow_shader_elimination &&
104+
(*(uint32_t*)ice->shaders.uncompiled[MESA_SHADER_FRAGMENT]->nir->info.source_sha1 == 880113298 ||
105+
*(uint32_t*)ice->shaders.uncompiled[MESA_SHADER_FRAGMENT]->nir->info.source_sha1 == 2932317437)) {
106+
ice->state.skipManhattanRobotShadowShader = true;
107+
}
108+
}
101109
if (isv->res->base.b.target != PIPE_BUFFER) {
102110
if (consider_framebuffer) {
103111
disable_rb_aux_buffer(ice, draw_aux_buffer_disabled, isv->res,
@@ -215,6 +223,9 @@ iris_predraw_resolve_framebuffer(struct iris_context *ice,
215223
if (zs_surf) {
216224
struct iris_resource *z_res, *s_res;
217225
iris_get_depth_stencil_resources(zs_surf->texture, &z_res, &s_res);
226+
if (z_res->base.b.depth_cleared) {
227+
z_res->base.b.depth_cleared = false;
228+
}
218229
unsigned num_layers =
219230
zs_surf->u.tex.last_layer - zs_surf->u.tex.first_layer + 1;
220231

src/gallium/drivers/iris/iris_screen.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -845,6 +845,8 @@ iris_screen_create(int fd, const struct pipe_screen_config *config)
845845
driQueryOptionb(config->options, "limit_trig_input_range");
846846
screen->driconf.lower_depth_range_rate =
847847
driQueryOptionf(config->options, "lower_depth_range_rate");
848+
screen->driconf.mht_robot_shadow_shader_elimination =
849+
driQueryOptionf(config->options, "mht_robot_shadow_shader_elimination");
848850

849851
screen->precompile = debug_get_bool_option("shader_precompile", true);
850852

src/gallium/drivers/iris/iris_screen.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -183,6 +183,7 @@ struct iris_screen {
183183
bool sync_compile;
184184
bool limit_trig_input_range;
185185
float lower_depth_range_rate;
186+
bool mht_robot_shadow_shader_elimination;
186187
} driconf;
187188

188189
/** Does the kernel support various features (KERNEL_HAS_* bitfield)? */

src/gallium/include/pipe/p_state.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -565,6 +565,7 @@ struct pipe_resource
565565
uint16_t height0; /* Textures: The maximum height/depth/array_size is 16k. */
566566
uint16_t depth0;
567567
uint16_t array_size;
568+
bool depth_cleared;
568569

569570
enum pipe_format format:16; /**< PIPE_FORMAT_x */
570571
enum pipe_texture_target target:8; /**< PIPE_TEXTURE_x */

src/util/00-mesa-defaults.conf

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -980,6 +980,12 @@ TODO: document the other workarounds.
980980
<application name="Insurgency" executable="insurgency_linux">
981981
<option name="force_gl_vendor" value="X.Org" />
982982
</application>
983+
<application name="Manhattan3.0" executable="testfw_app">
984+
<option name="mht_robot_shadow_shader_elimination" value="true" />
985+
</application>
986+
<application name="Manhattan3.0" executable="net.kishonti.gfxbench.gl.v50000.corporate">
987+
<option name="mht_robot_shadow_shader_elimination" value="true" />
988+
</application>
983989
</device>
984990
<device driver="crocus">
985991
<application name="glmark2" executable="glmark2">

src/util/driconf.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -302,6 +302,10 @@
302302
DRI_CONF_OPT_B(limit_trig_input_range, def, \
303303
"Limit trig input range to [-2p : 2p] to improve sin/cos calculation precision on Intel")
304304

305+
#define DRI_CONF_MHT_ROBOT_SHADOW_SHADER_ELIMINATION(def) \
306+
DRI_CONF_OPT_B(mht_robot_shadow_shader_elimination, def, \
307+
"Eliminate draw call for Gfxbench Manhattan3.0 robot shadow when conditions apply.")
308+
305309
/**
306310
* \brief Image quality-related options
307311
*/

0 commit comments

Comments
 (0)