gl-renderer: do not even pick a config with configless_context
If configless context is supported, we can skip choosing the "base" config completely as it will never be used. This simplifies the code a little bit. Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
This commit is contained in:
@@ -198,8 +198,7 @@ gl_renderer_get_egl_config(struct gl_renderer *gr,
|
|||||||
* everything.
|
* everything.
|
||||||
*/
|
*/
|
||||||
if (gr->egl_config != EGL_NO_CONFIG_KHR &&
|
if (gr->egl_config != EGL_NO_CONFIG_KHR &&
|
||||||
egl_config != gr->egl_config &&
|
egl_config != gr->egl_config) {
|
||||||
!gr->has_configless_context) {
|
|
||||||
weston_log("Found an EGLConfig but it is not usable because "
|
weston_log("Found an EGLConfig but it is not usable because "
|
||||||
"neither EGL_KHR_no_config_context nor "
|
"neither EGL_KHR_no_config_context nor "
|
||||||
"EGL_MESA_configless_context are supported by EGL.\n");
|
"EGL_MESA_configless_context are supported by EGL.\n");
|
||||||
|
|||||||
@@ -3454,19 +3454,21 @@ gl_renderer_display_create(struct weston_compositor *ec,
|
|||||||
|
|
||||||
log_egl_info(gr->egl_display);
|
log_egl_info(gr->egl_display);
|
||||||
|
|
||||||
gr->egl_config = gl_renderer_get_egl_config(gr, config_attribs,
|
|
||||||
drm_formats,
|
|
||||||
drm_formats_count);
|
|
||||||
if (gr->egl_config == EGL_NO_CONFIG_KHR) {
|
|
||||||
weston_log("failed to choose EGL config\n");
|
|
||||||
goto fail_terminate;
|
|
||||||
}
|
|
||||||
|
|
||||||
ec->renderer = &gr->base;
|
ec->renderer = &gr->base;
|
||||||
|
|
||||||
if (gl_renderer_setup_egl_extensions(ec) < 0)
|
if (gl_renderer_setup_egl_extensions(ec) < 0)
|
||||||
goto fail_with_error;
|
goto fail_with_error;
|
||||||
|
|
||||||
|
if (!gr->has_configless_context) {
|
||||||
|
gr->egl_config = gl_renderer_get_egl_config(gr, config_attribs,
|
||||||
|
drm_formats,
|
||||||
|
drm_formats_count);
|
||||||
|
if (gr->egl_config == EGL_NO_CONFIG_KHR) {
|
||||||
|
weston_log("failed to choose EGL config\n");
|
||||||
|
goto fail_terminate;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
ec->capabilities |= WESTON_CAP_ROTATION_ANY;
|
ec->capabilities |= WESTON_CAP_ROTATION_ANY;
|
||||||
ec->capabilities |= WESTON_CAP_CAPTURE_YFLIP;
|
ec->capabilities |= WESTON_CAP_CAPTURE_YFLIP;
|
||||||
ec->capabilities |= WESTON_CAP_VIEW_CLIP_MASK;
|
ec->capabilities |= WESTON_CAP_VIEW_CLIP_MASK;
|
||||||
@@ -3610,7 +3612,6 @@ gl_renderer_setup(struct weston_compositor *ec, EGLSurface egl_surface)
|
|||||||
{
|
{
|
||||||
struct gl_renderer *gr = get_renderer(ec);
|
struct gl_renderer *gr = get_renderer(ec);
|
||||||
const char *extensions;
|
const char *extensions;
|
||||||
EGLConfig context_config;
|
|
||||||
EGLBoolean ret;
|
EGLBoolean ret;
|
||||||
|
|
||||||
EGLint context_attribs[16] = {
|
EGLint context_attribs[16] = {
|
||||||
@@ -3639,20 +3640,15 @@ gl_renderer_setup(struct weston_compositor *ec, EGLSurface egl_surface)
|
|||||||
assert(nattr < ARRAY_LENGTH(context_attribs));
|
assert(nattr < ARRAY_LENGTH(context_attribs));
|
||||||
context_attribs[nattr] = EGL_NONE;
|
context_attribs[nattr] = EGL_NONE;
|
||||||
|
|
||||||
context_config = gr->egl_config;
|
|
||||||
|
|
||||||
if (gr->has_configless_context)
|
|
||||||
context_config = EGL_NO_CONFIG_KHR;
|
|
||||||
|
|
||||||
/* try to create an OpenGLES 3 context first */
|
/* try to create an OpenGLES 3 context first */
|
||||||
context_attribs[1] = 3;
|
context_attribs[1] = 3;
|
||||||
gr->egl_context = eglCreateContext(gr->egl_display, context_config,
|
gr->egl_context = eglCreateContext(gr->egl_display, gr->egl_config,
|
||||||
EGL_NO_CONTEXT, context_attribs);
|
EGL_NO_CONTEXT, context_attribs);
|
||||||
if (gr->egl_context == NULL) {
|
if (gr->egl_context == NULL) {
|
||||||
/* and then fallback to OpenGLES 2 */
|
/* and then fallback to OpenGLES 2 */
|
||||||
context_attribs[1] = 2;
|
context_attribs[1] = 2;
|
||||||
gr->egl_context = eglCreateContext(gr->egl_display,
|
gr->egl_context = eglCreateContext(gr->egl_display,
|
||||||
context_config,
|
gr->egl_config,
|
||||||
EGL_NO_CONTEXT,
|
EGL_NO_CONTEXT,
|
||||||
context_attribs);
|
context_attribs);
|
||||||
if (gr->egl_context == NULL) {
|
if (gr->egl_context == NULL) {
|
||||||
|
|||||||
Reference in New Issue
Block a user