Re: [PATCH xdriinfo] Fix xdriinfo not working with glvnd

2017-03-15 Thread Eric Anholt
Hans de Goede  writes:

> For glx calls to work on libglvnd as glx provider we must first call
> glXGetClientString. This also means that we can no longer take the
> shortcut to not open the Display when a driver name is past to options.

This seems sensible.  Hopefully nothing is relying on this working
without an X connection being possible.

Reviewed-by: Eric Anholt 


signature.asc
Description: PGP signature
___
xorg-devel@lists.x.org: X.Org development
Archives: http://lists.x.org/archives/xorg-devel
Info: https://lists.x.org/mailman/listinfo/xorg-devel

[PATCH xdriinfo] Fix xdriinfo not working with glvnd

2017-03-13 Thread Hans de Goede
For glx calls to work on libglvnd as glx provider we must first call
glXGetClientString. This also means that we can no longer take the
shortcut to not open the Display when a driver name is past to options.

Signed-off-by: Hans de Goede 
---
 xdriinfo.c | 29 -
 1 file changed, 12 insertions(+), 17 deletions(-)

diff --git a/xdriinfo.c b/xdriinfo.c
index c23cfa1..c7e7482 100644
--- a/xdriinfo.c
+++ b/xdriinfo.c
@@ -112,23 +112,9 @@ int main (int argc, char *argv[]) {
return 1;
}
 }
-  /* if the argument to the options command is a driver name, we can handle
-   * it without opening an X connection */
-if (func == OPTIONS && screenNum == -1) {
-   const char *options = (*GetDriverConfig) (funcArg);
-   if (!options) {
-   fprintf (stderr,
-"Driver \"%s\" is not installed or does not support 
configuration.\n",
-funcArg);
-   return 1;
-   }
-   printf ("%s", options);
-   if (isatty (STDOUT_FILENO))
-   printf ("\n");
-   return 0;
-} 
+
   /* driver command needs a valid screen number */
-else if (func == DRIVER && screenNum == -1) {
+if (func == DRIVER && screenNum == -1) {
fprintf (stderr, "Invalid screen number \"%s\".\n", funcArg);
return 1;
 }
@@ -146,6 +132,9 @@ int main (int argc, char *argv[]) {
return 1;
 }
 
+   /* Call glXGetClientString to load vendor libs on glvnd enabled systems */
+glXGetClientString (dpy, GLX_EXTENSIONS);
+
 switch (func) {
   case NSCREENS:
printf ("%d", nScreens);
@@ -165,7 +154,13 @@ int main (int argc, char *argv[]) {
  break;
   }
   case OPTIONS: {
- const char *name = (*GetScreenDriver) (dpy, screenNum), *options;
+ const char *name, *options;
+ 
+ if (screenNum == -1) {
+ name = funcArg;
+ } else {
+ name = (*GetScreenDriver) (dpy, screenNum);
+ }
  if (!name) {
  fprintf (stderr, "Screen \"%d\" is not direct rendering 
capable.\n",
   screenNum);
-- 
2.9.3

___
xorg-devel@lists.x.org: X.Org development
Archives: http://lists.x.org/archives/xorg-devel
Info: https://lists.x.org/mailman/listinfo/xorg-devel