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 22 matching lines...) Expand all Loading... |
33 planes_.push_back( | 33 planes_.push_back( |
34 new HardwareDisplayPlane(kPlaneBaseId + i, 1 << crtc_idx)); | 34 new HardwareDisplayPlane(kPlaneBaseId + i, 1 << crtc_idx)); |
35 } | 35 } |
36 } | 36 } |
37 } | 37 } |
38 }; | 38 }; |
39 | 39 |
40 } // namespace | 40 } // namespace |
41 | 41 |
42 MockDriWrapper::MockDriWrapper(int fd) | 42 MockDriWrapper::MockDriWrapper(int fd) |
43 : DriWrapper("", true), | 43 : DriWrapper(""), |
44 get_crtc_call_count_(0), | 44 get_crtc_call_count_(0), |
45 set_crtc_call_count_(0), | 45 set_crtc_call_count_(0), |
46 restore_crtc_call_count_(0), | 46 restore_crtc_call_count_(0), |
47 add_framebuffer_call_count_(0), | 47 add_framebuffer_call_count_(0), |
48 remove_framebuffer_call_count_(0), | 48 remove_framebuffer_call_count_(0), |
49 page_flip_call_count_(0), | 49 page_flip_call_count_(0), |
50 overlay_flip_call_count_(0), | 50 overlay_flip_call_count_(0), |
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 use_sync_flips, | 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("", use_sync_flips), | 64 : DriWrapper(""), |
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), |
75 create_dumb_buffer_expectation_(true), | 75 create_dumb_buffer_expectation_(true), |
| 76 use_sync_flips_(use_sync_flips), |
76 current_framebuffer_(0) { | 77 current_framebuffer_(0) { |
77 fd_ = fd; | 78 fd_ = fd; |
78 plane_manager_.reset( | 79 plane_manager_.reset( |
79 new MockHardwareDisplayPlaneManager(this, crtcs, planes_per_crtc)); | 80 new MockHardwareDisplayPlaneManager(this, crtcs, planes_per_crtc)); |
80 } | 81 } |
81 | 82 |
82 MockDriWrapper::~MockDriWrapper() { | 83 MockDriWrapper::~MockDriWrapper() { |
83 fd_ = -1; | 84 fd_ = -1; |
84 } | 85 } |
85 | 86 |
(...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
214 | 215 |
215 void MockDriWrapper::RunCallbacks() { | 216 void MockDriWrapper::RunCallbacks() { |
216 while (!callbacks_.empty()) { | 217 while (!callbacks_.empty()) { |
217 PageFlipCallback callback = callbacks_.front(); | 218 PageFlipCallback callback = callbacks_.front(); |
218 callbacks_.pop(); | 219 callbacks_.pop(); |
219 callback.Run(0, 0, 0); | 220 callback.Run(0, 0, 0); |
220 } | 221 } |
221 } | 222 } |
222 | 223 |
223 } // namespace ui | 224 } // namespace ui |
OLD | NEW |