This too.. please comment, test and if deemed alright add to
source. Thanks!


---------- Forwarded message ----------
From: Stephan Diestelhorst <stephan.diestelho...@gmail.com>
Date: Sun, Oct 9, 2011 at 8:28 PM
Subject: Re: [Libva] FGLRX detection code overly restrictive
To: Gwenole Beauchesne <gb.de...@gmail.com>


On Sun, Oct 9, 2011 at 11:36 AM, Stephan Diestelhorst
<stephan.diestelho...@gmail.com> wrote:
> How does one detect whether this is a multi-monitor setup? According
> to the X documentation :0 is equal to :0.0, since the first screen is chosen
> by default. I'll try to incorporate that into a patch.
>
>> The proper fixes would be:
>> 1. Don't return success if no valid match was found.
>> 2. Account for ":0" cases in a single monitor system.
>
> Will hack sth together!

This has got more ugly than anticipated, but works for me..

Stephan
diff --git a/va/x11/va_fglrx.c b/va/x11/va_fglrx.c
index 5be0256..7576c46 100644
--- a/va/x11/va_fglrx.c
+++ b/va/x11/va_fglrx.c
@@ -92,7 +92,33 @@ static int match_display(Display *x11_dpy, const char *display_name)
     x11_dpy_name  = XDisplayString(x11_dpy);
 
     if (x11_dpy_name && test_dpy_name)
+    {
         m = strcmp(x11_dpy_name, test_dpy_name) == 0;
+        if (!m)
+        {
+            // Check whether this is <display> vs <display>.0
+            int l1, l2;
+            l1 = strlen(x11_dpy_name);
+            l2 = strlen(test_dpy_name);
+            int l_short, l_long;
+            const char *name_short, *name_long;
+            if  (l1 < l2)
+            {
+                l_short    = l1;           l_long     = l2;
+                name_short = x11_dpy_name; name_long  = test_dpy_name;
+            }
+            else
+            {
+                l_long    = l1;           l_short     = l2;
+                name_long = x11_dpy_name; name_short  = test_dpy_name;
+            }
+            // Check for equal prefix
+            if (!strncmp(name_short, name_long, l_short))
+            {
+                m = strcmp(name_long + (l_long - 2), ".0") == 0;
+            }
+        }
+    }
     else
         m = !x11_dpy_name && !test_dpy_name;
 
@@ -211,7 +237,7 @@ Bool VA_FGLRXGetClientDriverName( Display *dpy, int screen,
         }
     }
 
-    success = True;
+    success = (*clientDriverName != NULL);
 end:
     if (lpXScreenInfo)
         ADL_Main_Memory_Free(&lpXScreenInfo);
_______________________________________________
Libva mailing list
Libva@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libva

Reply via email to