iris: rework Wa_14017076903 to only apply with occlusion queries

Signed-off-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Fixes: 415b824bc6 ("iris: implement occlusion query related Wa_14017076903")
Reviewed-by: Tapani Pälli <tapani.palli@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/22807>
This commit is contained in:
Lionel Landwerlin 2023-05-03 00:06:32 +03:00 committed by Marge Bot
parent 7ae6932d47
commit 1d13f22174
3 changed files with 48 additions and 11 deletions

View file

@ -850,6 +850,9 @@ struct iris_context {
/** Is a PIPE_QUERY_PRIMITIVES_GENERATED query active? */
bool prims_generated_query_active;
/** Is a PIPE_QUERY_OCCLUSION_COUNTER query active? */
bool occlusion_query_active;
/** 3DSTATE_STREAMOUT and 3DSTATE_SO_DECL_LIST packets */
uint32_t *streamout;

View file

@ -540,6 +540,11 @@ iris_begin_query(struct pipe_context *ctx, struct pipe_query *query)
ice->state.dirty |= IRIS_DIRTY_STREAMOUT | IRIS_DIRTY_CLIP;
}
if (q->type == PIPE_QUERY_OCCLUSION_COUNTER && q->index == 0) {
ice->state.occlusion_query_active = true;
ice->state.dirty |= IRIS_DIRTY_STREAMOUT;
}
if (q->type == PIPE_QUERY_SO_OVERFLOW_PREDICATE ||
q->type == PIPE_QUERY_SO_OVERFLOW_ANY_PREDICATE)
write_overflow_values(ice, q, false);
@ -579,6 +584,11 @@ iris_end_query(struct pipe_context *ctx, struct pipe_query *query)
ice->state.dirty |= IRIS_DIRTY_STREAMOUT | IRIS_DIRTY_CLIP;
}
if (q->type == PIPE_QUERY_OCCLUSION_COUNTER && q->index == 0) {
ice->state.occlusion_query_active = false;
ice->state.dirty |= IRIS_DIRTY_STREAMOUT;
}
if (q->type == PIPE_QUERY_SO_OVERFLOW_PREDICATE ||
q->type == PIPE_QUERY_SO_OVERFLOW_ANY_PREDICATE)
write_overflow_values(ice, q, true);

View file

@ -4316,17 +4316,6 @@ iris_create_so_decl_list(const struct pipe_stream_output_info *info,
sol.Buffer1SurfacePitch = 4 * info->stride[1];
sol.Buffer2SurfacePitch = 4 * info->stride[2];
sol.Buffer3SurfacePitch = 4 * info->stride[3];
#if INTEL_NEEDS_WA_14017076903
/* Wa_14017076903 : SOL should be programmed to force the
* rendering to be enabled.
*
* This fixes a rare case where SOL must render to get correct
* occlusion query results even when no PS and depth buffers are
* bound.
*/
sol.ForceRendering = Force_on;
#endif
}
iris_pack_command(GENX(3DSTATE_SO_DECL_LIST), so_decl_map, list) {
@ -6746,6 +6735,41 @@ iris_upload_dirty_render_state(struct iris_context *ice,
sol.RenderingDisable = cso_rast->rasterizer_discard &&
!ice->state.prims_generated_query_active;
sol.ReorderMode = cso_rast->flatshade_first ? LEADING : TRAILING;
#if INTEL_NEEDS_WA_14017076903
/* Wa_14017076903 :
*
* SKL PRMs, Volume 7: 3D-Media-GPGPU, Stream Output Logic (SOL) Stage:
*
* SOL_INT::Render_Enable =
* (3DSTATE_STREAMOUT::Force_Rending == Force_On) ||
* (
* (3DSTATE_STREAMOUT::Force_Rending != Force_Off) &&
* !(3DSTATE_GS::Enable && 3DSTATE_GS::Output Vertex Size == 0) &&
* !3DSTATE_STREAMOUT::API_Render_Disable &&
* (
* 3DSTATE_DEPTH_STENCIL_STATE::Stencil_TestEnable ||
* 3DSTATE_DEPTH_STENCIL_STATE::Depth_TestEnable ||
* 3DSTATE_DEPTH_STENCIL_STATE::Depth_WriteEnable ||
* 3DSTATE_PS_EXTRA::PS_Valid ||
* 3DSTATE_WM::Legacy Depth_Buffer_Clear ||
* 3DSTATE_WM::Legacy Depth_Buffer_Resolve_Enable ||
* 3DSTATE_WM::Legacy Hierarchical_Depth_Buffer_Resolve_Enable
* )
* )
*
* If SOL_INT::Render_Enable is false, the SO stage will not forward any
* topologies down the pipeline. Which is not what we want for occlusion
* queries.
*
* Here we force rendering to get SOL_INT::Render_Enable when occlusion
* queries are active.
*/
const struct iris_rasterizer_state *cso_rast = ice->state.cso_rast;
if (!cso_rast->rasterizer_discard && ice->state.occlusion_query_active)
sol.ForceRendering = Force_on;
#endif
}
assert(ice->state.streamout);