[PATCH 3/3] xwm: Don't set opaque region to cover window contents from X

Kristian Høgsberg hoegsberg at gmail.com
Fri Jun 14 11:56:15 PDT 2013


On Tue, Jun 11, 2013 at 08:01:03PM -0500, MoD wrote:
> Window contents cannot be assumed to be fully opaque for windows drawn with
> a RGBA visual. Later the optimization of setting a full opaque region can
> be reimplemented after checking that the windows involved aren't using RGBA
> visuals.

This patch just goes back to breaking RGB visuals instead.  The alpha
channel for RGB visual windows is undefined and depending on your
rendering method (core rendering, gl or xrender) you may get
non-opaque pixels.  When weston textures from that with blending
enabled, you end up with transparent text in xterm, for example.  We
need to look at the window visual before we can decide to whether or
not to set the opaque region.

> The comment mentioning sampling of undefined alpha channel was irrelevant as
> of f91871980e095caa827f4f39e6c178fc0a2bd396 and can safely be removed.

No, it's still relevant.  We have a subwindow (the client window)
which could have an RGB visual with undefined alpha channel and the
frame window which has an ARGB visual with well-defined alpha.  When
sampling with bilinear filtering, the sample will fetch texels from
around the sample point and blend them together.  If we don't extend
the opaque region 1px out, we may end up trying to sample an ARGB
pixel for the frame and blending a RGB pixel with undefined alpha from
the client window.

I'd love to see this fixed but we need to do it the right way.  We
have to get the child window visual using xcb_get_window_attributes()
and figure out from that whether or not to set the opaque region.

Kristian

> ---
>  src/xwayland/window-manager.c | 13 ++++---------
>  1 file changed, 4 insertions(+), 9 deletions(-)
> 
> diff --git a/src/xwayland/window-manager.c b/src/xwayland/window-manager.c
> index d4be4ca..68bc123 100644
> --- a/src/xwayland/window-manager.c
> +++ b/src/xwayland/window-manager.c
> @@ -830,13 +830,8 @@ weston_wm_window_draw_decoration(void *data)
>  
>  	if (window->surface) {
>  		pixman_region32_fini(&window->surface->pending.opaque);
> -		/* We leave an extra pixel around the X window area to
> -		 * make sure we don't sample from the undefined alpha
> -		 * channel when filtering. */
> -		pixman_region32_init_rect(&window->surface->pending.opaque, 
> -					  x - 1, y - 1,
> -					  window->width + 2,
> -					  window->height + 2);
> +		pixman_region32_init(&window->surface->pending.opaque);
> +		/* TODO: fill opaque region if client doesn't use 32-bit visual */
>  		weston_surface_geometry_dirty(window->surface);
>  	}
>  
> @@ -859,8 +854,8 @@ weston_wm_window_schedule_repaint(struct weston_wm_window *window)
>  		if (window->surface != NULL) {
>  			weston_wm_window_get_frame_size(window, &width, &height);
>  			pixman_region32_fini(&window->surface->pending.opaque);
> -			pixman_region32_init_rect(&window->surface->pending.opaque, 0, 0,
> -						  width, height);
> +			pixman_region32_init(&window->surface->pending.opaque);
> +			/* TODO: fill opaque region if client doesn't use 32-bit visual */
>  			weston_surface_geometry_dirty(window->surface);
>  		}
>  		return;
> -- 
> 1.8.3
> 
> _______________________________________________
> wayland-devel mailing list
> wayland-devel at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/wayland-devel


More information about the wayland-devel mailing list