[Mesa-dev] [RFC PATCH] mesa/st/cb_clear: in st_Clear also validate the render state (needed by virgl)

Gurchetan Singh gurchetansingh at chromium.org
Fri May 4 21:17:22 UTC 2018


On Fri, May 4, 2018 at 1:11 PM, Ilia Mirkin <imirkin at alum.mit.edu> wrote:
> On Fri, May 4, 2018 at 2:50 PM, Gert Wollny <gert.wollny at collabora.com> wrote:
>> For that reason I think that a render state validation within st_Clear
>> makes sense, because it makes sure that the states like  SCISSOR_TEST
>> or DISCARD_RASTERIZER are properly send to the driver, before clear()
>> is executed that makes use of these states. And while the workaround
>> for DISCARD_RASTERIZER is possible because if it is set then the host
>> should actually never see the clear command, SCISSOR_TEST is different,
>> its state can not be guessed on the host.
>>
>> Anyway, I happily take every hint on how this can be fixed directly in
>> virgl_clear or virgl in general, and thank you for taking the time to
>> answer me,
>
> I thought someone else took care of the scissor thing for clears. At
> least they were asking about it.

Yes, there were similar problems with stencils and scissors.

https://cgit.freedesktop.org/virglrenderer/commit/?id=b75e0a1dabdfbda44c310a69026a9dbd7d980294
https://cgit.freedesktop.org/virglrenderer/commit/?id=252b00d77c30ce39608c1a9de18523cbdcaca623

Essentially, we need save and restore the prior rasterizer state.

> I have to assume that virglrenderer keeps track of the last-set
> rasterizer state. Based on that, you have to turn off scissors,
> rasterizer discard, window rectangles, stencil tests, sample masks(?),
> and anything else which affects clears (have a look at st_Clear --
> anything that causes it to hit the fallback path which draws should be
> something you turn off because calling glClear() in virglrenderer).
>
> If you don't keep track of the last-set rasterizer state, then now may
> be a good time to start :)
>
>   -ilia
> _______________________________________________
> mesa-dev mailing list
> mesa-dev at lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/mesa-dev


More information about the mesa-dev mailing list