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

Side by Side Diff: ui/ozone/platform/drm/gpu/drm_window.cc

Issue 1311043016: Switch DRM platform to using a separate thread (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@mv-drm-calls-on-thread2
Patch Set: Created 5 years, 3 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 #include "ui/ozone/platform/drm/gpu/drm_window.h" 5 #include "ui/ozone/platform/drm/gpu/drm_window.h"
6 6
7 #include "base/time/time.h" 7 #include "base/time/time.h"
8 #include "base/trace_event/trace_event.h" 8 #include "base/trace_event/trace_event.h"
9 #include "third_party/skia/include/core/SkBitmap.h" 9 #include "third_party/skia/include/core/SkBitmap.h"
10 #include "third_party/skia/include/core/SkDevice.h" 10 #include "third_party/skia/include/core/SkDevice.h"
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after
71 } 71 }
72 72
73 gfx::AcceleratedWidget DrmWindow::GetAcceleratedWidget() { 73 gfx::AcceleratedWidget DrmWindow::GetAcceleratedWidget() {
74 return widget_; 74 return widget_;
75 } 75 }
76 76
77 HardwareDisplayController* DrmWindow::GetController() { 77 HardwareDisplayController* DrmWindow::GetController() {
78 return controller_; 78 return controller_;
79 } 79 }
80 80
81 scoped_refptr<DrmDevice> DrmWindow::GetAllocationDrmDevice() const {
82 return device_manager_->GetDrmDevice(widget_);
83 }
84
81 void DrmWindow::OnBoundsChanged(const gfx::Rect& bounds) { 85 void DrmWindow::OnBoundsChanged(const gfx::Rect& bounds) {
82 TRACE_EVENT2("drm", "DrmWindow::OnBoundsChanged", "widget", widget_, "bounds", 86 TRACE_EVENT2("drm", "DrmWindow::OnBoundsChanged", "widget", widget_, "bounds",
83 bounds.ToString()); 87 bounds.ToString());
84 bounds_ = bounds; 88 bounds_ = bounds;
85 if (bounds_.size() != bounds.size()) 89 if (bounds_.size() != bounds.size())
86 last_submitted_planes_.clear(); 90 last_submitted_planes_.clear();
87 91
88 screen_manager_->UpdateControllerToWindowMapping(); 92 screen_manager_->UpdateControllerToWindowMapping();
89 } 93 }
90 94
(...skipping 27 matching lines...) Expand all
118 cursor_location_ = location; 122 cursor_location_ = location;
119 123
120 if (controller_) 124 if (controller_)
121 controller_->MoveCursor(location); 125 controller_->MoveCursor(location);
122 } 126 }
123 127
124 void DrmWindow::QueueOverlayPlane(const OverlayPlane& plane) { 128 void DrmWindow::QueueOverlayPlane(const OverlayPlane& plane) {
125 pending_planes_.push_back(plane); 129 pending_planes_.push_back(plane);
126 } 130 }
127 131
128 bool DrmWindow::SchedulePageFlip(bool is_sync, 132 void DrmWindow::SchedulePageFlip(bool is_sync,
129 const SwapCompletionCallback& callback) { 133 const SwapCompletionCallback& callback) {
130 last_submitted_planes_.clear(); 134 last_submitted_planes_.clear();
131 last_submitted_planes_.swap(pending_planes_); 135 last_submitted_planes_.swap(pending_planes_);
132 last_swap_sync_ = is_sync; 136 last_swap_sync_ = is_sync;
133 137
134 if (controller_) { 138 if (controller_) {
135 return controller_->SchedulePageFlip(last_submitted_planes_, is_sync, false, 139 controller_->SchedulePageFlip(last_submitted_planes_, is_sync, false,
136 callback); 140 callback);
141 } else {
142 callback.Run(gfx::SwapResult::SWAP_ACK);
137 } 143 }
138
139 callback.Run(gfx::SwapResult::SWAP_ACK);
140 return true;
141 } 144 }
142 145
143 bool DrmWindow::TestPageFlip(const std::vector<OverlayCheck_Params>& overlays, 146 bool DrmWindow::TestPageFlip(const std::vector<OverlayCheck_Params>& overlays,
144 ScanoutBufferGenerator* buffer_generator) { 147 ScanoutBufferGenerator* buffer_generator) {
145 if (!controller_) 148 if (!controller_)
146 return true; 149 return true;
147 for (const auto& overlay : overlays) { 150 for (const auto& overlay : overlays) {
148 // It is possible that the cc rect we get actually falls off the edge of 151 // It is possible that the cc rect we get actually falls off the edge of
149 // the screen. Usually this is prevented via things like status bars 152 // the screen. Usually this is prevented via things like status bars
150 // blocking overlaying or cc clipping it, but in case it wasn't properly 153 // blocking overlaying or cc clipping it, but in case it wasn't properly
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
187 // Stores the time of the last refresh. 190 // Stores the time of the last refresh.
188 base::TimeTicks timebase = 191 base::TimeTicks timebase =
189 base::TimeTicks::FromInternalValue(controller_->GetTimeOfLastFlip()); 192 base::TimeTicks::FromInternalValue(controller_->GetTimeOfLastFlip());
190 // Stores the refresh rate. 193 // Stores the refresh rate.
191 base::TimeDelta interval = 194 base::TimeDelta interval =
192 base::TimeDelta::FromSeconds(1) / controller_->get_mode().vrefresh; 195 base::TimeDelta::FromSeconds(1) / controller_->get_mode().vrefresh;
193 196
194 callback.Run(timebase, interval); 197 callback.Run(timebase, interval);
195 } 198 }
196 199
200 bool DrmWindow::IsDisplayedOnUniversalDisplayLinkDevice() const {
201 if (!controller_)
202 return false;
203
204 scoped_refptr<DrmDevice> primary =
205 device_manager_->GetDrmDevice(gfx::kNullAcceleratedWidget);
206 DCHECK(primary);
207
208 return primary != controller_->GetAllocationDrmDevice();
209 }
210
197 void DrmWindow::ResetCursor(bool bitmap_only) { 211 void DrmWindow::ResetCursor(bool bitmap_only) {
198 if (!controller_) 212 if (!controller_)
199 return; 213 return;
200 214
201 if (cursor_bitmaps_.size()) { 215 if (cursor_bitmaps_.size()) {
202 // Draw new cursor into backbuffer. 216 // Draw new cursor into backbuffer.
203 UpdateCursorImage(cursor_buffers_[cursor_frontbuffer_ ^ 1].get(), 217 UpdateCursorImage(cursor_buffers_[cursor_frontbuffer_ ^ 1].get(),
204 cursor_bitmaps_[cursor_frame_]); 218 cursor_bitmaps_[cursor_frame_]);
205 219
206 // Reset location & buffer. 220 // Reset location & buffer.
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
256 if (!cursor_buffers_[i]->Initialize( 270 if (!cursor_buffers_[i]->Initialize(
257 info, false /* should_register_framebuffer */)) { 271 info, false /* should_register_framebuffer */)) {
258 LOG(FATAL) << "Failed to initialize cursor buffer"; 272 LOG(FATAL) << "Failed to initialize cursor buffer";
259 return; 273 return;
260 } 274 }
261 } 275 }
262 } 276 }
263 } 277 }
264 278
265 } // namespace ui 279 } // namespace ui
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698