From: Abhinav Kumar <quic_abhinavk@quicinc.com>
To: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>,
Jessica Zhang <quic_jesszhan@quicinc.com>
Cc: Tvrtko Ursulin <tvrtko.ursulin@linux.intel.com>,
<quic_sbillaka@quicinc.com>, <sean@poorly.run>,
<andersson@kernel.org>, <linux-kernel@vger.kernel.org>,
<dri-devel@lists.freedesktop.org>, <dianders@chromium.org>,
<vkoul@kernel.org>, <agross@kernel.org>,
"Rodrigo Vivi" <rodrigo.vivi@intel.com>,
<marijn.suijten@somainline.org>, <swboyd@chromium.org>,
Kuogee Hsieh <quic_khsieh@quicinc.com>,
<freedreno@lists.freedesktop.org>,
Intel Graphics Development <intel-gfx@lists.freedesktop.org>,
<linux-arm-msm@vger.kernel.org>
Subject: Re: [Freedreno] [RFC PATCH 1/2] drm/msm/dpu: add dsc helper functions
Date: Thu, 16 Mar 2023 16:40:08 -0700 [thread overview]
Message-ID: <b3143706-00d2-16d4-9bbd-046139fcdce0@quicinc.com> (raw)
In-Reply-To: <10b39fab-43a7-40b4-5d11-bc191e2953f3@quicinc.com>
On 3/16/2023 9:36 AM, Abhinav Kumar wrote:
>
>
> On 3/16/2023 9:23 AM, Dmitry Baryshkov wrote:
>> On 16/03/2023 18:13, Abhinav Kumar wrote:
>>>
>>>
>>> On 3/16/2023 9:03 AM, Dmitry Baryshkov wrote:
>>>> Hi,
>>>>
>>>> [removed previous conversation]
>>>>
>>>>>
>>>>> Hi Dmitry and Abhinav,
>>>>>
>>>>> Just wanted to follow up on this thread. I've gone over the
>>>>> MSM-specific
>>>>> DSC params for DP and DSI and have found a few shared calculations and
>>>>> variables between both DSI and DP paths:
>>>>>
>>>>> - (as mentioned earlier in the thread) almost all the calculations in
>>>>> dpu_dsc_populate_dsc_config() match dsi_populate_dsc_params() [1]. The
>>>>> only difference in the math I'm seeing is initial_scale_value.
>>>>
>>>> The value in dsi code is valid for initial_offset = 6144. Please use
>>>> the formula from the standard (= sde_dsc_populate_dsc_config) and add
>>>> it to drm_dsc_helper.c
>>>>
Yes, I agree with this part. for rc_model_size we can use
DSC_RC_MODEL_SIZE_CONST.
initial_offset is already handled in
https://patchwork.freedesktop.org/patch/525424/?series=114472&rev=2
Then we can use this math:
rc_model_size / (rc_model_size -
initial_offset), keeping in mind that initial_scale_value has three
fractional bits.
So this would be 8192 / (8192 - 6144) = 4
Then << 3 for 3 fractional bits = 32.
>>>> If I remember correctly the last remaining item in
>>>> dsi_populate_dsc_params() (except mentioned initial_offset) was
>>>> line_buf_depth, see [3]. I'm not sure about setting it to bpc+1.
>>>> According to the standard it should come from a DSC decoder spec,
>>>> which means it should be set by the DSI panel driver or via
>>>> drm_dp_dsc_sink_line_buf_depth() in the case of DP output.
>>>>
>>>>> - dsc_extra_pclk_cycle_cnt and dce_bytes_per_line, which were
>>>>> introduced
>>>>> in Kuogee's v1 DSC series [2], are used for DSI, DP, and the DPU
>>>>> timing
>>>>> engine. dsc_extra_pclk_cycle_cnt is calculated based on pclk_per_line
>>>>> (which is calculated differently between DP and DSI), but
>>>>> dce_bytes_per_line is calculated the same way between DP and DSI.
>>>>>
>>>>> To avoid having to duplicate math in 2 different places, I think it
>>>>> would help to have these calculations in some msm_dsc_helper.c
>>>>> file. Any
>>>>> thoughts on this?
>>>>
>>>> dsc_extra_pclk_cycle_cnt and dce_bytes_per_line are used only in DPU
>>>> code, so they can stay in DPU driver.
>>>>
>>>
>>> They can stay in the dpu driver is fine but where?
>>>
>>> Like Jessica wrote, this is computed and used in 3 places today :
>>>
>>> 1) DSI video engine computation
>>> 2) DP controller computation
>>> 3) timing engine programming
>>
>> Please excuse me if I'm wrong. I checked both vendor techpack and the
>> Kuogee's patches. I see them being used only in the SDE / DPU driver
>> code. Could you please point me to the code path that we are discussing?
>>
>
> DSI code :
>
> https://gitlab.freedesktop.org/drm/msm/-/blob/msm-next/drivers/gpu/drm/msm/dsi/dsi_host.c#L868
>
>
> DP code:
>
> Refer to dp_panel_dsc_pclk_param_calc in
> https://patchwork.freedesktop.org/patch/519837/?series=113240&rev=1
>
> Timing engine:
>
> refer to
> https://patchwork.freedesktop.org/patch/519838/?series=113240&rev=1
>
> Probably confusion is due to the naming. bytes_per_line is nothing but
> bytes_per_pkt * pkt_per_line but the concept is common for DP and DSI.
>
> + if (phys->comp_type == MSM_DISPLAY_COMPRESSION_DSC) {
> + phys->dsc_extra_pclk_cycle_cnt = dsc_info->pclk_per_line;
> + phys->dsc_extra_disp_width = dsc_info->extra_width;
> + phys->dce_bytes_per_line =
> + dsc_info->bytes_per_pkt * dsc_info->pkt_per_line;
>
>>
>>> So either we have a helper in a common location somewhere so that
>>> these 3 modules can call that helper and use it OR each module
>>> duplicates the computation code.
>>>
>>> What should be the common location is the discussion here.
>>>
>>> It cannot be dpu_encoder.c as the DSI/DP dont call into the encoder
>>> methods.
>>>
>>>>>
>>>>> Thanks,
>>>>>
>>>>> Jessica Zhang
>>>>>
>>>>> [1]
>>>>> https://elixir.bootlin.com/linux/v6.3-rc2/source/drivers/gpu/drm/msm/dsi/dsi_host.c#L1756
>>>>>
>>>>>
>>>>> [2]
>>>>> https://patchwork.freedesktop.org/patch/519845/?series=113240&rev=1
>>>>
>>>> [3] https://patchwork.freedesktop.org/patch/525441/?series=114472&rev=2
>>>>
>>>>
>>>>
>>
next prev parent reply other threads:[~2023-03-16 23:42 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 [this message]
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
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=b3143706-00d2-16d4-9bbd-046139fcdce0@quicinc.com \
--to=quic_abhinavk@quicinc.com \
--cc=agross@kernel.org \
--cc=andersson@kernel.org \
--cc=dianders@chromium.org \
--cc=dmitry.baryshkov@linaro.org \
--cc=dri-devel@lists.freedesktop.org \
--cc=freedreno@lists.freedesktop.org \
--cc=intel-gfx@lists.freedesktop.org \
--cc=linux-arm-msm@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=marijn.suijten@somainline.org \
--cc=quic_jesszhan@quicinc.com \
--cc=quic_khsieh@quicinc.com \
--cc=quic_sbillaka@quicinc.com \
--cc=rodrigo.vivi@intel.com \
--cc=sean@poorly.run \
--cc=swboyd@chromium.org \
--cc=tvrtko.ursulin@linux.intel.com \
--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