[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

xorg-server: Changes to 'ubuntu'



 debian/changelog                                                          |    2 
 debian/patches/228_autobind_gpu.patch                                     |   50 +-
 debian/patches/autoconfig-fixup-tell-changed-so-randr-clients-can-t.patch |  203 ++++++++++
 debian/patches/dix-allow-pixmap-dirty-helper-to-be-used-for-non-sha.patch |   40 +
 debian/patches/randr-cleanup-provider-properly.patch                      |  133 ++++++
 debian/patches/series                                                     |   16 
 debian/patches/xf86-actually-set-the-compat-output-in-the-failure-c.patch |   35 +
 debian/patches/xf86crtc-don-t-use-display-for-vx-vy-for-gpu-screens.patch |   65 +++
 debian/patches/xfree86-hotplug-cleanup-properly-if-the-screen-fails.patch |   38 +
 debian/patches/xserver-call-CSR-for-gpus.patch                            |   46 ++
 10 files changed, 614 insertions(+), 14 deletions(-)

New commits:
commit ee5768f65691bcacd59fe9e1024caf10375f5944
Author: Maarten Lankhorst <maarten.lankhorst@canonical.com>
Date:   Wed Jan 30 12:44:19 2013 +0100

    and push the reverse optimus patches

diff --git a/debian/changelog b/debian/changelog
index 3462e06..b932793 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -2,6 +2,8 @@ xorg-server (2:1.13.2-0ubuntu1) UNRELEASED; urgency=low
 
   * New upstream release.
   * control: Mark xvfb M-A: foreign.
+  * Refresh autobind patch from fedora, and cherry-pick some fixes from them for
+    reverse-optimus and hotplugging.
 
  -- Timo Aaltonen <tjaalton@ubuntu.com>  Tue, 29 Jan 2013 17:23:44 +0200
 
diff --git a/debian/patches/228_autobind_gpu.patch b/debian/patches/228_autobind_gpu.patch
index 7d05f27..c510791 100644
--- a/debian/patches/228_autobind_gpu.patch
+++ b/debian/patches/228_autobind_gpu.patch
@@ -1,19 +1,41 @@
-From 536626891b60039c0f3f9b4cd96156e9fe810f39 Mon Sep 17 00:00:00 2001
+From 37d51acb3b6a38af1717bfaa7925043c35bfb447 Mon Sep 17 00:00:00 2001
 From: Dave Airlie <airlied@redhat.com>
 Date: Fri, 17 Aug 2012 09:49:24 +1000
-Subject: [PATCH] autobind GPUs to the screen, (v2)
+Subject: [PATCH] autobind GPUs to the screen, (v3)
 
 this is racy and really not what we want for hotplug going forward,
 but until DE support is in GNOME its probably for the best.
 
 v2: fix if config or slave config is NULL
+v3: fix multi useful slaves
 DO NOT UPSTREAM.
 ---
- hw/xfree86/common/xf86Init.c        |   12 ++++++++++++
- hw/xfree86/common/xf86platformBus.c |    3 +++
- hw/xfree86/modes/xf86Crtc.c         |   28 ++++++++++++++++++++++++++++
- 3 files changed, 43 insertions(+)
+ dix/dispatch.c                      |  2 --
+ hw/xfree86/common/xf86Init.c        | 12 ++++++++++++
+ hw/xfree86/common/xf86platformBus.c |  3 +++
+ hw/xfree86/modes/xf86Crtc.c         | 32 ++++++++++++++++++++++++++++++++
+ 4 files changed, 47 insertions(+), 2 deletions(-)
 
+diff --git a/dix/dispatch.c b/dix/dispatch.c
+index 0ce10c2..c2ab8f9 100644
+--- a/dix/dispatch.c
++++ b/dix/dispatch.c
+@@ -3933,7 +3933,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;
+ }
+@@ -3950,7 +3949,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;
+ }
 diff --git a/hw/xfree86/common/xf86Init.c b/hw/xfree86/common/xf86Init.c
 index d231ced..89629c1 100644
 --- a/hw/xfree86/common/xf86Init.c
@@ -45,7 +67,7 @@ index d231ced..89629c1 100644
      if (sigio_blocked)
          OsReleaseSIGIO();
 diff --git a/hw/xfree86/common/xf86platformBus.c b/hw/xfree86/common/xf86platformBus.c
-index a73aea2..3810076 100644
+index 0525e39..82fef32 100644
 --- a/hw/xfree86/common/xf86platformBus.c
 +++ b/hw/xfree86/common/xf86platformBus.c
 @@ -387,6 +387,8 @@ xf86platformProbeDev(DriverPtr drvp)
@@ -66,10 +88,10 @@ index a73aea2..3810076 100644
     return 0;
  }
 diff --git a/hw/xfree86/modes/xf86Crtc.c b/hw/xfree86/modes/xf86Crtc.c
-index 8f05c53..ba84e6b 100644
+index 3011f13..34c1848 100644
 --- a/hw/xfree86/modes/xf86Crtc.c
 +++ b/hw/xfree86/modes/xf86Crtc.c
-@@ -3321,3 +3321,31 @@ xf86DetachAllCrtc(ScrnInfoPtr scrn)
+@@ -3323,3 +3323,35 @@ xf86DetachAllCrtc(ScrnInfoPtr scrn)
              crtc->x = crtc->y = 0;
          }
  }
@@ -80,6 +102,7 @@ index 8f05c53..ba84e6b 100644
 +    RRProviderPtr master_provider;
 +    xf86CrtcConfigPtr config = XF86_CRTC_CONFIG_PTR(master);
 +    xf86CrtcConfigPtr slave_config = XF86_CRTC_CONFIG_PTR(pScrn);
++    Bool unbound = FALSE;
 +
 +    if (!config || !slave_config)
 +        return;
@@ -91,16 +114,19 @@ index 8f05c53..ba84e6b 100644
 +            /* source offload */
 +            
 +        DetachUnboundGPU(pScrn->pScreen);
++        unbound = TRUE;
 +        AttachOffloadGPU(master->pScreen, pScrn->pScreen);
 +        slave_config->randr_provider->offload_sink = master_provider;
-+    } else if ((master->capabilities & RR_Capability_SourceOutput) &&
++    }
++    if ((master->capabilities & RR_Capability_SourceOutput) &&
 +               pScrn->capabilities & RR_Capability_SinkOutput) {
 +        /* sink offload */
-+        DetachUnboundGPU(pScrn->pScreen);
++        if (!unbound)
++            DetachUnboundGPU(pScrn->pScreen);
 +        AttachOutputGPU(master->pScreen, pScrn->pScreen);
 +        slave_config->randr_provider->output_source = master_provider;
 +    }
 +}
 -- 
-1.7.10.2
+1.8.1
 
diff --git a/debian/patches/autoconfig-fixup-tell-changed-so-randr-clients-can-t.patch b/debian/patches/autoconfig-fixup-tell-changed-so-randr-clients-can-t.patch
new file mode 100644
index 0000000..2fc9c8c
--- /dev/null
+++ b/debian/patches/autoconfig-fixup-tell-changed-so-randr-clients-can-t.patch
@@ -0,0 +1,203 @@
+From 4ff93e2e2d5253ac8aa773861e15dd41c0b5d4fd Mon Sep 17 00:00:00 2001
+From: Fedora X Ninjas <x@fedoraproject.org>
+Date: Wed, 12 Dec 2012 15:15:38 +1000
+Subject: [PATCH] autoconfig: fixup tell changed so randr clients can tell
+
+This lets the gnome applet update if a usb device appears/disappears
+---
+ hw/xfree86/common/xf86platformBus.c |  7 +++++--
+ hw/xfree86/modes/xf86Crtc.c         |  2 ++
+ 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 +-
+ 9 files changed, 40 insertions(+), 7 deletions(-)
+
+diff --git a/hw/xfree86/common/xf86platformBus.c b/hw/xfree86/common/xf86platformBus.c
+index 057b5b6..197bde8 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;
+@@ -462,7 +463,8 @@ xf86platformAddDevice(int index)
+    /* attach unbound to 0 protocol screen */
+    AttachUnboundGPU(xf86Screens[0]->pScreen, xf86GPUScreens[i]->pScreen);
+    xf86AutoConfigOutputDevice(xf86GPUScreens[i], xf86Screens[0]);
+-
++   
++   RRTellChanged(xf86Screens[0]->pScreen);
+    return 0;
+ }
+ 
+@@ -500,12 +502,13 @@ xf86platformRemoveDevice(int index)
+     xf86GPUScreens[i]->pScreen->CloseScreen(xf86GPUScreens[i]->pScreen);
+ 
+     RemoveGPUScreen(xf86GPUScreens[i]->pScreen);
++
+     xf86DeleteScreen(xf86GPUScreens[i]);
+ 
+     xf86UnclaimPlatformSlot(&xf86_platform_devices[index], NULL);
+ 
+     xf86_remove_platform_device(index);
+-
++    RRTellChanged(xf86Screens[0]->pScreen);
+  out:
+     return;
+ }
+diff --git a/hw/xfree86/modes/xf86Crtc.c b/hw/xfree86/modes/xf86Crtc.c
+index 1263dd7..263a1dc 100644
+--- a/hw/xfree86/modes/xf86Crtc.c
++++ b/hw/xfree86/modes/xf86Crtc.c
+@@ -3346,6 +3346,7 @@ void xf86AutoConfigOutputDevice(ScrnInfoPtr pScrn, ScrnInfoPtr master)
+         unbound = TRUE;
+         AttachOffloadGPU(master->pScreen, pScrn->pScreen);
+         slave_config->randr_provider->offload_sink = master_provider;
++	RRSetChanged(master->pScreen);
+     }
+     if ((master->capabilities & RR_Capability_SourceOutput) &&
+                pScrn->capabilities & RR_Capability_SinkOutput) {
+@@ -3354,5 +3355,6 @@ void xf86AutoConfigOutputDevice(ScrnInfoPtr pScrn, ScrnInfoPtr master)
+             DetachUnboundGPU(pScrn->pScreen);
+         AttachOutputGPU(master->pScreen, pScrn->pScreen);
+         slave_config->randr_provider->output_source = master_provider;
++	RRSetChanged(master->pScreen);
+     }
+ }
+diff --git a/hw/xfree86/modes/xf86RandR12.c b/hw/xfree86/modes/xf86RandR12.c
+index 01fc9c5..9d96c4f 100644
+--- a/hw/xfree86/modes/xf86RandR12.c
++++ b/hw/xfree86/modes/xf86RandR12.c
+@@ -1895,10 +1895,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);
+diff --git a/randr/randr.c b/randr/randr.c
+index f0decfc..2aebe29 100644
+--- a/randr/randr.c
++++ b/randr/randr.c
+@@ -464,6 +464,28 @@ TellChanged(WindowPtr pWin, pointer value)
+     return WT_WALKCHILDREN;
+ }
+ 
++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;
++    }
++
++    mastersp->changed = TRUE;
++}
++
+ /*
+  * Something changed; send events and adjust pointer position
+  */
+@@ -484,7 +506,7 @@ RRTellChanged(ScreenPtr pScreen)
+         mastersp = pScrPriv;
+     }
+ 
+-    if (pScrPriv->changed) {
++    if (mastersp->changed) {
+         UpdateCurrentTimeIf();
+         if (mastersp->configChanged) {
+             mastersp->lastConfigTime = currentTime;
+diff --git a/randr/randrstr.h b/randr/randrstr.h
+index 55faaed..73132e3 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 e82d050..d0add47 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..195bef9 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);
+-- 
+1.8.1
+
diff --git a/debian/patches/dix-allow-pixmap-dirty-helper-to-be-used-for-non-sha.patch b/debian/patches/dix-allow-pixmap-dirty-helper-to-be-used-for-non-sha.patch
new file mode 100644
index 0000000..e524142
--- /dev/null
+++ b/debian/patches/dix-allow-pixmap-dirty-helper-to-be-used-for-non-sha.patch
@@ -0,0 +1,40 @@
+From 73fc15d94136a87807c1ce69d56fb8a34c09fe4f Mon Sep 17 00:00:00 2001
+From: Fedora X Ninjas <x@fedoraproject.org>
+Date: Tue, 8 Jan 2013 09:41:36 +1000
+Subject: [PATCH] dix: allow pixmap dirty helper to be used for non-shared
+ pixmaps
+
+this allows the pixmap dirty helper to be used for reverse optimus
+---
+ dix/pixmap.c  | 2 ++
+ fb/fbpixmap.c | 1 +
+ 2 files changed, 3 insertions(+)
+
+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 =
+-- 
+1.8.1
+
diff --git a/debian/patches/randr-cleanup-provider-properly.patch b/debian/patches/randr-cleanup-provider-properly.patch
new file mode 100644
index 0000000..271108b
--- /dev/null
+++ b/debian/patches/randr-cleanup-provider-properly.patch
@@ -0,0 +1,133 @@
+From 9d9444a0796707eaa6a5635e78e2db6a4c04226e Mon Sep 17 00:00:00 2001
+From: Dave Airlie <airlied@redhat.com>
+Date: Wed, 9 Jan 2013 12:58:28 +1000
+Subject: [PATCH] randr: cleanup provider properly
+
+So in the cold plug server shutdown case, we reap the resources
+before we call CloseScreen handlers, so the config->randr_provider
+is a dangling pointer when the xf86CrtcCloseScreen handler is called,
+
+however in the hot screen unplug case, we can't rely on automatically
+reaped resources, so we need to clean up the provider in the xf86CrtcCloseScreen
+case.
+
+This patch provides a cleanup callback from the randr provider removal
+into the DDX so it can cleanup properly, this then gets called by the automatic
+code for cold plug, or if hot unplug it gets called explicitly.
+
+Fixes a number of random server crashes on shutdown
+Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=58174
+Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=891140
+
+Signed-off-by: Dave Airlie <airlied@redhat.com>
+Signed-off-by: Fedora X Ninjas <x@fedoraproject.org>
+---
+ hw/xfree86/modes/xf86Crtc.c    | 12 ++----------
+ hw/xfree86/modes/xf86RandR12.c | 22 ++++++++++++++++++++++
+ randr/randrstr.h               |  6 ++++++
+ randr/rrprovider.c             |  2 ++
+ 4 files changed, 32 insertions(+), 10 deletions(-)
+
+diff --git a/hw/xfree86/modes/xf86Crtc.c b/hw/xfree86/modes/xf86Crtc.c
+index e527abc..1263dd7 100644
+--- a/hw/xfree86/modes/xf86Crtc.c
++++ b/hw/xfree86/modes/xf86Crtc.c
+@@ -743,16 +743,8 @@ xf86CrtcCloseScreen(ScreenPtr screen)
+     }
+     /* detach any providers */
+     if (config->randr_provider) {
+-        if (config->randr_provider->offload_sink) {
+-            DetachOffloadGPU(screen);
+-            config->randr_provider->offload_sink = NULL;
+-        }
+-        else if (config->randr_provider->output_source) {
+-            DetachOutputGPU(screen);
+-            config->randr_provider->output_source = NULL;
+-        }
+-        else if (screen->current_master)
+-            DetachUnboundGPU(screen);
++        RRProviderDestroy(config->randr_provider);
++        config->randr_provider = NULL;
+     }
+     return TRUE;
+ }
+diff --git a/hw/xfree86/modes/xf86RandR12.c b/hw/xfree86/modes/xf86RandR12.c
+index 3530abf..01fc9c5 100644
+--- a/hw/xfree86/modes/xf86RandR12.c
++++ b/hw/xfree86/modes/xf86RandR12.c
+@@ -1885,6 +1885,27 @@ xf86RandR13ConstrainCursorHarder(DeviceIntPtr dev, ScreenPtr screen, int mode, i
+     }
+ }
+ 
++static void
++xf86RandR14ProviderDestroy(ScreenPtr screen, RRProviderPtr provider)
++{
++    ScrnInfoPtr scrn = xf86ScreenToScrn(screen);
++    xf86CrtcConfigPtr config = XF86_CRTC_CONFIG_PTR(scrn);
++    
++    if (config->randr_provider == provider) {
++        if (config->randr_provider->offload_sink) {
++            DetachOffloadGPU(screen);
++            config->randr_provider->offload_sink = NULL;
++        }
++        else if (config->randr_provider->output_source) {
++            DetachOutputGPU(screen);
++            config->randr_provider->output_source = NULL;
++        }
++        else if (screen->current_master)
++            DetachUnboundGPU(screen);
++    }
++    config->randr_provider = NULL;
++}
++
+ static Bool
+ xf86RandR12Init12(ScreenPtr pScreen)
+ {
+@@ -1914,6 +1935,7 @@ xf86RandR12Init12(ScreenPtr pScreen)
+     rp->rrProviderSetProperty = xf86RandR14ProviderSetProperty;
+     rp->rrProviderGetProperty = xf86RandR14ProviderGetProperty;
+     rp->rrCrtcSetScanoutPixmap = xf86CrtcSetScanoutPixmap;
++    rp->rrProviderDestroy = xf86RandR14ProviderDestroy;
+ 
+     pScrn->PointerMoved = xf86RandR12PointerMoved;
+     pScrn->ChangeGamma = xf86RandR12ChangeGamma;
+diff --git a/randr/randrstr.h b/randr/randrstr.h
+index 212b0a9..55faaed 100644
+--- a/randr/randrstr.h
++++ b/randr/randrstr.h
+@@ -232,6 +232,9 @@ typedef Bool (*RRProviderSetOffloadSinkProcPtr)(ScreenPtr pScreen,
+                                          RRProviderPtr offload_sink);
+ 
+ 
++typedef void (*RRProviderDestroyProcPtr)(ScreenPtr pScreen,
++                                         RRProviderPtr provider);
++
+ /* These are for 1.0 compatibility */
+ 
+ typedef struct _rrRefresh {
+@@ -330,6 +333,9 @@ typedef struct _rrScrPriv {
+     Bool discontiguous;
+ 
+     RRProviderPtr provider;
++
++    RRProviderDestroyProcPtr rrProviderDestroy;
++
+ } rrScrPrivRec, *rrScrPrivPtr;
+ 
+ extern _X_EXPORT DevPrivateKeyRec rrPrivKeyRec;
+diff --git a/randr/rrprovider.c b/randr/rrprovider.c
+index c4ed515..b321e62 100644
+--- a/randr/rrprovider.c
++++ b/randr/rrprovider.c
+@@ -389,6 +389,8 @@ RRProviderDestroyResource (pointer value, XID pid)
+     {
+         rrScrPriv(pScreen);
+ 
++        if (pScrPriv->rrProviderDestroy)
++            (*pScrPriv->rrProviderDestroy)(pScreen, provider);
+         pScrPriv->provider = NULL;
+     }
+     free(provider);
+-- 
+1.8.1
+
diff --git a/debian/patches/series b/debian/patches/series
index b7a346f..3aff1b9 100644
--- a/debian/patches/series
+++ b/debian/patches/series
@@ -16,8 +16,6 @@
 190_cache-xkbcomp_output_for_fast_start_up.patch
 191-Xorg-add-an-extra-module-path.patch
 226_fall_back_to_autoconfiguration.patch
-# drop after desktop support arrives
-228_autobind_gpu.patch
 
 ## send upstream
 122_xext_fix_card32_overflow_in_xauth.patch
@@ -37,3 +35,17 @@
 
 ## from upstream, drop when rebasing to a new version
 237_dix_save_touchpoint_last_coords_before_transform.patch
+
+# hybrid graphics fixes for xserver 1.13
+228_autobind_gpu.patch
+
+# hotplug fixes
+xfree86-hotplug-cleanup-properly-if-the-screen-fails.patch
+xf86crtc-don-t-use-display-for-vx-vy-for-gpu-screens.patch
+
+# fixes for reverse optimus, cherry-picked from fedora X
+dix-allow-pixmap-dirty-helper-to-be-used-for-non-sha.patch
+xserver-call-CSR-for-gpus.patch
+xf86-actually-set-the-compat-output-in-the-failure-c.patch
+randr-cleanup-provider-properly.patch
+autoconfig-fixup-tell-changed-so-randr-clients-can-t.patch
diff --git a/debian/patches/xf86-actually-set-the-compat-output-in-the-failure-c.patch b/debian/patches/xf86-actually-set-the-compat-output-in-the-failure-c.patch
new file mode 100644
index 0000000..fc6dae8
--- /dev/null
+++ b/debian/patches/xf86-actually-set-the-compat-output-in-the-failure-c.patch
@@ -0,0 +1,35 @@
+From bc9bbe15919f099d57a43c73b7d8cf28ac5ce1d4 Mon Sep 17 00:00:00 2001
+From: Dave Airlie <airlied@redhat.com>
+Date: Wed, 9 Jan 2013 12:53:14 +1000
+Subject: [PATCH 1/2] xf86: actually set the compat output in the failure case
+
+The previous fix for the previous fix, didn't fully work,
+
+If we don't set compat_output we end up doing derferences
+of arrays with -1, leading to valgrind warnings.
+
+Signed-off-by: Dave Airlie <airlied@redhat.com>
+---
+ hw/xfree86/modes/xf86Crtc.c | 6 ++++--
+ 1 file changed, 4 insertions(+), 2 deletions(-)
+
+diff --git a/hw/xfree86/modes/xf86Crtc.c b/hw/xfree86/modes/xf86Crtc.c
+index 77a0218..45764fc 100644
+--- a/hw/xfree86/modes/xf86Crtc.c
++++ b/hw/xfree86/modes/xf86Crtc.c
+@@ -1848,8 +1848,10 @@ SetCompatOutput(xf86CrtcConfigPtr config)
+     }
+ 
+     /* All outputs are disconnected, select one to fake */
+-    if (!output && config->num_output)
+-        output = config->output[0];
++    if (!output && config->num_output) {
++        config->compat_output = 0;
++        output = config->output[config->compat_output];
++    }
+ 
+     return output;
+ }
+-- 
+1.8.1
+
diff --git a/debian/patches/xf86crtc-don-t-use-display-for-vx-vy-for-gpu-screens.patch b/debian/patches/xf86crtc-don-t-use-display-for-vx-vy-for-gpu-screens.patch
new file mode 100644
index 0000000..36b6a4c
--- /dev/null
+++ b/debian/patches/xf86crtc-don-t-use-display-for-vx-vy-for-gpu-screens.patch
@@ -0,0 +1,65 @@
+From 2bd6a8491ad3dbd42db66be7ae48f4b6e9c698f2 Mon Sep 17 00:00:00 2001
+From: Fedora X Ninjas <x@fedoraproject.org>
+Date: Wed, 12 Dec 2012 14:02:54 +1000
+Subject: [PATCH] xf86crtc: don't use display for vx/vy for gpu screens
+
+---
+ hw/xfree86/modes/xf86Crtc.c | 18 +++++++++++-------
+ 1 file changed, 11 insertions(+), 7 deletions(-)
+
+diff --git a/hw/xfree86/modes/xf86Crtc.c b/hw/xfree86/modes/xf86Crtc.c
+index 6975d2f..2828ee0 100644
+--- a/hw/xfree86/modes/xf86Crtc.c
++++ b/hw/xfree86/modes/xf86Crtc.c
+@@ -2425,11 +2425,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;
+@@ -2497,8 +2497,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];
+@@ -2546,7 +2548,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.
+@@ -2561,8 +2563,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)
+-- 
+1.8.1
+
diff --git a/debian/patches/xfree86-hotplug-cleanup-properly-if-the-screen-fails.patch b/debian/patches/xfree86-hotplug-cleanup-properly-if-the-screen-fails.patch
new file mode 100644
index 0000000..9833e84
--- /dev/null
+++ b/debian/patches/xfree86-hotplug-cleanup-properly-if-the-screen-fails.patch
@@ -0,0 +1,38 @@
+From 18c470b399f9f29797c1604dc8e1f11782b3f89d Mon Sep 17 00:00:00 2001
+From: Dave Airlie <airlied@redhat.com>
+Date: Wed, 12 Dec 2012 14:14:39 +1000
+Subject: [PATCH] xfree86/hotplug: cleanup properly if the screen fails to
+ initialise
+
+Due to another bug, the modesetting/udl driver would fail to init properly
+on hotplug, when it did the code didn't clean up properly, and on removing
+the device the server could crash.
+
+Found in F18 testing.
+
+Signed-off-by: Dave Airlie <airlied@redhat.com>
+---
+ hw/xfree86/common/xf86platformBus.c | 7 ++++++-
+ 1 file changed, 6 insertions(+), 1 deletion(-)
+
+diff --git a/hw/xfree86/common/xf86platformBus.c b/hw/xfree86/common/xf86platformBus.c
+index 0525e39..5866333 100644
+--- a/hw/xfree86/common/xf86platformBus.c
++++ b/hw/xfree86/common/xf86platformBus.c
+@@ -438,7 +438,12 @@ xf86platformAddDevice(int index)
+     }
+ 
+    scr_index = AddGPUScreen(xf86GPUScreens[i]->ScreenInit, 0, NULL);
+-
++   if (scr_index == -1) {
++       xf86DeleteScreen(xf86GPUScreens[i]);
++       xf86UnclaimPlatformSlot(&xf86_platform_devices[index], NULL);
++       xf86NumGPUScreens = old_screens;
++       return -1;
++   }
+    dixSetPrivate(&xf86GPUScreens[i]->pScreen->devPrivates,
+                  xf86ScreenKey, xf86GPUScreens[i]);
+ 
+-- 
+1.8.0.1
+
diff --git a/debian/patches/xserver-call-CSR-for-gpus.patch b/debian/patches/xserver-call-CSR-for-gpus.patch
new file mode 100644
index 0000000..8c6fbda
--- /dev/null
+++ b/debian/patches/xserver-call-CSR-for-gpus.patch
@@ -0,0 +1,46 @@
+From 6aa11e40ec75fb31d0c611f9d578427941379c0d Mon Sep 17 00:00:00 2001
+From: Fedora X Ninjas <x@fedoraproject.org>
+Date: Tue, 8 Jan 2013 09:42:44 +1000
+Subject: [PATCH] xserver: call CSR for gpus
+
+---
+ dix/main.c                          | 3 +++
+ hw/xfree86/common/xf86platformBus.c | 8 ++++++++
+ 2 files changed, 11 insertions(+)
+
+diff --git a/dix/main.c b/dix/main.c
+index fb935c9..e558d70 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 67d03eb..8f73c3a 100644
+--- a/hw/xfree86/common/xf86platformBus.c
++++ b/hw/xfree86/common/xf86platformBus.c
+@@ -452,6 +452,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);
+    xf86AutoConfigOutputDevice(xf86GPUScreens[i], xf86Screens[0]);
+-- 
+1.8.1
+


Reply to: