mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
To: Kuogee Hsieh <quic_khsieh@quicinc.com>,
	dri-devel@lists.freedesktop.org, robdclark@gmail.com,
	sean@poorly.run, swboyd@chromium.org, dianders@chromium.org,
	vkoul@kernel.org, daniel@ffwll.ch, airlied@gmail.com,
	agross@kernel.org, andersson@kernel.org
Cc: quic_abhinavk@quicinc.com, quic_sbillaka@quicinc.com,
	marijn.suijten@somainline.org, freedreno@lists.freedesktop.org,
	linux-arm-msm@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [RFC PATCH 2/2] drm/msm/dsi: use new dpu_dsc_populate_dsc_config()
Date: Fri, 24 Feb 2023 23:04:35 +0200	[thread overview]
Message-ID: <525078f5-44be-9a75-a737-ddcc6e097700@linaro.org> (raw)
In-Reply-To: <1677267647-28672-3-git-send-email-quic_khsieh@quicinc.com>

On 24/02/2023 21:40, Kuogee Hsieh wrote:
> use new introduced dpu_dsc_populate_dsc_config() to calculate
> and populate drm_dsc_info instead of hard code value.

DPU is an optional component, so DSI driver should not depend on the DPU 
driver.

> 
> Signed-off-by: Kuogee Hsieh <quic_khsieh@quicinc.com>
> ---
>   drivers/gpu/drm/msm/dsi/dsi_host.c | 78 ++++++--------------------------------
>   1 file changed, 12 insertions(+), 66 deletions(-)
> 
> diff --git a/drivers/gpu/drm/msm/dsi/dsi_host.c b/drivers/gpu/drm/msm/dsi/dsi_host.c
> index 31ad193..5f3f84f 100644
> --- a/drivers/gpu/drm/msm/dsi/dsi_host.c
> +++ b/drivers/gpu/drm/msm/dsi/dsi_host.c
> @@ -1,6 +1,7 @@
>   // SPDX-License-Identifier: GPL-2.0-only
>   /*
>    * Copyright (c) 2015, The Linux Foundation. All rights reserved.
> + * Copyright (c) 2023. Qualcomm Innovation Center, Inc. All rights reserved
>    */
>   
>   #include <linux/clk.h>
> @@ -21,7 +22,6 @@
>   
>   #include <video/mipi_display.h>
>   
> -#include <drm/display/drm_dsc_helper.h>
>   #include <drm/drm_of.h>
>   
>   #include "dsi.h"
> @@ -31,6 +31,7 @@
>   #include "msm_kms.h"
>   #include "msm_gem.h"
>   #include "phy/dsi_phy.h"
> +#include "dpu_dsc_helper.h"
>   
>   #define DSI_RESET_TOGGLE_DELAY_MS 20
>   
> @@ -1819,29 +1820,8 @@ static int dsi_host_parse_lane_data(struct msm_dsi_host *msm_host,
>   	return -EINVAL;
>   }
>   
> -static u32 dsi_dsc_rc_buf_thresh[DSC_NUM_BUF_RANGES - 1] = {
> -	0x0e, 0x1c, 0x2a, 0x38, 0x46, 0x54, 0x62,
> -	0x69, 0x70, 0x77, 0x79, 0x7b, 0x7d, 0x7e
> -};
> -
> -/* only 8bpc, 8bpp added */
> -static char min_qp[DSC_NUM_BUF_RANGES] = {
> -	0, 0, 1, 1, 3, 3, 3, 3, 3, 3, 5, 5, 5, 7, 13
> -};
> -
> -static char max_qp[DSC_NUM_BUF_RANGES] = {
> -	4, 4, 5, 6, 7, 7, 7, 8, 9, 10, 11, 12, 13, 13, 15
> -};
> -
> -static char bpg_offset[DSC_NUM_BUF_RANGES] = {
> -	2, 0, 0, -2, -4, -6, -8, -8, -8, -10, -10, -12, -12, -12, -12
> -};
> -
>   static int dsi_populate_dsc_params(struct msm_dsi_host *msm_host, struct drm_dsc_config *dsc)
>   {
> -	int i;
> -	u16 bpp = dsc->bits_per_pixel >> 4;
> -
>   	if (dsc->bits_per_pixel & 0xf) {
>   		DRM_DEV_ERROR(&msm_host->pdev->dev, "DSI does not support fractional bits_per_pixel\n");
>   		return -EINVAL;
> @@ -1852,50 +1832,16 @@ static int dsi_populate_dsc_params(struct msm_dsi_host *msm_host, struct drm_dsc
>   		return -EOPNOTSUPP;
>   	}
>   
> -	dsc->rc_model_size = 8192;
> -	dsc->first_line_bpg_offset = 12;
> -	dsc->rc_edge_factor = 6;
> -	dsc->rc_tgt_offset_high = 3;
> -	dsc->rc_tgt_offset_low = 3;
> -	dsc->simple_422 = 0;
> -	dsc->convert_rgb = 1;
> -	dsc->vbr_enable = 0;
> -
> -	/* handle only bpp = bpc = 8 */
> -	for (i = 0; i < DSC_NUM_BUF_RANGES - 1 ; i++)
> -		dsc->rc_buf_thresh[i] = dsi_dsc_rc_buf_thresh[i];
> -
> -	for (i = 0; i < DSC_NUM_BUF_RANGES; i++) {
> -		dsc->rc_range_params[i].range_min_qp = min_qp[i];
> -		dsc->rc_range_params[i].range_max_qp = max_qp[i];
> -		/*
> -		 * Range BPG Offset contains two's-complement signed values that fill
> -		 * 8 bits, yet the registers and DCS PPS field are only 6 bits wide.
> -		 */
> -		dsc->rc_range_params[i].range_bpg_offset = bpg_offset[i] & DSC_RANGE_BPG_OFFSET_MASK;
> -	}
> -
> -	dsc->initial_offset = 6144;		/* Not bpp 12 */
> -	if (bpp != 8)
> -		dsc->initial_offset = 2048;	/* bpp = 12 */
> -
> -	if (dsc->bits_per_component <= 10)
> -		dsc->mux_word_size = DSC_MUX_WORD_SIZE_8_10_BPC;
> -	else
> -		dsc->mux_word_size = DSC_MUX_WORD_SIZE_12_BPC;
> -
> -	dsc->initial_xmit_delay = 512;
> -	dsc->initial_scale_value = 32;
> -	dsc->first_line_bpg_offset = 12;
> -	dsc->line_buf_depth = dsc->bits_per_component + 1;
> -
> -	/* bpc 8 */
> -	dsc->flatness_min_qp = 3;
> -	dsc->flatness_max_qp = 12;
> -	dsc->rc_quant_incr_limit0 = 11;
> -	dsc->rc_quant_incr_limit1 = 11;
> -
> -	return drm_dsc_compute_rc_parameters(dsc);
> +	/*
> +	 * NOTE:
> +	 * dsc->dsc_version_major, dsc->dsc_version_minor
> +	 * dsc->bits_per_pixel,
> +	 * dsc->bits_per_component,
> +	 * dsc->native_422, dsc->native_420
> +	 *
> +	 * above parameters must be populated

Comments
In Yoda style
written should be not.

> +	 */
> +	return dpu_dsc_populate_dsc_config(dsc, 0);
>   }
>   
>   static int dsi_host_parse_dt(struct msm_dsi_host *msm_host)

-- 
With best wishes
Dmitry


  reply	other threads:[~2023-02-24 21:04 UTC|newest]

Thread overview: 34+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-02-24 19:40 [RFC PATCH 0/2] Add DPU DSC helper module Kuogee Hsieh
2023-02-24 19:40 ` [RFC PATCH 1/2] drm/msm/dpu: add dsc helper functions Kuogee Hsieh
2023-02-24 21:13   ` Dmitry Baryshkov
2023-02-24 21:23     ` Abhinav Kumar
2023-02-24 21:36       ` Dmitry Baryshkov
2023-02-24 22:26         ` Abhinav Kumar
2023-02-24 23:53           ` Dmitry Baryshkov
2023-02-25  0:36             ` Abhinav Kumar
2023-02-25 15:23               ` Dmitry Baryshkov
2023-02-26  0:47                 ` Abhinav Kumar
2023-02-26 13:09                   ` Dmitry Baryshkov
2023-02-26 23:49                     ` Abhinav Kumar
2023-02-27 12:45                       ` Dmitry Baryshkov
2023-02-27 17:59                         ` Abhinav Kumar
2023-02-27 19:25                           ` Dmitry Baryshkov
2023-02-27 21:24                             ` Abhinav Kumar
2023-03-16  1:28                               ` [Freedreno] " Jessica Zhang
2023-03-16 16:03                                 ` Dmitry Baryshkov
2023-03-16 16:13                                   ` Abhinav Kumar
2023-03-16 16:23                                     ` Dmitry Baryshkov
2023-03-16 16:36                                       ` Abhinav Kumar
2023-03-16 23:40                                         ` Abhinav Kumar
2023-02-27 12:48                       ` Jani Nikula
2023-02-24 23:51     ` Kuogee Hsieh
2023-02-24 23:57       ` Dmitry Baryshkov
2023-02-26  0:16         ` Abhinav Kumar
2023-02-26 13:13           ` Dmitry Baryshkov
2023-02-27  0:15             ` Abhinav Kumar
2023-02-27 12:33               ` Dmitry Baryshkov
2023-02-24 19:40 ` [RFC PATCH 2/2] drm/msm/dsi: use new dpu_dsc_populate_dsc_config() Kuogee Hsieh
2023-02-24 21:04   ` Dmitry Baryshkov [this message]
2023-02-24 21:09     ` Abhinav Kumar
2023-02-24 21:14       ` Dmitry Baryshkov
2023-02-24 21:24         ` 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=525078f5-44be-9a75-a737-ddcc6e097700@linaro.org \
    --to=dmitry.baryshkov@linaro.org \
    --cc=agross@kernel.org \
    --cc=airlied@gmail.com \
    --cc=andersson@kernel.org \
    --cc=daniel@ffwll.ch \
    --cc=dianders@chromium.org \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=freedreno@lists.freedesktop.org \
    --cc=linux-arm-msm@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=marijn.suijten@somainline.org \
    --cc=quic_abhinavk@quicinc.com \
    --cc=quic_khsieh@quicinc.com \
    --cc=quic_sbillaka@quicinc.com \
    --cc=robdclark@gmail.com \
    --cc=sean@poorly.run \
    --cc=swboyd@chromium.org \
    --cc=vkoul@kernel.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

all inboxes | Powered by JetHome®