* [PATCH v2] drm/dsc: Return unsigned long on compute offset
@ 2019-11-22 18:46 ` mikita.lipski
0 siblings, 0 replies; 6+ messages in thread
From: mikita.lipski @ 2019-11-22 18:46 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.
v2: Modified function parameters to unsigned type for type
consistency
Cc: Ville Syrjälä <ville.syrjala@linux.intel.com>
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 | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/drivers/gpu/drm/drm_dsc.c b/drivers/gpu/drm/drm_dsc.c
index 74f3527f567d..ccce0297da64 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,
- int groups_per_line, int grpcnt)
+static unsigned long compute_offset(struct drm_dsc_config *vdsc_cfg, unsigned int pixels_per_group,
+ unsigned long groups_per_line, unsigned long 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] 6+ messages in thread* [PATCH v2] drm/dsc: Return unsigned long on compute offset
@ 2019-11-22 18:46 ` mikita.lipski
0 siblings, 0 replies; 6+ messages in thread
From: mikita.lipski @ 2019-11-22 18:46 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.
v2: Modified function parameters to unsigned type for type
consistency
Cc: Ville Syrjälä <ville.syrjala@linux.intel.com>
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 | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/drivers/gpu/drm/drm_dsc.c b/drivers/gpu/drm/drm_dsc.c
index 74f3527f567d..ccce0297da64 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,
- int groups_per_line, int grpcnt)
+static unsigned long compute_offset(struct drm_dsc_config *vdsc_cfg, unsigned int pixels_per_group,
+ unsigned long groups_per_line, unsigned long 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] 6+ messages in thread* [PATCH v2] drm/dsc: Return unsigned long on compute offset
@ 2019-11-22 18:46 ` mikita.lipski
0 siblings, 0 replies; 6+ messages in thread
From: mikita.lipski @ 2019-11-22 18:46 UTC (permalink / raw)
To: amd-gfx
Cc: Mikita Lipski, Harry Wentland, Ville Syrjälä, 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.
v2: Modified function parameters to unsigned type for type
consistency
Cc: Ville Syrjälä <ville.syrjala@linux.intel.com>
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 | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/drivers/gpu/drm/drm_dsc.c b/drivers/gpu/drm/drm_dsc.c
index 74f3527f567d..ccce0297da64 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,
- int groups_per_line, int grpcnt)
+static unsigned long compute_offset(struct drm_dsc_config *vdsc_cfg, unsigned int pixels_per_group,
+ unsigned long groups_per_line, unsigned long 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] 6+ messages in thread[parent not found: <20191122184625.20151-1-mikita.lipski-5C7GfCeVMHo@public.gmane.org>]
* Re: [PATCH v2] drm/dsc: Return unsigned long on compute offset
@ 2019-11-28 13:55 ` Jani Nikula
0 siblings, 0 replies; 6+ messages in thread
From: Jani Nikula @ 2019-11-28 13:55 UTC (permalink / raw)
To: amd-gfx-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW
Cc: Mikita Lipski, dri-devel-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW,
Nikola Cornij
On Fri, 22 Nov 2019, <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.
>
> v2: Modified function parameters to unsigned type for type
> consistency
I don't think that really addresses the review.
But all the same, current drm-tip does not have a compute_offset()
function, and the only reference to it in my email are your patches, so
this is completely unactionable anyway.
In any case I think the root cause for your issues is the unfounded use
of unsigned longs in drm_dsc_compute_rc_parameters(). Fix that and many
of your problems go away.
BR,
Jani.
>
> Cc: Ville Syrjälä <ville.syrjala@linux.intel.com>
> 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 | 8 ++++----
> 1 file changed, 4 insertions(+), 4 deletions(-)
>
> diff --git a/drivers/gpu/drm/drm_dsc.c b/drivers/gpu/drm/drm_dsc.c
> index 74f3527f567d..ccce0297da64 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,
> - int groups_per_line, int grpcnt)
> +static unsigned long compute_offset(struct drm_dsc_config *vdsc_cfg, unsigned int pixels_per_group,
> + unsigned long groups_per_line, unsigned long 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);
--
Jani Nikula, Intel Open Source Graphics Center
_______________________________________________
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
^ permalink raw reply [flat|nested] 6+ messages in thread* Re: [PATCH v2] drm/dsc: Return unsigned long on compute offset
@ 2019-11-28 13:55 ` Jani Nikula
0 siblings, 0 replies; 6+ messages in thread
From: Jani Nikula @ 2019-11-28 13:55 UTC (permalink / raw)
To: mikita.lipski, amd-gfx; +Cc: Mikita Lipski, dri-devel, Nikola Cornij
On Fri, 22 Nov 2019, <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.
>
> v2: Modified function parameters to unsigned type for type
> consistency
I don't think that really addresses the review.
But all the same, current drm-tip does not have a compute_offset()
function, and the only reference to it in my email are your patches, so
this is completely unactionable anyway.
In any case I think the root cause for your issues is the unfounded use
of unsigned longs in drm_dsc_compute_rc_parameters(). Fix that and many
of your problems go away.
BR,
Jani.
>
> Cc: Ville Syrjälä <ville.syrjala@linux.intel.com>
> 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 | 8 ++++----
> 1 file changed, 4 insertions(+), 4 deletions(-)
>
> diff --git a/drivers/gpu/drm/drm_dsc.c b/drivers/gpu/drm/drm_dsc.c
> index 74f3527f567d..ccce0297da64 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,
> - int groups_per_line, int grpcnt)
> +static unsigned long compute_offset(struct drm_dsc_config *vdsc_cfg, unsigned int pixels_per_group,
> + unsigned long groups_per_line, unsigned long 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);
--
Jani Nikula, Intel Open Source Graphics Center
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel
^ permalink raw reply [flat|nested] 6+ messages in thread* Re: [PATCH v2] drm/dsc: Return unsigned long on compute offset
@ 2019-11-28 13:55 ` Jani Nikula
0 siblings, 0 replies; 6+ messages in thread
From: Jani Nikula @ 2019-11-28 13:55 UTC (permalink / raw)
To: mikita.lipski, amd-gfx; +Cc: Mikita Lipski, dri-devel, Nikola Cornij
On Fri, 22 Nov 2019, <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.
>
> v2: Modified function parameters to unsigned type for type
> consistency
I don't think that really addresses the review.
But all the same, current drm-tip does not have a compute_offset()
function, and the only reference to it in my email are your patches, so
this is completely unactionable anyway.
In any case I think the root cause for your issues is the unfounded use
of unsigned longs in drm_dsc_compute_rc_parameters(). Fix that and many
of your problems go away.
BR,
Jani.
>
> Cc: Ville Syrjälä <ville.syrjala@linux.intel.com>
> 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 | 8 ++++----
> 1 file changed, 4 insertions(+), 4 deletions(-)
>
> diff --git a/drivers/gpu/drm/drm_dsc.c b/drivers/gpu/drm/drm_dsc.c
> index 74f3527f567d..ccce0297da64 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,
> - int groups_per_line, int grpcnt)
> +static unsigned long compute_offset(struct drm_dsc_config *vdsc_cfg, unsigned int pixels_per_group,
> + unsigned long groups_per_line, unsigned long 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);
--
Jani Nikula, Intel Open Source Graphics Center
_______________________________________________
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2019-11-28 13:55 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2019-11-22 18:46 [PATCH v2] drm/dsc: Return unsigned long on compute offset mikita.lipski
2019-11-22 18:46 ` mikita.lipski
2019-11-22 18:46 ` mikita.lipski
[not found] ` <20191122184625.20151-1-mikita.lipski-5C7GfCeVMHo@public.gmane.org>
2019-11-28 13:55 ` Jani Nikula
2019-11-28 13:55 ` Jani Nikula
2019-11-28 13:55 ` Jani Nikula
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.