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

Side by Side Diff: ui/ozone/platform/drm/test/mock_drm_device.cc

Issue 1314553002: Move Format checks to HardwareDisplayPlane (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: InitTest 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/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 208 matching lines...) Expand 10 before | Expand all | Expand 10 after
254 259
255 void MockDrmDevice::RunCallbacks() { 260 void MockDrmDevice::RunCallbacks() {
256 while (!callbacks_.empty()) { 261 while (!callbacks_.empty()) {
257 PageFlipCallback callback = callbacks_.front(); 262 PageFlipCallback callback = callbacks_.front();
258 callbacks_.pop(); 263 callbacks_.pop();
259 callback.Run(0, 0, 0); 264 callback.Run(0, 0, 0);
260 } 265 }
261 } 266 }
262 267
263 } // namespace ui 268 } // namespace ui
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698