progs: Try to read the texture from the current dir, if full path fails.
[mesa.git] / progs / egl / eglinfo.c
index e907d136989027b3a68bddf1789dc2c4cdfff064..feae954b75afc0b3d977c8a73a94d36eb9306778 100644 (file)
  * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
  */
 
+#define EGL_EGLEXT_PROTOTYPES
 
-#include <GLES/egl.h>
+#include <EGL/egl.h>
+#include <EGL/eglext.h>
 #include <assert.h>
 #include <stdio.h>
 #include <stdlib.h>
@@ -33,7 +35,7 @@
 
 #define MAX_CONFIGS 1000
 #define MAX_MODES 1000
-
+#define MAX_SCREENS 10
 
 /**
  * Print table of all available configurations.
@@ -47,15 +49,17 @@ PrintConfigs(EGLDisplay d)
    eglGetConfigs(d, configs, MAX_CONFIGS, &numConfigs);
 
    printf("Configurations:\n");
-   printf("     bf lv d st colorbuffer dp st   supported \n");
-   printf("  id sz  l b ro  r  g  b  a th cl   surfaces  \n");
-   printf("----------------------------------------------\n");
+   printf("     bf lv d st colorbuffer dp st  ms    vis   supported\n");
+   printf("  id sz  l b ro  r  g  b  a th cl ns b    id   surfaces \n");
+   printf("--------------------------------------------------------\n");
    for (i = 0; i < numConfigs; i++) {
       EGLint id, size, level;
       EGLint red, green, blue, alpha;
       EGLint depth, stencil;
       EGLint surfaces;
       EGLint doubleBuf = 1, stereo = 0;
+      EGLint vid;
+      EGLint samples, sampleBuffers;
       char surfString[100] = "";
 
       eglGetConfigAttrib(d, configs[i], EGL_CONFIG_ID, &id);
@@ -68,23 +72,32 @@ PrintConfigs(EGLDisplay d)
       eglGetConfigAttrib(d, configs[i], EGL_ALPHA_SIZE, &alpha);
       eglGetConfigAttrib(d, configs[i], EGL_DEPTH_SIZE, &depth);
       eglGetConfigAttrib(d, configs[i], EGL_STENCIL_SIZE, &stencil);
+      eglGetConfigAttrib(d, configs[i], EGL_NATIVE_VISUAL_ID, &vid);
       eglGetConfigAttrib(d, configs[i], EGL_SURFACE_TYPE, &surfaces);
 
+      eglGetConfigAttrib(d, configs[i], EGL_SAMPLES, &samples);
+      eglGetConfigAttrib(d, configs[i], EGL_SAMPLE_BUFFERS, &sampleBuffers);
+
       if (surfaces & EGL_WINDOW_BIT)
          strcat(surfString, "win,");
       if (surfaces & EGL_PBUFFER_BIT)
          strcat(surfString, "pb,");
       if (surfaces & EGL_PIXMAP_BIT)
          strcat(surfString, "pix,");
+#ifdef EGL_MESA_screen_surface
+      if (surfaces & EGL_SCREEN_BIT_MESA)
+         strcat(surfString, "scrn,");
+#endif
       if (strlen(surfString) > 0)
          surfString[strlen(surfString) - 1] = 0;
 
-      printf("0x%02x %2d %2d %c  %c %2d %2d %2d %2d %2d %2d   %-12s\n",
+      printf("0x%02x %2d %2d %c  %c %2d %2d %2d %2d %2d %2d %2d%2d  0x%02x   %-12s\n",
              id, size, level,
              doubleBuf ? 'y' : '.',
              stereo ? 'y' : '.',
              red, green, blue, alpha,
-             depth, stencil, surfString);
+             depth, stencil,
+             samples, sampleBuffers, vid, surfString);
    }
 }
 
@@ -97,12 +110,12 @@ PrintModes(EGLDisplay d)
 {
 #ifdef EGL_MESA_screen_surface
    const char *extensions = eglQueryString(d, EGL_EXTENSIONS);
-   if (strstr("EGL_MESA_screen_surface", extensions)) {
-      EGLScreenMESA screens[20];
+   if (strstr(extensions, "EGL_MESA_screen_surface")) {
+      EGLScreenMESA screens[MAX_SCREENS];
       EGLint numScreens = 1, scrn;
       EGLModeMESA modes[MAX_MODES];
 
-      eglGetScreensMESA(d, screens, 20, &numScreens);
+      eglGetScreensMESA(d, screens, MAX_SCREENS, &numScreens);
       printf("Number of Screens: %d\n\n", numScreens);
 
       for (scrn = 0; scrn < numScreens; scrn++) {
@@ -111,15 +124,17 @@ PrintModes(EGLDisplay d)
          eglGetModesMESA(d, screens[scrn], modes, MAX_MODES, &numModes);
 
          printf("Screen %d Modes:\n", scrn);
-         printf("  id width height refresh\n");
-         printf("-------------------------\n");
+         printf("  id  width height refresh  name\n");
+         printf("-----------------------------------------\n");
          for (i = 0; i < numModes; i++) {
             EGLint id, w, h, r;
+            const char *str;
             eglGetModeAttribMESA(d, modes[i], EGL_MODE_ID_MESA, &id);
             eglGetModeAttribMESA(d, modes[i], EGL_WIDTH, &w);
             eglGetModeAttribMESA(d, modes[i], EGL_HEIGHT, &h);
             eglGetModeAttribMESA(d, modes[i], EGL_REFRESH_RATE_MESA, &r);
-            printf("0x%02x %5d  %5d  %.3f\n", id, w, h, r / 1000.0);
+            str = eglQueryModeStringMESA(d, modes[i]);
+            printf("0x%02x %5d  %5d   %.3f  %s\n", id, w, h, r / 1000.0, str);
          }
       }
    }
@@ -132,8 +147,8 @@ int
 main(int argc, char *argv[])
 {
    int maj, min;
-//   EGLDisplay d = eglGetDisplay(EGL_DEFAULT_DISPLAY);
-   EGLDisplay d = eglGetDisplay("!fb_dri");
+   //EGLDisplay d = eglGetDisplay((EGLNativeDisplayType)"!EGL_i915");
+   EGLDisplay d = eglGetDisplay((EGLNativeDisplayType)"!EGL_i915");
 
    if (!eglInitialize(d, &maj, &min)) {
       printf("eglinfo: eglInitialize failed\n");
@@ -143,14 +158,14 @@ main(int argc, char *argv[])
    printf("EGL API version: %d.%d\n", maj, min);
    printf("EGL vendor string: %s\n", eglQueryString(d, EGL_VENDOR));
    printf("EGL version string: %s\n", eglQueryString(d, EGL_VERSION));
+#ifdef EGL_VERSION_1_2
+   printf("EGL client APIs: %s\n", eglQueryString(d, EGL_CLIENT_APIS));
+#endif
    printf("EGL extensions string:\n");
    printf("    %s\n", eglQueryString(d, EGL_EXTENSIONS));
-   printf("\n");
 
    PrintConfigs(d);
 
-   printf("\n");
-
    PrintModes(d);
 
    eglTerminate(d);