From patchwork Thu Oct 6 18:42:41 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: You-Sheng Yang X-Patchwork-Id: 1687154 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.ubuntu.com (client-ip=91.189.94.19; helo=huckleberry.canonical.com; envelope-from=kernel-team-bounces@lists.ubuntu.com; receiver=) Received: from huckleberry.canonical.com (huckleberry.canonical.com [91.189.94.19]) (using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4Mk1YJ5gTsz20Pd for ; Fri, 7 Oct 2022 06:22:43 +1100 (AEDT) Received: from localhost ([127.0.0.1] helo=huckleberry.canonical.com) by huckleberry.canonical.com with esmtp (Exim 4.86_2) (envelope-from ) id 1ogVqH-0006WT-4p; Thu, 06 Oct 2022 18:43:33 +0000 Received: from mail-pg1-f174.google.com ([209.85.215.174]) by huckleberry.canonical.com with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.86_2) (envelope-from ) id 1ogVqF-0006W4-56 for kernel-team@lists.ubuntu.com; Thu, 06 Oct 2022 18:43:31 +0000 Received: by mail-pg1-f174.google.com with SMTP id s206so2621871pgs.3 for ; Thu, 06 Oct 2022 11:43:30 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:x-gm-message-state:from:to:cc :subject:date; bh=OOogd4d53CJlpkFx9CPO03WF+rzGThW7gDgQUJ2Gyco=; b=Kf8PX6qX0s564yyk4nU8Ht+ValjmqSRwgOSDTn8hnDnbveWmyLEaWCHlsjIi94vN5m nNPR01ITIpQUkdfoejnqtEC4lzlDMBVnUBmZrJm9cxW06tzN8KEzmUkLJ+F3ct6NhVNg s8CegMoPr2Pd7OS1k/apAKBlZOVQgTF+vfPWN5j8vqPhpLjacgMCXbkWOcr29RsuYp+2 rVvQtertefxf00eriyFYTmEQKJuYlWefaKHgGTNPyr3NriXUL0tXfW6INumyWYCYMaVe 1W1nNhJ691n0YKJV5vBigmWPe50FyYqXrDthiityobWmsbjH42CQ4INjVieMp0PUns+l AgLg== X-Gm-Message-State: ACrzQf2L420xwAu0UXOZ6RKe+M6PBkv4g8kt+gFGNvfdPVXgBRoBv4+z kQe56jt371FMp9f5fan21WSUXlZ95h4= X-Google-Smtp-Source: AMsMyM6B6VeL2TkaMgHIje4u+2XTczopMWRyCITinl9Lsaw4RYAUfaVhfE3/lEhC70gsikZ0arN79w== X-Received: by 2002:a05:6a00:1706:b0:547:3e11:9160 with SMTP id h6-20020a056a00170600b005473e119160mr1004550pfc.79.1665081809117; Thu, 06 Oct 2022 11:43:29 -0700 (PDT) Received: from localhost.localdomain (61-227-97-62.dynamic-ip.hinet.net. [61.227.97.62]) by smtp.gmail.com with ESMTPSA id l19-20020a170902d35300b00176dd41320dsm12705940plk.119.2022.10.06.11.43.28 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 06 Oct 2022 11:43:28 -0700 (PDT) From: You-Sheng Yang To: kernel-team@lists.ubuntu.com Subject: [PATCH 1/5][SRU][OEM-5.14/Jammy] drm/amd/display: Fix for link encoder access for MST. Date: Fri, 7 Oct 2022 02:42:41 +0800 Message-Id: <20221006184245.891152-2-vicamo.yang@canonical.com> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20221006184245.891152-1-vicamo.yang@canonical.com> References: <20221006184245.891152-1-vicamo.yang@canonical.com> MIME-Version: 1.0 Received-SPF: pass client-ip=209.85.215.174; envelope-from=vicamo@gmail.com; helo=mail-pg1-f174.google.com X-BeenThere: kernel-team@lists.ubuntu.com X-Mailman-Version: 2.1.20 Precedence: list List-Id: Kernel team discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: kernel-team-bounces@lists.ubuntu.com Sender: "kernel-team" From: Meenakshikumar Somasundaram BugLink: https://bugs.launchpad.net/bugs/1991974 [Why] Link encoder in the link could be null for certain links. [How] If link encoder in the link is null then get the link encoder from the stream. Reviewed-by: Jun Lei Acked-by: Anson Jacob Signed-off-by: Meenakshikumar Somasundaram Tested-by: Daniel Wheeler Signed-off-by: Alex Deucher (cherry picked from commit e3ab29aa8c680f31ad1a53a0a1b3a54367dd473d) Signed-off-by: You-Sheng Yang (vicamo) --- drivers/gpu/drm/amd/display/dc/core/dc_link.c | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/drivers/gpu/drm/amd/display/dc/core/dc_link.c b/drivers/gpu/drm/amd/display/dc/core/dc_link.c index 7ce379d01612..c4860c2c73fd 100644 --- a/drivers/gpu/drm/amd/display/dc/core/dc_link.c +++ b/drivers/gpu/drm/amd/display/dc/core/dc_link.c @@ -3111,7 +3111,7 @@ enum dc_status dc_link_allocate_mst_payload(struct pipe_ctx *pipe_ctx) { struct dc_stream_state *stream = pipe_ctx->stream; struct dc_link *link = stream->link; - struct link_encoder *link_encoder = link->link_enc; + struct link_encoder *link_encoder = NULL; struct stream_encoder *stream_encoder = pipe_ctx->stream_res.stream_enc; struct dp_mst_stream_allocation_table proposed_table = {0}; struct fixed31_32 avg_time_slots_per_mtp; @@ -3121,6 +3121,13 @@ enum dc_status dc_link_allocate_mst_payload(struct pipe_ctx *pipe_ctx) enum act_return_status ret; DC_LOGGER_INIT(link->ctx->logger); + /* Link encoder may have been dynamically assigned to non-physical display endpoint. */ + if (link->ep_type == DISPLAY_ENDPOINT_PHY) + link_encoder = link->link_enc; + else if (link->dc->res_pool->funcs->link_encs_assign) + link_encoder = link_enc_cfg_get_link_enc_used_by_stream(pipe_ctx->stream->ctx->dc, stream); + ASSERT(link_encoder); + /* enable_link_dp_mst already check link->enabled_stream_count * and stream is in link->stream[]. This is called during set mode, * stream_enc is available. @@ -3212,7 +3219,7 @@ static enum dc_status deallocate_mst_payload(struct pipe_ctx *pipe_ctx) { struct dc_stream_state *stream = pipe_ctx->stream; struct dc_link *link = stream->link; - struct link_encoder *link_encoder = link->link_enc; + struct link_encoder *link_encoder = NULL; struct stream_encoder *stream_encoder = pipe_ctx->stream_res.stream_enc; struct dp_mst_stream_allocation_table proposed_table = {0}; struct fixed31_32 avg_time_slots_per_mtp = dc_fixpt_from_int(0); @@ -3220,6 +3227,13 @@ static enum dc_status deallocate_mst_payload(struct pipe_ctx *pipe_ctx) bool mst_mode = (link->type == dc_connection_mst_branch); DC_LOGGER_INIT(link->ctx->logger); + /* Link encoder may have been dynamically assigned to non-physical display endpoint. */ + if (link->ep_type == DISPLAY_ENDPOINT_PHY) + link_encoder = link->link_enc; + else if (link->dc->res_pool->funcs->link_encs_assign) + link_encoder = link_enc_cfg_get_link_enc_used_by_stream(pipe_ctx->stream->ctx->dc, stream); + ASSERT(link_encoder); + /* deallocate_mst_payload is called before disable link. When mode or * disable/enable monitor, new stream is created which is not in link * stream[] yet. For this, payload is not allocated yet, so de-alloc