* [PATCH] drm/dsc: Return unsigned long on compute offset
@ 2019-11-19 14:45 ` mikita.lipski
0 siblings, 0 replies; 23+ messages in thread
From: mikita.lipski-5C7GfCeVMHo @ 2019-11-19 14:45 UTC (permalink / raw)
To: amd-gfx-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW
Cc: Mikita Lipski, Harry Wentland,
dri-devel-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW, Nikola Cornij
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.
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
_______________________________________________
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
^ permalink raw reply related [flat|nested] 23+ messages in thread
* [PATCH] drm/dsc: Return unsigned long on compute offset
@ 2019-11-19 14:45 ` mikita.lipski
0 siblings, 0 replies; 23+ messages in thread
From: mikita.lipski @ 2019-11-19 14:45 UTC (permalink / raw)
To: amd-gfx; +Cc: Mikita Lipski, Harry Wentland, dri-devel, Nikola Cornij
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.
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
_______________________________________________
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
^ permalink raw reply related [flat|nested] 23+ messages in thread
* [PATCH] drm/dsc: Return unsigned long on compute offset
@ 2019-11-19 14:45 ` mikita.lipski
0 siblings, 0 replies; 23+ messages in thread
From: mikita.lipski @ 2019-11-19 14:45 UTC (permalink / raw)
To: amd-gfx; +Cc: Mikita Lipski, dri-devel, Nikola Cornij
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.
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
^ permalink raw reply related [flat|nested] 23+ messages in thread
* Re: [PATCH] drm/dsc: Return unsigned long on compute offset
@ 2019-11-19 14:56 ` Ville Syrjälä
0 siblings, 0 replies; 23+ messages in thread
From: Ville Syrjälä @ 2019-11-19 14:56 UTC (permalink / raw)
To: mikita.lipski; +Cc: dri-devel, amd-gfx, Nikola Cornij
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?
>
> 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
--
Ville Syrjälä
Intel
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel
^ permalink raw reply [flat|nested] 23+ messages in thread
* Re: [PATCH] drm/dsc: Return unsigned long on compute offset
@ 2019-11-19 14:56 ` Ville Syrjälä
0 siblings, 0 replies; 23+ messages in thread
From: Ville Syrjälä @ 2019-11-19 14:56 UTC (permalink / raw)
To: mikita.lipski; +Cc: dri-devel, amd-gfx, Nikola Cornij
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?
>
> 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
--
Ville Syrjälä
Intel
_______________________________________________
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
^ permalink raw reply [flat|nested] 23+ messages in thread
* Re: [PATCH] drm/dsc: Return unsigned long on compute offset
@ 2019-11-19 15:08 ` Mikita Lipski
0 siblings, 0 replies; 23+ messages in thread
From: Mikita Lipski @ 2019-11-19 15:08 UTC (permalink / raw)
To: Ville Syrjälä, mikita.lipski; +Cc: dri-devel, amd-gfx, Nikola Cornij
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
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel
^ permalink raw reply [flat|nested] 23+ messages in thread
* Re: [PATCH] drm/dsc: Return unsigned long on compute offset
@ 2019-11-19 15:08 ` Mikita Lipski
0 siblings, 0 replies; 23+ messages in thread
From: Mikita Lipski @ 2019-11-19 15:08 UTC (permalink / raw)
To: Ville Syrjälä, mikita.lipski; +Cc: dri-devel, amd-gfx, Nikola Cornij
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
_______________________________________________
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
^ permalink raw reply [flat|nested] 23+ messages in thread
* RE: [PATCH] drm/dsc: Return unsigned long on compute offset
@ 2019-11-19 16:59 ` Cornij, Nikola
0 siblings, 0 replies; 23+ messages in thread
From: Cornij, Nikola @ 2019-11-19 16:59 UTC (permalink / raw)
To: Lipski, Mikita, Ville Syrjälä
Cc: dri-devel@lists.freedesktop.org, amd-gfx@lists.freedesktop.org
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.
-----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
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel
^ permalink raw reply [flat|nested] 23+ messages in thread
* RE: [PATCH] drm/dsc: Return unsigned long on compute offset
@ 2019-11-19 16:59 ` Cornij, Nikola
0 siblings, 0 replies; 23+ messages in thread
From: Cornij, Nikola @ 2019-11-19 16:59 UTC (permalink / raw)
To: Lipski, Mikita, Ville Syrjälä
Cc: dri-devel@lists.freedesktop.org, amd-gfx@lists.freedesktop.org
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.
-----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
_______________________________________________
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
^ permalink raw reply [flat|nested] 23+ messages in thread
* Re: [PATCH] drm/dsc: Return unsigned long on compute offset
@ 2019-11-19 17:11 ` Ville Syrjälä
0 siblings, 0 replies; 23+ messages in thread
From: Ville Syrjälä @ 2019-11-19 17:11 UTC (permalink / raw)
To: Cornij, Nikola
Cc: Lipski, Mikita,
dri-devel-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org,
amd-gfx-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org
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.
>
> -----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
--
Ville Syrjälä
Intel
_______________________________________________
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
^ permalink raw reply [flat|nested] 23+ messages in thread
* Re: [PATCH] drm/dsc: Return unsigned long on compute offset
@ 2019-11-19 17:11 ` Ville Syrjälä
0 siblings, 0 replies; 23+ messages in thread
From: Ville Syrjälä @ 2019-11-19 17:11 UTC (permalink / raw)
To: Cornij, Nikola
Cc: Lipski, Mikita, dri-devel@lists.freedesktop.org,
amd-gfx@lists.freedesktop.org
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.
>
> -----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
--
Ville Syrjälä
Intel
_______________________________________________
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
^ permalink raw reply [flat|nested] 23+ messages in thread
* Re: [PATCH] drm/dsc: Return unsigned long on compute offset
@ 2019-11-19 17:11 ` Ville Syrjälä
0 siblings, 0 replies; 23+ messages in thread
From: Ville Syrjälä @ 2019-11-19 17:11 UTC (permalink / raw)
To: Cornij, Nikola
Cc: Lipski, Mikita, dri-devel@lists.freedesktop.org,
amd-gfx@lists.freedesktop.org
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.
>
> -----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
--
Ville Syrjälä
Intel
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel
^ permalink raw reply [flat|nested] 23+ messages in thread
* Re: [PATCH] drm/dsc: Return unsigned long on compute offset
@ 2019-11-19 21:09 ` Mikita Lipski
0 siblings, 0 replies; 23+ messages in thread
From: Mikita Lipski @ 2019-11-19 21:09 UTC (permalink / raw)
To: Ville Syrjälä, Cornij, Nikola
Cc: Lipski, Mikita,
dri-devel-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org,
amd-gfx-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@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
^ permalink raw reply [flat|nested] 23+ messages in thread
* Re: [PATCH] drm/dsc: Return unsigned long on compute offset
@ 2019-11-19 21:09 ` Mikita Lipski
0 siblings, 0 replies; 23+ messages in thread
From: Mikita Lipski @ 2019-11-19 21:09 UTC (permalink / raw)
To: Ville Syrjälä, Cornij, Nikola
Cc: Lipski, Mikita, dri-devel@lists.freedesktop.org,
amd-gfx@lists.freedesktop.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
^ permalink raw reply [flat|nested] 23+ messages in thread
* Re: [PATCH] drm/dsc: Return unsigned long on compute offset
@ 2019-11-19 21:09 ` Mikita Lipski
0 siblings, 0 replies; 23+ messages in thread
From: Mikita Lipski @ 2019-11-19 21:09 UTC (permalink / raw)
To: Ville Syrjälä, Cornij, Nikola
Cc: Lipski, Mikita, dri-devel@lists.freedesktop.org,
amd-gfx@lists.freedesktop.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
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel
^ permalink raw reply [flat|nested] 23+ messages in thread
* Re: [PATCH] drm/dsc: Return unsigned long on compute offset
@ 2019-11-19 21:11 ` Mikita Lipski
0 siblings, 0 replies; 23+ messages in thread
From: Mikita Lipski @ 2019-11-19 21:11 UTC (permalink / raw)
To: Ville Syrjälä, Cornij, Nikola
Cc: Lipski, Mikita,
dri-devel-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org,
amd-gfx-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org
On 19/11/2019 16:09, Mikita Lipski wrote:
>
>
> 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.
>>
Sorry made a type below. Supposed to be "I don't think it is broken"
> 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
^ permalink raw reply [flat|nested] 23+ messages in thread
* Re: [PATCH] drm/dsc: Return unsigned long on compute offset
@ 2019-11-19 21:11 ` Mikita Lipski
0 siblings, 0 replies; 23+ messages in thread
From: Mikita Lipski @ 2019-11-19 21:11 UTC (permalink / raw)
To: Ville Syrjälä, Cornij, Nikola
Cc: Lipski, Mikita, dri-devel@lists.freedesktop.org,
amd-gfx@lists.freedesktop.org
On 19/11/2019 16:09, Mikita Lipski wrote:
>
>
> 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.
>>
Sorry made a type below. Supposed to be "I don't think it is broken"
> 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
^ permalink raw reply [flat|nested] 23+ messages in thread
* Re: [PATCH] drm/dsc: Return unsigned long on compute offset
@ 2019-11-19 21:11 ` Mikita Lipski
0 siblings, 0 replies; 23+ messages in thread
From: Mikita Lipski @ 2019-11-19 21:11 UTC (permalink / raw)
To: Ville Syrjälä, Cornij, Nikola
Cc: Lipski, Mikita, dri-devel@lists.freedesktop.org,
amd-gfx@lists.freedesktop.org
On 19/11/2019 16:09, Mikita Lipski wrote:
>
>
> 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.
>>
Sorry made a type below. Supposed to be "I don't think it is broken"
> 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
^ permalink raw reply [flat|nested] 23+ messages in thread
* Re: [PATCH] drm/dsc: Return unsigned long on compute offset
@ 2019-11-20 10:17 ` Ville Syrjälä
0 siblings, 0 replies; 23+ messages in thread
From: Ville Syrjälä @ 2019-11-20 10:17 UTC (permalink / raw)
To: Mikita Lipski
Cc: Lipski, Mikita,
dri-devel-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org,
amd-gfx-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org,
Cornij, Nikola
On Tue, Nov 19, 2019 at 04:11:43PM -0500, Mikita Lipski wrote:
>
>
> On 19/11/2019 16:09, Mikita Lipski wrote:
> >
> >
> > 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.
> >>
>
>
> Sorry made a type below. Supposed to be "I don't think it is broken"
I mean that it's broken if it actually needs u64 when it's
currently using unsigned long. So u64 is either overkill or the
code is currently broken.
>
> > 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
--
Ville Syrjälä
Intel
_______________________________________________
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
^ permalink raw reply [flat|nested] 23+ messages in thread
* Re: [PATCH] drm/dsc: Return unsigned long on compute offset
@ 2019-11-20 10:17 ` Ville Syrjälä
0 siblings, 0 replies; 23+ messages in thread
From: Ville Syrjälä @ 2019-11-20 10:17 UTC (permalink / raw)
To: Mikita Lipski
Cc: Lipski, Mikita, dri-devel@lists.freedesktop.org,
amd-gfx@lists.freedesktop.org, Cornij, Nikola
On Tue, Nov 19, 2019 at 04:11:43PM -0500, Mikita Lipski wrote:
>
>
> On 19/11/2019 16:09, Mikita Lipski wrote:
> >
> >
> > 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.
> >>
>
>
> Sorry made a type below. Supposed to be "I don't think it is broken"
I mean that it's broken if it actually needs u64 when it's
currently using unsigned long. So u64 is either overkill or the
code is currently broken.
>
> > 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
--
Ville Syrjälä
Intel
_______________________________________________
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
^ permalink raw reply [flat|nested] 23+ messages in thread
* Re: [PATCH] drm/dsc: Return unsigned long on compute offset
@ 2019-11-20 10:17 ` Ville Syrjälä
0 siblings, 0 replies; 23+ messages in thread
From: Ville Syrjälä @ 2019-11-20 10:17 UTC (permalink / raw)
To: Mikita Lipski
Cc: Lipski, Mikita, dri-devel@lists.freedesktop.org,
amd-gfx@lists.freedesktop.org, Cornij, Nikola
On Tue, Nov 19, 2019 at 04:11:43PM -0500, Mikita Lipski wrote:
>
>
> On 19/11/2019 16:09, Mikita Lipski wrote:
> >
> >
> > 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.
> >>
>
>
> Sorry made a type below. Supposed to be "I don't think it is broken"
I mean that it's broken if it actually needs u64 when it's
currently using unsigned long. So u64 is either overkill or the
code is currently broken.
>
> > 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
--
Ville Syrjälä
Intel
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel
^ permalink raw reply [flat|nested] 23+ messages in thread
* Re: [PATCH] drm/dsc: Return unsigned long on compute offset
@ 2019-11-20 13:44 ` Mikita Lipski
0 siblings, 0 replies; 23+ messages in thread
From: Mikita Lipski @ 2019-11-20 13:44 UTC (permalink / raw)
To: Ville Syrjälä
Cc: Lipski, Mikita, dri-devel@lists.freedesktop.org,
amd-gfx@lists.freedesktop.org, Cornij, Nikola
On 20/11/2019 05:17, Ville Syrjälä wrote:
> On Tue, Nov 19, 2019 at 04:11:43PM -0500, Mikita Lipski wrote:
>>
>>
>> On 19/11/2019 16:09, Mikita Lipski wrote:
>>>
>>>
>>> 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.
>>>>
>>
>>
>> Sorry made a type below. Supposed to be "I don't think it is broken"
>
> I mean that it's broken if it actually needs u64 when it's
> currently using unsigned long. So u64 is either overkill or the
> code is currently broken.
>
None of the calculations exceed u32, so u64 would be an overkill, since
none of the variables in the structure exceed 16 bits. Therefore u32 is
enough.
>>
>>> 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
>
--
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
^ permalink raw reply [flat|nested] 23+ messages in thread
* Re: [PATCH] drm/dsc: Return unsigned long on compute offset
@ 2019-11-20 13:44 ` Mikita Lipski
0 siblings, 0 replies; 23+ messages in thread
From: Mikita Lipski @ 2019-11-20 13:44 UTC (permalink / raw)
To: Ville Syrjälä
Cc: Lipski, Mikita, dri-devel@lists.freedesktop.org,
amd-gfx@lists.freedesktop.org, Cornij, Nikola
On 20/11/2019 05:17, Ville Syrjälä wrote:
> On Tue, Nov 19, 2019 at 04:11:43PM -0500, Mikita Lipski wrote:
>>
>>
>> On 19/11/2019 16:09, Mikita Lipski wrote:
>>>
>>>
>>> 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.
>>>>
>>
>>
>> Sorry made a type below. Supposed to be "I don't think it is broken"
>
> I mean that it's broken if it actually needs u64 when it's
> currently using unsigned long. So u64 is either overkill or the
> code is currently broken.
>
None of the calculations exceed u32, so u64 would be an overkill, since
none of the variables in the structure exceed 16 bits. Therefore u32 is
enough.
>>
>>> 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
>
--
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
^ permalink raw reply [flat|nested] 23+ messages in thread
end of thread, other threads:[~2019-11-20 13:44 UTC | newest]
Thread overview: 23+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
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:45 ` mikita.lipski
2019-11-19 14:56 ` Ville Syrjälä
2019-11-19 14:56 ` Ville Syrjälä
2019-11-19 15:08 ` Mikita Lipski
2019-11-19 15:08 ` Mikita Lipski
2019-11-19 16:59 ` Cornij, Nikola
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ä
2019-11-19 17:11 ` Ville Syrjälä
[not found] ` <20191119171132.GB1208-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
2019-11-19 21:09 ` Mikita Lipski
2019-11-19 21:09 ` Mikita Lipski
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
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 10:17 ` Ville Syrjälä
2019-11-20 13:44 ` Mikita Lipski
2019-11-20 13:44 ` Mikita Lipski
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.