From: Wenjing Liu Date: Mon, 11 Sep 2023 21:28:26 +0000 (-0400) Subject: drm/amd/display: add get primary dpp pipe resource interface X-Git-Tag: io_uring-6.7-2023-11-10~63^2~10^2~237 X-Git-Url: https://git.kernel.dk/?a=commitdiff_plain;h=173db0c8b7664892fee343e5a605197962fc3ca8;p=linux-block.git drm/amd/display: add get primary dpp pipe resource interface [why] Need to have a helper function to find the primary dp pipe of the plane associated with a dpp pipe Reviewed-by: Dillon Varone Acked-by: Wayne Lin Signed-off-by: Wenjing Liu Tested-by: Daniel Wheeler Signed-off-by: Alex Deucher --- diff --git a/drivers/gpu/drm/amd/display/dc/core/dc_resource.c b/drivers/gpu/drm/amd/display/dc/core/dc_resource.c index 8a8f8560605a..5a6f458b2942 100644 --- a/drivers/gpu/drm/amd/display/dc/core/dc_resource.c +++ b/drivers/gpu/drm/amd/display/dc/core/dc_resource.c @@ -1807,6 +1807,20 @@ struct pipe_ctx *resource_get_opp_head(const struct pipe_ctx *pipe_ctx) return opp_head; } +struct pipe_ctx *resource_get_primary_dpp_pipe(const struct pipe_ctx *dpp_pipe) +{ + struct pipe_ctx *pri_dpp_pipe = (struct pipe_ctx *) dpp_pipe; + + ASSERT(resource_is_pipe_type(dpp_pipe, DPP_PIPE)); + while (pri_dpp_pipe->prev_odm_pipe) + pri_dpp_pipe = pri_dpp_pipe->prev_odm_pipe; + while (pri_dpp_pipe->top_pipe && + pri_dpp_pipe->top_pipe->plane_state == pri_dpp_pipe->plane_state) + pri_dpp_pipe = pri_dpp_pipe->top_pipe; + return pri_dpp_pipe; +} + + int resource_get_mpc_slice_index(const struct pipe_ctx *pipe_ctx) { struct pipe_ctx *split_pipe = pipe_ctx->top_pipe; diff --git a/drivers/gpu/drm/amd/display/dc/inc/resource.h b/drivers/gpu/drm/amd/display/dc/inc/resource.h index 6777b07d0727..170d6ab81aef 100644 --- a/drivers/gpu/drm/amd/display/dc/inc/resource.h +++ b/drivers/gpu/drm/amd/display/dc/inc/resource.h @@ -409,6 +409,12 @@ struct pipe_ctx *resource_get_otg_master(const struct pipe_ctx *pipe_ctx); */ struct pipe_ctx *resource_get_opp_head(const struct pipe_ctx *pipe_ctx); +/* + * Get the DPP pipe allocated for MPC slice 0 and ODM slice 0 of the plane + * associated with dpp_pipe. + */ +struct pipe_ctx *resource_get_primary_dpp_pipe(const struct pipe_ctx *dpp_pipe); + /* * Get the MPC slice index counting from 0 from left most slice * For example, if a DPP pipe is used as a secondary pipe in MPCC combine, MPC