Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(748)

Unified Diff: ui/ozone/platform/dri/gbm_surface.cc

Issue 371813004: ozone: gbm: Add overlay support (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: fix test build Created 6 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « ui/ozone/platform/dri/gbm_surface.h ('k') | ui/ozone/platform/dri/gbm_surface_factory.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/ozone/platform/dri/gbm_surface.cc
diff --git a/ui/ozone/platform/dri/gbm_surface.cc b/ui/ozone/platform/dri/gbm_surface.cc
index 99f0ae7016f9cafc6b49c4fc2605b804337dd009..aae27507953e39fcba8d0f309928fa6bfad27e9e 100644
--- a/ui/ozone/platform/dri/gbm_surface.cc
+++ b/ui/ozone/platform/dri/gbm_surface.cc
@@ -81,20 +81,13 @@ gfx::Size GbmSurface::Size() const {
return size_;
}
-void GbmSurface::SwapBuffers() {
- // If there was a frontbuffer, is no longer active. Release it back to GBM.
- if (buffers_[front_buffer_])
- gbm_surface_release_buffer(native_surface_, buffers_[front_buffer_]);
-
- // Update the index to the frontbuffer.
- front_buffer_ ^= 1;
- // We've just released it. Since GBM doesn't guarantee we'll get the same
- // buffer back, we set it to NULL so we don't keep track of objects that may
- // have been destroyed.
- buffers_[front_buffer_ ^ 1] = NULL;
-}
-
-void GbmSurface::LockCurrentDrawable() {
+// Before scheduling the backbuffer to be scanned out we need to "lock" it.
+// When we lock it, GBM will give a pointer to a buffer representing the
+// backbuffer. It will also update its information on which buffers can not be
+// used for drawing. The buffer will be released when the page flip event
+// occurs (see SwapBuffers). This is called from HardwareDisplayController
+// before scheduling a page flip.
+void GbmSurface::PreSwapBuffers() {
CHECK(native_surface_);
// Lock the buffer we want to display.
buffers_[front_buffer_ ^ 1] = gbm_surface_lock_front_buffer(native_surface_);
@@ -109,4 +102,17 @@ void GbmSurface::LockCurrentDrawable() {
}
}
+void GbmSurface::SwapBuffers() {
+ // If there was a frontbuffer, is no longer active. Release it back to GBM.
+ if (buffers_[front_buffer_])
+ gbm_surface_release_buffer(native_surface_, buffers_[front_buffer_]);
+
+ // Update the index to the frontbuffer.
+ front_buffer_ ^= 1;
+ // We've just released it. Since GBM doesn't guarantee we'll get the same
+ // buffer back, we set it to NULL so we don't keep track of objects that may
+ // have been destroyed.
+ buffers_[front_buffer_ ^ 1] = NULL;
+}
+
} // namespace ui
« no previous file with comments | « ui/ozone/platform/dri/gbm_surface.h ('k') | ui/ozone/platform/dri/gbm_surface_factory.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698