Skip to content

xwayland: clear pixmaps after creation in rootless mode

Dor Askayo requested to merge doraskayo/xserver:clear_pixmap into master

Description

From the commit message:

When a pixmap is created with a backing FBO, the FBO should be cleared
to avoid rendering uninitialized memory. This could happen when the
pixmap is rendered without being filled in its entirety.

One example is when a top-level window without a background is
resized. The pixmap would be reallocated to prepare for more pixels,
but uninitialized memory would be rendered in the resize offset until
the client sends a frame that fills these additional pixels.

Another example is when a new top-level window is created without a
background. Uninitialized memory would be rendered after the pixmap is
allocated and before the client sends its first frame.

This issue is only apparent in OpenGL implementations that don't zero
the VRAM of allocated buffers by default, such as RadeonSI.

The issue

Notice the artifacts shown at the bottom and right parts of the window as it's being resized: without-patch

Proposed solution

With this MR applied, textures are now cleared after creation and before being rendered, and therefore appear black in area where nothing has been drawn at the moment of rendering: with-patch

Tests performed

This change was tested in the following scenarios:

  • Xwayland in gnome-shell with RadeonSI
  • Xwayland in gnome-shell with LLVMpipe
  • Xwayland in weston with RadeonSI
  • Xorg in gnome-shell with modesetting and RadeonSI (for reference)

How to reproduce

The issue of uninitialized memory being rendered on resize is easily reproducible with Chromium and the Steam client, simply resize their windows fast. The issue of uninitialized memory being rendered for new windows is easily reproducible in Dota Underlords and sometimes Chromium. As far as I know, this can only be reproduced with RadeonSI since it doesn't zero the VRAM of allocated buffers.

Relevant issues

Fixes #636 (closed)

Edited by Dor Askayo

Merge request reports

Loading