[PATCH 04/29] dix: add unattached list for attaching screens to initially. (v1.1)

Dave Airlie airlied at gmail.com
Thu Jul 5 13:30:11 PDT 2012


From: Dave Airlie <airlied at redhat.com>

This list is meant for attaching unbound gpu screens to initially,
before the client side rebinds them.

v1.1: add another assert in the add path.

Signed-off-by: Dave Airlie <airlied at redhat.com>
---
 dix/dispatch.c       |   20 ++++++++++++++++++++
 include/screenint.h  |    5 +++++
 include/scrnintstr.h |    6 ++++++
 3 files changed, 31 insertions(+)

diff --git a/dix/dispatch.c b/dix/dispatch.c
index fa39728..9e84621 100644
--- a/dix/dispatch.c
+++ b/dix/dispatch.c
@@ -3742,6 +3742,8 @@ static int init_screen(ScreenPtr pScreen, int i, Bool gpu)
     pScreen->ClipNotify = 0;    /* for R4 ddx compatibility */
     pScreen->CreateScreenResources = 0;
 
+    xorg_list_init(&pScreen->unattached_list);
+
     /*
      * This loop gets run once for every Screen that gets added,
      * but thats ok.  If the ddx layer initializes the formats
@@ -3889,3 +3891,21 @@ RemoveGPUScreen(ScreenPtr pScreen)
     free(pScreen);
 
 }
+
+void
+AttachUnboundGPU(ScreenPtr pScreen, ScreenPtr new)
+{
+    assert(new->isGPU);
+    assert(!new->current_master);
+    xorg_list_add(&new->unattached_head, &pScreen->unattached_list);
+    new->current_master = pScreen;
+}
+
+void
+DetachUnboundGPU(ScreenPtr slave)
+{
+    assert(slave->isGPU);
+    xorg_list_del(&slave->unattached_head);
+    slave->current_master = NULL;
+}
+
diff --git a/include/screenint.h b/include/screenint.h
index 8205f63..c0c60ef 100644
--- a/include/screenint.h
+++ b/include/screenint.h
@@ -71,6 +71,11 @@ extern _X_EXPORT int AddGPUScreen(Bool (*pfnInit) (ScreenPtr /*pScreen */ ,
 
 extern _X_EXPORT void RemoveGPUScreen(ScreenPtr pScreen);
 
+extern _X_EXPORT void
+AttachUnboundGPU(ScreenPtr pScreen, ScreenPtr new);
+extern _X_EXPORT void
+DetachUnboundGPU(ScreenPtr unbound);
+
 typedef struct _ColormapRec *ColormapPtr;
 
 #endif                          /* SCREENINT_H */
diff --git a/include/scrnintstr.h b/include/scrnintstr.h
index bcac475..6b738de 100644
--- a/include/scrnintstr.h
+++ b/include/scrnintstr.h
@@ -479,6 +479,12 @@ typedef struct _Screen {
     Bool canDoBGNoneRoot;
 
     Bool isGPU;
+
+    struct xorg_list unattached_list;
+    struct xorg_list unattached_head;
+
+    ScreenPtr current_master;
+
 } ScreenRec;
 
 static inline RegionPtr
-- 
1.7.10.2



More information about the xorg-devel mailing list