| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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/gpu/drm_overlay_validator.h" | 5 #include "ui/ozone/platform/drm/gpu/drm_overlay_validator.h" |
| 6 | 6 |
| 7 #include <drm_fourcc.h> | 7 #include <drm_fourcc.h> |
| 8 | 8 |
| 9 #include <memory> | 9 #include <memory> |
| 10 #include <utility> | 10 #include <utility> |
| (...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 115 new ui::DrmOverlayValidator(window_, buffer_generator_.get())); | 115 new ui::DrmOverlayValidator(window_, buffer_generator_.get())); |
| 116 | 116 |
| 117 overlay_rect_ = | 117 overlay_rect_ = |
| 118 gfx::Rect(0, 0, kDefaultMode.hdisplay / 2, kDefaultMode.vdisplay / 2); | 118 gfx::Rect(0, 0, kDefaultMode.hdisplay / 2, kDefaultMode.vdisplay / 2); |
| 119 | 119 |
| 120 primary_rect_ = gfx::Rect(0, 0, kDefaultMode.hdisplay, kDefaultMode.vdisplay); | 120 primary_rect_ = gfx::Rect(0, 0, kDefaultMode.hdisplay, kDefaultMode.vdisplay); |
| 121 | 121 |
| 122 ui::OverlayCheck_Params primary_candidate; | 122 ui::OverlayCheck_Params primary_candidate; |
| 123 primary_candidate.buffer_size = primary_rect_.size(); | 123 primary_candidate.buffer_size = primary_rect_.size(); |
| 124 primary_candidate.display_rect = primary_rect_; | 124 primary_candidate.display_rect = primary_rect_; |
| 125 primary_candidate.format = gfx::BufferFormat::BGRX_8888; |
| 125 overlay_params_.push_back(primary_candidate); | 126 overlay_params_.push_back(primary_candidate); |
| 126 | 127 |
| 127 ui::OverlayCheck_Params overlay_candidate; | 128 ui::OverlayCheck_Params overlay_candidate; |
| 128 overlay_candidate.buffer_size = overlay_rect_.size(); | 129 overlay_candidate.buffer_size = overlay_rect_.size(); |
| 129 overlay_candidate.display_rect = overlay_rect_; | 130 overlay_candidate.display_rect = overlay_rect_; |
| 130 overlay_candidate.plane_z_order = 1; | 131 overlay_candidate.plane_z_order = 1; |
| 132 overlay_candidate.format = gfx::BufferFormat::BGRX_8888; |
| 131 overlay_params_.push_back(overlay_candidate); | 133 overlay_params_.push_back(overlay_candidate); |
| 132 | 134 |
| 133 scoped_refptr<ui::DrmDevice> drm = | 135 scoped_refptr<ui::DrmDevice> drm = |
| 134 window_->GetController()->GetAllocationDrmDevice(); | 136 window_->GetController()->GetAllocationDrmDevice(); |
| 135 for (const auto& param : overlay_params_) { | 137 for (const auto& param : overlay_params_) { |
| 136 scoped_refptr<ui::ScanoutBuffer> scanout_buffer = buffer_generator_->Create( | 138 scoped_refptr<ui::ScanoutBuffer> scanout_buffer = buffer_generator_->Create( |
| 137 drm, ui::GetFourCCFormatForFramebuffer(param.format), | 139 drm, ui::GetFourCCFormatFromBufferFormat(param.format), |
| 138 param.buffer_size); | 140 param.buffer_size); |
| 139 ui::OverlayPlane plane(std::move(scanout_buffer), param.plane_z_order, | 141 ui::OverlayPlane plane(std::move(scanout_buffer), param.plane_z_order, |
| 140 param.transform, param.display_rect, param.crop_rect, | 142 param.transform, param.display_rect, param.crop_rect, |
| 141 process_buffer_handler_); | 143 process_buffer_handler_); |
| 142 plane_list_.push_back(plane); | 144 plane_list_.push_back(plane); |
| 143 } | 145 } |
| 144 } | 146 } |
| 145 | 147 |
| 146 void DrmOverlayValidatorTest::TearDown() { | 148 void DrmOverlayValidatorTest::TearDown() { |
| 147 std::unique_ptr<ui::DrmWindow> window = | 149 std::unique_ptr<ui::DrmWindow> window = |
| (...skipping 483 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 631 | 633 |
| 632 TEST_F(DrmOverlayValidatorTest, RejectBufferAllocationFail) { | 634 TEST_F(DrmOverlayValidatorTest, RejectBufferAllocationFail) { |
| 633 // Buffer allocation for scanout might fail. | 635 // Buffer allocation for scanout might fail. |
| 634 // In that case we should reject the overlay candidate. | 636 // In that case we should reject the overlay candidate. |
| 635 buffer_generator_->set_allocation_failure(true); | 637 buffer_generator_->set_allocation_failure(true); |
| 636 | 638 |
| 637 std::vector<ui::OverlayCheck_Params> validated_params = | 639 std::vector<ui::OverlayCheck_Params> validated_params = |
| 638 overlay_validator_->TestPageFlip(overlay_params_, ui::OverlayPlaneList()); | 640 overlay_validator_->TestPageFlip(overlay_params_, ui::OverlayPlaneList()); |
| 639 EXPECT_FALSE(validated_params.front().is_overlay_candidate); | 641 EXPECT_FALSE(validated_params.front().is_overlay_candidate); |
| 640 } | 642 } |
| OLD | NEW |