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/test/mock_drm_device.h" | 5 #include "ui/ozone/platform/drm/test/mock_drm_device.h" |
6 | 6 |
| 7 #include <drm_fourcc.h> |
7 #include <xf86drm.h> | 8 #include <xf86drm.h> |
8 #include <xf86drmMode.h> | 9 #include <xf86drmMode.h> |
9 | 10 |
10 #include "base/logging.h" | 11 #include "base/logging.h" |
11 #include "third_party/skia/include/core/SkCanvas.h" | 12 #include "third_party/skia/include/core/SkCanvas.h" |
12 #include "ui/ozone/platform/drm/gpu/hardware_display_plane_manager_legacy.h" | 13 #include "ui/ozone/platform/drm/gpu/hardware_display_plane_manager_legacy.h" |
13 | 14 |
14 namespace ui { | 15 namespace ui { |
15 | 16 |
16 namespace { | 17 namespace { |
17 | 18 |
18 template <class Object> | 19 template <class Object> |
19 Object* DrmAllocator() { | 20 Object* DrmAllocator() { |
20 return static_cast<Object*>(drmMalloc(sizeof(Object))); | 21 return static_cast<Object*>(drmMalloc(sizeof(Object))); |
21 } | 22 } |
22 | 23 |
23 class MockHardwareDisplayPlaneManager | 24 class MockHardwareDisplayPlaneManager |
24 : public HardwareDisplayPlaneManagerLegacy { | 25 : public HardwareDisplayPlaneManagerLegacy { |
25 public: | 26 public: |
26 MockHardwareDisplayPlaneManager(DrmDevice* drm, | 27 MockHardwareDisplayPlaneManager(DrmDevice* drm, |
27 std::vector<uint32_t> crtcs, | 28 std::vector<uint32_t> crtcs, |
28 size_t planes_per_crtc) { | 29 size_t planes_per_crtc) { |
29 const int kPlaneBaseId = 50; | 30 const int kPlaneBaseId = 50; |
30 drm_ = drm; | 31 drm_ = drm; |
31 crtcs_.swap(crtcs); | 32 crtcs_.swap(crtcs); |
32 for (size_t crtc_idx = 0; crtc_idx < crtcs_.size(); crtc_idx++) { | 33 for (size_t crtc_idx = 0; crtc_idx < crtcs_.size(); crtc_idx++) { |
33 for (size_t i = 0; i < planes_per_crtc; i++) { | 34 for (size_t i = 0; i < planes_per_crtc; i++) { |
34 planes_.push_back( | 35 scoped_ptr<HardwareDisplayPlane> plane( |
35 new HardwareDisplayPlane(kPlaneBaseId + i, 1 << crtc_idx)); | 36 new HardwareDisplayPlane(kPlaneBaseId + i, 1 << crtc_idx)); |
| 37 // Add support to test more formats. |
| 38 plane->Initialize(drm, std::vector<uint32_t>(1, DRM_FORMAT_XRGB8888), |
| 39 false, true); |
| 40 planes_.push_back(plane.Pass()); |
36 } | 41 } |
37 } | 42 } |
38 } | 43 } |
39 }; | 44 }; |
40 | 45 |
41 } // namespace | 46 } // namespace |
42 | 47 |
43 MockDrmDevice::MockDrmDevice() | 48 MockDrmDevice::MockDrmDevice() |
44 : DrmDevice(base::FilePath(), base::File()), | 49 : DrmDevice(base::FilePath(), base::File()), |
45 get_crtc_call_count_(0), | 50 get_crtc_call_count_(0), |
(...skipping 207 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
253 | 258 |
254 void MockDrmDevice::RunCallbacks() { | 259 void MockDrmDevice::RunCallbacks() { |
255 while (!callbacks_.empty()) { | 260 while (!callbacks_.empty()) { |
256 PageFlipCallback callback = callbacks_.front(); | 261 PageFlipCallback callback = callbacks_.front(); |
257 callbacks_.pop(); | 262 callbacks_.pop(); |
258 callback.Run(0, 0, 0); | 263 callback.Run(0, 0, 0); |
259 } | 264 } |
260 } | 265 } |
261 | 266 |
262 } // namespace ui | 267 } // namespace ui |
OLD | NEW |