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>
main
Rob Clark 2014-10-22 12:57:16 -04:00
parent 00847fa48b
commit 5306078bbe
1 changed files with 7 additions and 0 deletions

View 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;