diff mbox series

[v3,5/6] drm: atmel-hlcdc: prefer a lower pixel-clock than requested

Message ID 1576672109-22707-6-git-send-email-claudiu.beznea@microchip.com (mailing list archive)
State New, archived
Headers show
Series fixes for atmel-hlcdc | expand

Commit Message

Claudiu Beznea Dec. 18, 2019, 12:28 p.m. UTC
From: Peter Rosin <peda@axentia.se>

The intention was to only select a higher pixel-clock rate than the
requested, if a slight overclocking would result in a rate significantly
closer to the requested rate than if the conservative lower pixel-clock
rate is selected. The fixed patch has the logic the other way around and
actually prefers the higher frequency. Fix that.

Fixes: f6f7ad323461 ("drm/atmel-hlcdc: allow selecting a higher pixel-clock than requested")
Reported-by: Claudiu Beznea <claudiu.beznea@microchip.com>
Tested-by: Claudiu Beznea <claudiu.beznea@microchip.com>
Signed-off-by: Peter Rosin <peda@axentia.se>
---
 drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_crtc.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

Comments

Sam Ravnborg Jan. 2, 2020, 9:08 a.m. UTC | #1
On Wed, Dec 18, 2019 at 02:28:28PM +0200, Claudiu Beznea wrote:
> From: Peter Rosin <peda@axentia.se>
> 
> The intention was to only select a higher pixel-clock rate than the
> requested, if a slight overclocking would result in a rate significantly
> closer to the requested rate than if the conservative lower pixel-clock
> rate is selected. The fixed patch has the logic the other way around and
> actually prefers the higher frequency. Fix that.
> 
> Fixes: f6f7ad323461 ("drm/atmel-hlcdc: allow selecting a higher pixel-clock than requested")
The id is wrong here - the right one is: 9946a3a9dbedaaacef8b7e94f6ac144f1daaf1de
The wrong id above was used before - so I think it is a copy'n'paste
thing.

Hint: try "dim fixes 9946a3a9dbedaaacef8b7e94f6ac144f1daaf1de"

If I get a quick response from Lee I can fix it up while applying.

	Sam

> Reported-by: Claudiu Beznea <claudiu.beznea@microchip.com>
> Tested-by: Claudiu Beznea <claudiu.beznea@microchip.com>
> Signed-off-by: Peter Rosin <peda@axentia.se>
> ---
>  drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_crtc.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_crtc.c b/drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_crtc.c
> index 721fa88bf71d..10985134ce0b 100644
> --- a/drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_crtc.c
> +++ b/drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_crtc.c
> @@ -121,8 +121,8 @@ static void atmel_hlcdc_crtc_mode_set_nofb(struct drm_crtc *c)
>  		int div_low = prate / mode_rate;
>  
>  		if (div_low >= 2 &&
> -		    ((prate / div_low - mode_rate) <
> -		     10 * (mode_rate - prate / div)))
> +		    (10 * (prate / div_low - mode_rate) <
> +		     (mode_rate - prate / div)))
>  			/*
>  			 * At least 10 times better when using a higher
>  			 * frequency than requested, instead of a lower.
> -- 
> 2.7.4
Sam Ravnborg Jan. 4, 2020, 5:12 p.m. UTC | #2
Hi Claudiu

On Thu, Jan 02, 2020 at 10:08:48AM +0100, Sam Ravnborg wrote:
> On Wed, Dec 18, 2019 at 02:28:28PM +0200, Claudiu Beznea wrote:
> > From: Peter Rosin <peda@axentia.se>
> > 
> > The intention was to only select a higher pixel-clock rate than the
> > requested, if a slight overclocking would result in a rate significantly
> > closer to the requested rate than if the conservative lower pixel-clock
> > rate is selected. The fixed patch has the logic the other way around and
> > actually prefers the higher frequency. Fix that.
> > 
> > Fixes: f6f7ad323461 ("drm/atmel-hlcdc: allow selecting a higher pixel-clock than requested")
> The id is wrong here - the right one is: 9946a3a9dbedaaacef8b7e94f6ac144f1daaf1de
> The wrong id above was used before - so I think it is a copy'n'paste
> thing.
> 
> Hint: try "dim fixes 9946a3a9dbedaaacef8b7e94f6ac144f1daaf1de"
> 
> If I get a quick response from Lee I can fix it up while applying.
> 
> 	Sam
> 
> > Reported-by: Claudiu Beznea <claudiu.beznea@microchip.com>
> > Tested-by: Claudiu Beznea <claudiu.beznea@microchip.com>
> > Signed-off-by: Peter Rosin <peda@axentia.se>

One other detail.
The patch has passed through your hands, so you have to add your s-o-b
to document this.
The chain of s-o-b shall document the path the patch has taken towards
the kernel.

In this case:
Peter => Claudiu => Sam => Applied.

Please resend or reply where you say OK that I add your s-o-b.

PS. And happy new year!

	Sam


> > ---
> >  drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_crtc.c | 4 ++--
> >  1 file changed, 2 insertions(+), 2 deletions(-)
> > 
> > diff --git a/drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_crtc.c b/drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_crtc.c
> > index 721fa88bf71d..10985134ce0b 100644
> > --- a/drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_crtc.c
> > +++ b/drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_crtc.c
> > @@ -121,8 +121,8 @@ static void atmel_hlcdc_crtc_mode_set_nofb(struct drm_crtc *c)
> >  		int div_low = prate / mode_rate;
> >  
> >  		if (div_low >= 2 &&
> > -		    ((prate / div_low - mode_rate) <
> > -		     10 * (mode_rate - prate / div)))
> > +		    (10 * (prate / div_low - mode_rate) <
> > +		     (mode_rate - prate / div)))
> >  			/*
> >  			 * At least 10 times better when using a higher
> >  			 * frequency than requested, instead of a lower.
> > -- 
> > 2.7.4
> _______________________________________________
> dri-devel mailing list
> dri-devel@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/dri-devel
Claudiu Beznea Jan. 6, 2020, 9:24 a.m. UTC | #3
On 02.01.2020 11:08, Sam Ravnborg wrote:
> On Wed, Dec 18, 2019 at 02:28:28PM +0200, Claudiu Beznea wrote:
>> From: Peter Rosin <peda@axentia.se>
>>
>> The intention was to only select a higher pixel-clock rate than the
>> requested, if a slight overclocking would result in a rate significantly
>> closer to the requested rate than if the conservative lower pixel-clock
>> rate is selected. The fixed patch has the logic the other way around and
>> actually prefers the higher frequency. Fix that.
>>
>> Fixes: f6f7ad323461 ("drm/atmel-hlcdc: allow selecting a higher pixel-clock than requested")
> The id is wrong here - the right one is: 9946a3a9dbedaaacef8b7e94f6ac144f1daaf1de

Right! Sorry for this one! Thank you for fixing it up.

Claudiu Beznea

> The wrong id above was used before - so I think it is a copy'n'paste
> thing.
> 
> Hint: try "dim fixes 9946a3a9dbedaaacef8b7e94f6ac144f1daaf1de"
> 
> If I get a quick response from Lee I can fix it up while applying.
> 
>         Sam
> 
>> Reported-by: Claudiu Beznea <claudiu.beznea@microchip.com>
>> Tested-by: Claudiu Beznea <claudiu.beznea@microchip.com>
>> Signed-off-by: Peter Rosin <peda@axentia.se>
>> ---
>>  drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_crtc.c | 4 ++--
>>  1 file changed, 2 insertions(+), 2 deletions(-)
>>
>> diff --git a/drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_crtc.c b/drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_crtc.c
>> index 721fa88bf71d..10985134ce0b 100644
>> --- a/drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_crtc.c
>> +++ b/drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_crtc.c
>> @@ -121,8 +121,8 @@ static void atmel_hlcdc_crtc_mode_set_nofb(struct drm_crtc *c)
>>               int div_low = prate / mode_rate;
>>
>>               if (div_low >= 2 &&
>> -                 ((prate / div_low - mode_rate) <
>> -                  10 * (mode_rate - prate / div)))
>> +                 (10 * (prate / div_low - mode_rate) <
>> +                  (mode_rate - prate / div)))
>>                       /*
>>                        * At least 10 times better when using a higher
>>                        * frequency than requested, instead of a lower.
>> --
>> 2.7.4
>
Claudiu Beznea Jan. 6, 2020, 9:25 a.m. UTC | #4
On 04.01.2020 19:12, Sam Ravnborg wrote:
> EXTERNAL EMAIL: Do not click links or open attachments unless you know the content is safe
> 
> Hi Claudiu
> 
> On Thu, Jan 02, 2020 at 10:08:48AM +0100, Sam Ravnborg wrote:
>> On Wed, Dec 18, 2019 at 02:28:28PM +0200, Claudiu Beznea wrote:
>>> From: Peter Rosin <peda@axentia.se>
>>>
>>> The intention was to only select a higher pixel-clock rate than the
>>> requested, if a slight overclocking would result in a rate significantly
>>> closer to the requested rate than if the conservative lower pixel-clock
>>> rate is selected. The fixed patch has the logic the other way around and
>>> actually prefers the higher frequency. Fix that.
>>>
>>> Fixes: f6f7ad323461 ("drm/atmel-hlcdc: allow selecting a higher pixel-clock than requested")
>> The id is wrong here - the right one is: 9946a3a9dbedaaacef8b7e94f6ac144f1daaf1de
>> The wrong id above was used before - so I think it is a copy'n'paste
>> thing.
>>
>> Hint: try "dim fixes 9946a3a9dbedaaacef8b7e94f6ac144f1daaf1de"
>>
>> If I get a quick response from Lee I can fix it up while applying.
>>
>>       Sam
>>
>>> Reported-by: Claudiu Beznea <claudiu.beznea@microchip.com>
>>> Tested-by: Claudiu Beznea <claudiu.beznea@microchip.com>
>>> Signed-off-by: Peter Rosin <peda@axentia.se>
> 
> One other detail.
> The patch has passed through your hands, so you have to add your s-o-b
> to document this.
> The chain of s-o-b shall document the path the patch has taken towards
> the kernel.
> 
> In this case:
> Peter => Claudiu => Sam => Applied.
> 
> Please resend or reply where you say OK that I add your s-o-b.

Sure! Please add my Signed-off-by: Claudiu Beznea <claudiu.beznea@microchip.com>

Thank you, Sam!

> 
> PS. And happy new year!
> 
>         Sam
> 
> 
>>> ---
>>>  drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_crtc.c | 4 ++--
>>>  1 file changed, 2 insertions(+), 2 deletions(-)
>>>
>>> diff --git a/drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_crtc.c b/drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_crtc.c
>>> index 721fa88bf71d..10985134ce0b 100644
>>> --- a/drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_crtc.c
>>> +++ b/drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_crtc.c
>>> @@ -121,8 +121,8 @@ static void atmel_hlcdc_crtc_mode_set_nofb(struct drm_crtc *c)
>>>             int div_low = prate / mode_rate;
>>>
>>>             if (div_low >= 2 &&
>>> -               ((prate / div_low - mode_rate) <
>>> -                10 * (mode_rate - prate / div)))
>>> +               (10 * (prate / div_low - mode_rate) <
>>> +                (mode_rate - prate / div)))
>>>                     /*
>>>                      * At least 10 times better when using a higher
>>>                      * frequency than requested, instead of a lower.
>>> --
>>> 2.7.4
>> _______________________________________________
>> dri-devel mailing list
>> dri-devel@lists.freedesktop.org
>> https://lists.freedesktop.org/mailman/listinfo/dri-devel
>
Sam Ravnborg Jan. 6, 2020, 7:02 p.m. UTC | #5
Hi Claudiu.
On Mon, Jan 06, 2020 at 09:25:40AM +0000, Claudiu.Beznea@microchip.com wrote:
> 
> 
> On 04.01.2020 19:12, Sam Ravnborg wrote:
> > EXTERNAL EMAIL: Do not click links or open attachments unless you know the content is safe
> > 
> > Hi Claudiu
> > 
> > On Thu, Jan 02, 2020 at 10:08:48AM +0100, Sam Ravnborg wrote:
> >> On Wed, Dec 18, 2019 at 02:28:28PM +0200, Claudiu Beznea wrote:
> >>> From: Peter Rosin <peda@axentia.se>
> >>>
> >>> The intention was to only select a higher pixel-clock rate than the
> >>> requested, if a slight overclocking would result in a rate significantly
> >>> closer to the requested rate than if the conservative lower pixel-clock
> >>> rate is selected. The fixed patch has the logic the other way around and
> >>> actually prefers the higher frequency. Fix that.
> >>>
> >>> Fixes: f6f7ad323461 ("drm/atmel-hlcdc: allow selecting a higher pixel-clock than requested")
> >> The id is wrong here - the right one is: 9946a3a9dbedaaacef8b7e94f6ac144f1daaf1de
> >> The wrong id above was used before - so I think it is a copy'n'paste
> >> thing.
> >>
> >> Hint: try "dim fixes 9946a3a9dbedaaacef8b7e94f6ac144f1daaf1de"
> >>
> >> If I get a quick response from Lee I can fix it up while applying.
> >>
> >>       Sam
> >>
> >>> Reported-by: Claudiu Beznea <claudiu.beznea@microchip.com>
> >>> Tested-by: Claudiu Beznea <claudiu.beznea@microchip.com>
> >>> Signed-off-by: Peter Rosin <peda@axentia.se>
> > 
> > One other detail.
> > The patch has passed through your hands, so you have to add your s-o-b
> > to document this.
> > The chain of s-o-b shall document the path the patch has taken towards
> > the kernel.
> > 
> > In this case:
> > Peter => Claudiu => Sam => Applied.
> > 
> > Please resend or reply where you say OK that I add your s-o-b.
> 
> Sure! Please add my Signed-off-by: Claudiu Beznea <claudiu.beznea@microchip.com>

Thanks - all four DRM patches pushed to drm-misc-next.
I used "dim fixes" so we could Cc relevant stable versions.

	Sam
Peter Rosin Jan. 7, 2020, 9:19 a.m. UTC | #6
On 2020-01-06 10:24, Claudiu.Beznea@microchip.com wrote:
> On 02.01.2020 11:08, Sam Ravnborg wrote:
>> On Wed, Dec 18, 2019 at 02:28:28PM +0200, Claudiu Beznea wrote:
>>> From: Peter Rosin <peda@axentia.se>
>>>
>>> The intention was to only select a higher pixel-clock rate than the
>>> requested, if a slight overclocking would result in a rate significantly
>>> closer to the requested rate than if the conservative lower pixel-clock
>>> rate is selected. The fixed patch has the logic the other way around and
>>> actually prefers the higher frequency. Fix that.
>>>
>>> Fixes: f6f7ad323461 ("drm/atmel-hlcdc: allow selecting a higher pixel-clock than requested")
>> The id is wrong here - the right one is: 9946a3a9dbedaaacef8b7e94f6ac144f1daaf1de
> 
> Right! Sorry for this one! Thank you for fixing it up.

Dito. This one was my fault. I wonder how I came up with the wrong id?
Probably some backport branch or something, but I'm not finding it. Oh
well, sorry again.

Cheers,
Peter
diff mbox series

Patch

diff --git a/drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_crtc.c b/drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_crtc.c
index 721fa88bf71d..10985134ce0b 100644
--- a/drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_crtc.c
+++ b/drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_crtc.c
@@ -121,8 +121,8 @@  static void atmel_hlcdc_crtc_mode_set_nofb(struct drm_crtc *c)
 		int div_low = prate / mode_rate;
 
 		if (div_low >= 2 &&
-		    ((prate / div_low - mode_rate) <
-		     10 * (mode_rate - prate / div)))
+		    (10 * (prate / div_low - mode_rate) <
+		     (mode_rate - prate / div)))
 			/*
 			 * At least 10 times better when using a higher
 			 * frequency than requested, instead of a lower.