panfrost: Move init_batch to GenXML vtbl

Secretly depends on GenXML.

Signed-off-by: Alyssa Rosenzweig <alyssa@collabora.com>
Reviewed-by: Boris Brezillon <boris.brezillon@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11851>
This commit is contained in:
Alyssa Rosenzweig
2021-07-13 13:42:55 -04:00
committed by Marge Bot
parent 3d0f6592b2
commit 6f0c235da1
3 changed files with 32 additions and 19 deletions
@@ -3486,6 +3486,30 @@ preload(struct panfrost_batch *batch, struct pan_fb_info *fb)
PAN_ARCH >= 6 ? batch->tiler_ctx.bifrost : 0);
}
static void
init_batch(struct panfrost_batch *batch)
{
/* Reserve the framebuffer and local storage descriptors */
batch->framebuffer =
#if PAN_ARCH == 4
pan_pool_alloc_desc(&batch->pool.base, SINGLE_TARGET_FRAMEBUFFER);
#else
pan_pool_alloc_desc_aggregate(&batch->pool.base,
PAN_DESC(MULTI_TARGET_FRAMEBUFFER),
PAN_DESC(ZS_CRC_EXTENSION),
PAN_DESC_ARRAY(MAX2(batch->key.nr_cbufs, 1), RENDER_TARGET));
batch->framebuffer.gpu |= MALI_FBD_TAG_IS_MFBD;
#endif
#if PAN_ARCH >= 6
batch->tls = pan_pool_alloc_desc(&batch->pool.base, LOCAL_STORAGE);
#else
/* On Midgard, the TLS is embedded in the FB descriptor */
batch->tls = batch->framebuffer;
#endif
}
static void
context_init(struct pipe_context *pipe)
{
@@ -3514,6 +3538,7 @@ GENX(panfrost_cmdstream_screen_init)(struct panfrost_screen *screen)
screen->vtbl.screen_destroy = screen_destroy;
screen->vtbl.preload = preload;
screen->vtbl.context_init = context_init;
screen->vtbl.init_batch = init_batch;
pan_blitter_init(dev, &screen->blitter.bin_pool.base,
&screen->blitter.desc_pool.base);
+4 -19
View File
@@ -51,7 +51,9 @@ panfrost_batch_init(struct panfrost_context *ctx,
const struct pipe_framebuffer_state *key,
struct panfrost_batch *batch)
{
struct panfrost_device *dev = pan_device(ctx->base.screen);
struct pipe_screen *pscreen = ctx->base.screen;
struct panfrost_screen *screen = pan_screen(pscreen);
struct panfrost_device *dev = &screen->dev;
batch->ctx = ctx;
@@ -79,24 +81,7 @@ panfrost_batch_init(struct panfrost_context *ctx,
panfrost_batch_add_fbo_bos(batch);
/* Reserve the framebuffer and local storage descriptors */
batch->framebuffer =
(dev->quirks & MIDGARD_SFBD) ?
pan_pool_alloc_desc(&batch->pool.base, SINGLE_TARGET_FRAMEBUFFER) :
pan_pool_alloc_desc_aggregate(&batch->pool.base,
PAN_DESC(MULTI_TARGET_FRAMEBUFFER),
PAN_DESC(ZS_CRC_EXTENSION),
PAN_DESC_ARRAY(MAX2(key->nr_cbufs, 1), RENDER_TARGET));
/* Add the MFBD tag now, other tags will be added at submit-time */
if (!(dev->quirks & MIDGARD_SFBD))
batch->framebuffer.gpu |= MALI_FBD_TAG_IS_MFBD;
/* On Midgard, the TLS is embedded in the FB descriptor */
if (pan_is_bifrost(dev))
batch->tls = pan_pool_alloc_desc(&batch->pool.base, LOCAL_STORAGE);
else
batch->tls = batch->framebuffer;
screen->vtbl.init_batch(batch);
}
static void
@@ -73,6 +73,9 @@ struct panfrost_vtable {
/* Initialize a Gallium context */
void (*context_init)(struct pipe_context *pipe);
/* Device-dependent initialization of a panfrost_batch */
void (*init_batch)(struct panfrost_batch *batch);
};
struct panfrost_screen {