This will be useful right now so we avoid retrieving a non-executable
buffer when a executable one is needed.
As we support more flags, this logic will need to be extended to
consider the different trade-offs to be made when matching BO
specifications to BOs in the cache.
Signed-off-by: Tomeu Vizoso <tomeu.vizoso@collabora.com>
Reviewed-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
size_t size;
int gem_handle;
+
+ uint32_t flags;
};
struct panfrost_memory {
{
struct list_head *bucket = pan_bucket(screen, size);
- /* TODO: Honour flags? */
-
/* Iterate the bucket looking for something suitable */
list_for_each_entry_safe(struct panfrost_bo, entry, bucket, link) {
- if (entry->size >= size) {
+ if (entry->size >= size &&
+ entry->flags == flags) {
/* This one works, splice it out of the cache */
list_del(&entry->link);
bo->size = create_bo.size;
bo->gpu = create_bo.offset;
bo->gem_handle = create_bo.handle;
+ bo->flags = flags;
}
/* Only mmap now if we know we need to. For CPU-invisible buffers, we