aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRob Clark2013-05-15 12:18:02 -0500
committerRob Clark2013-05-15 14:34:15 -0500
commit0b89e2730c41466e8d9c04c469679ba23d052ec9 (patch)
tree723d251c1394c596b8fbce9ce4c4ec9bfdd402d8 /freedreno/freedreno_priv.h
parent63aeae123848d0bfbc0a35102cb9717cf496eab6 (diff)
downloadexternal-libgbm-0b89e2730c41466e8d9c04c469679ba23d052ec9.tar.gz
external-libgbm-0b89e2730c41466e8d9c04c469679ba23d052ec9.tar.xz
external-libgbm-0b89e2730c41466e8d9c04c469679ba23d052ec9.zip
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 @@
37#include <fcntl.h> 37#include <fcntl.h>
38#include <sys/ioctl.h> 38#include <sys/ioctl.h>
39#include <sys/mman.h> 39#include <sys/mman.h>
40#include <pthread.h>
40 41
41#include "xf86drm.h" 42#include "xf86drm.h"
42#include "xf86atomic.h" 43#include "xf86atomic.h"
@@ -49,6 +50,18 @@
49 50
50struct fd_device { 51struct fd_device {
51 int fd; 52 int fd;
53 atomic_t refcnt;
54
55 /* tables to keep track of bo's, to avoid "evil-twin" fd_bo objects:
56 *
57 * handle_table: maps handle to fd_bo
58 * name_table: maps flink name to fd_bo
59 *
60 * We end up needing two tables, because DRM_IOCTL_GEM_OPEN always
61 * returns a new handle. So we need to figure out if the bo is already
62 * open in the process first, before calling gem-open.
63 */
64 void *handle_table, *name_table;
52}; 65};
53 66
54struct fd_pipe { 67struct fd_pipe {