aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTomi Valkeinen2016-04-08 12:41:19 -0500
committerTomi Valkeinen2016-04-08 12:41:19 -0500
commitcddacb2bde317f675b769c02fcb19e92beee727a (patch)
tree921e41d3c0b498c70264483cd9b7db711e9b715b /kmscube
parentbef0109aa93971dd6cc6040661dc6494533e6bee (diff)
downloadexternal-libkmsxx-cddacb2bde317f675b769c02fcb19e92beee727a.tar.gz
external-libkmsxx-cddacb2bde317f675b769c02fcb19e92beee727a.tar.xz
external-libkmsxx-cddacb2bde317f675b769c02fcb19e92beee727a.zip
kmscube: separate swap_buffers
Diffstat (limited to 'kmscube')
-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
310 glClear(GL_COLOR_BUFFER_BIT); 310 glClear(GL_COLOR_BUFFER_BIT);
311 } 311 }
312 312
313 void swap_buffers()
314 {
315 eglSwapBuffers(gl.display(), esurface);
316 }
317
313 static void drm_fb_destroy_callback(struct gbm_bo *bo, void *data) 318 static void drm_fb_destroy_callback(struct gbm_bo *bo, void *data)
314 { 319 {
315 auto fb = reinterpret_cast<Framebuffer*>(data); 320 auto fb = reinterpret_cast<Framebuffer*>(data);
@@ -337,7 +342,6 @@ struct Surface
337 struct Framebuffer* lock_next() 342 struct Framebuffer* lock_next()
338 { 343 {
339 bo_prev = bo_next; 344 bo_prev = bo_next;
340 eglSwapBuffers(gl.display(), esurface);
341 bo_next = gbm_surface_lock_front_buffer(gsurface); 345 bo_next = gbm_surface_lock_front_buffer(gsurface);
342 FAIL_IF(!bo_next, "could not lock gbm buffer"); 346 FAIL_IF(!bo_next, "could not lock gbm buffer");
343 return drm_fb_get_from_bo(bo_next, card); 347 return drm_fb_get_from_bo(bo_next, card);
@@ -431,6 +435,7 @@ public:
431 435
432 m_surface->make_current(); 436 m_surface->make_current();
433 m_surface->clear(); 437 m_surface->clear();
438 m_surface->swap_buffers();
434 struct Framebuffer* fb = m_surface->lock_next(); 439 struct Framebuffer* fb = m_surface->lock_next();
435 440
436 struct Framebuffer* planefb = 0; 441 struct Framebuffer* planefb = 0;
@@ -438,6 +443,7 @@ public:
438 if (m_plane) { 443 if (m_plane) {
439 m_surface2->make_current(); 444 m_surface2->make_current();
440 m_surface2->clear(); 445 m_surface2->clear();
446 m_surface2->swap_buffers();
441 planefb = m_surface2->lock_next(); 447 planefb = m_surface2->lock_next();
442 } 448 }
443 449
@@ -502,6 +508,7 @@ private:
502 m_surface->make_current(); 508 m_surface->make_current();
503 m_surface->clear(); 509 m_surface->clear();
504 draw(m_frame_num * m_rotation_mult, *m_surface); 510 draw(m_frame_num * m_rotation_mult, *m_surface);
511 m_surface->swap_buffers();
505 struct Framebuffer* fb = m_surface->lock_next(); 512 struct Framebuffer* fb = m_surface->lock_next();
506 513
507 struct Framebuffer* planefb = 0; 514 struct Framebuffer* planefb = 0;
@@ -510,6 +517,7 @@ private:
510 m_surface2->make_current(); 517 m_surface2->make_current();
511 m_surface2->clear(); 518 m_surface2->clear();
512 draw(m_frame_num * m_rotation_mult * 2, *m_surface2); 519 draw(m_frame_num * m_rotation_mult * 2, *m_surface2);
520 m_surface2->swap_buffers();
513 planefb = m_surface2->lock_next(); 521 planefb = m_surface2->lock_next();
514 } 522 }
515 523