[Mesa-dev] [PATCH 1/3] gallium: add render_condition_enable param to clear_render_target/depth_stencil
Nicolai Hähnle
nhaehnle at gmail.com
Tue Aug 9 08:27:18 UTC 2016
On 09.08.2016 00:59, Marek Olšák wrote:
> 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(-)
>
[snip]
> 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)
The whitespace looks inconsistent here and above. Apart from that:
Reviewed-by: Nicolai Hähnle <nicolai.haehnle at amd.com>
> {
> 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);
>
More information about the mesa-dev
mailing list