File xrandr-print-outputs-per-provider.patch of Package xrandr

Index: xrandr-1.5.0/xrandr.c
===================================================================
--- xrandr-1.5.0.orig/xrandr.c
+++ xrandr-1.5.0/xrandr.c
@@ -2635,6 +2635,53 @@ get_monitors(Bool get_active)
     monitors->monitors = m;
 }
 
+static void
+print_providers (Bool current)
+{
+    int k;
+
+    if (!has_1_4) {
+	printf ("RandR 1.4 not supported\n");
+	exit (0);
+    }
+
+    get_screen (current);
+    get_crtcs ();
+    get_outputs ();
+    get_providers ();
+
+    if (providers) {
+	int j;
+	int i;
+
+	printf("Providers: number : %d\n", num_providers);
+
+	for (j = 0; j < num_providers; j++) {
+	    provider_t *provider = &providers[j];
+	    XRRProviderInfo *info = provider->info;
+
+	    printf("Provider %d: id: 0x%x; cap: 0x%x (", j, (int)provider->provider.xid, info->capabilities);
+	    for (k = 0; k < 4; k++)
+		if (info->capabilities & (1 << k)) {
+		    printf("%s", capability_name(1<<k));
+		    if ((info->capabilities & (0xff << (k + 1))) != 0)
+			printf (", ");
+		}
+	    printf (");");
+
+	    printf(" crtcs: %d; outputs: %d; associated providers: %d; name: %s\n", info->ncrtcs, info->noutputs, info->nassociatedproviders, info->name);
+
+	    for (i = 0; i < info->noutputs; i++) {
+		output_t *output = find_output_by_xid (info->outputs[i]);
+		if (output)
+		    printf ("    output %s\n", output->output.string);
+		else
+		    printf ("    output 0x%x\n", (int)info->outputs[i]);
+	    }
+	}
+    }
+}
+
 int
 main (int argc, char **argv)
 {
@@ -3924,35 +3971,8 @@ main (int argc, char **argv)
 	}
 	exit (0);
     }
-    if (list_providers) {
-	int k;
-
-	if (!has_1_4) {
-	    printf ("RandR 1.4 not supported\n");
-	    exit (0);
-	}
-
-	get_screen (current);
-	get_providers ();
-
-	if (providers) {
-	    int j;
-
-	    printf("Providers: number : %d\n", num_providers);
-
-	    for (j = 0; j < num_providers; j++) {
-		provider_t *provider = &providers[j];
-		XRRProviderInfo *info = provider->info;
-
-		printf("Provider %d: id: 0x%x cap: 0x%x", j, (int)provider->provider.xid, info->capabilities);
-		for (k = 0; k < 4; k++)
-			if (info->capabilities & (1 << k))
-				printf(", %s", capability_name(1<<k));
-
-		printf(" crtcs: %d outputs: %d associated providers: %d name:%s\n", info->ncrtcs, info->noutputs, info->nassociatedproviders, info->name);
-	    }
-	}
-    }
+    if (list_providers)
+	print_providers (current);
     if (list_monitors || list_active_monitors) {
 
 	if (!has_1_5) {