summaryrefslogtreecommitdiff
path: root/hw
diff options
context:
space:
mode:
authorDor Askayo <dor.askayo@gmail.com>2020-02-19 17:22:11 +0100
committerMatt Turner <mattst88@gmail.com>2020-02-21 23:21:33 +0000
commit94dad4f05133171805ee94095bbcd20ece754eba (patch)
tree16949b83064c4641b3601d49feb1585b571468e9 /hw
parent0238359bced17f9db0e266111897d154ab117d68 (diff)
xwayland: clear pixmaps after creation in rootless mode
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. Signed-off-by: Dor Askayo <dor.askayo@gmail.com> Closes: https://gitlab.freedesktop.org/xorg/xserver/issues/636 Reviewed-by: Michel Dänzer <mdaenzer@redhat.com> (cherry picked from commit 0e9a0c203c2ae4eae12bdbb95428f398211c7bee) [ Michel Dänzer: * Squashed in commit ebf549db2d9341d99e0d0847b948dd798d98f7dc * Dropped code related to glamor_format, which only exists on master ]
Diffstat (limited to 'hw')
-rw-r--r--hw/xwayland/xwayland-glamor-gbm.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/hw/xwayland/xwayland-glamor-gbm.c b/hw/xwayland/xwayland-glamor-gbm.c
index febc0b910..c02ba7363 100644
--- a/hw/xwayland/xwayland-glamor-gbm.c
+++ b/hw/xwayland/xwayland-glamor-gbm.c
@@ -242,8 +242,12 @@ xwl_glamor_gbm_create_pixmap(ScreenPtr screen,
if (bo) {
pixmap = xwl_glamor_gbm_create_pixmap_for_bo(screen, bo, depth);
- if (!pixmap)
+ if (!pixmap) {
gbm_bo_destroy(bo);
+ }
+ else if (xwl_screen->rootless && hint == CREATE_PIXMAP_USAGE_BACKING_PIXMAP) {
+ glamor_clear_pixmap(pixmap);
+ }
}
}