drm: Provide a failure path when getting the fb
This is helpful for debugging as you will bail early with an error
message instead of a random SIGSEGV (or something more obscure).
Signed-off-by: Ben Widawsky <ben@bwidawsk.net>
Reviewed-by: Emil Velikov <emil.velikov@collabora.com>
Ben Widawsky
7 years ago
186 | 186 |
eglSwapBuffers(egl->display, egl->surface);
|
187 | 187 |
bo = gbm_surface_lock_front_buffer(gbm->surface);
|
188 | 188 |
fb = drm_fb_get_from_bo(bo);
|
|
189 |
if (!fb) {
|
|
190 |
printf("Failed to get a new framebuffer BO\n");
|
|
191 |
return -1;
|
|
192 |
}
|
|
193 |
|
189 | 194 |
|
190 | 195 |
drm.kms_in_fence_fd = -1;
|
191 | 196 |
|
|
234 | 239 |
|
235 | 240 |
next_bo = gbm_surface_lock_front_buffer(gbm->surface);
|
236 | 241 |
fb = drm_fb_get_from_bo(next_bo);
|
|
242 |
if (!fb) {
|
|
243 |
printf("Failed to get a new framebuffer BO\n");
|
|
244 |
return -1;
|
|
245 |
}
|
237 | 246 |
|
238 | 247 |
/*
|
239 | 248 |
* Here you could also update drm plane layers if you want
|
59 | 59 |
eglSwapBuffers(egl->display, egl->surface);
|
60 | 60 |
bo = gbm_surface_lock_front_buffer(gbm->surface);
|
61 | 61 |
fb = drm_fb_get_from_bo(bo);
|
|
62 |
if (!fb) {
|
|
63 |
fprintf(stderr, "Failed to get a new framebuffer BO\n");
|
|
64 |
return -1;
|
|
65 |
}
|
62 | 66 |
|
63 | 67 |
/* set mode: */
|
64 | 68 |
ret = drmModeSetCrtc(drm.fd, drm.crtc_id, fb->fb_id, 0, 0,
|
|
77 | 81 |
eglSwapBuffers(egl->display, egl->surface);
|
78 | 82 |
next_bo = gbm_surface_lock_front_buffer(gbm->surface);
|
79 | 83 |
fb = drm_fb_get_from_bo(next_bo);
|
|
84 |
if (!fb) {
|
|
85 |
fprintf(stderr, "Failed to get a new framebuffer BO\n");
|
|
86 |
return -1;
|
|
87 |
}
|
80 | 88 |
|
81 | 89 |
/*
|
82 | 90 |
* Here you could also update drm plane layers if you want
|