From: Adam Jackson <a...@redhat.com> (I'm blaming ajax for this, but it could have be krh, either way its came from Red Hat, so I can sign it off.)
This adds support to the X server so that the driver can let the server know if it needs to draw a background when the -nr option is passed. If the driver can copy the framebuffer cleanly it sets the flag, it if can't the server will fallback to normal behaviour. I think nearly every distro using KMS is carry this now. Also since we are bumping ABI, don't use a reserved int, just break the ScrnInfoRec. Signed-off-by: Dave Airlie <airl...@redhat.com> --- dix/globals.c | 1 + dix/window.c | 12 +++++++----- hw/xfree86/common/xf86Init.c | 11 +++++++++++ hw/xfree86/common/xf86str.h | 3 +++ include/opaque.h | 1 + os/utils.c | 3 +++ 6 files changed, 26 insertions(+), 5 deletions(-) diff --git a/dix/globals.c b/dix/globals.c index b128569..95dde2d 100644 --- a/dix/globals.c +++ b/dix/globals.c @@ -122,6 +122,7 @@ FontPtr defaultFont; /* not declared in dix.h to avoid including font.h in CursorPtr rootCursor; Bool party_like_its_1989 = FALSE; Bool whiteRoot = FALSE; +Bool bgNoneRoot = FALSE; TimeStamp currentTime; TimeStamp lastDeviceEventTime; diff --git a/dix/window.c b/dix/window.c index 8f3ffa3..eaf43aa 100644 --- a/dix/window.c +++ b/dix/window.c @@ -459,22 +459,24 @@ InitRootWindow(WindowPtr pWin) pWin->optional->cursor = rootCursor; rootCursor->refcnt++; + pWin->backingStore = defaultBackingStore; + pWin->forcedBS = (defaultBackingStore != NotUseful); if (party_like_its_1989) { MakeRootTile(pWin); backFlag |= CWBackPixmap; + pScreen->ChangeWindowAttributes(pWin, backFlag); + } else if (bgNoneRoot) { + /* nothing, handled in xf86CreateRootWindow */ } else { if (whiteRoot) pWin->background.pixel = pScreen->whitePixel; else pWin->background.pixel = pScreen->blackPixel; backFlag |= CWBackPixel; - } - pWin->backingStore = defaultBackingStore; - pWin->forcedBS = (defaultBackingStore != NotUseful); - /* We SHOULD check for an error value here XXX */ - (*pScreen->ChangeWindowAttributes)(pWin, backFlag); + pScreen->ChangeWindowAttributes(pWin, backFlag); + } MapWindow(pWin, serverClient); } diff --git a/hw/xfree86/common/xf86Init.c b/hw/xfree86/common/xf86Init.c index 98bbd5d..9963899 100644 --- a/hw/xfree86/common/xf86Init.c +++ b/hw/xfree86/common/xf86Init.c @@ -76,6 +76,7 @@ #include "xf86Xinput.h" #include "xf86InPriv.h" #include "picturestr.h" +#include "xace.h" #include "xf86Bus.h" #include "xf86VGAarbiter.h" @@ -242,6 +243,7 @@ xf86CreateRootWindow(WindowPtr pWin) int ret = TRUE; int err = Success; ScreenPtr pScreen = pWin->drawable.pScreen; + ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum]; RootWinPropPtr pProp; CreateWindowProcPtr CreateWindow = (CreateWindowProcPtr) dixLookupPrivate(&pScreen->devPrivates, xf86CreateRootWindowKey); @@ -293,6 +295,15 @@ xf86CreateRootWindow(WindowPtr pWin) } } + if (bgNoneRoot && pScrn->canDoBGNoneRoot) { + pWin->backgroundState = XaceBackgroundNoneState(pWin); + pWin->background.pixel = pScreen->whitePixel; + pScreen->ChangeWindowAttributes(pWin, CWBackPixmap | CWBorderPixel | CWCursor | CWBackingStore); + } else { + pWin->background.pixel = pScreen->blackPixel; + pScreen->ChangeWindowAttributes(pWin, CWBackPixel | CWBorderPixel | CWCursor | CWBackingStore); + } + DebugF("xf86CreateRootWindow() returns %d\n", ret); return (ret); } diff --git a/hw/xfree86/common/xf86str.h b/hw/xfree86/common/xf86str.h index c9b261d..e18524d 100644 --- a/hw/xfree86/common/xf86str.h +++ b/hw/xfree86/common/xf86str.h @@ -774,6 +774,9 @@ typedef struct _ScrnInfoRec { ClockRangePtr clockRanges; int adjustFlags; + /* -nr support */ + int canDoBGNoneRoot; + /* * These can be used when the minor ABI version is incremented. * The NUM_* parameters must be reduced appropriately to keep the diff --git a/include/opaque.h b/include/opaque.h index b3c7c70..fcc8c95 100644 --- a/include/opaque.h +++ b/include/opaque.h @@ -71,6 +71,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/os/utils.c b/os/utils.c index b4a954f..5a3ee87 100644 --- a/os/utils.c +++ b/os/utils.c @@ -504,6 +504,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"); @@ -843,6 +844,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.6.5.2 _______________________________________________ xorg-devel@lists.x.org: X.Org development Archives: http://lists.x.org/archives/xorg-devel Info: http://lists.x.org/mailman/listinfo/xorg-devel