OSDN Git Service

freedreno: do handle lookup on handle and dmabuf import
authorRob Clark <robclark@freedesktop.org>
Wed, 22 Oct 2014 16:57:16 +0000 (12:57 -0400)
committerRob Clark <robclark@freedesktop.org>
Tue, 18 Nov 2014 17:17:09 +0000 (12:17 -0500)
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>
freedreno/freedreno_bo.c

index fe8f503..9089c93 100644 (file)
@@ -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;