From: Alyssa Rosenzweig Date: Tue, 16 Jul 2019 18:36:11 +0000 (-0700) Subject: panfrost: Merge varyings_mem into transient buffers X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=a301250ece2e3d656008941308db83145b2579ca;p=mesa.git panfrost: Merge varyings_mem into transient buffers Theoretically we would like these split since varyings can have specially optimized flags (no map, coherent local). For now, since neither of these flags is particularly meaningful right now, merge them together instead of special casing varyings_mem. Saves upwards of 64MB of RAM per context. Signed-off-by: Alyssa Rosenzweig --- diff --git a/src/gallium/drivers/panfrost/pan_context.c b/src/gallium/drivers/panfrost/pan_context.c index 49ca1f570f1..929ffd16605 100644 --- a/src/gallium/drivers/panfrost/pan_context.c +++ b/src/gallium/drivers/panfrost/pan_context.c @@ -255,9 +255,6 @@ panfrost_invalidate_frame(struct panfrost_context *ctx) ctx->payload_vertex.postfix.framebuffer = 0; ctx->payload_tiler.postfix.framebuffer = 0; - /* Reset varyings allocated */ - ctx->varying_height = 0; - if (ctx->rasterizer) ctx->dirty |= PAN_DIRTY_RASTERIZER; @@ -509,18 +506,17 @@ panfrost_emit_varyings( unsigned stride, unsigned count) { - mali_ptr varying_address = ctx->varying_mem.bo->gpu + ctx->varying_height; - /* Fill out the descriptor */ - slot->elements = varying_address | MALI_ATTR_LINEAR; slot->stride = stride; slot->size = stride * count; slot->shift = slot->extra_flags = 0; - ctx->varying_height += ALIGN_POT(slot->size, 64); - assert(ctx->varying_height < ctx->varying_mem.bo->size); + struct panfrost_transfer transfer = + panfrost_allocate_transient(ctx, slot->size); + + slot->elements = transfer.gpu | MALI_ATTR_LINEAR; - return varying_address; + return transfer.gpu; } static void @@ -2531,7 +2527,6 @@ panfrost_destroy(struct pipe_context *pipe) util_blitter_destroy(panfrost->blitter_wallpaper); panfrost_drm_free_slab(screen, &panfrost->scratchpad); - panfrost_drm_free_slab(screen, &panfrost->varying_mem); panfrost_drm_free_slab(screen, &panfrost->shaders); panfrost_drm_free_slab(screen, &panfrost->tiler_heap); panfrost_drm_free_slab(screen, &panfrost->tiler_polygon_list); @@ -2678,7 +2673,6 @@ panfrost_setup_hardware(struct panfrost_context *ctx) struct panfrost_screen *screen = pan_screen(gallium->screen); panfrost_drm_allocate_slab(screen, &ctx->scratchpad, 64, false, 0, 0, 0); - panfrost_drm_allocate_slab(screen, &ctx->varying_mem, 16384, false, PAN_ALLOCATE_INVISIBLE | PAN_ALLOCATE_COHERENT_LOCAL, 0, 0); panfrost_drm_allocate_slab(screen, &ctx->shaders, 4096, true, PAN_ALLOCATE_EXECUTE, 0, 0); panfrost_drm_allocate_slab(screen, &ctx->tiler_heap, 32768, false, PAN_ALLOCATE_INVISIBLE | PAN_ALLOCATE_GROWABLE, 1, 128); panfrost_drm_allocate_slab(screen, &ctx->tiler_polygon_list, 128*128, false, PAN_ALLOCATE_INVISIBLE | PAN_ALLOCATE_GROWABLE, 1, 128); diff --git a/src/gallium/drivers/panfrost/pan_context.h b/src/gallium/drivers/panfrost/pan_context.h index b7c6bc51e46..097de158e09 100644 --- a/src/gallium/drivers/panfrost/pan_context.h +++ b/src/gallium/drivers/panfrost/pan_context.h @@ -107,7 +107,6 @@ struct panfrost_context { struct panfrost_memory shaders; struct panfrost_memory scratchpad; struct panfrost_memory tiler_heap; - struct panfrost_memory varying_mem; struct panfrost_memory tiler_polygon_list; struct panfrost_memory tiler_dummy; struct panfrost_memory depth_stencil_buffer; @@ -136,8 +135,6 @@ struct panfrost_context { union mali_attr attributes[PIPE_MAX_ATTRIBS]; - unsigned varying_height; - struct mali_single_framebuffer vt_framebuffer_sfbd; struct bifrost_framebuffer vt_framebuffer_mfbd; diff --git a/src/gallium/drivers/panfrost/pan_drm.c b/src/gallium/drivers/panfrost/pan_drm.c index 5bd2e340751..70051450cae 100644 --- a/src/gallium/drivers/panfrost/pan_drm.c +++ b/src/gallium/drivers/panfrost/pan_drm.c @@ -284,7 +284,6 @@ panfrost_drm_submit_vs_fs_job(struct panfrost_context *ctx, bool has_draws, bool panfrost_job_add_bo(job, ctx->shaders.bo); panfrost_job_add_bo(job, ctx->scratchpad.bo); panfrost_job_add_bo(job, ctx->tiler_heap.bo); - panfrost_job_add_bo(job, ctx->varying_mem.bo); panfrost_job_add_bo(job, ctx->tiler_polygon_list.bo); if (job->first_job.gpu) {