mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-05-04 22:49:13 +02:00
panfrost: Split up allocation and packing of tiler descriptor
This is mostly useful so that we can set the hierarchy level mask using information from the `pan_fb_info` structure that isn't filled yet when the tiler descriptor is first allocated. Signed-off-by: Louis-Francis Ratté-Boulianne <lfrb@collabora.com> Reviewed-by: Boris Brezillon <boris.brezillon@collabora.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/31948>
This commit is contained in:
parent
ca84b1e9b5
commit
eead8b6efd
4 changed files with 68 additions and 41 deletions
|
|
@ -3931,6 +3931,7 @@ init_polygon_list(struct panfrost_batch *batch)
|
|||
static int
|
||||
submit_batch(struct panfrost_batch *batch, struct pan_fb_info *fb)
|
||||
{
|
||||
JOBX(prepare_tiler)(batch, fb);
|
||||
JOBX(preload_fb)(batch, fb);
|
||||
init_polygon_list(batch);
|
||||
|
||||
|
|
|
|||
|
|
@ -612,6 +612,64 @@ out_free_syncops:
|
|||
return ret;
|
||||
}
|
||||
|
||||
static mali_ptr
|
||||
csf_get_tiler_desc(struct panfrost_batch *batch)
|
||||
{
|
||||
if (batch->tiler_ctx.valhall.desc)
|
||||
return batch->tiler_ctx.valhall.desc;
|
||||
|
||||
struct panfrost_ptr t =
|
||||
pan_pool_alloc_desc(&batch->pool.base, TILER_CONTEXT);
|
||||
|
||||
batch->csf.pending_tiler_desc = t.cpu;
|
||||
batch->tiler_ctx.valhall.desc = t.gpu;
|
||||
return batch->tiler_ctx.valhall.desc;
|
||||
}
|
||||
|
||||
static void
|
||||
csf_emit_tiler_desc(struct panfrost_batch *batch, const struct pan_fb_info *fb)
|
||||
{
|
||||
struct panfrost_context *ctx = batch->ctx;
|
||||
struct panfrost_device *dev = pan_device(ctx->base.screen);
|
||||
|
||||
if (!batch->csf.pending_tiler_desc)
|
||||
return;
|
||||
|
||||
pan_pack(batch->csf.pending_tiler_desc, TILER_CONTEXT, tiler) {
|
||||
unsigned max_levels = dev->tiler_features.max_levels;
|
||||
assert(max_levels >= 2);
|
||||
|
||||
/* 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 = batch->ctx->csf.heap.desc_bo->ptr.gpu;
|
||||
tiler.sample_pattern =
|
||||
pan_sample_pattern(util_framebuffer_get_num_samples(&batch->key));
|
||||
tiler.first_provoking_vertex =
|
||||
batch->first_provoking_vertex == U_TRISTATE_YES;
|
||||
tiler.geometry_buffer = ctx->csf.tmp_geom_bo->ptr.gpu;
|
||||
tiler.geometry_buffer_size = ctx->csf.tmp_geom_bo->kmod_bo->size;
|
||||
}
|
||||
|
||||
batch->csf.pending_tiler_desc = 0;
|
||||
}
|
||||
|
||||
void
|
||||
GENX(csf_prepare_tiler)(struct panfrost_batch *batch, struct pan_fb_info *fb)
|
||||
{
|
||||
csf_emit_tiler_desc(batch, fb);
|
||||
}
|
||||
|
||||
void
|
||||
GENX(csf_preload_fb)(struct panfrost_batch *batch, struct pan_fb_info *fb)
|
||||
{
|
||||
|
|
@ -929,47 +987,6 @@ GENX(csf_launch_xfb)(struct panfrost_batch *batch,
|
|||
cs_run_compute(b, 1, MALI_TASK_AXIS_Z, false, cs_shader_res_sel(0, 0, 0, 0));
|
||||
}
|
||||
|
||||
static mali_ptr
|
||||
csf_get_tiler_desc(struct panfrost_batch *batch)
|
||||
{
|
||||
struct panfrost_context *ctx = batch->ctx;
|
||||
struct panfrost_device *dev = pan_device(ctx->base.screen);
|
||||
|
||||
if (batch->tiler_ctx.valhall.desc)
|
||||
return batch->tiler_ctx.valhall.desc;
|
||||
|
||||
struct panfrost_ptr t =
|
||||
pan_pool_alloc_desc(&batch->pool.base, TILER_CONTEXT);
|
||||
pan_pack(t.cpu, TILER_CONTEXT, tiler) {
|
||||
unsigned max_levels = dev->tiler_features.max_levels;
|
||||
assert(max_levels >= 2);
|
||||
|
||||
/* 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 = batch->ctx->csf.heap.desc_bo->ptr.gpu;
|
||||
tiler.sample_pattern =
|
||||
pan_sample_pattern(util_framebuffer_get_num_samples(&batch->key));
|
||||
tiler.first_provoking_vertex =
|
||||
batch->first_provoking_vertex == U_TRISTATE_YES;
|
||||
tiler.geometry_buffer = ctx->csf.tmp_geom_bo->ptr.gpu;
|
||||
tiler.geometry_buffer_size = ctx->csf.tmp_geom_bo->kmod_bo->size;
|
||||
}
|
||||
|
||||
batch->tiler_ctx.valhall.desc = t.gpu;
|
||||
return batch->tiler_ctx.valhall.desc;
|
||||
}
|
||||
|
||||
static void
|
||||
emit_tiler_oom_context(struct cs_builder *b, struct panfrost_batch *batch)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -74,6 +74,8 @@ struct panfrost_csf_batch {
|
|||
struct panfrost_pool cs_chunk_pool;
|
||||
|
||||
struct panfrost_ptr tiler_oom_ctx;
|
||||
|
||||
void *pending_tiler_desc;
|
||||
};
|
||||
|
||||
struct panfrost_csf_context {
|
||||
|
|
@ -114,6 +116,8 @@ void GENX(csf_init_batch)(struct panfrost_batch *batch);
|
|||
void GENX(csf_cleanup_batch)(struct panfrost_batch *batch);
|
||||
int GENX(csf_submit_batch)(struct panfrost_batch *batch);
|
||||
|
||||
void GENX(csf_prepare_tiler)(struct panfrost_batch *batch,
|
||||
struct pan_fb_info *fb);
|
||||
void GENX(csf_preload_fb)(struct panfrost_batch *batch, struct pan_fb_info *fb);
|
||||
void GENX(csf_emit_fbds)(struct panfrost_batch *batch, struct pan_fb_info *fb,
|
||||
struct pan_tls_info *tls);
|
||||
|
|
|
|||
|
|
@ -70,6 +70,11 @@ GENX(jm_cleanup_batch)(struct panfrost_batch *batch)
|
|||
|
||||
int GENX(jm_submit_batch)(struct panfrost_batch *batch);
|
||||
|
||||
static inline void
|
||||
GENX(jm_prepare_tiler)(struct panfrost_batch *batch, struct pan_fb_info *fb)
|
||||
{
|
||||
}
|
||||
|
||||
void GENX(jm_preload_fb)(struct panfrost_batch *batch, struct pan_fb_info *fb);
|
||||
void GENX(jm_emit_fbds)(struct panfrost_batch *batch, struct pan_fb_info *fb,
|
||||
struct pan_tls_info *tls);
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue