Commit 6b082cca authored by Ben Widawsky's avatar Ben Widawsky

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: 's avatarBen Widawsky <ben@bwidawsk.net>
Reviewed-by: 's avatarEmil Velikov <emil.velikov@collabora.com>
parent ad3855b4
......@@ -187,6 +187,11 @@ static int atomic_run(const struct gbm *gbm, const struct egl *egl)
eglSwapBuffers(egl->display, egl->surface);
bo = gbm_surface_lock_front_buffer(gbm->surface);
fb = drm_fb_get_from_bo(bo);
if (!fb) {
printf("Failed to get a new framebuffer BO\n");
return -1;
}
drm.kms_in_fence_fd = -1;
......@@ -235,6 +240,10 @@ static int atomic_run(const struct gbm *gbm, const struct egl *egl)
next_bo = gbm_surface_lock_front_buffer(gbm->surface);
fb = drm_fb_get_from_bo(next_bo);
if (!fb) {
printf("Failed to get a new framebuffer BO\n");
return -1;
}
/*
* Here you could also update drm plane layers if you want
......
......@@ -60,6 +60,10 @@ static int legacy_run(const struct gbm *gbm, const struct egl *egl)
eglSwapBuffers(egl->display, egl->surface);
bo = gbm_surface_lock_front_buffer(gbm->surface);
fb = drm_fb_get_from_bo(bo);
if (!fb) {
fprintf(stderr, "Failed to get a new framebuffer BO\n");
return -1;
}
/* set mode: */
ret = drmModeSetCrtc(drm.fd, drm.crtc_id, fb->fb_id, 0, 0,
......@@ -78,6 +82,10 @@ static int legacy_run(const struct gbm *gbm, const struct egl *egl)
eglSwapBuffers(egl->display, egl->surface);
next_bo = gbm_surface_lock_front_buffer(gbm->surface);
fb = drm_fb_get_from_bo(next_bo);
if (!fb) {
fprintf(stderr, "Failed to get a new framebuffer BO\n");
return -1;
}
/*
* Here you could also update drm plane layers if you want
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment