[PATCH 19/31] xf86: add ability to do a role change

Dave Airlie airlied at gmail.com
Wed Jun 20 07:00:34 PDT 2012


From: Dave Airlie <airlied at redhat.com>

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

Signed-off-by: Dave Airlie <airlied at 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



More information about the xorg-devel mailing list