<div dir="ltr"><div class="gmail_extra"><div class="gmail_quote">On Thu, Feb 8, 2018 at 4:46 PM, Marek Olšák <span dir="ltr"><<a href="mailto:maraeo@gmail.com" target="_blank">maraeo@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">This is not the correct fix.<br>
<br>
clear_with_quad calls cso_set_blend. pipe->clear ignores (and should<br>
ignore) the blend state. There is no scenario where you would have to<br>
call st_update_blend for pipe->clear. I think this is a virgl bug in<br>
pipe->clear.<br></blockquote><div><br></div><div><span style="color:rgb(34,34,34);font-family:arial,sans-serif;font-size:small;font-style:normal;font-variant-ligatures:normal;font-variant-caps:normal;font-weight:400;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;background-color:rgb(255,255,255);text-decoration-style:initial;text-decoration-color:initial;float:none;display:inline">clear_with_quad</span> is only called if a color mask exists (see is_color_masked).  When the state transitions from color-mask exists --> completely unmasked (the clear_buffers case), how is the driver supposed to be notified?  </div><div><br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
<br>
Marek<br>
<div><div class="gmail-h5"><br>
On Fri, Feb 9, 2018 at 1:28 AM, <a href="mailto:gurchetansingh@chromium.org">gurchetansingh@chromium.org</a><br>
<<a href="mailto:gurchetansingh@chromium.org">gurchetansingh@chromium.org</a>> wrote:<br>
> From: Gurchetan Singh <<a href="mailto:gurchetansingh@chromium.org">gurchetansingh@chromium.org</a>><br>
><br>
> Consider this series of events:<br>
><br>
> glColorMask(GL_FALSE, GL_TRUE, GL_TRUE, GL_TRUE);<br>
> glClearColor(0.125f, 0.25f, 0.5f, 1.0f);<br>
> glClear(GL_COLOR_BUFFER_BIT);<br>
> glColorMask(GL_TRUE, GL_TRUE, GL_TRUE, GL_TRUE);<br>
> glClearColor(0.1f, 0.1f, 0.1f, 1.0f);<br>
> glClear(GL_COLOR_BUFFER_BIT);<br>
><br>
> With virgl, this may render an incorrect result.  This is because<br>
> there our two paths for clears in Gallium -- one for full clears<br>
> (st->pipe->clear) and another for color-masked/scissored clears<br>
> (clear_with_quad).  We only encode the color mask in the<br>
> virgl_encode_blend_state in the clear_with_quad case.<br>
><br>
> We should set the colormask the case of full clears as well, since<br>
> we need to update the GL state on the host driver.<br>
><br>
> With this patch, the number of dEQP GLES2 failures on Virgl with a<br>
> nvidia host drivers goes from 260 to 136 with no regressions.<br>
> Two representative test cases are:<br>
><br>
> dEQP-GLES2.functional.color_<wbr>clear.masked_scissored_rgb<br>
> dEQP-GLES2.functional.color_<wbr>clear.masked_scissored_rgba<br>
><br>
> Note: I tried a virgl specific solution (<a href="http://crrev.com/c/909961" rel="noreferrer" target="_blank">crrev.com/c/909961</a>), however<br>
> that caused a regression in dEQP-GLES2.functional.depth_<wbr>stencil_clear.depth<br>
> since the cso_cache was not updated.<br>
> ---<br>
>  src/mesa/state_tracker/st_cb_<wbr>clear.c | 7 +++++++<br>
>  1 file changed, 7 insertions(+)<br>
><br>
> diff --git a/src/mesa/state_tracker/st_<wbr>cb_clear.c b/src/mesa/state_tracker/st_<wbr>cb_clear.c<br>
> index 68677182ab..d8ad2b3b4a 100644<br>
> --- a/src/mesa/state_tracker/st_<wbr>cb_clear.c<br>
> +++ b/src/mesa/state_tracker/st_<wbr>cb_clear.c<br>
> @@ -444,6 +444,13 @@ st_Clear(struct gl_context *ctx, GLbitfield mask)<br>
>        clear_with_quad(ctx, quad_buffers);<br>
>     }<br>
>     if (clear_buffers) {<br>
> +      /* The colormask may go from a masked value to being completely unmasked.<br>
> +       * In that case, we should notify the driver via st_update_blend. The cso<br>
> +       * cache should take care of not emitting old states.<br>
> +       */<br>
> +      if (clear_buffers & PIPE_CLEAR_COLOR)<br>
> +         st_update_blend(st);<br>
> +<br>
>        /* We can't translate the clear color to the colorbuffer format,<br>
>         * because different colorbuffers may have different formats.<br>
>         */<br>
> --<br>
> 2.13.5<br>
><br>
</div></div>> ______________________________<wbr>_________________<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/<wbr>mailman/listinfo/mesa-dev</a><br>
</blockquote></div><br></div></div>