[PATCH] Add pScreen->NameWindowPixmap hook

Daniel Stone daniel at fooishbar.org
Mon Mar 31 04:29:57 PDT 2014


This hook allows drivers to be notified when a pixmap gains a new ID.

(ABI break.)

Signed-off-by: Daniel Stone <daniels at collabora.com>
---
 composite/compext.c  | 6 ++++++
 include/scrnintstr.h | 3 +++
 2 files changed, 9 insertions(+)

Is this in time for the ABI break? It's for quite a niche usecase
(virtualising X11 on top of another window system), where we need to know
all IDs that will be used for a given pixmap.

Round-tripping in eglCreateImageKHR would work too, but is much more
expensive by comparison.

However, I hope it's small enough to be pretty much harmless.

diff --git a/composite/compext.c b/composite/compext.c
index a945f72..b770fe2 100644
--- a/composite/compext.c
+++ b/composite/compext.c
@@ -270,6 +270,12 @@ ProcCompositeNameWindowPixmap(ClientPtr client)
     if (!AddResource(stuff->pixmap, RT_PIXMAP, (void *) pPixmap))
         return BadAlloc;
 
+    if (pScreen->NameWindowPixmap &&
+        !pScreen->NameWindowPixmap(pWin, pPixmap, stuff->pixmap)) {
+        pScreen->DestroyPixmap(pPixmap);
+	return BadAlloc;
+    }
+
     return Success;
 }
 
diff --git a/include/scrnintstr.h b/include/scrnintstr.h
index 86da789..b09fbd9 100644
--- a/include/scrnintstr.h
+++ b/include/scrnintstr.h
@@ -353,6 +353,8 @@ typedef Bool (*StopPixmapTrackingProcPtr)(PixmapPtr, PixmapPtr);
 
 typedef Bool (*ReplaceScanoutPixmapProcPtr)(DrawablePtr, PixmapPtr, Bool);
 
+typedef Bool (*NameWindowPixmapProcPtr)(WindowPtr, PixmapPtr, CARD32);
+
 typedef struct _Screen {
     int myNum;                  /* index of this instance in Screens[] */
     ATOM id;
@@ -463,6 +465,7 @@ typedef struct _Screen {
     SetWindowPixmapProcPtr SetWindowPixmap;
     GetScreenPixmapProcPtr GetScreenPixmap;
     SetScreenPixmapProcPtr SetScreenPixmap;
+    NameWindowPixmapProcPtr NameWindowPixmap;
 
     PixmapPtr pScratchPixmap;   /* scratch pixmap "pool" */
 
-- 
1.9.0



More information about the xorg-devel mailing list