Received: by 2002:a05:7412:b101:b0:e2:908c:2ebd with SMTP id az1csp2749883rdb; Wed, 15 Nov 2023 09:24:04 -0800 (PST) X-Google-Smtp-Source: AGHT+IHphgs11Yh0x+anIVzskrCotOdtBlX9aj2BK9QOi7CfgGRjk1paDrdIhRvlxY2t8LiR/R+W X-Received: by 2002:a05:6a21:78aa:b0:186:7842:ad0c with SMTP id bf42-20020a056a2178aa00b001867842ad0cmr2421166pzc.35.1700069044606; Wed, 15 Nov 2023 09:24:04 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1700069044; cv=none; d=google.com; s=arc-20160816; b=kcQ75dDZLFk+r0W75JADf9FUf6EBNMAWz06Eyoqblco+nPbxOC60vg9nxolyCGlHSZ ucfwlQ6NHh5vwnk4vVlD9fULmhS1NTF/XJN3kREbzc5QwLD+jaA5q6g04CKNFGFjCoNr rjaPg4uoxPcV6eRJ47gNUJmG/mtGXj4xNnsmxasQBMyiGuCOxAmWTTYTKtxSIuuWeCrc Eyg/5ZNKyecd0loRvwYT4uxeHaQcPdvtE6WSeYEpbnCXPGohGKFLXUVPP9lPl8MV+kK7 GYGeJ+1B5zCd6ZRBHrCGTzbTqaOSQBx+tm2eJ7NYcDQ8HnKH/PHqXPhOTm7Tt7QNK+FO 5z3g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date; bh=nUhoi10pEEaa5yFj4gI30jWV6YIV8uPWy8wBnka5A0M=; fh=d233QomGRDZC7SmBwZAlHxQmzhAUOa1CAw4gn3yo8o4=; b=cf/aUna1WG9eZyGYU18KVQ+XIphUhtxr635AYOV6HvHCstE1eJ3m3tDdtpsq9Suk40 3PIjfJazY+SUTpVTEyuBGfC960J9NCiVuQEwlZb0smL2gsE3pkSN8FCDjsAKb0T2HTGt SQFp2isHqYSCVIiT817HH4NR47wSmuSbIOQ9ksheyz2Y/2Kzilfbil5PeptmnCk397pG VBH3Yh72OyMww0KJ+RL5N9oYikeKL4LLh/HIjN5+DGwadl2TP29rnrlOFvv0iBDzS+Xx 5qzNpJaXlS9GuCGQojiNTU0j6kj6a2JUYyt2ijCIBsF5CXtEYlChy0pilrBwOvKBW+F+ Vf8A== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from snail.vger.email (snail.vger.email. [23.128.96.37]) by mx.google.com with ESMTPS id r185-20020a632bc2000000b005c1ce3c9609si1816753pgr.889.2023.11.15.09.24.04 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 15 Nov 2023 09:24:04 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 as permitted sender) client-ip=23.128.96.37; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by snail.vger.email (Postfix) with ESMTP id 6160E821A15A; Wed, 15 Nov 2023 09:24:03 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at snail.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232535AbjKORX7 (ORCPT + 99 others); Wed, 15 Nov 2023 12:23:59 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53958 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232555AbjKORX6 (ORCPT ); Wed, 15 Nov 2023 12:23:58 -0500 Received: from relay05.th.seeweb.it (relay05.th.seeweb.it [5.144.164.166]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7DABC18E; Wed, 15 Nov 2023 09:23:52 -0800 (PST) Received: from SoMainline.org (94-211-6-86.cable.dynamic.v4.ziggo.nl [94.211.6.86]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (P-256) server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by m-r2.th.seeweb.it (Postfix) with ESMTPSA id 09CA93F8F8; Wed, 15 Nov 2023 18:23:47 +0100 (CET) Date: Wed, 15 Nov 2023 18:23:46 +0100 From: Marijn Suijten To: Jonathan Marek Cc: freedreno@lists.freedesktop.org, Rob Clark , Abhinav Kumar , Dmitry Baryshkov , Sean Paul , David Airlie , Daniel Vetter , Jessica Zhang , Konrad Dybcio , Jiasheng Jiang , Doug Anderson , "open list:DRM DRIVER FOR MSM ADRENO GPU" , "open list:DRM DRIVER FOR MSM ADRENO GPU" , open list Subject: Re: [PATCH 4/4] drm/msm/dsi: fix DSC for the bonded DSI case Message-ID: <74ou4xly7pjnsqbavvt2iuonvpgioznriq2vgbccprn5uagkhm@ntq6sq7ywelv> References: <20231114174218.19765-1-jonathan@marek.ca> <20231114174218.19765-4-jonathan@marek.ca> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_BLOCKED,SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (snail.vger.email [0.0.0.0]); Wed, 15 Nov 2023 09:24:03 -0800 (PST) On 2023-11-14 14:00:19, Jonathan Marek wrote: > On 11/14/23 1:28 PM, Marijn Suijten wrote: > > On what hardware have you been testing this? Dmitry and I have a stack of > > patches to resolve support for Active CTL programming on newer hardware (DPU > > 5.0+ IIRC), where a single CTL is responsible for programming multiple INTF and > > DSC blocks as used in bonded DSI. > > > > I am also using DPU 6+ but I won't be posting patches for DPU to support > this as I am not using the upstream DPU codebase. Oh that is an odd situation! At least glad to hear we aren't completely duplicating our efforts :) > > On 2023-11-14 12:42:16, Jonathan Marek wrote: > >> For the bonded DSI case, DSC pic_width and timing calculations should use > >> the width of a single panel instead of the total combined width. > >> > >> Signed-off-by: Jonathan Marek > >> --- > >> drivers/gpu/drm/msm/dsi/dsi.h | 3 ++- > >> drivers/gpu/drm/msm/dsi/dsi_host.c | 20 +++++++++++--------- > >> drivers/gpu/drm/msm/dsi/dsi_manager.c | 2 +- > >> 3 files changed, 14 insertions(+), 11 deletions(-) > >> > >> diff --git a/drivers/gpu/drm/msm/dsi/dsi.h b/drivers/gpu/drm/msm/dsi/dsi.h > >> index 28379b1af63f..3a641e69447c 100644 > >> --- a/drivers/gpu/drm/msm/dsi/dsi.h > >> +++ b/drivers/gpu/drm/msm/dsi/dsi.h > >> @@ -93,7 +93,8 @@ int msm_dsi_host_power_off(struct mipi_dsi_host *host); > >> int msm_dsi_host_set_display_mode(struct mipi_dsi_host *host, > >> const struct drm_display_mode *mode); > >> enum drm_mode_status msm_dsi_host_check_dsc(struct mipi_dsi_host *host, > >> - const struct drm_display_mode *mode); > >> + const struct drm_display_mode *mode, > >> + bool is_bonded_dsi); > >> unsigned long msm_dsi_host_get_mode_flags(struct mipi_dsi_host *host); > >> int msm_dsi_host_register(struct mipi_dsi_host *host); > >> void msm_dsi_host_unregister(struct mipi_dsi_host *host); > >> diff --git a/drivers/gpu/drm/msm/dsi/dsi_host.c b/drivers/gpu/drm/msm/dsi/dsi_host.c > >> index 7284346ab787..a6286eb9d006 100644 > >> --- a/drivers/gpu/drm/msm/dsi/dsi_host.c > >> +++ b/drivers/gpu/drm/msm/dsi/dsi_host.c > >> @@ -938,8 +938,7 @@ static void dsi_timing_setup(struct msm_dsi_host *msm_host, bool is_bonded_dsi) > >> mode->hdisplay, mode->vdisplay); > >> return; > >> } > >> - > >> - dsc->pic_width = mode->hdisplay; > >> + dsc->pic_width = hdisplay; > > > > In my testing and debugging on CMDmode panels downstream this value/register > > was always programmed to the _full_ width of the bonded panel. Is that maybe > > different for video mode? > > > > downstream dual DSI panel timings are specified for a single panel > ("qcom,mdss-dsi-panel-width" is for a single panel, not both panels) _dual panels_? In my case I have a "single panel" that is driven by two "bonded" DSI hosts, just to achieve enough bandwidth. Indeed my downstream DTS has qcom,mdss-dsi-panel-width set to half the total panel width, but I recall seeing the full width in the register dump. I'll scan through my logs and see if I can back this up. > >> dsc->pic_height = mode->vdisplay; > >> DBG("Mode %dx%d\n", dsc->pic_width, dsc->pic_height); > >> > >> @@ -950,6 +949,11 @@ static void dsi_timing_setup(struct msm_dsi_host *msm_host, bool is_bonded_dsi) > >> if (ret) > >> return; > >> > >> + if (msm_host->mode_flags & MIPI_DSI_MODE_VIDEO) > >> + dsi_update_dsc_timing(msm_host, false, hdisplay); > >> + else > >> + dsi_update_dsc_timing(msm_host, true, hdisplay); Another thought: it's probably clearer to write: bool is_cmd_mode = msm_host->mode_flags & MIPI_DSI_MODE_VIDEO; dsi_update_dsc_timing(msm_host, is_cmd_mode, hdisplay); > >> + > > > > Such cleanups (which appear unrelated) should probably be posted as separate > > patches. > > > > - Marijn > > > > Its not unrelated, dsi_update_dsc_timing call is moved up so it can use > the single-panel "hdisplay" value before it gets adjusted for DSC. This reply was mostly expected after not looking at the original code folded in the diff, and pretty much solidifies my point: it's a hidden semantical change that's not immediately obvious from reading the patch, and why I'd like to see this split up in a few smaller patches. > >> /* Divide the display by 3 but keep back/font porch and > >> * pulse width same > >> */ > >> @@ -966,9 +970,6 @@ static void dsi_timing_setup(struct msm_dsi_host *msm_host, bool is_bonded_dsi) > >> } > >> > >> if (msm_host->mode_flags & MIPI_DSI_MODE_VIDEO) { > >> - if (msm_host->dsc) > >> - dsi_update_dsc_timing(msm_host, false, mode->hdisplay); > >> - > >> dsi_write(msm_host, REG_DSI_ACTIVE_H, > >> DSI_ACTIVE_H_START(ha_start) | > >> DSI_ACTIVE_H_END(ha_end)); > >> @@ -987,9 +988,6 @@ static void dsi_timing_setup(struct msm_dsi_host *msm_host, bool is_bonded_dsi) > >> DSI_ACTIVE_VSYNC_VPOS_START(vs_start) | > >> DSI_ACTIVE_VSYNC_VPOS_END(vs_end)); > >> } else { /* command mode */ > >> - if (msm_host->dsc) > >> - dsi_update_dsc_timing(msm_host, true, mode->hdisplay); > >> - > >> /* image data and 1 byte write_memory_start cmd */ > >> if (!msm_host->dsc) > >> wc = hdisplay * dsi_get_bpp(msm_host->format) / 8 + 1; Regarding another patch: cmdmode calculates and uses word count here, but video mode does it as part of timing calculations? - Marijn > >> @@ -2487,7 +2485,8 @@ int msm_dsi_host_set_display_mode(struct mipi_dsi_host *host, > >> } > >> > >> enum drm_mode_status msm_dsi_host_check_dsc(struct mipi_dsi_host *host, > >> - const struct drm_display_mode *mode) > >> + const struct drm_display_mode *mode, > >> + bool is_bonded_dsi) > >> { > >> struct msm_dsi_host *msm_host = to_msm_dsi_host(host); > >> struct drm_dsc_config *dsc = msm_host->dsc; > >> @@ -2497,6 +2496,9 @@ enum drm_mode_status msm_dsi_host_check_dsc(struct mipi_dsi_host *host, > >> if (!msm_host->dsc) > >> return MODE_OK; > >> > >> + if (is_bonded_dsi) > >> + pic_width = mode->hdisplay / 2; > >> + > >> if (pic_width % dsc->slice_width) { > >> pr_err("DSI: pic_width %d has to be multiple of slice %d\n", > >> pic_width, dsc->slice_width); > >> diff --git a/drivers/gpu/drm/msm/dsi/dsi_manager.c b/drivers/gpu/drm/msm/dsi/dsi_manager.c > >> index 896f369fdd53..2ca1a7ca3659 100644 > >> --- a/drivers/gpu/drm/msm/dsi/dsi_manager.c > >> +++ b/drivers/gpu/drm/msm/dsi/dsi_manager.c > >> @@ -455,7 +455,7 @@ static enum drm_mode_status dsi_mgr_bridge_mode_valid(struct drm_bridge *bridge, > >> return MODE_ERROR; > >> } > >> > >> - return msm_dsi_host_check_dsc(host, mode); > >> + return msm_dsi_host_check_dsc(host, mode, IS_BONDED_DSI()); > >> } > >> > >> static const struct drm_bridge_funcs dsi_mgr_bridge_funcs = { > >> -- > >> 2.26.1 > >>