[PATCH 1/2] drm/xe: Add SVG state table for Xe2

Matt Roper matthew.d.roper at intel.com
Mon Jan 29 20:14:40 UTC 2024


On Mon, Jan 29, 2024 at 11:46:14AM -0800, José Roberto de Souza wrote:
> 3DSTATE_HS has a different lenght than gfx1255+ platforms.
> 
> Signed-off-by: José Roberto de Souza <jose.souza at intel.com>
> ---
>  drivers/gpu/drm/xe/xe_lrc.c | 59 ++++++++++++++++++++++++++++++++++++-
>  1 file changed, 58 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/gpu/drm/xe/xe_lrc.c b/drivers/gpu/drm/xe/xe_lrc.c
> index f17e9785355e8..87ccff1f8e20a 100644
> --- a/drivers/gpu/drm/xe/xe_lrc.c
> +++ b/drivers/gpu/drm/xe/xe_lrc.c
> @@ -1255,6 +1255,59 @@ static const struct instr_state xe_hpg_svg_state[] = {
>  	{ .instr = CMD_3DSTATE_DRAWING_RECTANGLE, .num_dw = 4 },
>  };
>  
> +static const struct instr_state xe2_svg_state[] = {
> +	{ .instr = CMD_3DSTATE_CONSTANT_VS, .num_dw = 11 },
> +	{ .instr = CMD_3DSTATE_CONSTANT_HS, .num_dw = 11 },
> +	{ .instr = CMD_3DSTATE_CONSTANT_DS, .num_dw = 11 },
> +	{ .instr = CMD_3DSTATE_CONSTANT_GS, .num_dw = 11 },
> +	{ .instr = CMD_3DSTATE_VERTEX_ELEMENTS, .num_dw = 69 },
> +	{ .instr = CMD_3DSTATE_VF_COMPONENT_PACKING, .num_dw = 5 },
> +	{ .instr = CMD_3DSTATE_VF_SGVS, .num_dw = 2 },
> +	{ .instr = CMD_3DSTATE_VF_SGVS_2, .num_dw = 3 },
> +	{ .instr = CMD_3DSTATE_VS, .num_dw = 9 },
> +	{ .instr = CMD_3DSTATE_BINDING_TABLE_POINTERS_VS, .num_dw = 2 },
> +	{ .instr = CMD_3DSTATE_SAMPLER_STATE_POINTERS_VS, .num_dw = 2 },
> +	{ .instr = CMD_3DSTATE_URB_ALLOC_VS, .num_dw = 3 },
> +	{ .instr = CMD_3DSTATE_STREAMOUT, .num_dw = 5 },
> +	{ .instr = CMD_3DSTATE_SO_BUFFER_INDEX_0, .num_dw = 8 },
> +	{ .instr = CMD_3DSTATE_SO_BUFFER_INDEX_1, .num_dw = 8 },
> +	{ .instr = CMD_3DSTATE_SO_BUFFER_INDEX_2, .num_dw = 8 },
> +	{ .instr = CMD_3DSTATE_SO_BUFFER_INDEX_3, .num_dw = 8 },
> +	{ .instr = CMD_3DSTATE_CLIP, .num_dw = 4 },
> +	{ .instr = CMD_3DSTATE_PRIMITIVE_REPLICATION, .num_dw = 6 },
> +	{ .instr = CMD_3DSTATE_CLIP_MESH, .num_dw = 2 },
> +	{ .instr = CMD_3DSTATE_SF, .num_dw = 4 },
> +	{ .instr = CMD_3DSTATE_SCISSOR_STATE_POINTERS, .num_dw = 2 },
> +	{ .instr = CMD_3DSTATE_VIEWPORT_STATE_POINTERS_SF_CLIP, .num_dw = 2 },
> +	{ .instr = CMD_3DSTATE_RASTER, .num_dw = 5 },
> +	{ .instr = CMD_3DSTATE_TBIMR_TILE_PASS_INFO, .num_dw = 4 },
> +	{ .instr = CMD_3DSTATE_WM_HZ_OP, .num_dw = 6 },
> +	{ .instr = CMD_3DSTATE_MULTISAMPLE, .num_dw = 2 },
> +	{ .instr = CMD_3DSTATE_HS, .num_dw = 8 },

Hmm, the bspec seems to contradict itself on this one.  According to
bspec 65182, Xe2's LRC is reserving 9 dwords here rather than 8 dwords
as it might on certain other platforms.  However bspec 56209/56250 only
describe 8 dwords for 3DSTATE_HS_BODY.

Have you dumped the hardware-created context to see what size it
actually uses?  It may be that the hardware team changed the instruction
size, but continued to use 9 dwords of storage in the LRC due to an
oversight.  In general, I think it's always "safe" to have an oversized
instruction in the LRC (the instruction's "length" field is mainly just
used by the instruction parser to figure out where the start of the next
instruction will be, and any unnecessary dwords are 0 and just wind up
getting treated as harmless noops).


Matt

> +	{ .instr = CMD_3DSTATE_BINDING_TABLE_POINTERS_HS, .num_dw = 2 },
> +	{ .instr = CMD_3DSTATE_SAMPLER_STATE_POINTERS_HS, .num_dw = 2 },
> +	{ .instr = CMD_3DSTATE_URB_ALLOC_HS, .num_dw = 3 },
> +	{ .instr = CMD_3DSTATE_TASK_CONTROL, .num_dw = 3 },
> +	{ .instr = CMD_3DSTATE_TASK_SHADER, .num_dw = 7 },
> +	{ .instr = CMD_3DSTATE_TASK_SHADER_DATA, .num_dw = 10 },
> +	{ .instr = CMD_3DSTATE_URB_ALLOC_TASK, .num_dw = 3 },
> +	{ .instr = CMD_3DSTATE_TE, .num_dw = 5 },
> +	{ .instr = CMD_3DSTATE_TASK_REDISTRIB, .num_dw = 2 },
> +	{ .instr = CMD_3DSTATE_DS, .num_dw = 11 },
> +	{ .instr = CMD_3DSTATE_BINDING_TABLE_POINTERS_DS, .num_dw = 2 },
> +	{ .instr = CMD_3DSTATE_SAMPLER_STATE_POINTERS_DS, .num_dw = 2 },
> +	{ .instr = CMD_3DSTATE_URB_ALLOC_DS, .num_dw = 3 },
> +	{ .instr = CMD_3DSTATE_GS, .num_dw = 10 },
> +	{ .instr = CMD_3DSTATE_BINDING_TABLE_POINTERS_GS, .num_dw = 2 },
> +	{ .instr = CMD_3DSTATE_SAMPLER_STATE_POINTERS_GS, .num_dw = 2 },
> +	{ .instr = CMD_3DSTATE_URB_ALLOC_GS, .num_dw = 3 },
> +	{ .instr = CMD_3DSTATE_MESH_CONTROL, .num_dw = 3 },
> +	{ .instr = CMD_3DSTATE_MESH_SHADER_DATA, .num_dw = 10 },
> +	{ .instr = CMD_3DSTATE_URB_ALLOC_MESH, .num_dw = 3 },
> +	{ .instr = CMD_3DSTATE_MESH_SHADER, .num_dw = 8 },
> +	{ .instr = CMD_3DSTATE_DRAWING_RECTANGLE, .num_dw = 4 },
> +};
> +
>  void xe_lrc_emit_hwe_state_instructions(struct xe_exec_queue *q, struct xe_bb *bb)
>  {
>  	struct xe_gt *gt = q->hwe->gt;
> @@ -1271,10 +1324,14 @@ void xe_lrc_emit_hwe_state_instructions(struct xe_exec_queue *q, struct xe_bb *b
>  
>  	switch (GRAPHICS_VERx100(xe)) {
>  	case 1255:
> -	case 1270 ... 2004:
> +	case 1270:
>  		state_table = xe_hpg_svg_state;
>  		state_table_size = ARRAY_SIZE(xe_hpg_svg_state);
>  		break;
> +	case 2000 ... 2004:
> +		state_table = xe2_svg_state;
> +		state_table_size = ARRAY_SIZE(xe2_svg_state);
> +		break;
>  	default:
>  		xe_gt_dbg(gt, "No non-register state to emit on graphics ver %d.%02d\n",
>  			  GRAPHICS_VER(xe), GRAPHICS_VERx100(xe) % 100);
> -- 
> 2.43.0
> 

-- 
Matt Roper
Graphics Software Engineer
Linux GPU Platform Enablement
Intel Corporation


More information about the Intel-xe mailing list