From 0b89e2730c41466e8d9c04c469679ba23d052ec9 Mon Sep 17 00:00:00 2001 From: Rob Clark Date: Wed, 15 May 2013 13:18:02 -0400 Subject: freedreno: add handle and name tracking Due to the evil userspace buffer tracking we have to do, and hacks for creating GEM buffer from fbdev/scanout, "evil-twin" fd_bo objects are problematic. So introduce hashtable tracking of bo's and dev's, to avoid getting duplicate fd_bo ptrs for the same underlying gem object, in particular when importing via flink name. Signed-off-by: Rob Clark --- freedreno/freedreno_priv.h | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'freedreno/freedreno_priv.h') diff --git a/freedreno/freedreno_priv.h b/freedreno/freedreno_priv.h index 0edca1d9..433bd300 100644 --- a/freedreno/freedreno_priv.h +++ b/freedreno/freedreno_priv.h @@ -37,6 +37,7 @@ #include #include #include +#include #include "xf86drm.h" #include "xf86atomic.h" @@ -49,6 +50,18 @@ struct fd_device { int fd; + atomic_t refcnt; + + /* tables to keep track of bo's, to avoid "evil-twin" fd_bo objects: + * + * handle_table: maps handle to fd_bo + * name_table: maps flink name to fd_bo + * + * We end up needing two tables, because DRM_IOCTL_GEM_OPEN always + * returns a new handle. So we need to figure out if the bo is already + * open in the process first, before calling gem-open. + */ + void *handle_table, *name_table; }; struct fd_pipe { -- cgit v1.2.3