summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLucas Stach <l.stach@pengutronix.de>2017-05-02 16:39:34 +0200
committerDaniel Stone <daniels@collabora.com>2017-05-02 19:08:30 +0100
commitac7e6c720873e36e3700f927073d528793bf6308 (patch)
tree02602bc7a1b076020b5e4a7c7d96d8887f48445d
parent83d33948c172ccef1ce5b91bf1ace21da8628973 (diff)
downloadkmscube-ac7e6c720873e36e3700f927073d528793bf6308.tar.gz
drm-atomic: check for valid GBM BO
With the modifier support it is possible to force a modifier which isn't compatible with any of the GPU targets. In that case the EGL platform will be unable to allocate the back buffers. Provide an error message in that case, instead of crashing. Signed-off-by: Lucas Stach <l.stach@pengutronix.de> Reviewed-by: Daniel Stone <daniels@collabora.com>
-rw-r--r--drm-atomic.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/drm-atomic.c b/drm-atomic.c
index 7219623..bd4f3a8 100644
--- a/drm-atomic.c
+++ b/drm-atomic.c
@@ -227,6 +227,10 @@ static int atomic_run(const struct gbm *gbm, const struct egl *egl)
assert(drm.kms_in_fence_fd != -1);
next_bo = gbm_surface_lock_front_buffer(gbm->surface);
+ if (!next_bo) {
+ printf("Failed to lock frontbuffer\n");
+ return -1;
+ }
fb = drm_fb_get_from_bo(next_bo);
if (!fb) {
printf("Failed to get a new framebuffer BO\n");