From patchwork Thu Aug 29 10:17:30 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jun Nie X-Patchwork-Id: 13782980 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id D9E58C83030 for ; Thu, 29 Aug 2024 10:19:17 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 5A26910E47D; Thu, 29 Aug 2024 10:19:17 +0000 (UTC) Authentication-Results: gabe.freedesktop.org; dkim=pass (2048-bit key; unprotected) header.d=linaro.org header.i=@linaro.org header.b="KtnZNMhj"; dkim-atps=neutral Received: from mail-pf1-f178.google.com (mail-pf1-f178.google.com [209.85.210.178]) by gabe.freedesktop.org (Postfix) with ESMTPS id B2BB510E47F for ; Thu, 29 Aug 2024 10:19:15 +0000 (UTC) Received: by mail-pf1-f178.google.com with SMTP id d2e1a72fcca58-7142a30e3bdso1209651b3a.0 for ; Thu, 29 Aug 2024 03:19:15 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1724926755; x=1725531555; darn=lists.freedesktop.org; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=pm46gM0TTBbBdMjovlXNb5pnDJgcjv/io30h+9vcb2w=; b=KtnZNMhj5i4J4S9edb+MyKQWxCqN2jCOiIhAr5m0QjLVWUpGSFnAsbgIYzBzP2Fvt4 Vf5b52Cka0Wax2ifPdrHsw6U/5JjW5q0yFxMy9zJ/OYFgQJK0WrJOHP+2VpT1Cuu/MS6 a24p2sSnKRuHRCStaUKAkqCdSuvjB9YTXSgvN4B8eFxqJ5pf1uHPYXsSld0Zq4glLs3e fuaQyZR4ujmjT0pX851NyTlQoZhJ/VIf3k6t5gkLWBLptoqYq49La5ZP0b6AaExlL/r3 HI9wHnXiCQI228DZDqrBW+5/SeRLqqa0LsfVGSGbfpfh0UVfYUP10wQqRJ9ZfBhV4VOf v/2w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1724926755; x=1725531555; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=pm46gM0TTBbBdMjovlXNb5pnDJgcjv/io30h+9vcb2w=; b=JOknBQvskl0NkIa0NKdxOm9LVpLROuB0aBKfK6vjV1Pf4F6vd40+gY3EAScf4aK6zn VTY0GtIpR4BITM2g2i0dqup4kmtG0u2Ul+DZ2YmI6gxyn6NX+rHC/KlOd63iwmTtLLMl J6lGTdAqyo5g0JbN8Fv12T1BbEBs0SL9SO3eqUgBQrH4aca7dZHw+/DK6zevKn9U/jaT EDVN/i0sSqJiN9BgFyh9kWI1euxyticUD0921RHYtrGbpUpdWQcU0xUKn32eJeQqLtW2 K8N/fQBLdWZt5/eXmmemt/2hn8tdv3kdIix1yF5uwIDMVWNtkoJbXIskEIm+QQTjSLex 6CLQ== X-Forwarded-Encrypted: i=1; AJvYcCVcQuS4n3MF4Zx4K6Ss9EJWUO8x1a/c98z+EUPY4ioC58p1uX2R3MRAWoVEEg31yqOsc+RRcNPfZY4=@lists.freedesktop.org X-Gm-Message-State: AOJu0Ywq1LvtR5QTBB5ALTBo4Z3NvhT3IWcwkexEmzgWLeptTX/U0MSH /otSbyeWGNwHktENvF1/fJ+V3E2lTzybVGEXpQ3A/mdKsGseNXG7R2J8zZMmrWs= X-Google-Smtp-Source: AGHT+IFIi/GI1xiHx4ikkWEaDUD/O7jnJJ9faqHg9EcKdEHEXIo+BEOFueQ/+R9j5m2bXWlUa+kVtA== X-Received: by 2002:a05:6a21:458b:b0:1c4:85a2:9958 with SMTP id adf61e73a8af0-1cce58672eamr1524199637.25.1724926755196; Thu, 29 Aug 2024 03:19:15 -0700 (PDT) Received: from [127.0.1.1] ([112.65.12.167]) by smtp.gmail.com with ESMTPSA id 41be03b00d2f7-7d22e9d4df4sm891684a12.82.2024.08.29.03.19.06 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 29 Aug 2024 03:19:14 -0700 (PDT) From: Jun Nie Date: Thu, 29 Aug 2024 18:17:30 +0800 Subject: [PATCH 01/21] drm/msm/dsi: add support to DSI CTRL v2.8.0 MIME-Version: 1.0 Message-Id: <20240829-sm8650-v6-11-hmd-pocf-mdss-quad-upstream-8-v1-1-bdb05b4b5a2e@linaro.org> References: <20240829-sm8650-v6-11-hmd-pocf-mdss-quad-upstream-8-v1-0-bdb05b4b5a2e@linaro.org> In-Reply-To: <20240829-sm8650-v6-11-hmd-pocf-mdss-quad-upstream-8-v1-0-bdb05b4b5a2e@linaro.org> To: Rob Clark , Abhinav Kumar , Dmitry Baryshkov , Sean Paul , Marijn Suijten , David Airlie , Daniel Vetter , Maarten Lankhorst , Maxime Ripard , Thomas Zimmermann Cc: linux-arm-msm@vger.kernel.org, dri-devel@lists.freedesktop.org, freedreno@lists.freedesktop.org, linux-kernel@vger.kernel.org, Jun Nie , Jonathan Marek X-Mailer: b4 0.13.0 X-Developer-Signature: v=1; a=ed25519-sha256; t=1724926736; l=1217; i=jun.nie@linaro.org; s=20240403; h=from:subject:message-id; bh=C1k3RPwM6WNScuAGLeEJNZ/C8SUXvF2SN04fTyxqBC4=; b=IL2p1n//a/cGjDAbXalP8f4Wm6zhrPhNJ5sIDGMkYy4qtn/Aw3KFCQjztAspCIV9D1mB87nyE sNLBBVEeWJmDVH9l6gal907ZbTHPctNj7XlZo4S7aFE/u3f8VHrLul4 X-Developer-Key: i=jun.nie@linaro.org; a=ed25519; pk=MNiBt/faLPvo+iJoP1hodyY2x6ozVXL8QMptmsKg3cc= X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" From: Jonathan Marek Add support to DSI CTRL v2.8.0 with priority support Signed-off-by: Jun Nie --- drivers/gpu/drm/msm/dsi/dsi_host.c | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/drivers/gpu/drm/msm/dsi/dsi_host.c b/drivers/gpu/drm/msm/dsi/dsi_host.c index 185d7de0bf376..6388bb12696ff 100644 --- a/drivers/gpu/drm/msm/dsi/dsi_host.c +++ b/drivers/gpu/drm/msm/dsi/dsi_host.c @@ -2238,13 +2238,23 @@ int msm_dsi_host_cmd_rx(struct mipi_dsi_host *host, return ret; } +#define DSI_VBIF_CTRL (0x01CC - 4) +#define DSI_VBIF_CTRL_PRIORITY 0x07 + void msm_dsi_host_cmd_xfer_commit(struct mipi_dsi_host *host, u32 dma_base, u32 len) { struct msm_dsi_host *msm_host = to_msm_dsi_host(host); + const struct msm_dsi_cfg_handler *cfg_hnd = msm_host->cfg_hnd; + u32 reg; dsi_write(msm_host, REG_DSI_DMA_BASE, dma_base); dsi_write(msm_host, REG_DSI_DMA_LEN, len); + if (cfg_hnd->minor >= MSM_DSI_6G_VER_MINOR_V2_8_0) { + reg = dsi_read(msm_host, DSI_VBIF_CTRL); + reg |= (DSI_VBIF_CTRL_PRIORITY & 0x7); + dsi_write(msm_host, DSI_VBIF_CTRL, reg); + } dsi_write(msm_host, REG_DSI_TRIG_DMA, 1); /* Make sure trigger happens */ From patchwork Thu Aug 29 10:17:31 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jun Nie X-Patchwork-Id: 13782981 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 2D946C8302B for ; Thu, 29 Aug 2024 10:19:26 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 9C4DE10E4DB; Thu, 29 Aug 2024 10:19:25 +0000 (UTC) Authentication-Results: gabe.freedesktop.org; dkim=pass (2048-bit key; unprotected) header.d=linaro.org header.i=@linaro.org header.b="KW9tSQsm"; dkim-atps=neutral Received: from mail-pf1-f175.google.com (mail-pf1-f175.google.com [209.85.210.175]) by gabe.freedesktop.org (Postfix) with ESMTPS id C628410E4DB for ; Thu, 29 Aug 2024 10:19:23 +0000 (UTC) Received: by mail-pf1-f175.google.com with SMTP id d2e1a72fcca58-71423273c62so403644b3a.0 for ; Thu, 29 Aug 2024 03:19:23 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1724926763; x=1725531563; darn=lists.freedesktop.org; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=liJfUzuPiz+x1OeGHXt2r3UO2uLGH4OphxjUtIXOwkw=; b=KW9tSQsm5f3kpFxrVaBMltnzzmGkLG8DJ5UP9ocsd/ObmrHx+SI/pVWH39G7tkqmlD H47XaIuda0+2KD1/zLQYquAkbkSc7OAdxpnjToQvxrC+0lprMe0MjUug8xYfIQmp7k5f lL4t/KZUL2PYQGr773L3cF/PxeyrZW06b4dAHo8UfosGmepKrDr48pV1r9hYmisFZZ0s dqhC2hz8TcIIEJcyloB/quqGoqykIzXYV/CGanQLlLBwvHitHl4Dp9jsJp1d8H0ESXms HIpcCM82xhUcs7BmrXQmsuMLo2xE0p+SeZK4kqm7Mlaj7muAIm4JFYqT0BxPa9ZaS8NN 4F3Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1724926763; x=1725531563; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=liJfUzuPiz+x1OeGHXt2r3UO2uLGH4OphxjUtIXOwkw=; b=ANF/yYaKWeqnftAuH1hKZPVXFMPIDV4lIElEnNPleOeY/W+InZ1pBTaa1OM9O9Rnof MJbKxnTZSbaSTCx9eJ/vrTyn3rWLZ288M3CCi/DpA6rLXy0Mp5fcyUNC/Z5T+zJUyJGW k3P4Nqmct0yzBM8OlR8PGszn8NVmd++9NEIUEC+v8p7YZf6J/17DwhVjB4YWo3UOazIZ kcXf3NAGXsvurs7vpX/vb2Ou5GnnpuEAO5exQK0kfdoL1fJy/L7EoRd61DWSHC67Wunp vlLJ7TbfujQ1pqD9icZFq4sBidbA6+d8zsAJ5fSAD4fqGkA+EXYTxclCTObHtrYuBuWv DX2Q== X-Forwarded-Encrypted: i=1; AJvYcCU1kZJIfs7D1xDiGeTLcdESWi3/R2rqvFSVoAWBnaQP8TLQMCzCZkeoUn+HX8libFrmwTGSuoyweDI=@lists.freedesktop.org X-Gm-Message-State: AOJu0Yw64EenNTvrbZMyMaIygtMFxA/Y+pCVh+WbcVHf3ulWisuX/Yip O0y3FkYAZ5Z1mc2c6NEhR4Q+c5PSashnFPsqqYH0MKI1S16hUizZVyoQc3eY9Is= X-Google-Smtp-Source: AGHT+IGke0/qnL9Q3/h01ae4g52cRUA7SASLy2QLx9D9YMJ6mIYmlVGHFgKC3BITCmVT1KlLNqVLHw== X-Received: by 2002:a05:6a00:2353:b0:714:43d2:920f with SMTP id d2e1a72fcca58-715dfcaf7b0mr2933631b3a.25.1724926763274; Thu, 29 Aug 2024 03:19:23 -0700 (PDT) Received: from [127.0.1.1] ([112.65.12.167]) by smtp.gmail.com with ESMTPSA id 41be03b00d2f7-7d22e9d4df4sm891684a12.82.2024.08.29.03.19.15 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 29 Aug 2024 03:19:22 -0700 (PDT) From: Jun Nie Date: Thu, 29 Aug 2024 18:17:31 +0800 Subject: [PATCH 02/21] drm/msm/dsi: fix DSC width for the bonded DSI case MIME-Version: 1.0 Message-Id: <20240829-sm8650-v6-11-hmd-pocf-mdss-quad-upstream-8-v1-2-bdb05b4b5a2e@linaro.org> References: <20240829-sm8650-v6-11-hmd-pocf-mdss-quad-upstream-8-v1-0-bdb05b4b5a2e@linaro.org> In-Reply-To: <20240829-sm8650-v6-11-hmd-pocf-mdss-quad-upstream-8-v1-0-bdb05b4b5a2e@linaro.org> To: Rob Clark , Abhinav Kumar , Dmitry Baryshkov , Sean Paul , Marijn Suijten , David Airlie , Daniel Vetter , Maarten Lankhorst , Maxime Ripard , Thomas Zimmermann Cc: linux-arm-msm@vger.kernel.org, dri-devel@lists.freedesktop.org, freedreno@lists.freedesktop.org, linux-kernel@vger.kernel.org, Jun Nie , Jonathan Marek X-Mailer: b4 0.13.0 X-Developer-Signature: v=1; a=ed25519-sha256; t=1724926736; l=2920; i=jun.nie@linaro.org; s=20240403; h=from:subject:message-id; bh=rMW8hgzOVthU1PJqs91Rp1PmU+xpXc/U2BYdfZKLbeM=; b=BVhNj9KJ9uzLPwA91fAXENVPKzJaDPbKBTjgRRjyoZ1PwZV7o4Nf9bk80gC9rOKGmI3lNBimQ VB5Hqs9eJSfA7rHTx5AIfPuju1inhjMkcjiejmjJ2LebFMUN7JbYjGH X-Developer-Key: i=jun.nie@linaro.org; a=ed25519; pk=MNiBt/faLPvo+iJoP1hodyY2x6ozVXL8QMptmsKg3cc= X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" From: Jonathan Marek 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. Bonded DSI can be used to drive a single panel having two input channels, or to drive two panels with a input channel on every panel that behave like single panel for display controller. Signed-off-by: Jonathan Marek Signed-off-by: Jun Nie --- drivers/gpu/drm/msm/dsi/dsi.h | 3 ++- drivers/gpu/drm/msm/dsi/dsi_host.c | 6 +++++- drivers/gpu/drm/msm/dsi/dsi_manager.c | 2 +- 3 files changed, 8 insertions(+), 3 deletions(-) diff --git a/drivers/gpu/drm/msm/dsi/dsi.h b/drivers/gpu/drm/msm/dsi/dsi.h index 87496db203d6c..35b90c462f637 100644 --- a/drivers/gpu/drm/msm/dsi/dsi.h +++ b/drivers/gpu/drm/msm/dsi/dsi.h @@ -79,7 +79,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 6388bb12696ff..7a4d9c071be5a 100644 --- a/drivers/gpu/drm/msm/dsi/dsi_host.c +++ b/drivers/gpu/drm/msm/dsi/dsi_host.c @@ -2489,7 +2489,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; @@ -2499,6 +2500,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 a210b7c9e5ca2..6e915b57e14bb 100644 --- a/drivers/gpu/drm/msm/dsi/dsi_manager.c +++ b/drivers/gpu/drm/msm/dsi/dsi_manager.c @@ -420,7 +420,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 int dsi_mgr_bridge_attach(struct drm_bridge *bridge, From patchwork Thu Aug 29 10:17:32 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jun Nie X-Patchwork-Id: 13782982 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 2EE25C83030 for ; Thu, 29 Aug 2024 10:19:33 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id A9DFE10E4FD; Thu, 29 Aug 2024 10:19:32 +0000 (UTC) Authentication-Results: gabe.freedesktop.org; dkim=pass (2048-bit key; unprotected) header.d=linaro.org header.i=@linaro.org header.b="OU7WIYt1"; dkim-atps=neutral Received: from mail-pf1-f178.google.com (mail-pf1-f178.google.com [209.85.210.178]) by gabe.freedesktop.org (Postfix) with ESMTPS id AAE5110E4E6 for ; Thu, 29 Aug 2024 10:19:31 +0000 (UTC) Received: by mail-pf1-f178.google.com with SMTP id d2e1a72fcca58-715e3e03831so456002b3a.2 for ; Thu, 29 Aug 2024 03:19:31 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1724926771; x=1725531571; darn=lists.freedesktop.org; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=YT/oslnAviObem/Io85gQj+L4LOssdl6Cnm2LzK67QU=; b=OU7WIYt1a4JBK9/02XPKFfZ0sbL2Ti+D28NOxWB5TF5bm8pNxHwIRrqPPXq3MKYqCw i+5udD5XUbhq+bw4VdbtMhaAJETD4393YJc3D6UCfxxZz+CwVytLOSMGh/oGqwmrCCcM A4oGQDKs81QMBz6Gg7S6Y25ajKnX72jP5yUOQy7BsrC7ZJLmzrzK+XjM/iX9j3ySWE2R aq0gXgdu+ELlb/MeGhhBU0SxzMh1pDRV3OI3KzIAEcdB++OYwU0BG9NxpPVE2It06VhD UCHoUWOndp+KHabFJgGahiBdY7mVd+cYg1qEKk+fG6judGGLBbd0/h0fyWJyBENn5xHW DSyA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1724926771; x=1725531571; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=YT/oslnAviObem/Io85gQj+L4LOssdl6Cnm2LzK67QU=; b=PWrAfAKmCefkvgqxx+vwoCxd71jw3llKJKL+MAd9peiHkC4ymGTj8YLlKEkWBrjwpC 16kqwTyvsuvGjJY/xPjZEusijIEX7aj312LRq9t/thlLBgOCU3mLgQdnmv2w1PB+tn7+ xEJTJTD4YgGwDXfJ66pMUoyKY9Nhivtv7TQ4bYk6wL99w+uJ8FxyxvJmdGSg9Wkuyzph WxGFSBBMY2WsTronCDGUvVw04GJa4srIHayDAkys1mhoQhU9E0wMUXijQcSFR3OTQZ2C +THGvmkBgx4GPtMPSE063tWNKFJ+ngVLbj6Qj3snHrYPHNZskyA8nXliKfmSDUoiXSNp m3gA== X-Forwarded-Encrypted: i=1; AJvYcCUSQzaAH2CLERMgHvu3p44z/O/YwIkIXDHEj4VIRfNVY6Vz8fW9+qtrQlK93nu7ycoSFgnhvvhwJfg=@lists.freedesktop.org X-Gm-Message-State: AOJu0YzMrGmUxKoLj8ubMuHbTL7O5vVkdCNLDPMSjRqmx1Eqj1zP054W J/+i4FsB+0//P6oSLKZfnGq12nVXA7SRxGl75MbsDvu8LzHXV2JMQKsL7k0Ok/s= X-Google-Smtp-Source: AGHT+IHcvsg7fZYGxqm7ChIBko2zPV37f4pchYS4RO/UEJv/BV2Datn0nVhZhKL+JHS7piaG7e078Q== X-Received: by 2002:a05:6a00:21c9:b0:714:2881:44cc with SMTP id d2e1a72fcca58-715dfaf3a0bmr2666674b3a.10.1724926771151; Thu, 29 Aug 2024 03:19:31 -0700 (PDT) Received: from [127.0.1.1] ([112.65.12.167]) by smtp.gmail.com with ESMTPSA id 41be03b00d2f7-7d22e9d4df4sm891684a12.82.2024.08.29.03.19.23 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 29 Aug 2024 03:19:30 -0700 (PDT) From: Jun Nie Date: Thu, 29 Aug 2024 18:17:32 +0800 Subject: [PATCH 03/21] drm/msm/dsi: pass the right width to dsc MIME-Version: 1.0 Message-Id: <20240829-sm8650-v6-11-hmd-pocf-mdss-quad-upstream-8-v1-3-bdb05b4b5a2e@linaro.org> References: <20240829-sm8650-v6-11-hmd-pocf-mdss-quad-upstream-8-v1-0-bdb05b4b5a2e@linaro.org> In-Reply-To: <20240829-sm8650-v6-11-hmd-pocf-mdss-quad-upstream-8-v1-0-bdb05b4b5a2e@linaro.org> To: Rob Clark , Abhinav Kumar , Dmitry Baryshkov , Sean Paul , Marijn Suijten , David Airlie , Daniel Vetter , Maarten Lankhorst , Maxime Ripard , Thomas Zimmermann Cc: linux-arm-msm@vger.kernel.org, dri-devel@lists.freedesktop.org, freedreno@lists.freedesktop.org, linux-kernel@vger.kernel.org, Jun Nie X-Mailer: b4 0.13.0 X-Developer-Signature: v=1; a=ed25519-sha256; t=1724926736; l=2169; i=jun.nie@linaro.org; s=20240403; h=from:subject:message-id; bh=SPm33PXBWIKSppH1J5nRIqVSKT5JheP2bTluuMrYOXw=; b=2uMFbX70ER8OkBTRn+QVNb6hp3X5asWvQnYadjSLOcg5TmgHNJubsEGmnCe4Vuhcmfo3hKd+l Q1K6HbGoKNyBFSkdiSz9mYPQkAwUWKvJeWIfcvYYF/5SnKzF16Wwo7d X-Developer-Key: i=jun.nie@linaro.org; a=ed25519; pk=MNiBt/faLPvo+iJoP1hodyY2x6ozVXL8QMptmsKg3cc= X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" Data width for dsc engine is aligned with pipe, not with whole screen width. Because the width may be halved in DSI bonded case. The dsc width is not related to the timing with back front porch in later stage, so update dsc timing earlier. Signed-off-by: Jun Nie --- drivers/gpu/drm/msm/dsi/dsi_host.c | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/drivers/gpu/drm/msm/dsi/dsi_host.c b/drivers/gpu/drm/msm/dsi/dsi_host.c index 7a4d9c071be5a..5abade8f26b88 100644 --- a/drivers/gpu/drm/msm/dsi/dsi_host.c +++ b/drivers/gpu/drm/msm/dsi/dsi_host.c @@ -953,7 +953,7 @@ static void dsi_timing_setup(struct msm_dsi_host *msm_host, bool is_bonded_dsi) return; } - dsc->pic_width = mode->hdisplay; + dsc->pic_width = hdisplay; dsc->pic_height = mode->vdisplay; DBG("Mode %dx%d\n", dsc->pic_width, dsc->pic_height); @@ -964,6 +964,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); + /* * DPU sends 3 bytes per pclk cycle to DSI. If widebus is * enabled, bus width is extended to 6 bytes. @@ -990,9 +995,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)); @@ -1011,9 +1013,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 * mipi_dsi_pixel_format_to_bpp(msm_host->format) / 8 + 1; From patchwork Thu Aug 29 10:17:33 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jun Nie X-Patchwork-Id: 13782983 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 35B8BC8302B for ; Thu, 29 Aug 2024 10:19:42 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id AC98210E501; Thu, 29 Aug 2024 10:19:41 +0000 (UTC) Authentication-Results: gabe.freedesktop.org; dkim=pass (2048-bit key; unprotected) header.d=linaro.org header.i=@linaro.org header.b="eKTlYVwt"; dkim-atps=neutral Received: from mail-pf1-f178.google.com (mail-pf1-f178.google.com [209.85.210.178]) by gabe.freedesktop.org (Postfix) with ESMTPS id 1609010E501 for ; Thu, 29 Aug 2024 10:19:41 +0000 (UTC) Received: by mail-pf1-f178.google.com with SMTP id d2e1a72fcca58-715e64ea7d1so346357b3a.0 for ; Thu, 29 Aug 2024 03:19:41 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1724926780; x=1725531580; darn=lists.freedesktop.org; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=E55a1wcpHLjnTLosXy4HNdH7HmAgykI1Dzag/SnhcTk=; b=eKTlYVwtjZbVAL5s7VWKTJbwxpZlt1WdThnggg3sLnZeaLsSj7/jLkWogb0AFYDmB1 7aaGLut9m6KpaPIi/tSciGg6/Q9fIuTkJLIubIz9woXd7YxNXYbwH6g8EwjH67Vpd1Qd aetnmBEmZolLyiMsLyAF4CZuf19TBxWG3AZSgN8jdnWTQvEI47nWe5M+8DML7OVl3USU wPMSPRza9KLs+mLyp80TxoctPa1KhApUqM5gg6g5cOAHU5vMF5qAaBSAt/isIm7o6x+Z a7uRF5MKC+bWZNoqPLkdCt9bse7lzh3GMUj07lnOXOSppruD+NHFkiOqON6ZkTizdxhu OS0w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1724926780; x=1725531580; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=E55a1wcpHLjnTLosXy4HNdH7HmAgykI1Dzag/SnhcTk=; b=Ts72BI2jOwwL30TnukFtOmA3hvPojOAo2R5RoieckgHj1XQSS86w61Zt/E89TQYs6A J72ddQrTwPaYyVATdrQVnsRu3XZdL3/jq78EL/aHnEqP59zpfWDbM8RUKZow1zs5od4Q pNuuZb1D0ne1X/pN4y2Img7tERy0amGp1WKvmD5n70yIoDnFpoyAn3dgGtItnbJLAGz7 oWtIOUM6329Ud+vjbazEvVimAostQh6a6IjkZf3c9T0vB0DWHJBnta1QLG2+QLsDEllf Giejxc1Hwo6gj/orq2YVj0owgFYKqZiHEYpR471mhz0s5IKDiE0hvMzhZa4iEL15f4x8 Mqtw== X-Forwarded-Encrypted: i=1; AJvYcCUdRVp1JIwnUhwKtT6xu2885dmuHKxiQgsVIvWb+tCmkn00AZnorCEcU+ZyoHqCaGtEYT4/B7GRtjQ=@lists.freedesktop.org X-Gm-Message-State: AOJu0YxnjedD6DBQG7EyoBXZUGMvG+l8AEdDt+EBXS3ddT5fxB4ZQmtW rXyunyEEz6QxxjB6HdxmQ01UO/z98FdF9yqAD4wqDnJh4egi8mjbVJ+hmTiQvU4= X-Google-Smtp-Source: AGHT+IEqQrSjReMBtL61vjPIYBgNN+UQ6L12JGUOOf0f2rla6UKGtA7MG5pXDEiIM1GTX8hCV5eYsw== X-Received: by 2002:a05:6a20:aa89:b0:1cc:e487:ec12 with SMTP id adf61e73a8af0-1cce487ec8cmr1045714637.34.1724926780573; Thu, 29 Aug 2024 03:19:40 -0700 (PDT) Received: from [127.0.1.1] ([112.65.12.167]) by smtp.gmail.com with ESMTPSA id 41be03b00d2f7-7d22e9d4df4sm891684a12.82.2024.08.29.03.19.32 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 29 Aug 2024 03:19:39 -0700 (PDT) From: Jun Nie Date: Thu, 29 Aug 2024 18:17:33 +0800 Subject: [PATCH 04/21] drm/msm/dsi: support DSC configurations with slice_per_pkt > 1 MIME-Version: 1.0 Message-Id: <20240829-sm8650-v6-11-hmd-pocf-mdss-quad-upstream-8-v1-4-bdb05b4b5a2e@linaro.org> References: <20240829-sm8650-v6-11-hmd-pocf-mdss-quad-upstream-8-v1-0-bdb05b4b5a2e@linaro.org> In-Reply-To: <20240829-sm8650-v6-11-hmd-pocf-mdss-quad-upstream-8-v1-0-bdb05b4b5a2e@linaro.org> To: Rob Clark , Abhinav Kumar , Dmitry Baryshkov , Sean Paul , Marijn Suijten , David Airlie , Daniel Vetter , Maarten Lankhorst , Maxime Ripard , Thomas Zimmermann Cc: linux-arm-msm@vger.kernel.org, dri-devel@lists.freedesktop.org, freedreno@lists.freedesktop.org, linux-kernel@vger.kernel.org, Jun Nie , Jonathan Marek X-Mailer: b4 0.13.0 X-Developer-Signature: v=1; a=ed25519-sha256; t=1724926736; l=3705; i=jun.nie@linaro.org; s=20240403; h=from:subject:message-id; bh=/3AbBR4A8QK4EPx9duFdiBsejuWCAd+c9GSHXKntqOw=; b=zfJJ6qS1x60/eMkNq5xKVUkAUMljY/7SXEzK0bP3wQZcxhGk+Y4RMZTE/ZoVI+ZzMYY4OaIYy QfldO5kWIQTBjjJjfx+lUMuVaZFIs9cTNJT92t2QZAH9/14hxo+jxLN X-Developer-Key: i=jun.nie@linaro.org; a=ed25519; pk=MNiBt/faLPvo+iJoP1hodyY2x6ozVXL8QMptmsKg3cc= X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" From: Jonathan Marek MSM display controller support multiple slice to be sent in a single DSC packet. Add a dsc_slice_per_pkt field to mipi_dsi_device struct and support this field in msm mdss driver. Note that the removed "pkt_per_line = slice_per_intf * slice_per_pkt" comment is incorrect. Signed-off-by: Jonathan Marek Signed-off-by: Jun Nie --- drivers/gpu/drm/msm/dsi/dsi_host.c | 25 ++++++++++--------------- include/drm/drm_mipi_dsi.h | 2 ++ 2 files changed, 12 insertions(+), 15 deletions(-) diff --git a/drivers/gpu/drm/msm/dsi/dsi_host.c b/drivers/gpu/drm/msm/dsi/dsi_host.c index 5abade8f26b88..36f0470cdf588 100644 --- a/drivers/gpu/drm/msm/dsi/dsi_host.c +++ b/drivers/gpu/drm/msm/dsi/dsi_host.c @@ -157,6 +157,7 @@ struct msm_dsi_host { struct drm_display_mode *mode; struct drm_dsc_config *dsc; + unsigned int dsc_slice_per_pkt; /* connected device info */ unsigned int channel; @@ -861,17 +862,10 @@ static void dsi_update_dsc_timing(struct msm_dsi_host *msm_host, bool is_cmd_mod slice_per_intf = msm_dsc_get_slices_per_intf(dsc, hdisplay); total_bytes_per_intf = dsc->slice_chunk_size * slice_per_intf; - bytes_per_pkt = dsc->slice_chunk_size; /* * slice_per_pkt; */ + bytes_per_pkt = dsc->slice_chunk_size * msm_host->dsc_slice_per_pkt; eol_byte_num = total_bytes_per_intf % 3; - - /* - * Typically, pkt_per_line = slice_per_intf * slice_per_pkt. - * - * Since the current driver only supports slice_per_pkt = 1, - * pkt_per_line will be equal to slice per intf for now. - */ - pkt_per_line = slice_per_intf; + pkt_per_line = slice_per_intf / msm_host->dsc_slice_per_pkt; if (is_cmd_mode) /* packet data type */ reg = DSI_COMMAND_COMPRESSION_MODE_CTRL_STREAM0_DATATYPE(MIPI_DSI_DCS_LONG_WRITE); @@ -1019,12 +1013,8 @@ static void dsi_timing_setup(struct msm_dsi_host *msm_host, bool is_bonded_dsi) else /* * When DSC is enabled, WC = slice_chunk_size * slice_per_pkt + 1. - * Currently, the driver only supports default value of slice_per_pkt = 1 - * - * TODO: Expand mipi_dsi_device struct to hold slice_per_pkt info - * and adjust DSC math to account for slice_per_pkt. */ - wc = msm_host->dsc->slice_chunk_size + 1; + wc = msm_host->dsc->slice_chunk_size * msm_host->dsc_slice_per_pkt + 1; dsi_write(msm_host, REG_DSI_CMD_MDP_STREAM0_CTRL, DSI_CMD_MDP_STREAM0_CTRL_WORD_COUNT(wc) | @@ -1629,8 +1619,13 @@ static int dsi_host_attach(struct mipi_dsi_host *host, msm_host->lanes = dsi->lanes; msm_host->format = dsi->format; msm_host->mode_flags = dsi->mode_flags; - if (dsi->dsc) + if (dsi->dsc) { msm_host->dsc = dsi->dsc; + msm_host->dsc_slice_per_pkt = dsi->dsc_slice_per_pkt; + /* for backwards compatibility, assume 1 if not set */ + if (!msm_host->dsc_slice_per_pkt) + msm_host->dsc_slice_per_pkt = 1; + } ret = dsi_dev_attach(msm_host->pdev); if (ret) diff --git a/include/drm/drm_mipi_dsi.h b/include/drm/drm_mipi_dsi.h index 0f520eeeaa8e3..1c1b56077d44a 100644 --- a/include/drm/drm_mipi_dsi.h +++ b/include/drm/drm_mipi_dsi.h @@ -182,6 +182,7 @@ struct mipi_dsi_device_info { * be set to the real limits of the hardware, zero is only accepted for * legacy drivers * @dsc: panel/bridge DSC pps payload to be sent + * @dsc_slice_per_pkt: number of DSC slices to be sent as in a single packet */ struct mipi_dsi_device { struct mipi_dsi_host *host; @@ -196,6 +197,7 @@ struct mipi_dsi_device { unsigned long hs_rate; unsigned long lp_rate; struct drm_dsc_config *dsc; + unsigned int dsc_slice_per_pkt; }; /** From patchwork Thu Aug 29 10:17:34 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jun Nie X-Patchwork-Id: 13782984 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id A9727C8302B for ; Thu, 29 Aug 2024 10:19:52 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 35EEB10E5BE; Thu, 29 Aug 2024 10:19:52 +0000 (UTC) Authentication-Results: gabe.freedesktop.org; dkim=pass (2048-bit key; unprotected) header.d=linaro.org header.i=@linaro.org header.b="OQY0fPBK"; dkim-atps=neutral Received: from mail-pf1-f178.google.com (mail-pf1-f178.google.com [209.85.210.178]) by gabe.freedesktop.org (Postfix) with ESMTPS id A4DFA10E58D for ; Thu, 29 Aug 2024 10:19:50 +0000 (UTC) Received: by mail-pf1-f178.google.com with SMTP id d2e1a72fcca58-7141285db14so438523b3a.1 for ; Thu, 29 Aug 2024 03:19:50 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1724926790; x=1725531590; darn=lists.freedesktop.org; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=5XVbg4H7DqUL1wC1sOrarS7KoxsQPZKXglpZrahZaTU=; b=OQY0fPBKxVq+Gd23BqPqqwHKWo0PBe5NOFR2PBzKkCntr29ctobilvBqr6P+gRjn+A coBXUFUuvZ087jQfXXjRNBsBGoyQN1CQF8yWETHAKTP7E597+hAW3018ks4Kl4a8d78G rf+cWzHb35cwsZFisrWk7apor9PKM2q5KDs61/WnnpNeyou9lZLnt6p5omsfrX3X3+vG IeNrYy1UVyA8MwdOq/PD8ZpfJPB1yUGQ90on0a3Y0lXe4/oNKqPLNoJl/g4azR+mseSw p8Mfffdm4EWuJuegmgpbBfIphU8FkDEo6LVNkBBHzWcfrto4Sphwtgg6ftp8ZrtqDHCO WmCA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1724926790; x=1725531590; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=5XVbg4H7DqUL1wC1sOrarS7KoxsQPZKXglpZrahZaTU=; b=uLg9YZqHuIKYje8DLwwNdWM9modgBkq6w+rPDgckbEBSbAY2sgXzCy61zEbMpqaK1H /MMvBL08nYs01wXeU1LaNrIdWErDQ3mUoyqhA5MeByda/dPVKlI0wDVneNX9yNRbV/38 Xx5GzB6sh63GgVVr6m2tdnbQbv3RrqT+Wpcc+c2h2cfDHar1RQFc8JsEbMSoYUfN6aIQ +jx0uStxPKoAziEA+FPdb6dwlP7NIou1MpeB0dDMMNWS6uC0OgZPBHhV0uCzoaVAVNRR EGgh9Rfm0bsusLY7nqRDuqSDJUQNhlGP+O3ojEhmu/seHtQe507VMtq9IY9zEM8yeSFV I6Og== X-Forwarded-Encrypted: i=1; AJvYcCXTcNzOjtaAmKLSeHMjJ2E77II/tiBT/MaDRtQ2Kt3/JtFOFKadZ4yq98QGt6Mp10mvOcdzY9E1HSs=@lists.freedesktop.org X-Gm-Message-State: AOJu0YzkJUoIgMo6bagk+qPCemONYH9h/d8TrVzAUhQyZ1K3v6p6nRYO 2DWkRe/f0qNf2cNWBykVB45gI0p8ETvl7jVizOEwHOYfTEKwKpMOF2B+oFwt9Hk5R5mlYxzyZdx 4udpOjQ== X-Google-Smtp-Source: AGHT+IGMiDAlBDPtFQkiAuC1/1Ru4Yek6z8/XGcKf7/UgBC41xY5mzvqMxXMJ8xpjMIYreA+jiSxnw== X-Received: by 2002:a05:6a20:be1b:b0:1c4:c305:121c with SMTP id adf61e73a8af0-1cce10fe4afmr2046484637.42.1724926790096; Thu, 29 Aug 2024 03:19:50 -0700 (PDT) Received: from [127.0.1.1] ([112.65.12.167]) by smtp.gmail.com with ESMTPSA id 41be03b00d2f7-7d22e9d4df4sm891684a12.82.2024.08.29.03.19.41 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 29 Aug 2024 03:19:49 -0700 (PDT) From: Jun Nie Date: Thu, 29 Aug 2024 18:17:34 +0800 Subject: [PATCH 05/21] drm/msm/dpu: polish log for resource allocation MIME-Version: 1.0 Message-Id: <20240829-sm8650-v6-11-hmd-pocf-mdss-quad-upstream-8-v1-5-bdb05b4b5a2e@linaro.org> References: <20240829-sm8650-v6-11-hmd-pocf-mdss-quad-upstream-8-v1-0-bdb05b4b5a2e@linaro.org> In-Reply-To: <20240829-sm8650-v6-11-hmd-pocf-mdss-quad-upstream-8-v1-0-bdb05b4b5a2e@linaro.org> To: Rob Clark , Abhinav Kumar , Dmitry Baryshkov , Sean Paul , Marijn Suijten , David Airlie , Daniel Vetter , Maarten Lankhorst , Maxime Ripard , Thomas Zimmermann Cc: linux-arm-msm@vger.kernel.org, dri-devel@lists.freedesktop.org, freedreno@lists.freedesktop.org, linux-kernel@vger.kernel.org, Jun Nie X-Mailer: b4 0.13.0 X-Developer-Signature: v=1; a=ed25519-sha256; t=1724926736; l=1882; i=jun.nie@linaro.org; s=20240403; h=from:subject:message-id; bh=sjBVYTV8i33N2zpmEmydrCOK2azR2M1Z7wjB2RL+G3o=; b=KlDubHL67SerBVY8xx5C5rEgv2bphTfdqkLShKTQ6oSJjyiQdRzrnDbHsO7yCoorHxYyrI+d4 PPKWy5EToqpAUBNS0nw1kQCBCuQTNZkTCn/nz02pzYUcFPn1NzZ7pG7 X-Developer-Key: i=jun.nie@linaro.org; a=ed25519; pk=MNiBt/faLPvo+iJoP1hodyY2x6ozVXL8QMptmsKg3cc= X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" Add resource allocation type info. Signed-off-by: Jun Nie --- drivers/gpu/drm/msm/disp/dpu1/dpu_rm.c | 23 +++++++++++++++++++---- 1 file changed, 19 insertions(+), 4 deletions(-) diff --git a/drivers/gpu/drm/msm/disp/dpu1/dpu_rm.c b/drivers/gpu/drm/msm/disp/dpu1/dpu_rm.c index 15b42a6683639..e219d706610c2 100644 --- a/drivers/gpu/drm/msm/disp/dpu1/dpu_rm.c +++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_rm.c @@ -778,6 +778,21 @@ void dpu_rm_release_all_sspp(struct dpu_global_state *global_state, ARRAY_SIZE(global_state->sspp_to_crtc_id), crtc_id); } +static char *dpu_hw_blk_type_name[] = { + [DPU_HW_BLK_TOP] = "blk_top", + [DPU_HW_BLK_SSPP] = "blk_sspp", + [DPU_HW_BLK_LM] = "blk_lm", + [DPU_HW_BLK_CTL] = "blk_ctl", + [DPU_HW_BLK_PINGPONG] = "blk_pingpong", + [DPU_HW_BLK_INTF] = "blk_intf", + [DPU_HW_BLK_WB] = "blk_wb", + [DPU_HW_BLK_DSPP] = "blk_dspp", + [DPU_HW_BLK_MERGE_3D] = "blk_merge_3d", + [DPU_HW_BLK_DSC] = "blk_dsc", + [DPU_HW_BLK_CDM] = "blk_cdm", + [DPU_HW_BLK_MAX] = "blk_none", +}; + int dpu_rm_get_assigned_resources(struct dpu_rm *rm, struct dpu_global_state *global_state, uint32_t enc_id, enum dpu_hw_blk_type type, struct dpu_hw_blk **blks, int blks_size) @@ -828,13 +843,13 @@ int dpu_rm_get_assigned_resources(struct dpu_rm *rm, continue; if (num_blks == blks_size) { - DPU_ERROR("More than %d resources assigned to enc %d\n", - blks_size, enc_id); + DPU_ERROR("More than %d %s assigned to enc %d\n", + blks_size, dpu_hw_blk_type_name[type], enc_id); break; } if (!hw_blks[i]) { - DPU_ERROR("Allocated resource %d unavailable to assign to enc %d\n", - type, enc_id); + DPU_ERROR("%s unavailable to assign to enc %d\n", + dpu_hw_blk_type_name[type], enc_id); break; } blks[num_blks++] = hw_blks[i]; From patchwork Thu Aug 29 10:17:35 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jun Nie X-Patchwork-Id: 13782985 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id D185FC8302B for ; Thu, 29 Aug 2024 10:20:01 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 451CE10E60B; Thu, 29 Aug 2024 10:20:01 +0000 (UTC) Authentication-Results: gabe.freedesktop.org; dkim=pass (2048-bit key; unprotected) header.d=linaro.org header.i=@linaro.org header.b="TBY6YIga"; dkim-atps=neutral Received: from mail-ot1-f42.google.com (mail-ot1-f42.google.com [209.85.210.42]) by gabe.freedesktop.org (Postfix) with ESMTPS id C3E3510E60B for ; Thu, 29 Aug 2024 10:19:59 +0000 (UTC) Received: by mail-ot1-f42.google.com with SMTP id 46e09a7af769-70943b07c2cso293371a34.1 for ; Thu, 29 Aug 2024 03:19:59 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1724926799; x=1725531599; darn=lists.freedesktop.org; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=dXpohNGjcJfCJqCaQiZhnFBlaCnLWhBefQR/nOCDEO4=; b=TBY6YIgaWcFtlOL8JGoptGPQ/n2BkvlbHSuG7mUi29mRo38X9Vpb06U+m6FzvciP0z iQhtNkXAoOahbQCOz/wINT30T1Sx7jTvD/v+e2w9v885UAq47PGxe4xWiPpEE3neAjpr lX1zsN70jz2sSApyh1eTis8fWugxNe+bQ0rC3aIv6lcQlXD3yvTXF6U6Xh/yDHrJSvo0 3nVvmapWkS7/ERK/6VdS+D839vm206f+sx+g/i7mJ8FNU1Uj+FQZWHt2wU48qdgqIGYz nQxcaGdVVKJnIdKebBmyf75eg50JiqI5iAQs7Fgp0fxojUXjT/6JN2JxJSYsv8aOG8Vn K7+Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1724926799; x=1725531599; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=dXpohNGjcJfCJqCaQiZhnFBlaCnLWhBefQR/nOCDEO4=; b=eCl8ocYu6O0zePHac5Z1c5HVrvgFPtesAHvXQ7z/aawp5C/IfY3/mW3Vf+fpWZfLc0 Ola7y1H6O6T379R9c06QiFBYOyV60cG+qNRN8QhuhVUH3qVr/pS6KhnN2EHJMgKWOIt1 9j3A57iVP2rVbBzQzcla1vPiOVx6UeY+kQ+ZO1zmCzEOGkH8akyrDlvAtzeLvsjNZ0Uz g/hM6+/KtdTBEVcJmi/Zirg5qQa1HvC1ArukhPDsIFM/55tkWus4I+KyECEQ+Rki1XuQ vasypjA54mGqNNFagddfLZpug2wWO7tyM84Jm5unnjVB4gGt481kTOnnDM1v6AgRhGdV hmlA== X-Forwarded-Encrypted: i=1; AJvYcCWDuEYpr4Wp41SzNnqGD3dfVllZBFwz1jB0iWBhXNiYX8J7eV96Nly9OqrHNAQdcFXj7b7k7Y62w90=@lists.freedesktop.org X-Gm-Message-State: AOJu0YzfOTKv9XmdilGJYIKImu3bYogNMFGCLhyBKGY5Pim5OvejyltU NHSVCSWxuomqIC6TZm/TW6WWuxP5r9yfnmdMzfg0fL1XUIzC/tIVHxcy0JMLVoU= X-Google-Smtp-Source: AGHT+IHzQlKpb6SgNns8yfk1JCTnZQzAo8OKX9t5/fVEsIUjLhdRx9zqCLt3/Def18N+Yyhol8/MTA== X-Received: by 2002:a05:6358:50ca:b0:1b5:fa6e:4606 with SMTP id e5c5f4694b2df-1b603c4379dmr284289755d.14.1724926798698; Thu, 29 Aug 2024 03:19:58 -0700 (PDT) Received: from [127.0.1.1] ([112.65.12.167]) by smtp.gmail.com with ESMTPSA id 41be03b00d2f7-7d22e9d4df4sm891684a12.82.2024.08.29.03.19.50 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 29 Aug 2024 03:19:58 -0700 (PDT) From: Jun Nie Date: Thu, 29 Aug 2024 18:17:35 +0800 Subject: [PATCH 06/21] drm/msm/dpu: Add utility to get mixer number MIME-Version: 1.0 Message-Id: <20240829-sm8650-v6-11-hmd-pocf-mdss-quad-upstream-8-v1-6-bdb05b4b5a2e@linaro.org> References: <20240829-sm8650-v6-11-hmd-pocf-mdss-quad-upstream-8-v1-0-bdb05b4b5a2e@linaro.org> In-Reply-To: <20240829-sm8650-v6-11-hmd-pocf-mdss-quad-upstream-8-v1-0-bdb05b4b5a2e@linaro.org> To: Rob Clark , Abhinav Kumar , Dmitry Baryshkov , Sean Paul , Marijn Suijten , David Airlie , Daniel Vetter , Maarten Lankhorst , Maxime Ripard , Thomas Zimmermann Cc: linux-arm-msm@vger.kernel.org, dri-devel@lists.freedesktop.org, freedreno@lists.freedesktop.org, linux-kernel@vger.kernel.org, Jun Nie X-Mailer: b4 0.13.0 X-Developer-Signature: v=1; a=ed25519-sha256; t=1724926736; l=1489; i=jun.nie@linaro.org; s=20240403; h=from:subject:message-id; bh=TnuEj9uiNYDGvT/WDFYFtTXjthsNUxS/xNImWJVj/gE=; b=kEP+gbv7fJSxwa/V+9sP9FWlxxstGmW3wW7eOAaWmARUmmADQOGPOjYM4yKgyDVB+l2Iz/5gh E2wiNvBOm2qBTcMUCpak2jw7GncDdbg5jKrl9dB07Jjuj11u55tN9M3 X-Developer-Key: i=jun.nie@linaro.org; a=ed25519; pk=MNiBt/faLPvo+iJoP1hodyY2x6ozVXL8QMptmsKg3cc= X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" Add utility to get mixer number via CRTC handler Signed-off-by: Jun Nie --- drivers/gpu/drm/msm/disp/dpu1/dpu_crtc.c | 7 +++++++ drivers/gpu/drm/msm/disp/dpu1/dpu_crtc.h | 5 +++++ 2 files changed, 12 insertions(+) diff --git a/drivers/gpu/drm/msm/disp/dpu1/dpu_crtc.c b/drivers/gpu/drm/msm/disp/dpu1/dpu_crtc.c index 7d0fff9472441..a27e39c525d1a 100644 --- a/drivers/gpu/drm/msm/disp/dpu1/dpu_crtc.c +++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_crtc.c @@ -1306,6 +1306,13 @@ int dpu_crtc_vblank(struct drm_crtc *crtc, bool en) return 0; } +unsigned int dpu_crtc_get_lm_num(const struct drm_crtc_state *state) +{ + struct dpu_crtc_state *cstate = to_dpu_crtc_state(state); + + return cstate->num_mixers; +} + #ifdef CONFIG_DEBUG_FS static int _dpu_debugfs_status_show(struct seq_file *s, void *data) { diff --git a/drivers/gpu/drm/msm/disp/dpu1/dpu_crtc.h b/drivers/gpu/drm/msm/disp/dpu1/dpu_crtc.h index b26d5fe40c721..701c35803633d 100644 --- a/drivers/gpu/drm/msm/disp/dpu1/dpu_crtc.h +++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_crtc.h @@ -301,5 +301,10 @@ static inline enum dpu_crtc_client_type dpu_crtc_get_client_type( } void dpu_crtc_frame_event_cb(struct drm_crtc *crtc, u32 event); +/** + * dpu_crtc_get_lm_num - Get mixer number in this CRTC pipeline + * @crtc: Pointer to drm crtc object + */ +unsigned int dpu_crtc_get_lm_num(const struct drm_crtc_state *state); #endif /* _DPU_CRTC_H_ */ From patchwork Thu Aug 29 10:17:36 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jun Nie X-Patchwork-Id: 13782986 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 31662C8302B for ; Thu, 29 Aug 2024 10:20:10 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id AF05B10E614; Thu, 29 Aug 2024 10:20:09 +0000 (UTC) Authentication-Results: gabe.freedesktop.org; dkim=pass (2048-bit key; unprotected) header.d=linaro.org header.i=@linaro.org header.b="revnX/8K"; dkim-atps=neutral Received: from mail-pf1-f176.google.com (mail-pf1-f176.google.com [209.85.210.176]) by gabe.freedesktop.org (Postfix) with ESMTPS id 0421910E614 for ; Thu, 29 Aug 2024 10:20:08 +0000 (UTC) Received: by mail-pf1-f176.google.com with SMTP id d2e1a72fcca58-70cec4aa1e4so330498b3a.1 for ; Thu, 29 Aug 2024 03:20:08 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1724926807; x=1725531607; darn=lists.freedesktop.org; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=sCM9+J5N4G47yHA+9svPJMNmtm7ygy8LRAS3AKbj6g8=; b=revnX/8KemsuzmIArY0mZp2OVEkE4NrlcmkBgyqlbABY5pXs+klmoif2LmMQUTf6eI 5mdXU8QRolE0tutOzlCu1t2AHEl4x85rZ1RxxwBKrllnzVfszo62+dszsUxrS3B9mK8+ gCL9/bS5KWutcZQoDi6ZMJhf2sHTp7NIvevQlav3h5+NEVOJBZslenp/0IZUDofY4p5A 6BGj/aFJXv3Yfh7DNPgxzsm+Ew2x93xav+4lWdlBh3xY8isSuxCJUrEwPNTdlstxtYVQ O8Q8QVhJI65xRm1Hqwv9Mi+Vv+n5UiTvP3AY0zJV6SGlCmG7NxZCy29ES3kC1kpL29Bx TPVw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1724926807; x=1725531607; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=sCM9+J5N4G47yHA+9svPJMNmtm7ygy8LRAS3AKbj6g8=; b=v10jTu+IAc3CnG6ineGwLhphp4HthgSQfieSuTmXhuN99i0I+CyB+wTOFEgqewzhPy 0x9k8K5tc/yKFJStbfNOY9nQo9L90V8F9153v5kmq7fQ7br0x1ebAZnGfhY4O5+BK5lV cjsod0OjiXZvk5hweqOQ0uKxlpnbfUrhLsmK+vSUD15ee0O6gscS0qFAHQWV+flLc2bj bGbXzYxUQprwLCs7Rpw7iDax6DoXQfLpuRtNlEAocKTJi28wWrBMku1ZUxiBM5x28blD SJ6B6djoYAsGw4QH+27v//bHb/JiW0CgdlDDwzNCHQJq/gA6Aqd9THEWZOdefE2vC88O sBMg== X-Forwarded-Encrypted: i=1; AJvYcCWOfM+lPtUkx4xB5ao4zYb/EDkT8Ac/PFyuo/MAaWf+CQJGdaZOIlCR0LJ5PIKq3kGI13ipZOgV0Vk=@lists.freedesktop.org X-Gm-Message-State: AOJu0YylOLZvghyAz1Aoejwq5RG04WW1mTzxUPc80C/fc3PxnKkeeRF0 OgNZeQY3RX+vnKHoLfjxfD6zY90+96cL9af58OJm7VfvPWEFovIsT7EjHvhPmAQ= X-Google-Smtp-Source: AGHT+IFo6JqACOpnth0fo0ebIHz2s0TbrVB7OHz+muTbyPW6Oj8OzQXal3TuFyZ8y86blnUcHVs4ag== X-Received: by 2002:a05:6a20:43a0:b0:1c6:ed5e:24f with SMTP id adf61e73a8af0-1cce1021453mr2687410637.23.1724926807471; Thu, 29 Aug 2024 03:20:07 -0700 (PDT) Received: from [127.0.1.1] ([112.65.12.167]) by smtp.gmail.com with ESMTPSA id 41be03b00d2f7-7d22e9d4df4sm891684a12.82.2024.08.29.03.19.59 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 29 Aug 2024 03:20:06 -0700 (PDT) From: Jun Nie Date: Thu, 29 Aug 2024 18:17:36 +0800 Subject: [PATCH 07/21] drm/msm/dpu: Support dynamic DSC number MIME-Version: 1.0 Message-Id: <20240829-sm8650-v6-11-hmd-pocf-mdss-quad-upstream-8-v1-7-bdb05b4b5a2e@linaro.org> References: <20240829-sm8650-v6-11-hmd-pocf-mdss-quad-upstream-8-v1-0-bdb05b4b5a2e@linaro.org> In-Reply-To: <20240829-sm8650-v6-11-hmd-pocf-mdss-quad-upstream-8-v1-0-bdb05b4b5a2e@linaro.org> To: Rob Clark , Abhinav Kumar , Dmitry Baryshkov , Sean Paul , Marijn Suijten , David Airlie , Daniel Vetter , Maarten Lankhorst , Maxime Ripard , Thomas Zimmermann Cc: linux-arm-msm@vger.kernel.org, dri-devel@lists.freedesktop.org, freedreno@lists.freedesktop.org, linux-kernel@vger.kernel.org, Jun Nie X-Mailer: b4 0.13.0 X-Developer-Signature: v=1; a=ed25519-sha256; t=1724926736; l=921; i=jun.nie@linaro.org; s=20240403; h=from:subject:message-id; bh=0yy1liVIVVcBNaGfsGh4eMYqZcgCYhVFKjgWT8Yk1d0=; b=PwOW3rRew35aIX4xRyng/9JjRkID8/gLpZS+9EYNgSES93anR/gwegVFnq/E8Gu6stEEFpRH/ CqB8AK/26+2AOcc8A0fnpWAoCQs3VSmafagyoRBeq9Xe8yckQ/TJZpN X-Developer-Key: i=jun.nie@linaro.org; a=ed25519; pk=MNiBt/faLPvo+iJoP1hodyY2x6ozVXL8QMptmsKg3cc= X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" Do not assume DSC number as 2. Because there are 4 DSC in quad pipe case. Signed-off-by: Jun Nie --- drivers/gpu/drm/msm/disp/dpu1/dpu_encoder.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/gpu/drm/msm/disp/dpu1/dpu_encoder.c b/drivers/gpu/drm/msm/disp/dpu1/dpu_encoder.c index 6bdd9c21ff3ed..05b203be2a9bc 100644 --- a/drivers/gpu/drm/msm/disp/dpu1/dpu_encoder.c +++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_encoder.c @@ -553,9 +553,9 @@ bool dpu_encoder_use_dsc_merge(struct drm_encoder *drm_enc) if (dpu_enc->phys_encs[i]) intf_count++; - /* See dpu_encoder_get_topology, we only support 2:2:1 topology */ + /* DSC and mixer are mapped 1:1, so reuse the mixer number */ if (dpu_enc->dsc) - num_dsc = 2; + num_dsc = dpu_crtc_get_lm_num(drm_enc->crtc->state); return (num_dsc > 0) && (num_dsc > intf_count); } From patchwork Thu Aug 29 10:17:37 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jun Nie X-Patchwork-Id: 13782987 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 9D0C2C83030 for ; Thu, 29 Aug 2024 10:20:18 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 1B48510E61E; Thu, 29 Aug 2024 10:20:18 +0000 (UTC) Authentication-Results: gabe.freedesktop.org; dkim=pass (2048-bit key; unprotected) header.d=linaro.org header.i=@linaro.org header.b="RDohEStV"; dkim-atps=neutral Received: from mail-ot1-f46.google.com (mail-ot1-f46.google.com [209.85.210.46]) by gabe.freedesktop.org (Postfix) with ESMTPS id 8202E10E61D for ; Thu, 29 Aug 2024 10:20:16 +0000 (UTC) Received: by mail-ot1-f46.google.com with SMTP id 46e09a7af769-70f624c6015so128941a34.1 for ; Thu, 29 Aug 2024 03:20:16 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1724926816; x=1725531616; darn=lists.freedesktop.org; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=Y8bZPOFtZouu5Teru3SXjHUwrTGv8xZnRnBYE1IpFB0=; b=RDohEStVxZ85gO1uCu6fUys7gvJaW2DwL3IA13X/MexEV4SJ6U+/IIYDlcaBF0qLB3 0Aidq9Y/JQP+4s5dN9B54CSqE1WCeoiOZUwtYnR546r8gDze8Wuvr5RMxBmWejWTgrsU YdzTw6GX/TfkgHFNfxwaZmpNTUIhfP5wGkdLvpjSrkLzXfpfdiqjReqtOvjKwNlTmAbK 2LDx77Ub7WJ0qhFP4ytF9Kqd17qgvhWHQ1MBUWPc5k2Nl6kKXgJCHXEnqH1zEVInQnki DkEb6yZ3XUYx7tQfpeJ7GSgPiMlA2tHQ6CpO/DnZwqFfg07CAmZ9vTQVsy4aXDnvjXn0 R33A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1724926816; x=1725531616; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=Y8bZPOFtZouu5Teru3SXjHUwrTGv8xZnRnBYE1IpFB0=; b=u1aufPhxskgtKutGZLOJFFud3ocIfCPXw7tBDwoGGFtbXtQusd2avXdSAXgJwXps/x eRCwJ/iNiBPlxEvrwCGDHRQAd4LUtvLV8+NX/NGYUQPgQny0rmA77jtGnTm57EdhF99c TM4df+Ht3rAJX3KwqbHWXZdA18SvT/tPg1/8cYjSmS0f98WGgYwSTVwNpqcIPc8qodUt ZnTQ/tp7/ZwfST7a2/KG5RvbyEdpiDKabaMRlYZpk0We86dLfTD3LSFiJOB0tHydMU7B lG4geoW0fQItNB57aZG1tkrSlLX70PojLs2Co8qWxC4I0S0SOfFrJlkda/c5HN5f0uPa IYxA== X-Forwarded-Encrypted: i=1; AJvYcCX2n3msSrdG7IKmDihmdfBAwq1U2EuGeEAGAclWNU4Kd0zPdwAOCqblBkXREOVuGkxg0glz10G3uEY=@lists.freedesktop.org X-Gm-Message-State: AOJu0YzqRChBEY4wtTC2+eYLWJtb46ylgWm0IDHbL0FakF21un5OOtjT wODkgheXIohczL8aRF0cTTzhDmSuSkM9wANfEI4igYNCyvRBJ0aRaB2Ibb/nuDc= X-Google-Smtp-Source: AGHT+IEym+LTunQTzfEmwfn9ioQibaynXV6VWyoQiFC3MErj3eUuTmWGKObCu8L9rZiNCDri6dHHhw== X-Received: by 2002:a05:6358:29b:b0:1aa:b266:2a67 with SMTP id e5c5f4694b2df-1b603cce482mr233441555d.30.1724926815732; Thu, 29 Aug 2024 03:20:15 -0700 (PDT) Received: from [127.0.1.1] ([112.65.12.167]) by smtp.gmail.com with ESMTPSA id 41be03b00d2f7-7d22e9d4df4sm891684a12.82.2024.08.29.03.20.07 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 29 Aug 2024 03:20:15 -0700 (PDT) From: Jun Nie Date: Thu, 29 Aug 2024 18:17:37 +0800 Subject: [PATCH 08/21] drm/msm/dpu: decide right side per last bit MIME-Version: 1.0 Message-Id: <20240829-sm8650-v6-11-hmd-pocf-mdss-quad-upstream-8-v1-8-bdb05b4b5a2e@linaro.org> References: <20240829-sm8650-v6-11-hmd-pocf-mdss-quad-upstream-8-v1-0-bdb05b4b5a2e@linaro.org> In-Reply-To: <20240829-sm8650-v6-11-hmd-pocf-mdss-quad-upstream-8-v1-0-bdb05b4b5a2e@linaro.org> To: Rob Clark , Abhinav Kumar , Dmitry Baryshkov , Sean Paul , Marijn Suijten , David Airlie , Daniel Vetter , Maarten Lankhorst , Maxime Ripard , Thomas Zimmermann Cc: linux-arm-msm@vger.kernel.org, dri-devel@lists.freedesktop.org, freedreno@lists.freedesktop.org, linux-kernel@vger.kernel.org, Jun Nie X-Mailer: b4 0.13.0 X-Developer-Signature: v=1; a=ed25519-sha256; t=1724926736; l=1363; i=jun.nie@linaro.org; s=20240403; h=from:subject:message-id; bh=IWaQt7fOIuTYMO/sDj1ofTNDciH2u7nSLcam8JkLU5E=; b=ieBILLU/UCHYnkUeuzubKY3xpimkInETjb4hrSXsJVo68E0UyJbCNZUYZa/sf3Xf25pT23B2E G+zkaRPb8/1BUuBtPQa+vtVVb8HJTql3RoelmtRjCwo4R/VQBtzW6q+ X-Developer-Key: i=jun.nie@linaro.org; a=ed25519; pk=MNiBt/faLPvo+iJoP1hodyY2x6ozVXL8QMptmsKg3cc= X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" in case of multiple mixer pairs Signed-off-by: Jun Nie Reviewed-by: Dmitry Baryshkov --- drivers/gpu/drm/msm/disp/dpu1/dpu_crtc.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/drivers/gpu/drm/msm/disp/dpu1/dpu_crtc.c b/drivers/gpu/drm/msm/disp/dpu1/dpu_crtc.c index a27e39c525d1a..d9f26e189eebf 100644 --- a/drivers/gpu/drm/msm/disp/dpu1/dpu_crtc.c +++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_crtc.c @@ -369,11 +369,10 @@ static void _dpu_crtc_setup_blend_cfg(struct dpu_crtc_mixer *mixer, static void _dpu_crtc_program_lm_output_roi(struct drm_crtc *crtc) { struct dpu_crtc_state *crtc_state; - int lm_idx, lm_horiz_position; + int lm_idx; crtc_state = to_dpu_crtc_state(crtc->state); - lm_horiz_position = 0; for (lm_idx = 0; lm_idx < crtc_state->num_mixers; lm_idx++) { const struct drm_rect *lm_roi = &crtc_state->lm_bounds[lm_idx]; struct dpu_hw_mixer *hw_lm = crtc_state->mixers[lm_idx].hw_lm; @@ -384,7 +383,7 @@ static void _dpu_crtc_program_lm_output_roi(struct drm_crtc *crtc) cfg.out_width = drm_rect_width(lm_roi); cfg.out_height = drm_rect_height(lm_roi); - cfg.right_mixer = lm_horiz_position++; + cfg.right_mixer = lm_idx & 0x1; cfg.flags = 0; hw_lm->ops.setup_mixer_out(hw_lm, &cfg); } From patchwork Thu Aug 29 10:17:38 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jun Nie X-Patchwork-Id: 13782988 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id A9DE2C83030 for ; Thu, 29 Aug 2024 10:20:26 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 2D86910E61A; Thu, 29 Aug 2024 10:20:26 +0000 (UTC) Authentication-Results: gabe.freedesktop.org; dkim=pass (2048-bit key; unprotected) header.d=linaro.org header.i=@linaro.org header.b="GYruatb2"; dkim-atps=neutral Received: from mail-pf1-f181.google.com (mail-pf1-f181.google.com [209.85.210.181]) by gabe.freedesktop.org (Postfix) with ESMTPS id 3AF8210E61A for ; Thu, 29 Aug 2024 10:20:25 +0000 (UTC) Received: by mail-pf1-f181.google.com with SMTP id d2e1a72fcca58-715e64ea7d1so346858b3a.0 for ; Thu, 29 Aug 2024 03:20:25 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1724926825; x=1725531625; darn=lists.freedesktop.org; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=KqVaFuXRTjcV6hpBsvv8E/abzRWrI1lYc7ZkudzQdyo=; b=GYruatb2wsNqAjAFvu1efPoiBEKkshi1r2prrP0SmsSbllR6ZDQwludKq7y3qmnea5 ptT2quL85fRimiQSRvd1T4Orj0+viZY87J2GXKdYC55JxZpHslL/dmpserk9KAr0scKN exNK6Lwu55LAWxdZnlIQMcUUHwhY3M6Z/ckCfh+ClsI5+WAkR4iHHsNxYq+Mv792nKnX sEaD3nvSzHb1fC6YcS2lfC+VJxYbFWQDsIPaNUVbXro7BJgfun+bkLAcspl/genWAavq B/FcbIzLCrZOyXh3DG6nYhrVNTSM2i56UfTwJXhUPZHI+UetDSlg14wUsQi8kZzc0PNj +Fgg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1724926825; x=1725531625; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=KqVaFuXRTjcV6hpBsvv8E/abzRWrI1lYc7ZkudzQdyo=; b=PLP/DiPPc8/71PkNjualcS5zNmRx3O1r//ysqDxsfXK6+QJBSWCP19y01bpvaSsBVo B35TWDVeLXR/bQE4wktmx+IF3UIvoO9Gvh9ZHRVKztMQcPVC6mTRuMhzav/YIJV74f5A 72KLqNfaSVektcv7FKPdYEzYGqC3kqmgLAYwbEfrJBDoaRarepgsozhdQ6FpTHFR0/z8 0XfmOzMYP6eAoYbk2GZ7kizO8hPxTqJcqeyoo19JhYlc5//lQvOBFuD/FIrSUdyx2rFZ //ZkrlhLR989b56DgsxruUbW3HRvlmoZWRTen/c931Ckfu3YFyKjbX759NIy7xGrrcWV soIg== X-Forwarded-Encrypted: i=1; AJvYcCV/HrP3SheXr384QL+/xyD7Yxrsl9Bv8hJRsYz9iVDNz1occwr0ac32YPAOMMaMyKRmArqQ1TxiAHw=@lists.freedesktop.org X-Gm-Message-State: AOJu0YxUrwllsJFKxTwwJaeaWc2OTh2Etj7v3h+3zgalxIqhFCjtkOA3 ByitjES4k0s8J9+Cekru2xnwN2rr0MxOJLLdmxqlMX2fiM4OM5dI/nCnQrr3AZU= X-Google-Smtp-Source: AGHT+IFFcYQklmFqvsFpUrteERi7sYJuMzaDu52erTAc7hG9eMzpIZmxHDrIi9iF92E+PnEl7bRKMg== X-Received: by 2002:a05:6a20:c908:b0:1c6:a680:ef3d with SMTP id adf61e73a8af0-1cce10479ccmr2252451637.28.1724926824735; Thu, 29 Aug 2024 03:20:24 -0700 (PDT) Received: from [127.0.1.1] ([112.65.12.167]) by smtp.gmail.com with ESMTPSA id 41be03b00d2f7-7d22e9d4df4sm891684a12.82.2024.08.29.03.20.16 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 29 Aug 2024 03:20:23 -0700 (PDT) From: Jun Nie Date: Thu, 29 Aug 2024 18:17:38 +0800 Subject: [PATCH 09/21] drm/msm/dpu: request more mixer for 4K+ DSC case MIME-Version: 1.0 Message-Id: <20240829-sm8650-v6-11-hmd-pocf-mdss-quad-upstream-8-v1-9-bdb05b4b5a2e@linaro.org> References: <20240829-sm8650-v6-11-hmd-pocf-mdss-quad-upstream-8-v1-0-bdb05b4b5a2e@linaro.org> In-Reply-To: <20240829-sm8650-v6-11-hmd-pocf-mdss-quad-upstream-8-v1-0-bdb05b4b5a2e@linaro.org> To: Rob Clark , Abhinav Kumar , Dmitry Baryshkov , Sean Paul , Marijn Suijten , David Airlie , Daniel Vetter , Maarten Lankhorst , Maxime Ripard , Thomas Zimmermann Cc: linux-arm-msm@vger.kernel.org, dri-devel@lists.freedesktop.org, freedreno@lists.freedesktop.org, linux-kernel@vger.kernel.org, Jun Nie X-Mailer: b4 0.13.0 X-Developer-Signature: v=1; a=ed25519-sha256; t=1724926736; l=2153; i=jun.nie@linaro.org; s=20240403; h=from:subject:message-id; bh=J9qbpND/oK0fAXiMDbCuIZnkaZ9CaAJIulB/ZP/a6Ww=; b=2reSSKY4nTX2HXPWMGAjlTPGq8K51OYUY+VKwm+i9BINUgZREQbtA5f8i8d7LSSWkUPIvuj7B UDpmaeEAQAOAMDMADlR05u/TTonmyqRqi579jz6NI8X32aU6Ia4zUFr X-Developer-Key: i=jun.nie@linaro.org; a=ed25519; pk=MNiBt/faLPvo+iJoP1hodyY2x6ozVXL8QMptmsKg3cc= X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" request more mixer for the case that hdisplay exceeding 4096 and DSC enabled. Signed-off-by: Jun Nie --- drivers/gpu/drm/msm/disp/dpu1/dpu_encoder.c | 24 ++++++++++++++++++++---- 1 file changed, 20 insertions(+), 4 deletions(-) diff --git a/drivers/gpu/drm/msm/disp/dpu1/dpu_encoder.c b/drivers/gpu/drm/msm/disp/dpu1/dpu_encoder.c index 05b203be2a9bc..33cfd94badaba 100644 --- a/drivers/gpu/drm/msm/disp/dpu1/dpu_encoder.c +++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_encoder.c @@ -59,6 +59,7 @@ #define IDLE_SHORT_TIMEOUT 1 #define MAX_HDISPLAY_SPLIT 1080 +#define MAX_HDISPLAY_DSC_SPLIT 2560 /* timeout in frames waiting for frame done */ #define DPU_ENCODER_FRAME_DONE_TIMEOUT_FRAMES 5 @@ -588,15 +589,19 @@ static struct msm_display_topology dpu_encoder_get_topology( /* Datapath topology selection * - * Dual display + * Dual display without DSC * 2 LM, 2 INTF ( Split display using 2 interfaces) * + * Dual display with DSC + * 4 LM, 2 INTF ( Split display using 2 interfaces) + * * Single display * 1 LM, 1 INTF * 2 LM, 1 INTF (stream merge to support high resolution interfaces) * * Add dspps to the reservation requirements if ctm is requested */ + if (intf_count == 2) topology.num_lm = 2; else if (!dpu_kms->catalog->caps->has_3d_merge) @@ -615,10 +620,21 @@ static struct msm_display_topology dpu_encoder_get_topology( * 2 DSC encoders, 2 layer mixers and 1 interface * this is power optimal and can drive up to (including) 4k * screens + * But for dual display with hdisplay exceeding 4096, we need + * 4 layer mixer. Because DSC has a max width of 2048 and + * a single plane can only be used by one mixer pair */ - topology.num_dsc = 2; - topology.num_lm = 2; - topology.num_intf = 1; + + if (intf_count == 2 && + mode->hdisplay > MAX_HDISPLAY_DSC_SPLIT) { + topology.num_dsc = 4; + topology.num_lm = 4; + topology.num_intf = 2; + } else { + topology.num_dsc = 2; + topology.num_lm = 2; + topology.num_intf = 1; + } } return topology; From patchwork Thu Aug 29 10:17:39 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jun Nie X-Patchwork-Id: 13782989 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 76306C83030 for ; Thu, 29 Aug 2024 10:20:33 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id F32D310E615; Thu, 29 Aug 2024 10:20:32 +0000 (UTC) Authentication-Results: gabe.freedesktop.org; dkim=pass (2048-bit key; unprotected) header.d=linaro.org header.i=@linaro.org header.b="vzUG9GT/"; dkim-atps=neutral Received: from mail-ot1-f54.google.com (mail-ot1-f54.google.com [209.85.210.54]) by gabe.freedesktop.org (Postfix) with ESMTPS id 207F010E615 for ; Thu, 29 Aug 2024 10:20:32 +0000 (UTC) Received: by mail-ot1-f54.google.com with SMTP id 46e09a7af769-7093b53f315so181728a34.2 for ; Thu, 29 Aug 2024 03:20:32 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1724926831; x=1725531631; darn=lists.freedesktop.org; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=3lbMpHi+idQrWBFT40ehkUCaBfcILsbcClLsstfOLPw=; b=vzUG9GT/4I4+e3SQLZKqdGyP1E1sXGq6JHF8SWPxvz3kOoa8OTUaBttpifpXo/PIlb WLYd6iChx2hoT8N3moSztC1ZFEs9cAlWC7djoRAe/iLeRHWmuvKdsCHlK2uqgH7rpCxB Vg+6iMHguU0T9L7MvNFEXdUWPeWo7gQiT/fLh+7wFSeXH96+AYIPxv5kgDUUppj9U1ly 8jcet5me75ETnEfm8fV54+h0VvFlcEBUIhbkDLXcQKtDEJhV0H7ecTGVNx7eUOeVsHg8 d4Did98eklm92NwCWWVtgELMKNeJ17uDrr3aQiuHNgf/Gu4bOs13vhnaSaPNCSRemRsc FacQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1724926831; x=1725531631; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=3lbMpHi+idQrWBFT40ehkUCaBfcILsbcClLsstfOLPw=; b=H1j+E7Lcdyns+aU15it6oaQjR1/tJA03jSgy6DBS9DAXEz0wzSLPdeKFl3kfg5V6K/ uWohj+fKFcMpz8lXsy2LwkpcLlqEyo0ZLF3HO4cyPXVF0uX9t+HRN4JWisBdbyrGGO1M 1HtDAutS8ZuhR+o+YMnGFiGzfvr/bQnvgDwUrmUW2KFth8S8pBOQY6FSJ7+Umaq1Imhv /i+RU9eXhoEmfUMLmcKwFfRiNjH9NqaF8SuOwOU4TD77Rmy6O26vaF3mKXqOiG/GXOnb FjxeccnnNZTWFNarYHG57bvoYxB2nx9ezAylxu+xwZjHE1ylJ2jgUivNvSLKLIiZho9p Dn4w== X-Forwarded-Encrypted: i=1; AJvYcCXKtSSSWIpiYYx23KF7jsgdCGr9ArIjWqgLOYb32SrVbC3fpc6oVYYsDljlicTbq+8U+L1Aa8Tujcg=@lists.freedesktop.org X-Gm-Message-State: AOJu0Yz+blFJSh5+AGym30hDSxDKrT3gPzLaekhGPNl4wZpj5L5HgM8c 63DWXoUzx3lUOI0646kGh9QjY7Lx7M+yQ4duLlUY8wJ2NDaRYk95MI6cl/wI30Q= X-Google-Smtp-Source: AGHT+IFen9Jq7QnLTtz1M24pXV3owljduQ7AzBDQAdlqHW1BLOQlXouMHpCoA0U+fCxUk+qf1Qgf2Q== X-Received: by 2002:a05:6358:b00f:b0:1b5:fc87:f023 with SMTP id e5c5f4694b2df-1b603c4372amr301108555d.13.1724926831326; Thu, 29 Aug 2024 03:20:31 -0700 (PDT) Received: from [127.0.1.1] ([112.65.12.167]) by smtp.gmail.com with ESMTPSA id 41be03b00d2f7-7d22e9d4df4sm891684a12.82.2024.08.29.03.20.25 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 29 Aug 2024 03:20:30 -0700 (PDT) From: Jun Nie Date: Thu, 29 Aug 2024 18:17:39 +0800 Subject: [PATCH 10/21] drm/msm/dpu: fix lm number counter for quad-pipe MIME-Version: 1.0 Message-Id: <20240829-sm8650-v6-11-hmd-pocf-mdss-quad-upstream-8-v1-10-bdb05b4b5a2e@linaro.org> References: <20240829-sm8650-v6-11-hmd-pocf-mdss-quad-upstream-8-v1-0-bdb05b4b5a2e@linaro.org> In-Reply-To: <20240829-sm8650-v6-11-hmd-pocf-mdss-quad-upstream-8-v1-0-bdb05b4b5a2e@linaro.org> To: Rob Clark , Abhinav Kumar , Dmitry Baryshkov , Sean Paul , Marijn Suijten , David Airlie , Daniel Vetter , Maarten Lankhorst , Maxime Ripard , Thomas Zimmermann Cc: linux-arm-msm@vger.kernel.org, dri-devel@lists.freedesktop.org, freedreno@lists.freedesktop.org, linux-kernel@vger.kernel.org, Jun Nie X-Mailer: b4 0.13.0 X-Developer-Signature: v=1; a=ed25519-sha256; t=1724926736; l=2144; i=jun.nie@linaro.org; s=20240403; h=from:subject:message-id; bh=MuxQ5OVXyjEXNTRIAzTsA5+Nkr/OtZrXgpfu/qynNjo=; b=c5oycrwiyxCtgi1nfLY3vtWDhILufF21AgERHS7eIpJZlVfAkbuFpgeVC38YmR06XIUAU4YmN QxzQETH4WtaAYAC2NLpgo2dhnESjmYc43hBzPc03Wxklc0SUMHi6fmq X-Developer-Key: i=jun.nie@linaro.org; a=ed25519; pk=MNiBt/faLPvo+iJoP1hodyY2x6ozVXL8QMptmsKg3cc= X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" Add the case to reserve multiple pair mixer for high resolution Signed-off-by: Jun Nie --- drivers/gpu/drm/msm/disp/dpu1/dpu_encoder.c | 6 +++--- drivers/gpu/drm/msm/disp/dpu1/dpu_rm.c | 8 +++++++- 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/drivers/gpu/drm/msm/disp/dpu1/dpu_encoder.c b/drivers/gpu/drm/msm/disp/dpu1/dpu_encoder.c index 33cfd94badaba..f57725ad494d2 100644 --- a/drivers/gpu/drm/msm/disp/dpu1/dpu_encoder.c +++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_encoder.c @@ -54,7 +54,7 @@ #define MAX_PHYS_ENCODERS_PER_VIRTUAL \ (MAX_H_TILES_PER_DISPLAY * NUM_PHYS_ENCODER_TYPES) -#define MAX_CHANNELS_PER_ENC 2 +#define MAX_CHANNELS_PER_ENC 4 #define IDLE_SHORT_TIMEOUT 1 @@ -2029,8 +2029,8 @@ static void dpu_encoder_helper_reset_mixers(struct dpu_encoder_phys *phys_enc) struct dpu_hw_mixer_cfg mixer; int i, num_lm; struct dpu_global_state *global_state; - struct dpu_hw_blk *hw_lm[2]; - struct dpu_hw_mixer *hw_mixer[2]; + struct dpu_hw_blk *hw_lm[MAX_CHANNELS_PER_ENC]; + struct dpu_hw_mixer *hw_mixer[MAX_CHANNELS_PER_ENC]; struct dpu_hw_ctl *ctl = phys_enc->hw_ctl; memset(&mixer, 0, sizeof(mixer)); diff --git a/drivers/gpu/drm/msm/disp/dpu1/dpu_rm.c b/drivers/gpu/drm/msm/disp/dpu1/dpu_rm.c index e219d706610c2..77d7ff789346e 100644 --- a/drivers/gpu/drm/msm/disp/dpu1/dpu_rm.c +++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_rm.c @@ -306,7 +306,11 @@ static int _dpu_rm_reserve_lms(struct dpu_rm *rm, if (!rm->mixer_blks[i]) continue; - lm_count = 0; + /* + * Clear the last bit to drop the previous primary mixer if + * fail to find its peer. + */ + lm_count &= 0xfe; lm_idx[lm_count] = i; if (!_dpu_rm_check_lm_and_get_connected_blks(rm, global_state, @@ -353,6 +357,8 @@ static int _dpu_rm_reserve_lms(struct dpu_rm *rm, trace_dpu_rm_reserve_lms(lm_idx[i] + LM_0, enc_id, pp_idx[i] + PINGPONG_0); + DPU_DEBUG("reserve lm[%d]:%d, pp_idx[%d]:%d, dspp[%d]:%d for enc_id %d\n", + i, lm_idx[i], i, pp_idx[i], i, dspp_idx[i], enc_id); } return 0; From patchwork Thu Aug 29 10:17:40 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jun Nie X-Patchwork-Id: 13782990 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 75CCEC8302B for ; Thu, 29 Aug 2024 10:20:41 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id E93EB10E626; Thu, 29 Aug 2024 10:20:40 +0000 (UTC) Authentication-Results: gabe.freedesktop.org; dkim=pass (2048-bit key; unprotected) header.d=linaro.org header.i=@linaro.org header.b="QUgvsW2e"; dkim-atps=neutral Received: from mail-ot1-f46.google.com (mail-ot1-f46.google.com [209.85.210.46]) by gabe.freedesktop.org (Postfix) with ESMTPS id 8635C10E624 for ; Thu, 29 Aug 2024 10:20:39 +0000 (UTC) Received: by mail-ot1-f46.google.com with SMTP id 46e09a7af769-70f60d73436so220614a34.1 for ; Thu, 29 Aug 2024 03:20:39 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1724926839; x=1725531639; darn=lists.freedesktop.org; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=1Q+hoiaQgUkbwBnUwr/XhQnF7bzaey6Ce3LFLI7Ja2A=; b=QUgvsW2eTGIL8A1fqcOElKlQfSvNN2QKgbDqofh4vR9dJpJyOGHu4D4DXR7WXxKBil 6W8IYGXNhJ6WlUHRIJS/7H0jviTo4luGmPJ0v9JekXVo68N1XGy6aBuC1UjS3RCA4SyZ DEoVCvOdb12riqJFW4ZB8YAevpHkhxUrgGTO1BaQGTOMZZR+dGmy72jE/1cVQ8eC94LO QgplumOnIUHvVWwZ0+daoLI0naJLhWu2Z9x6RF4uRhVX8lPKIpW91sOEddYh9okGqqmA 1xftezD0L33SPiJv8gadgclzVaZF8wOLMHLzQkQGp1iKe2o9ohY6eMsK0Tpo+qIGpo58 IUmg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1724926839; x=1725531639; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=1Q+hoiaQgUkbwBnUwr/XhQnF7bzaey6Ce3LFLI7Ja2A=; b=J9BGLannDeVUf+R0z1paE83Uh85PheNkG2F5g16c4wQl2dRgbcxItLVdOn4b162j54 KClc7KhOicvzbbO5ZKq7E8k7N8j86OCQwpyx4SKhn6ehiJxzwNXF3YTM8vyizaRvtg8E AIxHEhxzKKNZjOAjp621uqXF7QKNE7HIgWSseWDK0GvYfyeoeq0qqPVYuGi60thzgZYd 16wtELNiriDN/PdeIakxT/n8CVU1ov4joc3o9krs7kmMIw7oWvCU1qtrnR+f+Nwqwc9e jdQVR7eFcb+ICeGXHh16k6wNx0vv8cS+iYsL8AX4a3bh0SWhEKoNaYy0hpjMG1odaOBE sh7w== X-Forwarded-Encrypted: i=1; AJvYcCXQy/SwuZHuzwkyFtJO/1S6V942hmURGWF6TXNego3S6fIBhgBVGACxsz7ja1ZRrUGxMdtn68xpkkE=@lists.freedesktop.org X-Gm-Message-State: AOJu0YyR/69Uk3qAzJSRfFUZsLJP5rPeyPXexv4V+dIOjFyvo/w8azYB 7KKHbZvUgDHEnMEUhMJCoKTiY1qJ6C+iZAFviNIZiLpiCu2UiTRVPwrKyPfq578= X-Google-Smtp-Source: AGHT+IHURAx1tsooOQ3BpeNpvN7C+aX7izExrX/ejBiTLN/buCsOS1Ed3EVamPLK9mdcOKp9oyzFHg== X-Received: by 2002:a05:6358:720d:b0:1b5:a060:678b with SMTP id e5c5f4694b2df-1b603bedfacmr293928955d.3.1724926838743; Thu, 29 Aug 2024 03:20:38 -0700 (PDT) Received: from [127.0.1.1] ([112.65.12.167]) by smtp.gmail.com with ESMTPSA id 41be03b00d2f7-7d22e9d4df4sm891684a12.82.2024.08.29.03.20.31 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 29 Aug 2024 03:20:38 -0700 (PDT) From: Jun Nie Date: Thu, 29 Aug 2024 18:17:40 +0800 Subject: [PATCH 11/21] drm/msm/dpu: Support 4 mixers at most MIME-Version: 1.0 Message-Id: <20240829-sm8650-v6-11-hmd-pocf-mdss-quad-upstream-8-v1-11-bdb05b4b5a2e@linaro.org> References: <20240829-sm8650-v6-11-hmd-pocf-mdss-quad-upstream-8-v1-0-bdb05b4b5a2e@linaro.org> In-Reply-To: <20240829-sm8650-v6-11-hmd-pocf-mdss-quad-upstream-8-v1-0-bdb05b4b5a2e@linaro.org> To: Rob Clark , Abhinav Kumar , Dmitry Baryshkov , Sean Paul , Marijn Suijten , David Airlie , Daniel Vetter , Maarten Lankhorst , Maxime Ripard , Thomas Zimmermann Cc: linux-arm-msm@vger.kernel.org, dri-devel@lists.freedesktop.org, freedreno@lists.freedesktop.org, linux-kernel@vger.kernel.org, Jun Nie X-Mailer: b4 0.13.0 X-Developer-Signature: v=1; a=ed25519-sha256; t=1724926736; l=2904; i=jun.nie@linaro.org; s=20240403; h=from:subject:message-id; bh=kZcvFgM7BrpSSre+N3AhgJe8dih69TpaDCUeGk49yQg=; b=mFqZD0eT2dw9oeR2ZHc0FiJ57u/AjSO6ItzK6quKx8cKBjBQSZcjkn0eto2YSWy861soD7tvs 4mW+Vaq5lU8A//Ocif+sSqA4ajsQ0iqXDMNcWh8CU+Q4fsNjOfNLRbn X-Developer-Key: i=jun.nie@linaro.org; a=ed25519; pk=MNiBt/faLPvo+iJoP1hodyY2x6ozVXL8QMptmsKg3cc= X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" Support 4 mixers case with increasing array size and checking the usage case. Signed-off-by: Jun Nie --- drivers/gpu/drm/msm/disp/dpu1/dpu_crtc.c | 2 +- drivers/gpu/drm/msm/disp/dpu1/dpu_crtc.h | 6 +++--- drivers/gpu/drm/msm/disp/dpu1/dpu_encoder_phys.h | 3 ++- drivers/gpu/drm/msm/disp/dpu1/dpu_hw_catalog.h | 1 + 4 files changed, 7 insertions(+), 5 deletions(-) diff --git a/drivers/gpu/drm/msm/disp/dpu1/dpu_crtc.c b/drivers/gpu/drm/msm/disp/dpu1/dpu_crtc.c index d9f26e189eebf..2c21a1e13d32f 100644 --- a/drivers/gpu/drm/msm/disp/dpu1/dpu_crtc.c +++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_crtc.c @@ -200,7 +200,7 @@ static int dpu_crtc_get_lm_crc(struct drm_crtc *crtc, struct dpu_crtc_state *crtc_state) { struct dpu_crtc_mixer *m; - u32 crcs[CRTC_DUAL_MIXERS]; + u32 crcs[CRTC_QUAD_MIXERS]; int rc = 0; int i; diff --git a/drivers/gpu/drm/msm/disp/dpu1/dpu_crtc.h b/drivers/gpu/drm/msm/disp/dpu1/dpu_crtc.h index 701c35803633d..08fc88d03bf6c 100644 --- a/drivers/gpu/drm/msm/disp/dpu1/dpu_crtc.h +++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_crtc.h @@ -210,7 +210,7 @@ struct dpu_crtc_state { bool bw_control; bool bw_split_vote; - struct drm_rect lm_bounds[CRTC_DUAL_MIXERS]; + struct drm_rect lm_bounds[CRTC_QUAD_MIXERS]; uint64_t input_fence_timeout_ns; @@ -218,10 +218,10 @@ struct dpu_crtc_state { /* HW Resources reserved for the crtc */ u32 num_mixers; - struct dpu_crtc_mixer mixers[CRTC_DUAL_MIXERS]; + struct dpu_crtc_mixer mixers[CRTC_QUAD_MIXERS]; u32 num_ctls; - struct dpu_hw_ctl *hw_ctls[CRTC_DUAL_MIXERS]; + struct dpu_hw_ctl *hw_ctls[CRTC_QUAD_MIXERS]; enum dpu_crtc_crc_source crc_source; int crc_frame_skip_count; diff --git a/drivers/gpu/drm/msm/disp/dpu1/dpu_encoder_phys.h b/drivers/gpu/drm/msm/disp/dpu1/dpu_encoder_phys.h index e77ebe3a68da9..c877ee45535ac 100644 --- a/drivers/gpu/drm/msm/disp/dpu1/dpu_encoder_phys.h +++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_encoder_phys.h @@ -324,7 +324,8 @@ static inline enum dpu_3d_blend_mode dpu_encoder_helper_get_3d_blend_mode( /* Use merge_3d unless DSC MERGE topology is used */ if (phys_enc->split_role == ENC_ROLE_SOLO && - dpu_cstate->num_mixers == CRTC_DUAL_MIXERS && + (dpu_cstate->num_mixers == CRTC_DUAL_MIXERS || + dpu_cstate->num_mixers == CRTC_QUAD_MIXERS) && !dpu_encoder_use_dsc_merge(phys_enc->parent)) return BLEND_3D_H_ROW_INT; diff --git a/drivers/gpu/drm/msm/disp/dpu1/dpu_hw_catalog.h b/drivers/gpu/drm/msm/disp/dpu1/dpu_hw_catalog.h index bf86d643887dd..f79ecd409a830 100644 --- a/drivers/gpu/drm/msm/disp/dpu1/dpu_hw_catalog.h +++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_hw_catalog.h @@ -25,6 +25,7 @@ #define MAX_IMG_HEIGHT 0x3fff #define CRTC_DUAL_MIXERS 2 +#define CRTC_QUAD_MIXERS 4 #define MAX_XIN_COUNT 16 From patchwork Thu Aug 29 10:17:41 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jun Nie X-Patchwork-Id: 13782991 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 35A4AC83030 for ; Thu, 29 Aug 2024 10:20:50 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id AD86A10E624; Thu, 29 Aug 2024 10:20:49 +0000 (UTC) Authentication-Results: gabe.freedesktop.org; dkim=pass (2048-bit key; unprotected) header.d=linaro.org header.i=@linaro.org header.b="puED/BRi"; dkim-atps=neutral Received: from mail-ot1-f50.google.com (mail-ot1-f50.google.com [209.85.210.50]) by gabe.freedesktop.org (Postfix) with ESMTPS id E95E210E627 for ; Thu, 29 Aug 2024 10:20:48 +0000 (UTC) Received: by mail-ot1-f50.google.com with SMTP id 46e09a7af769-70cb1b959a6so265186a34.3 for ; Thu, 29 Aug 2024 03:20:48 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1724926848; x=1725531648; darn=lists.freedesktop.org; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=YXJUqrx+UV5Y9Q9kChrmqmxRtCbD2xoa+NBPBC3/478=; b=puED/BRiemrs/TQZXeTVxWRO8IZDI3MJAaL3/ljDblUZjdBIPjmES7/2cUwpdYfW4d QAINETxRTmYBQyoezsUoOM5JcI5bGGZrMNmTIQyZDezivcihSRlRBYuDeIpGYUxBfsE6 jP6wNbAnn7WtVCHwHmBZV8tgPruuFI3gJtIGulcV1un8/bf2X/5pYX+Mc+ATvbYxpfR9 9MZCclzEycv+4eqtlpaftdUJSAxPvCAwDJnUKwz4B4W9Hxgu9nghYTHHCwHSi13TOeZw yHehe5mYPKRx5yz0LPlSYpjzEoxT8CwWTMS8AzXqonqi6Y1Q9TEsYoDR6YuOOBimL6Ti rYmQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1724926848; x=1725531648; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=YXJUqrx+UV5Y9Q9kChrmqmxRtCbD2xoa+NBPBC3/478=; b=DELvNDmAUgztkaORl6YBxUH0AbmuJBHQInle5KtLj0dO9oVbA6BxAF0OTUR0HtfoRa TnrekVtA8mA77iz77GUZWePgxU/z/GSEwlZgHeSVngQcwAKfrDjnAFN/TQlxwlLM4Neo 3DNAgHce6adEpPddjsuewVjVj3dVE18s2HU+mfMsT4aUAbllkxrqDUuQJKXro5rw3HiB 6UnVRCVdPB/4D6BheMLe8PiJKpLWpEQgOcCGPV+qbk2pAmhS8C4IeoOPDuJ2BaHDNldJ qU3yAJbvRo+ZKZ+0lkPAEx+BFpFFxmkQuMVXNyMVyvED8KlLLamul9oVFXg0id8MWPrQ 5Xag== X-Forwarded-Encrypted: i=1; AJvYcCUyhT3WAcIZ/TBBOlcXuPHrj03Ne24KjNUttiR/PNXySGSF1i0fh2Q232VMLinKEzyCnNBXDuqCxwY=@lists.freedesktop.org X-Gm-Message-State: AOJu0Yz22K37f1O5vvMKM3yLAc+Epwz+8yhE80vMjrKf4oT8St941IjR wu4MTyHVwDQtgSwQ6LEQ1puOLAKlX23A9gO/SS0G05hV8HzJnvCxk0oM5DRvmng= X-Google-Smtp-Source: AGHT+IGPU4anJfJQvzQDJn/MZxPgJfJqs2lrFSXpVrJUQ5Av558yw/upzcXRgv0zZRJ6e+CJP1vJMg== X-Received: by 2002:a05:6358:e49a:b0:1ad:471:9b7 with SMTP id e5c5f4694b2df-1b603c3af46mr292162355d.18.1724926847953; Thu, 29 Aug 2024 03:20:47 -0700 (PDT) Received: from [127.0.1.1] ([112.65.12.167]) by smtp.gmail.com with ESMTPSA id 41be03b00d2f7-7d22e9d4df4sm891684a12.82.2024.08.29.03.20.39 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 29 Aug 2024 03:20:47 -0700 (PDT) From: Jun Nie Date: Thu, 29 Aug 2024 18:17:41 +0800 Subject: [PATCH 12/21] drm/msm/dpu: switch RM to use crtc_id rather than enc_id for allocation MIME-Version: 1.0 Message-Id: <20240829-sm8650-v6-11-hmd-pocf-mdss-quad-upstream-8-v1-12-bdb05b4b5a2e@linaro.org> References: <20240829-sm8650-v6-11-hmd-pocf-mdss-quad-upstream-8-v1-0-bdb05b4b5a2e@linaro.org> In-Reply-To: <20240829-sm8650-v6-11-hmd-pocf-mdss-quad-upstream-8-v1-0-bdb05b4b5a2e@linaro.org> To: Rob Clark , Abhinav Kumar , Dmitry Baryshkov , Sean Paul , Marijn Suijten , David Airlie , Daniel Vetter , Maarten Lankhorst , Maxime Ripard , Thomas Zimmermann Cc: linux-arm-msm@vger.kernel.org, dri-devel@lists.freedesktop.org, freedreno@lists.freedesktop.org, linux-kernel@vger.kernel.org, Jun Nie X-Mailer: b4 0.13.0 X-Developer-Signature: v=1; a=ed25519-sha256; t=1724926736; l=25817; i=jun.nie@linaro.org; s=20240403; h=from:subject:message-id; bh=Bu2HVVTgMjnhk5Qq58H2r8E1MiJErBK1iIMTLBeo7Ms=; b=nWjWQUhev9TovyLt4kBoAgF4zHl6y43CP0YqVMO3DGCrYwm8wZmsQdEFdU7iiGhvhj4JZqdWm ib+rdxa2jc4B2OBDLXzxkfaMIS8S4AEUeeaEQTJsieUSYC4oMZjvCBV X-Developer-Key: i=jun.nie@linaro.org; a=ed25519; pk=MNiBt/faLPvo+iJoP1hodyY2x6ozVXL8QMptmsKg3cc= X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" Up to now the driver has been using encoder to allocate hardware resources. Switch it to use CRTC id so that mixer number can be known in dpu_plane_virtual_assign_resources() via CRTC id for sspp alloation. Because the mixer allocation is done in drm_atomic_helper_check_modeset() as part of CRTC operation. While the sspp assignment is in drm_atomic_helper_check_planes() call tree. So CRTC is more central than encoder. Siwtching the id achieves above goal. Co-developed-by: Dmitry Baryshkov Signed-off-by: Dmitry Baryshkov Signed-off-by: Jun Nie --- drivers/gpu/drm/msm/disp/dpu1/dpu_encoder.c | 18 +-- drivers/gpu/drm/msm/disp/dpu1/dpu_kms.h | 12 +- drivers/gpu/drm/msm/disp/dpu1/dpu_rm.c | 190 +++++++++++++--------------- drivers/gpu/drm/msm/disp/dpu1/dpu_rm.h | 19 ++- 4 files changed, 115 insertions(+), 124 deletions(-) diff --git a/drivers/gpu/drm/msm/disp/dpu1/dpu_encoder.c b/drivers/gpu/drm/msm/disp/dpu1/dpu_encoder.c index f57725ad494d2..76793201b984e 100644 --- a/drivers/gpu/drm/msm/disp/dpu1/dpu_encoder.c +++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_encoder.c @@ -703,11 +703,11 @@ static int dpu_encoder_virt_atomic_check( * Dont allocate when active is false. */ if (drm_atomic_crtc_needs_modeset(crtc_state)) { - dpu_rm_release(global_state, drm_enc); + dpu_rm_release(global_state, crtc_state->crtc); if (!crtc_state->active_changed || crtc_state->enable) ret = dpu_rm_reserve(&dpu_kms->rm, global_state, - drm_enc, crtc_state, topology); + crtc_state->crtc, topology); } trace_dpu_enc_atomic_check_flags(DRMID(drm_enc), adj_mode->flags); @@ -1141,14 +1141,14 @@ static void dpu_encoder_virt_atomic_mode_set(struct drm_encoder *drm_enc, /* Query resource that have been reserved in atomic check step. */ num_pp = dpu_rm_get_assigned_resources(&dpu_kms->rm, global_state, - drm_enc->base.id, DPU_HW_BLK_PINGPONG, hw_pp, + drm_enc->crtc, DPU_HW_BLK_PINGPONG, hw_pp, ARRAY_SIZE(hw_pp)); num_ctl = dpu_rm_get_assigned_resources(&dpu_kms->rm, global_state, - drm_enc->base.id, DPU_HW_BLK_CTL, hw_ctl, ARRAY_SIZE(hw_ctl)); + drm_enc->crtc, DPU_HW_BLK_CTL, hw_ctl, ARRAY_SIZE(hw_ctl)); num_lm = dpu_rm_get_assigned_resources(&dpu_kms->rm, global_state, - drm_enc->base.id, DPU_HW_BLK_LM, hw_lm, ARRAY_SIZE(hw_lm)); + drm_enc->crtc, DPU_HW_BLK_LM, hw_lm, ARRAY_SIZE(hw_lm)); dpu_rm_get_assigned_resources(&dpu_kms->rm, global_state, - drm_enc->base.id, DPU_HW_BLK_DSPP, hw_dspp, + drm_enc->crtc, DPU_HW_BLK_DSPP, hw_dspp, ARRAY_SIZE(hw_dspp)); for (i = 0; i < MAX_CHANNELS_PER_ENC; i++) @@ -1156,7 +1156,7 @@ static void dpu_encoder_virt_atomic_mode_set(struct drm_encoder *drm_enc, : NULL; num_dsc = dpu_rm_get_assigned_resources(&dpu_kms->rm, global_state, - drm_enc->base.id, DPU_HW_BLK_DSC, + drm_enc->crtc, DPU_HW_BLK_DSC, hw_dsc, ARRAY_SIZE(hw_dsc)); for (i = 0; i < num_dsc; i++) { dpu_enc->hw_dsc[i] = to_dpu_hw_dsc(hw_dsc[i]); @@ -1170,7 +1170,7 @@ static void dpu_encoder_virt_atomic_mode_set(struct drm_encoder *drm_enc, struct dpu_hw_blk *hw_cdm = NULL; dpu_rm_get_assigned_resources(&dpu_kms->rm, global_state, - drm_enc->base.id, DPU_HW_BLK_CDM, + drm_enc->crtc, DPU_HW_BLK_CDM, &hw_cdm, 1); dpu_enc->cur_master->hw_cdm = hw_cdm ? to_dpu_hw_cdm(hw_cdm) : NULL; } @@ -2042,7 +2042,7 @@ static void dpu_encoder_helper_reset_mixers(struct dpu_encoder_phys *phys_enc) global_state = dpu_kms_get_existing_global_state(phys_enc->dpu_kms); num_lm = dpu_rm_get_assigned_resources(&phys_enc->dpu_kms->rm, global_state, - phys_enc->parent->base.id, DPU_HW_BLK_LM, hw_lm, ARRAY_SIZE(hw_lm)); + phys_enc->parent->crtc, DPU_HW_BLK_LM, hw_lm, ARRAY_SIZE(hw_lm)); for (i = 0; i < num_lm; i++) { hw_mixer[i] = to_dpu_hw_mixer(hw_lm[i]); diff --git a/drivers/gpu/drm/msm/disp/dpu1/dpu_kms.h b/drivers/gpu/drm/msm/disp/dpu1/dpu_kms.h index 1952576600575..4f0fa1596b414 100644 --- a/drivers/gpu/drm/msm/disp/dpu1/dpu_kms.h +++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_kms.h @@ -134,12 +134,12 @@ struct dpu_global_state { struct dpu_rm *rm; - uint32_t pingpong_to_enc_id[PINGPONG_MAX - PINGPONG_0]; - uint32_t mixer_to_enc_id[LM_MAX - LM_0]; - uint32_t ctl_to_enc_id[CTL_MAX - CTL_0]; - uint32_t dspp_to_enc_id[DSPP_MAX - DSPP_0]; - uint32_t dsc_to_enc_id[DSC_MAX - DSC_0]; - uint32_t cdm_to_enc_id; + uint32_t pingpong_to_crtc_id[PINGPONG_MAX - PINGPONG_0]; + uint32_t mixer_to_crtc_id[LM_MAX - LM_0]; + uint32_t ctl_to_crtc_id[CTL_MAX - CTL_0]; + uint32_t dspp_to_crtc_id[DSPP_MAX - DSPP_0]; + uint32_t dsc_to_crtc_id[DSC_MAX - DSC_0]; + uint32_t cdm_to_crtc_id; uint32_t sspp_to_crtc_id[SSPP_MAX - SSPP_NONE]; }; diff --git a/drivers/gpu/drm/msm/disp/dpu1/dpu_rm.c b/drivers/gpu/drm/msm/disp/dpu1/dpu_rm.c index 77d7ff789346e..bb8ba609f5c9b 100644 --- a/drivers/gpu/drm/msm/disp/dpu1/dpu_rm.c +++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_rm.c @@ -21,9 +21,9 @@ static inline bool reserved_by_other(uint32_t *res_map, int idx, - uint32_t enc_id) + uint32_t crtc_id) { - return res_map[idx] && res_map[idx] != enc_id; + return res_map[idx] && res_map[idx] != crtc_id; } /** @@ -225,7 +225,7 @@ static int _dpu_rm_get_lm_peer(struct dpu_rm *rm, int primary_idx) * pingpong * @rm: dpu resource manager handle * @global_state: resources shared across multiple kms objects - * @enc_id: encoder id requesting for allocation + * @crtc_id: crtc id requesting for allocation * @lm_idx: index of proposed layer mixer in rm->mixer_blks[], function checks * if lm, and all other hardwired blocks connected to the lm (pp) is * available and appropriate @@ -239,14 +239,14 @@ static int _dpu_rm_get_lm_peer(struct dpu_rm *rm, int primary_idx) */ static bool _dpu_rm_check_lm_and_get_connected_blks(struct dpu_rm *rm, struct dpu_global_state *global_state, - uint32_t enc_id, int lm_idx, int *pp_idx, int *dspp_idx, + uint32_t crtc_id, int lm_idx, int *pp_idx, int *dspp_idx, struct dpu_rm_requirements *reqs) { const struct dpu_lm_cfg *lm_cfg; int idx; /* Already reserved? */ - if (reserved_by_other(global_state->mixer_to_enc_id, lm_idx, enc_id)) { + if (reserved_by_other(global_state->mixer_to_crtc_id, lm_idx, crtc_id)) { DPU_DEBUG("lm %d already reserved\n", lm_idx + LM_0); return false; } @@ -258,7 +258,7 @@ static bool _dpu_rm_check_lm_and_get_connected_blks(struct dpu_rm *rm, return false; } - if (reserved_by_other(global_state->pingpong_to_enc_id, idx, enc_id)) { + if (reserved_by_other(global_state->pingpong_to_crtc_id, idx, crtc_id)) { DPU_DEBUG("lm %d pp %d already reserved\n", lm_cfg->id, lm_cfg->pingpong); return false; @@ -274,7 +274,7 @@ static bool _dpu_rm_check_lm_and_get_connected_blks(struct dpu_rm *rm, return false; } - if (reserved_by_other(global_state->dspp_to_enc_id, idx, enc_id)) { + if (reserved_by_other(global_state->dspp_to_crtc_id, idx, crtc_id)) { DPU_DEBUG("lm %d dspp %d already reserved\n", lm_cfg->id, lm_cfg->dspp); return false; @@ -286,7 +286,7 @@ static bool _dpu_rm_check_lm_and_get_connected_blks(struct dpu_rm *rm, static int _dpu_rm_reserve_lms(struct dpu_rm *rm, struct dpu_global_state *global_state, - uint32_t enc_id, + uint32_t crtc_id, struct dpu_rm_requirements *reqs) { @@ -314,7 +314,7 @@ static int _dpu_rm_reserve_lms(struct dpu_rm *rm, lm_idx[lm_count] = i; if (!_dpu_rm_check_lm_and_get_connected_blks(rm, global_state, - enc_id, i, &pp_idx[lm_count], + crtc_id, i, &pp_idx[lm_count], &dspp_idx[lm_count], reqs)) { continue; } @@ -333,7 +333,7 @@ static int _dpu_rm_reserve_lms(struct dpu_rm *rm, continue; if (!_dpu_rm_check_lm_and_get_connected_blks(rm, - global_state, enc_id, j, + global_state, crtc_id, j, &pp_idx[lm_count], &dspp_idx[lm_count], reqs)) { continue; @@ -350,15 +350,15 @@ static int _dpu_rm_reserve_lms(struct dpu_rm *rm, } for (i = 0; i < lm_count; i++) { - global_state->mixer_to_enc_id[lm_idx[i]] = enc_id; - global_state->pingpong_to_enc_id[pp_idx[i]] = enc_id; - global_state->dspp_to_enc_id[dspp_idx[i]] = - reqs->topology.num_dspp ? enc_id : 0; + global_state->mixer_to_crtc_id[lm_idx[i]] = crtc_id; + global_state->pingpong_to_crtc_id[pp_idx[i]] = crtc_id; + global_state->dspp_to_crtc_id[dspp_idx[i]] = + reqs->topology.num_dspp ? crtc_id : 0; - trace_dpu_rm_reserve_lms(lm_idx[i] + LM_0, enc_id, + trace_dpu_rm_reserve_lms(lm_idx[i] + LM_0, crtc_id, pp_idx[i] + PINGPONG_0); - DPU_DEBUG("reserve lm[%d]:%d, pp_idx[%d]:%d, dspp[%d]:%d for enc_id %d\n", - i, lm_idx[i], i, pp_idx[i], i, dspp_idx[i], enc_id); + DPU_DEBUG("reserve lm[%d]:%d, pp_idx[%d]:%d, dspp[%d]:%d for crtc_id %d\n", + i, lm_idx[i], i, pp_idx[i], i, dspp_idx[i], crtc_id); } return 0; @@ -367,7 +367,7 @@ static int _dpu_rm_reserve_lms(struct dpu_rm *rm, static int _dpu_rm_reserve_ctls( struct dpu_rm *rm, struct dpu_global_state *global_state, - uint32_t enc_id, + uint32_t crtc_id, const struct msm_display_topology *top) { int ctl_idx[MAX_BLOCKS]; @@ -391,7 +391,7 @@ static int _dpu_rm_reserve_ctls( if (!rm->ctl_blks[j]) continue; - if (reserved_by_other(global_state->ctl_to_enc_id, j, enc_id)) + if (reserved_by_other(global_state->ctl_to_crtc_id, j, crtc_id)) continue; ctl = to_dpu_hw_ctl(rm->ctl_blks[j]); @@ -415,8 +415,8 @@ static int _dpu_rm_reserve_ctls( return -ENAVAIL; for (i = 0; i < ARRAY_SIZE(ctl_idx) && i < num_ctls; i++) { - global_state->ctl_to_enc_id[ctl_idx[i]] = enc_id; - trace_dpu_rm_reserve_ctls(i + CTL_0, enc_id); + global_state->ctl_to_crtc_id[ctl_idx[i]] = crtc_id; + trace_dpu_rm_reserve_ctls(i + CTL_0, crtc_id); } return 0; @@ -424,12 +424,12 @@ static int _dpu_rm_reserve_ctls( static int _dpu_rm_pingpong_next_index(struct dpu_global_state *global_state, int start, - uint32_t enc_id) + uint32_t crtc_id) { int i; for (i = start; i < (PINGPONG_MAX - PINGPONG_0); i++) { - if (global_state->pingpong_to_enc_id[i] == enc_id) + if (global_state->pingpong_to_crtc_id[i] == crtc_id) return i; } @@ -450,7 +450,7 @@ static int _dpu_rm_pingpong_dsc_check(int dsc_idx, int pp_idx) static int _dpu_rm_dsc_alloc(struct dpu_rm *rm, struct dpu_global_state *global_state, - uint32_t enc_id, + uint32_t crtc_id, const struct msm_display_topology *top) { int num_dsc = 0; @@ -463,10 +463,10 @@ static int _dpu_rm_dsc_alloc(struct dpu_rm *rm, if (!rm->dsc_blks[dsc_idx]) continue; - if (reserved_by_other(global_state->dsc_to_enc_id, dsc_idx, enc_id)) + if (reserved_by_other(global_state->dsc_to_crtc_id, dsc_idx, crtc_id)) continue; - pp_idx = _dpu_rm_pingpong_next_index(global_state, pp_idx, enc_id); + pp_idx = _dpu_rm_pingpong_next_index(global_state, pp_idx, crtc_id); if (pp_idx < 0) return -ENAVAIL; @@ -474,7 +474,7 @@ static int _dpu_rm_dsc_alloc(struct dpu_rm *rm, if (ret) return -ENAVAIL; - global_state->dsc_to_enc_id[dsc_idx] = enc_id; + global_state->dsc_to_crtc_id[dsc_idx] = crtc_id; num_dsc++; pp_idx++; } @@ -490,7 +490,7 @@ static int _dpu_rm_dsc_alloc(struct dpu_rm *rm, static int _dpu_rm_dsc_alloc_pair(struct dpu_rm *rm, struct dpu_global_state *global_state, - uint32_t enc_id, + uint32_t crtc_id, const struct msm_display_topology *top) { int num_dsc = 0; @@ -505,11 +505,11 @@ static int _dpu_rm_dsc_alloc_pair(struct dpu_rm *rm, continue; /* consective dsc index to be paired */ - if (reserved_by_other(global_state->dsc_to_enc_id, dsc_idx, enc_id) || - reserved_by_other(global_state->dsc_to_enc_id, dsc_idx + 1, enc_id)) + if (reserved_by_other(global_state->dsc_to_crtc_id, dsc_idx, crtc_id) || + reserved_by_other(global_state->dsc_to_crtc_id, dsc_idx + 1, crtc_id)) continue; - pp_idx = _dpu_rm_pingpong_next_index(global_state, pp_idx, enc_id); + pp_idx = _dpu_rm_pingpong_next_index(global_state, pp_idx, crtc_id); if (pp_idx < 0) return -ENAVAIL; @@ -519,7 +519,7 @@ static int _dpu_rm_dsc_alloc_pair(struct dpu_rm *rm, continue; } - pp_idx = _dpu_rm_pingpong_next_index(global_state, pp_idx + 1, enc_id); + pp_idx = _dpu_rm_pingpong_next_index(global_state, pp_idx + 1, crtc_id); if (pp_idx < 0) return -ENAVAIL; @@ -529,8 +529,8 @@ static int _dpu_rm_dsc_alloc_pair(struct dpu_rm *rm, continue; } - global_state->dsc_to_enc_id[dsc_idx] = enc_id; - global_state->dsc_to_enc_id[dsc_idx + 1] = enc_id; + global_state->dsc_to_crtc_id[dsc_idx] = crtc_id; + global_state->dsc_to_crtc_id[dsc_idx + 1] = crtc_id; num_dsc += 2; pp_idx++; /* start for next pair */ } @@ -546,11 +546,9 @@ static int _dpu_rm_dsc_alloc_pair(struct dpu_rm *rm, static int _dpu_rm_reserve_dsc(struct dpu_rm *rm, struct dpu_global_state *global_state, - struct drm_encoder *enc, + uint32_t crtc_id, const struct msm_display_topology *top) { - uint32_t enc_id = enc->base.id; - if (!top->num_dsc || !top->num_intf) return 0; @@ -560,22 +558,22 @@ static int _dpu_rm_reserve_dsc(struct dpu_rm *rm, * 2) DSC pair starts from even index, such as index(0,1), (2,3), etc * 3) even PINGPONG connects to even DSC * 4) odd PINGPONG connects to odd DSC - * 5) pair: encoder +--> pp_idx_0 --> dsc_idx_0 + * 5) pair: crtc +--> pp_idx_0 --> dsc_idx_0 * +--> pp_idx_1 --> dsc_idx_1 */ /* num_dsc should be either 1, 2 or 4 */ if (top->num_dsc > top->num_intf) /* merge mode */ - return _dpu_rm_dsc_alloc_pair(rm, global_state, enc_id, top); + return _dpu_rm_dsc_alloc_pair(rm, global_state, crtc_id, top); else - return _dpu_rm_dsc_alloc(rm, global_state, enc_id, top); + return _dpu_rm_dsc_alloc(rm, global_state, crtc_id, top); return 0; } static int _dpu_rm_reserve_cdm(struct dpu_rm *rm, struct dpu_global_state *global_state, - struct drm_encoder *enc) + uint32_t crtc_id) { /* try allocating only one CDM block */ if (!rm->cdm_blk) { @@ -583,12 +581,12 @@ static int _dpu_rm_reserve_cdm(struct dpu_rm *rm, return -EIO; } - if (global_state->cdm_to_enc_id) { + if (global_state->cdm_to_crtc_id) { DPU_ERROR("CDM_0 is already allocated\n"); return -EIO; } - global_state->cdm_to_enc_id = enc->base.id; + global_state->cdm_to_crtc_id = crtc_id; return 0; } @@ -596,30 +594,30 @@ static int _dpu_rm_reserve_cdm(struct dpu_rm *rm, static int _dpu_rm_make_reservation( struct dpu_rm *rm, struct dpu_global_state *global_state, - struct drm_encoder *enc, + uint32_t crtc_id, struct dpu_rm_requirements *reqs) { int ret; - ret = _dpu_rm_reserve_lms(rm, global_state, enc->base.id, reqs); + ret = _dpu_rm_reserve_lms(rm, global_state, crtc_id, reqs); if (ret) { DPU_ERROR("unable to find appropriate mixers\n"); return ret; } - ret = _dpu_rm_reserve_ctls(rm, global_state, enc->base.id, + ret = _dpu_rm_reserve_ctls(rm, global_state, crtc_id, &reqs->topology); if (ret) { DPU_ERROR("unable to find appropriate CTL\n"); return ret; } - ret = _dpu_rm_reserve_dsc(rm, global_state, enc, &reqs->topology); + ret = _dpu_rm_reserve_dsc(rm, global_state, crtc_id, &reqs->topology); if (ret) return ret; if (reqs->topology.needs_cdm) { - ret = _dpu_rm_reserve_cdm(rm, global_state, enc); + ret = _dpu_rm_reserve_cdm(rm, global_state, crtc_id); if (ret) { DPU_ERROR("unable to find CDM blk\n"); return ret; @@ -630,7 +628,7 @@ static int _dpu_rm_make_reservation( } static int _dpu_rm_populate_requirements( - struct drm_encoder *enc, + struct drm_crtc *crtc, struct dpu_rm_requirements *reqs, struct msm_display_topology req_topology) { @@ -644,66 +642,59 @@ static int _dpu_rm_populate_requirements( } static void _dpu_rm_clear_mapping(uint32_t *res_mapping, int cnt, - uint32_t enc_id) + uint32_t crtc_id) { int i; for (i = 0; i < cnt; i++) { - if (res_mapping[i] == enc_id) + if (res_mapping[i] == crtc_id) res_mapping[i] = 0; } } void dpu_rm_release(struct dpu_global_state *global_state, - struct drm_encoder *enc) + struct drm_crtc *crtc) { - _dpu_rm_clear_mapping(global_state->pingpong_to_enc_id, - ARRAY_SIZE(global_state->pingpong_to_enc_id), enc->base.id); - _dpu_rm_clear_mapping(global_state->mixer_to_enc_id, - ARRAY_SIZE(global_state->mixer_to_enc_id), enc->base.id); - _dpu_rm_clear_mapping(global_state->ctl_to_enc_id, - ARRAY_SIZE(global_state->ctl_to_enc_id), enc->base.id); - _dpu_rm_clear_mapping(global_state->dsc_to_enc_id, - ARRAY_SIZE(global_state->dsc_to_enc_id), enc->base.id); - _dpu_rm_clear_mapping(global_state->dspp_to_enc_id, - ARRAY_SIZE(global_state->dspp_to_enc_id), enc->base.id); - _dpu_rm_clear_mapping(&global_state->cdm_to_enc_id, 1, enc->base.id); + uint32_t crtc_id = crtc->base.id; + + _dpu_rm_clear_mapping(global_state->pingpong_to_crtc_id, + ARRAY_SIZE(global_state->pingpong_to_crtc_id), crtc_id); + _dpu_rm_clear_mapping(global_state->mixer_to_crtc_id, + ARRAY_SIZE(global_state->mixer_to_crtc_id), crtc_id); + _dpu_rm_clear_mapping(global_state->ctl_to_crtc_id, + ARRAY_SIZE(global_state->ctl_to_crtc_id), crtc_id); + _dpu_rm_clear_mapping(global_state->dsc_to_crtc_id, + ARRAY_SIZE(global_state->dsc_to_crtc_id), crtc_id); + _dpu_rm_clear_mapping(global_state->dspp_to_crtc_id, + ARRAY_SIZE(global_state->dspp_to_crtc_id), crtc_id); } int dpu_rm_reserve( struct dpu_rm *rm, struct dpu_global_state *global_state, - struct drm_encoder *enc, - struct drm_crtc_state *crtc_state, + struct drm_crtc *crtc, struct msm_display_topology topology) { struct dpu_rm_requirements reqs; int ret; - /* Check if this is just a page-flip */ - if (!drm_atomic_crtc_needs_modeset(crtc_state)) - return 0; - if (IS_ERR(global_state)) { DPU_ERROR("failed to global state\n"); return PTR_ERR(global_state); } - DRM_DEBUG_KMS("reserving hw for enc %d crtc %d\n", - enc->base.id, crtc_state->crtc->base.id); + DRM_DEBUG_KMS("reserving hw for crtc %d\n", crtc->base.id); - ret = _dpu_rm_populate_requirements(enc, &reqs, topology); + ret = _dpu_rm_populate_requirements(crtc, &reqs, topology); if (ret) { DPU_ERROR("failed to populate hw requirements\n"); return ret; } - ret = _dpu_rm_make_reservation(rm, global_state, enc, &reqs); + ret = _dpu_rm_make_reservation(rm, global_state, crtc->base.id, &reqs); if (ret) DPU_ERROR("failed to reserve hw resources: %d\n", ret); - - return ret; } @@ -800,42 +791,43 @@ static char *dpu_hw_blk_type_name[] = { }; int dpu_rm_get_assigned_resources(struct dpu_rm *rm, - struct dpu_global_state *global_state, uint32_t enc_id, + struct dpu_global_state *global_state, struct drm_crtc *crtc, enum dpu_hw_blk_type type, struct dpu_hw_blk **blks, int blks_size) { + uint32_t crtc_id = crtc->base.id; struct dpu_hw_blk **hw_blks; - uint32_t *hw_to_enc_id; + uint32_t *hw_to_crtc_id; int i, num_blks, max_blks; switch (type) { case DPU_HW_BLK_PINGPONG: hw_blks = rm->pingpong_blks; - hw_to_enc_id = global_state->pingpong_to_enc_id; + hw_to_crtc_id = global_state->pingpong_to_crtc_id; max_blks = ARRAY_SIZE(rm->pingpong_blks); break; case DPU_HW_BLK_LM: hw_blks = rm->mixer_blks; - hw_to_enc_id = global_state->mixer_to_enc_id; + hw_to_crtc_id = global_state->mixer_to_crtc_id; max_blks = ARRAY_SIZE(rm->mixer_blks); break; case DPU_HW_BLK_CTL: hw_blks = rm->ctl_blks; - hw_to_enc_id = global_state->ctl_to_enc_id; + hw_to_crtc_id = global_state->ctl_to_crtc_id; max_blks = ARRAY_SIZE(rm->ctl_blks); break; case DPU_HW_BLK_DSPP: hw_blks = rm->dspp_blks; - hw_to_enc_id = global_state->dspp_to_enc_id; + hw_to_crtc_id = global_state->dspp_to_crtc_id; max_blks = ARRAY_SIZE(rm->dspp_blks); break; case DPU_HW_BLK_DSC: hw_blks = rm->dsc_blks; - hw_to_enc_id = global_state->dsc_to_enc_id; + hw_to_crtc_id = global_state->dsc_to_crtc_id; max_blks = ARRAY_SIZE(rm->dsc_blks); break; case DPU_HW_BLK_CDM: hw_blks = &rm->cdm_blk; - hw_to_enc_id = &global_state->cdm_to_enc_id; + hw_to_crtc_id = &global_state->cdm_to_crtc_id; max_blks = 1; break; default: @@ -845,17 +837,17 @@ int dpu_rm_get_assigned_resources(struct dpu_rm *rm, num_blks = 0; for (i = 0; i < max_blks; i++) { - if (hw_to_enc_id[i] != enc_id) + if (hw_to_crtc_id[i] != crtc_id) continue; if (num_blks == blks_size) { - DPU_ERROR("More than %d %s assigned to enc %d\n", - blks_size, dpu_hw_blk_type_name[type], enc_id); + DPU_ERROR("More than %d resources assigned to crtc %d\n", + blks_size, crtc_id); break; } if (!hw_blks[i]) { - DPU_ERROR("%s unavailable to assign to enc %d\n", - dpu_hw_blk_type_name[type], enc_id); + DPU_ERROR("%s unavailable to assign to crtc %d\n", + dpu_hw_blk_type_name[type], crtc_id); break; } blks[num_blks++] = hw_blks[i]; @@ -885,38 +877,38 @@ void dpu_rm_print_state(struct drm_printer *p, drm_puts(p, "resource mapping:\n"); drm_puts(p, "\tpingpong="); - for (i = 0; i < ARRAY_SIZE(global_state->pingpong_to_enc_id); i++) + for (i = 0; i < ARRAY_SIZE(global_state->pingpong_to_crtc_id); i++) dpu_rm_print_state_helper(p, rm->pingpong_blks[i], - global_state->pingpong_to_enc_id[i]); + global_state->pingpong_to_crtc_id[i]); drm_puts(p, "\n"); drm_puts(p, "\tmixer="); - for (i = 0; i < ARRAY_SIZE(global_state->mixer_to_enc_id); i++) + for (i = 0; i < ARRAY_SIZE(global_state->mixer_to_crtc_id); i++) dpu_rm_print_state_helper(p, rm->mixer_blks[i], - global_state->mixer_to_enc_id[i]); + global_state->mixer_to_crtc_id[i]); drm_puts(p, "\n"); drm_puts(p, "\tctl="); - for (i = 0; i < ARRAY_SIZE(global_state->ctl_to_enc_id); i++) + for (i = 0; i < ARRAY_SIZE(global_state->ctl_to_crtc_id); i++) dpu_rm_print_state_helper(p, rm->ctl_blks[i], - global_state->ctl_to_enc_id[i]); + global_state->ctl_to_crtc_id[i]); drm_puts(p, "\n"); drm_puts(p, "\tdspp="); - for (i = 0; i < ARRAY_SIZE(global_state->dspp_to_enc_id); i++) + for (i = 0; i < ARRAY_SIZE(global_state->dspp_to_crtc_id); i++) dpu_rm_print_state_helper(p, rm->dspp_blks[i], - global_state->dspp_to_enc_id[i]); + global_state->dspp_to_crtc_id[i]); drm_puts(p, "\n"); drm_puts(p, "\tdsc="); - for (i = 0; i < ARRAY_SIZE(global_state->dsc_to_enc_id); i++) + for (i = 0; i < ARRAY_SIZE(global_state->dsc_to_crtc_id); i++) dpu_rm_print_state_helper(p, rm->dsc_blks[i], - global_state->dsc_to_enc_id[i]); + global_state->dsc_to_crtc_id[i]); drm_puts(p, "\n"); drm_puts(p, "\tcdm="); dpu_rm_print_state_helper(p, rm->cdm_blk, - global_state->cdm_to_enc_id); + global_state->cdm_to_crtc_id); drm_puts(p, "\n"); drm_puts(p, "\tsspp="); diff --git a/drivers/gpu/drm/msm/disp/dpu1/dpu_rm.h b/drivers/gpu/drm/msm/disp/dpu1/dpu_rm.h index c51c5a9255ce6..720e2c64effbf 100644 --- a/drivers/gpu/drm/msm/disp/dpu1/dpu_rm.h +++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_rm.h @@ -68,26 +68,25 @@ int dpu_rm_init(struct drm_device *dev, * HW blocks can then be accessed through dpu_rm_get_* functions. * HW Reservations should be released via dpu_rm_release_hw. * @rm: DPU Resource Manager handle - * @drm_enc: DRM Encoder handle - * @crtc_state: Proposed Atomic DRM CRTC State handle + * @crtc: DRM CRTC handle * @topology: Pointer to topology info for the display * @Return: 0 on Success otherwise -ERROR */ -int dpu_rm_reserve(struct dpu_rm *rm, +int dpu_rm_reserve( + struct dpu_rm *rm, struct dpu_global_state *global_state, - struct drm_encoder *drm_enc, - struct drm_crtc_state *crtc_state, + struct drm_crtc *crtc, struct msm_display_topology topology); /** - * dpu_rm_reserve - Given the encoder for the display chain, release any + * dpu_rm_reserve - Given the crtc for the display chain, release any * HW blocks previously reserved for that use case. * @rm: DPU Resource Manager handle - * @enc: DRM Encoder handle + * @crtc: DRM CRTC handle * @Return: 0 on Success otherwise -ERROR */ void dpu_rm_release(struct dpu_global_state *global_state, - struct drm_encoder *enc); + struct drm_crtc *crtc); /** * dpu_rm_reserve_sspp - Reserve the required SSPP for the provided CRTC @@ -111,10 +110,10 @@ void dpu_rm_release_all_sspp(struct dpu_global_state *global_state, struct drm_crtc *crtc); /** - * Get hw resources of the given type that are assigned to this encoder. + * Get hw resources of the given type that are assigned to this crtc. */ int dpu_rm_get_assigned_resources(struct dpu_rm *rm, - struct dpu_global_state *global_state, uint32_t enc_id, + struct dpu_global_state *global_state, struct drm_crtc *crtc, enum dpu_hw_blk_type type, struct dpu_hw_blk **blks, int blks_size); /** From patchwork Thu Aug 29 10:17:42 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jun Nie X-Patchwork-Id: 13782992 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 631B2C83030 for ; Thu, 29 Aug 2024 10:20:58 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id DAD4910E62A; Thu, 29 Aug 2024 10:20:57 +0000 (UTC) Authentication-Results: gabe.freedesktop.org; dkim=pass (2048-bit key; unprotected) header.d=linaro.org header.i=@linaro.org header.b="Mw45tT2c"; dkim-atps=neutral Received: from mail-pf1-f181.google.com (mail-pf1-f181.google.com [209.85.210.181]) by gabe.freedesktop.org (Postfix) with ESMTPS id 0696E10E62A for ; Thu, 29 Aug 2024 10:20:57 +0000 (UTC) Received: by mail-pf1-f181.google.com with SMTP id d2e1a72fcca58-7143165f23fso393484b3a.1 for ; Thu, 29 Aug 2024 03:20:57 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1724926856; x=1725531656; darn=lists.freedesktop.org; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=F0uRNpfIp2lpV9SgGo9NPsUI/ImMZPWVqx5nn2wZId8=; b=Mw45tT2cMxtMocbgnUmRrkfq1z+6krgK9s/srUUFFS+dNNiGd/kvqkNgFbSM45/kat XAj4Pr/nUqgUmoTE136XX16d7WtD6FhO5Xgjzu8V3Tl1y0EKFzPRodncDb4z6ZhcMvpc cL6qpGMSJcSpjQHQmKMBMTWsYr33kbWzHV0JQGRQSFQdqeacW1BQjrRYWxuuV6CfcbhD B9M/cEZk+FisNXCdsrQ/RBKJ/b/1srje2cblgMgVQe4vguElXfHwX6ebi1SmBOjWBhzH jkKLRCtBTe3PPJPflFkgogSgeS2J6mEogPOrhYceZyGUPuPQya1H0gBwG/0B1iRs3WiJ QpGg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1724926856; x=1725531656; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=F0uRNpfIp2lpV9SgGo9NPsUI/ImMZPWVqx5nn2wZId8=; b=FF6eFR7E2vuvv32mtjeVcihGO+zMIf7bMv3/XIRl+QrV6+BWClspVPPxwYAXUbKmKf wFt0VeEK2oDtCry5n+5VsnfBvVEcEFnF1hRs9QIJ3Q6nL8nejLzH8eEAyiHQ4WE++aWV fKGBZ6R+r8B+wb/uBPfXmqCsMM3dBYZqD0Ucq9rl3dFNsAjLKA9M45ce04I5IzI5gBxD fHK6eTwFaq2ODjOLgryenGLgjnEN9mZMif3anS6JN2uW/dxYMuLhZyFAQCf8Zu+ND8qo cMqME3lX0p7O4Q4KOjztMUkq5zydRKulB7xzrg/HcHo7wHf4IIByCtR9s30c9JsyWb1m iJuA== X-Forwarded-Encrypted: i=1; AJvYcCWeUCsWjTVY3WTzxpzBaXKqo6Fl576rgISByQvPw2V49NyH1C9WGrjDCLaUjIkNVgKLiuXPIFEk/eo=@lists.freedesktop.org X-Gm-Message-State: AOJu0YzDMiJ1pGgeWFjFEoKZUE/B7zqmuNijHKUTsaH7CZS4CNcRgNGX 0ozKf4oO4kyzYpSYTjtze6G5qRPJP53a8pi6kGXZz4YR1k3+p9bqe0vbq6FmzZA= X-Google-Smtp-Source: AGHT+IEQnZ7U6OXJ59JaU5lRHIu343sdAHqmwh5ITZdY+IPrw4gsbPdHxDGzOKFTJbJ7zQsi41Jqkg== X-Received: by 2002:a05:6a00:10c1:b0:70d:244b:cad9 with SMTP id d2e1a72fcca58-715dfcc0ba3mr2510462b3a.28.1724926856440; Thu, 29 Aug 2024 03:20:56 -0700 (PDT) Received: from [127.0.1.1] ([112.65.12.167]) by smtp.gmail.com with ESMTPSA id 41be03b00d2f7-7d22e9d4df4sm891684a12.82.2024.08.29.03.20.48 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 29 Aug 2024 03:20:55 -0700 (PDT) From: Jun Nie Date: Thu, 29 Aug 2024 18:17:42 +0800 Subject: [PATCH 13/21] drm/msm/dpu: Support quad pipe in header files MIME-Version: 1.0 Message-Id: <20240829-sm8650-v6-11-hmd-pocf-mdss-quad-upstream-8-v1-13-bdb05b4b5a2e@linaro.org> References: <20240829-sm8650-v6-11-hmd-pocf-mdss-quad-upstream-8-v1-0-bdb05b4b5a2e@linaro.org> In-Reply-To: <20240829-sm8650-v6-11-hmd-pocf-mdss-quad-upstream-8-v1-0-bdb05b4b5a2e@linaro.org> To: Rob Clark , Abhinav Kumar , Dmitry Baryshkov , Sean Paul , Marijn Suijten , David Airlie , Daniel Vetter , Maarten Lankhorst , Maxime Ripard , Thomas Zimmermann Cc: linux-arm-msm@vger.kernel.org, dri-devel@lists.freedesktop.org, freedreno@lists.freedesktop.org, linux-kernel@vger.kernel.org, Jun Nie X-Mailer: b4 0.13.0 X-Developer-Signature: v=1; a=ed25519-sha256; t=1724926736; l=4530; i=jun.nie@linaro.org; s=20240403; h=from:subject:message-id; bh=iBBFvuh42T8eyN/dYK/D5D18dlzaCweeyM10rWmhUYM=; b=ljxhEuqO0d+83B1jOB9X07XgeIfQ83dErzf8WVk3l5RtHzfq5go+VT1T9rPgHJOT3eTMcu4NQ Jtog/FbpINjCKsHZzsDiLWeqW1wQsnLRf7/8HNDlzHujPsKNJEnA+Ti X-Developer-Key: i=jun.nie@linaro.org; a=ed25519; pk=MNiBt/faLPvo+iJoP1hodyY2x6ozVXL8QMptmsKg3cc= X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" Support 4 pipes and their configs at most. They are for 2 SSPP and their multi-rect mode. Because one SSPP can co-work with 2 mixer at most, 2 pair of mixer are needed for 2 SSPP in quad- pipe case. So 2 mixer configs are needed in quad-pipe case. Signed-off-by: Jun Nie --- drivers/gpu/drm/msm/disp/dpu1/dpu_hw_mdss.h | 2 +- drivers/gpu/drm/msm/disp/dpu1/dpu_hw_sspp.h | 11 ++++++++++- drivers/gpu/drm/msm/disp/dpu1/dpu_plane.h | 30 +++++++++++++++++++++-------- 3 files changed, 33 insertions(+), 10 deletions(-) diff --git a/drivers/gpu/drm/msm/disp/dpu1/dpu_hw_mdss.h b/drivers/gpu/drm/msm/disp/dpu1/dpu_hw_mdss.h index a2eff36a2224c..424725303ccad 100644 --- a/drivers/gpu/drm/msm/disp/dpu1/dpu_hw_mdss.h +++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_hw_mdss.h @@ -32,7 +32,7 @@ #define DPU_MAX_PLANES 4 #endif -#define PIPES_PER_STAGE 2 +#define PIPES_PER_STAGE 4 #ifndef DPU_MAX_DE_CURVES #define DPU_MAX_DE_CURVES 3 #endif diff --git a/drivers/gpu/drm/msm/disp/dpu1/dpu_hw_sspp.h b/drivers/gpu/drm/msm/disp/dpu1/dpu_hw_sspp.h index fc54625ae5d4f..ae6beff2c294b 100644 --- a/drivers/gpu/drm/msm/disp/dpu1/dpu_hw_sspp.h +++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_hw_sspp.h @@ -143,11 +143,20 @@ struct dpu_hw_pixel_ext { * such as decimation, flip etc to program this field * @dest_rect: destination ROI. * @rotation: simplified drm rotation hint + * @visible: mark this cfg is valid + * @mxcfg_id: mixer config ID for left or right half screen. + * We have single SSPP, dual SSPP, single SSPP+multi_rect or dual + * SSPP+multi_rect case. mxcfg_id mark current pipe will use + * which mixer cfg. The first mxcfg is for the left half of screen, + * the 2nd mxcfg is for the right half screen. The heading cfg may + * be skipped by pipe with the first mxcfg_id = 1 if the plane is + * only displayed in the right side, thus SSPP goes to later mixers. */ struct dpu_sw_pipe_cfg { struct drm_rect src_rect; struct drm_rect dst_rect; - unsigned int rotation; + unsigned int rotation, mxcfg_id; + bool visible; }; /** diff --git a/drivers/gpu/drm/msm/disp/dpu1/dpu_plane.h b/drivers/gpu/drm/msm/disp/dpu1/dpu_plane.h index e225d5baceb09..9e79cf9eba264 100644 --- a/drivers/gpu/drm/msm/disp/dpu1/dpu_plane.h +++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_plane.h @@ -14,14 +14,30 @@ #include "dpu_hw_mdss.h" #include "dpu_hw_sspp.h" +/** + * Max number of mixer configs. Because we support 4 pipes at most, + * the 4 pipes are with 2 SSPP and their multi-rect mode. While one + * SSPP can co-work with 2 mixer at most, then 2 pair of mixer are + * needed for 2 SSPP in quad-pipe case. Thus 2 mixer configs are + * needed in quad-pipe case. + */ +#define MIX_CFGS_IN_CRTC 2 + /** * struct dpu_plane_state: Define dpu extension of drm plane state object * @base: base drm plane state object * @aspace: pointer to address space for input/output buffers - * @pipe: software pipe description - * @r_pipe: software pipe description of the second pipe - * @pipe_cfg: software pipe configuration - * @r_pipe_cfg: software pipe configuration for the second pipe + * @pipe: software pipe description. Some or all of fields in array can + * be in use per topology. The heading fields are used first, + * and the later fields is invalid if visible field of pipe_cfg + * is not set. For example, the visible fields of pipe_cfg are set + * in the first 2 pipe_cfg fields, and the mxcfg_id for them are + * 0 and 1. That means the first pipe is for left half screen and + * the 2nd pipe is for right half. The visible field of the 3rd + * pipe_cfg is not set, which means the 3rd and 4th pipe are not + * in use. + * @pipe_cfg: software pipe configuration. The 4 fields are for SSPP and their + parallel rect as above pipes. * @stage: assigned by crtc blender * @needs_qos_remap: qos remap settings need to be updated * @multirect_index: index of the rectangle of SSPP @@ -34,10 +50,8 @@ struct dpu_plane_state { struct drm_plane_state base; struct msm_gem_address_space *aspace; - struct dpu_sw_pipe pipe; - struct dpu_sw_pipe r_pipe; - struct dpu_sw_pipe_cfg pipe_cfg; - struct dpu_sw_pipe_cfg r_pipe_cfg; + struct dpu_sw_pipe pipe[PIPES_PER_STAGE]; + struct dpu_sw_pipe_cfg pipe_cfg[PIPES_PER_STAGE]; enum dpu_stage stage; bool needs_qos_remap; bool pending; From patchwork Thu Aug 29 10:17:43 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jun Nie X-Patchwork-Id: 13782993 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 304B4C8302B for ; Thu, 29 Aug 2024 10:21:06 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id AD3B510E62E; Thu, 29 Aug 2024 10:21:05 +0000 (UTC) Authentication-Results: gabe.freedesktop.org; dkim=pass (2048-bit key; unprotected) header.d=linaro.org header.i=@linaro.org header.b="ngsbwFHa"; dkim-atps=neutral Received: from mail-ot1-f51.google.com (mail-ot1-f51.google.com [209.85.210.51]) by gabe.freedesktop.org (Postfix) with ESMTPS id B9B5910E62E for ; Thu, 29 Aug 2024 10:21:04 +0000 (UTC) Received: by mail-ot1-f51.google.com with SMTP id 46e09a7af769-70f624c6015so129266a34.1 for ; Thu, 29 Aug 2024 03:21:04 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1724926864; x=1725531664; darn=lists.freedesktop.org; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=o0J6gfSiKm4ic0mw9uPw89ZXyvCtsR339YQWgX+0uvc=; b=ngsbwFHa1lk3L1dNWsdoQAdQMi++9eQzpPmB0Tg44KtiuAORHN3cpdsMecY78USy0b 2Vzu6nNEuidmz5O31l99pdDdLpQwiPBY9xG+UhEhiThl4xIvyoJjdSflwd/r4DHhZmXu O2hK9bnNrCG8m6nBGbVNwnQHtjD2bFZCYQLyDgDncNnkhwGD+Q3KLeypfmZALK//9BIN e6HFrSVw/oeUOS1NQHz+tMI0TGnAVHNxj/5s/Bl6m480j+3yl1oiFDmnOvAtcGz+SS44 2uzG7TwgT6WuWKVBGXwn8WSzKBlmFk/K4Mp7i28vgXrR/sC6esYqROQZ8oey4Ow5YL1m NGYg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1724926864; x=1725531664; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=o0J6gfSiKm4ic0mw9uPw89ZXyvCtsR339YQWgX+0uvc=; b=HG2iwhketz9dPxTgTg0PmKWOM/oj5gHOhaBYcR2TlDIeL5ZPVguoCDKH+1O9b5Djwo DZEV8bq6wJWMmNyMRbkArwmlncKwprTvDARHBY0YFdbbK7pCZ2Eplbtxw7OeVfwfYmYh 43I8Yhjml8Y1KsqhsSnZHzEaMU+8l+Cg1j/wQArnLQIQIVH4+T3VgYkONt7HwqMY/O+C IOKobOGVgk2r+V/MOjAZZ+YB1TQ81voa+O9FpomtGbd0fhH5SsWC7bDLTQWheeTRBzHE eWMmNY5R/fhKR2VzzdDtVFRxe32CXeau9VmNzhxc+q38yFwQgIBat9FKoohTEfK/GA9V fvtA== X-Forwarded-Encrypted: i=1; AJvYcCXDZ9SPBxbSlatWPsXMmnNjD2xLYu9m3f4hCe1sJes6hAmKGOzVTs4Wy7of6/u4VKCceM2RCVP4CaE=@lists.freedesktop.org X-Gm-Message-State: AOJu0Yy076QmR+1O6o1QDXRBsp1VhKZH37M2hr2I3pDpVD+j3faB0sok bMjec0NxCMzmJ2rhQUnOCE45Tb0g/A0vMMhSH88wuZPlphrCiTt1BBZLbh1U93Q= X-Google-Smtp-Source: AGHT+IEYeU8b0tKShp/1tqe/umI4hz9GnzhkBvnni3VPNx3JknLCkXdWH7K2aDAgRImHXjGCDUx1wg== X-Received: by 2002:a05:6359:4c83:b0:1b5:a037:f238 with SMTP id e5c5f4694b2df-1b603a23841mr290344855d.0.1724926863890; Thu, 29 Aug 2024 03:21:03 -0700 (PDT) Received: from [127.0.1.1] ([112.65.12.167]) by smtp.gmail.com with ESMTPSA id 41be03b00d2f7-7d22e9d4df4sm891684a12.82.2024.08.29.03.20.56 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 29 Aug 2024 03:21:03 -0700 (PDT) From: Jun Nie Date: Thu, 29 Aug 2024 18:17:43 +0800 Subject: [PATCH 14/21] drm/msm/dpu: Support quad-pipe in SSPP checking MIME-Version: 1.0 Message-Id: <20240829-sm8650-v6-11-hmd-pocf-mdss-quad-upstream-8-v1-14-bdb05b4b5a2e@linaro.org> References: <20240829-sm8650-v6-11-hmd-pocf-mdss-quad-upstream-8-v1-0-bdb05b4b5a2e@linaro.org> In-Reply-To: <20240829-sm8650-v6-11-hmd-pocf-mdss-quad-upstream-8-v1-0-bdb05b4b5a2e@linaro.org> To: Rob Clark , Abhinav Kumar , Dmitry Baryshkov , Sean Paul , Marijn Suijten , David Airlie , Daniel Vetter , Maarten Lankhorst , Maxime Ripard , Thomas Zimmermann Cc: linux-arm-msm@vger.kernel.org, dri-devel@lists.freedesktop.org, freedreno@lists.freedesktop.org, linux-kernel@vger.kernel.org, Jun Nie X-Mailer: b4 0.13.0 X-Developer-Signature: v=1; a=ed25519-sha256; t=1724926736; l=6676; i=jun.nie@linaro.org; s=20240403; h=from:subject:message-id; bh=7i2tZ6lsHlQvWtNNIv33X2jDrdBkZS2b+kzYUWO0fMI=; b=C6t5JxSLHz+r3FxGXyme5vAaHho61+PC/rRPPm+gGMljnzAh5OkDyqUlIUQJKDLPB5ANtLE6L 1Q7bIVmclZrBssFJaeh+hTvIJjBVyUs/Yjv5HDdU8jFVZlVYwrE8yD5 X-Developer-Key: i=jun.nie@linaro.org; a=ed25519; pk=MNiBt/faLPvo+iJoP1hodyY2x6ozVXL8QMptmsKg3cc= X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" Support quad-pipe in SSPP checking with unified method Signed-off-by: Jun Nie --- drivers/gpu/drm/msm/disp/dpu1/dpu_plane.c | 108 ++++++++++++++---------------- 1 file changed, 51 insertions(+), 57 deletions(-) diff --git a/drivers/gpu/drm/msm/disp/dpu1/dpu_plane.c b/drivers/gpu/drm/msm/disp/dpu1/dpu_plane.c index 4df7cfed4d230..78bf8f0292f62 100644 --- a/drivers/gpu/drm/msm/disp/dpu1/dpu_plane.c +++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_plane.c @@ -738,12 +738,40 @@ static int dpu_plane_check_inline_rotation(struct dpu_plane *pdpu, static int dpu_plane_atomic_check_pipe(struct dpu_plane *pdpu, struct dpu_sw_pipe *pipe, struct dpu_sw_pipe_cfg *pipe_cfg, - const struct msm_format *fmt, - const struct drm_display_mode *mode) + const struct drm_display_mode *mode, + struct drm_plane_state *new_plane_state) { uint32_t min_src_size; struct dpu_kms *kms = _dpu_plane_get_kms(&pdpu->base); int ret; + const struct msm_format *fmt; + uint32_t supported_rotations; + const struct dpu_sspp_cfg *pipe_hw_caps; + const struct dpu_sspp_sub_blks *sblk; + + pipe_hw_caps = pipe->sspp->cap; + sblk = pipe->sspp->cap->sblk; + + /* + * We already have verified scaling against platform limitations. + * Now check if the SSPP supports scaling at all. + */ + if (!sblk->scaler_blk.len && + ((drm_rect_width(&new_plane_state->src) >> 16 != + drm_rect_width(&new_plane_state->dst)) || + (drm_rect_height(&new_plane_state->src) >> 16 != + drm_rect_height(&new_plane_state->dst)))) + return -ERANGE; + + fmt = msm_framebuffer_format(new_plane_state->fb); + + supported_rotations = DRM_MODE_REFLECT_MASK | DRM_MODE_ROTATE_0; + + if (pipe_hw_caps->features & BIT(DPU_SSPP_INLINE_ROTATION)) + supported_rotations |= DRM_MODE_ROTATE_90; + + pipe_cfg->rotation = drm_rotation_simplify(new_plane_state->rotation, + supported_rotations); min_src_size = MSM_FORMAT_IS_YUV(fmt) ? 2 : 1; @@ -886,8 +914,7 @@ static int dpu_plane_atomic_check_nopipe(struct drm_plane *plane, return 0; } -static int dpu_plane_is_multirect_parallel_capable(struct dpu_sw_pipe *pipe, - struct dpu_sw_pipe_cfg *pipe_cfg, +static int dpu_plane_is_multirect_parallel_capable(struct dpu_sw_pipe_cfg *pipe_cfg, const struct msm_format *fmt, uint32_t max_linewidth) { @@ -916,49 +943,19 @@ static int dpu_plane_atomic_check_pipes(struct drm_plane *plane, drm_atomic_get_new_plane_state(state, plane); struct dpu_plane *pdpu = to_dpu_plane(plane); struct dpu_plane_state *pstate = to_dpu_plane_state(new_plane_state); - struct dpu_sw_pipe *pipe = &pstate->pipe; - struct dpu_sw_pipe *r_pipe = &pstate->r_pipe; - const struct msm_format *fmt; - struct dpu_sw_pipe_cfg *pipe_cfg = &pstate->pipe_cfg; - struct dpu_sw_pipe_cfg *r_pipe_cfg = &pstate->r_pipe_cfg; - uint32_t supported_rotations; - const struct dpu_sspp_cfg *pipe_hw_caps; - const struct dpu_sspp_sub_blks *sblk; - int ret = 0; - - pipe_hw_caps = pipe->sspp->cap; - sblk = pipe->sspp->cap->sblk; - - /* - * We already have verified scaling against platform limitations. - * Now check if the SSPP supports scaling at all. - */ - if (!sblk->scaler_blk.len && - ((drm_rect_width(&new_plane_state->src) >> 16 != - drm_rect_width(&new_plane_state->dst)) || - (drm_rect_height(&new_plane_state->src) >> 16 != - drm_rect_height(&new_plane_state->dst)))) - return -ERANGE; - - fmt = msm_framebuffer_format(new_plane_state->fb); - - supported_rotations = DRM_MODE_REFLECT_MASK | DRM_MODE_ROTATE_0; - - if (pipe_hw_caps->features & BIT(DPU_SSPP_INLINE_ROTATION)) - supported_rotations |= DRM_MODE_ROTATE_90; - - pipe_cfg->rotation = drm_rotation_simplify(new_plane_state->rotation, - supported_rotations); - r_pipe_cfg->rotation = pipe_cfg->rotation; - - ret = dpu_plane_atomic_check_pipe(pdpu, pipe, pipe_cfg, fmt, - &crtc_state->adjusted_mode); - if (ret) - return ret; + struct dpu_sw_pipe *pipe; + struct dpu_sw_pipe_cfg *pipe_cfg; + int ret = 0, i; - if (drm_rect_width(&r_pipe_cfg->src_rect) != 0) { - ret = dpu_plane_atomic_check_pipe(pdpu, r_pipe, r_pipe_cfg, fmt, - &crtc_state->adjusted_mode); + for (i = 0; i < PIPES_PER_STAGE; i++) { + pipe = &pstate->pipe[i]; + pipe_cfg = &pstate->pipe_cfg[i]; + if (!pipe_cfg->visible || !pipe->sspp) + break; + DPU_DEBUG_PLANE(pdpu, "pipe %d is in use, validate it\n", i); + ret = dpu_plane_atomic_check_pipe(pdpu, pipe, pipe_cfg, + &crtc_state->adjusted_mode, + new_plane_state); if (ret) return ret; } @@ -975,10 +972,10 @@ static int dpu_plane_atomic_check(struct drm_plane *plane, struct dpu_plane *pdpu = to_dpu_plane(plane); struct dpu_plane_state *pstate = to_dpu_plane_state(new_plane_state); struct dpu_kms *dpu_kms = _dpu_plane_get_kms(plane); - struct dpu_sw_pipe *pipe = &pstate->pipe; - struct dpu_sw_pipe *r_pipe = &pstate->r_pipe; - struct dpu_sw_pipe_cfg *pipe_cfg = &pstate->pipe_cfg; - struct dpu_sw_pipe_cfg *r_pipe_cfg = &pstate->r_pipe_cfg; + struct dpu_sw_pipe *pipe = &pstate->pipe[0]; + struct dpu_sw_pipe *r_pipe = &pstate->pipe[1]; + struct dpu_sw_pipe_cfg *pipe_cfg = &pstate->pipe_cfg[0]; + struct dpu_sw_pipe_cfg *r_pipe_cfg = &pstate->pipe_cfg[1]; const struct drm_crtc_state *crtc_state = NULL; if (new_plane_state->crtc) @@ -1033,13 +1030,10 @@ static int dpu_plane_atomic_check(struct drm_plane *plane, return -E2BIG; } - /* - * Use multirect for wide plane. We do not support dynamic - * assignment of SSPPs, so we know the configuration. - */ pipe->multirect_index = DPU_SSPP_RECT_0; pipe->multirect_mode = DPU_SSPP_MULTIRECT_PARALLEL; + r_pipe->sspp = pipe->sspp; r_pipe->multirect_index = DPU_SSPP_RECT_1; r_pipe->multirect_mode = DPU_SSPP_MULTIRECT_PARALLEL; } @@ -1056,7 +1050,7 @@ static int dpu_plane_virtual_atomic_check(struct drm_plane *plane, drm_atomic_get_old_plane_state(state, plane); struct dpu_plane_state *pstate = to_dpu_plane_state(plane_state); struct drm_crtc_state *crtc_state; - int ret; + int ret, i; if (plane_state->crtc) crtc_state = drm_atomic_get_new_crtc_state(state, @@ -1071,8 +1065,8 @@ static int dpu_plane_virtual_atomic_check(struct drm_plane *plane, * resources are freed by dpu_crtc_assign_plane_resources(), * but clean them here. */ - pstate->pipe.sspp = NULL; - pstate->r_pipe.sspp = NULL; + for (i = 0; i < PIPES_PER_STAGE; i++) + pstate->pipe[i].sspp = NULL; return 0; } From patchwork Thu Aug 29 10:17:44 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jun Nie X-Patchwork-Id: 13782994 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 42493C83031 for ; Thu, 29 Aug 2024 10:21:16 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id A9B9510E631; Thu, 29 Aug 2024 10:21:15 +0000 (UTC) Authentication-Results: gabe.freedesktop.org; dkim=pass (2048-bit key; unprotected) header.d=linaro.org header.i=@linaro.org header.b="cyyDsvfD"; dkim-atps=neutral Received: from mail-pf1-f180.google.com (mail-pf1-f180.google.com [209.85.210.180]) by gabe.freedesktop.org (Postfix) with ESMTPS id 2CBD010E631 for ; Thu, 29 Aug 2024 10:21:14 +0000 (UTC) Received: by mail-pf1-f180.google.com with SMTP id d2e1a72fcca58-715cc93694fso424549b3a.2 for ; Thu, 29 Aug 2024 03:21:14 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1724926874; x=1725531674; darn=lists.freedesktop.org; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=UujAM0ppALmP+CiZ+Yvmk6WlfqztN9lMTwPiJPvAki8=; b=cyyDsvfDl8tBrdI64dRr9UT/fx0w/CDRRYZS/kFboRpwR++gHOMfPROnANLGAGJBQF YNo60omjCt6mQAhaV7fX170RVVNy48ZcFv9IEBwjWbNRpPFrlc5SgEKrNIXoBrRCbdG2 jXft+UwdHirQq/bx3RraQIGXrBVWa9xY4qN0Hny6evEAGuUTjRODrFLgRnT3KYo216WK lylEu0xDo3E5ELyV4L/dC60JMHtm++4BppqlcDmJ2L2uCtbtjyrSWLvdlrjaBdLHUMN9 Vyb0ln9PurgN5SjD+KxwarAjhmHqwZFL5uveV/ah4O1pz8JL+gtFpybnkiy4zapV3YRF 0ouw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1724926874; x=1725531674; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=UujAM0ppALmP+CiZ+Yvmk6WlfqztN9lMTwPiJPvAki8=; b=Ky9TTuagOszxnW38lPR+u3p1iAgdO2cAObmy+d8qbrWJHBRTcEF40yohA/xM1k3M2S fgLK18Yix8mAjkp9B8UOJ3Ll3oS9aHXv53NoO0zVhDnerrVtvCXXZm9t/gJf1oSqH7r1 C3jAJ6bwfBONnJ+3oEAdQkGMex+Gx9+3usX2Trd82n8LrzphMfUSFnjP+pHHAtABBnkt U6eG1wgrHMRnjO8IUpEriCIUmFpaTOFudCTBiVrjdtlN7AXRpfwvXRBEmg/aK8WmOye3 t0rgiacKwlnkC/QrY9ZebGRjoDGgAhloDy/dUtu4xNizKM0xls4Ec2ujHwWvjZqj07kR rSNQ== X-Forwarded-Encrypted: i=1; AJvYcCUBsMA5I9ENMTNxcMCzKylVyw9vHFWAPksCl3dfDrCK4ViiqvxyRrtwzUZ1VSEUixkme2ofwQBLvlo=@lists.freedesktop.org X-Gm-Message-State: AOJu0Yxouh3rjHFTGoqy3G3VgVLG2NkDdeJy9kPldpdMcNK4z6YKyyGs mTXBsYQMtXT6NH/2m/yeH89Q0kwzA/NZ4Jmap+LWAIF/sruQUKJpfnFYwjrd/L0= X-Google-Smtp-Source: AGHT+IEZO2t8671x5VEXsSyb6biZG0ZXztl+IufggNceUR20goIfPI5Pkilp1q+yrz7uk8QdNHHulg== X-Received: by 2002:a05:6a21:513:b0:1cc:d7aa:fba4 with SMTP id adf61e73a8af0-1cce10aed99mr2453015637.42.1724926873547; Thu, 29 Aug 2024 03:21:13 -0700 (PDT) Received: from [127.0.1.1] ([112.65.12.167]) by smtp.gmail.com with ESMTPSA id 41be03b00d2f7-7d22e9d4df4sm891684a12.82.2024.08.29.03.21.04 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 29 Aug 2024 03:21:12 -0700 (PDT) From: Jun Nie Date: Thu, 29 Aug 2024 18:17:44 +0800 Subject: [PATCH 15/21] drm/msm/dpu: support plane splitting in quad-pipe case MIME-Version: 1.0 Message-Id: <20240829-sm8650-v6-11-hmd-pocf-mdss-quad-upstream-8-v1-15-bdb05b4b5a2e@linaro.org> References: <20240829-sm8650-v6-11-hmd-pocf-mdss-quad-upstream-8-v1-0-bdb05b4b5a2e@linaro.org> In-Reply-To: <20240829-sm8650-v6-11-hmd-pocf-mdss-quad-upstream-8-v1-0-bdb05b4b5a2e@linaro.org> To: Rob Clark , Abhinav Kumar , Dmitry Baryshkov , Sean Paul , Marijn Suijten , David Airlie , Daniel Vetter , Maarten Lankhorst , Maxime Ripard , Thomas Zimmermann Cc: linux-arm-msm@vger.kernel.org, dri-devel@lists.freedesktop.org, freedreno@lists.freedesktop.org, linux-kernel@vger.kernel.org, Jun Nie X-Mailer: b4 0.13.0 X-Developer-Signature: v=1; a=ed25519-sha256; t=1724926736; l=6300; i=jun.nie@linaro.org; s=20240403; h=from:subject:message-id; bh=+fFwh3BlU4QdHqwiqSk74UYJcpu2jT8QOrSJGdZFo6o=; b=ptq+UtRC5kpvJuEzJqB3XQdb1yGUc94lYYAbpcvYcm6FG7s2TQg28lLefqCfZW0+5jyd45wVO +lBt83BvFqtCS2k+y812D6DNo9akxkRtatC7uowxmVa62u2KtEIXel8 X-Developer-Key: i=jun.nie@linaro.org; a=ed25519; pk=MNiBt/faLPvo+iJoP1hodyY2x6ozVXL8QMptmsKg3cc= X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" Clip plane into SSPPs per left and right half screen per ROI if topology is quad pipe. Then split the split rectangle by half if the clip width still exceed limit. Signed-off-by: Jun Nie --- drivers/gpu/drm/msm/disp/dpu1/dpu_plane.c | 97 ++++++++++++++++++++++--------- 1 file changed, 71 insertions(+), 26 deletions(-) diff --git a/drivers/gpu/drm/msm/disp/dpu1/dpu_plane.c b/drivers/gpu/drm/msm/disp/dpu1/dpu_plane.c index 78bf8f0292f62..95cb2575c63b4 100644 --- a/drivers/gpu/drm/msm/disp/dpu1/dpu_plane.c +++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_plane.c @@ -836,10 +836,12 @@ static int dpu_plane_atomic_check_nopipe(struct drm_plane *plane, struct dpu_kms *kms = _dpu_plane_get_kms(&pdpu->base); u64 max_mdp_clk_rate = kms->perf.max_core_clk_rate; struct dpu_plane_state *pstate = to_dpu_plane_state(new_plane_state); - struct dpu_sw_pipe_cfg *pipe_cfg = &pstate->pipe_cfg; - struct dpu_sw_pipe_cfg *r_pipe_cfg = &pstate->r_pipe_cfg; + struct dpu_sw_pipe_cfg pipe_cfg; struct drm_rect fb_rect = { 0 }; + const struct drm_display_mode *mode = &crtc_state->adjusted_mode; uint32_t max_linewidth; + u32 lm_num; + int cfg_idx = 0, cfg_id, mixercfg_num; min_scale = FRAC_16_16(1, MAX_UPSCALE_RATIO); max_scale = MAX_DOWNSCALE_RATIO << 16; @@ -862,10 +864,10 @@ static int dpu_plane_atomic_check_nopipe(struct drm_plane *plane, return -EINVAL; } - /* state->src is 16.16, src_rect is not */ - drm_rect_fp_to_int(&pipe_cfg->src_rect, &new_plane_state->src); + lm_num = dpu_crtc_get_lm_num(crtc_state); - pipe_cfg->dst_rect = new_plane_state->dst; + /* state->src is 16.16, src_rect is not */ + drm_rect_fp_to_int(&pipe_cfg.src_rect, &new_plane_state->src); fb_rect.x2 = new_plane_state->fb->width; fb_rect.y2 = new_plane_state->fb->height; @@ -880,34 +882,77 @@ static int dpu_plane_atomic_check_nopipe(struct drm_plane *plane, max_linewidth = pdpu->catalog->caps->max_linewidth; - drm_rect_rotate(&pipe_cfg->src_rect, + drm_rect_rotate(&pipe_cfg.src_rect, new_plane_state->fb->width, new_plane_state->fb->height, new_plane_state->rotation); - if ((drm_rect_width(&pipe_cfg->src_rect) > max_linewidth) || - _dpu_plane_calc_clk(&crtc_state->adjusted_mode, pipe_cfg) > max_mdp_clk_rate) { - if (drm_rect_width(&pipe_cfg->src_rect) > 2 * max_linewidth) { - DPU_DEBUG_PLANE(pdpu, "invalid src " DRM_RECT_FMT " line:%u\n", - DRM_RECT_ARG(&pipe_cfg->src_rect), max_linewidth); - return -E2BIG; - } + /* + * We have 1 mixer cfg for 1:1:1 and 2:2:1 topology, 2 mixer configs + * for left and right half screen in case of 4:4:2 topology. + * But we may have 2 SSPP to split plane with 1 mixer config for 2:2:1. + * So need to handle super wide plane splitting, and plane on right half + * for dual-DSI case. Check dest rectangle left/right splitting + * first, then check super wide rectangle splitting next. + */ + mixercfg_num = lm_num / 2; + mixercfg_num = mixercfg_num == 0 ? 1 : mixercfg_num; + /* iterate mixer configs for this plane, to separate left/right with the id */ + for (cfg_id = 0; cfg_id < mixercfg_num; cfg_id++) { + struct drm_rect mixer_rect = {cfg_id * mode->hdisplay / mixercfg_num, 0, + (cfg_id + 1) * mode->hdisplay / mixercfg_num, mode->vdisplay}; + struct dpu_sw_pipe_cfg *cur_cfg = &pstate->pipe_cfg[cfg_idx]; + + drm_rect_fp_to_int(&cur_cfg->src_rect, &new_plane_state->src); + cur_cfg->dst_rect = new_plane_state->dst; + + DPU_DEBUG_PLANE(pdpu, "checking src " DRM_RECT_FMT " vs clip " DRM_RECT_FMT "\n", + DRM_RECT_ARG(&cur_cfg->src_rect), DRM_RECT_ARG(&mixer_rect)); + + /* If this plane does not fall into mixer rect, check next mixer rect */ + if (!drm_rect_clip_scaled(&cur_cfg->src_rect, &cur_cfg->dst_rect, &mixer_rect)) + continue; - *r_pipe_cfg = *pipe_cfg; - pipe_cfg->src_rect.x2 = (pipe_cfg->src_rect.x1 + pipe_cfg->src_rect.x2) >> 1; - pipe_cfg->dst_rect.x2 = (pipe_cfg->dst_rect.x1 + pipe_cfg->dst_rect.x2) >> 1; - r_pipe_cfg->src_rect.x1 = pipe_cfg->src_rect.x2; - r_pipe_cfg->dst_rect.x1 = pipe_cfg->dst_rect.x2; - } else { - memset(r_pipe_cfg, 0, sizeof(*r_pipe_cfg)); - } + cur_cfg->visible = true; + cur_cfg->mxcfg_id = cfg_id; + cur_cfg->dst_rect.x1 -= mixer_rect.x1; + cur_cfg->dst_rect.x2 -= mixer_rect.x1; + + DPU_DEBUG_PLANE(pdpu, "Got clip src:" DRM_RECT_FMT " dst: " DRM_RECT_FMT "\n", + DRM_RECT_ARG(&cur_cfg->src_rect), DRM_RECT_ARG(&cur_cfg->dst_rect)); + + /* Split super wide rect into 2 rect */ + if ((drm_rect_width(&cur_cfg->src_rect) > max_linewidth) || + _dpu_plane_calc_clk(mode, cur_cfg) > max_mdp_clk_rate) { + struct dpu_sw_pipe_cfg *next_cfg = &pstate->pipe_cfg[cfg_idx + 1]; + + if (drm_rect_width(&cur_cfg->src_rect) > 2 * max_linewidth) { + DPU_DEBUG_PLANE(pdpu, "invalid src " DRM_RECT_FMT " line:%u\n", + DRM_RECT_ARG(&cur_cfg->src_rect), max_linewidth); + return -E2BIG; + } + + memcpy(next_cfg, cur_cfg, sizeof(struct dpu_sw_pipe_cfg)); + cur_cfg->src_rect.x2 = (cur_cfg->src_rect.x1 + cur_cfg->src_rect.x2) >> 1; + cur_cfg->dst_rect.x2 = (cur_cfg->dst_rect.x1 + cur_cfg->dst_rect.x2) >> 1; + next_cfg->src_rect.x1 = cur_cfg->src_rect.x2; + next_cfg->dst_rect.x1 = cur_cfg->dst_rect.x2; + next_cfg->visible = true; + next_cfg->mxcfg_id = cfg_id; + DPU_DEBUG_PLANE(pdpu, "Split super wide plane into:" DRM_RECT_FMT "and" DRM_RECT_FMT "\n", + DRM_RECT_ARG(&cur_cfg->src_rect), DRM_RECT_ARG(&next_cfg->src_rect)); + cfg_idx++; + } - drm_rect_rotate_inv(&pipe_cfg->src_rect, - new_plane_state->fb->width, new_plane_state->fb->height, - new_plane_state->rotation); - if (drm_rect_width(&r_pipe_cfg->src_rect) != 0) - drm_rect_rotate_inv(&r_pipe_cfg->src_rect, + drm_rect_rotate_inv(&cur_cfg->src_rect, new_plane_state->fb->width, new_plane_state->fb->height, new_plane_state->rotation); + cfg_idx++; + } + + for (; cfg_idx < MIX_CFGS_IN_CRTC; cfg_idx++) { + memset(&pstate->pipe_cfg[cfg_idx], 0, sizeof(struct dpu_sw_pipe_cfg)); + memset(&pstate->pipe[cfg_idx], 0, sizeof(struct dpu_sw_pipe)); + } pstate->needs_qos_remap = drm_atomic_crtc_needs_modeset(crtc_state); From patchwork Thu Aug 29 10:17:45 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jun Nie X-Patchwork-Id: 13782995 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 78E53C8302B for ; Thu, 29 Aug 2024 10:21:24 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id EFDB510E632; Thu, 29 Aug 2024 10:21:23 +0000 (UTC) Authentication-Results: gabe.freedesktop.org; dkim=pass (2048-bit key; unprotected) header.d=linaro.org header.i=@linaro.org header.b="iiwHTKSB"; dkim-atps=neutral Received: from mail-io1-f45.google.com (mail-io1-f45.google.com [209.85.166.45]) by gabe.freedesktop.org (Postfix) with ESMTPS id 53ACA10E63A for ; Thu, 29 Aug 2024 10:21:23 +0000 (UTC) Received: by mail-io1-f45.google.com with SMTP id ca18e2360f4ac-82a205810ccso9059239f.2 for ; Thu, 29 Aug 2024 03:21:23 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1724926882; x=1725531682; darn=lists.freedesktop.org; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=4TuzTTnjlGvCSyzM33NKhNHvWlu8NZzgY6f6ECH0+Rc=; b=iiwHTKSB/6OLQpXQ5K/em98yXUX9Zvb7fgTyETKtnPifDtN02rZNLixgHw9n++Kksw g4Go/eMSj6ilSClt8GhjibZDbvFZ+9RVZzDRxdVx0VPgGyt5wR5p58/cP5OGXz4TRILJ T8YAoei/YR164a+irr6ePOPXXVkG2RpBD4EtZ02WSExi8aX1r5ajzgZAhXvehfVPA+uB L8pSVzYLcNiG2P7fwUqGNl+H3zvwQU7WdRTcSz38tPK7fiBJSGjLRyP1AAq095bstiLs mNTUVrF+OVpFR0zwKzKluXVDMTSvJlj5h3qp+Ex9G9QOCLJsdlC46rQh6d+hrOO94w+d pwzg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1724926882; x=1725531682; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=4TuzTTnjlGvCSyzM33NKhNHvWlu8NZzgY6f6ECH0+Rc=; b=mt/izMLRhY540ibNZ78BvaTzsON6cENXOVkhccJSOTqwWPuqjV2XNgmPMY0qYOPEpq AjUqrjIHhURNNlZ/vq5MBO81onPsJ6xBCFJ/qp4GGWC36ggehvRjAWQVgwebfYIA07XN wHuSZVlt13k8vpgJAMLKpTYkiXtv2nv6T8peurzjgff8egn3koHH2cPnkXLGykyRbCdG TUqzz6SqzdYOnPQxV5R0Zx7lUY1xf+GroXb2YoQH4Vu1FoprMbFrHX3yPYoBLzDrkta3 QWurQOj/I8cuOdTjZvVinOkrS4WkKCGEcrESQsLlwdwjdI1SUFPMxERxOW7NtpDn9mVU xjeg== X-Forwarded-Encrypted: i=1; AJvYcCXtYh4Ua0EkoE40XbiXGg3G4ll0c3Ia7hn1A9GakCwBs3mB7bnLt8nKEh5Kk6e4dHvlCYTGS6RpfFs=@lists.freedesktop.org X-Gm-Message-State: AOJu0YzeZ+Gu99JcReoCGDKnNIy8oq6kCucyc+XGVrqv2X5j3zBFjO12 Tv8Ivt26HO2UtFz18OzGbHFKiZ7MNbd+ueuKU/TTWHpp8IBGY1zbx5WGlvhMAwE= X-Google-Smtp-Source: AGHT+IHbVA0l+bX4JgXKuASc3OPCYhauqftt6K8Nr65uhYlEQYmVnADnoCU0mTUGLIgVyC3FpdBLfA== X-Received: by 2002:a05:6e02:52a:b0:39b:640e:c5e6 with SMTP id e9e14a558f8ab-39f37983ff7mr21822505ab.17.1724926882300; Thu, 29 Aug 2024 03:21:22 -0700 (PDT) Received: from [127.0.1.1] ([112.65.12.167]) by smtp.gmail.com with ESMTPSA id 41be03b00d2f7-7d22e9d4df4sm891684a12.82.2024.08.29.03.21.13 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 29 Aug 2024 03:21:21 -0700 (PDT) From: Jun Nie Date: Thu, 29 Aug 2024 18:17:45 +0800 Subject: [PATCH 16/21] drm/msm/dpu: support SSPP assignment for quad-pipe case MIME-Version: 1.0 Message-Id: <20240829-sm8650-v6-11-hmd-pocf-mdss-quad-upstream-8-v1-16-bdb05b4b5a2e@linaro.org> References: <20240829-sm8650-v6-11-hmd-pocf-mdss-quad-upstream-8-v1-0-bdb05b4b5a2e@linaro.org> In-Reply-To: <20240829-sm8650-v6-11-hmd-pocf-mdss-quad-upstream-8-v1-0-bdb05b4b5a2e@linaro.org> To: Rob Clark , Abhinav Kumar , Dmitry Baryshkov , Sean Paul , Marijn Suijten , David Airlie , Daniel Vetter , Maarten Lankhorst , Maxime Ripard , Thomas Zimmermann Cc: linux-arm-msm@vger.kernel.org, dri-devel@lists.freedesktop.org, freedreno@lists.freedesktop.org, linux-kernel@vger.kernel.org, Jun Nie X-Mailer: b4 0.13.0 X-Developer-Signature: v=1; a=ed25519-sha256; t=1724926736; l=4022; i=jun.nie@linaro.org; s=20240403; h=from:subject:message-id; bh=soj6PrVXT/xCUVwdiUUUMK0OTfrgaoP64MOuikj4L9c=; b=KPu/3YF8ZFbVS+RlbMDouNax60UXe9S/ZE+/72QOcOcl41DYXZyq3aJHCdKzR5U2a3JGsuALS 1HRk4X+9u9oBjgzC1oS0mox54LeBYnMgRsEHQ+1zkwH6/vztr/eXti3 X-Developer-Key: i=jun.nie@linaro.org; a=ed25519; pk=MNiBt/faLPvo+iJoP1hodyY2x6ozVXL8QMptmsKg3cc= X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" Support SSPP assignment for quad-pipe case with unified method Signed-off-by: Jun Nie --- drivers/gpu/drm/msm/disp/dpu1/dpu_plane.c | 58 +++++++++++++------------------ 1 file changed, 25 insertions(+), 33 deletions(-) diff --git a/drivers/gpu/drm/msm/disp/dpu1/dpu_plane.c b/drivers/gpu/drm/msm/disp/dpu1/dpu_plane.c index 95cb2575c63b4..c38c1bedd40fb 100644 --- a/drivers/gpu/drm/msm/disp/dpu1/dpu_plane.c +++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_plane.c @@ -1143,25 +1143,18 @@ static int dpu_plane_virtual_assign_resources(struct drm_crtc *crtc, struct dpu_kms *dpu_kms = _dpu_plane_get_kms(plane); struct dpu_rm_sspp_requirements reqs; struct dpu_plane_state *pstate; - struct dpu_sw_pipe *pipe; - struct dpu_sw_pipe *r_pipe; - struct dpu_sw_pipe_cfg *pipe_cfg; - struct dpu_sw_pipe_cfg *r_pipe_cfg; + struct dpu_plane *pdpu = to_dpu_plane(plane); const struct msm_format *fmt; uint32_t max_linewidth; + u32 i; if (plane_state->crtc) crtc_state = drm_atomic_get_new_crtc_state(state, plane_state->crtc); pstate = to_dpu_plane_state(plane_state); - pipe = &pstate->pipe; - r_pipe = &pstate->r_pipe; - pipe_cfg = &pstate->pipe_cfg; - r_pipe_cfg = &pstate->r_pipe_cfg; - - pipe->sspp = NULL; - r_pipe->sspp = NULL; + for (i = 0; i < PIPES_PER_STAGE; i++) + pstate->pipe[i].sspp = NULL; if (!plane_state->fb) return -EINVAL; @@ -1175,41 +1168,40 @@ static int dpu_plane_virtual_assign_resources(struct drm_crtc *crtc, max_linewidth = dpu_kms->catalog->caps->max_linewidth; - pipe->sspp = dpu_rm_reserve_sspp(&dpu_kms->rm, global_state, crtc, &reqs); - if (!pipe->sspp) - return -ENODEV; + for (i = 0; i < PIPES_PER_STAGE; i++) { + struct dpu_sw_pipe *r_pipe = &pstate->pipe[i + 1]; + struct dpu_sw_pipe_cfg *r_pipe_cfg = &pstate->pipe_cfg[i + 1]; + struct dpu_sw_pipe *pipe = &pstate->pipe[i]; + struct dpu_sw_pipe_cfg *pipe_cfg = &pstate->pipe_cfg[i]; - if (drm_rect_width(&r_pipe_cfg->src_rect) == 0) { - pipe->multirect_index = DPU_SSPP_RECT_SOLO; - pipe->multirect_mode = DPU_SSPP_MULTIRECT_NONE; + if (!pipe_cfg->visible) + break; - r_pipe->multirect_index = DPU_SSPP_RECT_SOLO; - r_pipe->multirect_mode = DPU_SSPP_MULTIRECT_NONE; + pipe->sspp = dpu_rm_reserve_sspp(&dpu_kms->rm, global_state, crtc, &reqs); + if (!pipe->sspp) + return -ENODEV; - r_pipe->sspp = NULL; - } else { - if (dpu_plane_is_multirect_parallel_capable(pipe, pipe_cfg, fmt, max_linewidth) && - dpu_plane_is_multirect_parallel_capable(r_pipe, r_pipe_cfg, fmt, max_linewidth) && + if (r_pipe_cfg->visible && + drm_rect_width(&r_pipe_cfg->src_rect) != 0 && + dpu_plane_is_multirect_parallel_capable(pipe_cfg, fmt, max_linewidth) && + dpu_plane_is_multirect_parallel_capable(r_pipe_cfg, fmt, max_linewidth) && + pipe_cfg->mxcfg_id == r_pipe_cfg->mxcfg_id && (test_bit(DPU_SSPP_SMART_DMA_V1, &pipe->sspp->cap->features) || test_bit(DPU_SSPP_SMART_DMA_V2, &pipe->sspp->cap->features))) { - r_pipe->sspp = pipe->sspp; - pipe->multirect_index = DPU_SSPP_RECT_0; pipe->multirect_mode = DPU_SSPP_MULTIRECT_PARALLEL; + DPU_DEBUG_PLANE(pdpu, "allocating sspp_%d for pipe %d and set pipe %d as multi-rect\n", + pipe->sspp->idx, i, i+1); + r_pipe->sspp = pipe->sspp; r_pipe->multirect_index = DPU_SSPP_RECT_1; r_pipe->multirect_mode = DPU_SSPP_MULTIRECT_PARALLEL; + i++; } else { - /* multirect is not possible, use two SSPP blocks */ - r_pipe->sspp = dpu_rm_reserve_sspp(&dpu_kms->rm, global_state, crtc, &reqs); - if (!r_pipe->sspp) - return -ENODEV; - pipe->multirect_index = DPU_SSPP_RECT_SOLO; pipe->multirect_mode = DPU_SSPP_MULTIRECT_NONE; - - r_pipe->multirect_index = DPU_SSPP_RECT_SOLO; - r_pipe->multirect_mode = DPU_SSPP_MULTIRECT_NONE; + DPU_DEBUG_PLANE(pdpu, "allocating sspp_%d for pipe %d.\n", + pipe->sspp->idx, i); } } From patchwork Thu Aug 29 10:17:46 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jun Nie X-Patchwork-Id: 13782996 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 27A98C8302B for ; Thu, 29 Aug 2024 10:21:32 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id A5CEF10E63A; Thu, 29 Aug 2024 10:21:31 +0000 (UTC) Authentication-Results: gabe.freedesktop.org; dkim=pass (2048-bit key; unprotected) header.d=linaro.org header.i=@linaro.org header.b="UksSNbHH"; dkim-atps=neutral Received: from mail-pf1-f176.google.com (mail-pf1-f176.google.com [209.85.210.176]) by gabe.freedesktop.org (Postfix) with ESMTPS id 983C510E63A for ; Thu, 29 Aug 2024 10:21:30 +0000 (UTC) Received: by mail-pf1-f176.google.com with SMTP id d2e1a72fcca58-7142448aaf9so327866b3a.1 for ; Thu, 29 Aug 2024 03:21:30 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1724926890; x=1725531690; darn=lists.freedesktop.org; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=r8DI7ikA88or2iDAK3xOlBJ1PA1zv5oIPqzpNTVoeMY=; b=UksSNbHHmSX4Ybk40e43qt9j6qHM8O3RACr98CEuFqips3REzWDy32H89GAuFhtBt9 oo0JxPdoXqfy9igNqYhYIZd7rSpjyMfOOT4HYIFDaYtQOvG/6YGiNYnfzJl1wl8sL8aY k+k2yxmB/jvAVY0ttoZ5TJZdKyIDS+3OFb5HIqeo7ci2TQ8N19Tkt37jBRLOnmxT5b77 mR+A4wB0vYjo+xACfhMC9DDig8r1pOsg/io/l0xuNA/jWEcQcDZWkDDhpf7K5fnSVUfO UPaSa4WxfxzeLNd7wXUu+FiTeY9CuqYeQXqm6X5pa5lYifTxL44QV1Vpyc35ETS8C/s4 8udg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1724926890; x=1725531690; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=r8DI7ikA88or2iDAK3xOlBJ1PA1zv5oIPqzpNTVoeMY=; b=ViXYl5C3SGeGVSPOmvS8VpyYx2SDb2+0CpgvozSgMNHdebrb+irQ2duCE/EwYTdwxj xNdn5Ay3fenlosTkNEudWnIO9fDONzpyByvWB4G8z7MLxTGxbO//yLSOzDCYMzN7gyYj jDzaQTDjk2BisaifPkRtS7+KojbEOG6p/3C2ZRug1Y63mE02aWlCiJkE1cmq2q3i9cty UsIdO1BYF11SjQ6zRdZSJ0UgnaMRGPuST8irCyHZqMpkBaCECwYCuoRWPkC6HqbixIY/ R9Ojl5IKRkgF8Zh1Ci8H1VaGLGdLKcOX8aya+vV0uhF/ZpbztD4ohV+SSe69KGuG1Xx9 9USQ== X-Forwarded-Encrypted: i=1; AJvYcCX8ebyi8V4TWkc/Gvz+e82dA9bj0EDY/e9I1jHe9ptDHCuei2g69GX6Se+eZhGwuryQS7TMXTp0mHo=@lists.freedesktop.org X-Gm-Message-State: AOJu0YzjVCZfVcXoIh8VnpV8gj/h+803krmTPS7zeE0/xucoDaFhlnYa cXz/BghbqNhiLirw8ULsRcCTa5X7RLD1smAAlCQ8UO3EDDT9VpQ+C2ifDEQ8iAY= X-Google-Smtp-Source: AGHT+IEcTRkQ5ZzVXvod6iAZFqWooirDADbwt3Jr/PqEsTMQoqohkuPi28x0O5nZR5hpkrLnnYZuuQ== X-Received: by 2002:a05:6a00:85a5:b0:714:2336:fa91 with SMTP id d2e1a72fcca58-715e1046500mr3379581b3a.14.1724926890039; Thu, 29 Aug 2024 03:21:30 -0700 (PDT) Received: from [127.0.1.1] ([112.65.12.167]) by smtp.gmail.com with ESMTPSA id 41be03b00d2f7-7d22e9d4df4sm891684a12.82.2024.08.29.03.21.22 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 29 Aug 2024 03:21:29 -0700 (PDT) From: Jun Nie Date: Thu, 29 Aug 2024 18:17:46 +0800 Subject: [PATCH 17/21] drm/msm/dpu: setup pipes with 2 set of stage config MIME-Version: 1.0 Message-Id: <20240829-sm8650-v6-11-hmd-pocf-mdss-quad-upstream-8-v1-17-bdb05b4b5a2e@linaro.org> References: <20240829-sm8650-v6-11-hmd-pocf-mdss-quad-upstream-8-v1-0-bdb05b4b5a2e@linaro.org> In-Reply-To: <20240829-sm8650-v6-11-hmd-pocf-mdss-quad-upstream-8-v1-0-bdb05b4b5a2e@linaro.org> To: Rob Clark , Abhinav Kumar , Dmitry Baryshkov , Sean Paul , Marijn Suijten , David Airlie , Daniel Vetter , Maarten Lankhorst , Maxime Ripard , Thomas Zimmermann Cc: linux-arm-msm@vger.kernel.org, dri-devel@lists.freedesktop.org, freedreno@lists.freedesktop.org, linux-kernel@vger.kernel.org, Jun Nie X-Mailer: b4 0.13.0 X-Developer-Signature: v=1; a=ed25519-sha256; t=1724926736; l=5154; i=jun.nie@linaro.org; s=20240403; h=from:subject:message-id; bh=2p1+0sprLK6BeoqG75+2/3BJRBQEnZgiwY/ji6q3SdA=; b=H9wx3GYWS3rql7lX5rfVbEbl82Qcbjc7rs6cMYTyW+Phj7Uod5o3sipnk1tae3jS/Pk5YH9IM J4pqV5DA60hCdIOVKl2pnC50i3UFThlz+hG4URucuJqZAHwdFyMEuMm X-Developer-Key: i=jun.nie@linaro.org; a=ed25519; pk=MNiBt/faLPvo+iJoP1hodyY2x6ozVXL8QMptmsKg3cc= X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" The first 2 fields in multirect_index and stage array are for the first SSPP and its multi-rect. And the later 2 fields are for the 2nd SSPP and its multi-rect. Signed-off-by: Jun Nie --- drivers/gpu/drm/msm/disp/dpu1/dpu_crtc.c | 76 +++++++++++++++++++++++--------- 1 file changed, 55 insertions(+), 21 deletions(-) diff --git a/drivers/gpu/drm/msm/disp/dpu1/dpu_crtc.c b/drivers/gpu/drm/msm/disp/dpu1/dpu_crtc.c index 2c21a1e13d32f..3b3cd17976082 100644 --- a/drivers/gpu/drm/msm/disp/dpu1/dpu_crtc.c +++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_crtc.c @@ -397,9 +397,8 @@ static void _dpu_crtc_blend_setup_pipe(struct drm_crtc *crtc, const struct msm_format *format, uint64_t modifier, struct dpu_sw_pipe *pipe, - unsigned int stage_idx, - struct dpu_hw_stage_cfg *stage_cfg - ) + unsigned int pipe_idx, + struct dpu_hw_stage_cfg *stage_cfg) { uint32_t lm_idx; enum dpu_sspp sspp_idx; @@ -410,7 +409,7 @@ static void _dpu_crtc_blend_setup_pipe(struct drm_crtc *crtc, state = plane->state; trace_dpu_crtc_setup_mixer(DRMID(crtc), DRMID(plane), - state, to_dpu_plane_state(state), stage_idx, + state, to_dpu_plane_state(state), pipe_idx, format->pixel_format, modifier); @@ -422,8 +421,14 @@ static void _dpu_crtc_blend_setup_pipe(struct drm_crtc *crtc, state->fb ? state->fb->base.id : -1, pipe->multirect_index); - stage_cfg->stage[stage][stage_idx] = sspp_idx; - stage_cfg->multirect_index[stage][stage_idx] = pipe->multirect_index; + /* Mark sspp[sspp_idx] to be blended in stage[stage], pipe_idx decide + * the SSPP is blended into which mixer. For example, SSPP 1 goes to + * left half of screen, then pipe_idx 0 and 1 shall be set for sspp_idx + * 1 in quad-pipe case. + * The operation is done in dpu_hw_ctl_setup_blendstage() + */ + stage_cfg->stage[stage][pipe_idx] = sspp_idx; + stage_cfg->multirect_index[stage][pipe_idx] = pipe->multirect_index; /* blend config update */ for (lm_idx = 0; lm_idx < num_mixers; lm_idx++) @@ -441,8 +446,9 @@ static void _dpu_crtc_blend_setup_mixer(struct drm_crtc *crtc, struct dpu_plane_state *pstate = NULL; const struct msm_format *format; struct dpu_hw_ctl *ctl = mixer->lm_ctl; + struct dpu_sw_pipe *pipe; - uint32_t lm_idx; + uint32_t lm_idx, i, c; bool bg_alpha_enable = false; DECLARE_BITMAP(fetch_active, SSPP_MAX); @@ -463,20 +469,48 @@ static void _dpu_crtc_blend_setup_mixer(struct drm_crtc *crtc, if (pstate->stage == DPU_STAGE_BASE && format->alpha_enable) bg_alpha_enable = true; - set_bit(pstate->pipe.sspp->idx, fetch_active); - _dpu_crtc_blend_setup_pipe(crtc, plane, - mixer, cstate->num_mixers, - pstate->stage, - format, fb ? fb->modifier : 0, - &pstate->pipe, 0, stage_cfg); - - if (pstate->r_pipe.sspp) { - set_bit(pstate->r_pipe.sspp->idx, fetch_active); - _dpu_crtc_blend_setup_pipe(crtc, plane, - mixer, cstate->num_mixers, - pstate->stage, - format, fb ? fb->modifier : 0, - &pstate->r_pipe, 1, stage_cfg); + /* + * Check whether the SSPP fall into left/right half of screen + * via mxcfg_id. The left half is the default area with the + * first config. And the right half is with the second config + * in quad pipe case. The SSPP for the left half always come + * first in pipe array. + * + * For example: there are one SSPP for left and another SSPP for + * right with a super wide plane in quad-pipe case, with multi- + * rect mode on both SSPP. The pipe index for the 1st SSPP are + * 0/1 which goes to left half with the first 2 mixers. The pipe + * index for the 2nd SSPP are 2/3 to indicate the SSPP will go + * to the right half with 3rd/4th mixer in 4 mixers. + * + * If a small size plane is only on right half of screen in quad + * pipe case, there shall be only one SSPP without multi-rect + * mode. Then only the fisrt field of pipe array is valid with + * the config id to be 1. The config id 1 indicates the SSPP go + * to the 2nd half/rectangle of screen that clipping with the id + * in dpu_plane_atomic_check_nopipe(). + */ + for (c = 0; c < MIX_CFGS_IN_CRTC; c++) { + u32 pipe_idx = c * 2; + + for (i = 0; i < PIPES_PER_STAGE; i++) { + DRM_DEBUG_ATOMIC("Checking pipe %d visible %d, pipe_cfg_id %d vs %d\n", + i, pstate->pipe_cfg[i].visible, pstate->pipe_cfg[i].mxcfg_id, c); + if (!pstate->pipe_cfg[i].visible) + break; + if (pstate->pipe_cfg[i].mxcfg_id != c) + continue; + pipe = &pstate->pipe[i]; + if (!pipe->sspp) + continue; + set_bit(pipe->sspp->idx, fetch_active); + DRM_DEBUG_ATOMIC("blend pipe %d with sspp_%d\n", i, pipe->sspp->idx); + _dpu_crtc_blend_setup_pipe(crtc, plane, + mixer, cstate->num_mixers, + pstate->stage, + format, fb ? fb->modifier : 0, + pipe, pipe_idx++, stage_cfg); + } } /* blend config update */ From patchwork Thu Aug 29 10:17:47 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jun Nie X-Patchwork-Id: 13782997 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id BDA79C8302B for ; Thu, 29 Aug 2024 10:21:41 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 444D510E642; Thu, 29 Aug 2024 10:21:41 +0000 (UTC) Authentication-Results: gabe.freedesktop.org; dkim=pass (2048-bit key; unprotected) header.d=linaro.org header.i=@linaro.org header.b="QjgSq3iY"; dkim-atps=neutral Received: from mail-ot1-f43.google.com (mail-ot1-f43.google.com [209.85.210.43]) by gabe.freedesktop.org (Postfix) with ESMTPS id A571F10E63F for ; Thu, 29 Aug 2024 10:21:39 +0000 (UTC) Received: by mail-ot1-f43.google.com with SMTP id 46e09a7af769-7093d565310so399158a34.2 for ; Thu, 29 Aug 2024 03:21:39 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1724926899; x=1725531699; darn=lists.freedesktop.org; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=EK1k+f2ysbGl8LU/rYDG3ay57h/xaV/fco9SLUBD9EM=; b=QjgSq3iY3YjPhw13OjlJmRt4DJnAc5q5grpRdeyRuG8tZjBzsaQxJ+o9O9DLbh22Gu edKaURbYIwa+c28nE/70GoSMCRMJAgu3d/IYRZQnynO6HZ6jx+Y5SWbf2xFT5ahOUXke Yi9erjlrQAEjDwy97Y+WCUPlCB5iGaKSkeat5IlhkcKRemkN6Yg1y8UIVwNpbXfR2XSP 0QPbFAKDuA6vPMXg6ywHFgSyK7VUtlVIVKb9EvdmNnR44glC5q9BcskxYKUaAfOgwq6S cWdwjH+TF97WVhJOQG16acFUHaowORd/n3PSKK//UXUBW4FBlusQbX8w4voAtKkGNo/u jgPw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1724926899; x=1725531699; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=EK1k+f2ysbGl8LU/rYDG3ay57h/xaV/fco9SLUBD9EM=; b=K+ebyaB3eZIvJoKr7hPQWdt0qKd9FyA1dTIYC/VJw8SENJhXr9gPIHF81RD4VzwsvX prqe5iLK89fKOalrZBiEmC64mRyWB0JPsTU7vgMZ/OrOFwxr+ZAzYIPWw7UOLm+zIsks 2GARQOi0uZVVHjpF1yrlJLZX72rph3qrtfU0kKvj2Gh5+Jz93X6mNYHRZr/UtusK5Wl6 rUTWnuWJ1V6vlJx62/E3aGnwzt5F9ZFSL7dcpMwGSMWPAsBvDQyN7aHT3uOwIp6n3sj7 qEpQE2a38GGpwNh/kFA++cHAYJtwApXkTUg5p+Qr5q/C1hiK9A0P5C3/3g7XQ6FyJAG3 dtvQ== X-Forwarded-Encrypted: i=1; AJvYcCUIOfOehpyz353p09078cY4yFzkJKXOGn0NK0bVcmHzt1gyc5eBYqKNOg4Eslkih2TfprFbShLqAMc=@lists.freedesktop.org X-Gm-Message-State: AOJu0YxnV7bubkcm9RruSpWuU5Ax1uRRVxGiiuKZPd9PAfMjqkt2Xd+t Rnrdf7/EKoEi0oPlXJ74OAMxZgzxhALnpaGMNrn5HoS+4dbN+4gR7K1EHn2LyiE= X-Google-Smtp-Source: AGHT+IHtCmZmbk18Vi3Dak2OwPt7OgHLCogUdc/r503bV/QzKkLfHYxNgEZbCcAkIvUU8w4p49d8kQ== X-Received: by 2002:a05:6358:7e03:b0:1b3:9b14:9c94 with SMTP id e5c5f4694b2df-1b603bebbc9mr299226155d.3.1724926898755; Thu, 29 Aug 2024 03:21:38 -0700 (PDT) Received: from [127.0.1.1] ([112.65.12.167]) by smtp.gmail.com with ESMTPSA id 41be03b00d2f7-7d22e9d4df4sm891684a12.82.2024.08.29.03.21.31 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 29 Aug 2024 03:21:38 -0700 (PDT) From: Jun Nie Date: Thu, 29 Aug 2024 18:17:47 +0800 Subject: [PATCH 18/21] drm/msm/dpu: blend pipes by left and right MIME-Version: 1.0 Message-Id: <20240829-sm8650-v6-11-hmd-pocf-mdss-quad-upstream-8-v1-18-bdb05b4b5a2e@linaro.org> References: <20240829-sm8650-v6-11-hmd-pocf-mdss-quad-upstream-8-v1-0-bdb05b4b5a2e@linaro.org> In-Reply-To: <20240829-sm8650-v6-11-hmd-pocf-mdss-quad-upstream-8-v1-0-bdb05b4b5a2e@linaro.org> To: Rob Clark , Abhinav Kumar , Dmitry Baryshkov , Sean Paul , Marijn Suijten , David Airlie , Daniel Vetter , Maarten Lankhorst , Maxime Ripard , Thomas Zimmermann Cc: linux-arm-msm@vger.kernel.org, dri-devel@lists.freedesktop.org, freedreno@lists.freedesktop.org, linux-kernel@vger.kernel.org, Jun Nie X-Mailer: b4 0.13.0 X-Developer-Signature: v=1; a=ed25519-sha256; t=1724926736; l=4932; i=jun.nie@linaro.org; s=20240403; h=from:subject:message-id; bh=ISvroWQkoq1F0Dc7B+ldRkqGyVCkm1R5SOT45VY+lqU=; b=+7LVoLcsKj5xmIck33DQjTT9nriKG4O0nLNgjDwuzuo9YnLw3DJ69ueeDe9MrwsQ3HlFqVasm qj+HtjZ5pOcCRK987BnH6B3l7ZB4CopzAzT+H+5jvcBDz7sXAj0z1R+ X-Developer-Key: i=jun.nie@linaro.org; a=ed25519; pk=MNiBt/faLPvo+iJoP1hodyY2x6ozVXL8QMptmsKg3cc= X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" Blend pipes by left and right. The first 2 pipes are for left half screen and the later 2 pipes are for right in quad pipe case. Signed-off-by: Jun Nie --- drivers/gpu/drm/msm/disp/dpu1/dpu_crtc.c | 13 +++++++++++-- drivers/gpu/drm/msm/disp/dpu1/dpu_encoder.c | 10 +++++++--- drivers/gpu/drm/msm/disp/dpu1/dpu_hw_ctl.c | 19 +++++++++++++++++-- drivers/gpu/drm/msm/disp/dpu1/dpu_hw_ctl.h | 4 +++- 4 files changed, 38 insertions(+), 8 deletions(-) diff --git a/drivers/gpu/drm/msm/disp/dpu1/dpu_crtc.c b/drivers/gpu/drm/msm/disp/dpu1/dpu_crtc.c index 3b3cd17976082..8fd56f8f2851f 100644 --- a/drivers/gpu/drm/msm/disp/dpu1/dpu_crtc.c +++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_crtc.c @@ -574,8 +574,17 @@ static void _dpu_crtc_blend_setup(struct drm_crtc *crtc) mixer[i].mixer_op_mode, ctl->idx - CTL_0); - ctl->ops.setup_blendstage(ctl, mixer[i].hw_lm->idx, - &stage_cfg); + /* + * call dpu_hw_ctl_setup_blendstage() to blend layers per stage cfg. + * There is 4 mixers at most. The first 2 are for the left half, and + * the later 2 are for the right half. + */ + if (cstate->num_mixers == 4 && i >= 2) + ctl->ops.setup_blendstage(ctl, mixer[i].hw_lm->idx, + &stage_cfg, true); + else + ctl->ops.setup_blendstage(ctl, mixer[i].hw_lm->idx, + &stage_cfg, false); } } diff --git a/drivers/gpu/drm/msm/disp/dpu1/dpu_encoder.c b/drivers/gpu/drm/msm/disp/dpu1/dpu_encoder.c index 76793201b984e..5d927f23e35b2 100644 --- a/drivers/gpu/drm/msm/disp/dpu1/dpu_encoder.c +++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_encoder.c @@ -2049,9 +2049,13 @@ static void dpu_encoder_helper_reset_mixers(struct dpu_encoder_phys *phys_enc) if (phys_enc->hw_ctl->ops.update_pending_flush_mixer) phys_enc->hw_ctl->ops.update_pending_flush_mixer(ctl, hw_mixer[i]->idx); - /* clear all blendstages */ - if (phys_enc->hw_ctl->ops.setup_blendstage) - phys_enc->hw_ctl->ops.setup_blendstage(ctl, hw_mixer[i]->idx, NULL); + /* clear all blendstages in both left and right */ + if (phys_enc->hw_ctl->ops.setup_blendstage) { + phys_enc->hw_ctl->ops.setup_blendstage(ctl, + hw_mixer[i]->idx, NULL, false); + phys_enc->hw_ctl->ops.setup_blendstage(ctl, + hw_mixer[i]->idx, NULL, true); + } } } diff --git a/drivers/gpu/drm/msm/disp/dpu1/dpu_hw_ctl.c b/drivers/gpu/drm/msm/disp/dpu1/dpu_hw_ctl.c index 602dfad127c2a..2072d18520326 100644 --- a/drivers/gpu/drm/msm/disp/dpu1/dpu_hw_ctl.c +++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_hw_ctl.c @@ -478,12 +478,13 @@ static const struct ctl_blend_config ctl_blend_config[][2] = { }; static void dpu_hw_ctl_setup_blendstage(struct dpu_hw_ctl *ctx, - enum dpu_lm lm, struct dpu_hw_stage_cfg *stage_cfg) + enum dpu_lm lm, struct dpu_hw_stage_cfg *stage_cfg, bool right) { struct dpu_hw_blk_reg_map *c = &ctx->hw; u32 mix, ext, mix_ext; u32 mixercfg[5] = { 0 }; int i, j; + int pipe_start, pipe_end; int stages; int pipes_per_stage; @@ -502,13 +503,27 @@ static void dpu_hw_ctl_setup_blendstage(struct dpu_hw_ctl *ctx, if (!stage_cfg) goto exit; + /* + * For quad pipe case, blend pipes in right side separately. Otherwise, + * all content is on the left half by defaut (no splitting case). + */ + if (!right) { + pipe_start = 0; + pipe_end = pipes_per_stage == PIPES_PER_STAGE ? 2 : 1; + } else { + pipe_start = 2; + pipe_end = PIPES_PER_STAGE; + } + + DRM_DEBUG_ATOMIC("blend lm %d on the %s side\n", lm - LM_0, + right ? "right" : "left"); for (i = 0; i <= stages; i++) { /* overflow to ext register if 'i + 1 > 7' */ mix = (i + 1) & 0x7; ext = i >= 7; mix_ext = (i + 1) & 0xf; - for (j = 0 ; j < pipes_per_stage; j++) { + for (j = pipe_start; j < pipe_end; j++) { enum dpu_sspp_multirect_index rect_index = stage_cfg->multirect_index[i][j]; enum dpu_sspp pipe = stage_cfg->stage[i][j]; diff --git a/drivers/gpu/drm/msm/disp/dpu1/dpu_hw_ctl.h b/drivers/gpu/drm/msm/disp/dpu1/dpu_hw_ctl.h index 557ec9a924f81..2dac7885fc5e7 100644 --- a/drivers/gpu/drm/msm/disp/dpu1/dpu_hw_ctl.h +++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_hw_ctl.h @@ -25,6 +25,8 @@ struct dpu_hw_ctl; /** * struct dpu_hw_stage_cfg - blending stage cfg * @stage : SSPP_ID at each stage + * The first 2 in PIPES_PER_STAGE(4) are for the first SSPP. + * The 3rd/4th in PIPES_PER_STAGE(4) are for the 2nd SSPP. * @multirect_index: index of the rectangle of SSPP. */ struct dpu_hw_stage_cfg { @@ -243,7 +245,7 @@ struct dpu_hw_ctl_ops { * @cfg : blend stage configuration */ void (*setup_blendstage)(struct dpu_hw_ctl *ctx, - enum dpu_lm lm, struct dpu_hw_stage_cfg *cfg); + enum dpu_lm lm, struct dpu_hw_stage_cfg *cfg, bool right); void (*set_active_pipes)(struct dpu_hw_ctl *ctx, unsigned long *fetch_active); From patchwork Thu Aug 29 10:17:48 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jun Nie X-Patchwork-Id: 13782998 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 17186C83030 for ; Thu, 29 Aug 2024 10:21:48 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 9E0AB10E640; Thu, 29 Aug 2024 10:21:47 +0000 (UTC) Authentication-Results: gabe.freedesktop.org; dkim=pass (2048-bit key; unprotected) header.d=linaro.org header.i=@linaro.org header.b="WjoUzEa8"; dkim-atps=neutral Received: from mail-il1-f174.google.com (mail-il1-f174.google.com [209.85.166.174]) by gabe.freedesktop.org (Postfix) with ESMTPS id 4AC3C10E640 for ; Thu, 29 Aug 2024 10:21:47 +0000 (UTC) Received: by mail-il1-f174.google.com with SMTP id e9e14a558f8ab-39d47a9ffd5so1387745ab.2 for ; Thu, 29 Aug 2024 03:21:47 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1724926906; x=1725531706; darn=lists.freedesktop.org; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=Z9jx05Flyz1UJjR2gb/LXP0v8OrpVfCmxku2GEq5wWk=; b=WjoUzEa8ex6faYXJ6VuUVlMsgX1qVds1LfZwlo75TlWqx0h3CIOJ5UCrIVM4YkKrxI h5mUU3UU11iNsurOHuLF46ALYqVc0t5RtAYZKuVLN1HCwYT/r2y9OT8kCS9gfVwo75Ai kzlg+ausZ+fq2FLCtpF+UTJobGbn7wNP2KNK406LLeYFwO/aJ+5Itz88pk/cLpIlbrsX kHJdYVcegAU9rslTbmP4guvq0XyVyr3vYRmfw603e7kAeL9sSaTKayIQiTgsF2Qu91B9 b6NPGim72vpRF+Ddq+lze91yp9a6w9zWwePjqbNIr10vZzw8R+L1aK5+9isiBapdDMPJ +auQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1724926906; x=1725531706; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=Z9jx05Flyz1UJjR2gb/LXP0v8OrpVfCmxku2GEq5wWk=; b=IKdsOv0Fjy59BVJgfMX7xF2fl69Wi1b1FY1RSc/y4LvE88E1EJRIHEGpwqppYrWVzb kvPW4RLswBJBtJJsj0wkgLuRbZ6qxL2dS3JouMjyi2oFn1TfaQ2GEKm6Zvwl2r2qGXhD Ej3EESMUMZh4iet/tb7ykxU7ua2QF8dgmMKuq0XxDl4dwwKCbEH7wNhw8yx8ahv7Ix6H KiEKBRpPrmPXFiX1JD+WaK8jz/q2sPEPjFHQR5kAKN5nnd9z486nb4Fk/m9Sylx5Zltn LGkc+4EbWK5NJTdg7tXsUkC4Dq/59qVlMAbycOxYJzSjiCOZCr8PlLU2ZLXwl5X+wiJR QKSA== X-Forwarded-Encrypted: i=1; AJvYcCV49phKbbdtB932tAPEL14A8Cxesr2P+VX2D6+2U+AGfzAQeL/SJlMUze0Zbgs27Dz+hgs9hhjzWeY=@lists.freedesktop.org X-Gm-Message-State: AOJu0YyHkmcC1o2mxcciVCJZesxyWhjjkHgcYAfKhj9qwtLh5q8rJ/wL MtYlo1rgP2XN57NlRqw7Qfd0FiZRFh00vD1PLu86cGf1x3GasIilgXQAwaCug9g= X-Google-Smtp-Source: AGHT+IFNqtjfH6898xDZo1oKXP4FPGRERQN/yG4/hS7UmK07Tu9uaYdYVMcYyGDgmPzuMBRpPO+cdQ== X-Received: by 2002:a05:6e02:1e09:b0:39e:38f6:d006 with SMTP id e9e14a558f8ab-39f377e0c13mr29566845ab.9.1724926906455; Thu, 29 Aug 2024 03:21:46 -0700 (PDT) Received: from [127.0.1.1] ([112.65.12.167]) by smtp.gmail.com with ESMTPSA id 41be03b00d2f7-7d22e9d4df4sm891684a12.82.2024.08.29.03.21.39 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 29 Aug 2024 03:21:45 -0700 (PDT) From: Jun Nie Date: Thu, 29 Aug 2024 18:17:48 +0800 Subject: [PATCH 19/21] drm/msm/dpu: bind correct pingpong for quad pipe MIME-Version: 1.0 Message-Id: <20240829-sm8650-v6-11-hmd-pocf-mdss-quad-upstream-8-v1-19-bdb05b4b5a2e@linaro.org> References: <20240829-sm8650-v6-11-hmd-pocf-mdss-quad-upstream-8-v1-0-bdb05b4b5a2e@linaro.org> In-Reply-To: <20240829-sm8650-v6-11-hmd-pocf-mdss-quad-upstream-8-v1-0-bdb05b4b5a2e@linaro.org> To: Rob Clark , Abhinav Kumar , Dmitry Baryshkov , Sean Paul , Marijn Suijten , David Airlie , Daniel Vetter , Maarten Lankhorst , Maxime Ripard , Thomas Zimmermann Cc: linux-arm-msm@vger.kernel.org, dri-devel@lists.freedesktop.org, freedreno@lists.freedesktop.org, linux-kernel@vger.kernel.org, Jun Nie X-Mailer: b4 0.13.0 X-Developer-Signature: v=1; a=ed25519-sha256; t=1724926736; l=1799; i=jun.nie@linaro.org; s=20240403; h=from:subject:message-id; bh=/0TaKCKB4quJoQmigc/feb+UNK8aS1L+bPWvhyMG0y8=; b=3i+u31QYN7+VHMXzkpCRi03u866yLUbNqbRJCoGzSkySX+He1RCO0pnnTqsKTYMy8tm3E030Q xxudyn/XPdCCPTgpW4OTkgRD7GYqnBTA3DrC7a4Yf0rdPAGAP5e38jk X-Developer-Key: i=jun.nie@linaro.org; a=ed25519; pk=MNiBt/faLPvo+iJoP1hodyY2x6ozVXL8QMptmsKg3cc= X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" There are 2 interface and 4 PP in quad pipe. Map the 2nd interface to 3rd PP instead of the 2nd PP. Signed-off-by: Jun Nie --- drivers/gpu/drm/msm/disp/dpu1/dpu_encoder.c | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/drivers/gpu/drm/msm/disp/dpu1/dpu_encoder.c b/drivers/gpu/drm/msm/disp/dpu1/dpu_encoder.c index 5d927f23e35b2..e17b7b39c4db9 100644 --- a/drivers/gpu/drm/msm/disp/dpu1/dpu_encoder.c +++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_encoder.c @@ -1116,7 +1116,7 @@ static void dpu_encoder_virt_atomic_mode_set(struct drm_encoder *drm_enc, struct dpu_hw_blk *hw_lm[MAX_CHANNELS_PER_ENC]; struct dpu_hw_blk *hw_dspp[MAX_CHANNELS_PER_ENC] = { NULL }; struct dpu_hw_blk *hw_dsc[MAX_CHANNELS_PER_ENC]; - int num_lm, num_ctl, num_pp, num_dsc; + int num_lm, num_ctl, num_pp, num_dsc, num_pp_per_intf; unsigned int dsc_mask = 0; int i; @@ -1186,9 +1186,14 @@ static void dpu_encoder_virt_atomic_mode_set(struct drm_encoder *drm_enc, } cstate->num_mixers = num_lm; - dpu_enc->connector = conn_state->connector; + /* + * There may be 4 PP and 2 INTF for quad pipe case, so INTF is not + * bind to PP 1:1. Let's calculate the stride with pipe/INTF + */ + num_pp_per_intf = num_lm / dpu_enc->num_phys_encs; + for (i = 0; i < dpu_enc->num_phys_encs; i++) { struct dpu_encoder_phys *phys = dpu_enc->phys_encs[i]; struct dpu_hw_ctl *ctl0 = to_dpu_hw_ctl(hw_ctl[0]); @@ -1210,7 +1215,7 @@ static void dpu_encoder_virt_atomic_mode_set(struct drm_encoder *drm_enc, return; } - phys->hw_pp = dpu_enc->hw_pp[i]; + phys->hw_pp = dpu_enc->hw_pp[num_pp_per_intf * i]; phys->cached_mode = crtc_state->adjusted_mode; if (phys->ops.atomic_mode_set) From patchwork Thu Aug 29 10:17:49 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jun Nie X-Patchwork-Id: 13782999 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id A7864C83030 for ; Thu, 29 Aug 2024 10:21:57 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 24D0D10E645; Thu, 29 Aug 2024 10:21:57 +0000 (UTC) Authentication-Results: gabe.freedesktop.org; dkim=pass (2048-bit key; unprotected) header.d=linaro.org header.i=@linaro.org header.b="a+jyHXHN"; dkim-atps=neutral Received: from mail-ot1-f47.google.com (mail-ot1-f47.google.com [209.85.210.47]) by gabe.freedesktop.org (Postfix) with ESMTPS id A895310E647 for ; Thu, 29 Aug 2024 10:21:55 +0000 (UTC) Received: by mail-ot1-f47.google.com with SMTP id 46e09a7af769-70df4b5cdd8so329345a34.1 for ; Thu, 29 Aug 2024 03:21:55 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1724926915; x=1725531715; darn=lists.freedesktop.org; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=gjSRyqv5jrIYe8oPavf5LS4RSFZl2p6GWK9ZKbwfHc8=; b=a+jyHXHNn46q0bF2/SXrBuihf+6Vz4dHeIB7sYSq2NDLilxvNb6M3wBaIW05OzM/Wk ty/msoGNSS5/OD71JwRWQGOA9fvFV8GdevcDfflrC80TMU2nw3mStU2efxCKzR2svHKr 5CD4Uyoxym0sonwYnkul/qnUwVD69j8TIIdQHW/r3JLiTt0ffGmwKSgBaL8Cnxj0/0aC qAXs+KQXiY1FszpSu6DAd1b7BdCLXa8GkyWr58Dwcn3ThGUYGbSIKTzIQJ9QyQ36bZsM bIYmzf6YsDwAcRyToaJF/1fAyXU6UfiEkPuPwvfKq94q5WzxCRVqpOjscW4F8ZXvk96K Y4Tg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1724926915; x=1725531715; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=gjSRyqv5jrIYe8oPavf5LS4RSFZl2p6GWK9ZKbwfHc8=; b=HjcDj3Fy/EQdhMWMd6YkAnZ0XqQ20M6g4ha18eV51gHT+QP1/N6Mgf6rZTDrjBPqJW nFKeN5CgAXk8bepV0JmhfxNt7dFLw8JKtJ0+zeXTLu2+sgYVTCG71fBg7+2gA/3Z+NmZ A2TqWc3NmUSSDzeX5MWzrwEZv2UjfQDCcZF3rKpT3gf+ZphbOubKB602fBMN6hEfjG7W jBkCQn9yKcJsmJFwHfnjS2TOz3SNo1BA29ToQq9AGjytCnR521DeyMfhZh0mbK4yXnXT hR5/IHS8+cBVvjHbwd2yqgsdXWifu5k4ANoN7Uag+5aNDZPLsfqK9BAxcVK4xcxuUfw2 318Q== X-Forwarded-Encrypted: i=1; AJvYcCXQp13BHdSLVmZ9EGSK3e2Gz25R5UWD4WkjSg6+DuIxMmBl5/j+59eDySx0Y2SMBkIMHoQtb89tjyo=@lists.freedesktop.org X-Gm-Message-State: AOJu0Yybu8k3ruG+gGN0VgvzPVmGos/aBGmNBhuZpj3OXgF1W0F1WTiN zh+zaAkbuZHsEYpiK+7cy/51tSBCTQXdFQHqsVlsQ/RpESlZD3eCu1La0bStnx8= X-Google-Smtp-Source: AGHT+IE2sJ3gi89U+R396+pQnENMpP6DHjXJOwnchnVnRwY/yHsyKlwnhI9BSt207Nf8HMmhG8zfoA== X-Received: by 2002:a05:6358:5290:b0:1a4:e0d7:8418 with SMTP id e5c5f4694b2df-1b603cb59camr263194455d.23.1724926914779; Thu, 29 Aug 2024 03:21:54 -0700 (PDT) Received: from [127.0.1.1] ([112.65.12.167]) by smtp.gmail.com with ESMTPSA id 41be03b00d2f7-7d22e9d4df4sm891684a12.82.2024.08.29.03.21.47 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 29 Aug 2024 03:21:54 -0700 (PDT) From: Jun Nie Date: Thu, 29 Aug 2024 18:17:49 +0800 Subject: [PATCH 20/21] drm/msm/dpu: support quad pipe in general operations MIME-Version: 1.0 Message-Id: <20240829-sm8650-v6-11-hmd-pocf-mdss-quad-upstream-8-v1-20-bdb05b4b5a2e@linaro.org> References: <20240829-sm8650-v6-11-hmd-pocf-mdss-quad-upstream-8-v1-0-bdb05b4b5a2e@linaro.org> In-Reply-To: <20240829-sm8650-v6-11-hmd-pocf-mdss-quad-upstream-8-v1-0-bdb05b4b5a2e@linaro.org> To: Rob Clark , Abhinav Kumar , Dmitry Baryshkov , Sean Paul , Marijn Suijten , David Airlie , Daniel Vetter , Maarten Lankhorst , Maxime Ripard , Thomas Zimmermann Cc: linux-arm-msm@vger.kernel.org, dri-devel@lists.freedesktop.org, freedreno@lists.freedesktop.org, linux-kernel@vger.kernel.org, Jun Nie X-Mailer: b4 0.13.0 X-Developer-Signature: v=1; a=ed25519-sha256; t=1724926736; l=6316; i=jun.nie@linaro.org; s=20240403; h=from:subject:message-id; bh=I2ikWc1eRtSUuiI5dMozrl26pLTUFuNNmccuZxgTX/s=; b=g1ueGL+TskNovQN/ZmNbHnb4EnXyhtPQROMxAonDNcj33RLavysgr4YjvXEtoRtODVlZTDTOu ri0JLuEDoopAWdVl6yM+GqV8v0lMF2vxjXlmgS/oWdM+hPzHzfuBURB X-Developer-Key: i=jun.nie@linaro.org; a=ed25519; pk=MNiBt/faLPvo+iJoP1hodyY2x6ozVXL8QMptmsKg3cc= X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" Support quad pipe in general operations with unified method. Signed-off-by: Jun Nie --- drivers/gpu/drm/msm/disp/dpu1/dpu_plane.c | 87 +++++++++++++++++-------------- 1 file changed, 47 insertions(+), 40 deletions(-) diff --git a/drivers/gpu/drm/msm/disp/dpu1/dpu_plane.c b/drivers/gpu/drm/msm/disp/dpu1/dpu_plane.c index c38c1bedd40fb..c3ea97b4ce439 100644 --- a/drivers/gpu/drm/msm/disp/dpu1/dpu_plane.c +++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_plane.c @@ -619,6 +619,7 @@ static void _dpu_plane_color_fill(struct dpu_plane *pdpu, struct msm_drm_private *priv = plane->dev->dev_private; struct dpu_plane_state *pstate = to_dpu_plane_state(plane->state); u32 fill_color = (color & 0xFFFFFF) | ((alpha & 0xFF) << 24); + int i; DPU_DEBUG_PLANE(pdpu, "\n"); @@ -632,12 +633,11 @@ static void _dpu_plane_color_fill(struct dpu_plane *pdpu, return; /* update sspp */ - _dpu_plane_color_fill_pipe(pstate, &pstate->pipe, &pstate->pipe_cfg.dst_rect, - fill_color, fmt); - - if (pstate->r_pipe.sspp) - _dpu_plane_color_fill_pipe(pstate, &pstate->r_pipe, &pstate->r_pipe_cfg.dst_rect, - fill_color, fmt); + for (i = 0; i < PIPES_PER_STAGE; i++) + if (pstate->pipe[i].sspp) + _dpu_plane_color_fill_pipe(pstate, &pstate->pipe[i], + &pstate->pipe_cfg[i].dst_rect, + fill_color, fmt); } static int dpu_plane_prepare_fb(struct drm_plane *plane, @@ -1279,8 +1279,11 @@ void dpu_plane_flush(struct drm_plane *plane) /* force 100% alpha */ _dpu_plane_color_fill(pdpu, pdpu->color_fill, 0xFF); else { - dpu_plane_flush_csc(pdpu, &pstate->pipe); - dpu_plane_flush_csc(pdpu, &pstate->r_pipe); + int i; + + for (i = 0; i < PIPES_PER_STAGE; i++) + if (pstate->pipe_cfg[i].visible) + dpu_plane_flush_csc(pdpu, &pstate->pipe[i]); } /* flag h/w flush complete */ @@ -1380,20 +1383,17 @@ static void dpu_plane_sspp_atomic_update(struct drm_plane *plane) struct dpu_plane *pdpu = to_dpu_plane(plane); struct drm_plane_state *state = plane->state; struct dpu_plane_state *pstate = to_dpu_plane_state(state); - struct dpu_sw_pipe *pipe = &pstate->pipe; - struct dpu_sw_pipe *r_pipe = &pstate->r_pipe; struct drm_crtc *crtc = state->crtc; struct drm_framebuffer *fb = state->fb; bool is_rt_pipe; const struct msm_format *fmt = msm_framebuffer_format(fb); - struct dpu_sw_pipe_cfg *pipe_cfg = &pstate->pipe_cfg; - struct dpu_sw_pipe_cfg *r_pipe_cfg = &pstate->r_pipe_cfg; + struct dpu_sw_pipe_cfg *pipe_cfg; struct dpu_kms *kms = _dpu_plane_get_kms(&pdpu->base); struct msm_gem_address_space *aspace = kms->base.aspace; struct dpu_hw_fmt_layout layout; bool layout_valid = false; - int ret; + int ret, i; ret = dpu_format_populate_layout(aspace, fb, &layout); if (ret) @@ -1412,28 +1412,28 @@ static void dpu_plane_sspp_atomic_update(struct drm_plane *plane) crtc->base.id, DRM_RECT_ARG(&state->dst), &fmt->pixel_format, MSM_FORMAT_IS_UBWC(fmt)); - dpu_plane_sspp_update_pipe(plane, pipe, pipe_cfg, fmt, - drm_mode_vrefresh(&crtc->mode), - layout_valid ? &layout : NULL); - - if (r_pipe->sspp) { - dpu_plane_sspp_update_pipe(plane, r_pipe, r_pipe_cfg, fmt, - drm_mode_vrefresh(&crtc->mode), - layout_valid ? &layout : NULL); + for (i = 0; i < PIPES_PER_STAGE; i++) { + if (pstate->pipe_cfg[i].visible && pstate->pipe[i].sspp) + dpu_plane_sspp_update_pipe(plane, &pstate->pipe[i], + &pstate->pipe_cfg[i], fmt, + drm_mode_vrefresh(&crtc->mode), + layout_valid ? &layout : NULL); } if (pstate->needs_qos_remap) pstate->needs_qos_remap = false; - pstate->plane_fetch_bw = _dpu_plane_calc_bw(pdpu->catalog, fmt, - &crtc->mode, pipe_cfg); - - pstate->plane_clk = _dpu_plane_calc_clk(&crtc->mode, pipe_cfg); - - if (r_pipe->sspp) { - pstate->plane_fetch_bw += _dpu_plane_calc_bw(pdpu->catalog, fmt, &crtc->mode, r_pipe_cfg); + pstate->plane_fetch_bw = 0; + pstate->plane_clk = 0; + for (i = 0; i < PIPES_PER_STAGE; i++) { + pipe_cfg = &pstate->pipe_cfg[i]; + if (pipe_cfg->visible) { + pstate->plane_fetch_bw += _dpu_plane_calc_bw(pdpu->catalog, fmt, + &crtc->mode, pipe_cfg); - pstate->plane_clk = max(pstate->plane_clk, _dpu_plane_calc_clk(&crtc->mode, r_pipe_cfg)); + pstate->plane_clk = max(pstate->plane_clk, + _dpu_plane_calc_clk(&crtc->mode, pipe_cfg)); + } } } @@ -1441,17 +1441,21 @@ static void _dpu_plane_atomic_disable(struct drm_plane *plane) { struct drm_plane_state *state = plane->state; struct dpu_plane_state *pstate = to_dpu_plane_state(state); - struct dpu_sw_pipe *r_pipe = &pstate->r_pipe; + struct dpu_sw_pipe *pipe; + int i; - trace_dpu_plane_disable(DRMID(plane), false, - pstate->pipe.multirect_mode); + for (i = 0; i < PIPES_PER_STAGE; i++) { + pipe = &pstate->pipe[i]; + if (pipe->multirect_index == DPU_SSPP_RECT_1) { + trace_dpu_plane_disable(DRMID(plane), false, + pstate->pipe[i - 1].multirect_mode); - if (r_pipe->sspp) { - r_pipe->multirect_index = DPU_SSPP_RECT_SOLO; - r_pipe->multirect_mode = DPU_SSPP_MULTIRECT_NONE; + pipe->multirect_index = DPU_SSPP_RECT_SOLO; + pipe->multirect_mode = DPU_SSPP_MULTIRECT_NONE; - if (r_pipe->sspp->ops.setup_multirect) - r_pipe->sspp->ops.setup_multirect(r_pipe); + if (pipe->sspp && pipe->sspp->ops.setup_multirect) + pipe->sspp->ops.setup_multirect(pipe); + } } pstate->pending = true; @@ -1607,14 +1611,17 @@ void dpu_plane_danger_signal_ctrl(struct drm_plane *plane, bool enable) struct dpu_plane *pdpu = to_dpu_plane(plane); struct dpu_plane_state *pstate = to_dpu_plane_state(plane->state); struct dpu_kms *dpu_kms = _dpu_plane_get_kms(plane); + int i; if (!pdpu->is_rt_pipe) return; pm_runtime_get_sync(&dpu_kms->pdev->dev); - _dpu_plane_set_qos_ctrl(plane, &pstate->pipe, enable); - if (pstate->r_pipe.sspp) - _dpu_plane_set_qos_ctrl(plane, &pstate->r_pipe, enable); + for (i = 0; i < PIPES_PER_STAGE; i++) { + if (!pstate->pipe_cfg[i].visible) + break; + _dpu_plane_set_qos_ctrl(plane, &pstate->pipe[i], enable); + } pm_runtime_put_sync(&dpu_kms->pdev->dev); } #endif From patchwork Thu Aug 29 10:17:50 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jun Nie X-Patchwork-Id: 13783000 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 25D76C83030 for ; Thu, 29 Aug 2024 10:22:07 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id A9AA910E649; Thu, 29 Aug 2024 10:22:06 +0000 (UTC) Authentication-Results: gabe.freedesktop.org; dkim=pass (2048-bit key; unprotected) header.d=linaro.org header.i=@linaro.org header.b="FhUaPCKd"; dkim-atps=neutral Received: from mail-ot1-f45.google.com (mail-ot1-f45.google.com [209.85.210.45]) by gabe.freedesktop.org (Postfix) with ESMTPS id A97EE10E64B for ; Thu, 29 Aug 2024 10:22:04 +0000 (UTC) Received: by mail-ot1-f45.google.com with SMTP id 46e09a7af769-7093ba310b0so190245a34.2 for ; Thu, 29 Aug 2024 03:22:04 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1724926924; x=1725531724; darn=lists.freedesktop.org; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=EoL1g7/icKaoeTVszo+C7O0+4g1QDi21vNC01sKJZ+U=; b=FhUaPCKdbcMGUFgXjy7uSPMRgWVuEyuPYtHDi0gM7CyJV3U4r0I/YVqE/DewQbXi+g Dit7qzGjOjeEtvdW9sfH/f0BoOmLXgprYqSd6YVA31wcb+6jHJ16UcQRpK54dScKRapf YBuVJYkqUeQZsYC/avBTB1rHStxV8UOfaI9YIwvS7h4c/7gFR8wtkzsfOwsNsvz5kkGd uOmz6CFuRnstBQaWmv02Oy+65ozIpYiPY0Q2FrNMoHC90126TKtCtKISHdRs0bX4xsTe 2A1+bfbn5HR9fAZmHNriblVapaPqayidpK5Q/bPtx2pfIsv77xO9n7en0n+wZyAeFERa 2Otg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1724926924; x=1725531724; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=EoL1g7/icKaoeTVszo+C7O0+4g1QDi21vNC01sKJZ+U=; b=CyNrcUl/fl6hHxyWXn8nz1ei22B2LUTz5wsWolQB+BHlHxzKC1f+IFXPGf1VfNnyFN sX83A15rcCevICzKv+OTFgSwEvxBuS9QxNdEa5XJtXpMQzK+VMrJzai2e+fKngNeyWMC FspTPMYZKz7ztBTCb+Xs1lVAoI8PYvfBk1XasB3A5Mv8WhhvIwuvs+E2wq2ipPtscE6c pW7KnszM7ffA+zxLJ+esKylHihQmD+0wijXUuauROY8J0l5ReYYcO3LWdJQE8R0xfCp1 zEfHRD70cz4vxUTofdUEwND3CFt5I7wl0cEx+245Y/D6smfMBisqCUkKuo+DqAVmRJkb COyA== X-Forwarded-Encrypted: i=1; AJvYcCXFFdCDVlCIos3WGKLglk8HQkA+YnjR71GlZkQ0h42DjSk6FtscG7sNyLDWUV50WrXqEuJYEcCMnH8=@lists.freedesktop.org X-Gm-Message-State: AOJu0YxGjpBodm/a6r6Rrp+NUMKWYGYgSjYYxAzbFEFr2/3iTlyTZQ5V eAQO07H1kM5bTwkyiK74hr3KKlH+J4G5BsjT2eoxVgcm5d7F/LBVnGJbKSd6YS8t8l3IYVLGp10 rxi1HLQ== X-Google-Smtp-Source: AGHT+IGeTVY5NXa21IFreOo7cUd0AF9nsb1AdXB76rapR4PU7ulwY3JN4O81zXAJhD39YeE/gmu+nA== X-Received: by 2002:a05:6358:3128:b0:1a6:7e01:e4f4 with SMTP id e5c5f4694b2df-1b603cce66emr313159955d.28.1724926923856; Thu, 29 Aug 2024 03:22:03 -0700 (PDT) Received: from [127.0.1.1] ([112.65.12.167]) by smtp.gmail.com with ESMTPSA id 41be03b00d2f7-7d22e9d4df4sm891684a12.82.2024.08.29.03.21.55 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 29 Aug 2024 03:22:03 -0700 (PDT) From: Jun Nie Date: Thu, 29 Aug 2024 18:17:50 +0800 Subject: [PATCH 21/21] drm/msm/dpu: revise debug info to support quad pipe MIME-Version: 1.0 Message-Id: <20240829-sm8650-v6-11-hmd-pocf-mdss-quad-upstream-8-v1-21-bdb05b4b5a2e@linaro.org> References: <20240829-sm8650-v6-11-hmd-pocf-mdss-quad-upstream-8-v1-0-bdb05b4b5a2e@linaro.org> In-Reply-To: <20240829-sm8650-v6-11-hmd-pocf-mdss-quad-upstream-8-v1-0-bdb05b4b5a2e@linaro.org> To: Rob Clark , Abhinav Kumar , Dmitry Baryshkov , Sean Paul , Marijn Suijten , David Airlie , Daniel Vetter , Maarten Lankhorst , Maxime Ripard , Thomas Zimmermann Cc: linux-arm-msm@vger.kernel.org, dri-devel@lists.freedesktop.org, freedreno@lists.freedesktop.org, linux-kernel@vger.kernel.org, Jun Nie X-Mailer: b4 0.13.0 X-Developer-Signature: v=1; a=ed25519-sha256; t=1724926736; l=3921; i=jun.nie@linaro.org; s=20240403; h=from:subject:message-id; bh=nVktgxY+Y22iglpT7aElSF7x0cz/c6cqG4U2dR19+fc=; b=ps+qzD7mgTydu3jMaADiSxfJjhNUZjxeZGWz5mhRkEH5L6u1lEgMUtgsZS8PogIIhHvYDdUCr 5HJfsvYAO6ZCG37w8uuEos6cFcsZ8wmsgOcKJVAZ5ki84E6rwKZoQC7 X-Developer-Key: i=jun.nie@linaro.org; a=ed25519; pk=MNiBt/faLPvo+iJoP1hodyY2x6ozVXL8QMptmsKg3cc= X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" Unify debug info to support dual pipe and quad pipe Signed-off-by: Jun Nie --- drivers/gpu/drm/msm/disp/dpu1/dpu_crtc.c | 16 +++++++------- drivers/gpu/drm/msm/disp/dpu1/dpu_plane.c | 35 +++++++++++++------------------ 2 files changed, 21 insertions(+), 30 deletions(-) diff --git a/drivers/gpu/drm/msm/disp/dpu1/dpu_crtc.c b/drivers/gpu/drm/msm/disp/dpu1/dpu_crtc.c index 8fd56f8f2851f..9e8c5225c8dca 100644 --- a/drivers/gpu/drm/msm/disp/dpu1/dpu_crtc.c +++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_crtc.c @@ -1437,15 +1437,13 @@ static int _dpu_debugfs_status_show(struct seq_file *s, void *data) seq_printf(s, "\tdst x:%4d dst_y:%4d dst_w:%4d dst_h:%4d\n", state->crtc_x, state->crtc_y, state->crtc_w, state->crtc_h); - seq_printf(s, "\tsspp[0]:%s\n", - pstate->pipe.sspp->cap->name); - seq_printf(s, "\tmultirect[0]: mode: %d index: %d\n", - pstate->pipe.multirect_mode, pstate->pipe.multirect_index); - if (pstate->r_pipe.sspp) { - seq_printf(s, "\tsspp[1]:%s\n", - pstate->r_pipe.sspp->cap->name); - seq_printf(s, "\tmultirect[1]: mode: %d index: %d\n", - pstate->r_pipe.multirect_mode, pstate->r_pipe.multirect_index); + for (i = 0; i < PIPES_PER_STAGE; i++) { + if (!pstate->pipe_cfg[i].visible) + break; + seq_printf(s, "\tsspp[%d]:%s\n", + i, pstate->pipe[i].sspp->cap->name); + seq_printf(s, "\tmultirect[%d]: mode: %d index: %d\n", + i, pstate->pipe[i].multirect_mode, pstate->pipe[i].multirect_index); } seq_puts(s, "\n"); diff --git a/drivers/gpu/drm/msm/disp/dpu1/dpu_plane.c b/drivers/gpu/drm/msm/disp/dpu1/dpu_plane.c index c3ea97b4ce439..12f7b510eb5e0 100644 --- a/drivers/gpu/drm/msm/disp/dpu1/dpu_plane.c +++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_plane.c @@ -1550,30 +1550,23 @@ static void dpu_plane_atomic_print_state(struct drm_printer *p, const struct drm_plane_state *state) { const struct dpu_plane_state *pstate = to_dpu_plane_state(state); - const struct dpu_sw_pipe *pipe = &pstate->pipe; - const struct dpu_sw_pipe_cfg *pipe_cfg = &pstate->pipe_cfg; - const struct dpu_sw_pipe *r_pipe = &pstate->r_pipe; - const struct dpu_sw_pipe_cfg *r_pipe_cfg = &pstate->r_pipe_cfg; + const struct dpu_sw_pipe *pipe; + const struct dpu_sw_pipe_cfg *pipe_cfg; + int i; drm_printf(p, "\tstage=%d\n", pstate->stage); - if (pipe->sspp) { - drm_printf(p, "\tsspp[0]=%s\n", pipe->sspp->cap->name); - drm_printf(p, "\tmultirect_mode[0]=%s\n", dpu_get_multirect_mode(pipe->multirect_mode)); - drm_printf(p, "\tmultirect_index[0]=%s\n", - dpu_get_multirect_index(pipe->multirect_index)); - drm_printf(p, "\tsrc[0]=" DRM_RECT_FMT "\n", DRM_RECT_ARG(&pipe_cfg->src_rect)); - drm_printf(p, "\tdst[0]=" DRM_RECT_FMT "\n", DRM_RECT_ARG(&pipe_cfg->dst_rect)); - } - - if (r_pipe->sspp) { - drm_printf(p, "\tsspp[1]=%s\n", r_pipe->sspp->cap->name); - drm_printf(p, "\tmultirect_mode[1]=%s\n", - dpu_get_multirect_mode(r_pipe->multirect_mode)); - drm_printf(p, "\tmultirect_index[1]=%s\n", - dpu_get_multirect_index(r_pipe->multirect_index)); - drm_printf(p, "\tsrc[1]=" DRM_RECT_FMT "\n", DRM_RECT_ARG(&r_pipe_cfg->src_rect)); - drm_printf(p, "\tdst[1]=" DRM_RECT_FMT "\n", DRM_RECT_ARG(&r_pipe_cfg->dst_rect)); + for (i = 0; i < PIPES_PER_STAGE; i++) { + pipe_cfg = &pstate->pipe_cfg[i]; + pipe = &pstate->pipe[i]; + if (pipe->sspp) { + drm_printf(p, "\tsspp[%d]=%s\n", i, pipe->sspp->cap->name); + drm_printf(p, "\tmultirect_mode[%d]=%s\n", i, dpu_get_multirect_mode(pipe->multirect_mode)); + drm_printf(p, "\tmultirect_index[%d]=%s\n", + i, dpu_get_multirect_index(pipe->multirect_index)); + drm_printf(p, "\tsrc[%d]=" DRM_RECT_FMT "\n", i, DRM_RECT_ARG(&pipe_cfg->src_rect)); + drm_printf(p, "\tdst[%d]=" DRM_RECT_FMT "\n", i, DRM_RECT_ARG(&pipe_cfg->dst_rect)); + } } }