panfrost: Remove pan_blitter integration
This was useful when panvk was being bootstrapped, allowing the blitter to be tested against a known-working driver. With panvk in-tree, I don't see a compelling reason to keep pan_blitter support wired in but off-by-default. Keeping it will complicate the GenXML change we're about to make. Signed-off-by: Alyssa Rosenzweig <alyssa@collabora.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11785>
This commit is contained in:
committed by
Marge Bot
parent
eddb81c326
commit
345778fa6f
@@ -27,7 +27,6 @@
|
||||
*
|
||||
*/
|
||||
|
||||
#include "pan_blitter.h"
|
||||
#include "pan_context.h"
|
||||
#include "pan_util.h"
|
||||
#include "util/format/u_format.h"
|
||||
@@ -70,229 +69,19 @@ panfrost_blitter_save(
|
||||
|
||||
}
|
||||
|
||||
static bool
|
||||
panfrost_u_blitter_blit(struct pipe_context *pipe,
|
||||
const struct pipe_blit_info *info)
|
||||
{
|
||||
struct panfrost_context *ctx = pan_context(pipe);
|
||||
|
||||
if (!util_blitter_is_blit_supported(ctx->blitter, info))
|
||||
unreachable("Unsupported blit\n");
|
||||
|
||||
/* TODO: Scissor */
|
||||
|
||||
panfrost_blitter_save(ctx, ctx->blitter, info->render_condition_enable);
|
||||
util_blitter_blit(ctx->blitter, info);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
static void
|
||||
panfrost_blit_add_ctx_bos(struct panfrost_batch *batch,
|
||||
struct panfrost_pool *blit_pool)
|
||||
{
|
||||
util_dynarray_foreach(&blit_pool->bos, struct panfrost_bo *, bo) {
|
||||
panfrost_batch_add_bo(batch, *bo,
|
||||
PIPE_SHADER_VERTEX);
|
||||
|
||||
panfrost_batch_add_bo(batch, *bo,
|
||||
PIPE_SHADER_FRAGMENT);
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
panfrost_blit(struct pipe_context *pipe,
|
||||
const struct pipe_blit_info *info)
|
||||
{
|
||||
if (info->render_condition_enable &&
|
||||
!panfrost_render_condition_check(pan_context(pipe)))
|
||||
return;
|
||||
|
||||
struct panfrost_device *dev = pan_device(pipe->screen);
|
||||
|
||||
if (!(dev->debug & PAN_DBG_PANBLIT)) {
|
||||
panfrost_u_blitter_blit(pipe, info);
|
||||
return;
|
||||
}
|
||||
|
||||
assert(!info->num_window_rectangles);
|
||||
assert(!info->alpha_blend);
|
||||
|
||||
struct panfrost_resource *psrc = pan_resource(info->src.resource);
|
||||
struct panfrost_resource *pdst = pan_resource(info->dst.resource);
|
||||
struct panfrost_context *ctx = pan_context(pipe);
|
||||
|
||||
struct pipe_surface tmpl = {
|
||||
.format = info->dst.format,
|
||||
.u.tex.level = info->dst.level,
|
||||
};
|
||||
if (info->render_condition_enable &&
|
||||
!panfrost_render_condition_check(ctx))
|
||||
return;
|
||||
|
||||
struct pan_blit_info pinfo = {
|
||||
.src = {
|
||||
.planes[0].format = info->src.format,
|
||||
.planes[0].image = &psrc->image,
|
||||
.level = info->src.level,
|
||||
.start = { info->src.box.x, info->src.box.y },
|
||||
.end = {
|
||||
info->src.box.x + info->src.box.width - 1,
|
||||
info->src.box.y + info->src.box.height - 1,
|
||||
},
|
||||
},
|
||||
.dst = {
|
||||
.planes[0].format = info->dst.format,
|
||||
.planes[0].image = &pdst->image,
|
||||
.level = info->dst.level,
|
||||
.start = { info->dst.box.x, info->dst.box.y },
|
||||
.end = {
|
||||
info->dst.box.x + info->dst.box.width - 1,
|
||||
info->dst.box.y + info->dst.box.height - 1,
|
||||
},
|
||||
},
|
||||
.scissor = {
|
||||
.enable = info->scissor_enable,
|
||||
.minx = info->scissor.minx,
|
||||
.miny = info->scissor.miny,
|
||||
.maxx = info->scissor.maxx - 1,
|
||||
.maxy = info->scissor.maxy - 1,
|
||||
},
|
||||
.nearest = info->filter == PIPE_TEX_FILTER_NEAREST,
|
||||
};
|
||||
if (!util_blitter_is_blit_supported(ctx->blitter, info))
|
||||
unreachable("Unsupported blit\n");
|
||||
|
||||
if (info->dst.resource->target == PIPE_TEXTURE_2D_ARRAY ||
|
||||
info->dst.resource->target == PIPE_TEXTURE_1D_ARRAY ||
|
||||
info->dst.resource->target == PIPE_TEXTURE_CUBE ||
|
||||
info->dst.resource->target == PIPE_TEXTURE_CUBE_ARRAY) {
|
||||
pinfo.dst.start.layer = info->dst.box.z;
|
||||
pinfo.dst.end.layer = info->dst.box.z + info->dst.box.depth - 1;
|
||||
} else if (info->dst.resource->target == PIPE_TEXTURE_3D) {
|
||||
pinfo.dst.start.z = info->dst.box.z;
|
||||
pinfo.dst.end.z = info->dst.box.z + info->dst.box.depth - 1;
|
||||
}
|
||||
|
||||
if (info->src.resource->target == PIPE_TEXTURE_2D_ARRAY ||
|
||||
info->src.resource->target == PIPE_TEXTURE_1D_ARRAY ||
|
||||
info->src.resource->target == PIPE_TEXTURE_CUBE ||
|
||||
info->src.resource->target == PIPE_TEXTURE_CUBE_ARRAY) {
|
||||
pinfo.src.start.layer = info->src.box.z;
|
||||
pinfo.src.end.layer = info->src.box.z + info->src.box.depth - 1;
|
||||
} else if (info->src.resource->target == PIPE_TEXTURE_3D) {
|
||||
pinfo.src.start.z = info->src.box.z;
|
||||
pinfo.src.end.z = info->src.box.z + info->src.box.depth - 1;
|
||||
}
|
||||
|
||||
unsigned draw_flags = 0;
|
||||
|
||||
/* For ZS buffers, only blit the component defined in the mask, the
|
||||
* preload logic will take care of preloading the other component.
|
||||
*/
|
||||
if (util_format_is_depth_and_stencil(pinfo.dst.planes[0].format) &&
|
||||
util_format_is_depth_and_stencil(pinfo.src.planes[0].format) &&
|
||||
(info->mask & PIPE_MASK_ZS) != PIPE_MASK_ZS) {
|
||||
pinfo.src.planes[0].format =
|
||||
(info->mask & PIPE_MASK_Z) ?
|
||||
util_format_get_depth_only(info->src.format) :
|
||||
util_format_stencil_only(info->src.format);
|
||||
pinfo.dst.planes[0].format =
|
||||
(info->mask & PIPE_MASK_Z) ?
|
||||
util_format_get_depth_only(info->dst.format) :
|
||||
util_format_stencil_only(info->dst.format);
|
||||
}
|
||||
|
||||
/* With our Z32_FLOAT_S8X24_UINT mapped to Z32_FLOAT + S8_UINT we
|
||||
* can't easily handle ZS <-> color blits, so let's forbid it for
|
||||
* now.
|
||||
*/
|
||||
assert((!psrc->separate_stencil && !pdst->separate_stencil) ||
|
||||
!(info->mask & ~PIPE_MASK_ZS));
|
||||
|
||||
if (psrc->separate_stencil) {
|
||||
if (pinfo.src.planes[0].format == PIPE_FORMAT_Z32_FLOAT_S8X24_UINT)
|
||||
pinfo.src.planes[0].format = PIPE_FORMAT_Z32_FLOAT;
|
||||
|
||||
if (info->mask & PIPE_MASK_S) {
|
||||
unsigned s_idx = info->mask & PIPE_MASK_Z ? 1 : 0;
|
||||
|
||||
pinfo.src.planes[s_idx].format = PIPE_FORMAT_S8_UINT;
|
||||
pinfo.src.planes[s_idx].image = &psrc->separate_stencil->image;
|
||||
}
|
||||
}
|
||||
|
||||
if (info->mask & PIPE_MASK_Z)
|
||||
draw_flags |= PIPE_CLEAR_DEPTH;
|
||||
|
||||
if (info->mask & PIPE_MASK_S)
|
||||
draw_flags |= PIPE_CLEAR_STENCIL;
|
||||
|
||||
if (info->mask & PIPE_MASK_RGBA)
|
||||
draw_flags |= PIPE_CLEAR_COLOR0;
|
||||
|
||||
unsigned dst_w = u_minify(info->dst.resource->width0, info->dst.level);
|
||||
unsigned dst_h = u_minify(info->dst.resource->height0, info->dst.level);
|
||||
unsigned minx = MAX2(0, pinfo.dst.start.x) & ~31;
|
||||
unsigned miny = MAX2(0, pinfo.dst.start.y) & ~31;
|
||||
unsigned maxx = MIN2(dst_w, ALIGN_POT(pinfo.dst.end.x + 1, 32));
|
||||
unsigned maxy = MIN2(dst_h, ALIGN_POT(pinfo.dst.end.y + 1, 32));
|
||||
|
||||
if (info->scissor_enable) {
|
||||
minx = MAX2(minx, info->scissor.minx & ~31);
|
||||
miny = MAX2(miny, info->scissor.miny & ~31);
|
||||
maxx = MIN2(maxx, ALIGN_POT(info->scissor.maxx + 1, 32));
|
||||
maxy = MIN2(maxy, ALIGN_POT(info->scissor.maxy + 1, 32));
|
||||
}
|
||||
|
||||
struct pan_blit_context bctx;
|
||||
struct panfrost_pool blit_pool;
|
||||
|
||||
panfrost_pool_init(&blit_pool, NULL, dev, 0, 4096, "Blitter pool",
|
||||
false, true);
|
||||
|
||||
pan_blit_ctx_init(dev, &pinfo, &blit_pool.base, &bctx);
|
||||
do {
|
||||
if (bctx.dst.cur_layer < 0)
|
||||
continue;
|
||||
|
||||
tmpl.u.tex.first_layer = tmpl.u.tex.last_layer = bctx.dst.cur_layer;
|
||||
struct pipe_surface *dst_surf =
|
||||
pipe->create_surface(pipe, info->dst.resource, &tmpl);
|
||||
struct pipe_framebuffer_state key = {
|
||||
.width = dst_w,
|
||||
.height = dst_h,
|
||||
};
|
||||
|
||||
if (util_format_is_depth_or_stencil(info->dst.format)) {
|
||||
key.zsbuf = dst_surf;
|
||||
} else {
|
||||
key.cbufs[0] = dst_surf;
|
||||
key.nr_cbufs = 1;
|
||||
}
|
||||
|
||||
struct panfrost_batch *batch = panfrost_get_fresh_batch(ctx, &key);
|
||||
|
||||
pipe_surface_reference(&dst_surf, NULL);
|
||||
|
||||
panfrost_batch_read_rsrc(batch, psrc, PIPE_SHADER_FRAGMENT);
|
||||
panfrost_batch_add_fbo_bos(batch);
|
||||
panfrost_blit_add_ctx_bos(batch, &blit_pool);
|
||||
batch->draws = draw_flags;
|
||||
batch->resolve = draw_flags;
|
||||
batch->minx = minx;
|
||||
batch->miny = miny;
|
||||
batch->maxx = maxx;
|
||||
batch->maxy = maxy;
|
||||
|
||||
mali_ptr tiler = pan_is_bifrost(dev) ?
|
||||
panfrost_batch_get_bifrost_tiler(batch, ~0) : 0;
|
||||
pan_blit(&bctx, &batch->pool.base, &batch->scoreboard,
|
||||
batch->tls.gpu, tiler);
|
||||
|
||||
/* We don't want this batch to interfere with subsequent draw
|
||||
* calls, but we want to keep it in the list of pending batches
|
||||
* (so it gets flushed when glFlush() is called), so calling
|
||||
* panfrost_freeze_batch() is not an option. Reset the
|
||||
* ctx->batch pointer manually.
|
||||
*/
|
||||
ctx->batch = NULL;
|
||||
} while (pan_blit_next_surface(&bctx));
|
||||
|
||||
panfrost_pool_cleanup(&blit_pool);
|
||||
panfrost_blitter_save(ctx, ctx->blitter, info->render_condition_enable);
|
||||
util_blitter_blit(ctx->blitter, info);
|
||||
}
|
||||
|
||||
@@ -68,7 +68,6 @@ static const struct debug_named_value panfrost_debug_options[] = {
|
||||
{"noafbc", PAN_DBG_NO_AFBC, "Disable AFBC support"},
|
||||
{"nocrc", PAN_DBG_NO_CRC, "Disable transaction elimination"},
|
||||
{"msaa16", PAN_DBG_MSAA16, "Enable MSAA 8x and 16x support"},
|
||||
{"panblit", PAN_DBG_PANBLIT, "Use pan_blitter instead of u_blitter"},
|
||||
{"noindirect", PAN_DBG_NOINDIRECT, "Emulate indirect draws on the CPU"},
|
||||
DEBUG_NAMED_VALUE_END
|
||||
};
|
||||
|
||||
@@ -39,8 +39,7 @@
|
||||
#define PAN_DBG_GL3 0x0100
|
||||
#define PAN_DBG_NO_AFBC 0x0200
|
||||
#define PAN_DBG_MSAA16 0x0400
|
||||
#define PAN_DBG_PANBLIT 0x0800
|
||||
#define PAN_DBG_NOINDIRECT 0x1000
|
||||
#define PAN_DBG_NOINDIRECT 0x0800
|
||||
|
||||
unsigned
|
||||
panfrost_translate_swizzle_4(const unsigned char swizzle[4]);
|
||||
|
||||
Reference in New Issue
Block a user