Return BadValue when the provider is main gpu (instead of aborting on assert
later) and when the sink and source are the same gpu (instead of breaking
and possibly crashing later).

diff --git a/randr/rrprovider.c b/randr/rrprovider.c
index 4507ba8..31af871 100644
--- a/randr/rrprovider.c
+++ b/randr/rrprovider.c
@@ -292,11 +292,17 @@ ProcRRSetProviderOutputSource(ClientPtr client)
     if (!(provider->capabilities & RR_Capability_SinkOutput))
         return BadValue;
 
+    if (!provider->pScreen->isGPU)
+        return BadValue;
+
     if (stuff->source_provider) {
         VERIFY_RR_PROVIDER(stuff->source_provider, source_provider, 
DixReadAccess);
 
         if (!(source_provider->capabilities & RR_Capability_SourceOutput))
             return BadValue;
+
+        if (source_provider == provider)
+            return BadValue;
     }
 
     pScreen = provider->pScreen;
@@ -326,10 +332,16 @@ ProcRRSetProviderOffloadSink(ClientPtr client)
     if (!(provider->capabilities & RR_Capability_SourceOffload))
         return BadValue;
 
+    if (!provider->pScreen->isGPU)
+        return BadValue;
+
     if (stuff->sink_provider) {
         VERIFY_RR_PROVIDER(stuff->sink_provider, sink_provider, DixReadAccess);
         if (!(sink_provider->capabilities & RR_Capability_SinkOffload))
             return BadValue;
+
+        if (sink_provider == provider)
+            return BadValue;
     }
     pScreen = provider->pScreen;
     pScrPriv = rrGetScrPriv(pScreen);

_______________________________________________
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