mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-05-05 11:48:06 +02:00
panfrost: Store the index pointer in panfrost_batch
So we can later use it from job-frontend specific hooks without having to pass the pointer around. Signed-off-by: Boris Brezillon <boris.brezillon@collabora.com> Reviewed-by: Erik Faye-Lund <erik.faye-lund@collabora.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/26249>
This commit is contained in:
parent
d618a46590
commit
a0d0e07036
2 changed files with 22 additions and 19 deletions
|
|
@ -3009,11 +3009,12 @@ panfrost_batch_get_bifrost_tiler(struct panfrost_batch *batch,
|
|||
* jobs and Valhall IDVS jobs
|
||||
*/
|
||||
static void
|
||||
panfrost_emit_primitive(struct panfrost_context *ctx,
|
||||
panfrost_emit_primitive(struct panfrost_batch *batch,
|
||||
const struct pipe_draw_info *info,
|
||||
const struct pipe_draw_start_count_bias *draw,
|
||||
mali_ptr indices, bool secondary_shader, void *out)
|
||||
bool secondary_shader, void *out)
|
||||
{
|
||||
struct panfrost_context *ctx = batch->ctx;
|
||||
UNUSED struct pipe_rasterizer_state *rast = &ctx->rasterizer->base;
|
||||
|
||||
bool lines =
|
||||
|
|
@ -3074,7 +3075,7 @@ panfrost_emit_primitive(struct panfrost_context *ctx,
|
|||
cfg.base_vertex_offset = draw->index_bias - ctx->offset_start;
|
||||
|
||||
#if PAN_ARCH <= 7
|
||||
cfg.indices = indices;
|
||||
cfg.indices = batch->indices;
|
||||
#endif
|
||||
}
|
||||
|
||||
|
|
@ -3302,7 +3303,7 @@ static void
|
|||
panfrost_emit_malloc_vertex(struct panfrost_batch *batch,
|
||||
const struct pipe_draw_info *info,
|
||||
const struct pipe_draw_start_count_bias *draw,
|
||||
mali_ptr indices, bool secondary_shader, void *job)
|
||||
bool secondary_shader, void *job)
|
||||
{
|
||||
struct panfrost_context *ctx = batch->ctx;
|
||||
struct panfrost_compiled_shader *vs = ctx->prog[PIPE_SHADER_VERTEX];
|
||||
|
|
@ -3316,7 +3317,7 @@ panfrost_emit_malloc_vertex(struct panfrost_batch *batch,
|
|||
*/
|
||||
secondary_shader &= fs_required;
|
||||
|
||||
panfrost_emit_primitive(ctx, info, draw, 0, secondary_shader,
|
||||
panfrost_emit_primitive(batch, info, draw, secondary_shader,
|
||||
pan_section_ptr(job, MALLOC_VERTEX_JOB, PRIMITIVE));
|
||||
|
||||
pan_section_pack(job, MALLOC_VERTEX_JOB, INSTANCE_COUNT, cfg) {
|
||||
|
|
@ -3342,7 +3343,7 @@ panfrost_emit_malloc_vertex(struct panfrost_batch *batch,
|
|||
}
|
||||
|
||||
pan_section_pack(job, MALLOC_VERTEX_JOB, TILER, cfg) {
|
||||
cfg.address = panfrost_batch_get_bifrost_tiler(batch, ~0);
|
||||
cfg.address = batch->indices;
|
||||
}
|
||||
|
||||
STATIC_ASSERT(sizeof(batch->scissor) == pan_size(SCISSOR));
|
||||
|
|
@ -3354,7 +3355,7 @@ panfrost_emit_malloc_vertex(struct panfrost_batch *batch,
|
|||
pan_section_ptr(job, MALLOC_VERTEX_JOB, PRIMITIVE_SIZE));
|
||||
|
||||
pan_section_pack(job, MALLOC_VERTEX_JOB, INDICES, cfg) {
|
||||
cfg.address = indices;
|
||||
cfg.address = batch->indices;
|
||||
}
|
||||
|
||||
panfrost_emit_draw(pan_section_ptr(job, MALLOC_VERTEX_JOB, DRAW), batch,
|
||||
|
|
@ -3394,16 +3395,16 @@ static void
|
|||
panfrost_draw_emit_tiler(struct panfrost_batch *batch,
|
||||
const struct pipe_draw_info *info,
|
||||
const struct pipe_draw_start_count_bias *draw,
|
||||
void *invocation_template, mali_ptr indices,
|
||||
mali_ptr fs_vary, mali_ptr varyings, mali_ptr pos,
|
||||
mali_ptr psiz, bool secondary_shader, void *job)
|
||||
void *invocation_template, mali_ptr fs_vary,
|
||||
mali_ptr varyings, mali_ptr pos, mali_ptr psiz,
|
||||
bool secondary_shader, void *job)
|
||||
{
|
||||
struct panfrost_context *ctx = batch->ctx;
|
||||
|
||||
void *section = pan_section_ptr(job, TILER_JOB, INVOCATION);
|
||||
memcpy(section, invocation_template, pan_size(INVOCATION));
|
||||
|
||||
panfrost_emit_primitive(ctx, info, draw, indices, secondary_shader,
|
||||
panfrost_emit_primitive(batch, info, draw, secondary_shader,
|
||||
pan_section_ptr(job, TILER_JOB, PRIMITIVE));
|
||||
|
||||
void *prim_size = pan_section_ptr(job, TILER_JOB, PRIMITIVE_SIZE);
|
||||
|
|
@ -3588,16 +3589,16 @@ panfrost_direct_draw(struct panfrost_batch *batch,
|
|||
unsigned vertex_count = ctx->vertex_count;
|
||||
|
||||
unsigned min_index = 0, max_index = 0;
|
||||
mali_ptr indices = 0;
|
||||
|
||||
batch->indices = 0;
|
||||
if (info->index_size && PAN_ARCH >= 9) {
|
||||
indices = panfrost_get_index_buffer(batch, info, draw);
|
||||
batch->indices = panfrost_get_index_buffer(batch, info, draw);
|
||||
|
||||
/* Use index count to estimate vertex count */
|
||||
panfrost_increase_vertex_count(batch, draw->count);
|
||||
} else if (info->index_size) {
|
||||
indices = panfrost_get_index_buffer_bounded(batch, info, draw, &min_index,
|
||||
&max_index);
|
||||
batch->indices = panfrost_get_index_buffer_bounded(
|
||||
batch, info, draw, &min_index, &max_index);
|
||||
|
||||
/* Use the corresponding values */
|
||||
vertex_count = max_index - min_index + 1;
|
||||
|
|
@ -3678,16 +3679,15 @@ panfrost_direct_draw(struct panfrost_batch *batch,
|
|||
#if PAN_ARCH >= 9
|
||||
assert(idvs && "Memory allocated IDVS required on Valhall");
|
||||
|
||||
panfrost_emit_malloc_vertex(batch, info, draw, indices, secondary_shader,
|
||||
tiler.cpu);
|
||||
panfrost_emit_malloc_vertex(batch, info, draw, secondary_shader, tiler.cpu);
|
||||
|
||||
panfrost_add_job(&batch->pool.base, &batch->scoreboard,
|
||||
MALI_JOB_TYPE_MALLOC_VERTEX, false, false, 0, 0, &tiler,
|
||||
false);
|
||||
#else
|
||||
/* Fire off the draw itself */
|
||||
panfrost_draw_emit_tiler(batch, info, draw, &invocation, indices, fs_vary,
|
||||
varyings, pos, psiz, secondary_shader, tiler.cpu);
|
||||
panfrost_draw_emit_tiler(batch, info, draw, &invocation, fs_vary, varyings,
|
||||
pos, psiz, secondary_shader, tiler.cpu);
|
||||
if (idvs) {
|
||||
#if PAN_ARCH >= 6
|
||||
panfrost_draw_emit_vertex_section(
|
||||
|
|
|
|||
|
|
@ -178,6 +178,9 @@ struct panfrost_batch {
|
|||
unsigned nr_push_uniforms[PIPE_SHADER_TYPES];
|
||||
unsigned nr_uniform_buffers[PIPE_SHADER_TYPES];
|
||||
|
||||
/* Index array */
|
||||
mali_ptr indices;
|
||||
|
||||
/* Valhall: struct mali_scissor_packed */
|
||||
unsigned scissor[2];
|
||||
float minimum_z, maximum_z;
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue