diff --git a/src/gallium/drivers/panfrost/pan_cmdstream.c b/src/gallium/drivers/panfrost/pan_cmdstream.c index f8754a62cd8..b5607121ec9 100644 --- a/src/gallium/drivers/panfrost/pan_cmdstream.c +++ b/src/gallium/drivers/panfrost/pan_cmdstream.c @@ -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; diff --git a/src/panfrost/lib/pan_cs.c b/src/panfrost/lib/pan_cs.c index 25140ce20d6..770102914a5 100644 --- a/src/panfrost/lib/pan_cs.c +++ b/src/panfrost/lib/pan_cs.c @@ -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) diff --git a/src/panfrost/lib/pan_cs.h b/src/panfrost/lib/pan_cs.h index d690b904134..b4266d4b6b4 100644 --- a/src/panfrost/lib/pan_cs.h +++ b/src/panfrost/lib/pan_cs.h @@ -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 */