Commit 923beb5a authored by dcastagna's avatar dcastagna Committed by Commit bot

cc: Allow overlay candidates with transforms.

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}
parent 487f8173
...@@ -47,10 +47,6 @@ bool OverlayStrategyFullscreen::Attempt( ...@@ -47,10 +47,6 @@ bool OverlayStrategyFullscreen::Attempt(
return false; return false;
} }
if (candidate.transform != gfx::OVERLAY_TRANSFORM_NONE) {
return false;
}
if (!candidate.display_rect.origin().IsOrigin() || if (!candidate.display_rect.origin().IsOrigin() ||
gfx::ToRoundedSize(candidate.display_rect.size()) != gfx::ToRoundedSize(candidate.display_rect.size()) !=
render_pass->output_rect.size() || render_pass->output_rect.size() ||
......
...@@ -37,8 +37,6 @@ bool OverlayStrategySingleOnTop::Attempt( ...@@ -37,8 +37,6 @@ bool OverlayStrategySingleOnTop::Attempt(
for (auto it = quad_list->begin(); it != quad_list->end(); ++it) { for (auto it = quad_list->begin(); it != quad_list->end(); ++it) {
OverlayCandidate candidate; OverlayCandidate candidate;
if (OverlayCandidate::FromDrawQuad(resource_provider, *it, &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)) { !OverlayCandidate::IsOccluded(candidate, quad_list->cbegin(), it)) {
// We currently reject quads with alpha that do not request alpha blending // 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 // since the alpha channel might not be set to 1 and we're not disabling
......
...@@ -1006,14 +1006,14 @@ TEST_F(SingleOverlayOnTopTest, AllowPositiveScaleTransform) { ...@@ -1006,14 +1006,14 @@ TEST_F(SingleOverlayOnTopTest, AllowPositiveScaleTransform) {
EXPECT_EQ(1U, candidate_list.size()); EXPECT_EQ(1U, candidate_list.size());
} }
TEST_F(SingleOverlayOnTopTest, RejectTransform) { TEST_F(SingleOverlayOnTopTest, AcceptMirrorYTransform) {
gfx::Rect rect = kOverlayRect; gfx::Rect rect = kOverlayRect;
rect.Offset(0, -rect.height()); rect.Offset(0, -rect.height());
std::unique_ptr<RenderPass> pass = CreateRenderPass(); std::unique_ptr<RenderPass> pass = CreateRenderPass();
CreateCandidateQuadAt(resource_provider_.get(), CreateCandidateQuadAt(resource_provider_.get(),
pass->shared_quad_state_list.back(), pass.get(), rect); pass->shared_quad_state_list.back(), pass.get(), rect);
pass->shared_quad_state_list.back() pass->shared_quad_state_list.back()->quad_to_target_transform.Scale(1.f,
->quad_to_target_transform.RotateAboutZAxis(90.f); -1.f);
OverlayCandidateList candidate_list; OverlayCandidateList candidate_list;
base::flat_map<int, FilterOperations*> render_pass_filters; base::flat_map<int, FilterOperations*> render_pass_filters;
...@@ -1022,7 +1022,7 @@ TEST_F(SingleOverlayOnTopTest, RejectTransform) { ...@@ -1022,7 +1022,7 @@ TEST_F(SingleOverlayOnTopTest, RejectTransform) {
resource_provider_.get(), pass.get(), render_pass_filters, resource_provider_.get(), pass.get(), render_pass_filters,
render_pass_background_filters, &candidate_list, nullptr, nullptr, render_pass_background_filters, &candidate_list, nullptr, nullptr,
&damage_rect_, &content_bounds_); &damage_rect_, &content_bounds_);
ASSERT_EQ(0U, candidate_list.size()); ASSERT_EQ(1U, candidate_list.size());
} }
TEST_F(UnderlayTest, Allow90DegreeRotation) { TEST_F(UnderlayTest, Allow90DegreeRotation) {
......
...@@ -64,7 +64,7 @@ struct OverlayCheck_Params { ...@@ -64,7 +64,7 @@ struct OverlayCheck_Params {
bool operator<(const OverlayCheck_Params& plane) const; bool operator<(const OverlayCheck_Params& plane) const;
gfx::Size buffer_size; 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::BufferFormat format = gfx::BufferFormat::BGRA_8888;
gfx::Rect display_rect; gfx::Rect display_rect;
gfx::RectF crop_rect; gfx::RectF crop_rect;
...@@ -76,4 +76,3 @@ struct OverlayCheck_Params { ...@@ -76,4 +76,3 @@ struct OverlayCheck_Params {
} // namespace ui } // namespace ui
#endif // UI_OZONE_COMMON_GPU_OZONE_GPU_MESSAGE_PARAMS_H_ #endif // UI_OZONE_COMMON_GPU_OZONE_GPU_MESSAGE_PARAMS_H_
...@@ -105,6 +105,9 @@ bool HardwareDisplayPlaneManagerLegacy::SetPlaneData( ...@@ -105,6 +105,9 @@ bool HardwareDisplayPlaneManagerLegacy::SetPlaneData(
uint32_t crtc_id, uint32_t crtc_id,
const gfx::Rect& src_rect, const gfx::Rect& src_rect,
CrtcController* crtc) { CrtcController* crtc) {
// Legacy modesetting rejects transforms.
if (overlay.plane_transform != gfx::OVERLAY_TRANSFORM_NONE)
return false;
if ((hw_plane->type() == HardwareDisplayPlane::kDummy) || if ((hw_plane->type() == HardwareDisplayPlane::kDummy) ||
plane_list->legacy_page_flips.empty() || plane_list->legacy_page_flips.empty() ||
plane_list->legacy_page_flips.back().crtc_id != crtc_id) { plane_list->legacy_page_flips.back().crtc_id != crtc_id) {
......
...@@ -12,7 +12,7 @@ namespace ui { ...@@ -12,7 +12,7 @@ namespace ui {
OverlayPlane::OverlayPlane(const scoped_refptr<ScanoutBuffer>& buffer) OverlayPlane::OverlayPlane(const scoped_refptr<ScanoutBuffer>& buffer)
: buffer(buffer), : buffer(buffer),
plane_transform(gfx::OVERLAY_TRANSFORM_INVALID), plane_transform(gfx::OVERLAY_TRANSFORM_NONE),
display_bounds(gfx::Point(), buffer->GetSize()), display_bounds(gfx::Point(), buffer->GetSize()),
crop_rect(0, 0, 1, 1) {} crop_rect(0, 0, 1, 1) {}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment