[PATCH 3/3] sync: Record the associated Drawable for a shm/fd fence
Chris Wilson
chris at chris-wilson.co.uk
Mon May 12 00:12:39 PDT 2014
Alongside DRI3, SHM fences are used to serialise changes to the Pixmap
shared between the client and the xserver. By recording the associated
Drawable for a particular fence, the driver can reduce the amount of
work required for serialisation (i.e. it only has to serialise access to
one Pixmap, not all).
Signed-off-by: Chris Wilson <chris at chris-wilson.co.uk>
---
miext/sync/misyncfd.c | 2 +-
miext/sync/misyncfd.h | 3 ++-
miext/sync/misyncshm.c | 11 ++++++++++-
miext/sync/misyncshm.h | 4 ++++
4 files changed, 17 insertions(+), 3 deletions(-)
diff --git a/miext/sync/misyncfd.c b/miext/sync/misyncfd.c
index 93ff85f..b5fe92d 100644
--- a/miext/sync/misyncfd.c
+++ b/miext/sync/misyncfd.c
@@ -52,7 +52,7 @@ miSyncInitFenceFromFD(DrawablePtr pDraw, SyncFence *pFence, int fd, BOOL initial
if (!priv)
return BadMatch;
- return (*priv->funcs.CreateFenceFromFd)(pDraw->pScreen, pFence, fd, initially_triggered);
+ return (*priv->funcs.CreateFenceFromFd)(pDraw->pScreen, pFence, pDraw, fd, initially_triggered);
}
int
diff --git a/miext/sync/misyncfd.h b/miext/sync/misyncfd.h
index c1d05f9..2cb33dc 100644
--- a/miext/sync/misyncfd.h
+++ b/miext/sync/misyncfd.h
@@ -25,11 +25,12 @@
typedef int (*SyncScreenCreateFenceFromFdFunc) (ScreenPtr screen,
SyncFence *fence,
+ DrawablePtr drawable,
int fd,
Bool initially_triggered);
typedef int (*SyncScreenGetFenceFdFunc) (ScreenPtr screen,
- SyncFence *fence);
+ SyncFence *fence);
#define SYNC_FD_SCREEN_FUNCS_VERSION 1
diff --git a/miext/sync/misyncshm.c b/miext/sync/misyncshm.c
index 4d11b57..f954e1e 100644
--- a/miext/sync/misyncshm.c
+++ b/miext/sync/misyncshm.c
@@ -38,6 +38,7 @@
static DevPrivateKeyRec syncShmFencePrivateKey;
typedef struct _SyncShmFencePrivate {
+ DrawablePtr pDrawable;
struct xshmfence *fence;
int fd;
} SyncShmFencePrivateRec, *SyncShmFencePrivatePtr;
@@ -121,12 +122,14 @@ miSyncShmScreenDestroyFence(ScreenPtr pScreen, SyncFence * pFence)
}
static int
-miSyncShmCreateFenceFromFd(ScreenPtr pScreen, SyncFence *pFence, int fd, Bool initially_triggered)
+miSyncShmCreateFenceFromFd(ScreenPtr pScreen, SyncFence *pFence, DrawablePtr draw, int fd, Bool initially_triggered)
{
SyncShmFencePrivatePtr pPriv = SYNC_FENCE_PRIV(pFence);
miSyncInitFence(pScreen, pFence, initially_triggered);
+ pPriv->pDrawable = draw;
+
fd = os_move_fd(fd);
pPriv->fence = xshmfence_map_shm(fd);
if (pPriv->fence) {
@@ -184,3 +187,9 @@ _X_EXPORT Bool miSyncShmScreenInit(ScreenPtr pScreen)
return TRUE;
}
+_X_EXPORT DrawablePtr
+miSyncShmFenceGetDrawable(SyncFence *pFence)
+{
+ SyncShmFencePrivatePtr pPriv = SYNC_FENCE_PRIV(pFence);
+ return pPriv ? pPriv->pDrawable : NULL;
+}
diff --git a/miext/sync/misyncshm.h b/miext/sync/misyncshm.h
index 23c001a..2484970 100644
--- a/miext/sync/misyncshm.h
+++ b/miext/sync/misyncshm.h
@@ -23,6 +23,10 @@
#ifndef _MISYNCSHM_H_
#define _MISYNCSHM_H_
+#include <misync.h>
+
extern _X_EXPORT Bool miSyncShmScreenInit(ScreenPtr pScreen);
+extern _X_EXPORT DrawablePtr miSyncShmFenceGetDrawable(SyncFence *pFence);
+
#endif /* _MISYNCSHM_H_ */
--
2.0.0.rc2
More information about the xorg-devel
mailing list