mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-05-08 11:18:08 +02:00
panfrost: Move blit funcs to pan_blitter
Add a dedicated header and prefix blit funcs accordingly. Signed-off-by: Loïc Molinari <loic.molinari@collabora.com> Reviewed-by: Ashley Smith <ashley.smith@collabora.com> Acked-by: Boris Brezillon <boris.brezillon@collabora.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/40124>
This commit is contained in:
parent
547c4ff8cb
commit
e30d95309f
6 changed files with 59 additions and 46 deletions
|
|
@ -17,7 +17,7 @@ files_panfrost = files(
|
|||
'pan_resource.h',
|
||||
'pan_context.c',
|
||||
'pan_blend_cso.c',
|
||||
'pan_blit.c',
|
||||
'pan_blitter.c',
|
||||
'pan_job.c',
|
||||
'pan_shader.c',
|
||||
'pan_mempool.c',
|
||||
|
|
|
|||
|
|
@ -5,6 +5,7 @@
|
|||
*/
|
||||
|
||||
#include "util/format/u_format.h"
|
||||
#include "pan_blitter.h"
|
||||
#include "pan_context.h"
|
||||
#include "pan_resource.h"
|
||||
#include "pan_trace.h"
|
||||
|
|
@ -131,8 +132,8 @@ panfrost_blitter_save(struct panfrost_context *ctx,
|
|||
}
|
||||
|
||||
void
|
||||
panfrost_blit_no_afbc_legalization(struct pipe_context *pipe,
|
||||
const struct pipe_blit_info *info)
|
||||
panfrost_blitter_blit_no_afbc_legalization(struct pipe_context *pipe,
|
||||
const struct pipe_blit_info *info)
|
||||
{
|
||||
PAN_TRACE_FUNC(PAN_TRACE_GL_BLIT);
|
||||
|
||||
|
|
@ -145,7 +146,8 @@ panfrost_blit_no_afbc_legalization(struct pipe_context *pipe,
|
|||
}
|
||||
|
||||
void
|
||||
panfrost_blit(struct pipe_context *pipe, const struct pipe_blit_info *info)
|
||||
panfrost_blitter_blit(struct pipe_context *pipe,
|
||||
const struct pipe_blit_info *info)
|
||||
{
|
||||
PAN_TRACE_FUNC(PAN_TRACE_GL_BLIT);
|
||||
|
||||
|
|
@ -167,6 +169,6 @@ panfrost_blit(struct pipe_context *pipe, const struct pipe_blit_info *info)
|
|||
pan_legalize_format(ctx, dst, dst_view_format, true, false);
|
||||
|
||||
panfrost_flush_all_batches(ctx, "Blit");
|
||||
panfrost_blit_no_afbc_legalization(pipe, info);
|
||||
panfrost_blitter_blit_no_afbc_legalization(pipe, info);
|
||||
panfrost_flush_all_batches(ctx, "Blit");
|
||||
}
|
||||
45
src/gallium/drivers/panfrost/pan_blitter.h
Normal file
45
src/gallium/drivers/panfrost/pan_blitter.h
Normal file
|
|
@ -0,0 +1,45 @@
|
|||
/*
|
||||
* Copyright (C) 2026 Amazon.com, Inc. or its affiliates
|
||||
* SPDX-License-Identifier: MIT
|
||||
*/
|
||||
|
||||
#ifndef __PAN_BLITTER_H__
|
||||
#define __PAN_BLITTER_H__
|
||||
|
||||
#include "pan_context.h"
|
||||
|
||||
enum panfrost_blitter_op /* bitmask */
|
||||
{
|
||||
PAN_SAVE_TEXTURES = 1,
|
||||
PAN_SAVE_FRAMEBUFFER = 2,
|
||||
PAN_SAVE_FRAGMENT_STATE = 4,
|
||||
PAN_SAVE_FRAGMENT_CONSTANT = 8,
|
||||
PAN_DISABLE_RENDER_COND = 16,
|
||||
};
|
||||
|
||||
enum {
|
||||
PAN_RENDER_BLIT =
|
||||
PAN_SAVE_TEXTURES | PAN_SAVE_FRAMEBUFFER | PAN_SAVE_FRAGMENT_STATE,
|
||||
PAN_RENDER_BLIT_COND = PAN_SAVE_TEXTURES | PAN_SAVE_FRAMEBUFFER |
|
||||
PAN_SAVE_FRAGMENT_STATE | PAN_DISABLE_RENDER_COND,
|
||||
PAN_RENDER_BASE = PAN_SAVE_FRAMEBUFFER | PAN_SAVE_FRAGMENT_STATE,
|
||||
PAN_RENDER_COND =
|
||||
PAN_SAVE_FRAMEBUFFER | PAN_SAVE_FRAGMENT_STATE | PAN_DISABLE_RENDER_COND,
|
||||
PAN_RENDER_CLEAR = PAN_SAVE_FRAGMENT_STATE | PAN_SAVE_FRAGMENT_CONSTANT,
|
||||
};
|
||||
|
||||
struct blitter_context *panfrost_blitter_create(struct pipe_context *pipe);
|
||||
|
||||
void panfrost_blitter_save(struct panfrost_context *ctx,
|
||||
const enum panfrost_blitter_op blitter_op);
|
||||
|
||||
/* Callers should ensure that all AFBC/AFRC resources that will be used in the
|
||||
* blit operation are legalized before calling blitter operations, otherwise
|
||||
* we may trigger a recursive blit */
|
||||
void panfrost_blitter_blit_no_afbc_legalization(struct pipe_context *pipe,
|
||||
const struct pipe_blit_info *info);
|
||||
|
||||
void panfrost_blitter_blit(struct pipe_context *pipe,
|
||||
const struct pipe_blit_info *info);
|
||||
|
||||
#endif
|
||||
|
|
@ -32,6 +32,7 @@
|
|||
#include "compiler/pan_compiler.h"
|
||||
#include "compiler/nir/nir_serialize.h"
|
||||
#include "decode.h"
|
||||
#include "pan_blitter.h"
|
||||
#include "pan_device.h"
|
||||
#include "pan_fence.h"
|
||||
#include "pan_screen.h"
|
||||
|
|
|
|||
|
|
@ -27,6 +27,7 @@
|
|||
#include "decode.h"
|
||||
#include "pan_afbc.h"
|
||||
#include "pan_afrc.h"
|
||||
#include "pan_blitter.h"
|
||||
#include "pan_bo.h"
|
||||
#include "pan_context.h"
|
||||
#include "pan_resource.h"
|
||||
|
|
@ -1355,7 +1356,7 @@ pan_blit_from_staging(struct pipe_context *pctx,
|
|||
blit.mask = util_format_get_mask(blit.src.format);
|
||||
blit.filter = PIPE_TEX_FILTER_NEAREST;
|
||||
|
||||
panfrost_blit_no_afbc_legalization(pctx, &blit);
|
||||
panfrost_blitter_blit_no_afbc_legalization(pctx, &blit);
|
||||
}
|
||||
|
||||
static void
|
||||
|
|
@ -1375,7 +1376,7 @@ pan_blit_to_staging(struct pipe_context *pctx, struct panfrost_transfer *trans)
|
|||
blit.mask = util_format_get_mask(blit.dst.format);
|
||||
blit.filter = PIPE_TEX_FILTER_NEAREST;
|
||||
|
||||
panfrost_blit_no_afbc_legalization(pctx, &blit);
|
||||
panfrost_blitter_blit_no_afbc_legalization(pctx, &blit);
|
||||
}
|
||||
|
||||
static void
|
||||
|
|
@ -1473,7 +1474,7 @@ pan_dump_resource(struct panfrost_context *ctx, struct panfrost_resource *rsc)
|
|||
blit.mask = util_format_get_mask(blit.dst.format);
|
||||
blit.filter = PIPE_TEX_FILTER_NEAREST;
|
||||
|
||||
panfrost_blit(pctx, &blit);
|
||||
panfrost_blitter_blit(pctx, &blit);
|
||||
|
||||
linear = pan_resource(plinear);
|
||||
}
|
||||
|
|
@ -1863,7 +1864,7 @@ pan_resource_modifier_convert(struct panfrost_context *ctx,
|
|||
if (drm_is_mtk_tiled(rsrc->modifier))
|
||||
screen->vtbl.mtk_detile(ctx, &blit);
|
||||
else
|
||||
panfrost_blit_no_afbc_legalization(&ctx->base, &blit);
|
||||
panfrost_blitter_blit_no_afbc_legalization(&ctx->base, &blit);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -2578,7 +2579,7 @@ panfrost_resource_context_init(struct pipe_context *pctx)
|
|||
pctx->texture_map = u_transfer_helper_transfer_map;
|
||||
pctx->texture_unmap = u_transfer_helper_transfer_unmap;
|
||||
pctx->resource_copy_region = util_resource_copy_region;
|
||||
pctx->blit = panfrost_blit;
|
||||
pctx->blit = panfrost_blitter_blit;
|
||||
pctx->generate_mipmap = panfrost_generate_mipmap;
|
||||
pctx->flush_resource = panfrost_flush_resource;
|
||||
pctx->invalidate_resource = panfrost_invalidate_resource;
|
||||
|
|
|
|||
|
|
@ -145,39 +145,6 @@ void panfrost_resource_screen_destroy(struct pipe_screen *screen);
|
|||
|
||||
void panfrost_resource_context_init(struct pipe_context *pctx);
|
||||
|
||||
/* Blitting */
|
||||
|
||||
enum panfrost_blitter_op /* bitmask */
|
||||
{
|
||||
PAN_SAVE_TEXTURES = 1,
|
||||
PAN_SAVE_FRAMEBUFFER = 2,
|
||||
PAN_SAVE_FRAGMENT_STATE = 4,
|
||||
PAN_SAVE_FRAGMENT_CONSTANT = 8,
|
||||
PAN_DISABLE_RENDER_COND = 16,
|
||||
};
|
||||
|
||||
enum {
|
||||
PAN_RENDER_BLIT =
|
||||
PAN_SAVE_TEXTURES | PAN_SAVE_FRAMEBUFFER | PAN_SAVE_FRAGMENT_STATE,
|
||||
PAN_RENDER_BLIT_COND = PAN_SAVE_TEXTURES | PAN_SAVE_FRAMEBUFFER |
|
||||
PAN_SAVE_FRAGMENT_STATE | PAN_DISABLE_RENDER_COND,
|
||||
PAN_RENDER_BASE = PAN_SAVE_FRAMEBUFFER | PAN_SAVE_FRAGMENT_STATE,
|
||||
PAN_RENDER_COND =
|
||||
PAN_SAVE_FRAMEBUFFER | PAN_SAVE_FRAGMENT_STATE | PAN_DISABLE_RENDER_COND,
|
||||
PAN_RENDER_CLEAR = PAN_SAVE_FRAGMENT_STATE | PAN_SAVE_FRAGMENT_CONSTANT,
|
||||
};
|
||||
|
||||
struct blitter_context *panfrost_blitter_create(struct pipe_context *pipe);
|
||||
|
||||
/* Callers should ensure that all AFBC/AFRC resources that will be used in the
|
||||
* blit operation are legalized before calling blitter operations, otherwise
|
||||
* we may trigger a recursive blit */
|
||||
void panfrost_blitter_save(struct panfrost_context *ctx,
|
||||
const enum panfrost_blitter_op blitter_op);
|
||||
|
||||
void panfrost_blit(struct pipe_context *pipe,
|
||||
const struct pipe_blit_info *info);
|
||||
|
||||
void panfrost_resource_set_damage_region(struct pipe_screen *screen,
|
||||
struct pipe_resource *res,
|
||||
unsigned int nrects,
|
||||
|
|
@ -251,7 +218,4 @@ void pan_legalize_format(struct panfrost_context *ctx,
|
|||
void pan_dump_resource(struct panfrost_context *ctx,
|
||||
struct panfrost_resource *rsc);
|
||||
|
||||
void panfrost_blit_no_afbc_legalization(struct pipe_context *pipe,
|
||||
const struct pipe_blit_info *info);
|
||||
|
||||
#endif /* PAN_RESOURCE_H */
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue