[PATCH 1/2] drm/xe: Simplify batch buffer allocation in emit_wa_job()
Tvrtko Ursulin
tvrtko.ursulin at igalia.com
Mon Jun 30 07:44:58 UTC 2025
On 27/06/2025 23:47, Lucas De Marchi wrote:
> On Fri, Jun 27, 2025 at 02:14:37PM +0100, Tvrtko Ursulin wrote:
>> Code just needs a large enough buffer and it doesn't even check. Lets
>> therefore simplify to one allocation path which is guaranteed to be as
>> least as big as the current ones.
>
> In my stashed patches (not sent yet since they don't fix an LRC
> corruption we are chasing) I went the other way around:
>
> b1f0626cb3d3 o drm/xe/gt: Extract emit_job_sync()
> 979fe60f3883 o drm/xe: Count dwords before allocating
> 5dca40d2503f o drm/xe/lrc: Reduce scope of empty lrc data
> d892c8ac707a o drm/xe/lrc: Add table with LRC layout
>
> ... particularly the "Count dwords before allocating".
Sounds good from the titles. Carry on as planned. :)
Regards,
Tvrtko
>> Signed-off-by: Tvrtko Ursulin <tvrtko.ursulin at igalia.com>
>> ---
>> drivers/gpu/drm/xe/xe_gt.c | 9 ++-------
>> 1 file changed, 2 insertions(+), 7 deletions(-)
>>
>> diff --git a/drivers/gpu/drm/xe/xe_gt.c b/drivers/gpu/drm/xe/xe_gt.c
>> index d397df056e4c..86018fee74d3 100644
>> --- a/drivers/gpu/drm/xe/xe_gt.c
>> +++ b/drivers/gpu/drm/xe/xe_gt.c
>> @@ -190,13 +190,8 @@ static int emit_wa_job(struct xe_gt *gt, struct
>> xe_exec_queue *q)
>> int count_rmw = 0;
>> int count = 0;
>>
>> - if (q->hwe->class == XE_ENGINE_CLASS_RENDER)
>> - /* Big enough to emit all of the context's 3DSTATE */
>> - bb = xe_bb_new(gt, xe_gt_lrc_size(gt, q->hwe->class), false);
>> - else
>> - /* Just pick a large BB size */
>> - bb = xe_bb_new(gt, SZ_4K, false);
>> -
>> + /* Just pick a large BB size */
>> + bb = xe_bb_new(gt, xe_gt_lrc_size(gt, q->hwe->class), false);
>> if (IS_ERR(bb))
>> return PTR_ERR(bb);
>>
>> --
>> 2.48.0
>>
More information about the Intel-xe
mailing list