From: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
To: Paloma Arellano <quic_parellan@quicinc.com>,
freedreno@lists.freedesktop.org
Cc: linux-arm-msm@vger.kernel.org, dri-devel@lists.freedesktop.org,
robdclark@gmail.com, seanpaul@chromium.org, swboyd@chromium.org,
quic_abhinavk@quicinc.com, quic_jesszhan@quicinc.com,
quic_khsieh@quicinc.com, marijn.suijten@somainline.org,
neil.armstrong@linaro.org
Subject: Re: [PATCH 08/17] drm/msm/dp: change YUV420 related programming for DP
Date: Thu, 25 Jan 2024 23:29:49 +0200 [thread overview]
Message-ID: <c666a271-e12c-41ad-af38-42d0c5b513b1@linaro.org> (raw)
In-Reply-To: <20240125193834.7065-9-quic_parellan@quicinc.com>
On 25/01/2024 21:38, Paloma Arellano wrote:
> Change all relevant DP controller related programming for YUV420 cases.
> Namely, change the pixel clock math to consider YUV420, program the
> configuration control to indicate YUV420, as well as modify the MVID
> programming to consider YUV420.
Too many items for a single commit.
>
> Signed-off-by: Paloma Arellano <quic_parellan@quicinc.com>
> ---
> drivers/gpu/drm/msm/dp/dp_catalog.c | 5 ++++-
> drivers/gpu/drm/msm/dp/dp_catalog.h | 2 +-
> drivers/gpu/drm/msm/dp/dp_ctrl.c | 12 +++++++++---
> drivers/gpu/drm/msm/dp/dp_display.c | 8 +++++++-
> drivers/gpu/drm/msm/msm_kms.h | 3 +++
> 5 files changed, 24 insertions(+), 6 deletions(-)
>
> diff --git a/drivers/gpu/drm/msm/dp/dp_catalog.c b/drivers/gpu/drm/msm/dp/dp_catalog.c
> index 5142aeb705a44..5d84c089e520a 100644
> --- a/drivers/gpu/drm/msm/dp/dp_catalog.c
> +++ b/drivers/gpu/drm/msm/dp/dp_catalog.c
> @@ -442,7 +442,7 @@ void dp_catalog_ctrl_config_misc(struct dp_catalog *dp_catalog,
>
> void dp_catalog_ctrl_config_msa(struct dp_catalog *dp_catalog,
> u32 rate, u32 stream_rate_khz,
> - bool fixed_nvid)
> + bool fixed_nvid, bool is_ycbcr_420)
> {
> u32 pixel_m, pixel_n;
> u32 mvid, nvid, pixel_div = 0, dispcc_input_rate;
> @@ -485,6 +485,9 @@ void dp_catalog_ctrl_config_msa(struct dp_catalog *dp_catalog,
> nvid = temp;
> }
>
> + if (is_ycbcr_420)
> + mvid /= 2;
> +
> if (link_rate_hbr2 == rate)
> nvid *= 2;
>
> diff --git a/drivers/gpu/drm/msm/dp/dp_catalog.h b/drivers/gpu/drm/msm/dp/dp_catalog.h
> index 38786e855b51a..6cb5e2a243de2 100644
> --- a/drivers/gpu/drm/msm/dp/dp_catalog.h
> +++ b/drivers/gpu/drm/msm/dp/dp_catalog.h
> @@ -96,7 +96,7 @@ void dp_catalog_ctrl_mainlink_ctrl(struct dp_catalog *dp_catalog, bool enable);
> void dp_catalog_ctrl_psr_mainlink_enable(struct dp_catalog *dp_catalog, bool enable);
> void dp_catalog_ctrl_config_misc(struct dp_catalog *dp_catalog, u32 cc, u32 tb);
> void dp_catalog_ctrl_config_msa(struct dp_catalog *dp_catalog, u32 rate,
> - u32 stream_rate_khz, bool fixed_nvid);
> + u32 stream_rate_khz, bool fixed_nvid, bool is_ycbcr_420);
> int dp_catalog_ctrl_set_pattern_state_bit(struct dp_catalog *dp_catalog, u32 pattern);
> u32 dp_catalog_hw_revision(const struct dp_catalog *dp_catalog);
> void dp_catalog_ctrl_reset(struct dp_catalog *dp_catalog);
> diff --git a/drivers/gpu/drm/msm/dp/dp_ctrl.c b/drivers/gpu/drm/msm/dp/dp_ctrl.c
> index 77a8d9366ed7b..209cf2a35642f 100644
> --- a/drivers/gpu/drm/msm/dp/dp_ctrl.c
> +++ b/drivers/gpu/drm/msm/dp/dp_ctrl.c
> @@ -128,6 +128,9 @@ static void dp_ctrl_config_ctrl(struct dp_ctrl_private *ctrl)
> /* Default-> LSCLK DIV: 1/4 LCLK */
> config |= (2 << DP_CONFIGURATION_CTRL_LSCLK_DIV_SHIFT);
>
> + if (ctrl->panel->dp_mode.out_fmt_is_yuv_420)
> + config |= DP_CONFIGURATION_CTRL_RGB_YUV; /* YUV420 */
> +
This definitely is not related to clock rate calculations.
> /* Scrambler reset enable */
> if (drm_dp_alternate_scrambler_reset_cap(dpcd))
> config |= DP_CONFIGURATION_CTRL_ASSR;
> @@ -957,7 +960,7 @@ static void dp_ctrl_calc_tu_parameters(struct dp_ctrl_private *ctrl,
> in.hporch = drm_mode->htotal - drm_mode->hdisplay;
> in.nlanes = ctrl->link->link_params.num_lanes;
> in.bpp = ctrl->panel->dp_mode.bpp;
> - in.pixel_enc = 444;
> + in.pixel_enc = ctrl->panel->dp_mode.out_fmt_is_yuv_420 ? 420 : 444;
> in.dsc_en = 0;
> in.async_en = 0;
> in.fec_en = 0;
> @@ -1763,6 +1766,8 @@ int dp_ctrl_on_link(struct dp_ctrl *dp_ctrl)
> ctrl->link->link_params.rate = rate;
> ctrl->link->link_params.num_lanes =
> ctrl->panel->link_info.num_lanes;
> + if (ctrl->panel->dp_mode.out_fmt_is_yuv_420)
> + pixel_rate >>= 1;
> }
>
> drm_dbg_dp(ctrl->drm_dev, "rate=%d, num_lanes=%d, pixel_rate=%lu\n",
> @@ -1878,7 +1883,7 @@ int dp_ctrl_on_stream(struct dp_ctrl *dp_ctrl, bool force_link_train)
>
> pixel_rate = pixel_rate_orig = ctrl->panel->dp_mode.drm_mode.clock;
>
> - if (dp_ctrl->wide_bus_en)
> + if (dp_ctrl->wide_bus_en || ctrl->panel->dp_mode.out_fmt_is_yuv_420)
> pixel_rate >>= 1;
>
> drm_dbg_dp(ctrl->drm_dev, "rate=%d, num_lanes=%d, pixel_rate=%lu\n",
> @@ -1917,7 +1922,8 @@ int dp_ctrl_on_stream(struct dp_ctrl *dp_ctrl, bool force_link_train)
>
> dp_catalog_ctrl_config_msa(ctrl->catalog,
> ctrl->link->link_params.rate,
> - pixel_rate_orig, dp_ctrl_use_fixed_nvid(ctrl));
> + pixel_rate_orig, dp_ctrl_use_fixed_nvid(ctrl),
> + ctrl->panel->dp_mode.out_fmt_is_yuv_420);
>
> dp_ctrl_setup_tr_unit(ctrl);
>
> diff --git a/drivers/gpu/drm/msm/dp/dp_display.c b/drivers/gpu/drm/msm/dp/dp_display.c
> index f6b3b6ca242f8..6d764f5b08727 100644
> --- a/drivers/gpu/drm/msm/dp/dp_display.c
> +++ b/drivers/gpu/drm/msm/dp/dp_display.c
> @@ -916,9 +916,10 @@ enum drm_mode_status dp_bridge_mode_valid(struct drm_bridge *bridge,
> const u32 num_components = 3, default_bpp = 24;
> struct dp_display_private *dp_display;
> struct dp_link_info *link_info;
> - u32 mode_rate_khz = 0, supported_rate_khz = 0, mode_bpp = 0;
> struct msm_dp *dp;
> int mode_pclk_khz = mode->clock;
> + int rate_ratio = RGB_24BPP_TMDS_CHAR_RATE_RATIO;
> + u32 mode_rate_khz = 0, supported_rate_khz = 0, mode_bpp = 0;
>
> dp = to_dp_bridge(bridge)->dp_display;
>
> @@ -933,6 +934,11 @@ enum drm_mode_status dp_bridge_mode_valid(struct drm_bridge *bridge,
> dp_display = container_of(dp, struct dp_display_private, dp_display);
> link_info = &dp_display->panel->link_info;
>
> + if (drm_mode_is_420_only(&dp->connector->display_info, mode))
> + rate_ratio = YUV420_24BPP_TMDS_CHAR_RATE_RATIO;
> +
> + mode_pclk_khz /= rate_ratio;
I think it will be more obvious and simple to write:
if (drm_mode_is_420...)
mode_pclk_khz /= 2;
> +
> mode_bpp = dp->connector->display_info.bpc * num_components;
> if (!mode_bpp)
> mode_bpp = default_bpp;
> diff --git a/drivers/gpu/drm/msm/msm_kms.h b/drivers/gpu/drm/msm/msm_kms.h
> index 44aa435d68ce2..66e8151951807 100644
> --- a/drivers/gpu/drm/msm/msm_kms.h
> +++ b/drivers/gpu/drm/msm/msm_kms.h
> @@ -15,6 +15,9 @@
>
> #define MAX_PLANE 4
>
> +#define RGB_24BPP_TMDS_CHAR_RATE_RATIO 1
> +#define YUV420_24BPP_TMDS_CHAR_RATE_RATIO 2
> +
> /* As there are different display controller blocks depending on the
> * snapdragon version, the kms support is split out and the appropriate
> * implementation is loaded at runtime. The kms module is responsible
--
With best wishes
Dmitry
next prev parent reply other threads:[~2024-01-25 21:29 UTC|newest]
Thread overview: 95+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-01-25 19:38 [PATCH 00/17] Add support for CDM over DP Paloma Arellano
2024-01-25 19:38 ` [PATCH 01/17] drm/msm/dpu: allow dpu_encoder_helper_phys_setup_cdm to work for DP Paloma Arellano
2024-01-25 21:14 ` Dmitry Baryshkov
2024-01-27 0:39 ` Paloma Arellano
2024-01-29 3:06 ` Abhinav Kumar
2024-01-29 3:23 ` Dmitry Baryshkov
2024-01-29 4:00 ` Abhinav Kumar
2024-01-29 4:12 ` Dmitry Baryshkov
2024-01-29 4:33 ` Abhinav Kumar
2024-01-29 5:12 ` Dmitry Baryshkov
2024-01-29 23:06 ` Paloma Arellano
2024-01-25 19:38 ` [PATCH 02/17] drm/msm/dpu: move dpu_encoder_helper_phys_setup_cdm to dpu_encoder Paloma Arellano
2024-01-25 21:16 ` Dmitry Baryshkov
2024-01-27 0:43 ` Paloma Arellano
2024-01-27 2:26 ` Dmitry Baryshkov
2024-01-25 19:38 ` [PATCH 03/17] drm/msm/dp: rename wide_bus_en to wide_bus_supported Paloma Arellano
2024-01-25 21:17 ` Dmitry Baryshkov
2024-01-25 19:38 ` [PATCH 04/17] drm/msm/dp: store mode YUV420 information to be used by rest of DP Paloma Arellano
2024-01-25 21:20 ` Dmitry Baryshkov
2024-01-27 0:48 ` Paloma Arellano
2024-01-27 2:29 ` Dmitry Baryshkov
2024-01-25 19:38 ` [PATCH 05/17] drm/msm/dp: add an API to indicate if sink supports VSC SDP Paloma Arellano
2024-01-25 21:23 ` Dmitry Baryshkov
2024-01-27 0:58 ` Paloma Arellano
2024-01-27 2:40 ` Dmitry Baryshkov
2024-01-27 3:57 ` Abhinav Kumar
2024-01-27 5:31 ` Dmitry Baryshkov
2024-01-29 23:20 ` Paloma Arellano
2024-01-25 19:38 ` [PATCH 06/17] drm/msm/dpu: move widebus logic to its own API Paloma Arellano
2024-01-25 21:25 ` Dmitry Baryshkov
2024-01-25 19:38 ` [PATCH 07/17] drm/msm/dpu: disallow widebus en in INTF_CONFIG2 when DP is YUV420 Paloma Arellano
2024-01-25 21:26 ` Dmitry Baryshkov
2024-01-27 5:42 ` Dmitry Baryshkov
2024-01-28 5:16 ` Paloma Arellano
2024-01-28 5:33 ` Dmitry Baryshkov
2024-01-29 23:51 ` Abhinav Kumar
2024-01-30 0:03 ` Dmitry Baryshkov
2024-01-30 1:07 ` Abhinav Kumar
2024-01-30 1:43 ` Dmitry Baryshkov
2024-01-30 4:10 ` Abhinav Kumar
2024-01-30 5:28 ` Dmitry Baryshkov
2024-01-30 6:03 ` Abhinav Kumar
2024-01-25 19:38 ` [PATCH 08/17] drm/msm/dp: change YUV420 related programming for DP Paloma Arellano
2024-01-25 21:29 ` Dmitry Baryshkov [this message]
2024-01-28 5:18 ` Paloma Arellano
2024-01-25 19:38 ` [PATCH 09/17] drm/msm/dp: move parity calculation to dp_catalog Paloma Arellano
2024-01-25 21:32 ` Dmitry Baryshkov
2024-01-28 5:18 ` Paloma Arellano
2024-01-25 19:38 ` [PATCH 10/17] drm/msm/dp: modify dp_catalog_hw_revision to show major and minor val Paloma Arellano
2024-01-25 22:07 ` Dmitry Baryshkov
2024-01-28 5:30 ` Paloma Arellano
2024-01-28 5:35 ` Dmitry Baryshkov
2024-01-27 23:43 ` kernel test robot
2024-01-28 14:02 ` kernel test robot
2024-01-25 19:38 ` [PATCH 11/17] drm/msm/dp: add VSC SDP support for YUV420 over DP Paloma Arellano
2024-01-25 21:48 ` Dmitry Baryshkov
2024-01-28 5:34 ` Paloma Arellano
2024-01-28 5:39 ` Dmitry Baryshkov
2024-02-01 1:56 ` Abhinav Kumar
2024-02-01 4:36 ` Dmitry Baryshkov
2024-02-02 6:25 ` Abhinav Kumar
2024-01-25 19:38 ` [PATCH 12/17] drm/msm/dpu: add support of new peripheral flush mechanism Paloma Arellano
2024-01-25 21:49 ` Dmitry Baryshkov
2024-01-28 5:40 ` Paloma Arellano
2024-01-28 5:42 ` Dmitry Baryshkov
2024-02-08 23:09 ` Paloma Arellano
2024-01-25 19:38 ` [PATCH 13/17] drm/msm/dp: enable SDP and SDE periph flush update Paloma Arellano
2024-01-25 21:50 ` Dmitry Baryshkov
2024-01-28 5:42 ` Paloma Arellano
2024-01-25 19:38 ` [PATCH 14/17] drm/msm/dpu: modify encoder programming for CDM over DP Paloma Arellano
2024-01-25 21:57 ` Dmitry Baryshkov
2024-01-28 5:48 ` Paloma Arellano
2024-01-28 5:55 ` Dmitry Baryshkov
2024-01-29 2:58 ` Abhinav Kumar
2024-01-29 3:42 ` Dmitry Baryshkov
2024-01-29 5:03 ` Abhinav Kumar
2024-01-29 6:12 ` Dmitry Baryshkov
2024-01-29 7:08 ` Abhinav Kumar
2024-01-29 23:44 ` Dmitry Baryshkov
2024-02-01 1:30 ` Abhinav Kumar
2024-02-01 3:17 ` Dmitry Baryshkov
2024-02-01 19:01 ` Abhinav Kumar
2024-01-25 19:38 ` [PATCH 15/17] drm/msm/dpu: allow certain formats for CDM for DP Paloma Arellano
2024-01-25 21:58 ` Dmitry Baryshkov
2024-02-08 23:19 ` Paloma Arellano
2024-01-25 19:38 ` [PATCH 16/17] drm/msm/dpu: reserve CDM blocks for DP if mode is YUV420 Paloma Arellano
2024-01-25 22:01 ` Dmitry Baryshkov
2024-01-28 5:48 ` Paloma Arellano
2024-01-25 19:38 ` [PATCH 17/17] drm/msm/dp: allow YUV420 mode for DP connector when VSC SDP supported Paloma Arellano
2024-01-25 22:05 ` Dmitry Baryshkov
2024-01-29 3:17 ` Abhinav Kumar
2024-01-29 3:52 ` Dmitry Baryshkov
2024-01-29 4:30 ` Abhinav Kumar
2024-01-29 5:05 ` Dmitry Baryshkov
2024-01-29 5:36 ` Abhinav Kumar
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=c666a271-e12c-41ad-af38-42d0c5b513b1@linaro.org \
--to=dmitry.baryshkov@linaro.org \
--cc=dri-devel@lists.freedesktop.org \
--cc=freedreno@lists.freedesktop.org \
--cc=linux-arm-msm@vger.kernel.org \
--cc=marijn.suijten@somainline.org \
--cc=neil.armstrong@linaro.org \
--cc=quic_abhinavk@quicinc.com \
--cc=quic_jesszhan@quicinc.com \
--cc=quic_khsieh@quicinc.com \
--cc=quic_parellan@quicinc.com \
--cc=robdclark@gmail.com \
--cc=seanpaul@chromium.org \
--cc=swboyd@chromium.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).