gl-renderer: prefer the base EGLConfig
If configless_context is not supported, we pick one EGLConfig as the "base config" because we have just one GL context and different configs between the context and EGLSurfaces might not work. Until now, we did not actually make sure to pick the base config. If the base config matches the requirements, prefer it. Only if it doesn't match, go looking for another config. This should give better chances of success on systems where configless_context is not supported by relying less on eglChooseConfig(). Cc: Madhurkiran Harikrishnan <madhurkiran.harikrishnan@xilinx.com> Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
This commit is contained in:
parent
88e5fcb55a
commit
7ba4c515a3
@ -185,6 +185,32 @@ out:
|
||||
return 0;
|
||||
}
|
||||
|
||||
static bool
|
||||
egl_config_is_compatible(struct gl_renderer *gr,
|
||||
EGLConfig config,
|
||||
EGLint egl_surface_type,
|
||||
const struct pixel_format_info *const *pinfo,
|
||||
unsigned pinfo_count)
|
||||
{
|
||||
EGLint value;
|
||||
unsigned i;
|
||||
|
||||
if (config == EGL_NO_CONFIG_KHR)
|
||||
return false;
|
||||
|
||||
if (!eglGetConfigAttrib(gr->egl_display, config,
|
||||
EGL_SURFACE_TYPE, &value))
|
||||
return false;
|
||||
if ((value & egl_surface_type) != egl_surface_type)
|
||||
return false;
|
||||
|
||||
for (i = 0; i < pinfo_count; i++) {
|
||||
if (egl_config_pixel_format_matches(gr, config, pinfo[i]))
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
EGLConfig
|
||||
gl_renderer_get_egl_config(struct gl_renderer *gr,
|
||||
EGLint egl_surface_type,
|
||||
@ -217,6 +243,10 @@ gl_renderer_get_egl_config(struct gl_renderer *gr,
|
||||
pinfo_count++;
|
||||
}
|
||||
|
||||
if (egl_config_is_compatible(gr, gr->egl_config, egl_surface_type,
|
||||
pinfo, pinfo_count))
|
||||
return gr->egl_config;
|
||||
|
||||
if (egl_choose_config(gr, config_attribs, pinfo, pinfo_count,
|
||||
&egl_config) < 0) {
|
||||
weston_log("No EGLConfig matches.\n");
|
||||
|
Loading…
Reference in New Issue
Block a user