kdrive/fbdev: simplify fbdev_glamor_egl_chose_configs

Now that we're first trying no-config contexts,
there is no need to inject an `EGL_NO_CONFIG_KHR`
as the first config in the returned list

Signed-off-by: stefan11111 <stefan11111@shitposting.expert>
This commit is contained in:
stefan11111
2026-01-29 03:28:37 +02:00
committed by Enrico Weigelt
parent 446485991d
commit 4a9da08a99

View File

@@ -435,26 +435,21 @@ fbdev_glamor_egl_chose_configs(EGLDisplay display, const EGLint *attrib_list,
*configs = NULL;
*num_configs = 0;
if (!eglChooseConfig(display, attrib_list, NULL, 0, &max_configs)) {
if (!eglChooseConfig(display, attrib_list, NULL, 0, &max_configs) || max_configs == 0) {
return;
}
*configs = calloc(max_configs + 1, sizeof(EGLConfig));
*configs = calloc(max_configs, sizeof(EGLConfig));
if (*configs == NULL) {
return;
}
(*configs)[0] = EGL_NO_CONFIG_KHR;
if (!eglChooseConfig(display, attrib_list, &(*configs)[1], max_configs, num_configs) || *num_configs == 0) {
if (!eglChooseConfig(display, attrib_list, *configs, max_configs, num_configs) || *num_configs == 0) {
free(*configs);
*configs = NULL;
*num_configs = 0;
}
(*num_configs)++;
max_configs++;
if (*num_configs < max_configs) {
/* Shouldn't happen */
void *tmp = realloc(*configs, *num_configs * sizeof(EGLConfig));
@@ -499,7 +494,7 @@ fbdev_glamor_egl_try_big_gl_api(FbdevScrPriv *scrpriv)
/* Try creating a no-config context, maybe we can skip all the config stuff */
scrpriv->ctx = fbdev_glamor_egl_create_context(scrpriv->display,
NULL, 1,
NULL, 0,
ctx_attrib_lists,
ARR_SIZE(ctx_attrib_lists));
if (scrpriv->ctx == EGL_NO_CONTEXT) {
@@ -564,7 +559,7 @@ fbdev_glamor_egl_try_gles_api(FbdevScrPriv *scrpriv)
/* Try creating a no-config context, maybe we can skip all the config stuff */
scrpriv->ctx = fbdev_glamor_egl_create_context(scrpriv->display,
NULL, 1,
NULL, 0,
ctx_attrib_lists,
ARR_SIZE(ctx_attrib_lists));