summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTomi Valkeinen <tomi.valkeinen@ti.com>2016-04-08 20:41:19 +0300
committerTomi Valkeinen <tomi.valkeinen@ti.com>2016-04-08 20:41:19 +0300
commitcddacb2bde317f675b769c02fcb19e92beee727a (patch)
tree921e41d3c0b498c70264483cd9b7db711e9b715b
parentbef0109aa93971dd6cc6040661dc6494533e6bee (diff)
kmscube: separate swap_buffers
-rw-r--r--kmscube/kmscube.cpp10
1 files changed, 9 insertions, 1 deletions
diff --git a/kmscube/kmscube.cpp b/kmscube/kmscube.cpp
index b6031c2..97b48df 100644
--- a/kmscube/kmscube.cpp
+++ b/kmscube/kmscube.cpp
@@ -310,6 +310,11 @@ struct Surface
glClear(GL_COLOR_BUFFER_BIT);
}
+ void swap_buffers()
+ {
+ eglSwapBuffers(gl.display(), esurface);
+ }
+
static void drm_fb_destroy_callback(struct gbm_bo *bo, void *data)
{
auto fb = reinterpret_cast<Framebuffer*>(data);
@@ -337,7 +342,6 @@ struct Surface
struct Framebuffer* lock_next()
{
bo_prev = bo_next;
- eglSwapBuffers(gl.display(), esurface);
bo_next = gbm_surface_lock_front_buffer(gsurface);
FAIL_IF(!bo_next, "could not lock gbm buffer");
return drm_fb_get_from_bo(bo_next, card);
@@ -431,6 +435,7 @@ public:
m_surface->make_current();
m_surface->clear();
+ m_surface->swap_buffers();
struct Framebuffer* fb = m_surface->lock_next();
struct Framebuffer* planefb = 0;
@@ -438,6 +443,7 @@ public:
if (m_plane) {
m_surface2->make_current();
m_surface2->clear();
+ m_surface2->swap_buffers();
planefb = m_surface2->lock_next();
}
@@ -502,6 +508,7 @@ private:
m_surface->make_current();
m_surface->clear();
draw(m_frame_num * m_rotation_mult, *m_surface);
+ m_surface->swap_buffers();
struct Framebuffer* fb = m_surface->lock_next();
struct Framebuffer* planefb = 0;
@@ -510,6 +517,7 @@ private:
m_surface2->make_current();
m_surface2->clear();
draw(m_frame_num * m_rotation_mult * 2, *m_surface2);
+ m_surface2->swap_buffers();
planefb = m_surface2->lock_next();
}