winsys/amdgpu: set max_ib_size and max_check_space_size later in cs_check_space

If there is enough CS space, don't update them. This eliminates some overhead.

Reviewed-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/13400>
This commit is contained in:
Marek Olšák 2021-10-18 00:40:54 -04:00 committed by Marge Bot
parent 6129db68bf
commit c5f39acb33
1 changed files with 7 additions and 8 deletions

View File

@ -1074,26 +1074,25 @@ static bool amdgpu_cs_check_space(struct radeon_cmdbuf *rcs, unsigned dw)
{
struct amdgpu_cs *cs = amdgpu_cs(rcs);
struct amdgpu_ib *ib = &cs->main;
unsigned cs_epilog_dw = amdgpu_cs_epilog_dws(cs);
unsigned need_byte_size = (dw + cs_epilog_dw) * 4;
assert(rcs->current.cdw <= rcs->current.max_dw);
/* 125% of the size for IB epilog. */
unsigned safe_byte_size = need_byte_size + need_byte_size / 4;
ib->max_check_space_size = MAX2(ib->max_check_space_size,
safe_byte_size);
unsigned requested_size = rcs->prev_dw + rcs->current.cdw + dw;
if (requested_size > IB_MAX_SUBMIT_DWORDS)
return false;
ib->max_ib_size = MAX2(ib->max_ib_size, requested_size);
if (rcs->current.max_dw - rcs->current.cdw >= dw)
return true;
unsigned cs_epilog_dw = amdgpu_cs_epilog_dws(cs);
unsigned need_byte_size = (dw + cs_epilog_dw) * 4;
unsigned safe_byte_size = need_byte_size + need_byte_size / 4;
ib->max_check_space_size = MAX2(ib->max_check_space_size,
safe_byte_size);
ib->max_ib_size = MAX2(ib->max_ib_size, requested_size);
if (!cs->has_chaining)
return false;