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

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: fix test code 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 ScanoutSurface; 24 class ScanoutSurface;
25 25
26 struct OzoneOverlayPlane {
27 OzoneOverlayPlane(ScanoutSurface* scanout,
28 int z_order,
29 gfx::OverlayTransform plane_transform,
30 const gfx::Rect& display_bounds,
31 const gfx::RectF& crop_rect)
32 : scanout(scanout),
33 z_order(z_order),
34 plane_transform(plane_transform),
35 display_bounds(display_bounds),
36 crop_rect(crop_rect),
37 overlay_plane(0) {}
38
39 ScanoutSurface* scanout;
40 int z_order;
41 gfx::OverlayTransform plane_transform;
42 gfx::Rect display_bounds;
43 gfx::RectF crop_rect;
44 int overlay_plane;
45 };
46
26 // The HDCOz will handle modesettings and scannout operations for hardware 47 // The HDCOz will handle modesettings and scannout operations for hardware
27 // devices. 48 // devices.
28 // 49 //
29 // In the DRM world there are 3 components that need to be paired up to be able 50 // 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), 51 // to display an image to the monitor: CRTC (cathode ray tube controller),
31 // encoder and connector. The CRTC determines which framebuffer to read, when 52 // 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 53 // 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 54 // to the appropriate format for the connector. The connector is the physical
34 // connection that monitors connect to. 55 // connection that monitors connect to.
35 // 56 //
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after
107 // 128 //
108 // Between this call and the callback, the framebuffer used in this call 129 // 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 130 // 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 131 // hardware performed the flip. Note that the frontbuffer should also not
111 // be modified as it could still be displayed. 132 // be modified as it could still be displayed.
112 // 133 //
113 // Note that this function does not block. Also, this function should not be 134 // Note that this function does not block. Also, this function should not be
114 // called again before the page flip occurrs. 135 // called again before the page flip occurrs.
115 // 136 //
116 // Returns true if the page flip was successfully registered, false otherwise. 137 // Returns true if the page flip was successfully registered, false otherwise.
117 bool SchedulePageFlip(); 138 bool SchedulePageFlip(std::vector<OzoneOverlayPlane>* overlays);
dnicoara 2014/07/07 19:17:55 Pass by const reference.
achaulk 2014/07/07 20:18:05 The contents are modified, or will be anyway once
118 139
119 // TODO(dnicoara) This should be on the MessageLoop when Ozone can have 140 // TODO(dnicoara) This should be on the MessageLoop when Ozone can have
120 // BeginFrame can be triggered explicitly by Ozone. 141 // BeginFrame can be triggered explicitly by Ozone.
121 void WaitForPageFlipEvent(); 142 void WaitForPageFlipEvent();
122 143
123 // Called when the page flip event occurred. The event is provided by the 144 // 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 145 // kernel when a VBlank event finished. This allows the controller to
125 // update internal state and propagate the update to the surface. 146 // update internal state and propagate the update to the surface.
126 // The tuple (seconds, useconds) represents the event timestamp. |seconds| 147 // The tuple (seconds, useconds) represents the event timestamp. |seconds|
127 // represents the number of seconds while |useconds| represents the 148 // represents the number of seconds while |useconds| represents the
128 // microseconds (< 1 second) in the timestamp. 149 // microseconds (< 1 second) in the timestamp.
129 void OnPageFlipEvent(unsigned int frame, 150 void OnPageFlipEvent(unsigned int frame,
130 unsigned int seconds, 151 unsigned int seconds,
131 unsigned int useconds); 152 unsigned int useconds);
132 153
133 // Set the hardware cursor to show the contents of |surface|. 154 // Set the hardware cursor to show the contents of |surface|.
134 bool SetCursor(ScanoutSurface* surface); 155 bool SetCursor(ScanoutSurface* surface);
135 156
136 bool UnsetCursor(); 157 bool UnsetCursor();
137 158
138 // Moves the hardware cursor to |location|. 159 // Moves the hardware cursor to |location|.
139 bool MoveCursor(const gfx::Point& location); 160 bool MoveCursor(const gfx::Point& location);
140 161
162 bool ScheduleOverlayPlane(int plane_z_order,
dnicoara 2014/07/07 19:17:55 Please delete. This isn't used or defined anywhere
achaulk 2014/07/07 20:18:04 Done.
163 gfx::OverlayTransform plane_transform,
164 ScanoutSurface* scanout,
165 const gfx::Rect& display_bounds,
166 const gfx::RectF& crop_rect);
167
141 const drmModeModeInfo& get_mode() const { return mode_; }; 168 const drmModeModeInfo& get_mode() const { return mode_; };
142 uint32_t connector_id() const { return connector_id_; } 169 uint32_t connector_id() const { return connector_id_; }
143 uint32_t crtc_id() const { return crtc_id_; } 170 uint32_t crtc_id() const { return crtc_id_; }
144 ScanoutSurface* surface() const { 171 ScanoutSurface* surface() const {
145 return surface_.get(); 172 return surface_.get();
146 }; 173 };
147 174
148 uint64_t get_time_of_last_flip() const { 175 uint64_t get_time_of_last_flip() const {
149 return time_of_last_flip_; 176 return time_of_last_flip_;
150 }; 177 };
151 178
152 private: 179 private:
180 // Assign overlay IDs to each overlay in the list, returning the primary
181 // plane's surface (z-index 0, or surface_.get()).
182 ScanoutSurface* AssignOverlayPlanes(std::vector<OzoneOverlayPlane>* overlays);
183
153 // Object containing the connection to the graphics device and wraps the API 184 // Object containing the connection to the graphics device and wraps the API
154 // calls to control it. 185 // calls to control it.
155 DriWrapper* drm_; 186 DriWrapper* drm_;
156 187
157 // TODO(dnicoara) Need to allow a CRTC to have multiple connectors. 188 // TODO(dnicoara) Need to allow a CRTC to have multiple connectors.
158 uint32_t connector_id_; 189 uint32_t connector_id_;
159 190
160 uint32_t crtc_id_; 191 uint32_t crtc_id_;
161 192
162 drmModeModeInfo mode_; 193 drmModeModeInfo mode_;
163 194
164 scoped_ptr<ScanoutSurface> surface_; 195 scoped_ptr<ScanoutSurface> surface_;
165 196
166 uint64_t time_of_last_flip_; 197 uint64_t time_of_last_flip_;
167 198
168 // Keeps track of the CRTC state. If a surface has been bound, then the value 199 // Keeps track of the CRTC state. If a surface has been bound, then the value
169 // is set to false. Otherwise it is true. 200 // is set to false. Otherwise it is true.
170 bool is_disabled_; 201 bool is_disabled_;
171 202
172 // Store the state of the CRTC before we took over. Used to restore the CRTC 203 // Store the state of the CRTC before we took over. Used to restore the CRTC
173 // once we no longer need it. 204 // once we no longer need it.
174 ScopedDrmCrtcPtr saved_crtc_; 205 ScopedDrmCrtcPtr saved_crtc_;
175 206
176 DISALLOW_COPY_AND_ASSIGN(HardwareDisplayController); 207 DISALLOW_COPY_AND_ASSIGN(HardwareDisplayController);
177 }; 208 };
178 209
179 } // namespace ui 210 } // namespace ui
180 211
181 #endif // UI_OZONE_PLATFORM_DRI_HARDWARE_DISPLAY_CONTROLLER_H_ 212 #endif // UI_OZONE_PLATFORM_DRI_HARDWARE_DISPLAY_CONTROLLER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698