Use magma::page_size()/magma::page_shift()
These provide a posix-compatible way to resolve these values that
enables linux build targets.
Test: $ tiles_ctl add
fuchsia-pkg://fuchsia.com/spinning_square_view#meta/spinning_square_view.cmx
Change-Id: I9a4b60996bfd887e0d77d8007ded2be22a1305b8
diff --git a/src/intel/vulkan/anv_magma_connection.cc b/src/intel/vulkan/anv_magma_connection.cc
index 9423d25..8f63954 100644
--- a/src/intel/vulkan/anv_magma_connection.cc
+++ b/src/intel/vulkan/anv_magma_connection.cc
@@ -13,16 +13,6 @@
#include <mutex>
#include <vector>
-#ifndef PAGE_SHIFT
-
-#if PAGE_SIZE == 4096
-#define PAGE_SHIFT 12
-#else
-#error PAGE_SHIFT not defined
-#endif
-
-#endif
-
class Buffer : public anv_magma_buffer {
public:
Buffer(magma_buffer_t buffer) { anv_magma_buffer::buffer = buffer; }
@@ -98,13 +88,13 @@
{
std::lock_guard<std::mutex> lock(allocator_mutex_);
- uint64_t length = (page_count + guard_page_count_) * PAGE_SIZE;
+ uint64_t length = (page_count + guard_page_count_) * magma::page_size();
if (length > allocator_->size())
return DRETF(false, "length (0x%lx) > address space size (0x%lx)", length,
allocator_->size());
- if (!allocator_->Alloc(length, PAGE_SHIFT, gpu_addr_out))
+ if (!allocator_->Alloc(length, magma::page_shift(), gpu_addr_out))
return DRETF(false, "failed to allocate gpu address");
return true;
@@ -205,8 +195,9 @@
if (!magma::is_page_aligned(offset))
return DRET_MSG(-1, "offset (0x%lx) not page aligned", offset);
- uint64_t page_offset = offset / PAGE_SIZE;
- uint64_t page_count = magma::round_up(exec_objects[i].rsvd2, PAGE_SIZE) / PAGE_SIZE;
+ uint64_t page_offset = offset / magma::page_size();
+ uint64_t page_count =
+ magma::round_up(exec_objects[i].rsvd2, magma::page_size()) / magma::page_size();
if (!buffer->HasMapping(page_offset, page_count, nullptr)) {
uint64_t gpu_addr;