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

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 build 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
36 ScanoutSurface* scanout;
37 int z_order;
38 gfx::OverlayTransform plane_transform;
39 gfx::Rect display_bounds;
40 gfx::RectF crop_rect;
41 int overlay_plane;
42 };
43
26 // The HDCOz will handle modesettings and scannout operations for hardware 44 // The HDCOz will handle modesettings and scannout operations for hardware
27 // devices. 45 // devices.
28 // 46 //
29 // In the DRM world there are 3 components that need to be paired up to be able 47 // 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), 48 // to display an image to the monitor: CRTC (cathode ray tube controller),
31 // encoder and connector. The CRTC determines which framebuffer to read, when 49 // 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 50 // 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 51 // to the appropriate format for the connector. The connector is the physical
34 // connection that monitors connect to. 52 // connection that monitors connect to.
35 // 53 //
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after
107 // 125 //
108 // Between this call and the callback, the framebuffer used in this call 126 // 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 127 // 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 128 // hardware performed the flip. Note that the frontbuffer should also not
111 // be modified as it could still be displayed. 129 // be modified as it could still be displayed.
112 // 130 //
113 // Note that this function does not block. Also, this function should not be 131 // Note that this function does not block. Also, this function should not be
114 // called again before the page flip occurrs. 132 // called again before the page flip occurrs.
115 // 133 //
116 // Returns true if the page flip was successfully registered, false otherwise. 134 // Returns true if the page flip was successfully registered, false otherwise.
117 bool SchedulePageFlip(); 135 bool SchedulePageFlip(const std::vector<OzoneOverlayPlane>& overlays,
136 NativePixmapList* references);
118 137
119 // TODO(dnicoara) This should be on the MessageLoop when Ozone can have 138 // TODO(dnicoara) This should be on the MessageLoop when Ozone can have
120 // BeginFrame can be triggered explicitly by Ozone. 139 // BeginFrame can be triggered explicitly by Ozone.
121 void WaitForPageFlipEvent(); 140 void WaitForPageFlipEvent();
122 141
123 // Called when the page flip event occurred. The event is provided by the 142 // 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 143 // kernel when a VBlank event finished. This allows the controller to
125 // update internal state and propagate the update to the surface. 144 // update internal state and propagate the update to the surface.
126 // The tuple (seconds, useconds) represents the event timestamp. |seconds| 145 // The tuple (seconds, useconds) represents the event timestamp. |seconds|
127 // represents the number of seconds while |useconds| represents the 146 // represents the number of seconds while |useconds| represents the
(...skipping 15 matching lines...) Expand all
143 uint32_t crtc_id() const { return crtc_id_; } 162 uint32_t crtc_id() const { return crtc_id_; }
144 ScanoutSurface* surface() const { 163 ScanoutSurface* surface() const {
145 return surface_.get(); 164 return surface_.get();
146 }; 165 };
147 166
148 uint64_t get_time_of_last_flip() const { 167 uint64_t get_time_of_last_flip() const {
149 return time_of_last_flip_; 168 return time_of_last_flip_;
150 }; 169 };
151 170
152 private: 171 private:
172 ScanoutSurface* GetPrimaryPlane(
173 const std::vector<OzoneOverlayPlane>& overlays);
174
175 NativePixmapList current_overlay_references_;
176
153 // Object containing the connection to the graphics device and wraps the API 177 // Object containing the connection to the graphics device and wraps the API
154 // calls to control it. 178 // calls to control it.
155 DriWrapper* drm_; 179 DriWrapper* drm_;
156 180
157 // TODO(dnicoara) Need to allow a CRTC to have multiple connectors. 181 // TODO(dnicoara) Need to allow a CRTC to have multiple connectors.
158 uint32_t connector_id_; 182 uint32_t connector_id_;
159 183
160 uint32_t crtc_id_; 184 uint32_t crtc_id_;
161 185
162 drmModeModeInfo mode_; 186 drmModeModeInfo mode_;
163 187
164 scoped_ptr<ScanoutSurface> surface_; 188 scoped_ptr<ScanoutSurface> surface_;
165 189
166 uint64_t time_of_last_flip_; 190 uint64_t time_of_last_flip_;
167 191
168 // Keeps track of the CRTC state. If a surface has been bound, then the value 192 // Keeps track of the CRTC state. If a surface has been bound, then the value
169 // is set to false. Otherwise it is true. 193 // is set to false. Otherwise it is true.
170 bool is_disabled_; 194 bool is_disabled_;
171 195
172 // Store the state of the CRTC before we took over. Used to restore the CRTC 196 // Store the state of the CRTC before we took over. Used to restore the CRTC
173 // once we no longer need it. 197 // once we no longer need it.
174 ScopedDrmCrtcPtr saved_crtc_; 198 ScopedDrmCrtcPtr saved_crtc_;
175 199
176 DISALLOW_COPY_AND_ASSIGN(HardwareDisplayController); 200 DISALLOW_COPY_AND_ASSIGN(HardwareDisplayController);
177 }; 201 };
178 202
179 } // namespace ui 203 } // namespace ui
180 204
181 #endif // UI_OZONE_PLATFORM_DRI_HARDWARE_DISPLAY_CONTROLLER_H_ 205 #endif // UI_OZONE_PLATFORM_DRI_HARDWARE_DISPLAY_CONTROLLER_H_
OLDNEW
« no previous file with comments | « ui/ozone/platform/dri/gbm_surface_factory.cc ('k') | ui/ozone/platform/dri/hardware_display_controller.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698