panfrost: Inline pan_emit_tiler_ctx()

Tiler context emission will differ on v10. Given pan_emit_tiler_ctx()
was only used in the gallium driver, and its implementation is
relatively simple, inline the code in panfrost_batch_get_bifrost_tiler().
This way we will avoid the churn caused by the function prototype change.

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:
Boris Brezillon 2023-11-13 16:53:01 +01:00 committed by Marge Bot
parent b378cfbc48
commit 948062ee84
3 changed files with 44 additions and 62 deletions

View file

@ -2970,12 +2970,32 @@ panfrost_batch_get_bifrost_tiler(struct panfrost_batch *batch,
}
mali_ptr heap = t.gpu;
unsigned max_levels = dev->tiler_features.max_levels;
assert(max_levels >= 2);
t = pan_pool_alloc_desc(&batch->pool.base, TILER_CONTEXT);
GENX(pan_emit_tiler_ctx)
(dev, batch->key.width, batch->key.height,
util_framebuffer_get_num_samples(&batch->key),
pan_tristate_get(batch->first_provoking_vertex), heap, t.cpu);
pan_pack(t.cpu, TILER_CONTEXT, tiler) {
/* TODO: Select hierarchy mask more effectively */
tiler.hierarchy_mask = (max_levels >= 8) ? 0xFF : 0x28;
/* For large framebuffers, disable the smallest bin size to
* avoid pathological tiler memory usage. Required to avoid OOM
* on dEQP-GLES31.functional.fbo.no_attachments.maximums.all on
* Mali-G57.
*/
if (MAX2(batch->key.width, batch->key.height) >= 4096)
tiler.hierarchy_mask &= ~1;
tiler.fb_width = batch->key.width;
tiler.fb_height = batch->key.height;
tiler.heap = heap;
tiler.sample_pattern =
pan_sample_pattern(util_framebuffer_get_num_samples(&batch->key));
#if PAN_ARCH >= 9
tiler.first_provoking_vertex =
pan_tristate_get(batch->first_provoking_vertex);
#endif
}
batch->tiler_ctx.bifrost = t.gpu;
return batch->tiler_ctx.bifrost;

View file

@ -77,25 +77,6 @@ mali_sampling_mode(const struct pan_image_view *view)
return MALI_MSAA_SINGLE;
}
#if PAN_ARCH >= 5
static inline enum mali_sample_pattern
pan_sample_pattern(unsigned samples)
{
switch (samples) {
case 1:
return MALI_SAMPLE_PATTERN_SINGLE_SAMPLED;
case 4:
return MALI_SAMPLE_PATTERN_ROTATED_4X_GRID;
case 8:
return MALI_SAMPLE_PATTERN_D3D_8X_GRID;
case 16:
return MALI_SAMPLE_PATTERN_D3D_16X_GRID;
default:
unreachable("Unsupported sample count");
}
}
#endif
int
GENX(pan_select_crc_rt)(const struct pan_fb_info *fb, unsigned tile_size)
{
@ -963,38 +944,6 @@ GENX(pan_emit_fbd)(const struct panfrost_device *dev,
}
#endif
#if PAN_ARCH >= 6
void
GENX(pan_emit_tiler_ctx)(const struct panfrost_device *dev, unsigned fb_width,
unsigned fb_height, unsigned nr_samples,
bool first_provoking_vertex, mali_ptr heap, void *out)
{
unsigned max_levels = dev->tiler_features.max_levels;
assert(max_levels >= 2);
pan_pack(out, TILER_CONTEXT, tiler) {
/* TODO: Select hierarchy mask more effectively */
tiler.hierarchy_mask = (max_levels >= 8) ? 0xFF : 0x28;
/* For large framebuffers, disable the smallest bin size to
* avoid pathological tiler memory usage. Required to avoid OOM
* on dEQP-GLES31.functional.fbo.no_attachments.maximums.all on
* Mali-G57.
*/
if (MAX2(fb_width, fb_height) >= 4096)
tiler.hierarchy_mask &= ~1;
tiler.fb_width = fb_width;
tiler.fb_height = fb_height;
tiler.heap = heap;
tiler.sample_pattern = pan_sample_pattern(nr_samples);
#if PAN_ARCH >= 9
tiler.first_provoking_vertex = first_provoking_vertex;
#endif
}
}
#endif
void
GENX(pan_emit_fragment_job)(const struct pan_fb_info *fb, mali_ptr fbd,
void *out)

View file

@ -152,6 +152,26 @@ pan_wls_mem_size(const struct panfrost_device *dev,
}
#ifdef PAN_ARCH
#if PAN_ARCH >= 5
static inline enum mali_sample_pattern
pan_sample_pattern(unsigned samples)
{
switch (samples) {
case 1:
return MALI_SAMPLE_PATTERN_SINGLE_SAMPLED;
case 4:
return MALI_SAMPLE_PATTERN_ROTATED_4X_GRID;
case 8:
return MALI_SAMPLE_PATTERN_D3D_8X_GRID;
case 16:
return MALI_SAMPLE_PATTERN_D3D_16X_GRID;
default:
unreachable("Unsupported sample count");
}
}
#endif
void GENX(pan_emit_tls)(const struct pan_tls_info *info, void *out);
int GENX(pan_select_crc_rt)(const struct pan_fb_info *fb, unsigned tile_size);
@ -162,13 +182,6 @@ unsigned GENX(pan_emit_fbd)(const struct panfrost_device *dev,
const struct pan_tiler_context *tiler_ctx,
void *out);
#if PAN_ARCH >= 6
void GENX(pan_emit_tiler_ctx)(const struct panfrost_device *dev,
unsigned fb_width, unsigned fb_height,
unsigned nr_samples, bool first_provoking_vertex,
mali_ptr heap, void *out);
#endif
void GENX(pan_emit_fragment_job)(const struct pan_fb_info *fb, mali_ptr fbd,
void *out);
#endif /* ifdef PAN_ARCH */