| 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/dri/test/mock_dri_wrapper.h" | 5 #include "ui/ozone/platform/dri/test/mock_dri_wrapper.h" |
| 6 | 6 |
| 7 #include <xf86drm.h> | 7 #include <xf86drm.h> |
| 8 #include <xf86drmMode.h> | 8 #include <xf86drmMode.h> |
| 9 | 9 |
| 10 #include "base/logging.h" | 10 #include "base/logging.h" |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 51 set_crtc_expectation_(true), | 51 set_crtc_expectation_(true), |
| 52 add_framebuffer_expectation_(true), | 52 add_framebuffer_expectation_(true), |
| 53 page_flip_expectation_(true), | 53 page_flip_expectation_(true), |
| 54 create_dumb_buffer_expectation_(true), | 54 create_dumb_buffer_expectation_(true), |
| 55 current_framebuffer_(0) { | 55 current_framebuffer_(0) { |
| 56 fd_ = fd; | 56 fd_ = fd; |
| 57 plane_manager_.reset(new HardwareDisplayPlaneManagerLegacy()); | 57 plane_manager_.reset(new HardwareDisplayPlaneManagerLegacy()); |
| 58 } | 58 } |
| 59 | 59 |
| 60 MockDriWrapper::MockDriWrapper(int fd, | 60 MockDriWrapper::MockDriWrapper(int fd, |
| 61 bool software_mode, | 61 bool use_sync_flips, |
| 62 std::vector<uint32_t> crtcs, | 62 std::vector<uint32_t> crtcs, |
| 63 size_t planes_per_crtc) | 63 size_t planes_per_crtc) |
| 64 : DriWrapper("", software_mode), | 64 : DriWrapper("", use_sync_flips), |
| 65 get_crtc_call_count_(0), | 65 get_crtc_call_count_(0), |
| 66 set_crtc_call_count_(0), | 66 set_crtc_call_count_(0), |
| 67 restore_crtc_call_count_(0), | 67 restore_crtc_call_count_(0), |
| 68 add_framebuffer_call_count_(0), | 68 add_framebuffer_call_count_(0), |
| 69 remove_framebuffer_call_count_(0), | 69 remove_framebuffer_call_count_(0), |
| 70 page_flip_call_count_(0), | 70 page_flip_call_count_(0), |
| 71 overlay_flip_call_count_(0), | 71 overlay_flip_call_count_(0), |
| 72 set_crtc_expectation_(true), | 72 set_crtc_expectation_(true), |
| 73 add_framebuffer_expectation_(true), | 73 add_framebuffer_expectation_(true), |
| 74 page_flip_expectation_(true), | 74 page_flip_expectation_(true), |
| (...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 132 ScopedDrmFramebufferPtr MockDriWrapper::GetFramebuffer(uint32_t framebuffer) { | 132 ScopedDrmFramebufferPtr MockDriWrapper::GetFramebuffer(uint32_t framebuffer) { |
| 133 return ScopedDrmFramebufferPtr(); | 133 return ScopedDrmFramebufferPtr(); |
| 134 } | 134 } |
| 135 | 135 |
| 136 bool MockDriWrapper::PageFlip(uint32_t crtc_id, | 136 bool MockDriWrapper::PageFlip(uint32_t crtc_id, |
| 137 uint32_t framebuffer, | 137 uint32_t framebuffer, |
| 138 const PageFlipCallback& callback) { | 138 const PageFlipCallback& callback) { |
| 139 page_flip_call_count_++; | 139 page_flip_call_count_++; |
| 140 current_framebuffer_ = framebuffer; | 140 current_framebuffer_ = framebuffer; |
| 141 if (page_flip_expectation_) { | 141 if (page_flip_expectation_) { |
| 142 if (software_mode_) | 142 if (use_sync_flips_) |
| 143 callback.Run(0, 0, 0); | 143 callback.Run(0, 0, 0); |
| 144 else | 144 else |
| 145 callbacks_.push(callback); | 145 callbacks_.push(callback); |
| 146 } | 146 } |
| 147 | 147 |
| 148 return page_flip_expectation_; | 148 return page_flip_expectation_; |
| 149 } | 149 } |
| 150 | 150 |
| 151 bool MockDriWrapper::PageFlipOverlay(uint32_t crtc_id, | 151 bool MockDriWrapper::PageFlipOverlay(uint32_t crtc_id, |
| 152 uint32_t framebuffer, | 152 uint32_t framebuffer, |
| (...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 214 | 214 |
| 215 void MockDriWrapper::RunCallbacks() { | 215 void MockDriWrapper::RunCallbacks() { |
| 216 while (!callbacks_.empty()) { | 216 while (!callbacks_.empty()) { |
| 217 PageFlipCallback callback = callbacks_.front(); | 217 PageFlipCallback callback = callbacks_.front(); |
| 218 callbacks_.pop(); | 218 callbacks_.pop(); |
| 219 callback.Run(0, 0, 0); | 219 callback.Run(0, 0, 0); |
| 220 } | 220 } |
| 221 } | 221 } |
| 222 | 222 |
| 223 } // namespace ui | 223 } // namespace ui |
| OLD | NEW |