[Mesa-dev] [PATCH kmscube] drm-atomic: check for valid GBM BO

Lucas Stach l.stach at pengutronix.de
Tue May 2 14:39:34 UTC 2017


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 at pengutronix.de>
---
 drm-atomic.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/drm-atomic.c b/drm-atomic.c
index 0f3c4f285fb7..1b1cc633c1cb 100644
--- a/drm-atomic.c
+++ b/drm-atomic.c
@@ -187,6 +187,10 @@ 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);
+	if (!bo) {
+		printf("Failed to lock frontbuffer\n");
+		return -1;
+	}
 	fb = drm_fb_get_from_bo(bo);
 	if (!fb) {
 		printf("Failed to get a new framebuffer BO\n");
-- 
2.11.0



More information about the mesa-dev mailing list