[waffle] [PATCH] gbm: Don't use a config that mesa's gbm doesn't support

Chad Versace chad.versace at intel.com
Wed Feb 11 18:27:38 PST 2015


On 02/11/2015 09:53 AM, Tom Stellard wrote:
> Using GBM_FORMAT_ABGR8888 was causing the B and G components to
> be swapped for some piglit tests.
> ---
> 
> I have no idea if this fix is correct, but based on an IRC discussion:
> http://people.freedesktop.org/~cbrill/dri-log/?channel=dri-devel&date=2015-02-05
> 
> Using the wrong format here is the reason that B and G outputs were swapped.
> I'm not sure what format we should be using instead.

This might fix the bug you're facing, but it continues the mistake that
caused the bug in the first place: Waffle is guessing, and guessing badly,
which GBM_FORMAT is backing the EGLConfig.

I think the correct fix is to eliminate the guessing. Rewriting
wgbm_config_get_gbm_format() to look like this should do the trick:

uint32_t
wgbm_config_get_gbm_format(struct wegl_config *wegl_config)
{
    EGLint gbm_format;

    ...
    ok = plat->eglGetConfigAttrib(..., EGL_NATIVE_VISUAL_ID, &gbm_format);
    if (!ok) {
       // emit error
       return 0;
    }

    return gbm_format;
}

Waffle's X11/EGL backend does something very similar when creating during window
creation. See [https://github.com/waffle-gl/waffle/blob/master/src/waffle/xegl/xegl_window.c#L79]

> 
>  src/waffle/gbm/wgbm_config.c | 4 +---
>  1 file changed, 1 insertion(+), 3 deletions(-)
> 
> diff --git a/src/waffle/gbm/wgbm_config.c b/src/waffle/gbm/wgbm_config.c
> index 480c2bf..5229210 100644
> --- a/src/waffle/gbm/wgbm_config.c
> +++ b/src/waffle/gbm/wgbm_config.c
> @@ -50,10 +50,8 @@ wgbm_config_get_gbm_format(const struct wcore_config_attrs *attrs)
>          return 0;
>      }
>  
> -    if (attrs->alpha_size <= 0)
> +    if (attrs->alpha_size <= 8)
>          return GBM_FORMAT_XRGB8888;
> -    else if (attrs->alpha_size <= 8)
> -        return GBM_FORMAT_ABGR8888;
>  
>      return 0;
>  }


-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 884 bytes
Desc: OpenPGP digital signature
URL: <http://lists.freedesktop.org/archives/waffle/attachments/20150211/df78b930/attachment.sig>


More information about the waffle mailing list