gfxstream: nuke util function

Use ALIGN_POT instead.

Acked-by: Yonggang Luo <luoyonggang@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/31548>
This commit is contained in:
Gurchetan Singh 2024-10-03 14:53:17 -07:00 committed by Marge Bot
parent 5b82c130d9
commit 34e0394580
4 changed files with 5 additions and 17 deletions

View file

@ -11,7 +11,6 @@
#include <unistd.h>
#include "VirtGpu.h"
#include "util.h"
#include "util/log.h"
#include "util/perf/cpu_trace.h"
#include "virtgpu_gfxstream_protocol.h"

View file

@ -8,7 +8,6 @@
#include <errno.h>
#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;

View file

@ -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

View file

@ -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);
}