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

Side by Side Diff: ui/ozone/platform/dri/gbm_surface.h

Issue 106633002: GBM Ozone implementation (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: . Created 6 years, 6 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « ui/ozone/platform/dri/gbm.gypi ('k') | ui/ozone/platform/dri/gbm_surface.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #ifndef UI_OZONE_PLATFORM_DRI_GBM_SURFACE_H_
6 #define UI_OZONE_PLATFORM_DRI_GBM_SURFACE_H_
7
8 #include "base/macros.h"
9 #include "base/memory/scoped_ptr.h"
10 #include "ui/gfx/geometry/size.h"
11 #include "ui/ozone/platform/dri/scanout_surface.h"
12
13 struct gbm_bo;
14 struct gbm_device;
15 struct gbm_surface;
16
17 namespace ui {
18
19 class DriBuffer;
20 class DriWrapper;
21
22 // Implement the ScanoutSurface interface on top of GBM (Generic Buffer
23 // Manager). GBM provides generic access to hardware accelerated surfaces which
24 // can be used in association with EGL to provide accelerated drawing.
25 class GbmSurface : public ScanoutSurface {
26 public:
27 GbmSurface(gbm_device* device, DriWrapper* dri, const gfx::Size& size);
28 virtual ~GbmSurface();
29
30 // ScanoutSurface:
31 virtual bool Initialize() OVERRIDE;
32 virtual uint32_t GetFramebufferId() const OVERRIDE;
33 virtual uint32_t GetHandle() const OVERRIDE;
34 virtual gfx::Size Size() const OVERRIDE;
35 virtual void SwapBuffers() OVERRIDE;
36
37 // Before scheduling the backbuffer to be scanned out we need to "lock" it.
38 // When we lock it, GBM will give a pointer to a buffer representing the
39 // backbuffer. It will also update its information on which buffers can not be
40 // used for drawing. The buffer will be released when the page flip event
41 // occurs (see SwapBuffers). This is called from GbmSurfaceFactory before
42 // scheduling a page flip.
43 void LockCurrentDrawable();
44
45 gbm_surface* native_surface() { return native_surface_; };
46
47 private:
48 gbm_device* gbm_device_;
49
50 DriWrapper* dri_;
51
52 gfx::Size size_;
53
54 // The native GBM surface. In EGL this represents the EGLNativeWindowType.
55 gbm_surface* native_surface_;
56
57 // Backing GBM buffers. One is the current front buffer. The other is the
58 // current backbuffer that is pending scan out.
59 gbm_bo* buffers_[2];
60
61 // Index to the front buffer.
62 int front_buffer_;
63
64 // We can't lock (and get) an accelerated buffer from the GBM surface until
65 // after something draws into it. But modesetting needs to happen earlier,
66 // before an actual window is created and draws. So, we create a dumb buffer
67 // for this purpose.
68 scoped_ptr<DriBuffer> dumb_buffer_;
69
70 DISALLOW_COPY_AND_ASSIGN(GbmSurface);
71 };
72
73 } // namespace ui
74
75 #endif // UI_OZONE_PLATFORM_DRI_GBM_SURFACE_H_
OLDNEW
« no previous file with comments | « ui/ozone/platform/dri/gbm.gypi ('k') | ui/ozone/platform/dri/gbm_surface.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698