From: Jason Ekstrand Date: Fri, 21 Oct 2016 18:30:05 +0000 (-0700) Subject: intel/blorp: Add a shader type to make keys more unique X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=99b436ae5cfa410c6daad89f78acbe5ec88b9426;p=mesa.git intel/blorp: Add a shader type to make keys more unique Depending on how the driver using blorp implements its shader caching, there is a small chance of shader collisions due to identical keys between blit and clear programs. Adding a small shader type at the top of the key alleviates this problem. Signed-off-by: Jason Ekstrand Reviewed-by: Topi Pohjolainen --- diff --git a/src/intel/blorp/blorp_blit.c b/src/intel/blorp/blorp_blit.c index bce4b973956..893a4bc4b16 100644 --- a/src/intel/blorp/blorp_blit.c +++ b/src/intel/blorp/blorp_blit.c @@ -1662,8 +1662,9 @@ blorp_blit(struct blorp_batch *batch, params.src.view.swizzle = src_swizzle; params.dst.view.swizzle = dst_swizzle; - struct brw_blorp_blit_prog_key wm_prog_key; - memset(&wm_prog_key, 0, sizeof(wm_prog_key)); + struct brw_blorp_blit_prog_key wm_prog_key = { + .shader_type = BLORP_SHADER_TYPE_BLIT + }; /* Scaled blitting or not. */ wm_prog_key.blit_scaled = @@ -1852,8 +1853,9 @@ blorp_copy(struct blorp_batch *batch, brw_blorp_surface_info_init(batch->blorp, ¶ms.dst, dst_surf, dst_level, dst_layer, ISL_FORMAT_UNSUPPORTED, true); - struct brw_blorp_blit_prog_key wm_prog_key; - memset(&wm_prog_key, 0, sizeof(wm_prog_key)); + struct brw_blorp_blit_prog_key wm_prog_key = { + .shader_type = BLORP_SHADER_TYPE_BLIT + }; const struct isl_format_layout *src_fmtl = isl_format_get_layout(params.src.surf.format); diff --git a/src/intel/blorp/blorp_clear.c b/src/intel/blorp/blorp_clear.c index c59040e0313..2b8af18019d 100644 --- a/src/intel/blorp/blorp_clear.c +++ b/src/intel/blorp/blorp_clear.c @@ -35,6 +35,7 @@ struct brw_blorp_const_color_prog_key { + enum blorp_shader_type shader_type; /* Must be BLORP_SHADER_TYPE_CLEAR */ bool use_simd16_replicated_data; bool pad[3]; }; @@ -44,9 +45,10 @@ blorp_params_get_clear_kernel(struct blorp_context *blorp, struct blorp_params *params, bool use_replicated_data) { - struct brw_blorp_const_color_prog_key blorp_key; - memset(&blorp_key, 0, sizeof(blorp_key)); - blorp_key.use_simd16_replicated_data = use_replicated_data; + const struct brw_blorp_const_color_prog_key blorp_key = { + .shader_type = BLORP_SHADER_TYPE_CLEAR, + .use_simd16_replicated_data = use_replicated_data, + }; if (blorp->lookup_shader(blorp, &blorp_key, sizeof(blorp_key), ¶ms->wm_prog_kernel, ¶ms->wm_prog_data)) diff --git a/src/intel/blorp/blorp_priv.h b/src/intel/blorp/blorp_priv.h index 9666a9b11bd..1258fa96f1a 100644 --- a/src/intel/blorp/blorp_priv.h +++ b/src/intel/blorp/blorp_priv.h @@ -178,8 +178,15 @@ struct blorp_params void blorp_params_init(struct blorp_params *params); +enum blorp_shader_type { + BLORP_SHADER_TYPE_BLIT, + BLORP_SHADER_TYPE_CLEAR, +}; + struct brw_blorp_blit_prog_key { + enum blorp_shader_type shader_type; /* Must be BLORP_SHADER_TYPE_BLIT */ + /* Number of samples per pixel that have been configured in the surface * state for texturing from. */