static mali_ptr
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);
- return panfrost_upload_transient(ctx, &mfbd, sizeof(mfbd)) | MALI_MFBD;
+ return panfrost_upload_transient(batch, &mfbd, sizeof(mfbd)) | MALI_MFBD;
}
static mali_ptr
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);
- return panfrost_upload_transient(ctx, &sfbd, sizeof(sfbd)) | MALI_SFBD;
+ return panfrost_upload_transient(batch, &sfbd, sizeof(sfbd)) | MALI_SFBD;
}
static void
struct panfrost_transfer
panfrost_vertex_tiler_job(struct panfrost_context *ctx, bool is_tiler)
{
+ struct panfrost_batch *batch = panfrost_get_batch_for_fbo(ctx);
struct mali_job_descriptor_header job = {
.job_type = is_tiler ? JOB_TYPE_TILER : JOB_TYPE_VERTEX,
.job_descriptor_size = 1,
struct midgard_payload_vertex_tiler *payload = is_tiler ? &ctx->payloads[PIPE_SHADER_FRAGMENT] : &ctx->payloads[PIPE_SHADER_VERTEX];
- struct panfrost_transfer transfer = panfrost_allocate_transient(ctx, sizeof(job) + sizeof(*payload));
+ struct panfrost_transfer transfer = panfrost_allocate_transient(batch, sizeof(job) + sizeof(*payload));
memcpy(transfer.cpu, &job, sizeof(job));
memcpy(transfer.cpu + sizeof(job), payload, sizeof(*payload));
return transfer;
static void
panfrost_stage_attributes(struct panfrost_context *ctx)
{
+ struct panfrost_batch *batch = panfrost_get_batch_for_fbo(ctx);
struct panfrost_vertex_state *so = ctx->vertex;
size_t sz = sizeof(struct mali_attr_meta) * so->num_elements;
- struct panfrost_transfer transfer = panfrost_allocate_transient(ctx, sz);
+ struct panfrost_transfer transfer = panfrost_allocate_transient(batch, sz);
struct mali_attr_meta *target = (struct mali_attr_meta *) transfer.cpu;
/* Copy as-is for the first pass */
static void
panfrost_upload_sampler_descriptors(struct panfrost_context *ctx)
{
+ struct panfrost_batch *batch = panfrost_get_batch_for_fbo(ctx);
size_t desc_size = sizeof(struct mali_sampler_descriptor);
for (int t = 0; t <= PIPE_SHADER_FRAGMENT; ++t) {
size_t transfer_size = desc_size * ctx->sampler_count[t];
struct panfrost_transfer transfer =
- panfrost_allocate_transient(ctx, transfer_size);
+ panfrost_allocate_transient(batch, transfer_size);
struct mali_sampler_descriptor *desc =
(struct mali_sampler_descriptor *) transfer.cpu;
}
}
- return panfrost_upload_transient(ctx, &view->hw,
+ return panfrost_upload_transient(batch, &view->hw,
sizeof(struct mali_texture_descriptor));
}
static void
panfrost_upload_texture_descriptors(struct panfrost_context *ctx)
{
+ struct panfrost_batch *batch = panfrost_get_batch_for_fbo(ctx);
+
for (int t = 0; t <= PIPE_SHADER_FRAGMENT; ++t) {
mali_ptr trampoline = 0;
trampolines[i] =
panfrost_upload_tex(ctx, ctx->sampler_views[t][i]);
- trampoline = panfrost_upload_transient(ctx, trampolines, sizeof(uint64_t) * ctx->sampler_view_count[t]);
+ trampoline = panfrost_upload_transient(batch, trampolines, sizeof(uint64_t) * ctx->sampler_view_count[t]);
}
ctx->payloads[t].postfix.texture_trampoline = trampoline;
struct pipe_constant_buffer *cb = &buf->cb[index];
struct panfrost_resource *rsrc = pan_resource(cb->buffer);
- if (rsrc)
+ if (rsrc) {
return rsrc->bo->gpu;
- else if (cb->user_buffer)
- return panfrost_upload_transient(ctx, cb->user_buffer, cb->buffer_size);
- else
+ } else if (cb->user_buffer) {
+ struct panfrost_batch *batch = panfrost_get_batch_for_fbo(ctx);
+ return panfrost_upload_transient(batch, cb->user_buffer, cb->buffer_size);
+ } else {
unreachable("No constant buffer");
+ }
}
/* Compute number of UBOs active (more specifically, compute the highest UBO
* transient uploaded */
if (should_upload) {
- return panfrost_upload_transient(ctx,
- ss->tripipe,
- sizeof(struct mali_shader_meta));
+ struct panfrost_batch *batch = panfrost_get_batch_for_fbo(ctx);
+
+ return panfrost_upload_transient(batch, ss->tripipe,
+ sizeof(struct mali_shader_meta));
}
/* If we don't need an upload, don't bother */
}
size_t size = sizeof(struct mali_shader_meta) + (sizeof(struct midgard_blend_rt) * rt_count);
- struct panfrost_transfer transfer = panfrost_allocate_transient(ctx, size);
+ struct panfrost_transfer transfer = panfrost_allocate_transient(batch, size);
memcpy(transfer.cpu, &ctx->fragment_shader_core, sizeof(struct mali_shader_meta));
ctx->payloads[PIPE_SHADER_FRAGMENT].postfix._shader_upper = (transfer.gpu) >> 4;
size_t sys_size = sizeof(float) * 4 * ss->sysval_count;
size_t uniform_size = has_uniforms ? (buf->cb[0].buffer_size) : 0;
size_t size = sys_size + uniform_size;
- struct panfrost_transfer transfer = panfrost_allocate_transient(ctx, size);
+ struct panfrost_transfer transfer = panfrost_allocate_transient(batch, size);
/* Upload sysvals requested by the shader */
panfrost_upload_sysvals(ctx, transfer.cpu, ss, i);
ubos[ubo].ptr = gpu >> 2;
}
- mali_ptr ubufs = panfrost_upload_transient(ctx, ubos, sz);
+ mali_ptr ubufs = panfrost_upload_transient(batch, ubos, sz);
postfix->uniforms = transfer.gpu;
postfix->uniform_buffers = ubufs;
view.clip_maxz = maxz;
ctx->payloads[PIPE_SHADER_FRAGMENT].postfix.viewport =
- panfrost_upload_transient(ctx,
+ panfrost_upload_transient(batch,
&view,
sizeof(struct mali_viewport));
} else {
/* Otherwise, we need to upload to transient memory */
const uint8_t *ibuf8 = (const uint8_t *) info->index.user;
- return panfrost_upload_transient(ctx, ibuf8 + offset, info->count * info->index_size);
+ return panfrost_upload_transient(batch, ibuf8 + offset, info->count * info->index_size);
}
}
{
struct panfrost_context *ctx = pan_context(pipe);
struct panfrost_query *query = (struct panfrost_query *) q;
+ struct panfrost_batch *batch = panfrost_get_batch_for_fbo(ctx);
switch (query->type) {
case PIPE_QUERY_OCCLUSION_COUNTER:
case PIPE_QUERY_OCCLUSION_PREDICATE:
case PIPE_QUERY_OCCLUSION_PREDICATE_CONSERVATIVE:
/* Allocate a word for the query results to be stored */
- query->transfer = panfrost_allocate_transient(ctx, sizeof(unsigned));
+ query->transfer = panfrost_allocate_transient(batch, sizeof(unsigned));
ctx->occlusion_query = query;
break;