[Mesa-dev] Revert "i965: Use MESA_FORMAT_B8G8R8X8_SRGB for RGB visuals"

Submitted by Neil Roberts on Dec. 16, 2015, 2:53 p.m.

Details

Message ID 1450277593-7897-1-git-send-email-neil@linux.intel.com
State Accepted
Commit 61cdb7665f7bd147533cdc5977750d990c2eafd5
Headers show
Series "Revert "i965: Use MESA_FORMAT_B8G8R8X8_SRGB for RGB visuals"" ( rev: 1 ) in Mesa

Not browsing as part of any series.

Commit Message

Neil Roberts Dec. 16, 2015, 2:53 p.m.
This reverts commit 839793680f99b8387bee9489733d5071c10f3ace.

The patch was breaking DRI3 because driGLFormatToImageFormat does not
handle MESA_FORMAT_B8G8R8X8_SRGB which ended up making it fail to
create the renderbuffer and it would later crash. It's not trivial to
add this format because there is no __DRI_IMAGE_FORMAT nor
__DRI_IMAGE_FOURCC define for the format either. I'm not sure how
difficult adding this would be and whether adding a new format would
require some sort of new version for DRI. Seeing as this might take a
while to fix I think it makes sense to just revert the patch in the
meantime in order to avoid regressing master.

It is also not handled in intel_gles3_srgb_workaround and there may be
other cases where it breaks.

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=93388
---
 src/mesa/drivers/dri/i965/intel_screen.c | 13 +++++++------
 1 file changed, 7 insertions(+), 6 deletions(-)

Patch hide | download patch | download mbox

diff --git a/src/mesa/drivers/dri/i965/intel_screen.c b/src/mesa/drivers/dri/i965/intel_screen.c
index 825a7c1..cc90efe 100644
--- a/src/mesa/drivers/dri/i965/intel_screen.c
+++ b/src/mesa/drivers/dri/i965/intel_screen.c
@@ -999,13 +999,14 @@  intelCreateBuffer(__DRIscreen * driScrnPriv,
       fb->Visual.samples = num_samples;
    }
 
-   if (mesaVis->redBits == 5) {
+   if (mesaVis->redBits == 5)
       rgbFormat = MESA_FORMAT_B5G6R5_UNORM;
-   } else {
-      if (mesaVis->alphaBits == 0)
-         rgbFormat = MESA_FORMAT_B8G8R8X8_SRGB;
-      else
-         rgbFormat = MESA_FORMAT_B8G8R8A8_SRGB;
+   else if (mesaVis->sRGBCapable)
+      rgbFormat = MESA_FORMAT_B8G8R8A8_SRGB;
+   else if (mesaVis->alphaBits == 0)
+      rgbFormat = MESA_FORMAT_B8G8R8X8_UNORM;
+   else {
+      rgbFormat = MESA_FORMAT_B8G8R8A8_SRGB;
       fb->Visual.sRGBCapable = true;
    }
 

Comments

Ack
On Dec 16, 2015 6:53 AM, "Neil Roberts" <neil@linux.intel.com> wrote:

> This reverts commit 839793680f99b8387bee9489733d5071c10f3ace.
>
> The patch was breaking DRI3 because driGLFormatToImageFormat does not
> handle MESA_FORMAT_B8G8R8X8_SRGB which ended up making it fail to
> create the renderbuffer and it would later crash. It's not trivial to
> add this format because there is no __DRI_IMAGE_FORMAT nor
> __DRI_IMAGE_FOURCC define for the format either. I'm not sure how
> difficult adding this would be and whether adding a new format would
> require some sort of new version for DRI. Seeing as this might take a
> while to fix I think it makes sense to just revert the patch in the
> meantime in order to avoid regressing master.
>
> It is also not handled in intel_gles3_srgb_workaround and there may be
> other cases where it breaks.
>
> Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=93388
> ---
>  src/mesa/drivers/dri/i965/intel_screen.c | 13 +++++++------
>  1 file changed, 7 insertions(+), 6 deletions(-)
>
> diff --git a/src/mesa/drivers/dri/i965/intel_screen.c
> b/src/mesa/drivers/dri/i965/intel_screen.c
> index 825a7c1..cc90efe 100644
> --- a/src/mesa/drivers/dri/i965/intel_screen.c
> +++ b/src/mesa/drivers/dri/i965/intel_screen.c
> @@ -999,13 +999,14 @@ intelCreateBuffer(__DRIscreen * driScrnPriv,
>        fb->Visual.samples = num_samples;
>     }
>
> -   if (mesaVis->redBits == 5) {
> +   if (mesaVis->redBits == 5)
>        rgbFormat = MESA_FORMAT_B5G6R5_UNORM;
> -   } else {
> -      if (mesaVis->alphaBits == 0)
> -         rgbFormat = MESA_FORMAT_B8G8R8X8_SRGB;
> -      else
> -         rgbFormat = MESA_FORMAT_B8G8R8A8_SRGB;
> +   else if (mesaVis->sRGBCapable)
> +      rgbFormat = MESA_FORMAT_B8G8R8A8_SRGB;
> +   else if (mesaVis->alphaBits == 0)
> +      rgbFormat = MESA_FORMAT_B8G8R8X8_UNORM;
> +   else {
> +      rgbFormat = MESA_FORMAT_B8G8R8A8_SRGB;
>        fb->Visual.sRGBCapable = true;
>     }
>
> --
> 1.9.3
>
> _______________________________________________
> mesa-dev mailing list
> mesa-dev@lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/mesa-dev
>