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;
>  }


Attachment: signature.asc
Description: OpenPGP digital signature

_______________________________________________
waffle mailing list
waffle@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/waffle

Reply via email to