summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorJean-Philippe Andre <jp.andre@samsung.com>2015-12-11 11:32:06 +0900
committerJean-Philippe Andre <jp.andre@samsung.com>2015-12-11 11:47:45 +0900
commitce21e513d5a86dbcf3ff4f72c131c763d67a04ec (patch)
tree78be4848c4dd93219588ef968c3f6e5e49430a29 /src
parent44260b69e263407cc66ed9ccb9de1a502b9f7cbb (diff)
Evas GL: Avoid confusing ERR message when requesting depth & stencil
An ERR message would be printed out mentionning that direct rendering won't work on this window, even if DR was not requested. Also, set the DR-specific flags only if DR is enabled. See T2936.
Diffstat (limited to 'src')
-rw-r--r--src/modules/evas/engines/gl_common/evas_gl_core.c108
1 files changed, 59 insertions, 49 deletions
diff --git a/src/modules/evas/engines/gl_common/evas_gl_core.c b/src/modules/evas/engines/gl_common/evas_gl_core.c
index 633f54a71a..2059957780 100644
--- a/src/modules/evas/engines/gl_common/evas_gl_core.c
+++ b/src/modules/evas/engines/gl_common/evas_gl_core.c
@@ -1330,7 +1330,6 @@ _internal_config_set(void *eng_data, EVGL_Surface *sfc, Evas_GL_Config *cfg)
1330 int color_bit = 0, depth_bit = 0, stencil_bit = 0, msaa_samples = 0; 1330 int color_bit = 0, depth_bit = 0, stencil_bit = 0, msaa_samples = 0;
1331 int depth_size = 0; 1331 int depth_size = 0;
1332 int native_win_depth = 0, native_win_stencil = 0, native_win_msaa = 0; 1332 int native_win_depth = 0, native_win_stencil = 0, native_win_msaa = 0;
1333 Eina_Bool support_win_cfg = 1;
1334 1333
1335 // Check if engine is valid 1334 // Check if engine is valid
1336 if (!evgl_engine) 1335 if (!evgl_engine)
@@ -1384,58 +1383,69 @@ try_again:
1384 sfc->msaa_samples = evgl_engine->caps.fbo_fmts[i].samples; 1383 sfc->msaa_samples = evgl_engine->caps.fbo_fmts[i].samples;
1385 1384
1386 // Direct Rendering Option 1385 // Direct Rendering Option
1387 if (evgl_engine->funcs->native_win_surface_config_get) 1386 if (cfg->options_bits & EVAS_GL_OPTIONS_DIRECT)
1388 evgl_engine->funcs->native_win_surface_config_get(eng_data, &native_win_depth, &native_win_stencil, &native_win_msaa);
1389 if ((native_win_depth >= depth_size)
1390 && (native_win_stencil >= stencil_bit)
1391 && (native_win_msaa >= msaa_samples))
1392 { 1387 {
1393 DBG("Win cfg can support the Req Evas GL's config successfully"); 1388 Eina_Bool support_win_cfg = EINA_FALSE;
1394 support_win_cfg = EINA_TRUE;
1395 }
1396 else
1397 {
1398 ERR("Win cfg can't support Evas GL DR, win: [depth %d, stencil %d, msaa %d] "
1399 "want: [depth %d, stencil %d, msaa %d]",
1400 native_win_depth, native_win_stencil, native_win_msaa,
1401 depth_size, stencil_bit, msaa_samples);
1402 support_win_cfg = EINA_FALSE;
1403 }
1404 1389
1405 if ((sfc->direct_override) || support_win_cfg) 1390 if (evgl_engine->funcs->native_win_surface_config_get)
1406 sfc->direct_fb_opt = !!(cfg->options_bits & EVAS_GL_OPTIONS_DIRECT); 1391 evgl_engine->funcs->native_win_surface_config_get(eng_data, &native_win_depth, &native_win_stencil, &native_win_msaa);
1407 else if (cfg->options_bits & EVAS_GL_OPTIONS_DIRECT) 1392 if ((native_win_depth >= depth_size)
1408 { 1393 && (native_win_stencil >= stencil_bit)
1409 const char *s1[] = { "", ":depth8", ":depth16", ":depth24", ":depth32" }; 1394 && (native_win_msaa >= msaa_samples))
1410 const char *s2[] = { "", ":stencil1", ":stencil2", ":stencil4", ":stencil8", ":stencil16" }; 1395 {
1411 const char *s3[] = { "", ":msaa_low", ":msaa_mid", ":msaa_high" }; 1396 DBG("Win cfg can support the Req Evas GL's config successfully");
1412 INF("Can not enable direct rendering with depth %d, stencil %d " 1397 support_win_cfg = EINA_TRUE;
1413 "and MSAA %d. When using Elementary GLView, try to call " 1398 }
1414 "elm_config_accel_preference_set(\"opengl%s%s%s\") before " 1399 else
1415 "creating any window.", 1400 {
1416 depth_size, stencil_bit, msaa_samples, 1401 ERR("Win config can't support Evas GL direct rendering, "
1417 s1[cfg->depth_bits], s2[cfg->stencil_bits], s3[cfg->multisample_bits]); 1402 "win: [depth %d, stencil %d, msaa %d] "
1418 } 1403 "want: [depth %d, stencil %d, msaa %d]. %s",
1404 native_win_depth, native_win_stencil, native_win_msaa,
1405 depth_size, stencil_bit, msaa_samples,
1406 sfc->direct_override ?
1407 "Forcing direct rendering anyway." :
1408 "Falling back to indirect rendering (FBO).");
1409 support_win_cfg = EINA_FALSE;
1410 }
1419 1411
1420 // When direct rendering is enabled, FBO configuration should match 1412 if (sfc->direct_override || support_win_cfg)
1421 // window surface configuration as FBO will be used in fallback cases. 1413 {
1422 // So we search again for the formats that match window surface's. 1414 sfc->direct_fb_opt = EINA_TRUE;
1423 if (sfc->direct_fb_opt &&
1424 ((native_win_depth != depth_size) ||
1425 (native_win_stencil != stencil_bit) ||
1426 (native_win_msaa != msaa_samples)))
1427 {
1428 if (native_win_depth < 8) depth_bit = 0;
1429 else depth_bit = (1 << ((native_win_depth / 8) - 1));
1430 depth_size = native_win_depth;
1431 stencil_bit = native_win_stencil;
1432 msaa_samples = native_win_msaa;
1433 goto try_again;
1434 }
1435 1415
1436 // Extra flags for direct rendering 1416 // Extra flags for direct rendering
1437 sfc->client_side_rotation = !!(cfg->options_bits & EVAS_GL_OPTIONS_CLIENT_SIDE_ROTATION); 1417 sfc->client_side_rotation = !!(cfg->options_bits & EVAS_GL_OPTIONS_CLIENT_SIDE_ROTATION);
1438 sfc->alpha = (cfg->color_format == EVAS_GL_RGBA_8888); 1418 sfc->alpha = (cfg->color_format == EVAS_GL_RGBA_8888);
1419 }
1420 else
1421 {
1422 const char *s1[] = { "", ":depth8", ":depth16", ":depth24", ":depth32" };
1423 const char *s2[] = { "", ":stencil1", ":stencil2", ":stencil4", ":stencil8", ":stencil16" };
1424 const char *s3[] = { "", ":msaa_low", ":msaa_mid", ":msaa_high" };
1425 INF("Can not enable direct rendering with depth %d, stencil %d "
1426 "and MSAA %d. When using Elementary GLView, try to call "
1427 "elm_config_accel_preference_set(\"opengl%s%s%s\") before "
1428 "creating any window.",
1429 depth_size, stencil_bit, msaa_samples,
1430 s1[cfg->depth_bits], s2[cfg->stencil_bits], s3[cfg->multisample_bits]);
1431 }
1432
1433 // When direct rendering is enabled, FBO configuration should match
1434 // window surface configuration as FBO will be used in fallback cases.
1435 // So we search again for the formats that match window surface's.
1436 if (sfc->direct_fb_opt &&
1437 ((native_win_depth != depth_size) ||
1438 (native_win_stencil != stencil_bit) ||
1439 (native_win_msaa != msaa_samples)))
1440 {
1441 if (native_win_depth < 8) depth_bit = 0;
1442 else depth_bit = (1 << ((native_win_depth / 8) - 1));
1443 depth_size = native_win_depth;
1444 stencil_bit = native_win_stencil;
1445 msaa_samples = native_win_msaa;
1446 goto try_again;
1447 }
1448 }
1439 1449
1440 cfg_index = i; 1450 cfg_index = i;
1441 break; 1451 break;