summaryrefslogtreecommitdiff
path: root/drm-legacy.c
diff options
context:
space:
mode:
authorBen Widawsky <ben@bwidawsk.net>2016-11-05 14:46:04 -0700
committerBen Widawsky <ben@bwidawsk.net>2017-04-14 14:13:44 -0700
commit6b082cca5fd2b0194ecd12140f7fa51838f9ab8d (patch)
tree598fd71d75fffbde6f4adbae13d4b960af0a33cc /drm-legacy.c
parentad3855b4605e781def437eb790f4dd350f2a5be2 (diff)
downloadkmscube-6b082cca5fd2b0194ecd12140f7fa51838f9ab8d.tar.gz
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>
Diffstat (limited to 'drm-legacy.c')
-rw-r--r--drm-legacy.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/drm-legacy.c b/drm-legacy.c
index 3b407f8..a0b419a 100644
--- a/drm-legacy.c
+++ b/drm-legacy.c
@@ -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