diff --git a/src/gfxstream/guest/GoldfishAddressSpace/AddressSpaceStream.cpp b/src/gfxstream/guest/GoldfishAddressSpace/AddressSpaceStream.cpp index e95a38a17df..9c025b526fe 100644 --- a/src/gfxstream/guest/GoldfishAddressSpace/AddressSpaceStream.cpp +++ b/src/gfxstream/guest/GoldfishAddressSpace/AddressSpaceStream.cpp @@ -11,7 +11,6 @@ #include #include "VirtGpu.h" -#include "util.h" #include "util/log.h" #include "util/perf/cpu_trace.h" #include "virtgpu_gfxstream_protocol.h" diff --git a/src/gfxstream/guest/GoldfishAddressSpace/VirtioGpuAddressSpaceStream.cpp b/src/gfxstream/guest/GoldfishAddressSpace/VirtioGpuAddressSpaceStream.cpp index 0c304b543a3..4780faef3b2 100644 --- a/src/gfxstream/guest/GoldfishAddressSpace/VirtioGpuAddressSpaceStream.cpp +++ b/src/gfxstream/guest/GoldfishAddressSpace/VirtioGpuAddressSpaceStream.cpp @@ -8,7 +8,6 @@ #include #include "util/log.h" -#include "util/u_math.h" static bool GetRingParamsFromCapset(enum VirtGpuCapset capset, const VirtGpuCaps& caps, uint32_t& ringSize, uint32_t& bufferSize, @@ -93,7 +92,7 @@ AddressSpaceStream* createVirtioGpuAddressSpaceStream(enum VirtGpuCapset capset) blobCreate.blobId = 0; blobCreate.blobMem = kBlobMemHost3d; blobCreate.flags = kBlobFlagMappable; - blobCreate.size = ALIGN(ringSize + bufferSize, blobAlignment); + blobCreate.size = ALIGN_POT(ringSize + bufferSize, blobAlignment); blob = instance->createBlob(blobCreate); if (!blob) return nullptr; diff --git a/src/gfxstream/guest/platform/include/util.h b/src/gfxstream/guest/platform/include/util.h deleted file mode 100644 index b0ac75305c1..00000000000 --- a/src/gfxstream/guest/platform/include/util.h +++ /dev/null @@ -1,10 +0,0 @@ -/* - * Copyright 2023 Google - * SPDX-License-Identifier: MIT - */ -#ifndef UTIL_H -#define UTIL_H - -#define ALIGN(A, B) (((A) + (B)-1) & ~((B)-1)) - -#endif diff --git a/src/gfxstream/guest/vulkan_enc/ResourceTracker.cpp b/src/gfxstream/guest/vulkan_enc/ResourceTracker.cpp index 8a49d374ce0..952eb4d3c67 100644 --- a/src/gfxstream/guest/vulkan_enc/ResourceTracker.cpp +++ b/src/gfxstream/guest/vulkan_enc/ResourceTracker.cpp @@ -13,7 +13,6 @@ #include "gfxstream_vk_private.h" #include "goldfish_address_space.h" #include "goldfish_vk_private_defs.h" -#include "util.h" #include "util/macros.h" #include "virtgpu_gfxstream_protocol.h" #include "vulkan/vulkan_core.h" @@ -3020,13 +3019,14 @@ VkResult ResourceTracker::allocateCoherentMemory(VkDevice device, if (mCaps.vulkanCapset.deferredMapping || mCaps.params[kParamCreateGuestHandle]) { hostAllocationInfo.allocationSize = - ALIGN(pAllocateInfo->allocationSize, mCaps.vulkanCapset.blobAlignment); + ALIGN_POT(pAllocateInfo->allocationSize, mCaps.vulkanCapset.blobAlignment); } else if (dedicated) { // Over-aligning to kLargestSize to some Windows drivers (b:152769369). Can likely // have host report the desired alignment. - hostAllocationInfo.allocationSize = ALIGN(pAllocateInfo->allocationSize, kLargestPageSize); + hostAllocationInfo.allocationSize = + ALIGN_POT(pAllocateInfo->allocationSize, kLargestPageSize); } else { - VkDeviceSize roundedUpAllocSize = ALIGN(pAllocateInfo->allocationSize, kMegaByte); + VkDeviceSize roundedUpAllocSize = ALIGN_POT(pAllocateInfo->allocationSize, kMegaByte); hostAllocationInfo.allocationSize = std::max(roundedUpAllocSize, kDefaultHostMemBlockSize); }