nouveau/winsys: Retrieve and store the PTE kind in the nouveau_ws_bo

Previously, for imports we wouldn't carry over the PTE kind with the import,
which worked fine up till now. However, compression depends on the PTE kind
being correct otherwise there will be a mismatch between both sides.

The GEM info object we get from the kernel already has the PTE kind embedded in
the tile flags object, so all we have to do is retrieve it and store in the bo
object, and then the lower layers can retrieve the kind from the bo directly.

Reviewed-by: Mel Henning <mhenning@darkrefraction.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/38702>
This commit is contained in:
Mohamed Ahmed 2025-10-14 14:39:43 +03:00 committed by Marge Bot
parent 3af0ee04a5
commit 88b92dc3d3
3 changed files with 6 additions and 4 deletions

View file

@ -28,10 +28,11 @@ create_mem_or_close_bo(struct nvkmd_nouveau_dev *dev,
enum nvkmd_mem_flags mem_flags,
struct nouveau_ws_bo *bo,
enum nvkmd_va_flags va_flags,
uint8_t pte_kind, uint64_t va_align_B,
uint64_t va_align_B,
struct nvkmd_mem **mem_out)
{
const uint64_t size_B = bo->size;
const uint8_t pte_kind = bo->pte_kind;
VkResult result;
struct nvkmd_nouveau_mem *mem = CALLOC_STRUCT(nvkmd_nouveau_mem);
@ -162,8 +163,7 @@ nvkmd_nouveau_alloc_tiled_mem(struct nvkmd_dev *_dev,
va_flags |= NVKMD_VA_GART;
return create_mem_or_close_bo(dev, log_obj, flags, bo,
va_flags, pte_kind, va_align_B,
mem_out);
va_flags, va_align_B, mem_out);
}
VkResult
@ -197,7 +197,6 @@ nvkmd_nouveau_import_dma_buf(struct nvkmd_dev *_dev,
return create_mem_or_close_bo(dev, log_obj, flags, bo,
0 /* va_flags */,
0 /* pte_kind */,
0 /* va_align_B */,
mem_out);
}

View file

@ -134,6 +134,7 @@ nouveau_ws_bo_new_tiled_locked(struct nouveau_ws_device *dev,
bo->dev = dev;
bo->flags = flags;
bo->refcnt = 1;
bo->pte_kind = pte_kind;
_mesa_hash_table_insert(dev->bos, (void *)(uintptr_t)bo->handle, bo);
@ -210,6 +211,7 @@ nouveau_ws_bo_from_dma_buf_locked(struct nouveau_ws_device *dev, int fd)
bo->dev = dev;
bo->flags = flags;
bo->refcnt = 1;
bo->pte_kind = (info.tile_flags & 0x0000ff00) >> 8;
_mesa_hash_table_insert(dev->bos, (void *)(uintptr_t)handle, bo);

View file

@ -40,6 +40,7 @@ struct nouveau_ws_bo {
uint32_t handle;
enum nouveau_ws_bo_flags flags;
atomic_uint_fast32_t refcnt;
uint8_t pte_kind;
};
void nouveau_ws_bo_bind_vma(struct nouveau_ws_device *dev,