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

Side by Side Diff: ui/ozone/platform/drm/gpu/drm_overlay_validator_unittest.cc

Issue 2896173002: ozone: introduce OverlayCheckReturn_Params (Closed)
Patch Set: refactoring Created 3 years, 6 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 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 139 matching lines...) Expand 10 before | Expand all | Expand 10 after
150 screen_manager_->RemoveWindow(kDefaultWidgetHandle); 150 screen_manager_->RemoveWindow(kDefaultWidgetHandle);
151 window->Shutdown(); 151 window->Shutdown();
152 message_loop_.reset(); 152 message_loop_.reset();
153 } 153 }
154 154
155 TEST_F(DrmOverlayValidatorTest, WindowWithNoController) { 155 TEST_F(DrmOverlayValidatorTest, WindowWithNoController) {
156 // We should never promote layers to overlay when controller is not 156 // We should never promote layers to overlay when controller is not
157 // present. 157 // present.
158 ui::HardwareDisplayController* controller = window_->GetController(); 158 ui::HardwareDisplayController* controller = window_->GetController();
159 window_->SetController(nullptr); 159 window_->SetController(nullptr);
160 std::vector<ui::OverlayCheck_Params> validated_params = 160 std::vector<ui::OverlayCheckReturn_Params> returns =
161 overlay_validator_->TestPageFlip(overlay_params_, ui::OverlayPlaneList()); 161 overlay_validator_->TestPageFlip(overlay_params_, ui::OverlayPlaneList());
162 EXPECT_FALSE(validated_params.front().is_overlay_candidate); 162 EXPECT_EQ(returns.front().status, ui::OverlayCheckReturn_Params::Status::Not);
163 EXPECT_FALSE(validated_params.back().is_overlay_candidate); 163 EXPECT_EQ(returns.back().status, ui::OverlayCheckReturn_Params::Status::Not);
164 window_->SetController(controller); 164 window_->SetController(controller);
165 } 165 }
166 166
167 TEST_F(DrmOverlayValidatorTest, DontPromoteMoreLayersThanAvailablePlanes) { 167 TEST_F(DrmOverlayValidatorTest, DontPromoteMoreLayersThanAvailablePlanes) {
168 std::vector<ui::OverlayCheck_Params> validated_params = 168 std::vector<ui::OverlayCheckReturn_Params> returns =
169 overlay_validator_->TestPageFlip(overlay_params_, ui::OverlayPlaneList()); 169 overlay_validator_->TestPageFlip(overlay_params_, ui::OverlayPlaneList());
170 EXPECT_TRUE(validated_params.front().is_overlay_candidate); 170 EXPECT_EQ(returns.front().status,
171 EXPECT_FALSE(validated_params.back().is_overlay_candidate); 171 ui::OverlayCheckReturn_Params::Status::Able);
172 EXPECT_EQ(returns.back().status, ui::OverlayCheckReturn_Params::Status::Not);
172 } 173 }
173 174
174 TEST_F(DrmOverlayValidatorTest, DontCollapseOverlayToPrimaryInFullScreen) { 175 TEST_F(DrmOverlayValidatorTest, DontCollapseOverlayToPrimaryInFullScreen) {
175 // Overlay Validator should not collapse planes during validation. 176 // Overlay Validator should not collapse planes during validation.
176 overlay_params_.back().buffer_size = primary_rect_.size(); 177 overlay_params_.back().buffer_size = primary_rect_.size();
177 overlay_params_.back().display_rect = primary_rect_; 178 overlay_params_.back().display_rect = primary_rect_;
178 plane_list_.back().display_bounds = primary_rect_; 179 plane_list_.back().display_bounds = primary_rect_;
179 180
180 std::vector<ui::OverlayCheck_Params> validated_params = 181 std::vector<ui::OverlayCheckReturn_Params> returns =
181 overlay_validator_->TestPageFlip(overlay_params_, ui::OverlayPlaneList()); 182 overlay_validator_->TestPageFlip(overlay_params_, ui::OverlayPlaneList());
182 // Second candidate should be marked as Invalid as we have only one plane 183 // Second candidate should be marked as Invalid as we have only one plane
183 // per CRTC. 184 // per CRTC.
184 EXPECT_TRUE(validated_params.front().is_overlay_candidate); 185 EXPECT_EQ(returns.front().status,
185 EXPECT_FALSE(validated_params.back().is_overlay_candidate); 186 ui::OverlayCheckReturn_Params::Status::Able);
187 EXPECT_EQ(returns.back().status, ui::OverlayCheckReturn_Params::Status::Not);
186 } 188 }
187 189
188 TEST_F(DrmOverlayValidatorTest, ClearCacheOnReset) { 190 TEST_F(DrmOverlayValidatorTest, ClearCacheOnReset) {
189 // This test checks if we invalidate cache when Reset is called. 191 // This test checks if we invalidate cache when Reset is called.
190 overlay_params_.back().buffer_size = overlay_rect_.size(); 192 overlay_params_.back().buffer_size = overlay_rect_.size();
191 overlay_params_.back().display_rect = overlay_rect_; 193 overlay_params_.back().display_rect = overlay_rect_;
192 plane_list_.back().display_bounds = overlay_rect_; 194 plane_list_.back().display_bounds = overlay_rect_;
193 std::vector<uint32_t> xrgb_yuv_packed_formats = {DRM_FORMAT_XRGB8888, 195 std::vector<uint32_t> xrgb_yuv_packed_formats = {DRM_FORMAT_XRGB8888,
194 DRM_FORMAT_UYVY}; 196 DRM_FORMAT_UYVY};
195 197
(...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after
307 309
308 std::vector<uint32_t> xrgb_yuv_packed_formats = {DRM_FORMAT_XRGB8888, 310 std::vector<uint32_t> xrgb_yuv_packed_formats = {DRM_FORMAT_XRGB8888,
309 DRM_FORMAT_UYVY}; 311 DRM_FORMAT_UYVY};
310 ui::FakePlaneInfo primary_plane_info( 312 ui::FakePlaneInfo primary_plane_info(
311 100, 1 << 0, std::vector<uint32_t>(1, DRM_FORMAT_XRGB8888)); 313 100, 1 << 0, std::vector<uint32_t>(1, DRM_FORMAT_XRGB8888));
312 ui::FakePlaneInfo overlay_info(101, 1 << 0, xrgb_yuv_packed_formats); 314 ui::FakePlaneInfo overlay_info(101, 1 << 0, xrgb_yuv_packed_formats);
313 std::vector<ui::FakePlaneInfo> planes_info{primary_plane_info, overlay_info}; 315 std::vector<ui::FakePlaneInfo> planes_info{primary_plane_info, overlay_info};
314 plane_manager_->SetPlaneProperties(planes_info); 316 plane_manager_->SetPlaneProperties(planes_info);
315 overlay_validator_->ClearCache(); 317 overlay_validator_->ClearCache();
316 318
317 std::vector<ui::OverlayCheck_Params> validated_params = 319 std::vector<ui::OverlayCheckReturn_Params> returns =
318 overlay_validator_->TestPageFlip(overlay_params_, ui::OverlayPlaneList()); 320 overlay_validator_->TestPageFlip(overlay_params_, ui::OverlayPlaneList());
319 321
320 for (const auto& param : validated_params) 322 for (const auto& param : returns)
321 EXPECT_TRUE(param.is_overlay_candidate); 323 EXPECT_EQ(param.status, ui::OverlayCheckReturn_Params::Status::Able);
322 324
323 EXPECT_EQ(3, plane_manager_->plane_count()); 325 EXPECT_EQ(3, plane_manager_->plane_count());
324 326
325 ui::OverlayPlaneList plane_list = 327 ui::OverlayPlaneList plane_list =
326 overlay_validator_->PrepareBuffersForPageFlip(plane_list_); 328 overlay_validator_->PrepareBuffersForPageFlip(plane_list_);
327 EXPECT_EQ(DRM_FORMAT_XRGB8888, 329 EXPECT_EQ(DRM_FORMAT_XRGB8888,
328 plane_list.back().buffer->GetFramebufferPixelFormat()); 330 plane_list.back().buffer->GetFramebufferPixelFormat());
329 } 331 }
330 332
331 TEST_F(DrmOverlayValidatorTest, OverlayPreferredFormat_YUV) { 333 TEST_F(DrmOverlayValidatorTest, OverlayPreferredFormat_YUV) {
(...skipping 10 matching lines...) Expand all
342 344
343 std::vector<uint32_t> xrgb_yuv_packed_formats = {DRM_FORMAT_XRGB8888, 345 std::vector<uint32_t> xrgb_yuv_packed_formats = {DRM_FORMAT_XRGB8888,
344 DRM_FORMAT_UYVY}; 346 DRM_FORMAT_UYVY};
345 ui::FakePlaneInfo primary_plane_info( 347 ui::FakePlaneInfo primary_plane_info(
346 100, 1 << 0, std::vector<uint32_t>(1, DRM_FORMAT_XRGB8888)); 348 100, 1 << 0, std::vector<uint32_t>(1, DRM_FORMAT_XRGB8888));
347 ui::FakePlaneInfo overlay_info(101, 1 << 0, xrgb_yuv_packed_formats); 349 ui::FakePlaneInfo overlay_info(101, 1 << 0, xrgb_yuv_packed_formats);
348 std::vector<ui::FakePlaneInfo> planes_info{primary_plane_info, overlay_info}; 350 std::vector<ui::FakePlaneInfo> planes_info{primary_plane_info, overlay_info};
349 plane_manager_->SetPlaneProperties(planes_info); 351 plane_manager_->SetPlaneProperties(planes_info);
350 overlay_validator_->ClearCache(); 352 overlay_validator_->ClearCache();
351 353
352 std::vector<ui::OverlayCheck_Params> validated_params = 354 std::vector<ui::OverlayCheckReturn_Params> returns =
353 overlay_validator_->TestPageFlip(overlay_params_, ui::OverlayPlaneList()); 355 overlay_validator_->TestPageFlip(overlay_params_, ui::OverlayPlaneList());
354 356
355 for (const auto& param : validated_params) 357 for (const auto& param : returns)
356 EXPECT_TRUE(param.is_overlay_candidate); 358 EXPECT_EQ(param.status, ui::OverlayCheckReturn_Params::Status::Able);
357 359
358 EXPECT_EQ(5, plane_manager_->plane_count()); 360 EXPECT_EQ(5, plane_manager_->plane_count());
359 361
360 ui::OverlayPlaneList plane_list = 362 ui::OverlayPlaneList plane_list =
361 overlay_validator_->PrepareBuffersForPageFlip(plane_list_); 363 overlay_validator_->PrepareBuffersForPageFlip(plane_list_);
362 EXPECT_EQ(DRM_FORMAT_UYVY, 364 EXPECT_EQ(DRM_FORMAT_UYVY,
363 plane_list.back().buffer->GetFramebufferPixelFormat()); 365 plane_list.back().buffer->GetFramebufferPixelFormat());
364 } 366 }
365 367
366 TEST_F(DrmOverlayValidatorTest, OverlayPreferredFormat_XRGB) { 368 TEST_F(DrmOverlayValidatorTest, OverlayPreferredFormat_XRGB) {
367 plane_manager_->ResetPlaneCount(); 369 plane_manager_->ResetPlaneCount();
368 // This test checks for optimal format in case of non full screen video case. 370 // This test checks for optimal format in case of non full screen video case.
369 // This should be XRGB when overlay doesn't support YUV. 371 // This should be XRGB when overlay doesn't support YUV.
370 overlay_params_.back().buffer_size = overlay_rect_.size(); 372 overlay_params_.back().buffer_size = overlay_rect_.size();
371 overlay_params_.back().display_rect = overlay_rect_; 373 overlay_params_.back().display_rect = overlay_rect_;
372 plane_list_.back().display_bounds = overlay_rect_; 374 plane_list_.back().display_bounds = overlay_rect_;
373 375
374 std::vector<uint32_t> xrgb_yuv_packed_formats = {DRM_FORMAT_XRGB8888, 376 std::vector<uint32_t> xrgb_yuv_packed_formats = {DRM_FORMAT_XRGB8888,
375 DRM_FORMAT_UYVY}; 377 DRM_FORMAT_UYVY};
376 ui::FakePlaneInfo primary_plane_info(100, 1 << 0, xrgb_yuv_packed_formats); 378 ui::FakePlaneInfo primary_plane_info(100, 1 << 0, xrgb_yuv_packed_formats);
377 ui::FakePlaneInfo overlay_info(101, 1 << 0, 379 ui::FakePlaneInfo overlay_info(101, 1 << 0,
378 std::vector<uint32_t>(1, DRM_FORMAT_XRGB8888)); 380 std::vector<uint32_t>(1, DRM_FORMAT_XRGB8888));
379 std::vector<ui::FakePlaneInfo> planes_info{primary_plane_info, overlay_info}; 381 std::vector<ui::FakePlaneInfo> planes_info{primary_plane_info, overlay_info};
380 plane_manager_->SetPlaneProperties(planes_info); 382 plane_manager_->SetPlaneProperties(planes_info);
381 overlay_validator_->ClearCache(); 383 overlay_validator_->ClearCache();
382 384
383 std::vector<ui::OverlayCheck_Params> validated_params = 385 std::vector<ui::OverlayCheckReturn_Params> returns =
384 overlay_validator_->TestPageFlip(overlay_params_, ui::OverlayPlaneList()); 386 overlay_validator_->TestPageFlip(overlay_params_, ui::OverlayPlaneList());
385 ui::OverlayPlaneList plane_list = 387 ui::OverlayPlaneList plane_list =
386 overlay_validator_->PrepareBuffersForPageFlip(plane_list_); 388 overlay_validator_->PrepareBuffersForPageFlip(plane_list_);
387 EXPECT_EQ(DRM_FORMAT_XRGB8888, 389 EXPECT_EQ(DRM_FORMAT_XRGB8888,
388 plane_list.back().buffer->GetFramebufferPixelFormat()); 390 plane_list.back().buffer->GetFramebufferPixelFormat());
389 EXPECT_EQ(3, plane_manager_->plane_count()); 391 EXPECT_EQ(3, plane_manager_->plane_count());
390 for (const auto& param : validated_params) 392 for (const auto& param : returns)
391 EXPECT_TRUE(param.is_overlay_candidate); 393 EXPECT_EQ(param.status, ui::OverlayCheckReturn_Params::Status::Able);
392 } 394 }
393 395
394 TEST_F(DrmOverlayValidatorTest, RejectYUVBuffersIfNotSupported) { 396 TEST_F(DrmOverlayValidatorTest, RejectYUVBuffersIfNotSupported) {
395 plane_manager_->ResetPlaneCount(); 397 plane_manager_->ResetPlaneCount();
396 // Check case where buffer storage format is already UYVY but planes dont 398 // Check case where buffer storage format is already UYVY but planes dont
397 // support it. 399 // support it.
398 overlay_params_.back().buffer_size = overlay_rect_.size(); 400 overlay_params_.back().buffer_size = overlay_rect_.size();
399 overlay_params_.back().display_rect = overlay_rect_; 401 overlay_params_.back().display_rect = overlay_rect_;
400 plane_list_.back().display_bounds = overlay_rect_; 402 plane_list_.back().display_bounds = overlay_rect_;
401 403
402 std::vector<uint32_t> xrgb_yuv_packed_formats = {DRM_FORMAT_XRGB8888, 404 std::vector<uint32_t> xrgb_yuv_packed_formats = {DRM_FORMAT_XRGB8888,
403 DRM_FORMAT_UYVY}; 405 DRM_FORMAT_UYVY};
404 ui::FakePlaneInfo primary_plane_info(100, 1 << 0, xrgb_yuv_packed_formats); 406 ui::FakePlaneInfo primary_plane_info(100, 1 << 0, xrgb_yuv_packed_formats);
405 ui::FakePlaneInfo overlay_info(101, 1 << 0, 407 ui::FakePlaneInfo overlay_info(101, 1 << 0,
406 std::vector<uint32_t>(1, DRM_FORMAT_XRGB8888)); 408 std::vector<uint32_t>(1, DRM_FORMAT_XRGB8888));
407 std::vector<ui::FakePlaneInfo> planes_info{primary_plane_info, overlay_info}; 409 std::vector<ui::FakePlaneInfo> planes_info{primary_plane_info, overlay_info};
408 plane_manager_->SetPlaneProperties(planes_info); 410 plane_manager_->SetPlaneProperties(planes_info);
409 overlay_validator_->ClearCache(); 411 overlay_validator_->ClearCache();
410 412
411 std::vector<ui::OverlayCheck_Params> validated_params = overlay_params_; 413 std::vector<ui::OverlayCheck_Params> validated_params = overlay_params_;
412 validated_params.back().format = gfx::BufferFormat::UYVY_422; 414 validated_params.back().format = gfx::BufferFormat::UYVY_422;
413 plane_manager_->ResetPlaneCount(); 415 plane_manager_->ResetPlaneCount();
414 validated_params = overlay_validator_->TestPageFlip(validated_params, 416 std::vector<ui::OverlayCheckReturn_Params> returns =
415 ui::OverlayPlaneList()); 417 overlay_validator_->TestPageFlip(validated_params,
418 ui::OverlayPlaneList());
416 419
417 EXPECT_FALSE(validated_params.back().is_overlay_candidate); 420 EXPECT_EQ(returns.back().status, ui::OverlayCheckReturn_Params::Status::Not);
418 } 421 }
419 422
420 TEST_F(DrmOverlayValidatorTest, 423 TEST_F(DrmOverlayValidatorTest,
421 RejectYUVBuffersIfNotSupported_MirroredControllers) { 424 RejectYUVBuffersIfNotSupported_MirroredControllers) {
422 std::vector<uint32_t> crtcs{kDefaultCrtc, kSecondaryCrtc}; 425 std::vector<uint32_t> crtcs{kDefaultCrtc, kSecondaryCrtc};
423 plane_manager_->SetCrtcInfo(crtcs); 426 plane_manager_->SetCrtcInfo(crtcs);
424 427
425 std::vector<uint32_t> only_rgb_format{DRM_FORMAT_XRGB8888}; 428 std::vector<uint32_t> only_rgb_format{DRM_FORMAT_XRGB8888};
426 std::vector<uint32_t> xrgb_yuv_packed_formats{DRM_FORMAT_XRGB8888, 429 std::vector<uint32_t> xrgb_yuv_packed_formats{DRM_FORMAT_XRGB8888,
427 DRM_FORMAT_UYVY}; 430 DRM_FORMAT_UYVY};
(...skipping 19 matching lines...) Expand all
447 450
448 std::vector<ui::FakePlaneInfo> planes_info{ 451 std::vector<ui::FakePlaneInfo> planes_info{
449 primary_crtc_primary_plane, primary_crtc_overlay, 452 primary_crtc_primary_plane, primary_crtc_overlay,
450 secondary_crtc_primary_plane, secondary_crtc_overlay}; 453 secondary_crtc_primary_plane, secondary_crtc_overlay};
451 plane_manager_->SetPlaneProperties(planes_info); 454 plane_manager_->SetPlaneProperties(planes_info);
452 overlay_validator_->ClearCache(); 455 overlay_validator_->ClearCache();
453 456
454 std::vector<ui::OverlayCheck_Params> validated_params = overlay_params_; 457 std::vector<ui::OverlayCheck_Params> validated_params = overlay_params_;
455 validated_params.back().format = gfx::BufferFormat::UYVY_422; 458 validated_params.back().format = gfx::BufferFormat::UYVY_422;
456 plane_manager_->ResetPlaneCount(); 459 plane_manager_->ResetPlaneCount();
457 validated_params = overlay_validator_->TestPageFlip(validated_params, 460 std::vector<ui::OverlayCheckReturn_Params> returns =
458 ui::OverlayPlaneList()); 461 overlay_validator_->TestPageFlip(validated_params,
462 ui::OverlayPlaneList());
459 463
460 EXPECT_TRUE(validated_params.back().is_overlay_candidate); 464 EXPECT_EQ(returns.back().status, ui::OverlayCheckReturn_Params::Status::Able);
461 465
462 // Both controllers have Overlay which support DRM_FORMAT_UYVY, and scaling is 466 // Both controllers have Overlay which support DRM_FORMAT_UYVY, and scaling is
463 // needed, hence this should be picked as the optimal format. 467 // needed, hence this should be picked as the optimal format.
464 ui::OverlayPlaneList plane_list = 468 ui::OverlayPlaneList plane_list =
465 overlay_validator_->PrepareBuffersForPageFlip(plane_list_); 469 overlay_validator_->PrepareBuffersForPageFlip(plane_list_);
466 EXPECT_EQ(DRM_FORMAT_UYVY, 470 EXPECT_EQ(DRM_FORMAT_UYVY,
467 plane_list.back().buffer->GetFramebufferPixelFormat()); 471 plane_list.back().buffer->GetFramebufferPixelFormat());
468 472
469 // This configuration should not be promoted to Overlay when either of the 473 // This configuration should not be promoted to Overlay when either of the
470 // controllers dont support UYVY format. 474 // controllers dont support UYVY format.
471 475
472 // Check case where we dont have support for packed formats in Mirrored CRTC. 476 // Check case where we dont have support for packed formats in Mirrored CRTC.
473 planes_info.back().allowed_formats = only_rgb_format; 477 planes_info.back().allowed_formats = only_rgb_format;
474 plane_manager_->SetPlaneProperties(planes_info); 478 plane_manager_->SetPlaneProperties(planes_info);
475 overlay_validator_->ClearCache(); 479 overlay_validator_->ClearCache();
476 480
477 validated_params = overlay_validator_->TestPageFlip(validated_params, 481 returns = overlay_validator_->TestPageFlip(validated_params,
478 ui::OverlayPlaneList()); 482 ui::OverlayPlaneList());
479 EXPECT_FALSE(validated_params.back().is_overlay_candidate); 483 EXPECT_EQ(returns.back().status, ui::OverlayCheckReturn_Params::Status::Not);
480 484
481 // Check case where we dont have support for packed formats in primary 485 // Check case where we dont have support for packed formats in primary
482 // display. 486 // display.
483 planes_info.back().allowed_formats = xrgb_yuv_packed_formats; 487 planes_info.back().allowed_formats = xrgb_yuv_packed_formats;
484 planes_info[1].allowed_formats = only_rgb_format; 488 planes_info[1].allowed_formats = only_rgb_format;
485 plane_manager_->SetPlaneProperties(planes_info); 489 plane_manager_->SetPlaneProperties(planes_info);
486 overlay_validator_->ClearCache(); 490 overlay_validator_->ClearCache();
487 491
488 validated_params = overlay_validator_->TestPageFlip(validated_params, 492 returns = overlay_validator_->TestPageFlip(validated_params,
489 ui::OverlayPlaneList()); 493 ui::OverlayPlaneList());
490 EXPECT_FALSE(validated_params.back().is_overlay_candidate); 494 EXPECT_EQ(returns.back().status, ui::OverlayCheckReturn_Params::Status::Not);
491 controller->RemoveCrtc(drm_, kSecondaryCrtc); 495 controller->RemoveCrtc(drm_, kSecondaryCrtc);
492 } 496 }
493 497
494 TEST_F(DrmOverlayValidatorTest, OptimalFormatYUV_MirroredControllers) { 498 TEST_F(DrmOverlayValidatorTest, OptimalFormatYUV_MirroredControllers) {
495 std::vector<uint32_t> crtcs{kDefaultCrtc, kSecondaryCrtc}; 499 std::vector<uint32_t> crtcs{kDefaultCrtc, kSecondaryCrtc};
496 plane_manager_->SetCrtcInfo(crtcs); 500 plane_manager_->SetCrtcInfo(crtcs);
497 overlay_validator_->ClearCache(); 501 overlay_validator_->ClearCache();
498 502
499 ui::HardwareDisplayController* controller = window_->GetController(); 503 ui::HardwareDisplayController* controller = window_->GetController();
500 controller->AddCrtc(std::unique_ptr<ui::CrtcController>( 504 controller->AddCrtc(std::unique_ptr<ui::CrtcController>(
(...skipping 15 matching lines...) Expand all
516 ui::FakePlaneInfo secondary_crtc_overlay(103, 1 << 1, 520 ui::FakePlaneInfo secondary_crtc_overlay(103, 1 << 1,
517 xrgb_yuv_packed_formats); 521 xrgb_yuv_packed_formats);
518 522
519 std::vector<ui::FakePlaneInfo> planes_info{ 523 std::vector<ui::FakePlaneInfo> planes_info{
520 primary_crtc_primary_plane, primary_crtc_overlay, 524 primary_crtc_primary_plane, primary_crtc_overlay,
521 secondary_crtc_primary_plane, secondary_crtc_overlay}; 525 secondary_crtc_primary_plane, secondary_crtc_overlay};
522 plane_manager_->SetPlaneProperties(planes_info); 526 plane_manager_->SetPlaneProperties(planes_info);
523 overlay_validator_->ClearCache(); 527 overlay_validator_->ClearCache();
524 528
525 plane_manager_->ResetPlaneCount(); 529 plane_manager_->ResetPlaneCount();
526 std::vector<ui::OverlayCheck_Params> validated_params = 530 std::vector<ui::OverlayCheckReturn_Params> returns =
527 overlay_validator_->TestPageFlip(overlay_params_, ui::OverlayPlaneList()); 531 overlay_validator_->TestPageFlip(overlay_params_, ui::OverlayPlaneList());
528 532
529 EXPECT_TRUE(validated_params.back().is_overlay_candidate); 533 EXPECT_EQ(returns.back().status, ui::OverlayCheckReturn_Params::Status::Able);
530 ui::OverlayPlaneList plane_list = 534 ui::OverlayPlaneList plane_list =
531 overlay_validator_->PrepareBuffersForPageFlip(plane_list_); 535 overlay_validator_->PrepareBuffersForPageFlip(plane_list_);
532 EXPECT_EQ(DRM_FORMAT_XRGB8888, 536 EXPECT_EQ(DRM_FORMAT_XRGB8888,
533 plane_list.back().buffer->GetFramebufferPixelFormat()); 537 plane_list.back().buffer->GetFramebufferPixelFormat());
534 538
535 // Check case where we dont have support for packed formats in Mirrored CRTC. 539 // Check case where we dont have support for packed formats in Mirrored CRTC.
536 planes_info.back().allowed_formats = only_rgb_format; 540 planes_info.back().allowed_formats = only_rgb_format;
537 plane_manager_->SetPlaneProperties(planes_info); 541 plane_manager_->SetPlaneProperties(planes_info);
538 overlay_validator_->ClearCache(); 542 overlay_validator_->ClearCache();
539 543
540 validated_params = 544 returns =
541 overlay_validator_->TestPageFlip(overlay_params_, ui::OverlayPlaneList()); 545 overlay_validator_->TestPageFlip(overlay_params_, ui::OverlayPlaneList());
542 EXPECT_TRUE(validated_params.back().is_overlay_candidate); 546 EXPECT_EQ(returns.back().status, ui::OverlayCheckReturn_Params::Status::Able);
543 547
544 plane_list = overlay_validator_->PrepareBuffersForPageFlip(plane_list_); 548 plane_list = overlay_validator_->PrepareBuffersForPageFlip(plane_list_);
545 EXPECT_EQ(DRM_FORMAT_XRGB8888, 549 EXPECT_EQ(DRM_FORMAT_XRGB8888,
546 plane_list.back().buffer->GetFramebufferPixelFormat()); 550 plane_list.back().buffer->GetFramebufferPixelFormat());
547 551
548 // Check case where we dont have support for packed formats in primary 552 // Check case where we dont have support for packed formats in primary
549 // display. 553 // display.
550 planes_info.back().allowed_formats = xrgb_yuv_packed_formats; 554 planes_info.back().allowed_formats = xrgb_yuv_packed_formats;
551 planes_info[1].allowed_formats = only_rgb_format; 555 planes_info[1].allowed_formats = only_rgb_format;
552 plane_manager_->SetPlaneProperties(planes_info); 556 plane_manager_->SetPlaneProperties(planes_info);
553 overlay_validator_->ClearCache(); 557 overlay_validator_->ClearCache();
554 558
555 validated_params = 559 returns =
556 overlay_validator_->TestPageFlip(overlay_params_, ui::OverlayPlaneList()); 560 overlay_validator_->TestPageFlip(overlay_params_, ui::OverlayPlaneList());
557 EXPECT_TRUE(validated_params.back().is_overlay_candidate); 561 EXPECT_EQ(returns.back().status, ui::OverlayCheckReturn_Params::Status::Able);
558 562
559 plane_list = overlay_validator_->PrepareBuffersForPageFlip(plane_list_); 563 plane_list = overlay_validator_->PrepareBuffersForPageFlip(plane_list_);
560 EXPECT_EQ(DRM_FORMAT_XRGB8888, 564 EXPECT_EQ(DRM_FORMAT_XRGB8888,
561 plane_list.back().buffer->GetFramebufferPixelFormat()); 565 plane_list.back().buffer->GetFramebufferPixelFormat());
562 controller->RemoveCrtc(drm_, kSecondaryCrtc); 566 controller->RemoveCrtc(drm_, kSecondaryCrtc);
563 } 567 }
564 568
565 TEST_F(DrmOverlayValidatorTest, OptimizeOnlyIfProcessingCallbackPresent) { 569 TEST_F(DrmOverlayValidatorTest, OptimizeOnlyIfProcessingCallbackPresent) {
566 // This test checks that we dont manipulate overlay buffers in case Processing 570 // This test checks that we dont manipulate overlay buffers in case Processing
567 // callback is not present. 571 // callback is not present.
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after
629 plane_list.back().buffer->GetFramebufferPixelFormat()); 633 plane_list.back().buffer->GetFramebufferPixelFormat());
630 plane_list_.back().processing_callback = base::Bind( 634 plane_list_.back().processing_callback = base::Bind(
631 &DrmOverlayValidatorTest::ProcessBuffer, base::Unretained(this)); 635 &DrmOverlayValidatorTest::ProcessBuffer, base::Unretained(this));
632 } 636 }
633 637
634 TEST_F(DrmOverlayValidatorTest, RejectBufferAllocationFail) { 638 TEST_F(DrmOverlayValidatorTest, RejectBufferAllocationFail) {
635 // Buffer allocation for scanout might fail. 639 // Buffer allocation for scanout might fail.
636 // In that case we should reject the overlay candidate. 640 // In that case we should reject the overlay candidate.
637 buffer_generator_->set_allocation_failure(true); 641 buffer_generator_->set_allocation_failure(true);
638 642
639 std::vector<ui::OverlayCheck_Params> validated_params = 643 std::vector<ui::OverlayCheckReturn_Params> returns =
640 overlay_validator_->TestPageFlip(overlay_params_, ui::OverlayPlaneList()); 644 overlay_validator_->TestPageFlip(overlay_params_, ui::OverlayPlaneList());
641 EXPECT_FALSE(validated_params.front().is_overlay_candidate); 645 EXPECT_EQ(returns.front().status, ui::OverlayCheckReturn_Params::Status::Not);
642 } 646 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698