<div dir="auto">I prefer not to have any negative caps.<div dir="auto"><br></div><div dir="auto">Marek</div></div><br><div class="gmail_quote"><div dir="ltr">On Tue, Nov 6, 2018, 11:14 AM Ilia Mirkin <<a href="mailto:imirkin@alum.mit.edu">imirkin@alum.mit.edu</a> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">On Tue, Nov 6, 2018 at 10:27 AM Gert Wollny <<a href="mailto:gert.wollny@collabora.com" target="_blank" rel="noreferrer">gert.wollny@collabora.com</a>> wrote:<br>
><br>
> Am Dienstag, den 06.11.2018, 09:29 -0500 schrieb Ilia Mirkin:<br>
> > On Tue, Nov 6, 2018 at 5:59 AM Gert Wollny <<a href="mailto:gert.wollny@collabora.com" target="_blank" rel="noreferrer">gert.wollny@collabora.com</a><br>
> > > wrote:<br>
> > ><br>
> > ><br>
> > > I'm not so sure that things break, at least we have all the dEQP<br>
> > > master tests that are enabled by the available extension (level<br>
> > > GLES 3.2+) passing on virgl, which would indicate that what is done<br>
> > > in mesa and virglrender is sufficiently correct for running a gles<br>
> > > 3.2 environment on top of a gles 3.2 host also without<br>
> > > EXT_sRGB_write_control<br>
> > > (obviously also not using this functionbality in the guest).<br>
> ><br>
> > Well, have a look at the code, and see if you can get it to trigger<br>
> > with a SRGB format. I suspect there's just no test that hits that<br>
> > particular scenario. Or perhaps you're 100% fallback-path driven on<br>
> > virgl?<br>
> Ther is no fallback, when the guest uses<br>
> glEnable/Disable(GL_FRAMEBUFFER_EXT) and the host doesn't support it,<br>
> and there it also fails. This is to be expected and only shows that the<br>
> guest shouldn't expose EXT_framebuffer_sRGB solely based on available<br>
> formats.<br>
<br>
I mean in the code, there's a "goto fallback" in various situations,<br>
which does the operation on the CPU. If you're 100% in that path, then<br>
you won't have issues.<br>
<br>
><br>
> > In that case, that particular code is fine, but I didn't do a<br>
> > full audit of the codebase. These tests would presumably be failing<br>
> > already, since the issue is that you *don't* have<br>
> > EXT_sRGB_write_control on the host and are trying to implement SRGB<br>
> > formats.<br>
> That was my guess too. I think if that code would do something wrong<br>
> without the guest explicitely en/disabling GL_FRAMEBUFFER_SRGB we would<br>
> have seen it.<br>
<br>
sRGB issues can be subtle. I doubt there's strong test coverage of all<br>
the various cases, and visually scenes just appear "dark", not<br>
"totally broken". I'd encourage you to trace the code and try to<br>
construct a test case that hits the path I pointed out as problematic.<br>
(iirc the blit in st_TexSubImage, which uses a normalized dst format,<br>
but I don't have the code in front of me)<br>
<br>
><br>
> [...]<br>
> > > I can now also understand your point of view that<br>
> > > EXT_sRGB_write_control and EXT_framebuffer_sRGB constitute the same<br>
> > > functionality, but then there is still some flag missing that<br>
> > > indicates for GLES that sRGB formats are available, but write<br>
> > > control isn't,<br>
> > > and using only a texture format test to identify whether<br>
> > > EXT_framebuffer_sRGB is supported is not sufficint for the scenario<br>
> > > above (which brings me back to actually using a CAP to indicate<br>
> > > whether the "hardware" supports sRGB write control.).<br>
> ><br>
> > I'd go the other way -- have a cap that shows that you CANT support<br>
> > surface formats differing from the resource format. The current<br>
> > implication is that this is always supported. There's a handful of<br>
> > such anti-CAP's, and given that this is a violation of the existing<br>
> > gallium interface (where the surface format != resource format is<br>
> > generally supported), I think that's the way to go.<br>
> Hmm, currently mesa exposes GLES 3.0 based on EXT_framebuffer_sRGB,<br>
> which is more then is needed, and EXT_texture_sRGB is not enough, so I<br>
> need one more flag that reflect the GLES requirement of format support<br>
> without the need to support the format switching, probably in gl_const,<br>
> because this is what is passed to mesa/compute_version_e2(...).<br>
<br>
I'm not as intimately familiar with GLES extensions / features, but<br>
would EXT_sRGB be the extension that covers that support? Mesa does<br>
not presently implement this extension, but if it's the right one,<br>
perhaps adding an implementation of that, and then doing something<br>
like<br>
<br>
EXT_sRGB = is_format_supported(SRGB)<br>
EXT_framebuffer_sRGB / ARB_framebuffer_sRGB / EXT_sRGB_write_control =<br>
is_format_supported(SRGB) &&<br>
!PIPE_CAP_REQUIRE_SURFACE_RESOURCE_FORMAT_MATCH<br>
GLES3 = EXT_sRGB (& others, obviously)<br>
<br>
And that PIPE_CAP would then in turn only ever be "enabled" by virgl<br>
when running on a host without EXT_sRGB_write_control (or equivalent)<br>
support.<br>
<br>
Cheers,<br>
<br>
  -ilia<br>
_______________________________________________<br>
mesa-dev mailing list<br>
<a href="mailto:mesa-dev@lists.freedesktop.org" target="_blank" rel="noreferrer">mesa-dev@lists.freedesktop.org</a><br>
<a href="https://lists.freedesktop.org/mailman/listinfo/mesa-dev" rel="noreferrer noreferrer" target="_blank">https://lists.freedesktop.org/mailman/listinfo/mesa-dev</a><br>
</blockquote></div>