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

Unified Diff: ui/gfx/ozone/dri/gbm_surface.h

Issue 132543002: Not for review. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebase Created 6 years, 10 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/gfx/ozone/dri/dri_wrapper.cc ('k') | ui/gfx/ozone/dri/gbm_surface.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/gfx/ozone/dri/gbm_surface.h
diff --git a/ui/gfx/ozone/dri/gbm_surface.h b/ui/gfx/ozone/dri/gbm_surface.h
new file mode 100644
index 0000000000000000000000000000000000000000..4c9e9220d6436e498d852f67be1c59ed6120d05d
--- /dev/null
+++ b/ui/gfx/ozone/dri/gbm_surface.h
@@ -0,0 +1,66 @@
+// Copyright 2013 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef UI_GFX_OZONE_DRI_GBM_SURFACE_H_
+#define UI_GFX_OZONE_DRI_GBM_SURFACE_H_
+
+#include "base/compiler_specific.h"
+#include "ui/gfx/ozone/dri/scanout_surface.h"
+
+struct gbm_bo;
+struct gbm_device;
+struct gbm_surface;
+
+namespace gfx {
+
+class HardwareDisplayController;
+
+// Implement the ScanoutSurface interface on top of GBM (Generic Buffer
+// Manager). GBM provides generic access to hardware accelerated surfaces which
+// can be used in association with EGL to provide accelerated drawing.
+class GbmSurface : public ScanoutSurface {
+ public:
+ GbmSurface(HardwareDisplayController* controller,
+ gbm_device* device);
+ virtual ~GbmSurface();
+
+ virtual bool Initialize() OVERRIDE;
+ virtual uint32_t GetFramebufferId() const OVERRIDE;
+
+ // If the |frontbuffer_| is a valid pointer, then we need to unlock it such
+ // that GBM can re-use the memory for future backbuffers. This is called from
+ // GbmSurfaceFactory when the page flip event is completed.
+ virtual void SwapBuffers() OVERRIDE;
+
+ // 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 GbmSurfaceFactory before
+ // scheduling a page flip.
+ void LockCurrentDrawable();
+
+ gbm_surface* get_native_surface() { return native_surface_; };
+
+ private:
+ HardwareDisplayController* controller_;
+
+ gbm_device* gbm_device_;
+
+ // The native GBM surface. In EGL this represents the EGLNativeWindowType.
+ gbm_surface* native_surface_;
+
+ // Backing GBM buffers. One is the current front buffer. The other is the
+ // current backbuffer that is pending scan out.
+ gbm_bo* buffers_[2];
+
+ // Index to the front buffer.
+ int front_buffer_;
+
+ DISALLOW_COPY_AND_ASSIGN(GbmSurface);
+};
+
+} // namespace gfx
+
+#endif // UI_GFX_OZONE_DRI_GBM_SURFACE_H_
« no previous file with comments | « ui/gfx/ozone/dri/dri_wrapper.cc ('k') | ui/gfx/ozone/dri/gbm_surface.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698