Skip to content

Commit

Permalink
cc: Allow overlay candidates with transforms.
Browse files Browse the repository at this point in the history
After https://codereview.chromium.org/2789363004 landed, Ozone Drm
supports the KMS "rotation" property that can be used to set a transform
to HW overlays.

This CL relaxes the transform restrictions of the fullscreen and
single on top overlay strategies.

Additionally, it makes sure that any configuration containing a transform
will be reject if the legacy page flip is being used.

After this CL WebGL and Pepper content can be promoted to HW overlay when
backed by a Gpu Memory Buffer.

BUG=b/36752417
CQ_INCLUDE_TRYBOTS=master.tryserver.blink:linux_trusty_blink_rel

Review-Url: https://codereview.chromium.org/2794343003
Cr-Commit-Position: refs/heads/master@{#467697}
  • Loading branch information
DCastagna authored and Commit bot committed Apr 27, 2017
1 parent 487f817 commit 923beb5
Show file tree
Hide file tree
Showing 6 changed files with 9 additions and 13 deletions.
4 changes: 0 additions & 4 deletions cc/output/overlay_strategy_fullscreen.cc
Original file line number Diff line number Diff line change
Expand Up @@ -47,10 +47,6 @@ bool OverlayStrategyFullscreen::Attempt(
return false;
}

if (candidate.transform != gfx::OVERLAY_TRANSFORM_NONE) {
return false;
}

if (!candidate.display_rect.origin().IsOrigin() ||
gfx::ToRoundedSize(candidate.display_rect.size()) !=
render_pass->output_rect.size() ||
Expand Down
2 changes: 0 additions & 2 deletions cc/output/overlay_strategy_single_on_top.cc
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,6 @@ bool OverlayStrategySingleOnTop::Attempt(
for (auto it = quad_list->begin(); it != quad_list->end(); ++it) {
OverlayCandidate candidate;
if (OverlayCandidate::FromDrawQuad(resource_provider, *it, &candidate) &&
// TODO(dcastagna): Remove this once drm platform supports transforms.
candidate.transform == gfx::OVERLAY_TRANSFORM_NONE &&
!OverlayCandidate::IsOccluded(candidate, quad_list->cbegin(), it)) {
// We currently reject quads with alpha that do not request alpha blending
// since the alpha channel might not be set to 1 and we're not disabling
Expand Down
8 changes: 4 additions & 4 deletions cc/output/overlay_unittest.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1006,14 +1006,14 @@ TEST_F(SingleOverlayOnTopTest, AllowPositiveScaleTransform) {
EXPECT_EQ(1U, candidate_list.size());
}

TEST_F(SingleOverlayOnTopTest, RejectTransform) {
TEST_F(SingleOverlayOnTopTest, AcceptMirrorYTransform) {
gfx::Rect rect = kOverlayRect;
rect.Offset(0, -rect.height());
std::unique_ptr<RenderPass> pass = CreateRenderPass();
CreateCandidateQuadAt(resource_provider_.get(),
pass->shared_quad_state_list.back(), pass.get(), rect);
pass->shared_quad_state_list.back()
->quad_to_target_transform.RotateAboutZAxis(90.f);
pass->shared_quad_state_list.back()->quad_to_target_transform.Scale(1.f,
-1.f);

OverlayCandidateList candidate_list;
base::flat_map<int, FilterOperations*> render_pass_filters;
Expand All @@ -1022,7 +1022,7 @@ TEST_F(SingleOverlayOnTopTest, RejectTransform) {
resource_provider_.get(), pass.get(), render_pass_filters,
render_pass_background_filters, &candidate_list, nullptr, nullptr,
&damage_rect_, &content_bounds_);
ASSERT_EQ(0U, candidate_list.size());
ASSERT_EQ(1U, candidate_list.size());
}

TEST_F(UnderlayTest, Allow90DegreeRotation) {
Expand Down
3 changes: 1 addition & 2 deletions ui/ozone/common/gpu/ozone_gpu_message_params.h
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ struct OverlayCheck_Params {
bool operator<(const OverlayCheck_Params& plane) const;

gfx::Size buffer_size;
gfx::OverlayTransform transform = gfx::OVERLAY_TRANSFORM_INVALID;
gfx::OverlayTransform transform = gfx::OVERLAY_TRANSFORM_NONE;
gfx::BufferFormat format = gfx::BufferFormat::BGRA_8888;
gfx::Rect display_rect;
gfx::RectF crop_rect;
Expand All @@ -76,4 +76,3 @@ struct OverlayCheck_Params {
} // namespace ui

#endif // UI_OZONE_COMMON_GPU_OZONE_GPU_MESSAGE_PARAMS_H_

Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,9 @@ bool HardwareDisplayPlaneManagerLegacy::SetPlaneData(
uint32_t crtc_id,
const gfx::Rect& src_rect,
CrtcController* crtc) {
// Legacy modesetting rejects transforms.
if (overlay.plane_transform != gfx::OVERLAY_TRANSFORM_NONE)
return false;
if ((hw_plane->type() == HardwareDisplayPlane::kDummy) ||
plane_list->legacy_page_flips.empty() ||
plane_list->legacy_page_flips.back().crtc_id != crtc_id) {
Expand Down
2 changes: 1 addition & 1 deletion ui/ozone/platform/drm/gpu/overlay_plane.cc
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ namespace ui {

OverlayPlane::OverlayPlane(const scoped_refptr<ScanoutBuffer>& buffer)
: buffer(buffer),
plane_transform(gfx::OVERLAY_TRANSFORM_INVALID),
plane_transform(gfx::OVERLAY_TRANSFORM_NONE),
display_bounds(gfx::Point(), buffer->GetSize()),
crop_rect(0, 0, 1, 1) {}

Expand Down

0 comments on commit 923beb5

Please sign in to comment.