Skip to content

Commit

Permalink
Limit minimum size of wayland viewport source rect
Browse files Browse the repository at this point in the history
This fix is intended to be a stopgap on the numerous issues we are
seeing that have this exact error. Once we resolve the error this code
should be removed.

(cherry picked from commit 51954df)

Bug: 1325344, 1324657,1300799
Change-Id: Iff32d60245d3c020a898eacf82e16d2e6e71d056
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3646046
Commit-Queue: Peter McNeeley <petermcneeley@chromium.org>
Reviewed-by: Kramer Ge <fangzhoug@chromium.org>
Cr-Original-Commit-Position: refs/heads/main@{#1003284}
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3645335
Cr-Commit-Position: refs/branch-heads/5060@{#21}
Cr-Branched-From: b83393d-refs/heads/main@{#1002911}
  • Loading branch information
petermcneeleychromium authored and Chromium LUCI CQ committed May 16, 2022
1 parent 0fb25f4 commit 87947c8
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions ui/ozone/platform/wayland/host/wayland_surface.cc
Original file line number Diff line number Diff line change
Expand Up @@ -557,6 +557,23 @@ void WaylandSurface::ApplyPendingState() {
wl_fixed_from_double(viewport_src_dip.height()) == 0) {
LOG(ERROR) << "Sending viewport src with width/height zero will result "
"in wayland disconnection";
// TODO(crbug.com/1325344): Resolve why this viewport size ends up being
// zero and remove the fix below.
LOG(ERROR) << "viewport_src_dip=" << viewport_src_dip.ToString()
<< " pending_state_.crop=" << pending_state_.crop.ToString()
<< " bounds=" << bounds.ToString()
<< " pending_state_.buffer_size_px="
<< pending_state_.buffer_size_px.ToString();
constexpr wl_fixed_t kViewportSizeMin = 1;
const float kViewPortSizeMinFloat =
static_cast<float>(wl_fixed_to_double(kViewportSizeMin));
LOG(ERROR)
<< "Limiting viewport_src_dip size to be non zero with a minium of "
<< kViewportSizeMin;
viewport_src_dip.set_width(
std::max(viewport_src_dip.width(), kViewPortSizeMinFloat));
viewport_src_dip.set_height(
std::max(viewport_src_dip.height(), kViewPortSizeMinFloat));
}
src_to_set[0] = wl_fixed_from_double(viewport_src_dip.x()),
src_to_set[1] = wl_fixed_from_double(viewport_src_dip.y());
Expand Down

0 comments on commit 87947c8

Please sign in to comment.