From: Abhinav Kumar <quic_abhinavk@quicinc.com>
To: Marijn Suijten <marijn.suijten@somainline.org>,
<phone-devel@vger.kernel.org>, Rob Clark <robdclark@gmail.com>,
Dmitry Baryshkov <dmitry.baryshkov@linaro.org>,
Vinod Koul <vkoul@kernel.org>
Cc: freedreno@lists.freedesktop.org,
Thomas Zimmermann <tzimmermann@suse.de>,
Jami Kettunen <jami.kettunen@somainline.org>,
Vladimir Lypak <vladimir.lypak@gmail.com>,
linux-arm-msm@vger.kernel.org,
Konrad Dybcio <konrad.dybcio@somainline.org>,
Javier Martinez Canillas <javierm@redhat.com>,
dri-devel@lists.freedesktop.org,
Douglas Anderson <dianders@chromium.org>,
David Airlie <airlied@linux.ie>,
Martin Botka <martin.botka@somainline.org>,
~postmarketos/upstreaming@lists.sr.ht,
AngeloGioacchino Del Regno
<angelogioacchino.delregno@somainline.org>,
Alex Deucher <alexander.deucher@amd.com>,
Sean Paul <sean@poorly.run>,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH v2 1/7] drm/msm/dsi: Remove useless math in DSC calculations
Date: Wed, 5 Oct 2022 14:14:02 -0700 [thread overview]
Message-ID: <a110f32a-261c-e5da-2c1d-609ba9ec1680@quicinc.com> (raw)
In-Reply-To: <20221005181657.784375-2-marijn.suijten@somainline.org>
On 10/5/2022 11:16 AM, Marijn Suijten wrote:
> Multiplying a value by 2 and adding 1 to it always results in a value
> that is uneven, and that 1 gets truncated immediately when performing
> integer division by 2 again. There is no "rounding" possible here.
>
> After that target_bpp_x16 is used to store a multiplication of
> bits_per_pixel by 16 which is only ever read to immediately be divided
> by 16 again, and is elided in much the same way.
>
> Fixes: b9080324d6ca ("drm/msm/dsi: add support for dsc data")
> Signed-off-by: Marijn Suijten <marijn.suijten@somainline.org>
Reviewed-by: Abhinav Kumar <quic_abhinavk@quicinc.com>
> ---
> drivers/gpu/drm/msm/dsi/dsi_host.c | 10 +---------
> 1 file changed, 1 insertion(+), 9 deletions(-)
>
> diff --git a/drivers/gpu/drm/msm/dsi/dsi_host.c b/drivers/gpu/drm/msm/dsi/dsi_host.c
> index 8e4bc586c262..70077d1f0f21 100644
> --- a/drivers/gpu/drm/msm/dsi/dsi_host.c
> +++ b/drivers/gpu/drm/msm/dsi/dsi_host.c
> @@ -1784,7 +1784,6 @@ static int dsi_populate_dsc_params(struct drm_dsc_config *dsc)
> int hrd_delay;
> int pre_num_extra_mux_bits, num_extra_mux_bits;
> int slice_bits;
> - int target_bpp_x16;
> int data;
> int final_value, final_scale;
> int i;
> @@ -1864,14 +1863,7 @@ static int dsi_populate_dsc_params(struct drm_dsc_config *dsc)
> data = 2048 * (dsc->rc_model_size - dsc->initial_offset + num_extra_mux_bits);
> dsc->slice_bpg_offset = DIV_ROUND_UP(data, groups_total);
>
> - /* bpp * 16 + 0.5 */
> - data = dsc->bits_per_pixel * 16;
> - data *= 2;
> - data++;
> - data /= 2;
> - target_bpp_x16 = data;
> -
> - data = (dsc->initial_xmit_delay * target_bpp_x16) / 16;
> + data = dsc->initial_xmit_delay * dsc->bits_per_pixel;
> final_value = dsc->rc_model_size - data + num_extra_mux_bits;
> dsc->final_offset = final_value;
>
next prev parent reply other threads:[~2022-10-05 21:14 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-10-05 18:16 [PATCH v2 0/7] drm/msm: Fix math issues in MSM DSC implementation Marijn Suijten
2022-10-05 18:16 ` [PATCH v2 1/7] drm/msm/dsi: Remove useless math in DSC calculations Marijn Suijten
2022-10-05 21:14 ` Abhinav Kumar [this message]
2022-10-05 18:16 ` [PATCH v2 2/7] drm/msm/dsi: Remove repeated calculation of slice_per_intf Marijn Suijten
2022-10-05 18:16 ` [PATCH v2 3/7] drm/msm/dsi: Use DIV_ROUND_UP instead of conditional increment on modulo Marijn Suijten
2022-10-05 21:34 ` Abhinav Kumar
2022-10-05 18:16 ` [PATCH v2 4/7] drm/msm/dsi: Reuse earlier computed dsc->slice_chunk_size Marijn Suijten
2022-10-05 21:37 ` Abhinav Kumar
2022-10-05 18:16 ` [PATCH v2 5/7] drm/msm/dsi: Account for DSC's bits_per_pixel having 4 fractional bits Marijn Suijten
2022-10-05 19:31 ` Dmitry Baryshkov
2022-10-05 20:58 ` Marijn Suijten
2022-10-05 21:06 ` Dmitry Baryshkov
2022-10-05 21:08 ` Marijn Suijten
2022-10-05 21:11 ` Dmitry Baryshkov
2022-10-05 21:33 ` Marijn Suijten
2022-10-05 18:16 ` [PATCH v2 6/7] drm/msm/dpu1: " Marijn Suijten
2022-10-05 18:16 ` [PATCH v2 7/7] drm/msm/dsi: Prevent signed BPG offsets from bleeding into adjacent bits Marijn Suijten
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=a110f32a-261c-e5da-2c1d-609ba9ec1680@quicinc.com \
--to=quic_abhinavk@quicinc.com \
--cc=airlied@linux.ie \
--cc=alexander.deucher@amd.com \
--cc=angelogioacchino.delregno@somainline.org \
--cc=dianders@chromium.org \
--cc=dmitry.baryshkov@linaro.org \
--cc=dri-devel@lists.freedesktop.org \
--cc=freedreno@lists.freedesktop.org \
--cc=jami.kettunen@somainline.org \
--cc=javierm@redhat.com \
--cc=konrad.dybcio@somainline.org \
--cc=linux-arm-msm@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=marijn.suijten@somainline.org \
--cc=martin.botka@somainline.org \
--cc=phone-devel@vger.kernel.org \
--cc=robdclark@gmail.com \
--cc=sean@poorly.run \
--cc=tzimmermann@suse.de \
--cc=vkoul@kernel.org \
--cc=vladimir.lypak@gmail.com \
--cc=~postmarketos/upstreaming@lists.sr.ht \
/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).