From patchwork Wed Apr 3 09:10:57 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jun Nie X-Patchwork-Id: 13615535 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 9D4FCCD1296 for ; Wed, 3 Apr 2024 09:11:19 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id C4C5E112901; Wed, 3 Apr 2024 09:11:18 +0000 (UTC) Authentication-Results: gabe.freedesktop.org; dkim=pass (2048-bit key; unprotected) header.d=linaro.org header.i=@linaro.org header.b="KzqM733O"; dkim-atps=neutral Received: from mail-pl1-f170.google.com (mail-pl1-f170.google.com [209.85.214.170]) by gabe.freedesktop.org (Postfix) with ESMTPS id 58AAE112904 for ; Wed, 3 Apr 2024 09:11:17 +0000 (UTC) Received: by mail-pl1-f170.google.com with SMTP id d9443c01a7336-1e27e174ccbso9391055ad.2 for ; Wed, 03 Apr 2024 02:11:17 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1712135477; x=1712740277; 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=NP1mArxks5bntvoBu6vgePRngXslO+DwNYzgIBI4xco=; b=KzqM733OIhec22dzGuI8IXRMJhkNkr6QKmU/jUWi3A7IDT6TJSbNrCAW8FSq3Ed/gr 5iQcK3rWfyqHmVuDG6D9+KNVv4WjYSg3o6UsLNV58GhkUk9bbcFfXGO/beuAau/lcUCa sxXYXT+NRt/leoo8FYzewckzjFnW16KGi9YpGl2I93GBt3Ep9Dl9ANRn9kXM/V0QWjGs kEszj4C5gtyy8aQGi5sN6P7x4D7U81U0k82vrZZYZWhX7npvWK1JFuzZuoUk4sJPNazo 65ojDvrKwyF8TapA3qYOJQ338Ny2hx/deTsQm0zuz8CclOSrEw/Av/MQ6U94nI4pgEL4 jSGA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1712135477; x=1712740277; 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=NP1mArxks5bntvoBu6vgePRngXslO+DwNYzgIBI4xco=; b=oWCT8HC5iBa3KsJtnnySqyxoZR+3VNMiNp4wRT7Y5j7UpjbPuOEJT+9dNHGUTdKURR mTG2ohSOLHZEYS+3DAu9vOjumbTAmJqgyDonNtiJc8zg1gcGozsaVLPHtfpZgn02ddrq /ryLfDbAT9BP6LJ/xVwZAoMsBqmuGgIiMsMfa5V9xWPrBdgNCI/2ExcsXtkKiOAPHU/T uQmeN7ZEHL1u8lLJBW4K+x4H358kZlFjGE36HMklEctG6TJId+9dX3pibJzqkWRKO4Pg qD0NZZrtSkTxMDgeF8Fjayum9Zd5sCsbi4+NvV/kE79+SvGgaOU2GEb+jHMTZoSSMDTg lTKA== X-Forwarded-Encrypted: i=1; AJvYcCWTKZv+Mji0+na0VqJr8aR6mxmyB3LpDBgr84S5tf+iskzdos7uNOo/AJFJEPluMLmLTKZOn397HgUZ1HiGOd7rssN0mOq4XRzG8KyEHTTS X-Gm-Message-State: AOJu0YwKHuECCzHHfP6K1cVpjW6y74k6vj/PyaCA5xO8GB9E2z3pRmlR rbJlo+qGxJDyG8vj5Tx0x2eN6y0QFwbHL2RHTu+HzuZzcInUUQvl7vWRSZ541Wc= X-Google-Smtp-Source: AGHT+IEvnZUXLpdEar+zDu2dEcKJ3XPbx7m6PBvpXM6ninTCE0WpaPkwirt2qnexBqWzAKnOJ5d/Zw== X-Received: by 2002:a17:903:2285:b0:1e0:b872:d862 with SMTP id b5-20020a170903228500b001e0b872d862mr19646560plh.52.1712135476796; Wed, 03 Apr 2024 02:11:16 -0700 (PDT) Received: from [127.0.1.1] ([112.65.12.66]) by smtp.gmail.com with ESMTPSA id lo14-20020a170903434e00b001e0aded0ca7sm12688087plb.239.2024.04.03.02.11.10 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 03 Apr 2024 02:11:16 -0700 (PDT) From: Jun Nie Date: Wed, 03 Apr 2024 17:10:57 +0800 Subject: [PATCH v3 1/6] drm/msm/dpu: fix video mode DSC for DSI MIME-Version: 1.0 Message-Id: <20240403-msm-drm-dsc-dsi-video-upstream-v1-1-db5036443545@linaro.org> References: <20240403-msm-drm-dsc-dsi-video-upstream-v1-0-db5036443545@linaro.org> In-Reply-To: <20240403-msm-drm-dsc-dsi-video-upstream-v1-0-db5036443545@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 X-Mailer: b4 0.13.0 X-Developer-Signature: v=1; a=ed25519-sha256; t=1712135460; l=2016; i=jun.nie@linaro.org; s=20240403; h=from:subject:message-id; bh=m6HQvVN42IUfffBpA5rSrdSQLAGl00b8q3W/bbmwYL0=; b=X1XSY5kWlW4EvhrnUx70p2aoQcx3f1DnnQ4OyjHIWQvbWeRXvcU2GduJDjEEDh2iXJNAm4MLN Z3Bv1A5eBC0BqnYTDzQzUt3NZ19ccVql5AenjM0xwfQJWidDKXu80Ql 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 necessary DPU timing and control changes for DSC to work with DSI video mode. Signed-off-by: Jonathan Marek Signed-off-by: Jun Nie --- drivers/gpu/drm/msm/disp/dpu1/dpu_encoder_phys_vid.c | 9 +++++++++ drivers/gpu/drm/msm/disp/dpu1/dpu_hw_intf.c | 8 ++++++++ 2 files changed, 17 insertions(+) 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 d9e7dbf0499c..c7b009a60b63 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 @@ -115,6 +115,15 @@ 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. + */ + if (phys_enc->hw_intf->cap->type != INTF_DP && timing->compression_en) { + timing->width = timing->width / 3; /* XXX: don't assume 3:1 compression ratio */ + timing->xres = timing->width; + } } static u32 get_horizontal_total(const struct dpu_hw_intf_timing_params *timing) diff --git a/drivers/gpu/drm/msm/disp/dpu1/dpu_hw_intf.c b/drivers/gpu/drm/msm/disp/dpu1/dpu_hw_intf.c index 965692ef7892..079efb48db05 100644 --- a/drivers/gpu/drm/msm/disp/dpu1/dpu_hw_intf.c +++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_hw_intf.c @@ -167,6 +167,14 @@ static void dpu_hw_intf_setup_timing_engine(struct dpu_hw_intf *ctx, intf_cfg2 |= INTF_CFG2_DATABUS_WIDEN; data_width = p->width; + if (p->wide_bus_en && !dp_intf) + data_width = p->width >> 1; + + if (p->compression_en) + intf_cfg2 |= INTF_CFG2_DCE_DATA_COMPRESS; + + if (p->compression_en && dp_intf) + DPU_ERROR("missing adjustments for DSC+DP\n"); hsync_data_start_x = hsync_start_x; hsync_data_end_x = hsync_start_x + data_width - 1; From patchwork Wed Apr 3 09:10:58 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jun Nie X-Patchwork-Id: 13615536 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 23C24CD1288 for ; Wed, 3 Apr 2024 09:11:26 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 852C1112909; Wed, 3 Apr 2024 09:11:25 +0000 (UTC) Authentication-Results: gabe.freedesktop.org; dkim=pass (2048-bit key; unprotected) header.d=linaro.org header.i=@linaro.org header.b="l2uxpM2Y"; dkim-atps=neutral Received: from mail-pf1-f179.google.com (mail-pf1-f179.google.com [209.85.210.179]) by gabe.freedesktop.org (Postfix) with ESMTPS id EB3B311290B for ; Wed, 3 Apr 2024 09:11:23 +0000 (UTC) Received: by mail-pf1-f179.google.com with SMTP id d2e1a72fcca58-6eae2b57ff2so4934557b3a.2 for ; Wed, 03 Apr 2024 02:11:23 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1712135483; x=1712740283; 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=cpjQAPGX7DRYeObxhpkzDQOHk6DN4GVEcESJCG1mUPs=; b=l2uxpM2Y7L7TPBt3QvkbZ2AHzg+mllWfXe9W8Hfj0LIqp1CPGEBEGDt31wEGaPEgsH xQ8YEa8ZYLDKzw+duaTSnIQJ3G6T8ojwmempJJJ4Jejfh/aFLbj5RMrn9cj7V+Qo3nLq EyK7b3vVFmUgAWUG1fs6KFuZA0xZs1tb7z87wHi4nZ2QnSzBgtgbBxnz/4vzd9fohDG4 3AdcBWFFStX+8Aq4Bjg8vZEwQzIYJNtEPHHNp+tPrhu8rFwYs2Ex5fznBhTUbcJRaxRY yYN/8+P0ocdP6ciMhs5SqyZRscRHK54zRmxVcybXjkPtFpcNI/3GmQpqKg0oRzsmsEbZ 6eug== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1712135483; x=1712740283; 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=cpjQAPGX7DRYeObxhpkzDQOHk6DN4GVEcESJCG1mUPs=; b=jk+W7l6CmyjdggxtiT+FsZvjni1J09fnAC4OPmgG9NMOoHSg/QIxgGM6ACCEBANPTL Bf79OeVLW39SuUsynsyXlEDy9OY+8rfxxjLOsXnBuG6i1WR4vInGVr3FgwOnacwI3oap RSBP8ENM+WikcjvDzJuUeNcvAqTEQQvYFkoK1hkj789zx08Fw7cJr9D2hBZ9343PPkQK lm09bsdpzdmHD4JfHi0d4T+ovTwsuYqFIxA5YLhB5z9yF8baXoKdPHO7Kzar0UaTZeC2 4SHgHltfomiZbTb6YObLGOxtkR+7JSFQ1oznScraNVID+6TnAyCtT5Tlmap/1zUumAD+ NITg== X-Forwarded-Encrypted: i=1; AJvYcCXe1oyYUnZtPsl0fwrxfJwVWnACJfVpyIWPnmI3/zZDnZqJPb2ZtJKqFB5+MZFP6nsaXz3x69OtYQfu54CWfPxV94k2wIfZNbuzYwiLzEZ1 X-Gm-Message-State: AOJu0Ywap7eu0htHvTvNVEsRvUeOCRCkLw2AEuQxrv19odHjIL/LurzP vJFv22Bmwbs0kASykWlTs3tp/FW/iBxnDDsvau5xSwWTR1aI4hJfeCPp4OPQQUg= X-Google-Smtp-Source: AGHT+IHP8Wkk3WqZo2x4m5I0Y9pbkAk5VQE/2rUf71FZT7C/JxIaPYVwnEjbjC99Ufxm9f+YT9UumQ== X-Received: by 2002:a05:6a21:7898:b0:1a1:6803:69a3 with SMTP id bf24-20020a056a21789800b001a1680369a3mr17535809pzc.0.1712135483394; Wed, 03 Apr 2024 02:11:23 -0700 (PDT) Received: from [127.0.1.1] ([112.65.12.66]) by smtp.gmail.com with ESMTPSA id lo14-20020a170903434e00b001e0aded0ca7sm12688087plb.239.2024.04.03.02.11.17 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 03 Apr 2024 02:11:22 -0700 (PDT) From: Jun Nie Date: Wed, 03 Apr 2024 17:10:58 +0800 Subject: [PATCH v3 2/6] drm/msm/dsi: set video mode widebus enable bit when widebus is enabled MIME-Version: 1.0 Message-Id: <20240403-msm-drm-dsc-dsi-video-upstream-v1-2-db5036443545@linaro.org> References: <20240403-msm-drm-dsc-dsi-video-upstream-v1-0-db5036443545@linaro.org> In-Reply-To: <20240403-msm-drm-dsc-dsi-video-upstream-v1-0-db5036443545@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 X-Mailer: b4 0.13.0 X-Developer-Signature: v=1; a=ed25519-sha256; t=1712135460; l=1740; i=jun.nie@linaro.org; s=20240403; h=from:subject:message-id; bh=OZSNyzuYoscDY4/FYsSXzvtJ+R2/AlPvVZDPzdhQNoA=; b=JV2mcwgTSj/9QP/9nbeMkSLbKZiuDUzrcHQTKV/HDaoeIOw35XNohHWH854JH04Qap8uPz1qe a1wuJWYSr8AD07LuWLw9ySSkW0JSmM3hPE4pifrLGC76X4rSGz0MANz 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 The value returned by msm_dsi_wide_bus_enabled() doesn't match what the driver is doing in video mode. Fix that by actually enabling widebus for video mode. Fixes: efcbd6f9cdeb ("drm/msm/dsi: Enable widebus for DSI") Signed-off-by: Jonathan Marek Signed-off-by: Jun Nie --- drivers/gpu/drm/msm/dsi/dsi.xml.h | 1 + drivers/gpu/drm/msm/dsi/dsi_host.c | 2 ++ 2 files changed, 3 insertions(+) diff --git a/drivers/gpu/drm/msm/dsi/dsi.xml.h b/drivers/gpu/drm/msm/dsi/dsi.xml.h index 2a7d980e12c3..f0b3cdc020a1 100644 --- a/drivers/gpu/drm/msm/dsi/dsi.xml.h +++ b/drivers/gpu/drm/msm/dsi/dsi.xml.h @@ -231,6 +231,7 @@ static inline uint32_t DSI_VID_CFG0_TRAFFIC_MODE(enum dsi_traffic_mode val) #define DSI_VID_CFG0_HSA_POWER_STOP 0x00010000 #define DSI_VID_CFG0_HBP_POWER_STOP 0x00100000 #define DSI_VID_CFG0_HFP_POWER_STOP 0x01000000 +#define DSI_VID_CFG0_DATABUS_WIDEN 0x02000000 #define DSI_VID_CFG0_PULSE_MODE_HSA_HE 0x10000000 #define REG_DSI_VID_CFG1 0x0000001c diff --git a/drivers/gpu/drm/msm/dsi/dsi_host.c b/drivers/gpu/drm/msm/dsi/dsi_host.c index 9d86a6aca6f2..2a0422cad6de 100644 --- a/drivers/gpu/drm/msm/dsi/dsi_host.c +++ b/drivers/gpu/drm/msm/dsi/dsi_host.c @@ -754,6 +754,8 @@ static void dsi_ctrl_enable(struct msm_dsi_host *msm_host, data |= DSI_VID_CFG0_TRAFFIC_MODE(dsi_get_traffic_mode(flags)); data |= DSI_VID_CFG0_DST_FORMAT(dsi_get_vid_fmt(mipi_fmt)); data |= DSI_VID_CFG0_VIRT_CHANNEL(msm_host->channel); + if (msm_dsi_host_is_wide_bus_enabled(&msm_host->base)) + data |= DSI_VID_CFG0_DATABUS_WIDEN; dsi_write(msm_host, REG_DSI_VID_CFG0, data); /* Do not swap RGB colors */ From patchwork Wed Apr 3 09:10:59 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jun Nie X-Patchwork-Id: 13615537 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 F0622CD1294 for ; Wed, 3 Apr 2024 09:11:32 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 019E911290D; Wed, 3 Apr 2024 09:11:32 +0000 (UTC) Authentication-Results: gabe.freedesktop.org; dkim=pass (2048-bit key; unprotected) header.d=linaro.org header.i=@linaro.org header.b="bCiuiwDR"; dkim-atps=neutral Received: from mail-pl1-f180.google.com (mail-pl1-f180.google.com [209.85.214.180]) by gabe.freedesktop.org (Postfix) with ESMTPS id 6B283112911 for ; Wed, 3 Apr 2024 09:11:30 +0000 (UTC) Received: by mail-pl1-f180.google.com with SMTP id d9443c01a7336-1e0f0398553so54669105ad.3 for ; Wed, 03 Apr 2024 02:11:30 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1712135490; x=1712740290; 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=DQqEHjYdisnUD2snQA56jk2b7liMK6zBTYwXTs6Sj2M=; b=bCiuiwDR3qWa02B/ctaM+jgvRfa5gmH86gMNQZn9Z9UUoLKvKHDeossbEx30mRxTmW MZl/lQMoTfierM7Oymn7EhYnrnk+gds2OZpNn+3lH7wcIfgJoJk2C/j+kbawOL4dmBqW KzWOxsHEOkWiTinm+8Ny9CYsDtDWKhGXr3zE0xr2rr+ZGTQ995mZ6HqAUVYlpD2JSgtp IEyuPjBTCWT50Ht0llz0iec+hSbRVXxuyf8neJMI4KP88CSqZngHU99A03zS+wDz/1kP p1NmqwGh6IZwtImDHhIO+Fv2oVUaWbbsY7Hjf5kT0v1gCW0aGx/6PXapm1prEMPm1+jb TjVg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1712135490; x=1712740290; 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=DQqEHjYdisnUD2snQA56jk2b7liMK6zBTYwXTs6Sj2M=; b=kectblh1hyGtTJMwzFXAXX5lnZGD0zE4WhCSG4OkUbk+feskeYGxocfRH6OxBKRpVa jVKXpxRJXhhGGCk+k+fjhKkp71L4jtv6a4LYw3wbPFnQ+HqT9jRNhts4yB1uD1xs6GgS 1xFIJ/hLbA+FyeIB9gyiAGhDbOrVrexxFOXNt2O1VJsdC82D4gbG/60fhJAcLVD6j680 DTdHHRwnoMpxf/We+bmyPeHWcot/NU9MugnitLZOi0WrMwu4ydy2KKB11KI4s5CyD3JS uCSgeOodWpx9hLxV0yd+0AD5GjZ+TiRkxMCa3ywy42EfUaUNli8epT3TYtARFm68RL+C /MRw== X-Forwarded-Encrypted: i=1; AJvYcCUf8CglPB8zYRd5p8S7WkZD+kneAP6cl0iTA1p0/D60MXbj9MMWVLKngGJi218VaPFGGMqc3pxKJvpeXAaWyo/yc5d+jjb4H5JtBT8WIBbZ X-Gm-Message-State: AOJu0YzMRGSRrx4LJ6fqpaGxmQ3bAl4bu8aopweeZuij8CAqSlHx4x3e rjRjIHzBlqojVY4Zof4IgCWFc7SVUth8v9mRCNt/24rvMqjo/Zulu6OfaJIAE+8= X-Google-Smtp-Source: AGHT+IGoKCZcGfq8O6r5TZMV+3488gW9BqB93GhZMP+8qde52gj2tgoCMbgU1QhQAK5AgXTygCwvkA== X-Received: by 2002:a17:902:ea0b:b0:1e0:b287:c1d8 with SMTP id s11-20020a170902ea0b00b001e0b287c1d8mr18367183plg.5.1712135489852; Wed, 03 Apr 2024 02:11:29 -0700 (PDT) Received: from [127.0.1.1] ([112.65.12.66]) by smtp.gmail.com with ESMTPSA id lo14-20020a170903434e00b001e0aded0ca7sm12688087plb.239.2024.04.03.02.11.23 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 03 Apr 2024 02:11:29 -0700 (PDT) From: Jun Nie Date: Wed, 03 Apr 2024 17:10:59 +0800 Subject: [PATCH v3 3/6] drm/msm/dsi: set VIDEO_COMPRESSION_MODE_CTRL_WC (fix video mode DSC) MIME-Version: 1.0 Message-Id: <20240403-msm-drm-dsc-dsi-video-upstream-v1-3-db5036443545@linaro.org> References: <20240403-msm-drm-dsc-dsi-video-upstream-v1-0-db5036443545@linaro.org> In-Reply-To: <20240403-msm-drm-dsc-dsi-video-upstream-v1-0-db5036443545@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 X-Mailer: b4 0.13.0 X-Developer-Signature: v=1; a=ed25519-sha256; t=1712135460; l=1680; i=jun.nie@linaro.org; s=20240403; h=from:subject:message-id; bh=3j8eHIegp4Va/VwA/6lBtYTg4B03+RKnNiDyMKiJ2vk=; b=KYx0Ix2CdVVcXMEVCmbw5LBcbUcSc2xtRS6uG1UPryAnL/gyF8kCDnP4OTQ0zJLN/6LZPkyCK qarGJC8xk8BDG+YYUxsw3+ChRenief6Vx+FotV/IsSCYwbmF6Znv3ai 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 Video mode DSC won't work if this field is not set correctly. Set it to fix video mode DSC (for slice_per_pkt==1 cases at least). Fixes: 08802f515c3c ("drm/msm/dsi: Add support for DSC configuration") Signed-off-by: Jonathan Marek Reviewed-by: Dmitry Baryshkov --- drivers/gpu/drm/msm/dsi/dsi_host.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/drivers/gpu/drm/msm/dsi/dsi_host.c b/drivers/gpu/drm/msm/dsi/dsi_host.c index 2a0422cad6de..80ea4f1d8274 100644 --- a/drivers/gpu/drm/msm/dsi/dsi_host.c +++ b/drivers/gpu/drm/msm/dsi/dsi_host.c @@ -858,6 +858,7 @@ static void dsi_update_dsc_timing(struct msm_dsi_host *msm_host, bool is_cmd_mod u32 slice_per_intf, total_bytes_per_intf; u32 pkt_per_line; u32 eol_byte_num; + u32 bytes_per_pkt; /* first calculate dsc parameters and then program * compress mode registers @@ -865,6 +866,7 @@ 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; */ eol_byte_num = total_bytes_per_intf % 3; @@ -902,6 +904,7 @@ static void dsi_update_dsc_timing(struct msm_dsi_host *msm_host, bool is_cmd_mod dsi_write(msm_host, REG_DSI_COMMAND_COMPRESSION_MODE_CTRL, reg_ctrl); dsi_write(msm_host, REG_DSI_COMMAND_COMPRESSION_MODE_CTRL2, reg_ctrl2); } else { + reg |= DSI_VIDEO_COMPRESSION_MODE_CTRL_WC(bytes_per_pkt); dsi_write(msm_host, REG_DSI_VIDEO_COMPRESSION_MODE_CTRL, reg); } } From patchwork Wed Apr 3 09:11:00 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jun Nie X-Patchwork-Id: 13615538 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 3948FCD1294 for ; Wed, 3 Apr 2024 09:11:39 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 2D5DF11290E; Wed, 3 Apr 2024 09:11:38 +0000 (UTC) Authentication-Results: gabe.freedesktop.org; dkim=pass (2048-bit key; unprotected) header.d=linaro.org header.i=@linaro.org header.b="lI49oz/2"; dkim-atps=neutral Received: from mail-pl1-f174.google.com (mail-pl1-f174.google.com [209.85.214.174]) by gabe.freedesktop.org (Postfix) with ESMTPS id DBB4211290C for ; Wed, 3 Apr 2024 09:11:36 +0000 (UTC) Received: by mail-pl1-f174.google.com with SMTP id d9443c01a7336-1e220e40998so35468765ad.1 for ; Wed, 03 Apr 2024 02:11:36 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1712135496; x=1712740296; 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=9hWxdEOmU4e6legIFUkyIF7zkRnOsSH8ACzlOjPdkh8=; b=lI49oz/2eK9oMYbQjhgyJ1bndEv/1kkRy9u8fs6a+ezK5GB0522faz9jkuXo3PNt03 SVlZZgUVsZalGEFE6C/va1MSTRU7T02W7cSucRYrdBmDgWJqb9//dBpNAjUI4+VABojO DIFTgUmkJ3lHbWXG7++Ux15x8hLzh5KQwoOzib2JRWZdN8Eu/TygzXaec0hHzGUpK1iE G8i9nrPk2UWn7WeLtlh/5NqJpSwFICkAcSyW9GUDtGHqR2Nxk/KTN2Fj7SNsvL8FkUE+ np/8wC+G1a1oWiSHubcsBO+AEF18BfUVMd+iRhqT+aQ98RueXH8OIiV4czUb0xMMdIGN /dcQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1712135496; x=1712740296; 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=9hWxdEOmU4e6legIFUkyIF7zkRnOsSH8ACzlOjPdkh8=; b=hL69ids2LdM7oMGdm0KxGcxVQcBV2sQy9FLhvrBvDJRB+2Lie5dGH+N6kETxAhIyr3 N8gpoJG6q+PQ+/UPxWZXwV5aharj6YFC4jmiv0n+LqvhFf7kBEm8jVm6SbEzMMUNvjN9 Z/BND21epTMA7qlBOOirnvs2VzDKpXznTy376uxmzFLKe+mP5ToDOS4ZLShWnSXNAgaZ 9+1um+L5k7L/EIafazDsleWiLSM7kni9qrjawue1TpjwAmnwbaJuxLg+kCUkIGeQFvyE Oi1oq7D2xfzTpTtH5sK2yjufCC0aFkg0kJMmBaO8lHHnP5aUv1ItmWRrQSoHfxy7nxgB iYHg== X-Forwarded-Encrypted: i=1; AJvYcCXfYJpU+ddHaouLIM/pc1IEQE+090VTioWbT7rb78sua50vP22eVNzfQR+iYk7xXQXYJctsd/PI/71rYtcw4D47yUMp/lqsWgcjN4Atpc9R X-Gm-Message-State: AOJu0YyKvdut5aPJQKwBoH0in67Eb1JqUlbIBAzVEmVdqLL0b2z4W61a d3Q5YBfFge03C7IiWKk3jIfmAJq9unxFZ/yQ0Ov98XEo04FS4SEM2C6yFxVM1Gk= X-Google-Smtp-Source: AGHT+IEyWqFwLOjN3DoRlpo+4Cc/2ygcGvENqA9aW1FSgOsYovoVqqyZlsMxzOzAo8DY7Gr1mb6hXA== X-Received: by 2002:a17:902:ba89:b0:1e0:1bb2:b38f with SMTP id k9-20020a170902ba8900b001e01bb2b38fmr1861834pls.59.1712135496335; Wed, 03 Apr 2024 02:11:36 -0700 (PDT) Received: from [127.0.1.1] ([112.65.12.66]) by smtp.gmail.com with ESMTPSA id lo14-20020a170903434e00b001e0aded0ca7sm12688087plb.239.2024.04.03.02.11.30 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 03 Apr 2024 02:11:35 -0700 (PDT) From: Jun Nie Date: Wed, 03 Apr 2024 17:11:00 +0800 Subject: [PATCH v3 4/6] drm/msm/dsi: add a comment to explain pkt_per_line encoding MIME-Version: 1.0 Message-Id: <20240403-msm-drm-dsc-dsi-video-upstream-v1-4-db5036443545@linaro.org> References: <20240403-msm-drm-dsc-dsi-video-upstream-v1-0-db5036443545@linaro.org> In-Reply-To: <20240403-msm-drm-dsc-dsi-video-upstream-v1-0-db5036443545@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 X-Mailer: b4 0.13.0 X-Developer-Signature: v=1; a=ed25519-sha256; t=1712135460; l=1185; i=jun.nie@linaro.org; s=20240403; h=from:subject:message-id; bh=Px8G3VT/pPMatEDJd8W5yLoDD+nxWLUBSZSRl+j+Bac=; b=GouXgYabwVWTVj3bHeksyAclYhr+CiBGfhejkhmQ72YqrJmdWZDRL9rczqXKkqVvK6U3n59oc Jop7S7F3ONhAPe9XAtU0TkJ5J1p3pJJ6BIpzfOAN3HGhKpSG0lzgNdq 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 Make it clear why the pkt_per_line value is being "divided by 2". Signed-off-by: Jonathan Marek Reviewed-by: Dmitry Baryshkov Signed-off-by: Jun Nie --- drivers/gpu/drm/msm/dsi/dsi_host.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/drivers/gpu/drm/msm/dsi/dsi_host.c b/drivers/gpu/drm/msm/dsi/dsi_host.c index 80ea4f1d8274..b0507a42ee6a 100644 --- a/drivers/gpu/drm/msm/dsi/dsi_host.c +++ b/drivers/gpu/drm/msm/dsi/dsi_host.c @@ -886,7 +886,11 @@ static void dsi_update_dsc_timing(struct msm_dsi_host *msm_host, bool is_cmd_mod /* DSI_VIDEO_COMPRESSION_MODE & DSI_COMMAND_COMPRESSION_MODE * registers have similar offsets, so for below common code use * DSI_VIDEO_COMPRESSION_MODE_XXXX for setting bits + * + * pkt_per_line is log2 encoded, >>1 works for supported values (1,2,4) */ + if (pkt_per_line > 4) + drm_warn(msm_host->dev, "pkt_per_line too big"); reg |= DSI_VIDEO_COMPRESSION_MODE_CTRL_PKT_PER_LINE(pkt_per_line >> 1); reg |= DSI_VIDEO_COMPRESSION_MODE_CTRL_EOL_BYTE_NUM(eol_byte_num); reg |= DSI_VIDEO_COMPRESSION_MODE_CTRL_EN; From patchwork Wed Apr 3 09:11:01 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jun Nie X-Patchwork-Id: 13615539 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 D5FC8CD1288 for ; Wed, 3 Apr 2024 09:11:45 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id D7F7E112911; Wed, 3 Apr 2024 09:11:44 +0000 (UTC) Authentication-Results: gabe.freedesktop.org; dkim=pass (2048-bit key; unprotected) header.d=linaro.org header.i=@linaro.org header.b="oHls4PxR"; dkim-atps=neutral Received: from mail-pl1-f182.google.com (mail-pl1-f182.google.com [209.85.214.182]) by gabe.freedesktop.org (Postfix) with ESMTPS id 9F955112915 for ; Wed, 3 Apr 2024 09:11:43 +0000 (UTC) Received: by mail-pl1-f182.google.com with SMTP id d9443c01a7336-1e2178b2cf2so47045615ad.0 for ; Wed, 03 Apr 2024 02:11:43 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1712135503; x=1712740303; 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=NOuu3sNA+84lczt5jxnbeGrnj9MwNeOoooH77NlU9Y0=; b=oHls4PxRIBNbiqLMVJmbZysN4OcXJRfXtw0KZJn5S0qfAmPtuebNLTd/Vd7HY7ULr+ 4D969SjRG+DlC78sgpahpxNa1/9krqjybVxcnqzeUhgV0UQj7Jfm/eRTkjj3A+gzrbH7 ojDbjUj2q+v0ASARsV3bD3FTaaJf39aLr70zo8fi9JIMSd50DGquW0+x5cNW7o5rYG8P mpFFWQ7xikevLzpGiUmVml7BECk+C+jMQVYLUvJJy7+IBAmR01qfczyJZSzHJoJGBFbl qtg//ktrPPLa+3QH8b3J9NOqMT6UkUA4U2eygufwvT7PpF7Qdf31gKj3yK7gOKBIUeTQ kq4Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1712135503; x=1712740303; 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=NOuu3sNA+84lczt5jxnbeGrnj9MwNeOoooH77NlU9Y0=; b=E9ISWN+1O6W439/BVagp1NTWupindt0VfxAuDTEwgMy2v4m6RSTSVACVPmQfTPjEFM D6n/D2vOKIlzFbjjKD+QmTxtoDfO6xvNjnM2nY0RQBFvbO9HlLMHIsZ6d6rLvC5Dwc6W ePs1NQMbHlHyxl1OwLAz0Q4FFvjWZz4v+vZqjmAO3GryThhHlUuXyfPSViLlc+uuI8gi NAkKYLDcoy5I51pSNnE7+IYeh9EXf3EMIe3EZ8YV+mwljT5oO+cE9NQ4qIdk7CpgL49m 8J+c14cWNNQVHVodeLgrHV8MKHCIc38ZlC48UI3BDPl2kRmrZxYvpyRDCam0GLJnsd1j 22Fg== X-Forwarded-Encrypted: i=1; AJvYcCXioEeTVQyR9yiPSF8F84Qi9C5SC46WbScV2jyDm9cIBJOGWtItOLm7W0N6u8TPi+JxxxrVyzaEmInM+J2oAqNXFZP0TmrpK+BKh3sMl8mL X-Gm-Message-State: AOJu0Yw0NGGfQUvSQVg9340UabGCe+4hbbw36bf2MAcggDag5B9iuYec SaH+RAocqAWqxoysdapsdsdObT/eORssQHanVJpkNwD7c3y9heU+VEocSLELEKM= X-Google-Smtp-Source: AGHT+IGE6QcA79jB0k2Li5lWPr2yvCO9+FLkeHddHmJdCmFiKZKqU+kbSjtNfgztpVuY/0gLGWy1dw== X-Received: by 2002:a17:902:c94f:b0:1e0:a784:f965 with SMTP id i15-20020a170902c94f00b001e0a784f965mr18198301pla.65.1712135502878; Wed, 03 Apr 2024 02:11:42 -0700 (PDT) Received: from [127.0.1.1] ([112.65.12.66]) by smtp.gmail.com with ESMTPSA id lo14-20020a170903434e00b001e0aded0ca7sm12688087plb.239.2024.04.03.02.11.36 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 03 Apr 2024 02:11:42 -0700 (PDT) From: Jun Nie Date: Wed, 03 Apr 2024 17:11:01 +0800 Subject: [PATCH v3 5/6] drm/display: Add slice_per_pkt for dsc MIME-Version: 1.0 Message-Id: <20240403-msm-drm-dsc-dsi-video-upstream-v1-5-db5036443545@linaro.org> References: <20240403-msm-drm-dsc-dsi-video-upstream-v1-0-db5036443545@linaro.org> In-Reply-To: <20240403-msm-drm-dsc-dsi-video-upstream-v1-0-db5036443545@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 X-Mailer: b4 0.13.0 X-Developer-Signature: v=1; a=ed25519-sha256; t=1712135460; l=867; i=jun.nie@linaro.org; s=20240403; h=from:subject:message-id; bh=MU4Swq5XDKyEWa3JYSzWqbeemF0ZbJTcthPE2KJsZos=; b=hpx8rqn0NW6jrZNlHbx/VHfFHcMfnFnfZNwaA4Q9oljlHNkFfqChP0YhKK5MS9joROjHj9ZCY Ys/IqPqN+8uDp67ZK5JQqci2IhuEveJuFZTRbjjhY/AmRAejQSlMBMT 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 variable for slice number of a DSC compression bit stream packet. Its value shall be specified in panel driver, or default value can be set in display controller driver if panel driver does not set it. Signed-off-by: Jun Nie --- include/drm/display/drm_dsc.h | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/include/drm/display/drm_dsc.h b/include/drm/display/drm_dsc.h index bc90273d06a6..4fac0a2746ae 100644 --- a/include/drm/display/drm_dsc.h +++ b/include/drm/display/drm_dsc.h @@ -82,6 +82,10 @@ struct drm_dsc_config { * @bits_per_component: Bits per component to code (8/10/12) */ u8 bits_per_component; + /** + * @slice_per_pkt: slice number per DSC bit stream packet + */ + u8 slice_per_pkt; /** * @convert_rgb: * Flag to indicate if RGB - YCoCg conversion is needed From patchwork Wed Apr 3 09:11:02 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jun Nie X-Patchwork-Id: 13615540 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 472A6CD1294 for ; Wed, 3 Apr 2024 09:11:54 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 43310112910; Wed, 3 Apr 2024 09:11:53 +0000 (UTC) Authentication-Results: gabe.freedesktop.org; dkim=pass (2048-bit key; unprotected) header.d=linaro.org header.i=@linaro.org header.b="b2WwNkal"; dkim-atps=neutral Received: from mail-pl1-f176.google.com (mail-pl1-f176.google.com [209.85.214.176]) by gabe.freedesktop.org (Postfix) with ESMTPS id DCF7E11290F for ; Wed, 3 Apr 2024 09:11:51 +0000 (UTC) Received: by mail-pl1-f176.google.com with SMTP id d9443c01a7336-1e0f3052145so57682595ad.2 for ; Wed, 03 Apr 2024 02:11:51 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1712135511; x=1712740311; 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=+nFa+DoX75Gh3LGa/SLXrbw1YnZbOgzc+2X5SVpsYKU=; b=b2WwNkals+qAVnRK5LC/SxLJufTkaAZHfz6cOP/fTQhbBdKjwz2WekwooMs5IGhiA4 YZ//Jc5jKwiz+OEZPuhHDu+xj3dn0fS7+W03QTerDu/KWM7QAqfyhrjhdG3V999tkMZH sgvd5DepmDmNoxIsBRVI0/5sV8T5dVxfm31V+2IHrQJc7CiEBbxW0i78oe8e21kvhrHC KHw04F5RoHsu7lFb9/BHUuzCD+/tLUXYmch/tpV0ENW/4cUa6xeOC/hhMsB4QFPQ7+ae /rq7Bvc/diZLbdBR+veI/fU5XQxQBjQs7zgL13kBvA4b6S595vVLA1QuJTL6Sy9l8wN3 YcAA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1712135511; x=1712740311; 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=+nFa+DoX75Gh3LGa/SLXrbw1YnZbOgzc+2X5SVpsYKU=; b=tvjK21roh2ERHYg1j5jA5luIddrw6I1pg2MbnUpP/b3C8aupp/v9TUgOueaFTZbUB0 RSayjc9M46HK49W1ytU6iiovd5lM49dsT7n1nmXmFOZs9jeOU+K4ZWVlXevfv8qRkUgb F6P2/Ws4r+/+LNIhH6WM+mo0LPt8Xrdnyh4p4XlGJQLY5eZfZl3aHx0Tf9eAd5YVlxJy DxojoUE/cBPyvbjQG1dBmVWmFmaQm7SoMlw106wt/i/1/71LmYfr476z1x9+pg4M3Sbp dN3IjCxdcCDBvB8pSOflygaZDzsei5WyR+4snfLvjq/Lld64e61PiBvNbYMrIg62MWen LD0w== X-Forwarded-Encrypted: i=1; AJvYcCXQrgfD95zMlFsBpFLAed8nsiMjVZ9vLHpR4Jn4XRImDvWhcUzLvlD50vKz4NZIOV2YsNGUH+wLbRKmljBo2gFX/292uRmY3pLwNL31O3Uf X-Gm-Message-State: AOJu0Yzltt/q2QmokKcRFuh9PKPWAFIaxUKQbN0GTzmYMzTaKIbBwP2B sU04BWh70lbGIM4JIPTAoFvch6VjSp9gdyaLGNcf6yUP7+yc7Lvp2ihU7REXJ1A= X-Google-Smtp-Source: AGHT+IGDKZpi6IzWPwxcA3gkwURqgiirh03g+6YOT47tXCPNep36CItbq3BtloN4WYOSIhk1Xi88sQ== X-Received: by 2002:a17:903:18f:b0:1e2:920a:4add with SMTP id z15-20020a170903018f00b001e2920a4addmr1179553plg.16.1712135511328; Wed, 03 Apr 2024 02:11:51 -0700 (PDT) Received: from [127.0.1.1] ([112.65.12.66]) by smtp.gmail.com with ESMTPSA id lo14-20020a170903434e00b001e0aded0ca7sm12688087plb.239.2024.04.03.02.11.43 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 03 Apr 2024 02:11:50 -0700 (PDT) From: Jun Nie Date: Wed, 03 Apr 2024 17:11:02 +0800 Subject: [PATCH v3 6/6] drm/msm/dsi: support DSC configurations with slice_per_pkt > 1 MIME-Version: 1.0 Message-Id: <20240403-msm-drm-dsc-dsi-video-upstream-v1-6-db5036443545@linaro.org> References: <20240403-msm-drm-dsc-dsi-video-upstream-v1-0-db5036443545@linaro.org> In-Reply-To: <20240403-msm-drm-dsc-dsi-video-upstream-v1-0-db5036443545@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 X-Mailer: b4 0.13.0 X-Developer-Signature: v=1; a=ed25519-sha256; t=1712135460; l=4300; i=jun.nie@linaro.org; s=20240403; h=from:subject:message-id; bh=KdBFnUu2Qm6ZZ65hBcXTk+Bm1tsC1DSuVU4sJTWGxzk=; b=0c+GOay4d8sYuEfmKXCY3qnC69M5LNKT/bdL1VuwVHTTHSJMUP6DvEIlrEPtXbRf7brwZBC9G THfCXQuOr93AkNUmqicPhAO7A7LuE1Xr9W6EM3TZrI+KgKHpwS6Ti1a 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 Support slice_per_pkt in msm driver. Note that the removed "pkt_per_line = slice_per_intf * slice_per_pkt" comment is incorrect. Also trim the code to simplify the dsc reference. Signed-off-by: Jonathan Marek Signed-off-by: Jun Nie --- drivers/gpu/drm/msm/dsi/dsi_host.c | 35 ++++++++++++++--------------------- 1 file changed, 14 insertions(+), 21 deletions(-) diff --git a/drivers/gpu/drm/msm/dsi/dsi_host.c b/drivers/gpu/drm/msm/dsi/dsi_host.c index b0507a42ee6a..0c6f40dbd25c 100644 --- a/drivers/gpu/drm/msm/dsi/dsi_host.c +++ b/drivers/gpu/drm/msm/dsi/dsi_host.c @@ -866,17 +866,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 * 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 / dsc->slice_per_pkt; if (is_cmd_mode) /* packet data type */ reg = DSI_COMMAND_COMPRESSION_MODE_CTRL_STREAM0_DATATYPE(MIPI_DSI_DCS_LONG_WRITE); @@ -916,6 +909,7 @@ static void dsi_update_dsc_timing(struct msm_dsi_host *msm_host, bool is_cmd_mod static void dsi_timing_setup(struct msm_dsi_host *msm_host, bool is_bonded_dsi) { struct drm_display_mode *mode = msm_host->mode; + struct drm_dsc_config *dsc = msm_host->dsc; u32 hs_start = 0, vs_start = 0; /* take sync start as 0 */ u32 h_total = mode->htotal; u32 v_total = mode->vtotal; @@ -947,8 +941,7 @@ static void dsi_timing_setup(struct msm_dsi_host *msm_host, bool is_bonded_dsi) hdisplay /= 2; } - if (msm_host->dsc) { - struct drm_dsc_config *dsc = msm_host->dsc; + if (dsc) { u32 bytes_per_pclk; /* update dsc params with timing params */ @@ -988,14 +981,14 @@ static void dsi_timing_setup(struct msm_dsi_host *msm_host, bool is_bonded_dsi) else bytes_per_pclk = 3; - hdisplay = DIV_ROUND_UP(msm_dsc_get_bytes_per_line(msm_host->dsc), bytes_per_pclk); + hdisplay = DIV_ROUND_UP(msm_dsc_get_bytes_per_line(dsc), bytes_per_pclk); h_total += hdisplay; ha_end = ha_start + hdisplay; } if (msm_host->mode_flags & MIPI_DSI_MODE_VIDEO) { - if (msm_host->dsc) + if (dsc) dsi_update_dsc_timing(msm_host, false, mode->hdisplay); dsi_write(msm_host, REG_DSI_ACTIVE_H, @@ -1016,21 +1009,17 @@ 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) + if (dsc) dsi_update_dsc_timing(msm_host, true, mode->hdisplay); /* image data and 1 byte write_memory_start cmd */ - if (!msm_host->dsc) + if (!dsc) wc = hdisplay * mipi_dsi_pixel_format_to_bpp(msm_host->format) / 8 + 1; 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 = dsc->slice_chunk_size * dsc->slice_per_pkt + 1; dsi_write(msm_host, REG_DSI_CMD_MDP_STREAM0_CTRL, DSI_CMD_MDP_STREAM0_CTRL_WORD_COUNT(wc) | @@ -1657,8 +1646,12 @@ 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; + /* for backwards compatibility, assume 1 if not set */ + if (!dsi->dsc->slice_per_pkt) + dsi->dsc->slice_per_pkt = 1; + } /* Some gpios defined in panel DT need to be controlled by host */ ret = dsi_host_init_panel_gpios(msm_host, &dsi->dev);