Received: by 2002:a05:6500:1b8f:b0:1fa:5c73:8e2d with SMTP id df15csp1089308lqb; Wed, 29 May 2024 22:57:13 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCUTqdFuiWJt2o8BNnL5hOMxs9tqVlUkLSTFj/0T7AfZLOYmhStlsXzGI4l0uj+cwPiV5Otk/1gmJdvWmqHbwY0rN26kFtvgI4nH7RLVxQ== X-Google-Smtp-Source: AGHT+IH8bOAB4LWTkWdrEJ1YQBRmP+lWxWX/Wc2NmROKcVFZo+x8sD/PwJzzUaaZI3Yf3AG45OUu X-Received: by 2002:a05:622a:1a08:b0:43a:74ea:89b with SMTP id d75a77b69052e-43fe92bb5bamr18602991cf.16.1717048633630; Wed, 29 May 2024 22:57:13 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1717048633; cv=pass; d=google.com; s=arc-20160816; b=CuUbfuiYzLSBVa/DnLyfWnDmuscbza2xDKK8CU/nvkQzxh9clWJIiuTFH9pUh145nu fAbnPbBQGi2rBpwKQ1Uu5sb84f/2KyUfIeBhxCdgRtE1NcgJCFLw/tJU2NYFWrvJ2RKr Hsbaqv3PSyQJ5qC28dXENwPC6ReyFgXG0vh5ny7meezhE7X0jaAvOgzlI6nS6YSrYOAA Ru9jg/IkEWtmK1EzwwQmb4gHmBE3KhYwFY/wsD4m9b02pj2Js3cmTQL6UmSGZICaCRzC NncG3dejRzBEYs2y8Qg5/bBS31yXetKMv8axCWD+00oeQk1tCFubie3eO2wy2AjgXzHg Yclg== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:list-unsubscribe:list-subscribe:list-id:precedence :subject:date:from:dkim-signature; bh=3Q2dQm7nGZxBRKpXC++099T4NGLN3Sf0rMWvCRq/ORE=; fh=SokN+fnxiUBhylwcaEYe9QWV56FnTeErxe/NuHRkPJw=; b=AAhfnAdw5OkyVPGLJYjd8uXqAD83KUZuUzjwwcQAZQ8AeIbdiEWJV7TW4x8B+haGku ctf+ybvdLm4pWHcrb1NGsJEbQJWeTVCwL84NIiqjV42b5WFUsSXTyvYXz98WFrjqhibg TFMnYNEeRzQ3SqmR4lhmQP+yV298VLHiAgiTRqHmJRjfGayAy2GJSQVZCe1A6Tx6VwMi oLLdbSJ2sM8VcquFptkwi6bjqpyrbd7oeAUbowPwyrhrT3GbU9V74X6E2Ez5KQLbY3yC QMAuEYx4VJNEqTiJ941CGLcNkh5LLgrq3M+D8eDZ6y0EbPBrS1jkef/eZ3QV/H/uDSk4 /pqA==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=H8iR0Rp8; arc=pass (i=1 spf=pass spfdomain=linaro.org dkim=pass dkdomain=linaro.org dmarc=pass fromdomain=linaro.org); spf=pass (google.com: domain of linux-kernel+bounces-194965-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-194965-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [2604:1380:45d1:ec00::1]) by mx.google.com with ESMTPS id d75a77b69052e-43fb17f0097si139720381cf.177.2024.05.29.22.57.13 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 29 May 2024 22:57:13 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-194965-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) client-ip=2604:1380:45d1:ec00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=H8iR0Rp8; arc=pass (i=1 spf=pass spfdomain=linaro.org dkim=pass dkdomain=linaro.org dmarc=pass fromdomain=linaro.org); spf=pass (google.com: domain of linux-kernel+bounces-194965-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-194965-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ny.mirrors.kernel.org (Postfix) with ESMTPS id 236BB1C21FF3 for ; Thu, 30 May 2024 05:57:13 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 8610B143758; Thu, 30 May 2024 05:56:59 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="H8iR0Rp8" Received: from mail-pl1-f177.google.com (mail-pl1-f177.google.com [209.85.214.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 19543139584 for ; Thu, 30 May 2024 05:56:56 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.214.177 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717048618; cv=none; b=aNMm5seS419RIAHueiKUWinV2uRTnH4sNX9YX2lMf4gF5ITz7kf+KoR4PLnqf3OEto8J0B/oEyKKcRUQ9GUblWC1qgpueYWXYYVx1ww5U1ZdxMULph+F/WQIjbXb+XN++HfQRJefltTzxW4huvI6PJhWRbq/o/OFCdo62wu6OLM= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717048618; c=relaxed/simple; bh=WVT01B++cpJsc5aWz2E9Ktl7ovUMti4jIZvkF51Gf+M=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=DeWHWuZJLEu3tNLqGYfIphuE5wKtxtfeZI+wUKNiX4TV248x3lAQyANHWEsgv95adoDWi194KQlV32vy/4lQDXhDrpzh+G3avxkRoVNjqGQfx6nC+5ZR3KCBUQ0l+y3UuyQWd1uxbc7CNuOfx9szMa//9Wh5WAp7Q9PmbTTzDV4= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org; spf=pass smtp.mailfrom=linaro.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b=H8iR0Rp8; arc=none smtp.client-ip=209.85.214.177 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linaro.org Received: by mail-pl1-f177.google.com with SMTP id d9443c01a7336-1f61f775738so1346375ad.2 for ; Wed, 29 May 2024 22:56:56 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1717048616; x=1717653416; darn=vger.kernel.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=3Q2dQm7nGZxBRKpXC++099T4NGLN3Sf0rMWvCRq/ORE=; b=H8iR0Rp8Z/LLhWPaDONl5v/hQnk+KdaUYJZ+EiUKsNTqmpfbdjQTpjARGoMr5WV+Ci DtdG27cGHwbn/dHwSNcW3K7mUYI2hcbGhhr7Vn7WWeH4XyKcckC2jPcxxMgUpoydqATa /QSFCikJwqC3EafVTRKxJmNGTHxZyD7CqzAfGnhiRSLILZBQqezQSgqOBIJ2AMti+dzA zsJZybwSwV58CNXBhL4G2lz8ByNvl7eYmlbCAdAHg+h3UqiJf8Lu5FlyApK7+EHCYRJc uFrDv5k5Feac6x9XGqM3K2I1YR8M8F1CKh5Ta/sVIhnq9Nfp9faHSrZafeejao3GzYcB +EcQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1717048616; x=1717653416; 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=3Q2dQm7nGZxBRKpXC++099T4NGLN3Sf0rMWvCRq/ORE=; b=lXJyOX3ybTdigPrTR6dmTYs+X60qvp1oPHnh1i2y+Z7yEtCg7ONe2f+K6Ids5Afg++ ZHXlFXbp2yzbRwtMKWs2VA9zgAak2Ll0VFVnhJ6W2gvaNAfG8yGXPPcmJdDWeJLOZH0l NYnRzQID2RaMYdgm9jTOOAjV62myYvbQ+/Sm/SZnJEzjbGT5T9h7J+4YNj4GRmKW+AOc qqkH8dwxQZg4iSmipJ+ALYiOA8I9I542LY8vCnB3j3zIo/8txMw64En0TUbaayOUI8/8 EiAozQJiK+rBi8DexRa3wPNO3MlzfXU6qKl9ivO60DURbMx12fY1tAiUbrQ1U5r0R1V3 SCfg== X-Forwarded-Encrypted: i=1; AJvYcCXZ9FpAO/eNe+8QomN4Te/LX/1giO9yQrCP5N4KdXMRYMeL8AoHd0w3YjcdLYdATMOdPqz5k87xhm5OfhpatROKnegr5gamHt1LyDYY X-Gm-Message-State: AOJu0Yy2ghjUz9o1SKdJpOCRVLv5/DvDHAtreZcgmL0G0zNCX3yTzc2q KmCAkpPov86ndW9ala5QnI9vXeqDU9uGjZgbTEb1d00VVzPGEzFi3B3P71nMdIc= X-Received: by 2002:a17:903:1d1:b0:1f5:e796:f279 with SMTP id d9443c01a7336-1f6193f880amr12124605ad.9.1717048616304; Wed, 29 May 2024 22:56:56 -0700 (PDT) Received: from [127.0.1.1] ([112.64.61.67]) by smtp.gmail.com with ESMTPSA id d9443c01a7336-1f44c75ffc6sm110006705ad.9.2024.05.29.22.56.48 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 29 May 2024 22:56:55 -0700 (PDT) From: Jun Nie Date: Thu, 30 May 2024 13:56:45 +0800 Subject: [PATCH v6 1/6] drm/msm/dpu: fix video mode DSC for DSI Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit Message-Id: <20240530-msm-drm-dsc-dsi-video-upstream-4-v6-1-2ab1d334c657@linaro.org> References: <20240530-msm-drm-dsc-dsi-video-upstream-4-v6-0-2ab1d334c657@linaro.org> In-Reply-To: <20240530-msm-drm-dsc-dsi-video-upstream-4-v6-0-2ab1d334c657@linaro.org> To: Rob Clark , Abhinav Kumar , Dmitry Baryshkov , Sean Paul , Marijn Suijten , David Airlie , Daniel Vetter , Jessica Zhang , Vinod Koul 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 , Neil Armstrong X-Mailer: b4 0.13.0 X-Developer-Signature: v=1; a=ed25519-sha256; t=1717048617; l=3798; i=jun.nie@linaro.org; s=20240403; h=from:subject:message-id; bh=7/Tbk8+Q7zUBUA35jCKdBQKG2nj1ozoalJhqd4RQMnk=; b=Dhlz3AsXrGGPXqlA2+lGadxOh+L1AjtcGB6npyI0d9ojvc8k/NkO8+/YfRe/IyM/VfF9SJVyd OH/km1k/wQ/DlMtij0zP2N2sJJrUar3jLkRTu/HoShmSfieTWRj/ftB X-Developer-Key: i=jun.nie@linaro.org; a=ed25519; pk=MNiBt/faLPvo+iJoP1hodyY2x6ozVXL8QMptmsKg3cc= From: Jonathan Marek Add width change in DPU timing for DSC compression case to work with DSI video mode. Signed-off-by: Jonathan Marek Signed-off-by: Jun Nie Tested-by: Neil Armstrong # on SM8550-QRD Tested-by: Neil Armstrong # on SM8650-QRD Tested-by: Neil Armstrong # on SM8650-HDK Reviewed-by: Dmitry Baryshkov Reviewed-by: Jessica Zhang --- drivers/gpu/drm/msm/disp/dpu1/dpu_encoder.c | 2 +- drivers/gpu/drm/msm/disp/dpu1/dpu_encoder_phys.h | 8 ++++++++ drivers/gpu/drm/msm/disp/dpu1/dpu_encoder_phys_vid.c | 18 ++++++++++++++++++ 3 files changed, 27 insertions(+), 1 deletion(-) diff --git a/drivers/gpu/drm/msm/disp/dpu1/dpu_encoder.c b/drivers/gpu/drm/msm/disp/dpu1/dpu_encoder.c index 119f3ea50a7c..48cef6e79c70 100644 --- a/drivers/gpu/drm/msm/disp/dpu1/dpu_encoder.c +++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_encoder.c @@ -564,7 +564,7 @@ bool dpu_encoder_use_dsc_merge(struct drm_encoder *drm_enc) return (num_dsc > 0) && (num_dsc > intf_count); } -static struct drm_dsc_config *dpu_encoder_get_dsc_config(struct drm_encoder *drm_enc) +struct drm_dsc_config *dpu_encoder_get_dsc_config(struct drm_encoder *drm_enc) { struct msm_drm_private *priv = drm_enc->dev->dev_private; struct dpu_encoder_virt *dpu_enc = to_dpu_encoder_virt(drm_enc); 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 002e89cc1705..2167c46c1a45 100644 --- a/drivers/gpu/drm/msm/disp/dpu1/dpu_encoder_phys.h +++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_encoder_phys.h @@ -334,6 +334,14 @@ static inline enum dpu_3d_blend_mode dpu_encoder_helper_get_3d_blend_mode( */ unsigned int dpu_encoder_helper_get_dsc(struct dpu_encoder_phys *phys_enc); +/** + * dpu_encoder_get_dsc_config - get DSC config for the DPU encoder + * This helper function is used by physical encoder to get DSC config + * used for this encoder. + * @drm_enc: Pointer to encoder structure + */ +struct drm_dsc_config *dpu_encoder_get_dsc_config(struct drm_encoder *drm_enc); + /** * dpu_encoder_get_drm_fmt - return DRM fourcc format * @phys_enc: Pointer to physical encoder structure diff --git a/drivers/gpu/drm/msm/disp/dpu1/dpu_encoder_phys_vid.c b/drivers/gpu/drm/msm/disp/dpu1/dpu_encoder_phys_vid.c index ef69c2f408c3..925ec6ada0e1 100644 --- a/drivers/gpu/drm/msm/disp/dpu1/dpu_encoder_phys_vid.c +++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_encoder_phys_vid.c @@ -11,6 +11,7 @@ #include "dpu_trace.h" #include "disp/msm_disp_snapshot.h" +#include #include #define DPU_DEBUG_VIDENC(e, fmt, ...) DPU_DEBUG("enc%d intf%d " fmt, \ @@ -115,6 +116,23 @@ static void drm_mode_to_intf_timing_params( timing->h_front_porch = timing->h_front_porch >> 1; timing->hsync_pulse_width = timing->hsync_pulse_width >> 1; } + + /* + * for DSI, if compression is enabled, then divide the horizonal active + * timing parameters by compression ratio. bits of 3 components(R/G/B) + * is compressed into bits of 1 pixel. + */ + if (phys_enc->hw_intf->cap->type != INTF_DP && timing->compression_en) { + struct drm_dsc_config *dsc = + dpu_encoder_get_dsc_config(phys_enc->parent); + /* + * TODO: replace drm_dsc_get_bpp_int with logic to handle + * fractional part if there is fraction + */ + timing->width = timing->width * drm_dsc_get_bpp_int(dsc) / + (dsc->bits_per_component * 3); + timing->xres = timing->width; + } } static u32 get_horizontal_total(const struct dpu_hw_intf_timing_params *timing) -- 2.34.1