[6/8] panfrost: Free context BOs

Submitted by Tomeu Vizoso on March 4, 2019, 4:11 p.m.

Details

Message ID 20190304161144.52910-7-tomeu.vizoso@collabora.com
State New
Headers show
Series "Series without cover letter" ( rev: 1 ) in Mesa

Not browsing as part of any series.

Commit Message

Tomeu Vizoso March 4, 2019, 4:11 p.m.
Signed-off-by: Tomeu Vizoso <tomeu.vizoso@collabora.com>
---
 src/gallium/drivers/panfrost/pan_context.c | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)

Patch hide | download patch | download mbox

diff --git a/src/gallium/drivers/panfrost/pan_context.c b/src/gallium/drivers/panfrost/pan_context.c
index 776469c3e411..ac58411b265d 100644
--- a/src/gallium/drivers/panfrost/pan_context.c
+++ b/src/gallium/drivers/panfrost/pan_context.c
@@ -606,7 +606,7 @@  static void
 panfrost_invalidate_frame(struct panfrost_context *ctx)
 {
         unsigned transient_count = ctx->transient_pools[ctx->cmdstream_i].entry_index*ctx->transient_pools[0].entry_size + ctx->transient_pools[ctx->cmdstream_i].entry_offset;
-	printf("Uploaded transient %d bytes\n", transient_count);
+	//printf("Uploaded transient %d bytes\n", transient_count);
 
         /* Rotate cmdstream */
         if ((++ctx->cmdstream_i) == (sizeof(ctx->transient_pools) / sizeof(ctx->transient_pools[0])))
@@ -2594,9 +2594,16 @@  static void
 panfrost_destroy(struct pipe_context *pipe)
 {
         struct panfrost_context *panfrost = pan_context(pipe);
+        struct panfrost_screen *screen = pan_screen(pipe->screen);
 
         if (panfrost->blitter)
                 util_blitter_destroy(panfrost->blitter);
+
+        screen->driver->free_slab(screen, &panfrost->scratchpad);
+        screen->driver->free_slab(screen, &panfrost->varying_mem);
+        screen->driver->free_slab(screen, &panfrost->shaders);
+        screen->driver->free_slab(screen, &panfrost->tiler_heap);
+        screen->driver->free_slab(screen, &panfrost->misc_0);
 }
 
 static struct pipe_query *

Comments

>          unsigned transient_count = ctx->transient_pools[ctx->cmdstream_i].entry_index*ctx->transient_pools[0].entry_size + ctx->transient_pools[ctx->cmdstream_i].entry_offset;
> -	printf("Uploaded transient %d bytes\n", transient_count);
> +	//printf("Uploaded transient %d bytes\n", transient_count);

This will raised an unused variable warning for transient_count, better
comment both or neither.

Other than that, Reviewed-by: Alyssa Rosenzweig <alyssa@rosenzweig.io>

I wonder if this will fix some of the memory leaks on non-DRM as well.
On Mon, Mar 4, 2019 at 1:38 PM Alyssa Rosenzweig <alyssa@rosenzweig.io> wrote:
>
> >          unsigned transient_count = ctx->transient_pools[ctx->cmdstream_i].entry_index*ctx->transient_pools[0].entry_size + ctx->transient_pools[ctx->cmdstream_i].entry_offset;
> > -     printf("Uploaded transient %d bytes\n", transient_count);
> > +     //printf("Uploaded transient %d bytes\n", transient_count);
>
> This will raised an unused variable warning for transient_count, better
> comment both or neither.

Better yet, use a debug print so it can be enabled via an env var. Or
if it's not that useful, just remove it.

>
> Other than that, Reviewed-by: Alyssa Rosenzweig <alyssa@rosenzweig.io>
>
> I wonder if this will fix some of the memory leaks on non-DRM as well.
On 3/4/19 8:52 PM, Rob Herring wrote:
> On Mon, Mar 4, 2019 at 1:38 PM Alyssa Rosenzweig <alyssa@rosenzweig.io> wrote:
>>
>>>           unsigned transient_count = ctx->transient_pools[ctx->cmdstream_i].entry_index*ctx->transient_pools[0].entry_size + ctx->transient_pools[ctx->cmdstream_i].entry_offset;
>>> -     printf("Uploaded transient %d bytes\n", transient_count);
>>> +     //printf("Uploaded transient %d bytes\n", transient_count);

Sorry, this change slipped into this patch.

>> This will raised an unused variable warning for transient_count, better
>> comment both or neither.
> 
> Better yet, use a debug print so it can be enabled via an env var. Or
> if it's not that useful, just remove it.

Yeah, I couldn't tell because I don't really know what's the purpose of 
this printf.

>>
>> Other than that, Reviewed-by: Alyssa Rosenzweig <alyssa@rosenzweig.io>
>>
>> I wonder if this will fix some of the memory leaks on non-DRM as well.

I think it should, though it may not be that acute because of some lazy 
allocations that I think kbase does?

Cheers,

Tomeu