[PATCH] xrandr: allow disconnecting of offload and outputs

Dave Airlie airlied at gmail.com
Thu May 2 17:05:04 PDT 2013


Before the lookup code passing a 0 XID would disconnect,
this fixes it backup.

Signed-off-by: Dave Airlie <airlied at redhat.com>
---
 xrandr.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/xrandr.c b/xrandr.c
index 305308c..d5727b2 100644
--- a/xrandr.c
+++ b/xrandr.c
@@ -2446,6 +2446,8 @@ find_provider (name_t *name)
 {
     int i;
 
+    if ((name->kind & name_xid) && name->xid == 0)
+	return NULL;
     for (i = 0; i < num_providers; i++) {
 	provider_t *p = &providers[i];
 	name_kind_t common = name->kind & p->provider.kind;
@@ -3228,7 +3230,7 @@ main (int argc, char **argv)
 	provider = find_provider (&provider_name);
 	source = find_provider(&output_source_provider_name);
 
-	XRRSetProviderOutputSource(dpy, provider->provider.xid, source->provider.xid);
+	XRRSetProviderOutputSource(dpy, provider->provider.xid, source ? source->provider.xid : 0);
     }
     if (provsetoffsink)
     {
@@ -3243,7 +3245,7 @@ main (int argc, char **argv)
 	provider = find_provider (&provider_name);
 	sink = find_provider(&offload_sink_provider_name);
 
-	XRRSetProviderOffloadSink(dpy, provider->provider.xid, sink->provider.xid);
+	XRRSetProviderOffloadSink(dpy, provider->provider.xid, sink ? sink->provider.xid : 0);
     }
     if (setit_1_2)
     {
-- 
1.8.2



More information about the xorg-devel mailing list