kmscube: check for free bufs
authorTomi Valkeinen <tomi.valkeinen@ti.com>
Mon, 11 Apr 2016 09:11:14 +0000 (12:11 +0300)
committerTomi Valkeinen <tomi.valkeinen@ti.com>
Mon, 11 Apr 2016 09:11:14 +0000 (12:11 +0300)
kmscube/kmscube.cpp

index 49592ecc756509934f0d7a66b45c26cf760e7ba5..2b01b6b4368a3c54db159a8a9f00ef3409f5049f 100644 (file)
@@ -91,6 +91,11 @@ public:
        GbmSurface(const GbmSurface& other) = delete;
        GbmSurface& operator=(const GbmSurface& other) = delete;
 
+       bool has_free()
+       {
+               return gbm_surface_has_free_buffers(m_surface);
+       }
+
        gbm_bo* lock_front_buffer()
        {
                return gbm_surface_lock_front_buffer(m_surface);
@@ -381,6 +386,8 @@ public:
 
        void make_current()
        {
+               FAIL_IF(!gsurface->has_free(), "No free buffers");
+
                eglMakeCurrent(egl.display(), esurface, esurface, egl.context());
        }