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

Side by Side Diff: ui/ozone/platform/drm/gpu/hardware_display_controller.h

Issue 1091253003: [ozone] Keep the queue of surfaceless buffers inside gl_surface_ozone (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 8 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_DRM_GPU_HARDWARE_DISPLAY_CONTROLLER_H_ 5 #ifndef UI_OZONE_PLATFORM_DRM_GPU_HARDWARE_DISPLAY_CONTROLLER_H_
6 #define UI_OZONE_PLATFORM_DRM_GPU_HARDWARE_DISPLAY_CONTROLLER_H_ 6 #define UI_OZONE_PLATFORM_DRM_GPU_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 <deque> 11 #include <deque>
12 #include <map> 12 #include <map>
13 #include <vector> 13 #include <vector>
14 14
15 #include "base/basictypes.h" 15 #include "base/basictypes.h"
16 #include "base/callback.h" 16 #include "base/callback.h"
17 #include "base/containers/scoped_ptr_hash_map.h" 17 #include "base/containers/scoped_ptr_hash_map.h"
18 #include "base/memory/scoped_ptr.h" 18 #include "base/memory/scoped_ptr.h"
19 #include "base/memory/scoped_vector.h" 19 #include "base/memory/scoped_vector.h"
20 #include "base/memory/weak_ptr.h"
21 #include "ui/ozone/ozone_export.h" 20 #include "ui/ozone/ozone_export.h"
22 #include "ui/ozone/platform/drm/gpu/hardware_display_plane_manager.h" 21 #include "ui/ozone/platform/drm/gpu/hardware_display_plane_manager.h"
23 #include "ui/ozone/platform/drm/gpu/overlay_plane.h" 22 #include "ui/ozone/platform/drm/gpu/overlay_plane.h"
24 #include "ui/ozone/platform/drm/gpu/page_flip_observer.h"
25 23
26 namespace gfx { 24 namespace gfx {
27 class Point; 25 class Point;
28 } 26 }
29 27
30 namespace ui { 28 namespace ui {
31 29
32 class CrtcController; 30 class CrtcController;
33 class ScanoutBuffer; 31 class ScanoutBuffer;
34 class DrmDevice; 32 class DrmDevice;
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
80 // ^ ^ 78 // ^ ^
81 // | | 79 // | |
82 // ---------------------- 80 // ----------------------
83 // | CRTC1 | 81 // | CRTC1 |
84 // ---------------------- 82 // ----------------------
85 // 83 //
86 // Note that it is possible to have more connectors than CRTCs which means that 84 // Note that it is possible to have more connectors than CRTCs which means that
87 // only a subset of connectors can be active independently, showing different 85 // only a subset of connectors can be active independently, showing different
88 // framebuffers. Though, in this case, it would be possible to have all 86 // framebuffers. Though, in this case, it would be possible to have all
89 // connectors active if some use the same CRTC to mirror the display. 87 // connectors active if some use the same CRTC to mirror the display.
90 class OZONE_EXPORT HardwareDisplayController 88 class OZONE_EXPORT HardwareDisplayController {
91 : public base::SupportsWeakPtr<HardwareDisplayController>,
92 public PageFlipObserver {
93 public: 89 public:
94 explicit HardwareDisplayController(scoped_ptr<CrtcController> controller); 90 explicit HardwareDisplayController(scoped_ptr<CrtcController> controller);
95 ~HardwareDisplayController() override; 91 ~HardwareDisplayController();
96 92
97 // Performs the initial CRTC configuration. If successful, it will display the 93 // Performs the initial CRTC configuration. If successful, it will display the
98 // framebuffer for |primary| with |mode|. 94 // framebuffer for |primary| with |mode|.
99 bool Modeset(const OverlayPlane& primary, drmModeModeInfo mode); 95 bool Modeset(const OverlayPlane& primary, drmModeModeInfo mode);
100 96
101 // Disables the CRTC. 97 // Disables the CRTC.
102 void Disable(); 98 void Disable();
103 99
104 // Schedules the |overlays|' framebuffers to be displayed on the next vsync 100 // Schedules the |overlays|' framebuffers to be displayed on the next vsync
105 // event. The event will be posted on the graphics card file descriptor |fd_| 101 // event. The event will be posted on the graphics card file descriptor |fd_|
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
147 const std::vector<CrtcController*>& crtc_controllers() const { 143 const std::vector<CrtcController*>& crtc_controllers() const {
148 return crtc_controllers_.get(); 144 return crtc_controllers_.get();
149 } 145 }
150 146
151 scoped_refptr<DrmDevice> GetAllocationDrmDevice() const; 147 scoped_refptr<DrmDevice> GetAllocationDrmDevice() const;
152 148
153 private: 149 private:
154 // Returns true if any of the CRTCs is waiting for a page flip. 150 // Returns true if any of the CRTCs is waiting for a page flip.
155 bool HasPendingPageFlips() const; 151 bool HasPendingPageFlips() const;
156 152
157 bool ActualSchedulePageFlip();
158
159 void ProcessPageFlipRequest();
160
161 void ClearPendingRequests();
162
163 // PageFlipObserver:
164 void OnPageFlipEvent() override;
165
166 struct PageFlipRequest {
167 PageFlipRequest(const OverlayPlaneList& planes,
168 bool is_sync,
169 const base::Closure& callback);
170 ~PageFlipRequest();
171
172 OverlayPlaneList planes;
173 bool is_sync;
174 base::Closure callback;
175 };
176
177 // Buffers need to be declared first so that they are destroyed last. Needed
178 // since the controllers may reference the buffers.
179 OverlayPlaneList current_planes_;
180 // Planes currently being queued without having SchedulePageFlip() called.
181 OverlayPlaneList pending_planes_;
182 // Plane lists for which SchedulePageFlip() was called. They are waiting for
183 // previous page flip events to be completed before they can be serviced.
184 std::deque<PageFlipRequest> requests_;
185 scoped_refptr<ScanoutBuffer> cursor_buffer_; 153 scoped_refptr<ScanoutBuffer> cursor_buffer_;
dnicoara 2015/04/23 15:34:56 nit: Unrelated, but could you just remove this as
186 154
187 base::ScopedPtrHashMap<DrmDevice*, HardwareDisplayPlaneList> 155 base::ScopedPtrHashMap<DrmDevice*, HardwareDisplayPlaneList>
188 owned_hardware_planes_; 156 owned_hardware_planes_;
189 157
190 // Stores the CRTC configuration. This is used to identify monitors and 158 // Stores the CRTC configuration. This is used to identify monitors and
191 // configure them. 159 // configure them.
192 ScopedVector<CrtcController> crtc_controllers_; 160 ScopedVector<CrtcController> crtc_controllers_;
193 161
194 // Location of the controller on the screen. 162 // Location of the controller on the screen.
195 gfx::Point origin_; 163 gfx::Point origin_;
196 164
197 // The mode used by the last modesetting operation. 165 // The mode used by the last modesetting operation.
198 drmModeModeInfo mode_; 166 drmModeModeInfo mode_;
199 167
200 bool is_disabled_; 168 bool is_disabled_;
169 bool ignore_page_flip_event_;
dnicoara 2015/04/23 15:34:56 remove
201 170
202 DISALLOW_COPY_AND_ASSIGN(HardwareDisplayController); 171 DISALLOW_COPY_AND_ASSIGN(HardwareDisplayController);
203 }; 172 };
204 173
205 } // namespace ui 174 } // namespace ui
206 175
207 #endif // UI_OZONE_PLATFORM_DRM_GPU_HARDWARE_DISPLAY_CONTROLLER_H_ 176 #endif // UI_OZONE_PLATFORM_DRM_GPU_HARDWARE_DISPLAY_CONTROLLER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698