From: Dave Airlie <airl...@redhat.com>

This just hooks up a simple role change to go from unattached
to slave output and back.

Signed-off-by: Dave Airlie <airl...@redhat.com>
---
 hw/xfree86/modes/xf86RandR12.c |   27 ++++++++++++++++++++++++++-
 1 file changed, 26 insertions(+), 1 deletion(-)

diff --git a/hw/xfree86/modes/xf86RandR12.c b/hw/xfree86/modes/xf86RandR12.c
index 78cad63..5a85ed1 100644
--- a/hw/xfree86/modes/xf86RandR12.c
+++ b/hw/xfree86/modes/xf86RandR12.c
@@ -1763,7 +1763,32 @@ xf86RandR15ProviderSetRole(ScreenPtr pScreen,
                            RRProviderPtr provider,
                            uint32_t new_role)
 {
-    /* do nothing so far */
+    ScreenPtr master;
+    ScrnInfoPtr pScrn = xf86ScreenToScrn(pScreen);
+
+    master = pScreen->current_master;
+
+    assert(!master->isGPU);
+    SetRootClip(master, FALSE);
+
+    if (new_role == RR_Role_Slave_Output) {
+        if (provider->current_role == 0)
+            DetachUnboundGPU(pScreen);
+        AttachOutputGPU(master, pScreen);
+        xf86SetCurrentRole(xf86ScreenToScrn(pScreen), RR_Role_Slave_Output);
+    }
+
+    if (!new_role) {
+        if (provider->current_role == RR_Role_Slave_Output) {
+            DetachOutputGPU(pScreen);
+            xf86SetCurrentRole(xf86ScreenToScrn(pScreen), 0);
+        }
+
+        AttachUnboundGPU(master, pScreen);
+    }
+
+    RRTellChanged(master);
+    SetRootClip(master, TRUE);
     return TRUE;
 }
 
-- 
1.7.10.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

Reply via email to