summaryrefslogtreecommitdiff
path: root/freedreno/freedreno_priv.h
diff options
context:
space:
mode:
authorRob Clark <robclark@freedesktop.org>2013-05-15 13:18:02 -0400
committerRob Clark <robclark@freedesktop.org>2013-05-15 15:34:15 -0400
commit0b89e2730c41466e8d9c04c469679ba23d052ec9 (patch)
tree723d251c1394c596b8fbce9ce4c4ec9bfdd402d8 /freedreno/freedreno_priv.h
parent63aeae123848d0bfbc0a35102cb9717cf496eab6 (diff)
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 <robclark@freedesktop.org>
Diffstat (limited to 'freedreno/freedreno_priv.h')
-rw-r--r--freedreno/freedreno_priv.h13
1 files changed, 13 insertions, 0 deletions
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 <fcntl.h>
#include <sys/ioctl.h>
#include <sys/mman.h>
+#include <pthread.h>
#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 {