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

Side by Side Diff: ui/ozone/platform/dri/scanout_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/ozone_platform_gbm.cc ('k') | ui/ozone/platform/dri/screen_manager.h » ('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_SCANOUT_SURFACE_H_
6 #define UI_OZONE_PLATFORM_DRI_SCANOUT_SURFACE_H_
7
8 #include <stdint.h>
9
10 namespace gfx {
11 class Size;
12 }
13
14 namespace ui {
15
16 // ScanoutSurface is an interface for a surface that can be scanned out to a
17 // monitor using the DRM/KMS API. Implementations will store the internal state
18 // associated with the drawing surface. Implementations are also required to
19 // performs all the needed operations to initialize and update the drawing
20 // surface.
21 //
22 // The typical usage pattern is:
23 // -----------------------------------------------------------------------------
24 // HardwareDisplayController controller;
25 // // Initialize controller
26 //
27 // ScanoutSurface* surface = new ScanoutSurfaceImpl(size);
28 // surface.Initialize();
29 // controller.BindSurfaceToController(surface);
30 //
31 // while (true) {
32 // DrawIntoSurface(surface);
33 // controller.SchedulePageFlip();
34 //
35 // Wait for page flip event. The DRM page flip handler will call
36 // surface.SwapBuffers();
37 // }
38 //
39 // delete surface;
40 // -----------------------------------------------------------------------------
41 // In the above example the wait consists of reading a DRM pageflip event from
42 // the graphics card file descriptor. This is done by calling |drmHandleEvent|,
43 // which will read and process the event. |drmHandleEvent| will call a callback
44 // registered by |SchedulePageFlip| which will update the internal state.
45 //
46 // |SchedulePageFlip| can also be used to limit drawing to the screen's vsync
47 // since page flips only happen on vsync. In a threaded environment a message
48 // loop would listen on the graphics card file descriptor for an event and
49 // |drmHandleEvent| would be called from the message loop. The event handler
50 // would also be responsible for updating the renderer's state and signal that
51 // it is OK to start drawing the next frame.
52 class ScanoutSurface {
53 public:
54 virtual ~ScanoutSurface() {}
55
56 // Used to allocate all necessary buffers for this surface. If the
57 // initialization succeeds, the device is ready to be used for drawing
58 // operations.
59 // Returns true if the initialization is successful, false otherwise.
60 virtual bool Initialize() = 0;
61
62 // Swaps the back buffer with the front buffer.
63 virtual void SwapBuffers() = 0;
64
65 // Returns the ID of the current backbuffer.
66 virtual uint32_t GetFramebufferId() const = 0;
67
68 // Returns the handle of the current backbuffer.
69 virtual uint32_t GetHandle() const = 0;
70
71 // Returns the surface size.
72 virtual gfx::Size Size() const = 0;
73 };
74
75 class ScanoutSurfaceGenerator {
76 public:
77 virtual ~ScanoutSurfaceGenerator() {}
78
79 virtual ScanoutSurface* Create(const gfx::Size& size) = 0;
80 };
81
82 } // namespace ui
83
84 #endif // UI_OZONE_PLATFORM_DRI_SCANOUT_SURFACE_H_
OLDNEW
« no previous file with comments | « ui/ozone/platform/dri/ozone_platform_gbm.cc ('k') | ui/ozone/platform/dri/screen_manager.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698