xserver: Branch 'master' - 9 commits

Keith Packard keithp at kemper.freedesktop.org
Mon May 6 09:28:35 PDT 2013


 dix/dispatch.c                      |    2 --
 dix/main.c                          |    3 +++
 dix/pixmap.c                        |    2 ++
 fb/fbpixmap.c                       |    1 +
 hw/xfree86/common/xf86platformBus.c |   11 ++++++++++-
 hw/xfree86/modes/xf86Crtc.c         |   34 ++++++++++++++++++++++++----------
 hw/xfree86/modes/xf86RandR12.c      |    2 ++
 randr/randr.c                       |   24 +++++++++++++++++++++++-
 randr/randrstr.h                    |    4 ++++
 randr/rrcrtc.c                      |    2 +-
 randr/rrinfo.c                      |    2 +-
 randr/rroutput.c                    |    2 +-
 randr/rrscreen.c                    |    2 +-
 13 files changed, 73 insertions(+), 18 deletions(-)

New commits:
commit dbfeaf70623a83e1a3f3255c94d52e0e04702837
Author: Aaron Plattner <aplattner at nvidia.com>
Date:   Tue Apr 30 14:30:18 2013 -0700

    xfree86: don't enable anything in xf86InitialConfiguration for GPU screens
    
    There's no point in turning on outputs connected to GPU screens during initial
    configuration.  Not only does this cause them to just display black, it also
    confuses clients when these screens are attached to a master screen and RandR
    reports that the outputs are already on.
    
    Also, don't print the warning about no outputs being found on GPU screens,
    since that's expected.
    
    Signed-off-by: Aaron Plattner <aplattner at nvidia.com>
    Reviewed-by: Dave Airlie <airlied at gmail.com>

diff --git a/hw/xfree86/modes/xf86Crtc.c b/hw/xfree86/modes/xf86Crtc.c
index 4a490c6..35845e8 100644
--- a/hw/xfree86/modes/xf86Crtc.c
+++ b/hw/xfree86/modes/xf86Crtc.c
@@ -1997,6 +1997,14 @@ xf86CollectEnabledOutputs(ScrnInfoPtr scrn, xf86CrtcConfigPtr config,
     Bool any_enabled = FALSE;
     int o;
 
+    /*
+     * Don't bother enabling outputs on GPU screens: a client needs to attach
+     * it to a source provider before setting a mode that scans out a shared
+     * pixmap.
+     */
+    if (scrn->is_gpu)
+        return FALSE;
+
     for (o = 0; o < config->num_output; o++)
         any_enabled |= enabled[o] = xf86OutputEnabled(config->output[o], TRUE);
 
@@ -2466,9 +2474,11 @@ xf86InitialConfiguration(ScrnInfoPtr scrn, Bool canGrow)
 
     ret = xf86CollectEnabledOutputs(scrn, config, enabled);
     if (ret == FALSE && canGrow) {
-        xf86DrvMsg(i, X_WARNING,
-                   "Unable to find connected outputs - setting %dx%d initial framebuffer\n",
-                   NO_OUTPUT_DEFAULT_WIDTH, NO_OUTPUT_DEFAULT_HEIGHT);
+        if (!scrn->is_gpu)
+            xf86DrvMsg(i, X_WARNING,
+		       "Unable to find connected outputs - setting %dx%d "
+                       "initial framebuffer\n",
+                       NO_OUTPUT_DEFAULT_WIDTH, NO_OUTPUT_DEFAULT_HEIGHT);
         have_outputs = FALSE;
     }
     else {
commit f2fd8ec3725a61abbc831f0a9ec28fa2b7020c47
Author: Dave Airlie <airlied at redhat.com>
Date:   Wed Jan 9 12:52:13 2013 +1000

    gpu: call CreateScreenResources for GPU screens
    
    I didn't think we needed this before, but after doing some more
    work with reverse optimus it seems like it should be called.
    
    Reviewed-by: Keith Packard <keithp at keithp.com>
    Signed-off-by: Dave Airlie <airlied at redhat.com>

diff --git a/dix/main.c b/dix/main.c
index bea1a8d..c46e40a 100644
--- a/dix/main.c
+++ b/dix/main.c
@@ -211,6 +211,9 @@ main(int argc, char *argv[], char *envp[])
             ScreenPtr pScreen = screenInfo.gpuscreens[i];
             if (!CreateScratchPixmapsForScreen(pScreen))
                 FatalError("failed to create scratch pixmaps");
+            if (pScreen->CreateScreenResources &&
+                !(*pScreen->CreateScreenResources) (pScreen))
+                FatalError("failed to create screen resources");
         }
 
         for (i = 0; i < screenInfo.numScreens; i++) {
diff --git a/hw/xfree86/common/xf86platformBus.c b/hw/xfree86/common/xf86platformBus.c
index bcb65ff..e368dee 100644
--- a/hw/xfree86/common/xf86platformBus.c
+++ b/hw/xfree86/common/xf86platformBus.c
@@ -455,6 +455,14 @@ xf86platformAddDevice(int index)
 
    CreateScratchPixmapsForScreen(xf86GPUScreens[i]->pScreen);
 
+   if (xf86GPUScreens[i]->pScreen->CreateScreenResources &&
+       !(*xf86GPUScreens[i]->pScreen->CreateScreenResources) (xf86GPUScreens[i]->pScreen)) {
+       RemoveGPUScreen(xf86GPUScreens[i]->pScreen);
+       xf86DeleteScreen(xf86GPUScreens[i]);
+       xf86UnclaimPlatformSlot(&xf86_platform_devices[index], NULL);
+       xf86NumGPUScreens = old_screens;
+       return -1;
+   }
    /* attach unbound to 0 protocol screen */
    AttachUnboundGPU(xf86Screens[0]->pScreen, xf86GPUScreens[i]->pScreen);
 
commit 8fcb9d91b69abc72ddef31b9f2e8585580c6cad2
Author: Dave Airlie <airlied at redhat.com>
Date:   Wed Jan 9 12:52:08 2013 +1000

    dix: allow pixmap dirty helper to be used for non-shared pixmaps
    
    this allows the pixmap dirty helper to be used for reverse optimus,
    where the GPU wants to copy from the shared pixmap to its VRAM copy.
    
    [airlied: slave_dst is wrong name now but pointless ABI churn at this point]
    Reviewed-by: Keith Packard <keithp at keithp.com>
    Signed-off-by: Dave Airlie <airlied at redhat.com>

diff --git a/dix/pixmap.c b/dix/pixmap.c
index 2418812..fe92147 100644
--- a/dix/pixmap.c
+++ b/dix/pixmap.c
@@ -243,6 +243,8 @@ Bool PixmapSyncDirtyHelper(PixmapDirtyUpdatePtr dirty, RegionPtr dirty_region)
     }
 
     dst = dirty->slave_dst->master_pixmap;
+    if (!dst)
+        dst = dirty->slave_dst;
 
     RegionTranslate(dirty_region, -dirty->x, -dirty->y);
     n = RegionNumRects(dirty_region);
diff --git a/fb/fbpixmap.c b/fb/fbpixmap.c
index fbcdca9..0824b64 100644
--- a/fb/fbpixmap.c
+++ b/fb/fbpixmap.c
@@ -67,6 +67,7 @@ fbCreatePixmapBpp(ScreenPtr pScreen, int width, int height, int depth, int bpp,
     pPixmap->devKind = paddedWidth;
     pPixmap->refcnt = 1;
     pPixmap->devPrivate.ptr = (pointer) ((char *) pPixmap + base + adjust);
+    pPixmap->master_pixmap = NULL;
 
 #ifdef FB_DEBUG
     pPixmap->devPrivate.ptr =
commit 16077b81c502e04d77f81f683e0c213b9fe75393
Author: Dave Airlie <airlied at redhat.com>
Date:   Wed Jan 9 12:52:03 2013 +1000

    xf86crtc: don't use scrn->display for gpu screens
    
    scrn->display is a property of the main screen really, and we don't
    want to have the GPU screens use it for anything when picking modes
    or a front buffer size.
    
    This fixes a bug where when you plugged a display link device, it
    would try and allocate a screen the same size as the current running
    one (3360x1050 in this case), which was too big for the device. Avoid
    doing this and just pick sizes based on whats plugged into this device.
    
    Reviewed-by: Keith Packard <keithp at keithp.com>
    Signed-off-by: Dave Airlie <airlied at redhat.com>

diff --git a/hw/xfree86/modes/xf86Crtc.c b/hw/xfree86/modes/xf86Crtc.c
index d64f6bd..4a490c6 100644
--- a/hw/xfree86/modes/xf86Crtc.c
+++ b/hw/xfree86/modes/xf86Crtc.c
@@ -2449,11 +2449,11 @@ xf86InitialConfiguration(ScrnInfoPtr scrn, Bool canGrow)
     config->debug_modes = xf86ReturnOptValBool(config->options,
                                                OPTION_MODEDEBUG, FALSE);
 
-    if (scrn->display->virtualX)
+    if (scrn->display->virtualX && !scrn->is_gpu)
         width = scrn->display->virtualX;
     else
         width = config->maxWidth;
-    if (scrn->display->virtualY)
+    if (scrn->display->virtualY && !scrn->is_gpu)
         height = scrn->display->virtualY;
     else
         height = config->maxHeight;
@@ -2517,8 +2517,10 @@ xf86InitialConfiguration(ScrnInfoPtr scrn, Bool canGrow)
 
     /* XXX override xf86 common frame computation code */
 
-    scrn->display->frameX0 = 0;
-    scrn->display->frameY0 = 0;
+    if (!scrn->is_gpu) {
+        scrn->display->frameX0 = 0;
+        scrn->display->frameY0 = 0;
+    }
 
     for (c = 0; c < config->num_crtc; c++) {
         xf86CrtcPtr crtc = config->crtc[c];
@@ -2566,7 +2568,7 @@ xf86InitialConfiguration(ScrnInfoPtr scrn, Bool canGrow)
         }
     }
 
-    if (scrn->display->virtualX == 0) {
+    if (scrn->display->virtualX == 0 || scrn->is_gpu) {
         /*
          * Expand virtual size to cover the current config and potential mode
          * switches, if the driver can't enlarge the screen later.
@@ -2581,8 +2583,10 @@ xf86InitialConfiguration(ScrnInfoPtr scrn, Bool canGrow)
             }
         }
 
-        scrn->display->virtualX = width;
-        scrn->display->virtualY = height;
+	if (!scrn->is_gpu) {
+            scrn->display->virtualX = width;
+            scrn->display->virtualY = height;
+	}
     }
 
     if (width > scrn->virtualX)
commit f0d0d75bfe62553dde353f89e46ff13dd863fbe8
Author: Dave Airlie <airlied at redhat.com>
Date:   Wed Jan 9 12:51:55 2013 +1000

    dix/gpu: remove asserts for output/offload from same slave
    
    We should have no problem allowing output/offload from the same slave,
    I asserted here, but in order to implement reverse optimus this makes
    perfect sense. (reverse optimus is intel outputting to nvidia).
    
    Reviewed-by: Keith Packard <keithp at keithp.com>
    Signed-off-by: Dave Airlie <airlied at redhat.com>

diff --git a/dix/dispatch.c b/dix/dispatch.c
index 8d61735..90b6c7c 100644
--- a/dix/dispatch.c
+++ b/dix/dispatch.c
@@ -3942,7 +3942,6 @@ void
 AttachOutputGPU(ScreenPtr pScreen, ScreenPtr new)
 {
     assert(new->isGPU);
-    assert(!new->current_master);
     xorg_list_add(&new->output_head, &pScreen->output_slave_list);
     new->current_master = pScreen;
 }
@@ -3959,7 +3958,6 @@ void
 AttachOffloadGPU(ScreenPtr pScreen, ScreenPtr new)
 {
     assert(new->isGPU);
-    assert(!new->current_master);
     xorg_list_add(&new->offload_head, &pScreen->offload_slave_list);
     new->current_master = pScreen;
 }
commit 9d26e8eaf5a2d7c3e65670ac20254c60f665c463
Author: Dave Airlie <airlied at redhat.com>
Date:   Wed Jan 9 14:26:35 2013 +1000

    randr: report changes when we disconnect a GPU slave
    
    When we disconnect an output/offload slave set the changed bits,
    so a later TellChanged can do something.
    
    Then when we remove a GPU slave device, sent change notification
    to the protocol screen.
    
    This allows hot unplugged USB devices to disappear in clients.
    
    Reviewed-by: Peter Hutterer <peter.hutterer at who-t.net>
    Signed-off-by: Dave Airlie <airlied at redhat.com>

diff --git a/hw/xfree86/common/xf86platformBus.c b/hw/xfree86/common/xf86platformBus.c
index 9034dad..bcb65ff 100644
--- a/hw/xfree86/common/xf86platformBus.c
+++ b/hw/xfree86/common/xf86platformBus.c
@@ -47,6 +47,7 @@
 #include "Pci.h"
 #include "xf86platformBus.h"
 
+#include "randrstr.h"
 int platformSlotClaimed;
 
 int xf86_num_platform_devices;
@@ -499,7 +500,7 @@ xf86platformRemoveDevice(int index)
     xf86UnclaimPlatformSlot(&xf86_platform_devices[index], NULL);
 
     xf86_remove_platform_device(index);
-
+    RRTellChanged(xf86Screens[0]->pScreen);
  out:
     return;
 }
diff --git a/hw/xfree86/modes/xf86RandR12.c b/hw/xfree86/modes/xf86RandR12.c
index 25beee6..2817aaa 100644
--- a/hw/xfree86/modes/xf86RandR12.c
+++ b/hw/xfree86/modes/xf86RandR12.c
@@ -1896,10 +1896,12 @@ xf86RandR14ProviderDestroy(ScreenPtr screen, RRProviderPtr provider)
         if (config->randr_provider->offload_sink) {
             DetachOffloadGPU(screen);
             config->randr_provider->offload_sink = NULL;
+            RRSetChanged(screen);
         }
         else if (config->randr_provider->output_source) {
             DetachOutputGPU(screen);
             config->randr_provider->output_source = NULL;
+            RRSetChanged(screen);
         }
         else if (screen->current_master)
             DetachUnboundGPU(screen);
commit b724324252d13ff95f62eebd12d125b194d2ccc2
Author: Dave Airlie <airlied at redhat.com>
Date:   Wed Jan 9 14:25:43 2013 +1000

    randr: only respected changed on the protocol screen
    
    We don't want to know about changes on the non-protocol screen,
    we will fix up setchanged to make sure non-protocol screens update
    the protocol screens when they have a change.
    
    Reviewed-by: Peter Hutterer <peter.hutterer at who-t.net>
    Signed-off-by: Dave Airlie <airlied at redhat.com>

diff --git a/randr/randr.c b/randr/randr.c
index fb0895d..cb6fce7 100644
--- a/randr/randr.c
+++ b/randr/randr.c
@@ -506,7 +506,7 @@ RRTellChanged(ScreenPtr pScreen)
         mastersp = pScrPriv;
     }
 
-    if (pScrPriv->changed) {
+    if (mastersp->changed) {
         UpdateCurrentTimeIf();
         if (mastersp->configChanged) {
             mastersp->lastConfigTime = currentTime;
commit b3f70f38edebac87afe9351538365292f1aaaff3
Author: Dave Airlie <airlied at redhat.com>
Date:   Wed Jan 9 14:29:47 2013 +1000

    randr: make SetChanged modify the main protocol screen not the gpu screen
    
    When SetChanged is called we now modify the main protocol screen,
    not the the gpu screen. Since changed stuff should work at the protocol level.
    
    Reviewed-by: Peter Hutterer <peter.hutterer at who-t.net>
    Signed-off-by: Dave Airlie <airlied at redhat.com>

diff --git a/randr/randr.c b/randr/randr.c
index 11f88b2..fb0895d 100644
--- a/randr/randr.c
+++ b/randr/randr.c
@@ -467,9 +467,23 @@ TellChanged(WindowPtr pWin, pointer value)
 void
 RRSetChanged(ScreenPtr pScreen)
 {
+    /* set changed bits on the master screen only */
+    ScreenPtr master;
     rrScrPriv(pScreen);
+    rrScrPrivPtr mastersp;
+
+    if (pScreen->isGPU) {
+        master = pScreen->current_master;
+        if (!master)
+            return;
+        mastersp = rrGetScrPriv(master);
+    }
+    else {
+        master = pScreen;
+        mastersp = pScrPriv;
+    }
 
-    pScrPriv->changed = TRUE;
+    mastersp->changed = TRUE;
 }
 
 /*
commit f9c8248b8326ad01f33f31531c6b2479baf80f02
Author: Dave Airlie <airlied at redhat.com>
Date:   Wed Jan 9 14:23:57 2013 +1000

    randr: don't directly set changed bits in randr screen
    
    Introduce a wrapper interface so we can fix things up for multi-gpu
    situations later.
    
    This just introduces the API for now.
    
    Reviewed-by: Peter Hutterer <peter.hutterer at who-t.net>
    Signed-off-by: Dave Airlie <airlied at redhat.com>

diff --git a/randr/randr.c b/randr/randr.c
index f0decfc..11f88b2 100644
--- a/randr/randr.c
+++ b/randr/randr.c
@@ -464,6 +464,14 @@ TellChanged(WindowPtr pWin, pointer value)
     return WT_WALKCHILDREN;
 }
 
+void
+RRSetChanged(ScreenPtr pScreen)
+{
+    rrScrPriv(pScreen);
+
+    pScrPriv->changed = TRUE;
+}
+
 /*
  * Something changed; send events and adjust pointer position
  */
diff --git a/randr/randrstr.h b/randr/randrstr.h
index 2517479..2babfed 100644
--- a/randr/randrstr.h
+++ b/randr/randrstr.h
@@ -486,6 +486,10 @@ extern _X_EXPORT void
  RRDeliverScreenEvent(ClientPtr client, WindowPtr pWin, ScreenPtr pScreen);
 
 /* randr.c */
+/* set a screen change on the primary screen */
+extern _X_EXPORT void
+RRSetChanged(ScreenPtr pScreen);
+
 /*
  * Send all pending events
  */
diff --git a/randr/rrcrtc.c b/randr/rrcrtc.c
index 721b05a..2f76b62 100644
--- a/randr/rrcrtc.c
+++ b/randr/rrcrtc.c
@@ -39,7 +39,7 @@ RRCrtcChanged(RRCrtcPtr crtc, Bool layoutChanged)
     if (pScreen) {
         rrScrPriv(pScreen);
 
-        pScrPriv->changed = TRUE;
+        RRSetChanged(pScreen);
         /*
          * Send ConfigureNotify on any layout change
          */
diff --git a/randr/rrinfo.c b/randr/rrinfo.c
index 1408d6f..fc57bd4 100644
--- a/randr/rrinfo.c
+++ b/randr/rrinfo.c
@@ -225,7 +225,7 @@ RRScreenSetSizeRange(ScreenPtr pScreen,
     pScrPriv->minHeight = minHeight;
     pScrPriv->maxWidth = maxWidth;
     pScrPriv->maxHeight = maxHeight;
-    pScrPriv->changed = TRUE;
+    RRSetChanged(pScreen);
     pScrPriv->configChanged = TRUE;
 }
 
diff --git a/randr/rroutput.c b/randr/rroutput.c
index 88781ba..922d61f 100644
--- a/randr/rroutput.c
+++ b/randr/rroutput.c
@@ -36,7 +36,7 @@ RROutputChanged(RROutputPtr output, Bool configChanged)
     output->changed = TRUE;
     if (pScreen) {
         rrScrPriv(pScreen);
-        pScrPriv->changed = TRUE;
+        RRSetChanged(pScreen);
         if (configChanged)
             pScrPriv->configChanged = TRUE;
     }
diff --git a/randr/rrscreen.c b/randr/rrscreen.c
index 39340cc..36179ae 100644
--- a/randr/rrscreen.c
+++ b/randr/rrscreen.c
@@ -143,7 +143,7 @@ RRScreenSizeNotify(ScreenPtr pScreen)
     pScrPriv->height = pScreen->height;
     pScrPriv->mmWidth = pScreen->mmWidth;
     pScrPriv->mmHeight = pScreen->mmHeight;
-    pScrPriv->changed = TRUE;
+    RRSetChanged(pScreen);
 /*    pScrPriv->sizeChanged = TRUE; */
 
     RRTellChanged(pScreen);


More information about the xorg-commit mailing list