summaryrefslogtreecommitdiff
path: root/freedreno
diff options
context:
space:
mode:
authorRob Clark <robclark@freedesktop.org>2014-10-22 12:57:16 -0400
committerRob Clark <robclark@freedesktop.org>2014-11-18 12:17:09 -0500
commit5306078bbe21e05365700c186c6c8a1ae86b776c (patch)
treebbf1db58dad2ce3ef0869d4876210f56f4e35f26 /freedreno
parent00847fa48b83a85b0cb882594a12ed1511f780db (diff)
freedreno: do handle lookup on handle and dmabuf import
We also need to check handle_table in the _from_handle() path and the _from_dmabuf() (which goes through _from_handle()) to avoid duplicate imports. Signed-off-by: Rob Clark <robclark@freedesktop.org>
Diffstat (limited to 'freedreno')
-rw-r--r--freedreno/freedreno_bo.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/freedreno/freedreno_bo.c b/freedreno/freedreno_bo.c
index fe8f503d..9089c931 100644
--- a/freedreno/freedreno_bo.c
+++ b/freedreno/freedreno_bo.c
@@ -207,7 +207,14 @@ fd_bo_from_handle(struct fd_device *dev, uint32_t handle, uint32_t size)
struct fd_bo *bo = NULL;
pthread_mutex_lock(&table_lock);
+
+ bo = lookup_bo(dev->handle_table, handle);
+ if (bo)
+ goto out_unlock;
+
bo = bo_from_handle(dev, size, handle);
+
+out_unlock:
pthread_mutex_unlock(&table_lock);
return bo;