| 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/gpu/drm_window.h" | 5 #include "ui/ozone/platform/drm/gpu/drm_window.h" |
| 6 | 6 |
| 7 #include <drm_fourcc.h> |
| 7 #include <stdint.h> | 8 #include <stdint.h> |
| 8 | 9 |
| 9 #include <memory> | 10 #include <memory> |
| 10 #include <utility> | 11 #include <utility> |
| 11 #include <vector> | 12 #include <vector> |
| 12 | 13 |
| 13 #include "base/macros.h" | 14 #include "base/macros.h" |
| 14 #include "base/message_loop/message_loop.h" | 15 #include "base/message_loop/message_loop.h" |
| 15 #include "testing/gtest/include/gtest/gtest.h" | 16 #include "testing/gtest/include/gtest/gtest.h" |
| 16 #include "third_party/skia/include/core/SkCanvas.h" | 17 #include "third_party/skia/include/core/SkCanvas.h" |
| (...skipping 145 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 162 EXPECT_EQ(2u, GetCursorBuffers(drm).size()); | 163 EXPECT_EQ(2u, GetCursorBuffers(drm).size()); |
| 163 // Make sure the cursor is showing on the new display. | 164 // Make sure the cursor is showing on the new display. |
| 164 EXPECT_NE(0u, drm->get_cursor_handle_for_crtc(kDefaultCrtc)); | 165 EXPECT_NE(0u, drm->get_cursor_handle_for_crtc(kDefaultCrtc)); |
| 165 } | 166 } |
| 166 | 167 |
| 167 TEST_F(DrmWindowTest, CheckCallbackOnFailedSwap) { | 168 TEST_F(DrmWindowTest, CheckCallbackOnFailedSwap) { |
| 168 const gfx::Size window_size(6, 4); | 169 const gfx::Size window_size(6, 4); |
| 169 ui::MockDumbBufferGenerator buffer_generator; | 170 ui::MockDumbBufferGenerator buffer_generator; |
| 170 ui::DrmWindow* window = screen_manager_->GetWindow(kDefaultWidgetHandle); | 171 ui::DrmWindow* window = screen_manager_->GetWindow(kDefaultWidgetHandle); |
| 171 ui::OverlayPlane plane( | 172 ui::OverlayPlane plane( |
| 172 buffer_generator.Create(drm_, gfx::BufferFormat::BGRX_8888, window_size)); | 173 buffer_generator.Create(drm_, DRM_FORMAT_XRGB8888, window_size)); |
| 173 | 174 |
| 174 drm_->set_page_flip_expectation(false); | 175 drm_->set_page_flip_expectation(false); |
| 175 | 176 |
| 176 // Window was re-sized, so the expectation is to re-create the buffers first. | 177 // Window was re-sized, so the expectation is to re-create the buffers first. |
| 177 window->SchedulePageFlip( | 178 window->SchedulePageFlip( |
| 178 std::vector<ui::OverlayPlane>(1, ui::OverlayPlane(plane)), | 179 std::vector<ui::OverlayPlane>(1, ui::OverlayPlane(plane)), |
| 179 base::Bind(&DrmWindowTest::OnSwapBuffers, base::Unretained(this))); | 180 base::Bind(&DrmWindowTest::OnSwapBuffers, base::Unretained(this))); |
| 180 EXPECT_EQ(1, on_swap_buffers_count_); | 181 EXPECT_EQ(1, on_swap_buffers_count_); |
| 181 EXPECT_EQ(gfx::SwapResult::SWAP_NAK_RECREATE_BUFFERS, | 182 EXPECT_EQ(gfx::SwapResult::SWAP_NAK_RECREATE_BUFFERS, |
| 182 last_swap_buffers_result_); | 183 last_swap_buffers_result_); |
| 183 | 184 |
| 184 window->SchedulePageFlip( | 185 window->SchedulePageFlip( |
| 185 std::vector<ui::OverlayPlane>(1, ui::OverlayPlane(plane)), | 186 std::vector<ui::OverlayPlane>(1, ui::OverlayPlane(plane)), |
| 186 base::Bind(&DrmWindowTest::OnSwapBuffers, base::Unretained(this))); | 187 base::Bind(&DrmWindowTest::OnSwapBuffers, base::Unretained(this))); |
| 187 EXPECT_EQ(2, on_swap_buffers_count_); | 188 EXPECT_EQ(2, on_swap_buffers_count_); |
| 188 EXPECT_EQ(gfx::SwapResult::SWAP_FAILED, last_swap_buffers_result_); | 189 EXPECT_EQ(gfx::SwapResult::SWAP_FAILED, last_swap_buffers_result_); |
| 189 } | 190 } |
| OLD | NEW |