Re: [Mesa-dev] [PATCH] egl_dri2: Allow both 24 and 32 bit X visuals for RGBA configs

2014-11-08 Thread Pekka Paalanen
On Fri, 07 Nov 2014 11:32:04 -0800
Eric Anholt e...@anholt.net wrote:

 Pekka Paalanen ppaala...@gmail.com writes:
 
  On Thu, 06 Nov 2014 13:01:03 -0800
  Ian Romanick i...@freedesktop.org wrote:
 
  I thought Eric and Chad already NAKed it in bugzilla.  The problem is
  that applications ask for an RGBA visual for GL blending.  They use the
  alpha channel to generate their images, but the final alpha values are,
  basically, random... and the composited result would be pure garbage.
 
  Reading
  https://bugs.freedesktop.org/show_bug.cgi?id=67676#c5
  We should certainly be exposing EGLConfigs that match up to the rgba
  visual, though, so you can find it when you try. - Eric
 
  To me that sounds like Eric would accept having the visuals there
  in additional configs (as long as they are sorted after the otherwise
  equivalent xRGB configs?). Eric, would you like to confirm your current
  opinion?
 
 What I believe we want:
 
 Somebody just requesting RGBA with ChooseConfig doesn't end up forced
 into the depth-32 (blending) X visual.  This is the most important.
 
 There is some mechanism for somebody that does want the depth 32 visual
 to get an EGL config to draw to it.  This is important but secondary to
 not breaking everything else, and them having to jump through hoops is
 reasonable but probably avoidable.

I think that is exactly what everybody already agrees on.

The remaining question seems to be, should we add new configs with
the blending X visual, or wait for an EGL extension to allow to
request blending in generic terms (*and* add configs with the
blending X visual, since that is essentially required for making,
say, a new value for EGL_TRANSPARENT_TYPE to work on X11).

Can you imagine other reasonable mechanisms?

Btw. I noticed that EGL_TRANSPARENT_TYPE defaults to EGL_NONE for
eglChooseConfig, not DONT_CARE (which is not even allowed in EGL
1.4). So if we add only configs now, and add the
EGL_TRANSPARENT_TYPE=alpha extension later, apps using
eglChooseConfig for initial config filtering and wanting a blending
config will be broken yet again. I suppose one might even claim,
that exposing bleding configs when EGL_TRANSPARENT_TYPE=NONE is a
violation of the spirit of the spec.

EGL 1.4 says that EGL_TRANSPARENT_TYPE is not a sorting key at all,
but NATIVE_VISUAL_ID is with an implementation specified order.


Thanks,
pq
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev


Re: [Mesa-dev] [PATCH] egl_dri2: Allow both 24 and 32 bit X visuals for RGBA configs

2014-11-07 Thread Pekka Paalanen
On Thu, 06 Nov 2014 13:01:03 -0800
Ian Romanick i...@freedesktop.org wrote:

 I thought Eric and Chad already NAKed it in bugzilla.  The problem is
 that applications ask for an RGBA visual for GL blending.  They use the
 alpha channel to generate their images, but the final alpha values are,
 basically, random... and the composited result would be pure garbage.

Reading
https://bugs.freedesktop.org/show_bug.cgi?id=67676#c5
We should certainly be exposing EGLConfigs that match up to the rgba
visual, though, so you can find it when you try. - Eric

To me that sounds like Eric would accept having the visuals there
in additional configs (as long as they are sorted after the otherwise
equivalent xRGB configs?). Eric, would you like to confirm your current
opinion?

 As Chad points out in comment #1, EGL just doesn't let applications do
 the thing the patch is trying to do.

True in general, not exactly for X11. Surely the native visual is
exposed in EGL configs for some reason? (Ok, yeah, not a good argument,
EGL considered.)

For the record, if a Wayland compositor uses the opaque region hint in
Wayland core protocol, we do not see this problem on Wayland at all. In
Wayland, so far the implementations always assume that if the alpha
channel exists in the buffer, it will be used for window blending,
except on regions marked as opaque. So we kind of already have a way to
make it work in Wayland, and just X11 is broken here.

Still, I won't even try to deny that an extension to
EGL_TRANSPARENT_TYPE would be hugely useful and the superior solution
over all the hacking. I do understand you would rather see that
developed than a native visual based solution.

More below...

 On 11/06/2014 05:12 AM, Emil Velikov wrote:
  Humble ping x2
  
  On 14/10/14 15:25, Emil Velikov wrote:
  Humble ping.
 
  On 23/09/14 01:25, Emil Velikov wrote:
  From: Sjoerd Simons sjoerd.sim...@collabora.co.uk
 
  When using RGBA EGLConfigs allow both RGB and RGBA X visuals, such that
  application can decide whether they want to use RGBA (and have the
  compositor blend their windows).
 
  On my system with this change EGLConfigs with a 24 bit visual comes up
  first, as such applications blindly picking the first EGLConfig will
  still get an RGB X visual.
 
  Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=67676
  ---
 
  Hello gents,
 
  This patch has been stuck in bugzilla since February this year. Bringing 
  it around here to gather greater exposure and perhaps some 
  comments/reviews.
 
  -Emil
 
   src/egl/drivers/dri2/egl_dri2.c |  5 +
   src/egl/drivers/dri2/platform_x11.c | 17 +
   2 files changed, 14 insertions(+), 8 deletions(-)
 
  diff --git a/src/egl/drivers/dri2/egl_dri2.c 
  b/src/egl/drivers/dri2/egl_dri2.c
  index 20a7243..2ed90a7 100644
  --- a/src/egl/drivers/dri2/egl_dri2.c
  +++ b/src/egl/drivers/dri2/egl_dri2.c
  @@ -110,6 +110,11 @@ EGLint dri2_to_egl_attribute_map[] = {
   static EGLBoolean
   dri2_match_config(const _EGLConfig *conf, const _EGLConfig *criteria)
   {
  +
  +   if (criteria-NativeVisualID != EGL_DONT_CARE 
  +conf-NativeVisualID != criteria-NativeVisualID)
  +  return EGL_FALSE;

Does this directly affect the behaviour of eglChooseConfig?

EGL 1.4 spec quite clearly says that NATIVE_VISUAL_ID is ignored if
specified as matching criterion to eglChooseConfig, which is why
apps are expected to match it manually rather than via eglChooseConfig.

Doesn't that mean that apps that want alpha blending of the window
already check the native visual? Maybe not if it worked by accident...

Now, this magical alpha-blending visual thing used to work the past
somehow for a long time, didn't it? Until someone noticed a performance
problem (fd.o #59783), not even a correctness problem, or are there
other bugs about correctness too? The patch that caused bug #59783 to
be reported was an intel-driver specific commit, and then #59783 got
fixed by a hardware agnostic change elsewhere, causing some existing
apps to produce unwanted results rather than just affect performance,
leading to fd.o #67676.

To not break most of existing apps that need alpha for rendering but
do not intend the alpha channel to go to the window system blending, we
only need to make sure the configs with argb visual get sorted after
the equivalent xrgb visual config? Reading the EGL 1.4 spec, that seems
perfectly valid.

I don't know if this patch guarantees the config ordering though.


Thanks,
pq

  +
  if (_eglCompareConfigs(conf, criteria, NULL, EGL_FALSE) != 0)
 return EGL_FALSE;
   
  diff --git a/src/egl/drivers/dri2/platform_x11.c 
  b/src/egl/drivers/dri2/platform_x11.c
  index a7a7338..3395fb7 100644
  --- a/src/egl/drivers/dri2/platform_x11.c
  +++ b/src/egl/drivers/dri2/platform_x11.c
  @@ -672,14 +672,15 @@ dri2_x11_add_configs_for_visuals(struct 
  dri2_egl_display *dri2_dpy,
dri2_add_config(disp, dri2_dpy-driver_configs[j], id++,

Re: [Mesa-dev] [PATCH] egl_dri2: Allow both 24 and 32 bit X visuals for RGBA configs

2014-11-07 Thread Eric Anholt
Pekka Paalanen ppaala...@gmail.com writes:

 On Thu, 06 Nov 2014 13:01:03 -0800
 Ian Romanick i...@freedesktop.org wrote:

 I thought Eric and Chad already NAKed it in bugzilla.  The problem is
 that applications ask for an RGBA visual for GL blending.  They use the
 alpha channel to generate their images, but the final alpha values are,
 basically, random... and the composited result would be pure garbage.

 Reading
 https://bugs.freedesktop.org/show_bug.cgi?id=67676#c5
 We should certainly be exposing EGLConfigs that match up to the rgba
 visual, though, so you can find it when you try. - Eric

 To me that sounds like Eric would accept having the visuals there
 in additional configs (as long as they are sorted after the otherwise
 equivalent xRGB configs?). Eric, would you like to confirm your current
 opinion?

What I believe we want:

Somebody just requesting RGBA with ChooseConfig doesn't end up forced
into the depth-32 (blending) X visual.  This is the most important.

There is some mechanism for somebody that does want the depth 32 visual
to get an EGL config to draw to it.  This is important but secondary to
not breaking everything else, and them having to jump through hoops is
reasonable but probably avoidable.


pgp0ltGUZci54.pgp
Description: PGP signature
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev


Re: [Mesa-dev] [PATCH] egl_dri2: Allow both 24 and 32 bit X visuals for RGBA configs

2014-11-06 Thread Emil Velikov
Humble ping x2

On 14/10/14 15:25, Emil Velikov wrote:
 Humble ping.
 
 On 23/09/14 01:25, Emil Velikov wrote:
 From: Sjoerd Simons sjoerd.sim...@collabora.co.uk

 When using RGBA EGLConfigs allow both RGB and RGBA X visuals, such that
 application can decide whether they want to use RGBA (and have the
 compositor blend their windows).

 On my system with this change EGLConfigs with a 24 bit visual comes up
 first, as such applications blindly picking the first EGLConfig will
 still get an RGB X visual.

 Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=67676
 ---

 Hello gents,

 This patch has been stuck in bugzilla since February this year. Bringing 
 it around here to gather greater exposure and perhaps some 
 comments/reviews.

 -Emil

  src/egl/drivers/dri2/egl_dri2.c |  5 +
  src/egl/drivers/dri2/platform_x11.c | 17 +
  2 files changed, 14 insertions(+), 8 deletions(-)

 diff --git a/src/egl/drivers/dri2/egl_dri2.c 
 b/src/egl/drivers/dri2/egl_dri2.c
 index 20a7243..2ed90a7 100644
 --- a/src/egl/drivers/dri2/egl_dri2.c
 +++ b/src/egl/drivers/dri2/egl_dri2.c
 @@ -110,6 +110,11 @@ EGLint dri2_to_egl_attribute_map[] = {
  static EGLBoolean
  dri2_match_config(const _EGLConfig *conf, const _EGLConfig *criteria)
  {
 +
 +   if (criteria-NativeVisualID != EGL_DONT_CARE 
 +conf-NativeVisualID != criteria-NativeVisualID)
 +  return EGL_FALSE;
 +
 if (_eglCompareConfigs(conf, criteria, NULL, EGL_FALSE) != 0)
return EGL_FALSE;
  
 diff --git a/src/egl/drivers/dri2/platform_x11.c 
 b/src/egl/drivers/dri2/platform_x11.c
 index a7a7338..3395fb7 100644
 --- a/src/egl/drivers/dri2/platform_x11.c
 +++ b/src/egl/drivers/dri2/platform_x11.c
 @@ -672,14 +672,15 @@ dri2_x11_add_configs_for_visuals(struct 
 dri2_egl_display *dri2_dpy,
  dri2_add_config(disp, dri2_dpy-driver_configs[j], id++,
  surface_type, config_attrs, rgba_masks);
  
 -/* Allow a 24-bit RGB visual to match a 32-bit RGBA EGLConfig.
 - * Otherwise it will only match a 32-bit RGBA visual.  On a
 - * composited window manager on X11, this will make all of the
 - * EGLConfigs with destination alpha get blended by the
 - * compositor.  This is probably not what the application
 - * wants... especially on drivers that only have 32-bit RGBA
 - * EGLConfigs! */
 -if (d.data-depth == 24) {
 +/* Allow both 24-bit RGB visual and 32 bit RGBA to match a 
 32-bit
 + * RGBA EGLConfig.  Otherwise it will only match a 32-bit RGBA
 + * visual.  On a composited window manager on X11, this will 
 make
 + * all of the EGLConfigs with destination alpha get blended by 
 the
 + * compositor.  This is probably not what the application 
 wants...
 + * especially on drivers that only have 32-bit RGBA EGLConfigs!
 + * Allowing both allows applications to make the decision 
 whether
 + * 32 bit visuals are intended */
 +if (d.data-depth == 24 || d.data-depth == 32) {
 rgba_masks[3] =
~(rgba_masks[0] | rgba_masks[1] | rgba_masks[2]);
 dri2_add_config(disp, dri2_dpy-driver_configs[j], id++,

 

___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev


Re: [Mesa-dev] [PATCH] egl_dri2: Allow both 24 and 32 bit X visuals for RGBA configs

2014-11-06 Thread Marek Olšák
If there's no feedback for so long, I suggest you commit the patch
without review. If it fixes a bug, that's one more reason to commit
it.

Marek

On Thu, Nov 6, 2014 at 2:12 PM, Emil Velikov emil.l.veli...@gmail.com wrote:
 Humble ping x2

 On 14/10/14 15:25, Emil Velikov wrote:
 Humble ping.

 On 23/09/14 01:25, Emil Velikov wrote:
 From: Sjoerd Simons sjoerd.sim...@collabora.co.uk

 When using RGBA EGLConfigs allow both RGB and RGBA X visuals, such that
 application can decide whether they want to use RGBA (and have the
 compositor blend their windows).

 On my system with this change EGLConfigs with a 24 bit visual comes up
 first, as such applications blindly picking the first EGLConfig will
 still get an RGB X visual.

 Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=67676
 ---

 Hello gents,

 This patch has been stuck in bugzilla since February this year. Bringing
 it around here to gather greater exposure and perhaps some
 comments/reviews.

 -Emil

  src/egl/drivers/dri2/egl_dri2.c |  5 +
  src/egl/drivers/dri2/platform_x11.c | 17 +
  2 files changed, 14 insertions(+), 8 deletions(-)

 diff --git a/src/egl/drivers/dri2/egl_dri2.c 
 b/src/egl/drivers/dri2/egl_dri2.c
 index 20a7243..2ed90a7 100644
 --- a/src/egl/drivers/dri2/egl_dri2.c
 +++ b/src/egl/drivers/dri2/egl_dri2.c
 @@ -110,6 +110,11 @@ EGLint dri2_to_egl_attribute_map[] = {
  static EGLBoolean
  dri2_match_config(const _EGLConfig *conf, const _EGLConfig *criteria)
  {
 +
 +   if (criteria-NativeVisualID != EGL_DONT_CARE 
 +conf-NativeVisualID != criteria-NativeVisualID)
 +  return EGL_FALSE;
 +
 if (_eglCompareConfigs(conf, criteria, NULL, EGL_FALSE) != 0)
return EGL_FALSE;

 diff --git a/src/egl/drivers/dri2/platform_x11.c 
 b/src/egl/drivers/dri2/platform_x11.c
 index a7a7338..3395fb7 100644
 --- a/src/egl/drivers/dri2/platform_x11.c
 +++ b/src/egl/drivers/dri2/platform_x11.c
 @@ -672,14 +672,15 @@ dri2_x11_add_configs_for_visuals(struct 
 dri2_egl_display *dri2_dpy,
  dri2_add_config(disp, dri2_dpy-driver_configs[j], id++,
  surface_type, config_attrs, rgba_masks);

 -/* Allow a 24-bit RGB visual to match a 32-bit RGBA EGLConfig.
 - * Otherwise it will only match a 32-bit RGBA visual.  On a
 - * composited window manager on X11, this will make all of the
 - * EGLConfigs with destination alpha get blended by the
 - * compositor.  This is probably not what the application
 - * wants... especially on drivers that only have 32-bit RGBA
 - * EGLConfigs! */
 -if (d.data-depth == 24) {
 +/* Allow both 24-bit RGB visual and 32 bit RGBA to match a 
 32-bit
 + * RGBA EGLConfig.  Otherwise it will only match a 32-bit RGBA
 + * visual.  On a composited window manager on X11, this will 
 make
 + * all of the EGLConfigs with destination alpha get blended by 
 the
 + * compositor.  This is probably not what the application 
 wants...
 + * especially on drivers that only have 32-bit RGBA EGLConfigs!
 + * Allowing both allows applications to make the decision 
 whether
 + * 32 bit visuals are intended */
 +if (d.data-depth == 24 || d.data-depth == 32) {
 rgba_masks[3] =
~(rgba_masks[0] | rgba_masks[1] | rgba_masks[2]);
 dri2_add_config(disp, dri2_dpy-driver_configs[j], id++,



 ___
 mesa-dev mailing list
 mesa-dev@lists.freedesktop.org
 http://lists.freedesktop.org/mailman/listinfo/mesa-dev
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev


Re: [Mesa-dev] [PATCH] egl_dri2: Allow both 24 and 32 bit X visuals for RGBA configs

2014-11-06 Thread Ian Romanick
I thought Eric and Chad already NAKed it in bugzilla.  The problem is
that applications ask for an RGBA visual for GL blending.  They use the
alpha channel to generate their images, but the final alpha values are,
basically, random... and the composited result would be pure garbage.

As Chad points out in comment #1, EGL just doesn't let applications do
the thing the patch is trying to do.

On 11/06/2014 05:12 AM, Emil Velikov wrote:
 Humble ping x2
 
 On 14/10/14 15:25, Emil Velikov wrote:
 Humble ping.

 On 23/09/14 01:25, Emil Velikov wrote:
 From: Sjoerd Simons sjoerd.sim...@collabora.co.uk

 When using RGBA EGLConfigs allow both RGB and RGBA X visuals, such that
 application can decide whether they want to use RGBA (and have the
 compositor blend their windows).

 On my system with this change EGLConfigs with a 24 bit visual comes up
 first, as such applications blindly picking the first EGLConfig will
 still get an RGB X visual.

 Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=67676
 ---

 Hello gents,

 This patch has been stuck in bugzilla since February this year. Bringing 
 it around here to gather greater exposure and perhaps some 
 comments/reviews.

 -Emil

  src/egl/drivers/dri2/egl_dri2.c |  5 +
  src/egl/drivers/dri2/platform_x11.c | 17 +
  2 files changed, 14 insertions(+), 8 deletions(-)

 diff --git a/src/egl/drivers/dri2/egl_dri2.c 
 b/src/egl/drivers/dri2/egl_dri2.c
 index 20a7243..2ed90a7 100644
 --- a/src/egl/drivers/dri2/egl_dri2.c
 +++ b/src/egl/drivers/dri2/egl_dri2.c
 @@ -110,6 +110,11 @@ EGLint dri2_to_egl_attribute_map[] = {
  static EGLBoolean
  dri2_match_config(const _EGLConfig *conf, const _EGLConfig *criteria)
  {
 +
 +   if (criteria-NativeVisualID != EGL_DONT_CARE 
 +conf-NativeVisualID != criteria-NativeVisualID)
 +  return EGL_FALSE;
 +
 if (_eglCompareConfigs(conf, criteria, NULL, EGL_FALSE) != 0)
return EGL_FALSE;
  
 diff --git a/src/egl/drivers/dri2/platform_x11.c 
 b/src/egl/drivers/dri2/platform_x11.c
 index a7a7338..3395fb7 100644
 --- a/src/egl/drivers/dri2/platform_x11.c
 +++ b/src/egl/drivers/dri2/platform_x11.c
 @@ -672,14 +672,15 @@ dri2_x11_add_configs_for_visuals(struct 
 dri2_egl_display *dri2_dpy,
 dri2_add_config(disp, dri2_dpy-driver_configs[j], id++,
 surface_type, config_attrs, rgba_masks);
  
 -/* Allow a 24-bit RGB visual to match a 32-bit RGBA EGLConfig.
 - * Otherwise it will only match a 32-bit RGBA visual.  On a
 - * composited window manager on X11, this will make all of the
 - * EGLConfigs with destination alpha get blended by the
 - * compositor.  This is probably not what the application
 - * wants... especially on drivers that only have 32-bit RGBA
 - * EGLConfigs! */
 -if (d.data-depth == 24) {
 +/* Allow both 24-bit RGB visual and 32 bit RGBA to match a 
 32-bit
 + * RGBA EGLConfig.  Otherwise it will only match a 32-bit RGBA
 + * visual.  On a composited window manager on X11, this will 
 make
 + * all of the EGLConfigs with destination alpha get blended by 
 the
 + * compositor.  This is probably not what the application 
 wants...
 + * especially on drivers that only have 32-bit RGBA EGLConfigs!
 + * Allowing both allows applications to make the decision 
 whether
 + * 32 bit visuals are intended */
 +if (d.data-depth == 24 || d.data-depth == 32) {
 rgba_masks[3] =
~(rgba_masks[0] | rgba_masks[1] | rgba_masks[2]);
 dri2_add_config(disp, dri2_dpy-driver_configs[j], id++,


 
 ___
 mesa-dev mailing list
 mesa-dev@lists.freedesktop.org
 http://lists.freedesktop.org/mailman/listinfo/mesa-dev
 

___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev


Re: [Mesa-dev] [PATCH] egl_dri2: Allow both 24 and 32 bit X visuals for RGBA configs

2014-10-14 Thread Emil Velikov
Humble ping.

On 23/09/14 01:25, Emil Velikov wrote:
 From: Sjoerd Simons sjoerd.sim...@collabora.co.uk
 
 When using RGBA EGLConfigs allow both RGB and RGBA X visuals, such that
 application can decide whether they want to use RGBA (and have the
 compositor blend their windows).
 
 On my system with this change EGLConfigs with a 24 bit visual comes up
 first, as such applications blindly picking the first EGLConfig will
 still get an RGB X visual.
 
 Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=67676
 ---
 
 Hello gents,
 
 This patch has been stuck in bugzilla since February this year. Bringing 
 it around here to gather greater exposure and perhaps some 
 comments/reviews.
 
 -Emil
 
  src/egl/drivers/dri2/egl_dri2.c |  5 +
  src/egl/drivers/dri2/platform_x11.c | 17 +
  2 files changed, 14 insertions(+), 8 deletions(-)
 
 diff --git a/src/egl/drivers/dri2/egl_dri2.c b/src/egl/drivers/dri2/egl_dri2.c
 index 20a7243..2ed90a7 100644
 --- a/src/egl/drivers/dri2/egl_dri2.c
 +++ b/src/egl/drivers/dri2/egl_dri2.c
 @@ -110,6 +110,11 @@ EGLint dri2_to_egl_attribute_map[] = {
  static EGLBoolean
  dri2_match_config(const _EGLConfig *conf, const _EGLConfig *criteria)
  {
 +
 +   if (criteria-NativeVisualID != EGL_DONT_CARE 
 +conf-NativeVisualID != criteria-NativeVisualID)
 +  return EGL_FALSE;
 +
 if (_eglCompareConfigs(conf, criteria, NULL, EGL_FALSE) != 0)
return EGL_FALSE;
  
 diff --git a/src/egl/drivers/dri2/platform_x11.c 
 b/src/egl/drivers/dri2/platform_x11.c
 index a7a7338..3395fb7 100644
 --- a/src/egl/drivers/dri2/platform_x11.c
 +++ b/src/egl/drivers/dri2/platform_x11.c
 @@ -672,14 +672,15 @@ dri2_x11_add_configs_for_visuals(struct 
 dri2_egl_display *dri2_dpy,
   dri2_add_config(disp, dri2_dpy-driver_configs[j], id++,
   surface_type, config_attrs, rgba_masks);
  
 -/* Allow a 24-bit RGB visual to match a 32-bit RGBA EGLConfig.
 - * Otherwise it will only match a 32-bit RGBA visual.  On a
 - * composited window manager on X11, this will make all of the
 - * EGLConfigs with destination alpha get blended by the
 - * compositor.  This is probably not what the application
 - * wants... especially on drivers that only have 32-bit RGBA
 - * EGLConfigs! */
 -if (d.data-depth == 24) {
 +/* Allow both 24-bit RGB visual and 32 bit RGBA to match a 32-bit
 + * RGBA EGLConfig.  Otherwise it will only match a 32-bit RGBA
 + * visual.  On a composited window manager on X11, this will make
 + * all of the EGLConfigs with destination alpha get blended by 
 the
 + * compositor.  This is probably not what the application 
 wants...
 + * especially on drivers that only have 32-bit RGBA EGLConfigs!
 + * Allowing both allows applications to make the decision whether
 + * 32 bit visuals are intended */
 +if (d.data-depth == 24 || d.data-depth == 32) {
 rgba_masks[3] =
~(rgba_masks[0] | rgba_masks[1] | rgba_masks[2]);
 dri2_add_config(disp, dri2_dpy-driver_configs[j], id++,
 

___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev


[Mesa-dev] [PATCH] egl_dri2: Allow both 24 and 32 bit X visuals for RGBA configs

2014-09-22 Thread Emil Velikov
From: Sjoerd Simons sjoerd.sim...@collabora.co.uk

When using RGBA EGLConfigs allow both RGB and RGBA X visuals, such that
application can decide whether they want to use RGBA (and have the
compositor blend their windows).

On my system with this change EGLConfigs with a 24 bit visual comes up
first, as such applications blindly picking the first EGLConfig will
still get an RGB X visual.

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=67676
---

Hello gents,

This patch has been stuck in bugzilla since February this year. Bringing 
it around here to gather greater exposure and perhaps some 
comments/reviews.

-Emil

 src/egl/drivers/dri2/egl_dri2.c |  5 +
 src/egl/drivers/dri2/platform_x11.c | 17 +
 2 files changed, 14 insertions(+), 8 deletions(-)

diff --git a/src/egl/drivers/dri2/egl_dri2.c b/src/egl/drivers/dri2/egl_dri2.c
index 20a7243..2ed90a7 100644
--- a/src/egl/drivers/dri2/egl_dri2.c
+++ b/src/egl/drivers/dri2/egl_dri2.c
@@ -110,6 +110,11 @@ EGLint dri2_to_egl_attribute_map[] = {
 static EGLBoolean
 dri2_match_config(const _EGLConfig *conf, const _EGLConfig *criteria)
 {
+
+   if (criteria-NativeVisualID != EGL_DONT_CARE 
+conf-NativeVisualID != criteria-NativeVisualID)
+  return EGL_FALSE;
+
if (_eglCompareConfigs(conf, criteria, NULL, EGL_FALSE) != 0)
   return EGL_FALSE;
 
diff --git a/src/egl/drivers/dri2/platform_x11.c 
b/src/egl/drivers/dri2/platform_x11.c
index a7a7338..3395fb7 100644
--- a/src/egl/drivers/dri2/platform_x11.c
+++ b/src/egl/drivers/dri2/platform_x11.c
@@ -672,14 +672,15 @@ dri2_x11_add_configs_for_visuals(struct dri2_egl_display 
*dri2_dpy,
dri2_add_config(disp, dri2_dpy-driver_configs[j], id++,
surface_type, config_attrs, rgba_masks);
 
-/* Allow a 24-bit RGB visual to match a 32-bit RGBA EGLConfig.
- * Otherwise it will only match a 32-bit RGBA visual.  On a
- * composited window manager on X11, this will make all of the
- * EGLConfigs with destination alpha get blended by the
- * compositor.  This is probably not what the application
- * wants... especially on drivers that only have 32-bit RGBA
- * EGLConfigs! */
-if (d.data-depth == 24) {
+/* Allow both 24-bit RGB visual and 32 bit RGBA to match a 32-bit
+ * RGBA EGLConfig.  Otherwise it will only match a 32-bit RGBA
+ * visual.  On a composited window manager on X11, this will make
+ * all of the EGLConfigs with destination alpha get blended by the
+ * compositor.  This is probably not what the application wants...
+ * especially on drivers that only have 32-bit RGBA EGLConfigs!
+ * Allowing both allows applications to make the decision whether
+ * 32 bit visuals are intended */
+if (d.data-depth == 24 || d.data-depth == 32) {
rgba_masks[3] =
   ~(rgba_masks[0] | rgba_masks[1] | rgba_masks[2]);
dri2_add_config(disp, dri2_dpy-driver_configs[j], id++,
-- 
2.1.0

___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev