Reland "util/X11Window: Set PMinSize and PMaxSize hints."

This is a reland of commit a78eca2cab

Revert https://crrev.com/c/3661210 refers to cropping on SwS bots which might be due to another X11 related issue I recently fixed (https://crrev.com/c/3979168)

Lack of min width/height is triggering a swapchain recreation with smaller extents due to window being resized by the WM:
https://anglebug.com/7840#c2

Also, capturing screenshots past the first frame (--screenshot-frame=2) results in partial screenshots.

Original change's description:
> util/X11Window: Set PMinSize and PMaxSize hints.
>
> Before this patch replay windows were down-sized to match the default
> screen size in case their extent was greater than the screen size.
>
> Setting a PMinSize on XSizeHints resolves the issue on modern window
> managers. Tested with GNOME Shell 41.3 with both native X11 and Wayland
> (over XWayland) backends.
> Setting PMaxSize was also requried to pass the
> BlitFramebufferANGLETest tests.
>
> This fixes retracing with correct extents and resolves a VVL performance
> warning.
>
> Bug: angleproject:6808
> Bug: angleproject:7083
> Change-Id: I00ee149ec02efe08c5801e4231913049d31e262b
> Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3507514
> Reviewed-by: Cody Northrop <cnorthrop@google.com>
> Reviewed-by: Jamie Madill <jmadill@chromium.org>
> Commit-Queue: Lubosz Sarnecki <lubosz.sarnecki@collabora.com>

Bug: angleproject:6808
Bug: angleproject:7083
Bug: angleproject:7840
Change-Id: Ide540ecf55c2c0f39635f2b6b0688d7c2ddffc0b
Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/4048025
Reviewed-by: Cody Northrop <cnorthrop@google.com>
Commit-Queue: Roman Lavrov <romanl@google.com>
This commit is contained in:
Lubosz Sarnecki
2022-03-08 14:47:14 +01:00
committed by Angle LUCI CQ
parent 202fcb8d85
commit 317870f9c0

View File

@@ -361,6 +361,17 @@ bool X11Window::initializeImpl(const std::string &name, int width, int height)
return false; return false;
} }
// Set PMinSize and PMaxSize on XSizeHints so windows larger than the screen do not get adjusted
// to screen size
XSizeHints sizeHints = {
.flags = PMinSize | PMaxSize,
.min_width = width,
.min_height = height,
.max_width = width,
.max_height = height,
};
XSetWMNormalHints(mDisplay, mWindow, &sizeHints);
XFlush(mDisplay); XFlush(mDisplay);
mX = 0; mX = 0;
@@ -447,6 +458,18 @@ bool X11Window::setPosition(int x, int y)
bool X11Window::resize(int width, int height) bool X11Window::resize(int width, int height)
{ {
XResizeWindow(mDisplay, mWindow, width, height); XResizeWindow(mDisplay, mWindow, width, height);
// Set PMinSize and PMaxSize on XSizeHints so windows larger than the screen do not get adjusted
// to screen size
XSizeHints sizeHints = {
.flags = PMinSize | PMaxSize,
.min_width = width,
.min_height = height,
.max_width = width,
.max_height = height,
};
XSetWMNormalHints(mDisplay, mWindow, &sizeHints);
XFlush(mDisplay); XFlush(mDisplay);
Timer timer; Timer timer;