[PATCH 20/29] xf86: add output source setting callback

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


From: Dave Airlie <airlied at redhat.com>

This adds support for the randr callback for setting the output source
for a device.

Signed-off-by: Dave Airlie <airlied at redhat.com>
---
 hw/xfree86/modes/xf86Crtc.c    |    6 +++++-
 hw/xfree86/modes/xf86RandR12.c |   35 +++++++++++++++++++++++++++++++++++
 2 files changed, 40 insertions(+), 1 deletion(-)

diff --git a/hw/xfree86/modes/xf86Crtc.c b/hw/xfree86/modes/xf86Crtc.c
index 5057eac..9e43c40 100644
--- a/hw/xfree86/modes/xf86Crtc.c
+++ b/hw/xfree86/modes/xf86Crtc.c
@@ -728,7 +728,11 @@ xf86CrtcCloseScreen(ScreenPtr screen)
 
     /* detach any providers */
     if (config->randr_provider) {
-        DetachUnboundGPU(screen);
+        if (config->randr_provider->output_source) {
+            DetachOutputGPU(screen);
+            config->randr_provider->output_source = NULL;
+        } else
+            DetachUnboundGPU(screen);
     }
     for (o = 0; o < config->num_output; o++) {
         xf86OutputPtr output = config->output[o];
diff --git a/hw/xfree86/modes/xf86RandR12.c b/hw/xfree86/modes/xf86RandR12.c
index ca3388a..01cc594 100644
--- a/hw/xfree86/modes/xf86RandR12.c
+++ b/hw/xfree86/modes/xf86RandR12.c
@@ -1754,6 +1754,39 @@ xf86RandR12EnterVT(ScrnInfoPtr pScrn)
 }
 
 static Bool
+xf86RandR14ProviderSetOutputSource(ScreenPtr pScreen,
+                                   RRProviderPtr provider,
+                                   RRProviderPtr source_provider)
+{
+
+
+    if (!source_provider) {
+        if (provider->output_source) {
+            ScreenPtr cmScreen = pScreen->current_master;
+            SetRootClip(cmScreen, FALSE);
+
+            DetachOutputGPU(pScreen);
+            AttachUnboundGPU(cmScreen, pScreen);
+            SetRootClip(cmScreen, TRUE);
+        }
+        provider->output_source = NULL;
+        return TRUE;
+    }
+
+    if (provider->output_source == source_provider)
+        return TRUE;
+
+    SetRootClip(source_provider->pScreen, FALSE);
+
+    DetachUnboundGPU(pScreen);
+    AttachOutputGPU(source_provider->pScreen, pScreen);
+
+    provider->output_source = source_provider;
+    SetRootClip(source_provider->pScreen, TRUE);
+    return TRUE;
+}
+
+static Bool
 xf86RandR14ProviderSetProperty(ScreenPtr pScreen,
                              RRProviderPtr randr_provider,
                              Atom property, RRPropertyValuePtr value)
@@ -1820,6 +1853,8 @@ xf86RandR12Init12(ScreenPtr pScreen)
     rp->rrModeDestroy = xf86RandR12ModeDestroy;
     rp->rrSetConfig = NULL;
 
+    rp->rrProviderSetOutputSource = xf86RandR14ProviderSetOutputSource;
+
     rp->rrProviderSetProperty = xf86RandR14ProviderSetProperty;
     rp->rrProviderGetProperty = xf86RandR14ProviderGetProperty;
     rp->rrCrtcSetScanoutPixmap = xf86CrtcSetScanoutPixmap;
-- 
1.7.10.2



More information about the xorg-devel mailing list