diff options
author | Alvin Lee <Alvin.Lee2@amd.com> | 2022-08-11 23:24:19 -0400 |
---|---|---|
committer | Alex Deucher <alexander.deucher@amd.com> | 2022-08-25 13:34:40 -0400 |
commit | b68ea8af4ae005df5ca4f547f22b3824d0fcb3a4 (patch) | |
tree | 2217d542f7551c03a40cba92be1e9978f072ef64 /drivers/gpu/drm/amd/display | |
parent | e6cf22ef5fae493a99e162c3f2e7233448d2b970 (diff) | |
download | linux-b68ea8af4ae005df5ca4f547f22b3824d0fcb3a4.tar.gz linux-b68ea8af4ae005df5ca4f547f22b3824d0fcb3a4.tar.bz2 linux-b68ea8af4ae005df5ca4f547f22b3824d0fcb3a4.zip |
drm/amd/display: Free phantom plane and stream properly
[Description]
Refcount is incremented on allocation and
when adding to the context. Therefore we must
release the phantom plane and stream after
removing from the context.
Reviewed-by: Aric Cyr <Aric.Cyr@amd.com>
Acked-by: Brian Chang <Brian.Chang@amd.com>
Signed-off-by: Alvin Lee <Alvin.Lee2@amd.com>
Tested-by: Daniel Wheeler <daniel.wheeler@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
Diffstat (limited to 'drivers/gpu/drm/amd/display')
-rw-r--r-- | drivers/gpu/drm/amd/display/dc/dcn32/dcn32_resource.c | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/drivers/gpu/drm/amd/display/dc/dcn32/dcn32_resource.c b/drivers/gpu/drm/amd/display/dc/dcn32/dcn32_resource.c index d4fe7e97a0fc..ef0a6d468a10 100644 --- a/drivers/gpu/drm/amd/display/dc/dcn32/dcn32_resource.c +++ b/drivers/gpu/drm/amd/display/dc/dcn32/dcn32_resource.c @@ -1737,13 +1737,26 @@ bool dcn32_remove_phantom_pipes(struct dc *dc, struct dc_state *context) { int i; bool removed_pipe = false; + struct dc_plane_state *phantom_plane = NULL; + struct dc_stream_state *phantom_stream = NULL; for (i = 0; i < dc->res_pool->pipe_count; i++) { struct pipe_ctx *pipe = &context->res_ctx.pipe_ctx[i]; // build scaling params for phantom pipes if (pipe->plane_state && pipe->stream && pipe->stream->mall_stream_config.type == SUBVP_PHANTOM) { + phantom_plane = pipe->plane_state; + phantom_stream = pipe->stream; + dc_rem_all_planes_for_stream(dc, pipe->stream, context); dc_remove_stream_from_ctx(dc, context, pipe->stream); + + /* Ref count is incremented on allocation and also when added to the context. + * Therefore we must call release for the the phantom plane and stream once + * they are removed from the ctx to finally decrement the refcount to 0 to free. + */ + dc_plane_state_release(phantom_plane); + dc_stream_release(phantom_stream); + removed_pipe = true; } |