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 <vector> | 5 #include <vector> |
6 | 6 |
7 #include "base/memory/scoped_ptr.h" | 7 #include "base/memory/scoped_ptr.h" |
8 #include "testing/gtest/include/gtest/gtest.h" | 8 #include "testing/gtest/include/gtest/gtest.h" |
9 #include "ui/ozone/platform/dri/crtc_controller.h" | 9 #include "ui/ozone/platform/dri/crtc_controller.h" |
10 #include "ui/ozone/platform/dri/hardware_display_controller.h" | 10 #include "ui/ozone/platform/dri/hardware_display_controller.h" |
11 #include "ui/ozone/platform/dri/hardware_display_plane.h" | 11 #include "ui/ozone/platform/dri/hardware_display_plane.h" |
12 #include "ui/ozone/platform/dri/hardware_display_plane_manager.h" | 12 #include "ui/ozone/platform/dri/hardware_display_plane_manager.h" |
13 #include "ui/ozone/platform/dri/hardware_display_plane_manager_legacy.h" | 13 #include "ui/ozone/platform/dri/hardware_display_plane_manager_legacy.h" |
14 #include "ui/ozone/platform/dri/overlay_plane.h" | 14 #include "ui/ozone/platform/dri/overlay_plane.h" |
15 #include "ui/ozone/platform/dri/scanout_buffer.h" | 15 #include "ui/ozone/platform/dri/scanout_buffer.h" |
16 #include "ui/ozone/platform/dri/test/mock_dri_wrapper.h" | 16 #include "ui/ozone/platform/dri/test/mock_drm_device.h" |
17 | 17 |
18 namespace { | 18 namespace { |
19 | 19 |
20 struct FakePlaneInfo { | 20 struct FakePlaneInfo { |
21 uint32_t id; | 21 uint32_t id; |
22 uint32_t allowed_crtc_mask; | 22 uint32_t allowed_crtc_mask; |
23 }; | 23 }; |
24 | 24 |
25 const FakePlaneInfo kOnePlanePerCrtc[] = {{10, 1}, {20, 2}}; | 25 const FakePlaneInfo kOnePlanePerCrtc[] = {{10, 1}, {20, 2}}; |
26 const FakePlaneInfo kTwoPlanesPerCrtc[] = {{10, 1}, {11, 1}, {20, 2}, {21, 2}}; | 26 const FakePlaneInfo kTwoPlanesPerCrtc[] = {{10, 1}, {11, 1}, {20, 2}, {21, 2}}; |
(...skipping 198 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
225 default_crtcs_[1], nullptr)); | 225 default_crtcs_[1], nullptr)); |
226 EXPECT_EQ(2, plane_manager_->plane_count()); | 226 EXPECT_EQ(2, plane_manager_->plane_count()); |
227 // The shared plane is now unavailable for use by the other CRTC. | 227 // The shared plane is now unavailable for use by the other CRTC. |
228 EXPECT_FALSE(plane_manager_->AssignOverlayPlanes(&state_, assigns, | 228 EXPECT_FALSE(plane_manager_->AssignOverlayPlanes(&state_, assigns, |
229 default_crtcs_[0], nullptr)); | 229 default_crtcs_[0], nullptr)); |
230 } | 230 } |
231 | 231 |
232 TEST(HardwareDisplayPlaneManagerLegacyTest, UnusedPlanesAreReleased) { | 232 TEST(HardwareDisplayPlaneManagerLegacyTest, UnusedPlanesAreReleased) { |
233 std::vector<uint32_t> crtcs; | 233 std::vector<uint32_t> crtcs; |
234 crtcs.push_back(100); | 234 crtcs.push_back(100); |
235 scoped_refptr<ui::MockDriWrapper> drm = | 235 scoped_refptr<ui::MockDrmDevice> drm = new ui::MockDrmDevice(false, crtcs, 2); |
236 new ui::MockDriWrapper(false, crtcs, 2); | |
237 ui::OverlayPlaneList assigns; | 236 ui::OverlayPlaneList assigns; |
238 scoped_refptr<FakeScanoutBuffer> fake_buffer = new FakeScanoutBuffer(); | 237 scoped_refptr<FakeScanoutBuffer> fake_buffer = new FakeScanoutBuffer(); |
239 assigns.push_back(ui::OverlayPlane(fake_buffer)); | 238 assigns.push_back(ui::OverlayPlane(fake_buffer)); |
240 assigns.push_back(ui::OverlayPlane(fake_buffer)); | 239 assigns.push_back(ui::OverlayPlane(fake_buffer)); |
241 ui::HardwareDisplayPlaneList hdpl; | 240 ui::HardwareDisplayPlaneList hdpl; |
242 ui::CrtcController crtc(drm, crtcs[0], 0); | 241 ui::CrtcController crtc(drm, crtcs[0], 0); |
243 EXPECT_TRUE(drm->plane_manager()->AssignOverlayPlanes(&hdpl, assigns, | 242 EXPECT_TRUE(drm->plane_manager()->AssignOverlayPlanes(&hdpl, assigns, |
244 crtcs[0], &crtc)); | 243 crtcs[0], &crtc)); |
245 EXPECT_TRUE(drm->plane_manager()->Commit(&hdpl, false)); | 244 EXPECT_TRUE(drm->plane_manager()->Commit(&hdpl, false)); |
246 assigns.clear(); | 245 assigns.clear(); |
247 assigns.push_back(ui::OverlayPlane(fake_buffer)); | 246 assigns.push_back(ui::OverlayPlane(fake_buffer)); |
248 EXPECT_TRUE(drm->plane_manager()->AssignOverlayPlanes(&hdpl, assigns, | 247 EXPECT_TRUE(drm->plane_manager()->AssignOverlayPlanes(&hdpl, assigns, |
249 crtcs[0], &crtc)); | 248 crtcs[0], &crtc)); |
250 EXPECT_EQ(0, drm->get_overlay_clear_call_count()); | 249 EXPECT_EQ(0, drm->get_overlay_clear_call_count()); |
251 EXPECT_TRUE(drm->plane_manager()->Commit(&hdpl, false)); | 250 EXPECT_TRUE(drm->plane_manager()->Commit(&hdpl, false)); |
252 EXPECT_EQ(1, drm->get_overlay_clear_call_count()); | 251 EXPECT_EQ(1, drm->get_overlay_clear_call_count()); |
253 } | 252 } |
254 | 253 |
255 } // namespace | 254 } // namespace |
OLD | NEW |