#include "panfrost-quirks.h"
-#include "pan_allocate.h"
+#include "pan_pool.h"
#include "pan_bo.h"
#include "pan_cmdstream.h"
#include "pan_context.h"
.scratchpad = panfrost_batch_get_scratchpad(batch, shift, dev->thread_tls_alloc, dev->core_count)->gpu,
.shared_workgroup_count = ~0,
};
- postfix->shared_memory = panfrost_upload_transient(batch, &shared, sizeof(shared));
+ postfix->shared_memory = panfrost_pool_upload(&batch->pool, &shared, sizeof(shared));
}
static void
sizeof(struct mali_single_framebuffer) :
sizeof(struct mali_framebuffer);
- batch->framebuffer = panfrost_allocate_transient(batch, size);
+ batch->framebuffer = panfrost_pool_alloc(&batch->pool, size);
/* Tag the pointer */
if (!(dev->quirks & MIDGARD_SFBD))
} else {
/* Otherwise, we need to upload to transient memory */
const uint8_t *ibuf8 = (const uint8_t *) info->index.user;
- out = panfrost_upload_transient(batch, ibuf8 + offset,
+ out = panfrost_pool_upload(&batch->pool, ibuf8 + offset,
info->count *
info->index_size);
}
(dev->quirks & MIDGARD_SFBD) && ctx->blend &&
!ctx->blend->base.dither);
+ SET_BIT(fragmeta->unknown2_4, MALI_ALPHA_TO_COVERAGE,
+ ctx->blend->base.alpha_to_coverage);
+
/* Get blending setup */
unsigned rt_count = MAX2(ctx->pipe_framebuffer.nr_cbufs, 1);
fs = panfrost_get_shader_state(ctx, PIPE_SHADER_FRAGMENT);
- fragmeta->coverage_mask = 0xFFFF;
+ bool msaa = ctx->rasterizer && ctx->rasterizer->base.multisample;
+ fragmeta->coverage_mask = (msaa ? ctx->sample_mask : ~0) & 0xF;
+
fragmeta->unknown2_3 = MALI_DEPTH_FUNC(MALI_FUNC_ALWAYS) | 0x10;
fragmeta->unknown2_4 = 0x4e0;
SET_BIT(fragmeta->midgard1.flags_lo, MALI_EARLY_Z,
!fs->can_discard && !fs->writes_global &&
- !fs->writes_depth && !fs->writes_stencil);
+ !fs->writes_depth && !fs->writes_stencil &&
+ !ctx->blend->base.alpha_to_coverage);
/* Add the writes Z/S flags if needed. */
SET_BIT(fragmeta->midgard1.flags_lo, MALI_WRITES_Z, fs->writes_depth);
panfrost_frag_shader_meta_init(ctx, &meta, rts);
- xfer = panfrost_allocate_transient(batch, desc_size);
+ xfer = panfrost_pool_alloc(&batch->pool, desc_size);
memcpy(xfer.cpu, &meta, sizeof(meta));
memcpy(xfer.cpu + sizeof(meta), rts, rt_size * rt_count);
shader_ptr = xfer.gpu;
} else {
- shader_ptr = panfrost_upload_transient(batch, &meta,
+ shader_ptr = panfrost_pool_upload(&batch->pool, &meta,
sizeof(meta));
}
mvp.viewport1[0] + 1,
mvp.viewport1[1] + 1);
- tiler_postfix->viewport = panfrost_upload_transient(batch, &mvp,
+ tiler_postfix->viewport = panfrost_pool_upload(&batch->pool, &mvp,
sizeof(mvp));
}
* PIPE_CAP_CONSTANT_BUFFER_OFFSET_ALIGNMENT */
return rsrc->bo->gpu + cb->buffer_offset;
} else if (cb->user_buffer) {
- return panfrost_upload_transient(batch,
+ return panfrost_pool_upload(&batch->pool,
cb->user_buffer +
cb->buffer_offset,
cb->buffer_size);
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(batch,
+ struct panfrost_transfer transfer = panfrost_pool_alloc(&batch->pool,
size);
/* Upload sysvals requested by the shader */
ubos[ubo] = MALI_MAKE_UBO(aligned / bytes_per_field, gpu);
}
- mali_ptr ubufs = panfrost_upload_transient(batch, ubos, sz);
+ mali_ptr ubufs = panfrost_pool_upload(&batch->pool, ubos, sz);
postfix->uniforms = transfer.gpu;
postfix->uniform_buffers = ubufs;
.shared_shift = util_logbase2(single_size) - 1
};
- vtp->postfix.shared_memory = panfrost_upload_transient(batch, &shared,
+ vtp->postfix.shared_memory = panfrost_pool_upload(&batch->pool, &shared,
sizeof(shared));
}
memcpy(&descriptors[i], view->bifrost_descriptor, sizeof(*view->bifrost_descriptor));
}
- postfix->textures = panfrost_upload_transient(batch,
+ postfix->textures = panfrost_pool_upload(&batch->pool,
descriptors,
sizeof(struct bifrost_texture_descriptor) *
ctx->sampler_view_count[stage]);
trampolines[i] = panfrost_get_tex_desc(batch, stage, view);
}
- postfix->textures = panfrost_upload_transient(batch,
+ postfix->textures = panfrost_pool_upload(&batch->pool,
trampolines,
sizeof(uint64_t) *
ctx->sampler_view_count[stage]);
if (device->quirks & IS_BIFROST) {
size_t desc_size = sizeof(struct bifrost_sampler_descriptor);
size_t transfer_size = desc_size * ctx->sampler_count[stage];
- struct panfrost_transfer transfer = panfrost_allocate_transient(batch,
+ struct panfrost_transfer transfer = panfrost_pool_alloc(&batch->pool,
transfer_size);
struct bifrost_sampler_descriptor *desc = (struct bifrost_sampler_descriptor *)transfer.cpu;
} else {
size_t desc_size = sizeof(struct mali_sampler_descriptor);
size_t transfer_size = desc_size * ctx->sampler_count[stage];
- struct panfrost_transfer transfer = panfrost_allocate_transient(batch,
+ struct panfrost_transfer transfer = panfrost_pool_alloc(&batch->pool,
transfer_size);
struct mali_sampler_descriptor *desc = (struct mali_sampler_descriptor *)transfer.cpu;
struct panfrost_vertex_state *so = ctx->vertex;
panfrost_vertex_state_upd_attr_offs(ctx, vertex_postfix);
- vertex_postfix->attribute_meta = panfrost_upload_transient(batch, so->hw,
+ vertex_postfix->attribute_meta = panfrost_pool_upload(&batch->pool, so->hw,
sizeof(*so->hw) *
PAN_MAX_ATTRIBUTE);
}
/* Upload whatever we emitted and go */
- vertex_postfix->attributes = panfrost_upload_transient(batch, attrs,
+ vertex_postfix->attributes = panfrost_pool_upload(&batch->pool, attrs,
k * sizeof(*attrs));
}
slot->size = stride * count;
slot->shift = slot->extra_flags = 0;
- struct panfrost_transfer transfer = panfrost_allocate_transient(batch,
+ struct panfrost_transfer transfer = panfrost_pool_alloc(&batch->pool,
slot->size);
slot->elements = transfer.gpu | MALI_ATTR_LINEAR;
vs_size = sizeof(struct mali_attr_meta) * vs->varying_count;
fs_size = sizeof(struct mali_attr_meta) * fs->varying_count;
- struct panfrost_transfer trans = panfrost_allocate_transient(batch,
+ struct panfrost_transfer trans = panfrost_pool_alloc(&batch->pool,
vs_size +
fs_size);
}
unsigned xfb_base = pan_xfb_base(present);
- struct panfrost_transfer T = panfrost_allocate_transient(batch,
+ struct panfrost_transfer T = panfrost_pool_alloc(&batch->pool,
sizeof(union mali_attr) * (xfb_base + ctx->streamout.num_targets));
union mali_attr *varyings = (union mali_attr *) T.cpu;
0, 0,
};
- return panfrost_upload_transient(batch, locations, 96 * sizeof(uint16_t));
+ return panfrost_pool_upload(&batch->pool, locations, 96 * sizeof(uint16_t));
}