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

2015-02-11 Thread Tom Stellard
Using GBM_FORMAT_ABGR 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-develdate=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.

 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_XRGB;
-else if (attrs-alpha_size = 8)
-return GBM_FORMAT_ABGR;
 
 return 0;
 }
-- 
1.8.5.5

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


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

2015-02-11 Thread Chad Versace
On 02/11/2015 09:53 AM, Tom Stellard wrote:
 Using GBM_FORMAT_ABGR 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-develdate=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_XRGB;
 -else if (attrs-alpha_size = 8)
 -return GBM_FORMAT_ABGR;
  
  return 0;
  }




signature.asc
Description: OpenPGP digital signature
___
waffle mailing list
waffle@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/waffle