From: Mikita Lipski <mlipski-5C7GfCeVMHo@public.gmane.org>
To: "Ville Syrjälä"
<ville.syrjala-VuQAYsv1563Yd54FQh9/CA@public.gmane.org>,
"Cornij, Nikola" <Nikola.Cornij-5C7GfCeVMHo@public.gmane.org>
Cc: "Lipski, Mikita" <Mikita.Lipski-5C7GfCeVMHo@public.gmane.org>,
"dri-devel-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org"
<dri-devel-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org>,
"amd-gfx-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org"
<amd-gfx-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org>
Subject: Re: [PATCH] drm/dsc: Return unsigned long on compute offset
Date: Tue, 19 Nov 2019 16:09:19 -0500 [thread overview]
Message-ID: <2a61d60c-98f9-a5a2-6e7b-dc94df3fc510@amd.com> (raw)
In-Reply-To: <20191119171132.GB1208-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
On 19/11/2019 12:11, Ville Syrjälä wrote:
> On Tue, Nov 19, 2019 at 04:59:40PM +0000, Cornij, Nikola wrote:
>> If you're going to make all of them the same, then u64, please.
>>
>> This is because I'm not sure if calculations require 64-bit at some stage.
>
> If it does then it's already broken. Someone should probably figure out
> what's actally needed instead of shooting ducks with an icbm.
>
I don't think it is not broken, cause I'm currently testing DSC.
The patch I sent early simply fixes the error of comparing signed and
unsigned variables.
We can then submit a second patch addressing the issue of using unsigned
long int instead of u32. Also, since the variables in drm_dsc_config
structure are all of type u8 and u16, the calculation values shouldn't
exceed the size of u32.
Thanks
>>
>> -----Original Message-----
>> From: Lipski, Mikita <Mikita.Lipski@amd.com>
>> Sent: November 19, 2019 10:08 AM
>> To: Ville Syrjälä <ville.syrjala@linux.intel.com>; Lipski, Mikita <Mikita.Lipski@amd.com>
>> Cc: amd-gfx@lists.freedesktop.org; dri-devel@lists.freedesktop.org; Cornij, Nikola <Nikola.Cornij@amd.com>
>> Subject: Re: [PATCH] drm/dsc: Return unsigned long on compute offset
>>
>>
>>
>> On 19/11/2019 09:56, Ville Syrjälä wrote:
>>> On Tue, Nov 19, 2019 at 09:45:26AM -0500, mikita.lipski@amd.com wrote:
>>>> From: Mikita Lipski <mikita.lipski@amd.com>
>>>>
>>>> We shouldn't compare int with unsigned long to find the max value and
>>>> since we are not expecting negative value returned from
>>>> compute_offset we should make this function return unsigned long so
>>>> we can compare the values when computing rc parameters.
>>>
>>> Why are there other unsigned longs in dsc parameter computation in the
>>> first place?
>>
>> I believe it was initially set to be unsigned long for variable consistency, when we ported intel_compute_rc_parameters into drm_dsc_compute_rc_parameters. But now that I look at it, we can actually just set them to u32 or u64, as nothing should exceed that.
>>>
>>>>
>>>> Cc: Nikola Cornij <nikola.cornij@amd.com>
>>>> Cc: Harry Wentland <harry.wentland@amd.com>
>>>> Signed-off-by: Mikita Lipski <mikita.lipski@amd.com>
>>>> ---
>>>> drivers/gpu/drm/drm_dsc.c | 6 +++---
>>>> 1 file changed, 3 insertions(+), 3 deletions(-)
>>>>
>>>> diff --git a/drivers/gpu/drm/drm_dsc.c b/drivers/gpu/drm/drm_dsc.c
>>>> index 74f3527f567d..ec40604ab6a2 100644
>>>> --- a/drivers/gpu/drm/drm_dsc.c
>>>> +++ b/drivers/gpu/drm/drm_dsc.c
>>>> @@ -245,11 +245,11 @@ void drm_dsc_pps_payload_pack(struct drm_dsc_picture_parameter_set *pps_payload,
>>>> }
>>>> EXPORT_SYMBOL(drm_dsc_pps_payload_pack);
>>>>
>>>> -static int compute_offset(struct drm_dsc_config *vdsc_cfg, int pixels_per_group,
>>>> +static unsigned long compute_offset(struct drm_dsc_config *vdsc_cfg, int pixels_per_group,
>>>> int groups_per_line, int grpcnt)
>>>> {
>>>> - int offset = 0;
>>>> - int grpcnt_id = DIV_ROUND_UP(vdsc_cfg->initial_xmit_delay, pixels_per_group);
>>>> + unsigned long offset = 0;
>>>> + unsigned long grpcnt_id = DIV_ROUND_UP(vdsc_cfg->initial_xmit_delay, pixels_per_group);
>>>>
>>>> if (grpcnt <= grpcnt_id)
>>>> offset = DIV_ROUND_UP(grpcnt * pixels_per_group * vdsc_cfg->bits_per_pixel, 16);
>>>> --
>>>> 2.17.1
>>>>
>>>> _______________________________________________
>>>> dri-devel mailing list
>>>> dri-devel@lists.freedesktop.org
>>>> https://lists.freedesktop.org/mailman/listinfo/dri-devel
>>>
>>
>> --
>> Thanks,
>> Mikita Lipski
>> Software Engineer 2, AMD
>> mikita.lipski@amd.com
>
--
Thanks,
Mikita Lipski
Software Engineer 2, AMD
mikita.lipski@amd.com
_______________________________________________
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
WARNING: multiple messages have this Message-ID (diff)
From: Mikita Lipski <mlipski@amd.com>
To: "Ville Syrjälä" <ville.syrjala@linux.intel.com>,
"Cornij, Nikola" <Nikola.Cornij@amd.com>
Cc: "Lipski, Mikita" <Mikita.Lipski@amd.com>,
"dri-devel@lists.freedesktop.org"
<dri-devel@lists.freedesktop.org>,
"amd-gfx@lists.freedesktop.org" <amd-gfx@lists.freedesktop.org>
Subject: Re: [PATCH] drm/dsc: Return unsigned long on compute offset
Date: Tue, 19 Nov 2019 16:09:19 -0500 [thread overview]
Message-ID: <2a61d60c-98f9-a5a2-6e7b-dc94df3fc510@amd.com> (raw)
Message-ID: <20191119210919.0ktwFY-nQ7Wpg6_dfO-QEZeGuOi3L21E6GKY7LjK6nM@z> (raw)
In-Reply-To: <20191119171132.GB1208@intel.com>
On 19/11/2019 12:11, Ville Syrjälä wrote:
> On Tue, Nov 19, 2019 at 04:59:40PM +0000, Cornij, Nikola wrote:
>> If you're going to make all of them the same, then u64, please.
>>
>> This is because I'm not sure if calculations require 64-bit at some stage.
>
> If it does then it's already broken. Someone should probably figure out
> what's actally needed instead of shooting ducks with an icbm.
>
I don't think it is not broken, cause I'm currently testing DSC.
The patch I sent early simply fixes the error of comparing signed and
unsigned variables.
We can then submit a second patch addressing the issue of using unsigned
long int instead of u32. Also, since the variables in drm_dsc_config
structure are all of type u8 and u16, the calculation values shouldn't
exceed the size of u32.
Thanks
>>
>> -----Original Message-----
>> From: Lipski, Mikita <Mikita.Lipski@amd.com>
>> Sent: November 19, 2019 10:08 AM
>> To: Ville Syrjälä <ville.syrjala@linux.intel.com>; Lipski, Mikita <Mikita.Lipski@amd.com>
>> Cc: amd-gfx@lists.freedesktop.org; dri-devel@lists.freedesktop.org; Cornij, Nikola <Nikola.Cornij@amd.com>
>> Subject: Re: [PATCH] drm/dsc: Return unsigned long on compute offset
>>
>>
>>
>> On 19/11/2019 09:56, Ville Syrjälä wrote:
>>> On Tue, Nov 19, 2019 at 09:45:26AM -0500, mikita.lipski@amd.com wrote:
>>>> From: Mikita Lipski <mikita.lipski@amd.com>
>>>>
>>>> We shouldn't compare int with unsigned long to find the max value and
>>>> since we are not expecting negative value returned from
>>>> compute_offset we should make this function return unsigned long so
>>>> we can compare the values when computing rc parameters.
>>>
>>> Why are there other unsigned longs in dsc parameter computation in the
>>> first place?
>>
>> I believe it was initially set to be unsigned long for variable consistency, when we ported intel_compute_rc_parameters into drm_dsc_compute_rc_parameters. But now that I look at it, we can actually just set them to u32 or u64, as nothing should exceed that.
>>>
>>>>
>>>> Cc: Nikola Cornij <nikola.cornij@amd.com>
>>>> Cc: Harry Wentland <harry.wentland@amd.com>
>>>> Signed-off-by: Mikita Lipski <mikita.lipski@amd.com>
>>>> ---
>>>> drivers/gpu/drm/drm_dsc.c | 6 +++---
>>>> 1 file changed, 3 insertions(+), 3 deletions(-)
>>>>
>>>> diff --git a/drivers/gpu/drm/drm_dsc.c b/drivers/gpu/drm/drm_dsc.c
>>>> index 74f3527f567d..ec40604ab6a2 100644
>>>> --- a/drivers/gpu/drm/drm_dsc.c
>>>> +++ b/drivers/gpu/drm/drm_dsc.c
>>>> @@ -245,11 +245,11 @@ void drm_dsc_pps_payload_pack(struct drm_dsc_picture_parameter_set *pps_payload,
>>>> }
>>>> EXPORT_SYMBOL(drm_dsc_pps_payload_pack);
>>>>
>>>> -static int compute_offset(struct drm_dsc_config *vdsc_cfg, int pixels_per_group,
>>>> +static unsigned long compute_offset(struct drm_dsc_config *vdsc_cfg, int pixels_per_group,
>>>> int groups_per_line, int grpcnt)
>>>> {
>>>> - int offset = 0;
>>>> - int grpcnt_id = DIV_ROUND_UP(vdsc_cfg->initial_xmit_delay, pixels_per_group);
>>>> + unsigned long offset = 0;
>>>> + unsigned long grpcnt_id = DIV_ROUND_UP(vdsc_cfg->initial_xmit_delay, pixels_per_group);
>>>>
>>>> if (grpcnt <= grpcnt_id)
>>>> offset = DIV_ROUND_UP(grpcnt * pixels_per_group * vdsc_cfg->bits_per_pixel, 16);
>>>> --
>>>> 2.17.1
>>>>
>>>> _______________________________________________
>>>> dri-devel mailing list
>>>> dri-devel@lists.freedesktop.org
>>>> https://lists.freedesktop.org/mailman/listinfo/dri-devel
>>>
>>
>> --
>> Thanks,
>> Mikita Lipski
>> Software Engineer 2, AMD
>> mikita.lipski@amd.com
>
--
Thanks,
Mikita Lipski
Software Engineer 2, AMD
mikita.lipski@amd.com
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel
next prev parent reply other threads:[~2019-11-19 21:09 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-11-19 14:45 [PATCH] drm/dsc: Return unsigned long on compute offset mikita.lipski-5C7GfCeVMHo
2019-11-19 14:45 ` mikita.lipski
2019-11-19 14:56 ` Ville Syrjälä
2019-11-19 15:08 ` Mikita Lipski
2019-11-19 16:59 ` Cornij, Nikola
[not found] ` <BL0PR12MB24039F7D8CC95CCCC10C3103EE4C0-b4cIHhjg/p81/3vIZPtp9gdYzm3356FpvxpqHgZTriW3zl9H0oFU5g@public.gmane.org>
2019-11-19 17:11 ` Ville Syrjälä
2019-11-19 17:11 ` Ville Syrjälä
[not found] ` <20191119171132.GB1208-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
2019-11-19 21:09 ` Mikita Lipski [this message]
2019-11-19 21:09 ` Mikita Lipski
[not found] ` <2a61d60c-98f9-a5a2-6e7b-dc94df3fc510-5C7GfCeVMHo@public.gmane.org>
2019-11-19 21:11 ` Mikita Lipski
2019-11-19 21:11 ` Mikita Lipski
[not found] ` <362986e6-e5d4-f2d5-12bd-feb0acc06546-5C7GfCeVMHo@public.gmane.org>
2019-11-20 10:17 ` Ville Syrjälä
2019-11-20 10:17 ` Ville Syrjälä
2019-11-20 13:44 ` Mikita Lipski
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=2a61d60c-98f9-a5a2-6e7b-dc94df3fc510@amd.com \
--to=mlipski-5c7gfcevmho@public.gmane.org \
--cc=Mikita.Lipski-5C7GfCeVMHo@public.gmane.org \
--cc=Nikola.Cornij-5C7GfCeVMHo@public.gmane.org \
--cc=amd-gfx-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org \
--cc=dri-devel-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org \
--cc=ville.syrjala-VuQAYsv1563Yd54FQh9/CA@public.gmane.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