[PATCH] dix: adds support for none root window background

Tiago Vignatti tiago.vignatti at nokia.com
Thu Oct 28 06:57:22 PDT 2010


This lets the driver notify the server whether it can draw a background when
-nr option is passed. If the driver can copy the framebuffer cleanly then it
can set the flag, otherwise the server will fallback to normal behaviour.

The commit is originally based on discussions happened on xorg-devel:
http://lists.freedesktop.org/archives/xorg-devel/2010-June/009755.html

Signed-off-by: Tiago Vignatti <tiago.vignatti at nokia.com>
---
 dix/window.c         |    6 ++++++
 include/opaque.h     |    1 +
 include/scrnintstr.h |    5 +++++
 os/utils.c           |    3 +++
 4 files changed, 15 insertions(+), 0 deletions(-)

diff --git a/dix/window.c b/dix/window.c
index cfebb9d..7a47221 100644
--- a/dix/window.c
+++ b/dix/window.c
@@ -137,6 +137,8 @@ Equipment Corporation.
  *    ChangeWindowDeviceCursor
  ******/
 
+Bool bgNoneRoot = FALSE;
+
 static unsigned char _back_lsb[4] = {0x88, 0x22, 0x44, 0x11};
 static unsigned char _back_msb[4] = {0x11, 0x44, 0x22, 0x88};
 
@@ -463,6 +465,10 @@ InitRootWindow(WindowPtr pWin)
     if (party_like_its_1989) {
         MakeRootTile(pWin);
         backFlag |= CWBackPixmap;
+    } else if (pScreen->canDoBGNoneRoot && bgNoneRoot) {
+        pWin->backgroundState = XaceBackgroundNoneState(pWin);
+        pWin->background.pixel = pScreen->whitePixel;
+        backFlag |= CWBackPixmap;
     } else {
 	if (whiteRoot)
             pWin->background.pixel = pScreen->whitePixel;
diff --git a/include/opaque.h b/include/opaque.h
index f8c0000..f1a0046 100644
--- a/include/opaque.h
+++ b/include/opaque.h
@@ -72,6 +72,7 @@ extern _X_EXPORT Bool defeatAccessControl;
 extern _X_EXPORT long maxBigRequestSize;
 extern _X_EXPORT Bool party_like_its_1989;
 extern _X_EXPORT Bool whiteRoot;
+extern _X_EXPORT Bool bgNoneRoot;
 
 extern _X_EXPORT Bool CoreDump;
 
diff --git a/include/scrnintstr.h b/include/scrnintstr.h
index e36b15f..b1d2d8e 100644
--- a/include/scrnintstr.h
+++ b/include/scrnintstr.h
@@ -479,6 +479,11 @@ typedef struct _Screen {
     short       	numVisuals;
     VisualPtr		visuals;
     WindowPtr		root;
+
+    /* set it in driver side if X server can copy the framebuffer content.
+     * Meant be used together with -nr option. */
+    int		canDoBGNoneRoot;
+
     ScreenSaverStuffRec screensaver;
 
     /* Random screen procedures */
diff --git a/os/utils.c b/os/utils.c
index f176af4..9eb6084 100644
--- a/os/utils.c
+++ b/os/utils.c
@@ -502,6 +502,7 @@ void UseMsg(void)
 #endif
     ErrorF("-nolisten string       don't listen on protocol\n");
     ErrorF("-noreset               don't reset after last client exists\n");
+    ErrorF("-nr                    create root window with no background\n");
     ErrorF("-reset                 reset after last client exists\n");
     ErrorF("-p #                   screen-saver pattern duration (minutes)\n");
     ErrorF("-pn                    accept failure to listen on all ports\n");
@@ -842,6 +843,8 @@ ProcessCommandLine(int argc, char *argv[])
 	    defaultBackingStore = WhenMapped;
         else if ( strcmp( argv[i], "-wr") == 0)
             whiteRoot = TRUE;
+        else if ( strcmp( argv[i], "-nr") == 0)
+            bgNoneRoot = TRUE;
         else if ( strcmp( argv[i], "-maxbigreqsize") == 0) {
              if(++i < argc) {
                  long reqSizeArg = atol(argv[i]);
-- 
1.7.0.4



More information about the xorg-devel mailing list