[PATCH v8 4/7] drm/xe: Allow specifying number of extra dwords at the end of wa bb emission

Tvrtko Ursulin tvrtko.ursulin at igalia.com
Wed Jul 9 07:50:11 UTC 2025


On 08/07/2025 23:11, Lucas De Marchi wrote:
> On Thu, Jul 03, 2025 at 09:20:56AM +0100, Tvrtko Ursulin wrote:
>> Indirect context setup will need more than one.
>>
>> Signed-off-by: Tvrtko Ursulin <tvrtko.ursulin at igalia.com>
>> Cc: Lucas De Marchi <lucas.demarchi at intel.com>
>> ---
>> drivers/gpu/drm/xe/xe_lrc.c | 8 ++++----
>> 1 file changed, 4 insertions(+), 4 deletions(-)
>>
>> diff --git a/drivers/gpu/drm/xe/xe_lrc.c b/drivers/gpu/drm/xe/xe_lrc.c
>> index 7f8911a10cc9..e278c12a41f9 100644
>> --- a/drivers/gpu/drm/xe/xe_lrc.c
>> +++ b/drivers/gpu/drm/xe/xe_lrc.c
>> @@ -982,6 +982,7 @@ static u32 *
>> setup_bo(struct xe_lrc *lrc,
>>      struct xe_hw_engine *hwe,
>>      const size_t max_size,
>> +     unsigned int reserve_dw,
>>      unsigned int offset,
>>      const struct bo_setup *funcs,
>>      unsigned int num_funcs,
> 
> one by one these arguments make sense. Together they are pretty hard to
> add a call to this function. We will probably need to change this to
> keep the state separate or something like that.

Yes it is not the prettiest. From what we talked before I understood you 
are okay to leave the conversion to a struct state for later, but if you 
want I can try something straight away.

Regards,

Tvrtko

>> @@ -1010,10 +1011,9 @@ setup_bo(struct xe_lrc *lrc,
>>         remain -= len;
>>
>>         /*
>> -         * There should always be at least 1 additional dword for
>> -         * the end marker
>> +         * Caller has asked for at least reserve_dw to remain unused.
>>          */
>> -        if (len < 0 || xe_gt_WARN_ON(lrc->gt, remain < 1))
>> +        if (len < 0 || xe_gt_WARN_ON(lrc->gt, remain < reserve_dw))
>>             goto fail;
>>
>>         cmd += len;
>> @@ -1049,7 +1049,7 @@ static int setup_wa_bb(struct xe_lrc *lrc, 
>> struct xe_hw_engine *hwe)
>>     unsigned int written = 0;
>>     u32 *cmd, *buf = NULL;
>>
>> -    cmd = setup_bo(lrc, hwe, LRC_WA_BB_SIZE, offset, funcs,
>> +    cmd = setup_bo(lrc, hwe, LRC_WA_BB_SIZE, 1, offset, funcs,
>>                ARRAY_SIZE(funcs), &buf, &written);
>>     if (IS_ERR(cmd))
>>         return PTR_ERR(cmd);
>> -- 
>> 2.48.0
>>



More information about the Intel-xe mailing list