From 81546c769e69f9ed67422a778cc8cfaac3cbd3e5 Mon Sep 17 00:00:00 2001 From: Asahi Lina Date: Fri, 4 Oct 2024 01:41:25 +0900 Subject: [PATCH] asahi: Use 64bit size fields This allows for BOs >4G. Signed-off-by: Asahi Lina Part-of: --- src/asahi/lib/agx_bo.c | 8 ++++---- src/asahi/lib/agx_bo.h | 2 +- src/asahi/lib/agx_device.h | 4 ++-- src/asahi/lib/agx_va.c | 2 +- 4 files changed, 8 insertions(+), 8 deletions(-) diff --git a/src/asahi/lib/agx_bo.c b/src/asahi/lib/agx_bo.c index ed6d03a298e..1935d646f04 100644 --- a/src/asahi/lib/agx_bo.c +++ b/src/asahi/lib/agx_bo.c @@ -11,7 +11,7 @@ /* Helper to calculate the bucket index of a BO */ static unsigned -agx_bucket_index(unsigned size) +agx_bucket_index(size_t size) { /* Round down to POT to compute a bucket index */ unsigned bucket_index = util_logbase2(size); @@ -24,7 +24,7 @@ agx_bucket_index(unsigned size) } static struct list_head * -agx_bucket(struct agx_device *dev, unsigned size) +agx_bucket(struct agx_device *dev, size_t size) { return &dev->bo_cache.buckets[agx_bucket_index(size)]; } @@ -197,14 +197,14 @@ agx_bo_unreference(struct agx_device *dev, struct agx_bo *bo) } struct agx_bo * -agx_bo_create(struct agx_device *dev, unsigned size, unsigned align, +agx_bo_create(struct agx_device *dev, size_t size, unsigned align, enum agx_bo_flags flags, const char *label) { struct agx_bo *bo; assert(size > 0); /* BOs are allocated in pages */ - size = ALIGN_POT(size, dev->params.vm_page_size); + size = ALIGN_POT(size, (size_t)dev->params.vm_page_size); align = MAX2(align, dev->params.vm_page_size); /* See if we have a BO already in the cache */ diff --git a/src/asahi/lib/agx_bo.h b/src/asahi/lib/agx_bo.h index 18a8390fe51..3b307c9c61f 100644 --- a/src/asahi/lib/agx_bo.h +++ b/src/asahi/lib/agx_bo.h @@ -118,7 +118,7 @@ agx_bo_writer(uint32_t queue, uint32_t syncobj) return (((uint64_t)queue) << 32) | syncobj; } -struct agx_bo *agx_bo_create(struct agx_device *dev, unsigned size, +struct agx_bo *agx_bo_create(struct agx_device *dev, size_t size, unsigned align, enum agx_bo_flags flags, const char *label); diff --git a/src/asahi/lib/agx_device.h b/src/asahi/lib/agx_device.h index aa57a124cc9..dfb19eeabcf 100644 --- a/src/asahi/lib/agx_device.h +++ b/src/asahi/lib/agx_device.h @@ -198,7 +198,7 @@ unsigned agx_get_num_cores(const struct agx_device *dev); struct agx_device_key agx_gather_device_key(struct agx_device *dev); -struct agx_va *agx_va_alloc(struct agx_device *dev, uint32_t size_B, - uint32_t align_B, enum agx_va_flags flags, +struct agx_va *agx_va_alloc(struct agx_device *dev, uint64_t size_B, + uint64_t align_B, enum agx_va_flags flags, uint64_t fixed_va); void agx_va_free(struct agx_device *dev, struct agx_va *va); diff --git a/src/asahi/lib/agx_va.c b/src/asahi/lib/agx_va.c index 6cc344b215d..b6b5f333219 100644 --- a/src/asahi/lib/agx_va.c +++ b/src/asahi/lib/agx_va.c @@ -13,7 +13,7 @@ agx_vma_heap(struct agx_device *dev, enum agx_va_flags flags) } struct agx_va * -agx_va_alloc(struct agx_device *dev, uint32_t size_B, uint32_t align_B, +agx_va_alloc(struct agx_device *dev, uint64_t size_B, uint64_t align_B, enum agx_va_flags flags, uint64_t fixed_va) { assert((fixed_va != 0) == !!(flags & AGX_VA_FIXED));