From f0a165799ce5f7ebe1d9f5ea797a1b3fb8a8a14d Mon Sep 17 00:00:00 2001 From: Faith Ekstrand Date: Wed, 19 Jul 2023 17:03:30 -0500 Subject: [PATCH] nvk: Add an addr field to nvk_image_plane Nothing actually needs the pointer to the memory object so it's better to not even include it. Part-of: --- src/nouveau/vulkan/nvk_image.c | 9 +++------ src/nouveau/vulkan/nvk_image.h | 7 +++---- 2 files changed, 6 insertions(+), 10 deletions(-) diff --git a/src/nouveau/vulkan/nvk_image.c b/src/nouveau/vulkan/nvk_image.c index 2635d28..6a06f22 100644 --- a/src/nouveau/vulkan/nvk_image.c +++ b/src/nouveau/vulkan/nvk_image.c @@ -610,14 +610,11 @@ nvk_image_plane_bind(struct nvk_image_plane *plane, *offset_B = ALIGN_POT(*offset_B, plane->nil.align_B); if (mem->dedicated_image_plane == plane) { assert(*offset_B == 0); - plane->mem = mem; - plane->offset = 0; + plane->addr = mem->bo->offset; } else if (plane->internal != NULL) { - plane->mem = plane->internal; - plane->offset = 0; + plane->addr = plane->internal->bo->offset; } else { - plane->mem = mem; - plane->offset = *offset_B; + plane->addr = mem->bo->offset + *offset_B; } *offset_B += plane->nil.size_B; } diff --git a/src/nouveau/vulkan/nvk_image.h b/src/nouveau/vulkan/nvk_image.h index 2e731970..f5dec2c 100644 --- a/src/nouveau/vulkan/nvk_image.h +++ b/src/nouveau/vulkan/nvk_image.h @@ -14,15 +14,14 @@ VkFormatFeatureFlags2 nvk_get_image_format_features(struct nvk_physical_device *pdevice, VkFormat format, VkImageTiling tiling); - struct nvk_image_plane { struct nil_image nil; - struct nvk_device_memory *mem; - VkDeviceSize offset; + uint64_t addr; /* Used for internal dedicated allocations */ struct nvk_device_memory *internal; }; + struct nvk_image { struct vk_image vk; @@ -49,7 +48,7 @@ VK_DEFINE_NONDISP_HANDLE_CASTS(nvk_image, vk.base, VkImage, VK_OBJECT_TYPE_IMAGE static inline uint64_t nvk_image_plane_base_address(const struct nvk_image_plane *plane) { - return plane->mem->bo->offset + plane->offset; + return plane->addr; } static inline uint64_t -- 2.7.4