Skip to content

Commit 382ea68

Browse files
committed
only report error from gbm_surface_create_with_modifiers if gbm_surface_create fails too
1 parent 94e4540 commit 382ea68

File tree

1 file changed

+14
-5
lines changed

1 file changed

+14
-5
lines changed

src/egl_gbm_render_surface.c

Lines changed: 14 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -146,6 +146,7 @@ static int egl_gbm_render_surface_init(
146146
}
147147
#endif
148148

149+
int with_modifiers_errno;
149150
gbm_surface = NULL;
150151
if (allowed_modifiers != NULL) {
151152
gbm_surface = gbm_surface_create_with_modifiers(
@@ -157,11 +158,10 @@ static int egl_gbm_render_surface_init(
157158
n_allowed_modifiers
158159
);
159160
if (gbm_surface == NULL) {
160-
ok = errno;
161-
LOG_ERROR("Couldn't create GBM surface for rendering. gbm_surface_create_with_modifiers: %s\n", strerror(ok));
162-
LOG_ERROR("Will retry without modifiers\n");
161+
with_modifiers_errno = errno;
163162
}
164163
}
164+
165165
if (gbm_surface == NULL) {
166166
gbm_surface = gbm_surface_create(
167167
gbm_device,
@@ -171,8 +171,17 @@ static int egl_gbm_render_surface_init(
171171
GBM_BO_USE_RENDERING | GBM_BO_USE_SCANOUT
172172
);
173173
if (gbm_surface == NULL) {
174-
ok = errno;
175-
LOG_ERROR("Couldn't create GBM surface for rendering. gbm_surface_create: %s\n", strerror(ok));
174+
ok = errno ? errno : EIO;
175+
if (allowed_modifiers != NULL) {
176+
LOG_ERROR(
177+
"Couldn't create GBM surface for rendering. gbm_surface_create_with_modifiers: %s, gbm_surface_create: %s\n",
178+
strerror(with_modifiers_errno),
179+
strerror(ok)
180+
);
181+
} else {
182+
LOG_ERROR("Couldn't create GBM surface for rendering. gbm_surface_create: %s\n", strerror(ok));
183+
}
184+
176185
return ok;
177186
}
178187
}

0 commit comments

Comments
 (0)