Codebase list kmscube / 6b082cc
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
2 changed file(s) with 17 addition(s) and 0 deletion(s). Raw diff Collapse all Expand all
186186 eglSwapBuffers(egl->display, egl->surface);
187187 bo = gbm_surface_lock_front_buffer(gbm->surface);
188188 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
189194
190195 drm.kms_in_fence_fd = -1;
191196
234239
235240 next_bo = gbm_surface_lock_front_buffer(gbm->surface);
236241 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 }
237246
238247 /*
239248 * Here you could also update drm plane layers if you want
5959 eglSwapBuffers(egl->display, egl->surface);
6060 bo = gbm_surface_lock_front_buffer(gbm->surface);
6161 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 }
6266
6367 /* set mode: */
6468 ret = drmModeSetCrtc(drm.fd, drm.crtc_id, fb->fb_id, 0, 0,
7781 eglSwapBuffers(egl->display, egl->surface);
7882 next_bo = gbm_surface_lock_front_buffer(gbm->surface);
7983 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 }
8088
8189 /*
8290 * Here you could also update drm plane layers if you want