comparison libvo/gl_common.c @ 36210:6e2e30ee31d0

Add support for printing available egl configs. In contrast to glxinfo, the es2_info too is too half-assed to print this info, so it is easiest to just include it here.
author reimar
date Sun, 09 Jun 2013 09:16:11 +0000
parents 236179a10ee9
children 40a06b268bb6
comparison
equal deleted inserted replaced
36209:236179a10ee9 36210:6e2e30ee31d0
2427 static const EGLint cfg_attribs[] = { EGL_RENDERABLE_TYPE, EGL_OPENGL_ES2_BIT, EGL_NONE }; 2427 static const EGLint cfg_attribs[] = { EGL_RENDERABLE_TYPE, EGL_OPENGL_ES2_BIT, EGL_NONE };
2428 static const EGLint ctx_attribs[] = { EGL_CONTEXT_CLIENT_VERSION, 2, EGL_NONE }; 2428 static const EGLint ctx_attribs[] = { EGL_CONTEXT_CLIENT_VERSION, 2, EGL_NONE };
2429 EGLContext *context = &ctx->context.egl; 2429 EGLContext *context = &ctx->context.egl;
2430 EGLContext new_context = NULL; 2430 EGLContext new_context = NULL;
2431 EGLConfig eglConfig; 2431 EGLConfig eglConfig;
2432 EGLint id;
2432 int num_configs; 2433 int num_configs;
2433 #ifdef CONFIG_GL_EGL_ANDROID 2434 #ifdef CONFIG_GL_EGL_ANDROID
2434 EGLint w, h; 2435 EGLint w, h;
2435 if (vo_window) { 2436 if (vo_window) {
2436 eglQuerySurface(eglDisplay, eglSurface, EGL_WIDTH, &w); 2437 eglQuerySurface(eglDisplay, eglSurface, EGL_WIDTH, &w);
2469 if (*context != EGL_NO_CONTEXT) { 2470 if (*context != EGL_NO_CONTEXT) {
2470 eglMakeCurrent(eglDisplay, EGL_NO_SURFACE, EGL_NO_SURFACE, EGL_NO_CONTEXT); 2471 eglMakeCurrent(eglDisplay, EGL_NO_SURFACE, EGL_NO_SURFACE, EGL_NO_CONTEXT);
2471 eglDestroyContext(eglDisplay, *context); 2472 eglDestroyContext(eglDisplay, *context);
2472 eglDestroySurface(eglDisplay, eglSurface); 2473 eglDestroySurface(eglDisplay, eglSurface);
2473 } 2474 }
2475 if (mp_msg_test(MSGT_VO, MSGL_DBG2)) {
2476 EGLConfig *configs;
2477 EGLint count = 0, i;
2478 eglGetConfigs(eglDisplay, NULL, 0, &count);
2479 configs = calloc(count, sizeof(*configs));
2480 eglGetConfigs(eglDisplay, configs, count, &count);
2481 mp_msg(MSGT_VO, MSGL_V, " ID | sizes | gl |es2| samples | caveat\n"
2482 " r g b a d s | es| vg | surfaces |\n");
2483 for (i = 0; i < count; i++) {
2484 EGLint rs, gs, bs, as, ds, ss, samples, surfaces, renderable, caveat;
2485 const char *caveatstr = "unknown";
2486 eglGetConfigAttrib(eglDisplay, configs[i], EGL_CONFIG_ID, &id);
2487 eglGetConfigAttrib(eglDisplay, configs[i], EGL_RED_SIZE, &rs);
2488 eglGetConfigAttrib(eglDisplay, configs[i], EGL_GREEN_SIZE, &gs);
2489 eglGetConfigAttrib(eglDisplay, configs[i], EGL_BLUE_SIZE, &bs);
2490 eglGetConfigAttrib(eglDisplay, configs[i], EGL_ALPHA_SIZE, &as);
2491 eglGetConfigAttrib(eglDisplay, configs[i], EGL_DEPTH_SIZE, &ds);
2492 eglGetConfigAttrib(eglDisplay, configs[i], EGL_STENCIL_SIZE, &ss);
2493 eglGetConfigAttrib(eglDisplay, configs[i], EGL_SAMPLES, &samples);
2494 eglGetConfigAttrib(eglDisplay, configs[i], EGL_SURFACE_TYPE, &surfaces);
2495 eglGetConfigAttrib(eglDisplay, configs[i], EGL_RENDERABLE_TYPE, &renderable);
2496 eglGetConfigAttrib(eglDisplay, configs[i], EGL_CONFIG_CAVEAT, &caveat);
2497 switch (caveat) {
2498 case EGL_SLOW_CONFIG: caveatstr = "slow"; break;
2499 case EGL_NON_CONFORMANT_CONFIG: caveatstr = "nonconf"; break;
2500 case EGL_NONE: caveatstr = "none"; break;
2501 }
2502 mp_msg(MSGT_VO, MSGL_V, "0x%03x %2i %2i %2i %2i %2i %2i %c %c %c %c %2i 0x%03x %s (0x%x)\n",
2503 id, rs, gs, bs, as, ds, ss,
2504 renderable & EGL_OPENGL_BIT ? '+' : '-',
2505 renderable & EGL_OPENGL_ES_BIT ? '+' : '-',
2506 renderable & EGL_OPENGL_ES2_BIT ? '+' : '-',
2507 renderable & EGL_OPENVG_BIT ? '+' : '-',
2508 samples, surfaces, caveatstr, caveat);
2509 }
2510 free(configs);
2511 }
2474 if (!eglChooseConfig(eglDisplay, cfg_attribs, &eglConfig, 1, &num_configs) || 2512 if (!eglChooseConfig(eglDisplay, cfg_attribs, &eglConfig, 1, &num_configs) ||
2475 num_configs != 1) 2513 num_configs != 1)
2476 return SET_WINDOW_FAILED; 2514 return SET_WINDOW_FAILED;
2515 eglGetConfigAttrib(eglDisplay, eglConfig, EGL_CONFIG_ID, &id);
2516 mp_msg(MSGT_VO, MSGL_V, "Chosen config %x\n", id);
2477 eglSurface = eglCreateWindowSurface(eglDisplay, eglConfig, vo_window, NULL); 2517 eglSurface = eglCreateWindowSurface(eglDisplay, eglConfig, vo_window, NULL);
2478 if (eglSurface == EGL_NO_SURFACE) 2518 if (eglSurface == EGL_NO_SURFACE)
2479 return SET_WINDOW_FAILED; 2519 return SET_WINDOW_FAILED;
2480 2520
2481 new_context = eglCreateContext(eglDisplay, eglConfig, EGL_NO_CONTEXT, ctx_attribs); 2521 new_context = eglCreateContext(eglDisplay, eglConfig, EGL_NO_CONTEXT, ctx_attribs);