/* Framebuffer descriptor */
static struct midgard_tiler_descriptor
-panfrost_emit_midg_tiler(
- struct panfrost_context *ctx,
- unsigned width,
- unsigned height,
- unsigned vertex_count)
+panfrost_emit_midg_tiler(struct panfrost_batch *batch, unsigned vertex_count)
{
+ struct panfrost_context *ctx = batch->ctx;
struct midgard_tiler_descriptor t = {};
- struct panfrost_batch *batch = panfrost_get_batch_for_fbo(ctx);
+ unsigned height = batch->key.height;
+ unsigned width = batch->key.width;
t.hierarchy_mask =
panfrost_choose_hierarchy_mask(width, height, vertex_count);
}
struct mali_single_framebuffer
-panfrost_emit_sfbd(struct panfrost_context *ctx, unsigned vertex_count)
+panfrost_emit_sfbd(struct panfrost_batch *batch, unsigned vertex_count)
{
- unsigned width = ctx->pipe_framebuffer.width;
- unsigned height = ctx->pipe_framebuffer.height;
+ struct panfrost_context *ctx = batch->ctx;
+ unsigned width = batch->key.width;
+ unsigned height = batch->key.height;
struct mali_single_framebuffer framebuffer = {
.width = MALI_POSITIVE(width),
.format = 0x30000000,
.clear_flags = 0x1000,
.unknown_address_0 = ctx->scratchpad->gpu,
- .tiler = panfrost_emit_midg_tiler(ctx,
- width, height, vertex_count),
+ .tiler = panfrost_emit_midg_tiler(batch, vertex_count),
};
return framebuffer;
}
struct bifrost_framebuffer
-panfrost_emit_mfbd(struct panfrost_context *ctx, unsigned vertex_count)
+panfrost_emit_mfbd(struct panfrost_batch *batch, unsigned vertex_count)
{
- unsigned width = ctx->pipe_framebuffer.width;
- unsigned height = ctx->pipe_framebuffer.height;
+ struct panfrost_context *ctx = batch->ctx;
+ unsigned width = batch->key.width;
+ unsigned height = batch->key.height;
struct bifrost_framebuffer framebuffer = {
.unk0 = 0x1e5, /* 1e4 if no spill */
.unk1 = 0x1080,
- .rt_count_1 = MALI_POSITIVE(ctx->pipe_framebuffer.nr_cbufs),
+ .rt_count_1 = MALI_POSITIVE(batch->key.nr_cbufs),
.rt_count_2 = 4,
.unknown2 = 0x1f,
.scratchpad = ctx->scratchpad->gpu,
- .tiler = panfrost_emit_midg_tiler(ctx,
- width, height, vertex_count)
+ .tiler = panfrost_emit_midg_tiler(batch, vertex_count)
};
return framebuffer;
panfrost_attach_vt_mfbd(struct panfrost_context *ctx)
{
struct panfrost_batch *batch = panfrost_get_batch_for_fbo(ctx);
- struct bifrost_framebuffer mfbd = panfrost_emit_mfbd(ctx, ~0);
+ struct bifrost_framebuffer mfbd = panfrost_emit_mfbd(batch, ~0);
return panfrost_upload_transient(batch, &mfbd, sizeof(mfbd)) | MALI_MFBD;
}
panfrost_attach_vt_sfbd(struct panfrost_context *ctx)
{
struct panfrost_batch *batch = panfrost_get_batch_for_fbo(ctx);
- struct mali_single_framebuffer sfbd = panfrost_emit_sfbd(ctx, ~0);
+ struct mali_single_framebuffer sfbd = panfrost_emit_sfbd(batch, ~0);
return panfrost_upload_transient(batch, &sfbd, sizeof(sfbd)) | MALI_SFBD;
}
struct pipe_fence_handle **fence,
unsigned flags);
-mali_ptr panfrost_sfbd_fragment(struct panfrost_context *ctx, bool has_draws);
-mali_ptr panfrost_mfbd_fragment(struct panfrost_context *ctx, bool has_draws);
+mali_ptr panfrost_sfbd_fragment(struct panfrost_batch *batch, bool has_draws);
+mali_ptr panfrost_mfbd_fragment(struct panfrost_batch *batch, bool has_draws);
struct bifrost_framebuffer
-panfrost_emit_mfbd(struct panfrost_context *ctx, unsigned vertex_count);
+panfrost_emit_mfbd(struct panfrost_batch *batch, unsigned vertex_count);
struct mali_single_framebuffer
-panfrost_emit_sfbd(struct panfrost_context *ctx, unsigned vertex_count);
+panfrost_emit_sfbd(struct panfrost_batch *batch, unsigned vertex_count);
mali_ptr
-panfrost_fragment_job(struct panfrost_context *ctx, bool has_draws);
+panfrost_fragment_job(struct panfrost_batch *batch, bool has_draws);
void
panfrost_shader_compile(
if (batch->first_tiler.gpu || batch->clear) {
ret = panfrost_drm_submit_batch(batch,
- panfrost_fragment_job(ctx, has_draws),
+ panfrost_fragment_job(batch, has_draws),
PANFROST_JD_REQ_FS);
assert(!ret);
}
* presentations, this is supposed to correspond to eglSwapBuffers) */
mali_ptr
-panfrost_fragment_job(struct panfrost_context *ctx, bool has_draws)
+panfrost_fragment_job(struct panfrost_batch *batch, bool has_draws)
{
- struct panfrost_screen *screen = pan_screen(ctx->base.screen);
+ struct panfrost_screen *screen = pan_screen(batch->ctx->base.screen);
mali_ptr framebuffer = screen->require_sfbd ?
- panfrost_sfbd_fragment(ctx, has_draws) :
- panfrost_mfbd_fragment(ctx, has_draws);
+ panfrost_sfbd_fragment(batch, has_draws) :
+ panfrost_mfbd_fragment(batch, has_draws);
/* Mark the affected buffers as initialized, since we're writing to it.
* Also, add the surfaces we're writing to to the batch */
- struct pipe_framebuffer_state *fb = &ctx->pipe_framebuffer;
- struct panfrost_batch *batch = panfrost_get_batch_for_fbo(ctx);
+ struct pipe_framebuffer_state *fb = &batch->key;
for (unsigned i = 0; i < fb->nr_cbufs; ++i) {
panfrost_initialize_surface(batch, fb->cbufs[i]);
}
static mali_ptr
-panfrost_mfbd_upload(
- struct panfrost_context *ctx,
+panfrost_mfbd_upload(struct panfrost_batch *batch,
struct bifrost_framebuffer *fb,
struct bifrost_fb_extra *fbx,
struct bifrost_render_target *rts,
(has_extra ? sizeof(struct bifrost_fb_extra) : 0) +
sizeof(struct bifrost_render_target) * 4;
- struct panfrost_batch *batch = panfrost_get_batch_for_fbo(ctx);
struct panfrost_transfer m_f_trans =
panfrost_allocate_transient(batch, total_sz);
/* Creates an MFBD for the FRAGMENT section of the bound framebuffer */
mali_ptr
-panfrost_mfbd_fragment(struct panfrost_context *ctx, bool has_draws)
+panfrost_mfbd_fragment(struct panfrost_batch *batch, bool has_draws)
{
- struct panfrost_batch *batch = panfrost_get_batch_for_fbo(ctx);
-
- struct bifrost_framebuffer fb = panfrost_emit_mfbd(ctx, has_draws);
+ struct bifrost_framebuffer fb = panfrost_emit_mfbd(batch, has_draws);
struct bifrost_fb_extra fbx = {};
struct bifrost_render_target rts[4] = {};
/* We always upload at least one dummy GL_NONE render target */
- unsigned rt_descriptors =
- MAX2(ctx->pipe_framebuffer.nr_cbufs, 1);
+ unsigned rt_descriptors = MAX2(batch->key.nr_cbufs, 1);
fb.rt_count_1 = MALI_POSITIVE(rt_descriptors);
fb.rt_count_2 = rt_descriptors;
/* Upload either the render target or a dummy GL_NONE target */
for (int cb = 0; cb < rt_descriptors; ++cb) {
- struct pipe_surface *surf = ctx->pipe_framebuffer.cbufs[cb];
+ struct pipe_surface *surf = batch->key.cbufs[cb];
if (surf) {
panfrost_mfbd_set_cbuf(&rts[cb], surf);
rts[cb].format.unk1 |= (cb * 0x400);
}
- if (ctx->pipe_framebuffer.zsbuf) {
- panfrost_mfbd_set_zsbuf(&fb, &fbx, ctx->pipe_framebuffer.zsbuf);
+ if (batch->key.zsbuf) {
+ panfrost_mfbd_set_zsbuf(&fb, &fbx, batch->key.zsbuf);
}
/* When scanning out, the depth buffer is immediately invalidated, so
/* Checksumming only works with a single render target */
- if (ctx->pipe_framebuffer.nr_cbufs == 1) {
- struct pipe_surface *surf = ctx->pipe_framebuffer.cbufs[0];
+ if (batch->key.nr_cbufs == 1) {
+ struct pipe_surface *surf = batch->key.cbufs[0];
struct panfrost_resource *rsrc = pan_resource(surf->texture);
struct panfrost_bo *bo = rsrc->bo;
}
}
- return panfrost_mfbd_upload(ctx, &fb, &fbx, rts, rt_descriptors);
+ return panfrost_mfbd_upload(batch, &fb, &fbx, rts, rt_descriptors);
}
/* Creates an SFBD for the FRAGMENT section of the bound framebuffer */
mali_ptr
-panfrost_sfbd_fragment(struct panfrost_context *ctx, bool has_draws)
+panfrost_sfbd_fragment(struct panfrost_batch *batch, bool has_draws)
{
- struct panfrost_batch *batch = panfrost_get_batch_for_fbo(ctx);
- struct mali_single_framebuffer fb = panfrost_emit_sfbd(ctx, has_draws);
+ struct mali_single_framebuffer fb = panfrost_emit_sfbd(batch, has_draws);
panfrost_sfbd_clear(batch, &fb);
/* SFBD does not support MRT natively; sanity check */
- assert(ctx->pipe_framebuffer.nr_cbufs == 1);
- panfrost_sfbd_set_cbuf(&fb, ctx->pipe_framebuffer.cbufs[0]);
+ assert(batch->key.nr_cbufs == 1);
+ panfrost_sfbd_set_cbuf(&fb, batch->key.cbufs[0]);
- if (ctx->pipe_framebuffer.zsbuf)
- panfrost_sfbd_set_zsbuf(&fb, ctx->pipe_framebuffer.zsbuf);
+ if (batch->key.zsbuf)
+ panfrost_sfbd_set_zsbuf(&fb, batch->key.zsbuf);
if (batch->requirements & PAN_REQ_MSAA)
fb.format |= MALI_FRAMEBUFFER_MSAA_A | MALI_FRAMEBUFFER_MSAA_B;