| OLD | NEW |
| 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 108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 119 cursor_location_ = location; | 119 cursor_location_ = location; |
| 120 | 120 |
| 121 if (controller_) | 121 if (controller_) |
| 122 controller_->MoveCursor(location); | 122 controller_->MoveCursor(location); |
| 123 } | 123 } |
| 124 | 124 |
| 125 void DrmWindow::QueueOverlayPlane(const OverlayPlane& plane) { | 125 void DrmWindow::QueueOverlayPlane(const OverlayPlane& plane) { |
| 126 pending_planes_.push_back(plane); | 126 pending_planes_.push_back(plane); |
| 127 } | 127 } |
| 128 | 128 |
| 129 bool DrmWindow::SchedulePageFlip(const SwapCompletionCallback& callback) { | 129 void DrmWindow::SchedulePageFlip(const SwapCompletionCallback& callback) { |
| 130 if (force_buffer_reallocation_) { | 130 if (force_buffer_reallocation_) { |
| 131 // Clear pending planes otherwise the next call to queue planes will just | 131 // Clear pending planes otherwise the next call to queue planes will just |
| 132 // add on top. | 132 // add on top. |
| 133 pending_planes_.clear(); | 133 pending_planes_.clear(); |
| 134 force_buffer_reallocation_ = false; | 134 force_buffer_reallocation_ = false; |
| 135 callback.Run(gfx::SwapResult::SWAP_NAK_RECREATE_BUFFERS); | 135 callback.Run(gfx::SwapResult::SWAP_NAK_RECREATE_BUFFERS); |
| 136 return true; | 136 return; |
| 137 } | 137 } |
| 138 | 138 |
| 139 last_submitted_planes_.clear(); | 139 last_submitted_planes_.clear(); |
| 140 last_submitted_planes_.swap(pending_planes_); | 140 last_submitted_planes_.swap(pending_planes_); |
| 141 | 141 |
| 142 if (controller_) { | 142 if (controller_) { |
| 143 return controller_->SchedulePageFlip(last_submitted_planes_, | 143 if (!controller_->SchedulePageFlip(last_submitted_planes_, |
| 144 false /* test_only */, callback); | 144 false /* test_only */, callback)) |
| 145 callback.Run(gfx::SwapResult::SWAP_FAILED); |
| 146 } else { |
| 147 callback.Run(gfx::SwapResult::SWAP_ACK); |
| 145 } | 148 } |
| 146 | |
| 147 callback.Run(gfx::SwapResult::SWAP_ACK); | |
| 148 return true; | |
| 149 } | 149 } |
| 150 | 150 |
| 151 bool DrmWindow::TestPageFlip(const std::vector<OverlayCheck_Params>& overlays, | 151 bool DrmWindow::TestPageFlip(const std::vector<OverlayCheck_Params>& overlays, |
| 152 ScanoutBufferGenerator* buffer_generator) { | 152 ScanoutBufferGenerator* buffer_generator) { |
| 153 if (!controller_) | 153 if (!controller_) |
| 154 return true; | 154 return true; |
| 155 for (const auto& overlay : overlays) { | 155 for (const auto& overlay : overlays) { |
| 156 // It is possible that the cc rect we get actually falls off the edge of | 156 // It is possible that the cc rect we get actually falls off the edge of |
| 157 // the screen. Usually this is prevented via things like status bars | 157 // the screen. Usually this is prevented via things like status bars |
| 158 // blocking overlaying or cc clipping it, but in case it wasn't properly | 158 // blocking overlaying or cc clipping it, but in case it wasn't properly |
| (...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 273 if (!cursor_buffers_[i]->Initialize( | 273 if (!cursor_buffers_[i]->Initialize( |
| 274 info, false /* should_register_framebuffer */)) { | 274 info, false /* should_register_framebuffer */)) { |
| 275 LOG(FATAL) << "Failed to initialize cursor buffer"; | 275 LOG(FATAL) << "Failed to initialize cursor buffer"; |
| 276 return; | 276 return; |
| 277 } | 277 } |
| 278 } | 278 } |
| 279 } | 279 } |
| 280 } | 280 } |
| 281 | 281 |
| 282 } // namespace ui | 282 } // namespace ui |
| OLD | NEW |