[RFC] etnaviv: flush color cache and depth cache together before resolves
Wladimir J. van der Laan
laanwj at gmail.com
Tue Jun 20 14:03:20 UTC 2017
On Tue, May 30, 2017 at 12:50:07PM +0200, Philipp Zabel wrote:
> Before resolving a rendertarget or a depth/stencil resource into a
> texture, flush both the color cache and the depth cache together.
>
> It is unclear whether this is necessary for the following stall to
> work properly, or whether the depth flush just adds enough time
> for the color cache flush to finish before the resolver is started,
> but this change removes artifacts that otherwise appear if a texture
> is sampled directly after rendering into it.
>
> The test case is a simple QML scene graph with a QtWebEngine based
> WebView rendered on top of a blue background:
>
> import QtQuick 2.0
> import QtQuick.Window 2.2
> import QtWebView 1.1
>
> Window {
> Rectangle {
> id: background
> anchors.fill: parent
> color: "blue"
> }
>
> WebView {
> id: webView
> anchors.fill: parent
> }
>
> Component.onCompleted: {
> webView.url = "<some animated website>"
> }
> }
>
> If the website is animated, the WebView renders the site contents into
> texture tiles and immediately afterwards samples from them to draw the
> tiles into the Qt renderbuffer. Without this patch, a small irregular
> triangle in the lower right of each browser tile appears solid blue, as
> if the texture sampler samples zeroes instead of the website contents,
> and the previously rendered blue Rectangle shows through.
>
> Other attempts such as adding a pipeline stall before the color flush or
> a TS cache flush afterwards or flushing multiple times, with stalls
> before and after each flush, have shown no effect.
>
> Signed-off-by: Philipp Zabel <p.zabel at pengutronix.de>
> ---
> src/gallium/drivers/etnaviv/etnaviv_clear_blit.c | 13 ++++---------
> 1 file changed, 4 insertions(+), 9 deletions(-)
>
> diff --git a/src/gallium/drivers/etnaviv/etnaviv_clear_blit.c b/src/gallium/drivers/etnaviv/etnaviv_clear_blit.c
> index ae1c586288..faa6bd0436 100644
> --- a/src/gallium/drivers/etnaviv/etnaviv_clear_blit.c
> +++ b/src/gallium/drivers/etnaviv/etnaviv_clear_blit.c
> @@ -455,15 +455,10 @@ etna_try_rs_blit(struct pipe_context *pctx,
> ts_mem_config |= VIVS_TS_MEM_CONFIG_MSAA | msaa_format;
> }
>
> - uint32_t to_flush = 0;
> -
> - if (src->base.bind & PIPE_BIND_RENDER_TARGET)
> - to_flush |= VIVS_GL_FLUSH_CACHE_COLOR;
> - if (src->base.bind & PIPE_BIND_DEPTH_STENCIL)
> - to_flush |= VIVS_GL_FLUSH_CACHE_DEPTH;
> -
> - if (to_flush) {
> - etna_set_state(ctx->stream, VIVS_GL_FLUSH_CACHE, to_flush);
> + if (src->base.bind & PIPE_BIND_RENDER_TARGET ||
> + src->base.bind & PIPE_BIND_DEPTH_STENCIL) {
> + etna_set_state(ctx->stream, VIVS_GL_FLUSH_CACHE,
> + VIVS_GL_FLUSH_CACHE_COLOR | VIVS_GL_FLUSH_CACHE_DEPTH);
Can you please add a comment here, describing (as above) why both
caches are flushed?
These things are hard to get right, so any bit of documentation why
a certain choice was made while reading the code helps.
> etna_stall(ctx->stream, SYNC_RECIPIENT_RA, SYNC_RECIPIENT_PE);
> }
>
> --
> 2.11.0
>
> _______________________________________________
> etnaviv mailing list
> etnaviv at lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/etnaviv
More information about the etnaviv
mailing list