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

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

Issue 371813004: ozone: gbm: Add overlay support (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: 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 unified diff | Download patch
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 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 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef UI_OZONE_PLATFORM_DRI_HARDWARE_DISPLAY_CONTROLLER_H_ 5 #ifndef UI_OZONE_PLATFORM_DRI_HARDWARE_DISPLAY_CONTROLLER_H_
6 #define UI_OZONE_PLATFORM_DRI_HARDWARE_DISPLAY_CONTROLLER_H_ 6 #define UI_OZONE_PLATFORM_DRI_HARDWARE_DISPLAY_CONTROLLER_H_
7 7
8 #include <stddef.h> 8 #include <stddef.h>
9 #include <stdint.h> 9 #include <stdint.h>
10 #include <xf86drmMode.h> 10 #include <xf86drmMode.h>
11 #include <vector> 11 #include <vector>
12 12
13 #include "base/basictypes.h" 13 #include "base/basictypes.h"
14 #include "base/memory/scoped_ptr.h" 14 #include "base/memory/scoped_ptr.h"
15 #include "base/memory/weak_ptr.h" 15 #include "base/memory/weak_ptr.h"
16 #include "ui/ozone/platform/dri/dri_wrapper.h" 16 #include "ui/ozone/platform/dri/dri_wrapper.h"
17 17
18 namespace gfx { 18 namespace gfx {
19 class Point; 19 class Point;
20 } 20 }
21 21
22 namespace ui { 22 namespace ui {
23 23
24 class NativePixmap;
24 class ScanoutSurface; 25 class ScanoutSurface;
25 26
27 typedef std::vector<scoped_refptr<NativePixmap> > NativePixmapList;
28
29 struct OzoneOverlayPlane {
30 OzoneOverlayPlane(ScanoutSurface* scanout,
31 int z_order,
32 gfx::OverlayTransform plane_transform,
33 const gfx::Rect& display_bounds,
34 const gfx::RectF& crop_rect)
35 : scanout(scanout),
36 z_order(z_order),
37 plane_transform(plane_transform),
38 display_bounds(display_bounds),
39 crop_rect(crop_rect),
40 overlay_plane(0) {}
41
42 ScanoutSurface* scanout;
43 int z_order;
44 gfx::OverlayTransform plane_transform;
45 gfx::Rect display_bounds;
46 gfx::RectF crop_rect;
47 int overlay_plane;
48 };
49
26 // The HDCOz will handle modesettings and scannout operations for hardware 50 // The HDCOz will handle modesettings and scannout operations for hardware
27 // devices. 51 // devices.
28 // 52 //
29 // In the DRM world there are 3 components that need to be paired up to be able 53 // In the DRM world there are 3 components that need to be paired up to be able
30 // to display an image to the monitor: CRTC (cathode ray tube controller), 54 // to display an image to the monitor: CRTC (cathode ray tube controller),
31 // encoder and connector. The CRTC determines which framebuffer to read, when 55 // encoder and connector. The CRTC determines which framebuffer to read, when
32 // to scanout and where to scanout. Encoders converts the stream from the CRTC 56 // to scanout and where to scanout. Encoders converts the stream from the CRTC
33 // to the appropriate format for the connector. The connector is the physical 57 // to the appropriate format for the connector. The connector is the physical
34 // connection that monitors connect to. 58 // connection that monitors connect to.
35 // 59 //
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after
107 // 131 //
108 // Between this call and the callback, the framebuffer used in this call 132 // Between this call and the callback, the framebuffer used in this call
109 // should not be modified in any way as it would cause screen tearing if the 133 // should not be modified in any way as it would cause screen tearing if the
110 // hardware performed the flip. Note that the frontbuffer should also not 134 // hardware performed the flip. Note that the frontbuffer should also not
111 // be modified as it could still be displayed. 135 // be modified as it could still be displayed.
112 // 136 //
113 // Note that this function does not block. Also, this function should not be 137 // Note that this function does not block. Also, this function should not be
114 // called again before the page flip occurrs. 138 // called again before the page flip occurrs.
115 // 139 //
116 // Returns true if the page flip was successfully registered, false otherwise. 140 // Returns true if the page flip was successfully registered, false otherwise.
117 bool SchedulePageFlip(); 141 bool SchedulePageFlip(const std::vector<OzoneOverlayPlane>& overlays,
142 NativePixmapList* references);
118 143
119 // TODO(dnicoara) This should be on the MessageLoop when Ozone can have 144 // TODO(dnicoara) This should be on the MessageLoop when Ozone can have
120 // BeginFrame can be triggered explicitly by Ozone. 145 // BeginFrame can be triggered explicitly by Ozone.
121 void WaitForPageFlipEvent(); 146 void WaitForPageFlipEvent();
122 147
123 // Called when the page flip event occurred. The event is provided by the 148 // Called when the page flip event occurred. The event is provided by the
124 // kernel when a VBlank event finished. This allows the controller to 149 // kernel when a VBlank event finished. This allows the controller to
125 // update internal state and propagate the update to the surface. 150 // update internal state and propagate the update to the surface.
126 // The tuple (seconds, useconds) represents the event timestamp. |seconds| 151 // The tuple (seconds, useconds) represents the event timestamp. |seconds|
127 // represents the number of seconds while |useconds| represents the 152 // represents the number of seconds while |useconds| represents the
(...skipping 15 matching lines...) Expand all
143 uint32_t crtc_id() const { return crtc_id_; } 168 uint32_t crtc_id() const { return crtc_id_; }
144 ScanoutSurface* surface() const { 169 ScanoutSurface* surface() const {
145 return surface_.get(); 170 return surface_.get();
146 }; 171 };
147 172
148 uint64_t get_time_of_last_flip() const { 173 uint64_t get_time_of_last_flip() const {
149 return time_of_last_flip_; 174 return time_of_last_flip_;
150 }; 175 };
151 176
152 private: 177 private:
178 ScanoutSurface* GetPrimaryPlane(
179 const std::vector<OzoneOverlayPlane>& overlays);
180
181 NativePixmapList current_overlay_references_;
182
153 // Object containing the connection to the graphics device and wraps the API 183 // Object containing the connection to the graphics device and wraps the API
154 // calls to control it. 184 // calls to control it.
155 DriWrapper* drm_; 185 DriWrapper* drm_;
156 186
157 // TODO(dnicoara) Need to allow a CRTC to have multiple connectors. 187 // TODO(dnicoara) Need to allow a CRTC to have multiple connectors.
158 uint32_t connector_id_; 188 uint32_t connector_id_;
159 189
160 uint32_t crtc_id_; 190 uint32_t crtc_id_;
161 191
162 drmModeModeInfo mode_; 192 drmModeModeInfo mode_;
163 193
164 scoped_ptr<ScanoutSurface> surface_; 194 scoped_ptr<ScanoutSurface> surface_;
165 195
166 uint64_t time_of_last_flip_; 196 uint64_t time_of_last_flip_;
167 197
168 // Keeps track of the CRTC state. If a surface has been bound, then the value 198 // Keeps track of the CRTC state. If a surface has been bound, then the value
169 // is set to false. Otherwise it is true. 199 // is set to false. Otherwise it is true.
170 bool is_disabled_; 200 bool is_disabled_;
171 201
172 // Store the state of the CRTC before we took over. Used to restore the CRTC 202 // Store the state of the CRTC before we took over. Used to restore the CRTC
173 // once we no longer need it. 203 // once we no longer need it.
174 ScopedDrmCrtcPtr saved_crtc_; 204 ScopedDrmCrtcPtr saved_crtc_;
175 205
176 DISALLOW_COPY_AND_ASSIGN(HardwareDisplayController); 206 DISALLOW_COPY_AND_ASSIGN(HardwareDisplayController);
177 }; 207 };
178 208
179 } // namespace ui 209 } // namespace ui
180 210
181 #endif // UI_OZONE_PLATFORM_DRI_HARDWARE_DISPLAY_CONTROLLER_H_ 211 #endif // UI_OZONE_PLATFORM_DRI_HARDWARE_DISPLAY_CONTROLLER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698