| 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 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 47 void SetUp() override; | 47 void SetUp() override; |
| 48 void TearDown() override; | 48 void TearDown() override; |
| 49 | 49 |
| 50 void OnSwapBuffers(gfx::SwapResult result) { | 50 void OnSwapBuffers(gfx::SwapResult result) { |
| 51 on_swap_buffers_count_++; | 51 on_swap_buffers_count_++; |
| 52 last_swap_buffers_result_ = result; | 52 last_swap_buffers_result_ = result; |
| 53 } | 53 } |
| 54 | 54 |
| 55 scoped_refptr<ui::ScanoutBuffer> ProcessBuffer(const gfx::Size& size, | 55 scoped_refptr<ui::ScanoutBuffer> ProcessBuffer(const gfx::Size& size, |
| 56 uint32_t format) { | 56 uint32_t format) { |
| 57 gfx::BufferFormat buffer_format = | 57 return buffer_generator_->Create(drm_, format, size); |
| 58 ui::GetBufferFormatFromFourCCFormat(format); | |
| 59 return buffer_generator_->Create(drm_, buffer_format, size); | |
| 60 } | 58 } |
| 61 | 59 |
| 62 scoped_refptr<ui::ScanoutBuffer> ReturnNullBuffer(const gfx::Size& size, | 60 scoped_refptr<ui::ScanoutBuffer> ReturnNullBuffer(const gfx::Size& size, |
| 63 uint32_t format) { | 61 uint32_t format) { |
| 64 return nullptr; | 62 return nullptr; |
| 65 } | 63 } |
| 66 | 64 |
| 67 protected: | 65 protected: |
| 68 std::unique_ptr<base::MessageLoop> message_loop_; | 66 std::unique_ptr<base::MessageLoop> message_loop_; |
| 69 scoped_refptr<ui::MockDrmDevice> drm_; | 67 scoped_refptr<ui::MockDrmDevice> drm_; |
| (...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 128 | 126 |
| 129 ui::OverlayCheck_Params overlay_candidate; | 127 ui::OverlayCheck_Params overlay_candidate; |
| 130 overlay_candidate.buffer_size = overlay_rect_.size(); | 128 overlay_candidate.buffer_size = overlay_rect_.size(); |
| 131 overlay_candidate.display_rect = overlay_rect_; | 129 overlay_candidate.display_rect = overlay_rect_; |
| 132 overlay_candidate.plane_z_order = 1; | 130 overlay_candidate.plane_z_order = 1; |
| 133 overlay_params_.push_back(overlay_candidate); | 131 overlay_params_.push_back(overlay_candidate); |
| 134 | 132 |
| 135 scoped_refptr<ui::DrmDevice> drm = | 133 scoped_refptr<ui::DrmDevice> drm = |
| 136 window_->GetController()->GetAllocationDrmDevice(); | 134 window_->GetController()->GetAllocationDrmDevice(); |
| 137 for (const auto& param : overlay_params_) { | 135 for (const auto& param : overlay_params_) { |
| 138 scoped_refptr<ui::ScanoutBuffer> scanout_buffer = | 136 scoped_refptr<ui::ScanoutBuffer> scanout_buffer = buffer_generator_->Create( |
| 139 buffer_generator_->Create(drm, param.format, param.buffer_size); | 137 drm, ui::GetFourCCFormatForFramebuffer(param.format), |
| 138 param.buffer_size); |
| 140 ui::OverlayPlane plane(std::move(scanout_buffer), param.plane_z_order, | 139 ui::OverlayPlane plane(std::move(scanout_buffer), param.plane_z_order, |
| 141 param.transform, param.display_rect, param.crop_rect, | 140 param.transform, param.display_rect, param.crop_rect, |
| 142 process_buffer_handler_); | 141 process_buffer_handler_); |
| 143 plane_list_.push_back(plane); | 142 plane_list_.push_back(plane); |
| 144 } | 143 } |
| 145 } | 144 } |
| 146 | 145 |
| 147 void DrmOverlayValidatorTest::TearDown() { | 146 void DrmOverlayValidatorTest::TearDown() { |
| 148 std::unique_ptr<ui::DrmWindow> window = | 147 std::unique_ptr<ui::DrmWindow> window = |
| 149 screen_manager_->RemoveWindow(kDefaultWidgetHandle); | 148 screen_manager_->RemoveWindow(kDefaultWidgetHandle); |
| (...skipping 477 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 627 plane_list.back().buffer->GetFramebufferPixelFormat()); | 626 plane_list.back().buffer->GetFramebufferPixelFormat()); |
| 628 plane_list_.back().processing_callback = base::Bind( | 627 plane_list_.back().processing_callback = base::Bind( |
| 629 &DrmOverlayValidatorTest::ReturnNullBuffer, base::Unretained(this)); | 628 &DrmOverlayValidatorTest::ReturnNullBuffer, base::Unretained(this)); |
| 630 | 629 |
| 631 plane_list = overlay_validator_->PrepareBuffersForPageFlip(plane_list_); | 630 plane_list = overlay_validator_->PrepareBuffersForPageFlip(plane_list_); |
| 632 EXPECT_EQ(plane_list_.back().buffer->GetFramebufferPixelFormat(), | 631 EXPECT_EQ(plane_list_.back().buffer->GetFramebufferPixelFormat(), |
| 633 plane_list.back().buffer->GetFramebufferPixelFormat()); | 632 plane_list.back().buffer->GetFramebufferPixelFormat()); |
| 634 plane_list_.back().processing_callback = base::Bind( | 633 plane_list_.back().processing_callback = base::Bind( |
| 635 &DrmOverlayValidatorTest::ProcessBuffer, base::Unretained(this)); | 634 &DrmOverlayValidatorTest::ProcessBuffer, base::Unretained(this)); |
| 636 } | 635 } |
| OLD | NEW |