u_blitter: add support for sample0 only resolves.

This adds support for sample0 only resolves to support lavapipe

Reviewed-by: Roland Scheidegger <sroland@vmware.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/12504>
This commit is contained in:
Dave Airlie 2021-08-23 17:26:29 +10:00 committed by Marge Bot
parent 4d747c0c89
commit 3235b695b2
8 changed files with 15 additions and 15 deletions

View file

@ -1734,7 +1734,7 @@ void util_blitter_copy_texture(struct blitter_context *blitter,
util_blitter_blit_generic(blitter, dst_view, &dstbox,
src_view, srcbox, src->width0, src->height0,
PIPE_MASK_RGBAZS, PIPE_TEX_FILTER_NEAREST, NULL,
false);
false, false);
pipe_surface_reference(&dst_view, NULL);
pipe_sampler_view_reference(&src_view, NULL);
@ -1787,7 +1787,7 @@ static void do_blits(struct blitter_context_priv *ctx,
unsigned src_height0,
const struct pipe_box *srcbox,
bool is_zsbuf,
bool uses_txf)
bool uses_txf, bool sample0_only)
{
struct pipe_context *pipe = ctx->base.pipe;
unsigned src_samples = src->texture->nr_samples;
@ -1867,9 +1867,9 @@ static void do_blits(struct blitter_context_priv *ctx,
pipe->set_framebuffer_state(pipe, &fb_state);
/* See if we need to blit a multisample or singlesample buffer. */
if (src_samples == dst_samples && dst_samples > 1) {
if (sample0_only || (src_samples == dst_samples && dst_samples > 1)) {
/* MSAA copy. */
unsigned i, max_sample = dst_samples - 1;
unsigned i, max_sample = sample0_only ? 0 : dst_samples - 1;
for (i = 0; i <= max_sample; i++) {
pipe->set_sample_mask(pipe, 1 << i);
@ -1918,7 +1918,7 @@ void util_blitter_blit_generic(struct blitter_context *blitter,
unsigned src_width0, unsigned src_height0,
unsigned mask, unsigned filter,
const struct pipe_scissor_state *scissor,
bool alpha_blend)
bool alpha_blend, bool sample0_only)
{
struct blitter_context_priv *ctx = (struct blitter_context_priv*)blitter;
struct pipe_context *pipe = ctx->base.pipe;
@ -2123,7 +2123,7 @@ void util_blitter_blit_generic(struct blitter_context *blitter,
blitter_set_common_draw_rect_state(ctx, scissor != NULL, dst_samples > 1);
do_blits(ctx, dst, dstbox, src, src_width0, src_height0,
srcbox, dst_has_depth || dst_has_stencil, use_txf);
srcbox, dst_has_depth || dst_has_stencil, use_txf, sample0_only);
util_blitter_restore_vertex_states(blitter);
util_blitter_restore_fragment_states(blitter);
@ -2163,7 +2163,7 @@ util_blitter_blit(struct blitter_context *blitter,
src_view, &info->src.box, src->width0, src->height0,
info->mask, info->filter,
info->scissor_enable ? &info->scissor : NULL,
info->alpha_blend);
info->alpha_blend, info->sample0_only);
pipe_surface_reference(&dst_view, NULL);
pipe_sampler_view_reference(&src_view, NULL);
@ -2261,7 +2261,7 @@ void util_blitter_generate_mipmap(struct blitter_context *blitter,
pipe->set_sampler_views(pipe, PIPE_SHADER_FRAGMENT, 0, 1, 0, false, &src_view);
do_blits(ctx, dst_view, &dstbox, src_view, tex->width0, tex->height0,
&srcbox, is_depth, false);
&srcbox, is_depth, false, false);
pipe_surface_reference(&dst_view, NULL);
pipe_sampler_view_reference(&src_view, NULL);

View file

@ -270,7 +270,7 @@ void util_blitter_blit_generic(struct blitter_context *blitter,
unsigned src_width0, unsigned src_height0,
unsigned mask, unsigned filter,
const struct pipe_scissor_state *scissor,
bool alpha_blend);
bool alpha_blend, bool sample0_only);
void util_blitter_blit(struct blitter_context *blitter,
const struct pipe_blit_info *info);

View file

@ -166,7 +166,7 @@ fd_blitter_blit(struct fd_context *ctx, const struct pipe_blit_info *info)
util_blitter_blit_generic(
ctx->blitter, dst_view, &info->dst.box, src_view, &info->src.box,
src->width0, src->height0, info->mask, info->filter,
info->scissor_enable ? &info->scissor : NULL, info->alpha_blend);
info->scissor_enable ? &info->scissor : NULL, info->alpha_blend, false);
pipe_surface_reference(&dst_view, NULL);
pipe_sampler_view_reference(&src_view, NULL);

View file

@ -118,7 +118,7 @@ i915_surface_copy_render(struct pipe_context *pipe, struct pipe_resource *dst,
util_blitter_blit_generic(i915->blitter, dst_view, &dstbox, src_view,
src_box, src_width0, src_height0, PIPE_MASK_RGBAZS,
PIPE_TEX_FILTER_NEAREST, NULL, false);
PIPE_TEX_FILTER_NEAREST, NULL, false, false);
return;
fallback:

View file

@ -676,7 +676,7 @@ static void r300_resource_copy_region(struct pipe_context *pipe,
util_blitter_blit_generic(r300->blitter, dst_view, &dstbox,
src_view, src_box, src_width0, src_height0,
PIPE_MASK_RGBAZS, PIPE_TEX_FILTER_NEAREST, NULL,
FALSE);
FALSE, FALSE);
r300_blitter_end(r300);
pipe_surface_reference(&dst_view, NULL);

View file

@ -813,7 +813,7 @@ void r600_resource_copy_region(struct pipe_context *ctx,
util_blitter_blit_generic(rctx->blitter, dst_view, &dstbox,
src_view, src_box, src_width0, src_height0,
PIPE_MASK_RGBAZS, PIPE_TEX_FILTER_NEAREST, NULL,
FALSE);
FALSE, FALSE);
r600_blitter_end(ctx);
pipe_surface_reference(&dst_view, NULL);

View file

@ -1027,7 +1027,7 @@ void si_resource_copy_region(struct pipe_context *ctx, struct pipe_resource *dst
/* Copy. */
si_blitter_begin(sctx, SI_COPY);
util_blitter_blit_generic(sctx->blitter, dst_view, &dstbox, src_view, src_box, src_width0,
src_height0, PIPE_MASK_RGBAZS, PIPE_TEX_FILTER_NEAREST, NULL, false);
src_height0, PIPE_MASK_RGBAZS, PIPE_TEX_FILTER_NEAREST, NULL, false, false);
si_blitter_end(sctx);
pipe_surface_reference(&dst_view, NULL);

View file

@ -182,7 +182,7 @@ v3d_stencil_blit(struct pipe_context *ctx, struct pipe_blit_info *info)
PIPE_MASK_R,
PIPE_TEX_FILTER_NEAREST,
info->scissor_enable ? &info->scissor : NULL,
info->alpha_blend);
info->alpha_blend, false);
pipe_surface_reference(&dst_surf, NULL);
pipe_sampler_view_reference(&src_view, NULL);