From 765829568a6f16a9e3d985b6f6649bd54d3795d4 Mon Sep 17 00:00:00 2001 From: Mattijs Korpershoek <mkorpershoek@baylibre.com> Date: Mon, 25 Nov 2024 10:43:44 +0100 Subject: [PATCH] TI: plugin_store: Remove use of hardcoded PAGE_SIZE 4096 bionic hard-codes the PAGE_SIZE macro as 4096. This is going away as Android begins to support larger page sizes [1] Remove the usage of this hard-coded value by using getpagesize() instead as recommended by the doc [2]. [1] https://source.android.com/docs/core/architecture/16kb-page-size/16kb [2] https://source.android.com/docs/core/architecture/16kb-page-size/getting-page-size Signed-off-by: Mattijs Korpershoek <mkorpershoek@baylibre.com> --- plugin_store/C2CarveoutDmaBufAllocator.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/plugin_store/C2CarveoutDmaBufAllocator.cpp b/plugin_store/C2CarveoutDmaBufAllocator.cpp index 89b37cb..b92baf9 100644 --- a/plugin_store/C2CarveoutDmaBufAllocator.cpp +++ b/plugin_store/C2CarveoutDmaBufAllocator.cpp @@ -171,6 +171,7 @@ class C2CarveoutDmaBufAllocation : public C2LinearAllocation { c2_status_t C2CarveoutDmaBufAllocation::map(size_t offset, size_t size, C2MemoryUsage usage, C2Fence* fence, void** addr) { + static const size_t kPageSize = getpagesize(); (void)fence; // TODO: wait for fence *addr = nullptr; if (!mMappings.lock()->empty()) { @@ -193,7 +194,7 @@ c2_status_t C2CarveoutDmaBufAllocation::map(size_t offset, size_t size, C2Memory prot |= PROT_WRITE; } - size_t alignmentBytes = offset % PAGE_SIZE; + size_t alignmentBytes = offset % kPageSize; size_t mapOffset = offset - alignmentBytes; size_t mapSize = size + alignmentBytes; Mapping map = {nullptr, alignmentBytes, mapSize}; -- GitLab