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; }; /**