[Mesa-dev] [PATCH 1/3] gallium: add render_condition_enable param to clear_render_target/depth_stencil
Roland Scheidegger
sroland at vmware.com
Tue Aug 9 00:04:27 UTC 2016
Am 09.08.2016 um 00:59 schrieb Marek Olšák:
> From: Marek Olšák <marek.olsak at amd.com>
>
> ---
> src/gallium/auxiliary/util/u_clear.h | 5 +++--
> src/gallium/auxiliary/vl/vl_bicubic_filter.c | 2 +-
> src/gallium/auxiliary/vl/vl_compositor.c | 2 +-
> src/gallium/docs/source/context.rst | 7 ++++---
> src/gallium/drivers/ddebug/dd_draw.c | 12 ++++++++----
> src/gallium/drivers/freedreno/freedreno_draw.c | 6 ++++--
> src/gallium/drivers/i915/i915_surface.c | 12 ++++++++----
> src/gallium/drivers/ilo/ilo_blit.c | 6 ++++--
> src/gallium/drivers/llvmpipe/lp_surface.c | 6 ++++--
> src/gallium/drivers/noop/noop_pipe.c | 6 ++++--
> src/gallium/drivers/nouveau/nv30/nv30_clear.c | 6 ++++--
> src/gallium/drivers/nouveau/nv50/nv50_surface.c | 10 ++++++----
> src/gallium/drivers/nouveau/nv50/nv84_video.c | 6 +++---
> src/gallium/drivers/nouveau/nvc0/nvc0_surface.c | 6 ++++--
> src/gallium/drivers/r300/r300_blit.c | 6 ++++--
> src/gallium/drivers/r600/r600_blit.c | 6 ++++--
> src/gallium/drivers/radeonsi/si_blit.c | 6 ++++--
> src/gallium/drivers/rbug/rbug_context.c | 12 ++++++++----
> src/gallium/drivers/softpipe/sp_surface.c | 6 ++++--
> src/gallium/drivers/swr/swr_clear.cpp | 6 ++++--
> src/gallium/drivers/trace/tr_context.c | 14 ++++++++++----
> src/gallium/drivers/vc4/vc4_draw.c | 6 ++++--
> src/gallium/include/pipe/p_context.h | 6 ++++--
> src/gallium/state_trackers/nine/device9.c | 6 +++---
> src/gallium/state_trackers/nine/surface9.c | 2 +-
> src/gallium/state_trackers/vdpau/surface.c | 2 +-
> 26 files changed, 109 insertions(+), 61 deletions(-)
>
> diff --git a/src/gallium/auxiliary/util/u_clear.h b/src/gallium/auxiliary/util/u_clear.h
> index 864d130..6413530 100644
> --- a/src/gallium/auxiliary/util/u_clear.h
> +++ b/src/gallium/auxiliary/util/u_clear.h
> @@ -42,22 +42,23 @@ util_clear(struct pipe_context *pipe,
> struct pipe_framebuffer_state *framebuffer, unsigned buffers,
> const union pipe_color_union *color, double depth, unsigned stencil)
> {
> unsigned i;
>
> for (i = 0; i < framebuffer->nr_cbufs; i++) {
> if (buffers & (PIPE_CLEAR_COLOR0 << i)) {
> struct pipe_surface *ps = framebuffer->cbufs[i];
>
> if (ps) {
> - pipe->clear_render_target(pipe, ps, color, 0, 0, ps->width, ps->height);
> + pipe->clear_render_target(pipe, ps, color, 0, 0, ps->width,
> + ps->height, true);
> }
> }
> }
>
> if (buffers & PIPE_CLEAR_DEPTHSTENCIL) {
> struct pipe_surface *ps = framebuffer->zsbuf;
> pipe->clear_depth_stencil(pipe, ps, buffers & PIPE_CLEAR_DEPTHSTENCIL,
> depth, stencil,
> - 0, 0, ps->width, ps->height);
> + 0, 0, ps->width, ps->height, true);
> }
> }
> diff --git a/src/gallium/auxiliary/vl/vl_bicubic_filter.c b/src/gallium/auxiliary/vl/vl_bicubic_filter.c
> index 51a0019..0364d43 100644
> --- a/src/gallium/auxiliary/vl/vl_bicubic_filter.c
> +++ b/src/gallium/auxiliary/vl/vl_bicubic_filter.c
> @@ -433,21 +433,21 @@ vl_bicubic_filter_render(struct vl_bicubic_filter *filter,
> pipe_buffer_unmap(filter->pipe, buf_transfer);
>
> memset(&fb_state, 0, sizeof(fb_state));
> fb_state.width = dst->width;
> fb_state.height = dst->height;
> fb_state.nr_cbufs = 1;
> fb_state.cbufs[0] = dst;
>
> filter->pipe->set_scissor_states(filter->pipe, 0, 1, &scissor);
> filter->pipe->clear_render_target(filter->pipe, dst, &clear_color,
> - 0, 0, dst->width, dst->height);
> + 0, 0, dst->width, dst->height, false);
> pipe_set_constant_buffer(filter->pipe, PIPE_SHADER_FRAGMENT, 0, surface_size);
> filter->pipe->bind_rasterizer_state(filter->pipe, filter->rs_state);
> filter->pipe->bind_blend_state(filter->pipe, filter->blend);
> filter->pipe->bind_sampler_states(filter->pipe, PIPE_SHADER_FRAGMENT,
> 0, 1, &filter->sampler);
> filter->pipe->set_sampler_views(filter->pipe, PIPE_SHADER_FRAGMENT,
> 0, 1, &src);
> filter->pipe->bind_vs_state(filter->pipe, filter->vs);
> filter->pipe->bind_fs_state(filter->pipe, filter->fs);
> filter->pipe->set_framebuffer_state(filter->pipe, &fb_state);
> diff --git a/src/gallium/auxiliary/vl/vl_compositor.c b/src/gallium/auxiliary/vl/vl_compositor.c
> index f7517f3..03a0a64 100644
> --- a/src/gallium/auxiliary/vl/vl_compositor.c
> +++ b/src/gallium/auxiliary/vl/vl_compositor.c
> @@ -1161,21 +1161,21 @@ vl_compositor_render(struct vl_compositor_state *s,
> s->scissor.maxy = dst_surface->height;
> }
> c->pipe->set_scissor_states(c->pipe, 0, 1, &s->scissor);
>
> gen_vertex_data(c, s, dirty_area);
>
> if (clear_dirty && dirty_area &&
> (dirty_area->x0 < dirty_area->x1 || dirty_area->y0 < dirty_area->y1)) {
>
> c->pipe->clear_render_target(c->pipe, dst_surface, &s->clear_color,
> - 0, 0, dst_surface->width, dst_surface->height);
> + 0, 0, dst_surface->width, dst_surface->height, false);
> dirty_area->x0 = dirty_area->y0 = MAX_DIRTY;
> dirty_area->x1 = dirty_area->y1 = MIN_DIRTY;
> }
>
> c->pipe->set_framebuffer_state(c->pipe, &c->fb_state);
> c->pipe->bind_vs_state(c->pipe, c->vs);
> c->pipe->set_vertex_buffers(c->pipe, 0, 1, &c->vertex_buf);
> c->pipe->bind_vertex_elements_state(c->pipe, c->vertex_elems_state);
> pipe_set_constant_buffer(c->pipe, PIPE_SHADER_FRAGMENT, 0, s->csc_matrix);
> c->pipe->bind_rasterizer_state(c->pipe, c->rast);
> diff --git a/src/gallium/docs/source/context.rst b/src/gallium/docs/source/context.rst
> index af3d266..1b045fa 100644
> --- a/src/gallium/docs/source/context.rst
> +++ b/src/gallium/docs/source/context.rst
> @@ -421,23 +421,24 @@ Gallium does not guarantee the availability of any query types; one must
> always check the capabilities of the :ref:`Screen` first.
>
>
> Conditional Rendering
> ^^^^^^^^^^^^^^^^^^^^^
>
> A drawing command can be skipped depending on the outcome of a query
> (typically an occlusion query, or streamout overflow predicate).
> The ``render_condition`` function specifies the query which should be checked
> prior to rendering anything. Functions always honoring render_condition include
> -(and are limited to) draw_vbo, clear, clear_render_target, clear_depth_stencil.
> -The blit function (but not resource_copy_region, which seems inconsistent)
> -can also optionally honor the current render condition.
> +(and are limited to) draw_vbo and clear.
> +The blit, clear_render_target and clear_depth_stencil functions (but
> +not resource_copy_region, which seems inconsistent) can also optionally honor
> +the current render condition.
>
> If ``render_condition`` is called with ``query`` = NULL, conditional
> rendering is disabled and drawing takes place normally.
>
> If ``render_condition`` is called with a non-null ``query`` subsequent
> drawing commands will be predicated on the outcome of the query.
> Commands will be skipped if ``condition`` is equal to the predicate result
> (for non-boolean queries such as OCCLUSION_QUERY, zero counts as FALSE,
> non-zero as TRUE).
>
> diff --git a/src/gallium/drivers/ddebug/dd_draw.c b/src/gallium/drivers/ddebug/dd_draw.c
> index 97325e4..13f6b6d 100644
> --- a/src/gallium/drivers/ddebug/dd_draw.c
> +++ b/src/gallium/drivers/ddebug/dd_draw.c
> @@ -1245,48 +1245,52 @@ dd_context_clear(struct pipe_context *_pipe, unsigned buffers,
> dd_before_draw(dctx);
> pipe->clear(pipe, buffers, color, depth, stencil);
> dd_after_draw(dctx, &call);
> }
>
> static void
> dd_context_clear_render_target(struct pipe_context *_pipe,
> struct pipe_surface *dst,
> const union pipe_color_union *color,
> unsigned dstx, unsigned dsty,
> - unsigned width, unsigned height)
> + unsigned width, unsigned height,
> + bool render_condition_enabled)
> {
> struct dd_context *dctx = dd_context(_pipe);
> struct pipe_context *pipe = dctx->pipe;
> struct dd_call call;
>
> call.type = CALL_CLEAR_RENDER_TARGET;
>
> dd_before_draw(dctx);
> - pipe->clear_render_target(pipe, dst, color, dstx, dsty, width, height);
> + pipe->clear_render_target(pipe, dst, color, dstx, dsty, width, height,
> + render_condition_enabled);
> dd_after_draw(dctx, &call);
> }
>
> static void
> dd_context_clear_depth_stencil(struct pipe_context *_pipe,
> struct pipe_surface *dst, unsigned clear_flags,
> double depth, unsigned stencil, unsigned dstx,
> - unsigned dsty, unsigned width, unsigned height)
> + unsigned dsty, unsigned width, unsigned height,
> + bool render_condition_enabled)
> {
> struct dd_context *dctx = dd_context(_pipe);
> struct pipe_context *pipe = dctx->pipe;
> struct dd_call call;
>
> call.type = CALL_CLEAR_DEPTH_STENCIL;
>
> dd_before_draw(dctx);
> pipe->clear_depth_stencil(pipe, dst, clear_flags, depth, stencil,
> - dstx, dsty, width, height);
> + dstx, dsty, width, height,
> + render_condition_enabled);
> dd_after_draw(dctx, &call);
> }
>
> static void
> dd_context_clear_buffer(struct pipe_context *_pipe, struct pipe_resource *res,
> unsigned offset, unsigned size,
> const void *clear_value, int clear_value_size)
> {
> struct dd_context *dctx = dd_context(_pipe);
> struct pipe_context *pipe = dctx->pipe;
> diff --git a/src/gallium/drivers/freedreno/freedreno_draw.c b/src/gallium/drivers/freedreno/freedreno_draw.c
> index ca42cf7..715ad21 100644
> --- a/src/gallium/drivers/freedreno/freedreno_draw.c
> +++ b/src/gallium/drivers/freedreno/freedreno_draw.c
> @@ -287,29 +287,31 @@ fd_clear(struct pipe_context *pctx, unsigned buffers,
> FD_DIRTY_BLEND |
> FD_DIRTY_FRAMEBUFFER;
>
> if (fd_mesa_debug & FD_DBG_DCLEAR)
> ctx->dirty = 0xffffffff;
> }
>
> static void
> fd_clear_render_target(struct pipe_context *pctx, struct pipe_surface *ps,
> const union pipe_color_union *color,
> - unsigned x, unsigned y, unsigned w, unsigned h)
> + unsigned x, unsigned y, unsigned w, unsigned h,
> + bool render_condition_enabled)
> {
> DBG("TODO: x=%u, y=%u, w=%u, h=%u", x, y, w, h);
> }
>
> static void
> fd_clear_depth_stencil(struct pipe_context *pctx, struct pipe_surface *ps,
> unsigned buffers, double depth, unsigned stencil,
> - unsigned x, unsigned y, unsigned w, unsigned h)
> + unsigned x, unsigned y, unsigned w, unsigned h,
> + bool render_condition_enabled)
> {
> DBG("TODO: buffers=%u, depth=%f, stencil=%u, x=%u, y=%u, w=%u, h=%u",
> buffers, depth, stencil, x, y, w, h);
> }
>
> void
> fd_draw_init(struct pipe_context *pctx)
> {
> pctx->draw_vbo = fd_draw_vbo;
> pctx->clear = fd_clear;
> diff --git a/src/gallium/drivers/i915/i915_surface.c b/src/gallium/drivers/i915/i915_surface.c
> index b2a639c..27b0d9e 100644
> --- a/src/gallium/drivers/i915/i915_surface.c
> +++ b/src/gallium/drivers/i915/i915_surface.c
> @@ -127,21 +127,22 @@ i915_surface_copy_render(struct pipe_context *pipe,
> fallback:
> util_resource_copy_region(pipe, dst, dst_level, dstx, dsty, dstz,
> src, src_level, src_box);
> }
>
> static void
> i915_clear_render_target_render(struct pipe_context *pipe,
> struct pipe_surface *dst,
> const union pipe_color_union *color,
> unsigned dstx, unsigned dsty,
> - unsigned width, unsigned height)
> + unsigned width, unsigned height,
> + bool render_condition_enabled)
> {
> struct i915_context *i915 = i915_context(pipe);
> struct pipe_framebuffer_state fb_state;
>
> util_blitter_save_framebuffer(i915->blitter, &i915->framebuffer);
>
> fb_state.width = dst->width;
> fb_state.height = dst->height;
> fb_state.nr_cbufs = 1;
> fb_state.cbufs[0] = dst;
> @@ -159,21 +160,22 @@ i915_clear_render_target_render(struct pipe_context *pipe,
> i915->blitter->saved_fb_state.nr_cbufs = ~0;
> }
>
> static void
> i915_clear_depth_stencil_render(struct pipe_context *pipe,
> struct pipe_surface *dst,
> unsigned clear_flags,
> double depth,
> unsigned stencil,
> unsigned dstx, unsigned dsty,
> - unsigned width, unsigned height)
> + unsigned width, unsigned height,
> + bool render_condition_enabled)
> {
> struct i915_context *i915 = i915_context(pipe);
> struct pipe_framebuffer_state fb_state;
>
> util_blitter_save_framebuffer(i915->blitter, &i915->framebuffer);
>
> fb_state.width = dst->width;
> fb_state.height = dst->height;
> fb_state.nr_cbufs = 0;
> fb_state.zsbuf = dst;
> @@ -274,21 +276,22 @@ i915_blit(struct pipe_context *pipe, const struct pipe_blit_info *blit_info)
> static void
> i915_flush_resource(struct pipe_context *ctx, struct pipe_resource *resource)
> {
> }
>
> static void
> i915_clear_render_target_blitter(struct pipe_context *pipe,
> struct pipe_surface *dst,
> const union pipe_color_union *color,
> unsigned dstx, unsigned dsty,
> - unsigned width, unsigned height)
> + unsigned width, unsigned height,
> + bool render_condition_enabled)
> {
> struct i915_texture *tex = i915_texture(dst->texture);
> struct pipe_resource *pt = &tex->b.b;
> union util_color uc;
> unsigned offset = i915_texture_offset(tex, dst->u.tex.level, dst->u.tex.first_layer);
>
> assert(util_format_get_blockwidth(pt->format) == 1);
> assert(util_format_get_blockheight(pt->format) == 1);
>
> util_pack_color(color->f, dst->format, &uc);
> @@ -302,21 +305,22 @@ i915_clear_render_target_blitter(struct pipe_context *pipe,
> uc.ui[0] );
> }
>
> static void
> i915_clear_depth_stencil_blitter(struct pipe_context *pipe,
> struct pipe_surface *dst,
> unsigned clear_flags,
> double depth,
> unsigned stencil,
> unsigned dstx, unsigned dsty,
> - unsigned width, unsigned height)
> + unsigned width, unsigned height,
> + bool render_condition_enabled)
> {
> struct i915_texture *tex = i915_texture(dst->texture);
> struct pipe_resource *pt = &tex->b.b;
> unsigned packedds;
> unsigned mask = 0;
> unsigned offset = i915_texture_offset(tex, dst->u.tex.level, dst->u.tex.first_layer);
>
> assert(util_format_get_blockwidth(pt->format) == 1);
> assert(util_format_get_blockheight(pt->format) == 1);
>
> diff --git a/src/gallium/drivers/ilo/ilo_blit.c b/src/gallium/drivers/ilo/ilo_blit.c
> index f88f1e8..e2ba6aa 100644
> --- a/src/gallium/drivers/ilo/ilo_blit.c
> +++ b/src/gallium/drivers/ilo/ilo_blit.c
> @@ -76,21 +76,22 @@ ilo_clear(struct pipe_context *pipe,
> }
>
> ilo_blitter_pipe_clear_fb(ilo->blitter, buffers, color, depth, stencil);
> }
>
> static void
> ilo_clear_render_target(struct pipe_context *pipe,
> struct pipe_surface *dst,
> const union pipe_color_union *color,
> unsigned dstx, unsigned dsty,
> - unsigned width, unsigned height)
> + unsigned width, unsigned height,
> + bool render_condition_enabled)
> {
> struct ilo_context *ilo = ilo_context(pipe);
>
> if (!width || !height || dstx >= dst->width || dsty >= dst->height)
> return;
>
> if (dstx + width > dst->width)
> width = dst->width - dstx;
> if (dsty + height > dst->height)
> height = dst->height - dsty;
> @@ -103,21 +104,22 @@ ilo_clear_render_target(struct pipe_context *pipe,
> dst, color, dstx, dsty, width, height);
> }
>
> static void
> ilo_clear_depth_stencil(struct pipe_context *pipe,
> struct pipe_surface *dst,
> unsigned clear_flags,
> double depth,
> unsigned stencil,
> unsigned dstx, unsigned dsty,
> - unsigned width, unsigned height)
> + unsigned width, unsigned height,
> + bool render_condition_enabled)
> {
> struct ilo_context *ilo = ilo_context(pipe);
>
> if (!width || !height || dstx >= dst->width || dsty >= dst->height)
> return;
>
> if (dstx + width > dst->width)
> width = dst->width - dstx;
> if (dsty + height > dst->height)
> height = dst->height - dsty;
> diff --git a/src/gallium/drivers/llvmpipe/lp_surface.c b/src/gallium/drivers/llvmpipe/lp_surface.c
> index dd1c446..643c416 100644
> --- a/src/gallium/drivers/llvmpipe/lp_surface.c
> +++ b/src/gallium/drivers/llvmpipe/lp_surface.c
> @@ -183,40 +183,42 @@ llvmpipe_surface_destroy(struct pipe_context *pipe,
> pipe_resource_reference(&surf->texture, NULL);
> FREE(surf);
> }
>
>
> static void
> llvmpipe_clear_render_target(struct pipe_context *pipe,
> struct pipe_surface *dst,
> const union pipe_color_union *color,
> unsigned dstx, unsigned dsty,
> - unsigned width, unsigned height)
> + unsigned width, unsigned height,
> + bool render_condition_enabled)
> {
> struct llvmpipe_context *llvmpipe = llvmpipe_context(pipe);
>
> if (!llvmpipe_check_render_cond(llvmpipe))
> return;
>
> util_clear_render_target(pipe, dst, color,
> dstx, dsty, width, height);
> }
>
>
> static void
> llvmpipe_clear_depth_stencil(struct pipe_context *pipe,
> struct pipe_surface *dst,
> unsigned clear_flags,
> double depth,
> unsigned stencil,
> unsigned dstx, unsigned dsty,
> - unsigned width, unsigned height)
> + unsigned width, unsigned height,
> + bool render_condition_enabled)
> {
> struct llvmpipe_context *llvmpipe = llvmpipe_context(pipe);
>
> if (!llvmpipe_check_render_cond(llvmpipe))
> return;
>
> util_clear_depth_stencil(pipe, dst, clear_flags,
> depth, stencil,
> dstx, dsty, width, height);
> }
> diff --git a/src/gallium/drivers/noop/noop_pipe.c b/src/gallium/drivers/noop/noop_pipe.c
> index 097ff21..cf20681 100644
> --- a/src/gallium/drivers/noop/noop_pipe.c
> +++ b/src/gallium/drivers/noop/noop_pipe.c
> @@ -216,31 +216,33 @@ static void noop_texture_subdata(struct pipe_context *pipe,
> */
> static void noop_clear(struct pipe_context *ctx, unsigned buffers,
> const union pipe_color_union *color, double depth, unsigned stencil)
> {
> }
>
> static void noop_clear_render_target(struct pipe_context *ctx,
> struct pipe_surface *dst,
> const union pipe_color_union *color,
> unsigned dstx, unsigned dsty,
> - unsigned width, unsigned height)
> + unsigned width, unsigned height,
> + bool render_condition_enabled)
> {
> }
>
> static void noop_clear_depth_stencil(struct pipe_context *ctx,
> struct pipe_surface *dst,
> unsigned clear_flags,
> double depth,
> unsigned stencil,
> unsigned dstx, unsigned dsty,
> - unsigned width, unsigned height)
> + unsigned width, unsigned height,
> + bool render_condition_enabled)
> {
> }
>
> static void noop_resource_copy_region(struct pipe_context *ctx,
> struct pipe_resource *dst,
> unsigned dst_level,
> unsigned dstx, unsigned dsty, unsigned dstz,
> struct pipe_resource *src,
> unsigned src_level,
> const struct pipe_box *src_box)
> diff --git a/src/gallium/drivers/nouveau/nv30/nv30_clear.c b/src/gallium/drivers/nouveau/nv30/nv30_clear.c
> index c8fa38e..4217bca 100644
> --- a/src/gallium/drivers/nouveau/nv30/nv30_clear.c
> +++ b/src/gallium/drivers/nouveau/nv30/nv30_clear.c
> @@ -94,21 +94,22 @@ nv30_clear(struct pipe_context *pipe, unsigned buffers,
> PUSH_DATA (push, zeta);
> PUSH_DATA (push, colr);
> PUSH_DATA (push, mode);
>
> nv30_state_release(nv30);
> }
>
> static void
> nv30_clear_render_target(struct pipe_context *pipe, struct pipe_surface *ps,
> const union pipe_color_union *color,
> - unsigned x, unsigned y, unsigned w, unsigned h)
> + unsigned x, unsigned y, unsigned w, unsigned h,
> + bool render_condition_enabled)
> {
> struct nv30_context *nv30 = nv30_context(pipe);
> struct nv30_surface *sf = nv30_surface(ps);
> struct nv30_miptree *mt = nv30_miptree(ps->texture);
> struct nouveau_pushbuf *push = nv30->base.pushbuf;
> struct nouveau_object *eng3d = nv30->screen->eng3d;
> struct nouveau_pushbuf_refn refn;
> uint32_t rt_format;
>
> rt_format = nv30_format(pipe->screen, ps->format)->hw;
> @@ -153,21 +154,22 @@ nv30_clear_render_target(struct pipe_context *pipe, struct pipe_surface *ps,
> NV30_3D_CLEAR_BUFFERS_COLOR_G |
> NV30_3D_CLEAR_BUFFERS_COLOR_B |
> NV30_3D_CLEAR_BUFFERS_COLOR_A);
>
> nv30->dirty |= NV30_NEW_FRAMEBUFFER | NV30_NEW_SCISSOR;
> }
>
> static void
> nv30_clear_depth_stencil(struct pipe_context *pipe, struct pipe_surface *ps,
> unsigned buffers, double depth, unsigned stencil,
> - unsigned x, unsigned y, unsigned w, unsigned h)
> + unsigned x, unsigned y, unsigned w, unsigned h,
> + bool render_condition_enabled)
> {
> struct nv30_context *nv30 = nv30_context(pipe);
> struct nv30_surface *sf = nv30_surface(ps);
> struct nv30_miptree *mt = nv30_miptree(ps->texture);
> struct nouveau_pushbuf *push = nv30->base.pushbuf;
> struct nouveau_object *eng3d = nv30->screen->eng3d;
> struct nouveau_pushbuf_refn refn;
> uint32_t rt_format, mode = 0;
>
> rt_format = nv30_format(pipe->screen, ps->format)->hw;
> diff --git a/src/gallium/drivers/nouveau/nv50/nv50_surface.c b/src/gallium/drivers/nouveau/nv50/nv50_surface.c
> index fbb5129..52e8907 100644
> --- a/src/gallium/drivers/nouveau/nv50/nv50_surface.c
> +++ b/src/gallium/drivers/nouveau/nv50/nv50_surface.c
> @@ -270,21 +270,22 @@ nv50_resource_copy_region(struct pipe_context *pipe,
> break;
> }
> nouveau_bufctx_reset(nv50->bufctx, NV50_BIND_2D);
> }
>
> static void
> nv50_clear_render_target(struct pipe_context *pipe,
> struct pipe_surface *dst,
> const union pipe_color_union *color,
> unsigned dstx, unsigned dsty,
> - unsigned width, unsigned height)
> + unsigned width, unsigned height,
> + bool render_condition_enabled)
> {
> struct nv50_context *nv50 = nv50_context(pipe);
> struct nouveau_pushbuf *push = nv50->base.pushbuf;
> struct nv50_miptree *mt = nv50_miptree(dst->texture);
> struct nv50_surface *sf = nv50_surface(dst);
> struct nouveau_bo *bo = mt->base.bo;
> unsigned z;
>
> assert(dst->texture->target != PIPE_BUFFER);
>
> @@ -356,21 +357,22 @@ nv50_clear_render_target(struct pipe_context *pipe,
> nv50->dirty_3d |= NV50_NEW_3D_FRAMEBUFFER | NV50_NEW_3D_SCISSOR;
> }
>
> static void
> nv50_clear_depth_stencil(struct pipe_context *pipe,
> struct pipe_surface *dst,
> unsigned clear_flags,
> double depth,
> unsigned stencil,
> unsigned dstx, unsigned dsty,
> - unsigned width, unsigned height)
> + unsigned width, unsigned height,
> + bool render_condition_enabled)
> {
> struct nv50_context *nv50 = nv50_context(pipe);
> struct nouveau_pushbuf *push = nv50->base.pushbuf;
> struct nv50_miptree *mt = nv50_miptree(dst->texture);
> struct nv50_surface *sf = nv50_surface(dst);
> struct nouveau_bo *bo = mt->base.bo;
> uint32_t mode = 0;
> unsigned z;
>
> assert(dst->texture->target != PIPE_BUFFER);
> @@ -465,21 +467,21 @@ nv50_clear_texture(struct pipe_context *pipe,
>
> if (util_format_has_depth(desc)) {
> clear |= PIPE_CLEAR_DEPTH;
> desc->unpack_z_float(&depth, 0, data, 0, 1, 1);
> }
> if (util_format_has_stencil(desc)) {
> clear |= PIPE_CLEAR_STENCIL;
> desc->unpack_s_8uint(&stencil, 0, data, 0, 1, 1);
> }
> pipe->clear_depth_stencil(pipe, sf, clear, depth, stencil,
> - box->x, box->y, box->width, box->height);
> + box->x, box->y, box->width, box->height, false);
> } else {
> union pipe_color_union color;
>
> switch (util_format_get_blocksizebits(res->format)) {
> case 128:
> sf->format = PIPE_FORMAT_R32G32B32A32_UINT;
> memcpy(&color.ui, data, 128 / 8);
> break;
> case 64:
> sf->format = PIPE_FORMAT_R32G32_UINT;
> @@ -501,21 +503,21 @@ nv50_clear_texture(struct pipe_context *pipe,
> sf->format = PIPE_FORMAT_R8_UINT;
> color.ui[0] = util_cpu_to_le32(*(unsigned char *)data);
> memset(&color.ui[1], 0, 96 / 8);
> break;
> default:
> assert(!"Unknown texel element size");
> return;
> }
>
> pipe->clear_render_target(pipe, sf, &color,
> - box->x, box->y, box->width, box->height);
> + box->x, box->y, box->width, box->height, false);
> }
> pipe->surface_destroy(pipe, sf);
> }
>
> void
> nv50_clear(struct pipe_context *pipe, unsigned buffers,
> const union pipe_color_union *color,
> double depth, unsigned stencil)
> {
> struct nv50_context *nv50 = nv50_context(pipe);
> diff --git a/src/gallium/drivers/nouveau/nv50/nv84_video.c b/src/gallium/drivers/nouveau/nv50/nv84_video.c
> index 1b1f31a..409c40d 100644
> --- a/src/gallium/drivers/nouveau/nv50/nv84_video.c
> +++ b/src/gallium/drivers/nouveau/nv50/nv84_video.c
> @@ -475,30 +475,30 @@ nv84_create_decoder(struct pipe_context *context,
> surf.height = (templ->max_references + 1) * dec->frame_mbs / 4;
> surf.depth = 1;
> surf.base.format = PIPE_FORMAT_B8G8R8A8_UNORM;
> surf.base.u.tex.level = 0;
> surf.base.texture = &mip.base.base;
> mip.level[0].tile_mode = 0;
> mip.level[0].pitch = surf.width * 4;
> mip.base.domain = NOUVEAU_BO_VRAM;
> mip.base.bo = dec->mbring;
> mip.base.address = dec->mbring->offset;
> - context->clear_render_target(context, &surf.base, &color, 0, 0, 64, 4760);
> + context->clear_render_target(context, &surf.base, &color, 0, 0, 64, 4760, false);
> surf.offset = dec->vpring->size / 2 - 0x1000;
> surf.width = 1024;
> surf.height = 1;
> mip.level[0].pitch = surf.width * 4;
> mip.base.bo = dec->vpring;
> mip.base.address = dec->vpring->offset;
> - context->clear_render_target(context, &surf.base, &color, 0, 0, 1024, 1);
> + context->clear_render_target(context, &surf.base, &color, 0, 0, 1024, 1, false);
> surf.offset = dec->vpring->size - 0x1000;
> - context->clear_render_target(context, &surf.base, &color, 0, 0, 1024, 1);
> + context->clear_render_target(context, &surf.base, &color, 0, 0, 1024, 1, false);
>
> PUSH_SPACE(screen->pushbuf, 5);
> PUSH_REFN(screen->pushbuf, dec->fence, NOUVEAU_BO_VRAM | NOUVEAU_BO_RDWR);
> /* The clear_render_target is done via 3D engine, so use it to write to a
> * sempahore to indicate that it's done.
> */
> BEGIN_NV04(screen->pushbuf, NV50_3D(QUERY_ADDRESS_HIGH), 4);
> PUSH_DATAh(screen->pushbuf, dec->fence->offset);
> PUSH_DATA (screen->pushbuf, dec->fence->offset);
> PUSH_DATA (screen->pushbuf, 1);
> diff --git a/src/gallium/drivers/nouveau/nvc0/nvc0_surface.c b/src/gallium/drivers/nouveau/nvc0/nvc0_surface.c
> index 7556e71..a6ca6fb 100644
> --- a/src/gallium/drivers/nouveau/nvc0/nvc0_surface.c
> +++ b/src/gallium/drivers/nouveau/nvc0/nvc0_surface.c
> @@ -273,21 +273,22 @@ nvc0_resource_copy_region(struct pipe_context *pipe,
> break;
> }
> nouveau_bufctx_reset(nvc0->bufctx, 0);
> }
>
> static void
> nvc0_clear_render_target(struct pipe_context *pipe,
> struct pipe_surface *dst,
> const union pipe_color_union *color,
> unsigned dstx, unsigned dsty,
> - unsigned width, unsigned height)
> + unsigned width, unsigned height,
> + bool render_condition_enabled)
> {
> struct nvc0_context *nvc0 = nvc0_context(pipe);
> struct nouveau_pushbuf *push = nvc0->base.pushbuf;
> struct nv50_surface *sf = nv50_surface(dst);
> struct nv04_resource *res = nv04_resource(sf->base.texture);
> unsigned z;
>
> assert(dst->texture->target != PIPE_BUFFER);
>
> if (!PUSH_SPACE(push, 32 + sf->depth))
> @@ -612,21 +613,22 @@ nvc0_clear_buffer(struct pipe_context *pipe,
> nvc0->dirty_3d |= NVC0_NEW_3D_FRAMEBUFFER;
> }
>
> static void
> nvc0_clear_depth_stencil(struct pipe_context *pipe,
> struct pipe_surface *dst,
> unsigned clear_flags,
> double depth,
> unsigned stencil,
> unsigned dstx, unsigned dsty,
> - unsigned width, unsigned height)
> + unsigned width, unsigned height,
> + bool render_condition_enabled)
> {
> struct nvc0_context *nvc0 = nvc0_context(pipe);
> struct nouveau_pushbuf *push = nvc0->base.pushbuf;
> struct nv50_miptree *mt = nv50_miptree(dst->texture);
> struct nv50_surface *sf = nv50_surface(dst);
> uint32_t mode = 0;
> int unk = mt->base.base.target == PIPE_TEXTURE_2D;
> unsigned z;
>
> assert(dst->texture->target != PIPE_BUFFER);
> diff --git a/src/gallium/drivers/r300/r300_blit.c b/src/gallium/drivers/r300/r300_blit.c
> index 2ee9b54..cfb3f6d 100644
> --- a/src/gallium/drivers/r300/r300_blit.c
> +++ b/src/gallium/drivers/r300/r300_blit.c
> @@ -423,38 +423,40 @@ static void r300_clear(struct pipe_context* pipe,
> if (r300->zmask_in_use || r300->hiz_in_use) {
> r300_mark_atom_dirty(r300, &r300->hyperz_state);
> }
> }
>
> /* Clear a region of a color surface to a constant value. */
> static void r300_clear_render_target(struct pipe_context *pipe,
> struct pipe_surface *dst,
> const union pipe_color_union *color,
> unsigned dstx, unsigned dsty,
> - unsigned width, unsigned height)
> + unsigned width, unsigned height,
> + bool render_condition_enabled)
> {
> struct r300_context *r300 = r300_context(pipe);
>
> r300_blitter_begin(r300, R300_CLEAR_SURFACE);
> util_blitter_clear_render_target(r300->blitter, dst, color,
> dstx, dsty, width, height);
> r300_blitter_end(r300);
> }
>
> /* Clear a region of a depth stencil surface. */
> static void r300_clear_depth_stencil(struct pipe_context *pipe,
> struct pipe_surface *dst,
> unsigned clear_flags,
> double depth,
> unsigned stencil,
> unsigned dstx, unsigned dsty,
> - unsigned width, unsigned height)
> + unsigned width, unsigned height,
> + bool render_condition_enabled)
> {
> struct r300_context *r300 = r300_context(pipe);
> struct pipe_framebuffer_state *fb =
> (struct pipe_framebuffer_state*)r300->fb_state.state;
>
> if (r300->zmask_in_use && !r300->locked_zbuffer) {
> if (fb->zsbuf->texture == dst->texture) {
> r300_decompress_zmask(r300);
> }
> }
> diff --git a/src/gallium/drivers/r600/r600_blit.c b/src/gallium/drivers/r600/r600_blit.c
> index a6c5b44..327efc2 100644
> --- a/src/gallium/drivers/r600/r600_blit.c
> +++ b/src/gallium/drivers/r600/r600_blit.c
> @@ -466,37 +466,39 @@ static void r600_clear(struct pipe_context *ctx, unsigned buffers,
> if (rctx->db_misc_state.htile_clear) {
> rctx->db_misc_state.htile_clear = false;
> r600_mark_atom_dirty(rctx, &rctx->db_misc_state.atom);
> }
> }
>
> static void r600_clear_render_target(struct pipe_context *ctx,
> struct pipe_surface *dst,
> const union pipe_color_union *color,
> unsigned dstx, unsigned dsty,
> - unsigned width, unsigned height)
> + unsigned width, unsigned height,
> + bool render_condition_enabled)
> {
> struct r600_context *rctx = (struct r600_context *)ctx;
>
> r600_blitter_begin(ctx, R600_CLEAR_SURFACE);
> util_blitter_clear_render_target(rctx->blitter, dst, color,
> dstx, dsty, width, height);
> r600_blitter_end(ctx);
> }
>
> static void r600_clear_depth_stencil(struct pipe_context *ctx,
> struct pipe_surface *dst,
> unsigned clear_flags,
> double depth,
> unsigned stencil,
> unsigned dstx, unsigned dsty,
> - unsigned width, unsigned height)
> + unsigned width, unsigned height,
> + bool render_condition_enabled)
> {
> struct r600_context *rctx = (struct r600_context *)ctx;
>
> r600_blitter_begin(ctx, R600_CLEAR_SURFACE);
> util_blitter_clear_depth_stencil(rctx->blitter, dst, clear_flags, depth, stencil,
> dstx, dsty, width, height);
> r600_blitter_end(ctx);
> }
>
> static void r600_copy_buffer(struct pipe_context *ctx, struct pipe_resource *dst, unsigned dstx,
> diff --git a/src/gallium/drivers/radeonsi/si_blit.c b/src/gallium/drivers/radeonsi/si_blit.c
> index 38a19d5..ce13e97 100644
> --- a/src/gallium/drivers/radeonsi/si_blit.c
> +++ b/src/gallium/drivers/radeonsi/si_blit.c
> @@ -752,37 +752,39 @@ static void si_clear(struct pipe_context *ctx, unsigned buffers,
> sctx->db_stencil_disable_expclear = false;
> zstex->stencil_cleared = true;
> si_mark_atom_dirty(sctx, &sctx->db_render_state);
> }
> }
>
> static void si_clear_render_target(struct pipe_context *ctx,
> struct pipe_surface *dst,
> const union pipe_color_union *color,
> unsigned dstx, unsigned dsty,
> - unsigned width, unsigned height)
> + unsigned width, unsigned height,
> + bool render_condition_enabled)
> {
> struct si_context *sctx = (struct si_context *)ctx;
>
> si_blitter_begin(ctx, SI_CLEAR_SURFACE);
> util_blitter_clear_render_target(sctx->blitter, dst, color,
> dstx, dsty, width, height);
> si_blitter_end(ctx);
> }
>
> static void si_clear_depth_stencil(struct pipe_context *ctx,
> struct pipe_surface *dst,
> unsigned clear_flags,
> double depth,
> unsigned stencil,
> unsigned dstx, unsigned dsty,
> - unsigned width, unsigned height)
> + unsigned width, unsigned height,
> + bool render_condition_enabled)
> {
> struct si_context *sctx = (struct si_context *)ctx;
>
> si_blitter_begin(ctx, SI_CLEAR_SURFACE);
> util_blitter_clear_depth_stencil(sctx->blitter, dst, clear_flags, depth, stencil,
> dstx, dsty, width, height);
> si_blitter_end(ctx);
> }
>
> /* Helper for decompressing a portion of a color or depth resource before
> diff --git a/src/gallium/drivers/rbug/rbug_context.c b/src/gallium/drivers/rbug/rbug_context.c
> index 83914d3..3c2dc69 100644
> --- a/src/gallium/drivers/rbug/rbug_context.c
> +++ b/src/gallium/drivers/rbug/rbug_context.c
> @@ -945,62 +945,66 @@ rbug_clear(struct pipe_context *_pipe,
> depth,
> stencil);
> pipe_mutex_unlock(rb_pipe->call_mutex);
> }
>
> static void
> rbug_clear_render_target(struct pipe_context *_pipe,
> struct pipe_surface *_dst,
> const union pipe_color_union *color,
> unsigned dstx, unsigned dsty,
> - unsigned width, unsigned height)
> + unsigned width, unsigned height,
> + bool render_condition_enabled)
> {
> struct rbug_context *rb_pipe = rbug_context(_pipe);
> struct rbug_surface *rb_surface_dst = rbug_surface(_dst);
> struct pipe_context *pipe = rb_pipe->pipe;
> struct pipe_surface *dst = rb_surface_dst->surface;
>
> pipe_mutex_lock(rb_pipe->call_mutex);
> pipe->clear_render_target(pipe,
> dst,
> color,
> dstx,
> dsty,
> width,
> - height);
> + height,
> + render_condition_enabled);
> pipe_mutex_unlock(rb_pipe->call_mutex);
> }
>
> static void
> rbug_clear_depth_stencil(struct pipe_context *_pipe,
> struct pipe_surface *_dst,
> unsigned clear_flags,
> double depth,
> unsigned stencil,
> unsigned dstx, unsigned dsty,
> - unsigned width, unsigned height)
> + unsigned width, unsigned height,
> + bool render_condition_enabled)
> {
> struct rbug_context *rb_pipe = rbug_context(_pipe);
> struct rbug_surface *rb_surface_dst = rbug_surface(_dst);
> struct pipe_context *pipe = rb_pipe->pipe;
> struct pipe_surface *dst = rb_surface_dst->surface;
>
> pipe_mutex_lock(rb_pipe->call_mutex);
> pipe->clear_depth_stencil(pipe,
> dst,
> clear_flags,
> depth,
> stencil,
> dstx,
> dsty,
> width,
> - height);
> + height,
> + render_condition_enabled);
> pipe_mutex_unlock(rb_pipe->call_mutex);
> }
>
> static void
> rbug_flush(struct pipe_context *_pipe,
> struct pipe_fence_handle **fence,
> unsigned flags)
> {
> struct rbug_context *rb_pipe = rbug_context(_pipe);
> struct pipe_context *pipe = rb_pipe->pipe;
> diff --git a/src/gallium/drivers/softpipe/sp_surface.c b/src/gallium/drivers/softpipe/sp_surface.c
> index e2ecbdf..643b060 100644
> --- a/src/gallium/drivers/softpipe/sp_surface.c
> +++ b/src/gallium/drivers/softpipe/sp_surface.c
> @@ -90,40 +90,42 @@ static void
> sp_flush_resource(struct pipe_context *pipe,
> struct pipe_resource *resource)
> {
> }
>
> static void
> softpipe_clear_render_target(struct pipe_context *pipe,
> struct pipe_surface *dst,
> const union pipe_color_union *color,
> unsigned dstx, unsigned dsty,
> - unsigned width, unsigned height)
> + unsigned width, unsigned height,
> + bool render_condition_enabled)
> {
> struct softpipe_context *softpipe = softpipe_context(pipe);
>
> if (!softpipe_check_render_cond(softpipe))
> return;
>
> util_clear_render_target(pipe, dst, color,
> dstx, dsty, width, height);
> }
>
>
> static void
> softpipe_clear_depth_stencil(struct pipe_context *pipe,
> struct pipe_surface *dst,
> unsigned clear_flags,
> double depth,
> unsigned stencil,
> unsigned dstx, unsigned dsty,
> - unsigned width, unsigned height)
> + unsigned width, unsigned height,
> + bool render_condition_enabled)
> {
> struct softpipe_context *softpipe = softpipe_context(pipe);
>
> if (!softpipe_check_render_cond(softpipe))
> return;
>
> util_clear_depth_stencil(pipe, dst, clear_flags,
> depth, stencil,
> dstx, dsty, width, height);
> }
> diff --git a/src/gallium/drivers/swr/swr_clear.cpp b/src/gallium/drivers/swr/swr_clear.cpp
> index 103bca9..4b02dd1 100644
> --- a/src/gallium/drivers/swr/swr_clear.cpp
> +++ b/src/gallium/drivers/swr/swr_clear.cpp
> @@ -79,32 +79,34 @@ swr_clear(struct pipe_context *pipe,
> swr_update_draw_context(ctx);
> SwrClearRenderTarget(ctx->swrContext, clearMask, color->f, depth, stencil);
> }
>
>
> #if 0 // XXX, these don't get called. how to get these called? Do we need
> // them? Docs?
> static void
> swr_clear_render_target(struct pipe_context *pipe, struct pipe_surface *ps,
> const union pipe_color_union *color,
> - unsigned x, unsigned y, unsigned w, unsigned h)
> + unsigned x, unsigned y, unsigned w, unsigned h,
> + bool render_condition_enabled)
> {
> struct swr_context *ctx = swr_context(pipe);
> fprintf(stderr, "SWR swr_clear_render_target!\n");
>
> ctx->dirty |= SWR_NEW_FRAMEBUFFER | SWR_NEW_SCISSOR;
> }
>
> static void
> swr_clear_depth_stencil(struct pipe_context *pipe, struct pipe_surface *ps,
> unsigned buffers, double depth, unsigned stencil,
> - unsigned x, unsigned y, unsigned w, unsigned h)
> + unsigned x, unsigned y, unsigned w, unsigned h,
> + bool render_condition_enabled)
> {
> struct swr_context *ctx = swr_context(pipe);
> fprintf(stderr, "SWR swr_clear_depth_stencil!\n");
>
> ctx->dirty |= SWR_NEW_FRAMEBUFFER | SWR_NEW_SCISSOR;
> }
>
> static void
> swr_clear_buffer(struct pipe_context *pipe,
> struct pipe_resource *res,
> diff --git a/src/gallium/drivers/trace/tr_context.c b/src/gallium/drivers/trace/tr_context.c
> index 65d7f4e..ef36f5f 100644
> --- a/src/gallium/drivers/trace/tr_context.c
> +++ b/src/gallium/drivers/trace/tr_context.c
> @@ -1284,70 +1284,76 @@ trace_context_clear(struct pipe_context *_pipe,
>
> trace_dump_call_end();
> }
>
>
> static void
> trace_context_clear_render_target(struct pipe_context *_pipe,
> struct pipe_surface *dst,
> const union pipe_color_union *color,
> unsigned dstx, unsigned dsty,
> - unsigned width, unsigned height)
> + unsigned width, unsigned height,
> + bool render_condition_enabled)
> {
> struct trace_context *tr_ctx = trace_context(_pipe);
> struct pipe_context *pipe = tr_ctx->pipe;
>
> dst = trace_surface_unwrap(tr_ctx, dst);
>
> trace_dump_call_begin("pipe_context", "clear_render_target");
>
> trace_dump_arg(ptr, pipe);
> trace_dump_arg(ptr, dst);
> trace_dump_arg_array(float, color->f, 4);
> trace_dump_arg(uint, dstx);
> trace_dump_arg(uint, dsty);
> trace_dump_arg(uint, width);
> trace_dump_arg(uint, height);
> + trace_dump_arg(bool, render_condition_enabled);
>
> - pipe->clear_render_target(pipe, dst, color, dstx, dsty, width, height);
> + pipe->clear_render_target(pipe, dst, color, dstx, dsty, width, height,
> + render_condition_enabled);
>
> trace_dump_call_end();
> }
>
> static void
> trace_context_clear_depth_stencil(struct pipe_context *_pipe,
> struct pipe_surface *dst,
> unsigned clear_flags,
> double depth,
> unsigned stencil,
> unsigned dstx, unsigned dsty,
> - unsigned width, unsigned height)
> + unsigned width, unsigned height,
> + bool render_condition_enabled)
> {
> struct trace_context *tr_ctx = trace_context(_pipe);
> struct pipe_context *pipe = tr_ctx->pipe;
>
> dst = trace_surface_unwrap(tr_ctx, dst);
>
> trace_dump_call_begin("pipe_context", "clear_depth_stencil");
>
> trace_dump_arg(ptr, pipe);
> trace_dump_arg(ptr, dst);
> trace_dump_arg(uint, clear_flags);
> trace_dump_arg(float, depth);
> trace_dump_arg(uint, stencil);
> trace_dump_arg(uint, dstx);
> trace_dump_arg(uint, dsty);
> trace_dump_arg(uint, width);
> trace_dump_arg(uint, height);
> + trace_dump_arg(bool, render_condition_enabled);
>
> pipe->clear_depth_stencil(pipe, dst, clear_flags, depth, stencil,
> - dstx, dsty, width, height);
> + dstx, dsty, width, height,
> + render_condition_enabled);
>
> trace_dump_call_end();
> }
>
> static inline void
> trace_context_clear_texture(struct pipe_context *_pipe,
> struct pipe_resource *res,
> unsigned level,
> const struct pipe_box *box,
> const void *data)
> diff --git a/src/gallium/drivers/vc4/vc4_draw.c b/src/gallium/drivers/vc4/vc4_draw.c
> index cf3f5e0..773caf7 100644
> --- a/src/gallium/drivers/vc4/vc4_draw.c
> +++ b/src/gallium/drivers/vc4/vc4_draw.c
> @@ -490,29 +490,31 @@ vc4_clear(struct pipe_context *pctx, unsigned buffers,
> vc4->draw_max_y = vc4->framebuffer.height;
> vc4->cleared |= buffers;
> vc4->resolve |= buffers;
>
> vc4_start_draw(vc4, 0);
> }
>
> static void
> vc4_clear_render_target(struct pipe_context *pctx, struct pipe_surface *ps,
> const union pipe_color_union *color,
> - unsigned x, unsigned y, unsigned w, unsigned h)
> + unsigned x, unsigned y, unsigned w, unsigned h,
> + bool render_condition_enabled)
> {
> fprintf(stderr, "unimpl: clear RT\n");
> }
>
> static void
> vc4_clear_depth_stencil(struct pipe_context *pctx, struct pipe_surface *ps,
> unsigned buffers, double depth, unsigned stencil,
> - unsigned x, unsigned y, unsigned w, unsigned h)
> + unsigned x, unsigned y, unsigned w, unsigned h,
> + bool render_condition_enabled)
> {
> fprintf(stderr, "unimpl: clear DS\n");
> }
>
> void
> vc4_draw_init(struct pipe_context *pctx)
> {
> pctx->draw_vbo = vc4_draw_vbo;
> pctx->clear = vc4_clear;
> pctx->clear_render_target = vc4_clear_render_target;
> diff --git a/src/gallium/include/pipe/p_context.h b/src/gallium/include/pipe/p_context.h
> index f1de189..5359164 100644
> --- a/src/gallium/include/pipe/p_context.h
> +++ b/src/gallium/include/pipe/p_context.h
> @@ -409,35 +409,37 @@ struct pipe_context {
> unsigned stencil);
>
> /**
> * Clear a color rendertarget surface.
> * \param color pointer to an union of fiu array for each of r, g, b, a.
> */
> void (*clear_render_target)(struct pipe_context *pipe,
> struct pipe_surface *dst,
> const union pipe_color_union *color,
> unsigned dstx, unsigned dsty,
> - unsigned width, unsigned height);
> + unsigned width, unsigned height,
> + bool render_condition_enabled);
>
> /**
> * Clear a depth-stencil surface.
> * \param clear_flags bitfield of PIPE_CLEAR_DEPTH/STENCIL values.
> * \param depth depth clear value in [0,1].
> * \param stencil stencil clear value
> */
> void (*clear_depth_stencil)(struct pipe_context *pipe,
> struct pipe_surface *dst,
> unsigned clear_flags,
> double depth,
> unsigned stencil,
> unsigned dstx, unsigned dsty,
> - unsigned width, unsigned height);
> + unsigned width, unsigned height,
> + bool render_condition_enabled);
>
> /**
> * Clear the texture with the specified texel. Not guaranteed to be a
> * renderable format. Data provided in the resource's format.
> */
> void (*clear_texture)(struct pipe_context *pipe,
> struct pipe_resource *res,
> unsigned level,
> const struct pipe_box *box,
> const void *data);
> diff --git a/src/gallium/state_trackers/nine/device9.c b/src/gallium/state_trackers/nine/device9.c
> index b4ce3c8..d233304 100644
> --- a/src/gallium/state_trackers/nine/device9.c
> +++ b/src/gallium/state_trackers/nine/device9.c
> @@ -1745,21 +1745,21 @@ NineDevice9_ColorFill( struct NineDevice9 *This,
>
> fallback = !(surf->base.info.bind & PIPE_BIND_RENDER_TARGET);
>
> if (!fallback) {
> psurf = NineSurface9_GetSurface(surf, 0);
> if (!psurf)
> fallback = TRUE;
> }
>
> if (!fallback) {
> - pipe->clear_render_target(pipe, psurf, &rgba, x, y, w, h);
> + pipe->clear_render_target(pipe, psurf, &rgba, x, y, w, h, false);
> } else {
> D3DLOCKED_RECT lock;
> union util_color uc;
> HRESULT hr;
> /* XXX: lock pRect and fix util_fill_rect */
> hr = NineSurface9_LockRect(surf, &lock, NULL, 0);
> if (FAILED(hr))
> return hr;
> util_pack_color_ub(color >> 16, color >> 8, color >> 0, color >> 24,
> surf->base.info.format, &uc);
> @@ -2030,21 +2030,21 @@ NineDevice9_Clear( struct NineDevice9 *This,
> if (pRects[r].y1 > pRects[r].y2) continue;
> #endif
>
> x1 = MAX2(x1, rect.x1);
> y1 = MAX2(y1, rect.y1);
> x2 = MIN3(x2, rect.x2, rt->desc.Width);
> y2 = MIN3(y2, rect.y2, rt->desc.Height);
>
> DBG("Clearing (%u..%u)x(%u..%u)\n", x1, x2, y1, y2);
> pipe->clear_render_target(pipe, cbuf, &rgba,
> - x1, y1, x2 - x1, y2 - y1);
> + x1, y1, x2 - x1, y2 - y1, false);
> }
> }
> if (!(bufs & PIPE_CLEAR_DEPTHSTENCIL))
> return D3D_OK;
>
> bufs &= PIPE_CLEAR_DEPTHSTENCIL;
>
> for (r = 0; r < Count; ++r) {
> unsigned x1 = MIN2(pRects[r].x1, pRects[r].x2);
> unsigned y1 = MIN2(pRects[r].y1, pRects[r].y2);
> @@ -2057,21 +2057,21 @@ NineDevice9_Clear( struct NineDevice9 *This,
> #endif
>
> x1 = MIN2(x1, rect.x1);
> y1 = MIN2(y1, rect.y1);
> x2 = MIN3(x2, rect.x2, zsbuf_surf->desc.Width);
> y2 = MIN3(y2, rect.y2, zsbuf_surf->desc.Height);
>
> zsbuf = NineSurface9_GetSurface(zsbuf_surf, 0);
> assert(zsbuf);
> pipe->clear_depth_stencil(pipe, zsbuf, bufs, Z, Stencil,
> - x1, y1, x2 - x1, y2 - y1);
> + x1, y1, x2 - x1, y2 - y1, false);
> }
> return D3D_OK;
> }
>
> HRESULT NINE_WINAPI
> NineDevice9_SetTransform( struct NineDevice9 *This,
> D3DTRANSFORMSTATETYPE State,
> const D3DMATRIX *pMatrix )
> {
> struct nine_state *state = This->update;
> diff --git a/src/gallium/state_trackers/nine/surface9.c b/src/gallium/state_trackers/nine/surface9.c
> index 6a4a0d9..0cedd4e 100644
> --- a/src/gallium/state_trackers/nine/surface9.c
> +++ b/src/gallium/state_trackers/nine/surface9.c
> @@ -157,21 +157,21 @@ NineSurface9_ctor( struct NineSurface9 *This,
> This->desc = *pDesc;
>
> This->stride = nine_format_get_stride(This->base.info.format, pDesc->Width);
>
> if (pResource && NineSurface9_IsOffscreenPlain(This))
> pResource->flags |= NINE_RESOURCE_FLAG_LOCKABLE;
>
> /* TODO: investigate what else exactly needs to be cleared */
> if (This->base.resource && (pDesc->Usage & D3DUSAGE_RENDERTARGET)) {
> surf = NineSurface9_GetSurface(This, 0);
> - pipe->clear_render_target(pipe, surf, &rgba, 0, 0, pDesc->Width, pDesc->Height);
> + pipe->clear_render_target(pipe, surf, &rgba, 0, 0, pDesc->Width, pDesc->Height, false);
> }
>
> NineSurface9_Dump(This);
>
> return D3D_OK;
> }
>
> void
> NineSurface9_dtor( struct NineSurface9 *This )
> {
> diff --git a/src/gallium/state_trackers/vdpau/surface.c b/src/gallium/state_trackers/vdpau/surface.c
> index 6dc479a..177483e 100644
> --- a/src/gallium/state_trackers/vdpau/surface.c
> +++ b/src/gallium/state_trackers/vdpau/surface.c
> @@ -388,21 +388,21 @@ vlVdpVideoSurfaceClear(vlVdpSurface *vlsurf)
> for (i = 0; i < VL_MAX_SURFACES; ++i) {
> union pipe_color_union c = {};
>
> if (!surfaces[i])
> continue;
>
> if (i > !!vlsurf->templat.interlaced)
> c.f[0] = c.f[1] = c.f[2] = c.f[3] = 0.5f;
>
> pipe->clear_render_target(pipe, surfaces[i], &c, 0, 0,
> - surfaces[i]->width, surfaces[i]->height);
> + surfaces[i]->width, surfaces[i]->height, false);
> }
> pipe->flush(pipe, NULL, 0);
> }
>
> /**
> * Interop to mesa state tracker
> */
> struct pipe_video_buffer *vlVdpVideoSurfaceGallium(VdpVideoSurface surface)
> {
> vlVdpSurface *p_surf = vlGetDataHTAB(surface);
>
Reviewed-by: Roland Scheidegger <sroland at vmware.com>
I guess you didn't feel like trivially fixing softpipe/llvmpipe to
actually honor the flag ;-).
Roland
More information about the mesa-dev
mailing list