diff options
author | Marek Olšák <marek.olsak@amd.com> | 2021-10-21 22:57:43 -0400 |
---|---|---|
committer | Marge Bot <emma+marge@anholt.net> | 2021-10-29 06:54:21 +0000 |
commit | f815009036837cb28a349f74ab9614ead75b0e8a (patch) | |
tree | 2ef2092115f8a375a794aafc4cbaf2f5e4ae3d4f /src/gallium/winsys/radeon | |
parent | a0f05a5b205d204c42d81d27d9f2c5d457bdd38c (diff) |
gallium/radeon: change the BO priority definitions to bits
This is for the next microoptimization.
Reviewed-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/13478>
Diffstat (limited to 'src/gallium/winsys/radeon')
-rw-r--r-- | src/gallium/winsys/radeon/drm/radeon_drm_cs.c | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/src/gallium/winsys/radeon/drm/radeon_drm_cs.c b/src/gallium/winsys/radeon/drm/radeon_drm_cs.c index 0e37d1c732a..59ce65f0b70 100644 --- a/src/gallium/winsys/radeon/drm/radeon_drm_cs.c +++ b/src/gallium/winsys/radeon/drm/radeon_drm_cs.c @@ -362,7 +362,7 @@ static unsigned radeon_drm_cs_add_buffer(struct radeon_cmdbuf *rcs, struct pb_buffer *buf, enum radeon_bo_usage usage, enum radeon_bo_domain domains, - enum radeon_bo_priority priority) + unsigned priority) { struct radeon_drm_cs *cs = radeon_drm_cs(rcs); struct radeon_bo *bo = (struct radeon_bo*)buf; @@ -394,8 +394,11 @@ static unsigned radeon_drm_cs_add_buffer(struct radeon_cmdbuf *rcs, added_domains = (rd | wd) & ~(reloc->read_domains | reloc->write_domain); reloc->read_domains |= rd; reloc->write_domain |= wd; - reloc->flags = MAX2(reloc->flags, priority); - cs->csc->relocs_bo[index].u.real.priority_usage |= 1u << priority; + + /* The priority must be in [0, 15]. It's used by the kernel memory management. */ + unsigned bo_priority = util_last_bit(priority) / 2; + reloc->flags = MAX2(reloc->flags, bo_priority); + cs->csc->relocs_bo[index].u.real.priority_usage |= priority; if (added_domains & RADEON_DOMAIN_VRAM) rcs->used_vram_kb += bo->base.size / 1024; |