Signed-off-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Reviewed-by: Boris Brezillon <boris.brezillon@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/5859>
*
* Copyright 2018-2019 Alyssa Rosenzweig
* Copyright 2018-2019 Collabora, Ltd.
*
* Copyright 2018-2019 Alyssa Rosenzweig
* Copyright 2018-2019 Collabora, Ltd.
+ * Copyright © 2015 Intel Corporation
* All Rights Reserved.
*
* Permission is hereby granted, free of charge, to any person obtaining a
* All Rights Reserved.
*
* Permission is hereby granted, free of charge, to any person obtaining a
#include "util/bitset.h"
#include "util/set.h"
#include "util/list.h"
#include "util/bitset.h"
#include "util/set.h"
#include "util/list.h"
+#include "util/sparse_array.h"
#include <panfrost-misc.h>
#include <panfrost-misc.h>
pthread_mutex_t active_bos_lock;
struct set *active_bos;
pthread_mutex_t active_bos_lock;
struct set *active_bos;
+ pthread_mutex_t bo_map_lock;
+ struct util_sparse_array bo_map;
+
struct {
pthread_mutex_t lock;
struct {
pthread_mutex_t lock;
void
panfrost_close_device(struct panfrost_device *dev);
void
panfrost_close_device(struct panfrost_device *dev);
+static inline struct panfrost_bo *
+pan_lookup_bo(struct panfrost_device *dev, uint32_t gem_handle)
+{
+ return util_sparse_array_get(&dev->bo_map, gem_handle);
+}
+
dev->active_bos = _mesa_set_create(memctx,
panfrost_active_bos_hash, panfrost_active_bos_cmp);
dev->active_bos = _mesa_set_create(memctx,
panfrost_active_bos_hash, panfrost_active_bos_cmp);
+ util_sparse_array_init(&dev->bo_map, sizeof(struct panfrost_bo), 512);
+
pthread_mutex_init(&dev->bo_cache.lock, NULL);
list_inithead(&dev->bo_cache.lru);
pthread_mutex_init(&dev->bo_cache.lock, NULL);
list_inithead(&dev->bo_cache.lru);
pthread_mutex_destroy(&dev->bo_cache.lock);
pthread_mutex_destroy(&dev->active_bos_lock);
drmFreeVersion(dev->kernel_version);
pthread_mutex_destroy(&dev->bo_cache.lock);
pthread_mutex_destroy(&dev->active_bos_lock);
drmFreeVersion(dev->kernel_version);
+ util_sparse_array_finish(&dev->bo_map);