summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--cc/output/gl_renderer.cc6
-rw-r--r--cc/output/overlay_candidate.cc7
-rw-r--r--cc/output/overlay_candidate.h9
-rw-r--r--cc/output/overlay_candidate_validator.h4
-rw-r--r--ui/ozone/platform/drm/gbm_surface_factory.cc6
-rw-r--r--ui/ozone/public/overlay_candidates_ozone.h10
6 files changed, 26 insertions, 16 deletions
diff --git a/cc/output/gl_renderer.cc b/cc/output/gl_renderer.cc
index ba3e07d..b13f4b2 100644
--- a/cc/output/gl_renderer.cc
+++ b/cc/output/gl_renderer.cc
@@ -3433,9 +3433,7 @@ void GLRenderer::ScheduleOverlays(DrawingFrame* frame) {
ResourceProvider::ResourceIdArray resources;
OverlayCandidateList& overlays = frame->overlay_list;
- OverlayCandidateList::iterator it;
- for (it = overlays.begin(); it != overlays.end(); ++it) {
- const OverlayCandidate& overlay = *it;
+ for (const OverlayCandidate& overlay : overlays) {
// Skip primary plane.
if (overlay.plane_z_order == 0)
continue;
@@ -3448,7 +3446,7 @@ void GLRenderer::ScheduleOverlays(DrawingFrame* frame) {
overlay.plane_z_order,
overlay.transform,
pending_overlay_resources_.back()->texture_id(),
- overlay.display_rect,
+ ToNearestRect(overlay.display_rect),
overlay.uv_rect);
}
}
diff --git a/cc/output/overlay_candidate.cc b/cc/output/overlay_candidate.cc
index 46c3a7d..0cbd3de 100644
--- a/cc/output/overlay_candidate.cc
+++ b/cc/output/overlay_candidate.cc
@@ -128,13 +128,14 @@ gfx::OverlayTransform OverlayCandidate::ModifyTransform(
}
// static
-gfx::Rect OverlayCandidate::GetOverlayRect(const gfx::Transform& quad_transform,
- const gfx::Rect& rect) {
+gfx::RectF OverlayCandidate::GetOverlayRect(
+ const gfx::Transform& quad_transform,
+ const gfx::Rect& rect) {
DCHECK(quad_transform.IsPositiveScaleOrTranslation());
gfx::RectF float_rect(rect);
quad_transform.TransformRect(&float_rect);
- return gfx::ToNearestRect(float_rect);
+ return float_rect;
}
} // namespace cc
diff --git a/cc/output/overlay_candidate.h b/cc/output/overlay_candidate.h
index 28ae8cb..c6bb22a 100644
--- a/cc/output/overlay_candidate.h
+++ b/cc/output/overlay_candidate.h
@@ -24,8 +24,8 @@ class CC_EXPORT OverlayCandidate {
// or OVERLAY_TRANSFORM_INVALID.
static gfx::OverlayTransform ModifyTransform(gfx::OverlayTransform in,
gfx::OverlayTransform delta);
- static gfx::Rect GetOverlayRect(const gfx::Transform& quad_transform,
- const gfx::Rect& rect);
+ static gfx::RectF GetOverlayRect(const gfx::Transform& quad_transform,
+ const gfx::Rect& rect);
OverlayCandidate();
~OverlayCandidate();
@@ -34,8 +34,9 @@ class CC_EXPORT OverlayCandidate {
gfx::OverlayTransform transform;
// Format of the buffer to composite.
ResourceFormat format;
- // Rect on the display to position the overlay to.
- gfx::Rect display_rect;
+ // Rect on the display to position the overlay to. Implementer must convert
+ // to integer coordinates if setting |overlay_handled| to true.
+ gfx::RectF display_rect;
// Crop within the buffer to be placed inside |display_rect|.
gfx::RectF uv_rect;
// Texture resource to present in an overlay.
diff --git a/cc/output/overlay_candidate_validator.h b/cc/output/overlay_candidate_validator.h
index 036eafc..6064731 100644
--- a/cc/output/overlay_candidate_validator.h
+++ b/cc/output/overlay_candidate_validator.h
@@ -19,7 +19,9 @@ class CC_EXPORT OverlayCandidateValidator {
// A list of possible overlay candidates is presented to this function.
// The expected result is that those candidates that can be in a separate
// plane are marked with |overlay_handled| set to true, otherwise they are
- // to be traditionally composited.
+ // to be traditionally composited. Candidates with |overlay_handled| set to
+ // true must also have their |display_rect| converted to integer
+ // coordinates if necessary.
virtual void CheckOverlaySupport(OverlayCandidateList* surfaces) = 0;
virtual ~OverlayCandidateValidator() {}
diff --git a/ui/ozone/platform/drm/gbm_surface_factory.cc b/ui/ozone/platform/drm/gbm_surface_factory.cc
index 525cd45..afe8d2c 100644
--- a/ui/ozone/platform/drm/gbm_surface_factory.cc
+++ b/ui/ozone/platform/drm/gbm_surface_factory.cc
@@ -9,6 +9,7 @@
#include "base/command_line.h"
#include "base/files/file_path.h"
#include "third_party/khronos/EGL/egl.h"
+#include "ui/gfx/geometry/rect_conversions.h"
#include "ui/ozone/common/egl_util.h"
#include "ui/ozone/platform/drm/gpu/drm_device_manager.h"
#include "ui/ozone/platform/drm/gpu/drm_window.h"
@@ -47,8 +48,11 @@ class SingleOverlay : public OverlayCandidatesOzone {
NOTREACHED();
return;
}
+ // 0.01 constant chosen to match DCHECKs in gfx::ToNearestRect and avoid
+ // that code asserting on quads that we accept.
if (overlay->plane_z_order > 0 &&
- IsTransformSupported(overlay->transform)) {
+ IsTransformSupported(overlay->transform) &&
+ gfx::IsNearestRectWithinDistance(overlay->display_rect, 0.01f)) {
overlay->overlay_handled = true;
}
}
diff --git a/ui/ozone/public/overlay_candidates_ozone.h b/ui/ozone/public/overlay_candidates_ozone.h
index ad26ebc..c573330 100644
--- a/ui/ozone/public/overlay_candidates_ozone.h
+++ b/ui/ozone/public/overlay_candidates_ozone.h
@@ -27,8 +27,10 @@ class OZONE_BASE_EXPORT OverlayCandidatesOzone {
gfx::OverlayTransform transform;
// Format of the buffer to composite.
SurfaceFactoryOzone::BufferFormat format;
- // Rect on the display to position the overlay to.
- gfx::Rect display_rect;
+ // Rect on the display to position the overlay to. Input rectangle may
+ // not have integer coordinates, but when accepting for overlay, must
+ // be modified by CheckOverlaySupport to output integer values.
+ gfx::RectF display_rect;
// Crop within the buffer to be placed inside |display_rect|.
gfx::RectF crop_rect;
// Stacking order of the overlay plane relative to the main surface,
@@ -45,7 +47,9 @@ class OZONE_BASE_EXPORT OverlayCandidatesOzone {
// A list of possible overlay candidates is presented to this function.
// The expected result is that those candidates that can be in a separate
// plane are marked with |overlay_handled| set to true, otherwise they are
- // to be tranditionally composited.
+ // to be traditionally composited. When setting |overlay_handled| to true,
+ // the implementation must also snap |display_rect| to integer coordinates
+ // if necessary.
virtual void CheckOverlaySupport(OverlaySurfaceCandidateList* surfaces);
virtual ~OverlayCandidatesOzone();