nouveau/winsys: Make BO_LOCAL and BO_GART separate flags

It's sometimes useful to specify both to allow migration.

Reviewed-by: Dave Airlie <airlied@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24795>
This commit is contained in:
Faith Ekstrand 2024-05-07 10:50:46 -05:00 committed by Marge Bot
parent 19b143b7bc
commit 6cd58de4eb
3 changed files with 16 additions and 9 deletions

View file

@ -127,7 +127,7 @@ nvk_AllocateMemory(VkDevice device,
nvk_memory_type_flags(type, handle_types);
uint32_t alignment = (1ULL << 12);
if (!(flags & NOUVEAU_WS_BO_GART))
if (flags & NOUVEAU_WS_BO_LOCAL)
alignment = (1ULL << 16);
const uint64_t aligned_size =

View file

@ -189,6 +189,15 @@ nouveau_ws_bo_new_locked(struct nouveau_ws_device *dev,
req.info.domain = 0;
/* It needs to live somewhere */
assert((flags & NOUVEAU_WS_BO_LOCAL) || (flags & NOUVEAU_WS_BO_GART));
if (flags & NOUVEAU_WS_BO_LOCAL)
req.info.domain |= dev->local_mem_domain;
if (flags & NOUVEAU_WS_BO_GART)
req.info.domain |= NOUVEAU_GEM_DOMAIN_GART;
/* TODO:
*
* VRAM maps on Kepler appear to be broken and we don't really know why.
@ -196,12 +205,8 @@ nouveau_ws_bo_new_locked(struct nouveau_ws_device *dev,
* should but they don't today. Force everything that may be mapped to
* use GART for now.
*/
if (flags & NOUVEAU_WS_BO_GART)
req.info.domain |= NOUVEAU_GEM_DOMAIN_GART;
else if (dev->info.chipset < 0x110 && (flags & NOUVEAU_WS_BO_MAP))
req.info.domain |= NOUVEAU_GEM_DOMAIN_GART;
else
req.info.domain |= dev->local_mem_domain;
if (flags & NOUVEAU_WS_BO_MAP)
req.info.domain |= NOUVEAU_GEM_DOMAIN_MAPPABLE;
@ -289,6 +294,8 @@ nouveau_ws_bo_from_dma_buf_locked(struct nouveau_ws_device *dev, int fd)
goto fail_fd_to_handle;
enum nouveau_ws_bo_flags flags = 0;
if (info.domain & dev->local_mem_domain)
flags |= NOUVEAU_WS_BO_LOCAL;
if (info.domain & NOUVEAU_GEM_DOMAIN_GART)
flags |= NOUVEAU_WS_BO_GART;
if (info.map_handle)

View file

@ -20,10 +20,10 @@ extern "C" {
enum nouveau_ws_bo_flags {
/* vram or gart depending on GPU */
NOUVEAU_WS_BO_LOCAL = 0 << 0,
NOUVEAU_WS_BO_GART = 1 << 0,
NOUVEAU_WS_BO_MAP = 1 << 1,
NOUVEAU_WS_BO_NO_SHARE = 1 << 2,
NOUVEAU_WS_BO_LOCAL = 1 << 0,
NOUVEAU_WS_BO_GART = 1 << 1,
NOUVEAU_WS_BO_MAP = 1 << 2,
NOUVEAU_WS_BO_NO_SHARE = 1 << 3,
};
enum nouveau_ws_bo_map_flags {