<div dir="ltr">Ilia: please review patch v4. I have added a separate patch to fix the GLES3 sRGB workaround, which fixes the colorspace issue.</div><div class="gmail_extra"><br><div class="gmail_quote">On Tue, Apr 5, 2016 at 5:20 PM, Ilia Mirkin <span dir="ltr"><<a href="mailto:imirkin@alum.mit.edu" target="_blank">imirkin@alum.mit.edu</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Sounds right. That's glEnable/glDisable(GL_FRAMEBUFFER_SRGB). It<br>
defaults to off for desktop GL, and on for GL ES (why? no clue.)<br>
<div class="HOEnZb"><div class="h5"><br>
On Tue, Apr 5, 2016 at 8:11 PM, Haixia Shi <<a href="mailto:hshi@chromium.org">hshi@chromium.org</a>> wrote:<br>
> Are you referring to the following check<br>
><br>
> mesa_format<br>
> _mesa_get_render_format(const struct gl_context *ctx, mesa_format format)<br>
> {<br>
> if (ctx->Color.sRGBEnabled)<br>
> return format;<br>
> else<br>
> return _mesa_get_srgb_format_linear(format);<br>
> }<br>
><br>
> So if the platform sets ctx->Color.sRGBEnabled = false then I should not<br>
> have this problem? Thanks<br>
><br>
> On Tue, Apr 5, 2016 at 2:04 PM, Ilia Mirkin <<a href="mailto:imirkin@alum.mit.edu">imirkin@alum.mit.edu</a>> wrote:<br>
>><br>
>> On Tue, Apr 5, 2016 at 4:57 PM, Haixia Shi <<a href="mailto:hshi@chromium.org">hshi@chromium.org</a>> wrote:<br>
>> > CC Stephane<br>
>> ><br>
>> > In my opinion we should not assume sRGB-capable when alpha is requested,<br>
>> > because UNORM is the more common use case. I actually have a use case<br>
>> > where<br>
>> > alpha is requested but not sRGBCapable, and if we assume SRGB by default<br>
>> > then we will get really white-washed faded color.<br>
>><br>
>> That most likely means that your application is buggy. Even though the<br>
>> SRGB format is returned internally, that doesn't mean that SRGB<br>
>> encoding/decoding is actually enabled. Just provides the option for it<br>
>> to be used.<br>
>><br>
>> ><br>
>> > On Tue, Apr 5, 2016 at 1:52 PM, Ilia Mirkin <<a href="mailto:imirkin@alum.mit.edu">imirkin@alum.mit.edu</a>><br>
>> > wrote:<br>
>> >><br>
>> >> On Tue, Apr 5, 2016 at 4:33 PM, Haixia Shi <<a href="mailto:hshi@chromium.org">hshi@chromium.org</a>> wrote:<br>
>> >> > It is incorrect to assume that pixel format is always in BGR byte<br>
>> >> > order.<br>
>> >> > We need to check bitmask parameters (such as |redMask|) to determine<br>
>> >> > whether<br>
>> >> > the RGB or BGR byte order is requested.<br>
>> >> ><br>
>> >> > Furthermore when parameter |sRGBCapable| is set to false, we should<br>
>> >> > be<br>
>> >> > using<br>
>> >> > UNORM format by default.<br>
>> >><br>
>> >> Unfortunately none of the visuals are exported with that flag, so it<br>
>> >> will always be false in practice. The current logic is also very<br>
>> >> fragile -- you only get a sRGB-capable fb if you happen to request<br>
>> >> alpha.<br>
>> >><br>
>> >> ><br>
>> >> > v2: reformat code to stay within 80 character per line limit.<br>
>> >> ><br>
>> >> > Signed-off-by: Haixia Shi <<a href="mailto:hshi@chromium.org">hshi@chromium.org</a>><br>
>> >> > Reviewed-by: Stéphane Marchesin <<a href="mailto:marcheu@chromium.org">marcheu@chromium.org</a>><br>
>> >> > Cc: <a href="mailto:kenneth.w.graunke@intel.com">kenneth.w.graunke@intel.com</a><br>
>> >> ><br>
>> >> > Change-Id: Ib75087aef1fbfb51baa72517207fed410dcd7b1e<br>
>> >> > ---<br>
>> >> > src/mesa/drivers/dri/i965/intel_screen.c | 20 ++++++++++++--------<br>
>> >> > 1 file changed, 12 insertions(+), 8 deletions(-)<br>
>> >> ><br>
>> >> > diff --git a/src/mesa/drivers/dri/i965/intel_screen.c<br>
>> >> > b/src/mesa/drivers/dri/i965/intel_screen.c<br>
>> >> > index c6eb50a..a27d7ee 100644<br>
>> >> > --- a/src/mesa/drivers/dri/i965/intel_screen.c<br>
>> >> > +++ b/src/mesa/drivers/dri/i965/intel_screen.c<br>
>> >> > @@ -1000,15 +1000,19 @@ intelCreateBuffer(__DRIscreen * driScrnPriv,<br>
>> >> > fb->Visual.samples = num_samples;<br>
>> >> > }<br>
>> >> ><br>
>> >> > - if (mesaVis->redBits == 5)<br>
>> >> > - rgbFormat = MESA_FORMAT_B5G6R5_UNORM;<br>
>> >> > - else if (mesaVis->sRGBCapable)<br>
>> >> > - rgbFormat = MESA_FORMAT_B8G8R8A8_SRGB;<br>
>> >> > - else if (mesaVis->alphaBits == 0)<br>
>> >> > - rgbFormat = MESA_FORMAT_B8G8R8X8_UNORM;<br>
>> >> > - else {<br>
>> >> > - rgbFormat = MESA_FORMAT_B8G8R8A8_SRGB;<br>
>> >> > + if (mesaVis->redBits == 5) {<br>
>> >> > + rgbFormat = mesaVis->redMask == 0x1f ?<br>
>> >> > MESA_FORMAT_R5G6B5_UNORM<br>
>> >> > + :<br>
>> >> > MESA_FORMAT_B5G6R5_UNORM;<br>
>> >> > + } else if (mesaVis->alphaBits == 0) {<br>
>> >> > + rgbFormat = mesaVis->redMask == 0xff ?<br>
>> >> > MESA_FORMAT_R8G8B8X8_UNORM<br>
>> >> > + :<br>
>> >> > MESA_FORMAT_B8G8R8X8_UNORM;<br>
>> >> > + } else if (mesaVis->sRGBCapable) {<br>
>> >> > + rgbFormat = mesaVis->redMask == 0xff ?<br>
>> >> > MESA_FORMAT_R8G8B8A8_SRGB<br>
>> >> > + :<br>
>> >> > MESA_FORMAT_B8G8R8A8_SRGB;<br>
>> >> > fb->Visual.sRGBCapable = true;<br>
>> >> > + } else {<br>
>> >> > + rgbFormat = mesaVis->redMask == 0xff ?<br>
>> >> > MESA_FORMAT_R8G8B8A8_UNORM<br>
>> >> > + :<br>
>> >> > MESA_FORMAT_B8G8R8A8_UNORM;<br>
>> >> > }<br>
>> >> ><br>
>> >> > /* setup the hardware-based renderbuffers */<br>
>> >> > --<br>
>> >> > 2.8.0.rc3.226.g39d4020<br>
>> >> ><br>
>> >> > _______________________________________________<br>
>> >> > mesa-dev mailing list<br>
>> >> > <a href="mailto:mesa-dev@lists.freedesktop.org">mesa-dev@lists.freedesktop.org</a><br>
>> >> > <a href="https://lists.freedesktop.org/mailman/listinfo/mesa-dev" rel="noreferrer" target="_blank">https://lists.freedesktop.org/mailman/listinfo/mesa-dev</a><br>
>> ><br>
>> ><br>
><br>
><br>
</div></div></blockquote></div><br></div>