nvk/nvkmd: Be more specific about memory alignments
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/30033>
This commit is contained in:

committed by
Marge Bot

parent
1db57bb414
commit
7f45d20d2b
@@ -59,6 +59,9 @@ VkResult nvkmd_nouveau_create_dev(struct nvkmd_pdev *pdev,
|
||||
struct vk_object_base *log_obj,
|
||||
struct nvkmd_dev **dev_out);
|
||||
|
||||
#define NVKMD_NOUVEAU_GART_ALIGN_B (1 << 12)
|
||||
#define NVKMD_NOUVEAU_VRAM_ALIGN_B (1 << 16)
|
||||
|
||||
struct nvkmd_nouveau_mem {
|
||||
struct nvkmd_mem base;
|
||||
|
||||
|
@@ -111,6 +111,15 @@ nvkmd_nouveau_alloc_tiled_mem(struct nvkmd_dev *_dev,
|
||||
domains = NOUVEAU_WS_BO_GART;
|
||||
}
|
||||
|
||||
uint32_t mem_align_B = NVKMD_NOUVEAU_GART_ALIGN_B;
|
||||
if (domains & NOUVEAU_WS_BO_VRAM)
|
||||
mem_align_B = NVKMD_NOUVEAU_VRAM_ALIGN_B;
|
||||
|
||||
size_B = align64(size_B, mem_align_B);
|
||||
|
||||
assert(util_is_power_of_two_or_zero64(align_B));
|
||||
const uint64_t va_align_B = MAX2(mem_align_B, align_B);
|
||||
|
||||
enum nouveau_ws_bo_flags nouveau_flags = domains;
|
||||
if (flags & NVKMD_MEM_CAN_MAP)
|
||||
nouveau_flags |= NOUVEAU_WS_BO_MAP;
|
||||
@@ -118,13 +127,13 @@ nvkmd_nouveau_alloc_tiled_mem(struct nvkmd_dev *_dev,
|
||||
nouveau_flags |= NOUVEAU_WS_BO_NO_SHARE;
|
||||
|
||||
struct nouveau_ws_bo *bo = nouveau_ws_bo_new_tiled(dev->ws_dev,
|
||||
size_B, align_B,
|
||||
size_B, mem_align_B,
|
||||
pte_kind, tile_mode,
|
||||
nouveau_flags);
|
||||
if (bo == NULL)
|
||||
return vk_errorf(log_obj, VK_ERROR_OUT_OF_DEVICE_MEMORY, "%m");
|
||||
|
||||
return create_mem_or_close_bo(dev, log_obj, align_B, pte_kind,
|
||||
return create_mem_or_close_bo(dev, log_obj, va_align_B, pte_kind,
|
||||
flags, bo, mem_out);
|
||||
}
|
||||
|
||||
|
@@ -69,6 +69,12 @@ enum nvkmd_va_flags {
|
||||
|
||||
/** Attempt to place this VA at the requested address and fail otherwise */
|
||||
NVKMD_VA_ALLOC_FIXED = 1 << 2,
|
||||
|
||||
/** This VA will only be used with GART.
|
||||
*
|
||||
* Alignment requirements for GART-only are lower.
|
||||
*/
|
||||
NVKMD_VA_GART_ONLY = 1 << 3,
|
||||
};
|
||||
|
||||
enum nvkmd_engines {
|
||||
|
Reference in New Issue
Block a user