All the mail mirrored from lore.kernel.org
 help / color / mirror / Atom feed
From: <Roman.Li@amd.com>
To: <amd-gfx@lists.freedesktop.org>
Cc: <Harry.Wentland@amd.com>, <Sunpeng.Li@amd.com>,
	<Rodrigo.Siqueira@amd.com>, <Aurabindo.Pillai@amd.com>,
	<roman.li@amd.com>, <wayne.lin@amd.com>,
	<agustin.gutierrez@amd.com>, <chiahsuan.chung@amd.com>,
	<jerry.zuo@amd.com>, Chris Park <chris.park@amd.com>
Subject: [PATCH 12/24] drm/amd/display: Deallocate DML 2.1 Memory Allocation
Date: Thu, 16 May 2024 15:26:35 -0400	[thread overview]
Message-ID: <20240516192647.1522729-13-Roman.Li@amd.com> (raw)
In-Reply-To: <20240516192647.1522729-1-Roman.Li@amd.com>

From: Chris Park <chris.park@amd.com>

[Why]
DML 2.1 allocates two types of memory in its ctx structure but does not
destroy them, causing memory leak whenever DML 2.1 instance is created
and destroyed.

[How]
Deallocate two instances of allocated memory whenever DML 2.1 is
destroyed.

Reviewed-by: Rodrigo Siqueira <Rodrigo.Siqueira@amd.com>
Signed-off-by: Chris Park <chris.park@amd.com>
---
 drivers/gpu/drm/amd/display/dc/dml2/dml21/dml21_wrapper.c | 6 ++++++
 drivers/gpu/drm/amd/display/dc/dml2/dml21/dml21_wrapper.h | 1 +
 drivers/gpu/drm/amd/display/dc/dml2/dml2_wrapper.c        | 2 ++
 3 files changed, 9 insertions(+)

diff --git a/drivers/gpu/drm/amd/display/dc/dml2/dml21/dml21_wrapper.c b/drivers/gpu/drm/amd/display/dc/dml2/dml21/dml21_wrapper.c
index cb8b2d77a1ac..4e0b7d2d63b2 100644
--- a/drivers/gpu/drm/amd/display/dc/dml2/dml21/dml21_wrapper.c
+++ b/drivers/gpu/drm/amd/display/dc/dml2/dml21/dml21_wrapper.c
@@ -107,6 +107,12 @@ bool dml21_create(const struct dc *in_dc, struct dml2_context **dml_ctx, const s
 	return true;
 }
 
+void dml21_destroy(struct dml2_context *dml2)
+{
+	kfree(dml2->v21.dml_init.dml2_instance);
+	kfree(dml2->v21.mode_programming.programming);
+}
+
 static void dml21_calculate_rq_and_dlg_params(const struct dc *dc, struct dc_state *context, struct resource_context *out_new_hw_state,
 	struct dml2_context *in_ctx, unsigned int pipe_cnt)
 {
diff --git a/drivers/gpu/drm/amd/display/dc/dml2/dml21/dml21_wrapper.h b/drivers/gpu/drm/amd/display/dc/dml2/dml21/dml21_wrapper.h
index 6708f7117fbd..b2075b8c363b 100644
--- a/drivers/gpu/drm/amd/display/dc/dml2/dml21/dml21_wrapper.h
+++ b/drivers/gpu/drm/amd/display/dc/dml2/dml21/dml21_wrapper.h
@@ -27,6 +27,7 @@ struct dml2_context;
  * Return: True if dml2 is successfully created, false otherwise.
  */
 bool dml21_create(const struct dc *in_dc, struct dml2_context **dml_ctx, const struct dml2_configuration_options *config);
+void dml21_destroy(struct dml2_context *dml2);
 void dml21_copy(struct dml2_context *dst_dml_ctx,
 	struct dml2_context *src_dml_ctx);
 bool dml21_create_copy(struct dml2_context **dst_dml_ctx,
diff --git a/drivers/gpu/drm/amd/display/dc/dml2/dml2_wrapper.c b/drivers/gpu/drm/amd/display/dc/dml2/dml2_wrapper.c
index 4be304ebf0b4..22f6a59d8ed2 100644
--- a/drivers/gpu/drm/amd/display/dc/dml2/dml2_wrapper.c
+++ b/drivers/gpu/drm/amd/display/dc/dml2/dml2_wrapper.c
@@ -782,6 +782,8 @@ void dml2_destroy(struct dml2_context *dml2)
 	if (!dml2)
 		return;
 
+	if (dml2->architecture == dml2_architecture_21)
+		dml21_destroy(dml2);
 	kfree(dml2);
 }
 
-- 
2.34.1


  parent reply	other threads:[~2024-05-16 19:27 UTC|newest]

Thread overview: 26+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-05-16 19:26 [PATCH 00/24] DC Patches May 16, 2024 Roman.Li
2024-05-16 19:26 ` [PATCH 01/24] drm/amd/display: Move DSC functions from dc.c to dc_dsc.c Roman.Li
2024-05-16 19:26 ` [PATCH 02/24] drm/amd/display: Remove duplicate configuration Roman.Li
2024-05-16 19:26 ` [PATCH 03/24] drm/amd/display: Add missing enable and disable symclk_se functions for dcn401 Roman.Li
2024-05-16 19:26 ` [PATCH 04/24] drm/amd/display: Fix incorrect DCN401 comparison Roman.Li
2024-05-16 19:26 ` [PATCH 05/24] drm/amd/display: Use the correct TMDS function to avoid DVI issues Roman.Li
2024-05-16 19:26 ` [PATCH 06/24] drm/amd/display: Adjust incorrect indentations and spaces Roman.Li
2024-05-16 19:26 ` [PATCH 07/24] drm/amd/display: enable EASF support for DCN40 Roman.Li
2024-05-16 19:26 ` [PATCH 08/24] drm/amd/display: Refactor HUBBUB into component folder for DCN401 Roman.Li
2024-05-16 19:26 ` [PATCH 09/24] drm/amd/display: Modify HPO pixel clock programming to support DPM Roman.Li
2024-05-16 19:26 ` [PATCH 10/24] drm/amd/display: Add missing DML2 var helpers Roman.Li
2024-05-16 19:26 ` [PATCH 11/24] drm/amd/display: Add NULL check within get_target_mpc_factor Roman.Li
2024-05-16 19:26 ` Roman.Li [this message]
2024-05-16 19:26 ` [PATCH 13/24] drm/amd/display: Add 3DLUT DMA load trigger Roman.Li
2024-05-16 19:26 ` [PATCH 14/24] drm/amd/display: Clear shared dmub firmware state on init Roman.Li
2024-05-16 19:26 ` [PATCH 15/24] drm/amd/display: Add ips status info to debugfs Roman.Li
2024-05-16 19:26 ` [PATCH 16/24] drm/amd/display: Fix pipe addition logic in calc_blocks_to_ungate DCN35 Roman.Li
2024-05-16 19:26 ` [PATCH 17/24] drm/amd/display: Remove redundant idle optimization check Roman.Li
2024-05-16 19:26 ` [PATCH 18/24] drm/amd/display: fix a typo which causes an incorrect ODM combine setup Roman.Li
2024-05-16 19:26 ` [PATCH 19/24] drm/amd/display: Fix ODM + underscan case with cursor Roman.Li
2024-05-16 19:26 ` [PATCH 20/24] drm/amd/display: Disable DCN401 idle optimizations Roman.Li
2024-05-16 19:26 ` [PATCH 21/24] drm/amd/display: Correct display clocks update block sequence Roman.Li
2024-05-16 19:26 ` [PATCH 22/24] drm/amd/display: Not fallback if link BW is smaller than req BW Roman.Li
2024-05-16 19:26 ` [PATCH 23/24] drm/amd/display: Fix POWERPC_64 compilation Roman.Li
2024-05-16 19:33   ` Aurabindo Pillai
2024-05-16 19:26 ` [PATCH 24/24] drm/amd/display: 3.2.286 Roman.Li

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20240516192647.1522729-13-Roman.Li@amd.com \
    --to=roman.li@amd.com \
    --cc=Aurabindo.Pillai@amd.com \
    --cc=Harry.Wentland@amd.com \
    --cc=Rodrigo.Siqueira@amd.com \
    --cc=Sunpeng.Li@amd.com \
    --cc=agustin.gutierrez@amd.com \
    --cc=amd-gfx@lists.freedesktop.org \
    --cc=chiahsuan.chung@amd.com \
    --cc=chris.park@amd.com \
    --cc=jerry.zuo@amd.com \
    --cc=wayne.lin@amd.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.