[PATCH weston 2/2] compositor-drm: pass ARGB fallback to gl create functions for XRGB formats

Pekka Paalanen ppaalanen at gmail.com
Fri May 15 01:10:20 PDT 2015


On Mon, 11 May 2015 14:19:03 -0500
Derek Foreman <derekf at osg.samsung.com> wrote:

> If the GL implementation doesn't provide an XRGB visual we may still be
> able to proceed with an ARGB one. Since we're not changing the scanout
> buffer format, and our current rendering loop always results in saturated
> alpha in the frame buffer, it should be Just Fine(tm) - and probably better
> than just exiting.
> 
> Signed-off-by: Derek Foreman <derekf at osg.samsung.com>

Hi,

I have tested, that this patch does indeed work around
https://bugs.freedesktop.org/show_bug.cgi?id=89689

I think you should link to the bug report here. It provides the context
on when this workaround is needed. The link might even be in a comment
in the code.

> ---
>  src/compositor-drm.c | 54 ++++++++++++++++++++++++++++++++++++++++++----------
>  src/gl-renderer.c    |  8 ++++++++
>  2 files changed, 52 insertions(+), 10 deletions(-)
> 
> diff --git a/src/compositor-drm.c b/src/compositor-drm.c
> index 69bdcfd..48dfa29 100644
> --- a/src/compositor-drm.c
> +++ b/src/compositor-drm.c
> @@ -1391,14 +1391,43 @@ create_gbm_device(int fd)
>  	return gbm;
>  }
>  
> +/* When initializing EGL, if the preferred buffer format isn't availble
> + * we may be able to susbstitute an ARGB format for an XRGB one.
> + *
> + * This returns 0 if substitution isn't possible, but 0 might be a
> + * legitimate format for other EGL platforms, so the caller is
> + * responsible for checking for 0 before calling gl_renderer->create().
> + */
>  static int
> -drm_compositor_create_gl_renderer(struct drm_compositor *ec)
> +fallback_format_for(uint32_t format)
>  {
> -	EGLint format;
> +	switch (format) {
> +	case GBM_FORMAT_XRGB8888:
> +		return GBM_FORMAT_ARGB8888;
> +	case GBM_FORMAT_XRGB2101010:
> +		return GBM_FORMAT_ARGB2101010;
> +	default:
> +		return 0;
> +	}
> +}

This is now very obvious on what it does. Great!

Tested-by: Pekka Paalanen <pekka.paalanen at collabora.co.uk>
Reviewed-by: Pekka Paalanen <pekka.paalanen at collabora.co.uk>


Thanks,
pq


More information about the wayland-devel mailing list