diff mbox

drm: panel: simple-panel: set appropriate mode type

Message ID 1430404770-29704-1-git-send-email-boris.brezillon@free-electrons.com (mailing list archive)
State New, archived
Headers show

Commit Message

Boris BREZILLON April 30, 2015, 2:39 p.m. UTC
All modes exposed by simple panels should be tagged as driver defined
modes.
Moreover, if a panel supports only one mode, this mode is obviously the
preferred one.

Doing this also fix a problem occurring when a 'video=' parameter is passed
on the kernel cmdline. In some cases the user provided mode is preferred
over the simple panel ones, which might result in unpredictable behavior.

Signed-off-by: Boris Brezillon <boris.brezillon@free-electrons.com>
---
 drivers/gpu/drm/panel/panel-simple.c | 8 ++++++++
 1 file changed, 8 insertions(+)

Comments

Nicolas Ferre April 30, 2015, 2:46 p.m. UTC | #1
Le 30/04/2015 16:39, Boris Brezillon a écrit :
> All modes exposed by simple panels should be tagged as driver defined
> modes.
> Moreover, if a panel supports only one mode, this mode is obviously the
> preferred one.
> 
> Doing this also fix a problem occurring when a 'video=' parameter is passed
> on the kernel cmdline. In some cases the user provided mode is preferred
> over the simple panel ones, which might result in unpredictable behavior.
> 
> Signed-off-by: Boris Brezillon <boris.brezillon@free-electrons.com>

Tested-by: Nicolas Ferre <nicolas.ferre@atmel.com>
On Atmel sama5d3xek board.

> ---
>  drivers/gpu/drm/panel/panel-simple.c | 8 ++++++++
>  1 file changed, 8 insertions(+)
> 
> diff --git a/drivers/gpu/drm/panel/panel-simple.c b/drivers/gpu/drm/panel/panel-simple.c
> index d14b904..95ae390 100644
> --- a/drivers/gpu/drm/panel/panel-simple.c
> +++ b/drivers/gpu/drm/panel/panel-simple.c
> @@ -111,6 +111,10 @@ static int panel_simple_get_fixed_modes(struct panel_simple *panel)
>  			continue;
>  		}
>  
> +		mode->type |= DRM_MODE_TYPE_DRIVER;
> +		if (panel->desc->num_modes == 1)
> +			mode->type |= DRM_MODE_TYPE_PREFERRED;
> +
>  		drm_display_mode_from_videomode(&vm, mode);
>  
>  		drm_mode_probed_add(connector, mode);
> @@ -127,6 +131,10 @@ static int panel_simple_get_fixed_modes(struct panel_simple *panel)
>  			continue;
>  		}
>  
> +		mode->type |= DRM_MODE_TYPE_DRIVER;
> +		if (panel->desc->num_modes == 1)
> +			mode->type |= DRM_MODE_TYPE_PREFERRED;
> +
>  		drm_mode_set_name(mode);
>  
>  		drm_mode_probed_add(connector, mode);
>
Boris BREZILLON May 28, 2015, 2:25 p.m. UTC | #2
Hi Thierry,

Could you have a look at this patch (a.k.a. ping) ?

Best Regards,

Boris

On Thu, 30 Apr 2015 16:39:30 +0200
Boris Brezillon <boris.brezillon@free-electrons.com> wrote:

> All modes exposed by simple panels should be tagged as driver defined
> modes.
> Moreover, if a panel supports only one mode, this mode is obviously the
> preferred one.
> 
> Doing this also fix a problem occurring when a 'video=' parameter is passed
> on the kernel cmdline. In some cases the user provided mode is preferred
> over the simple panel ones, which might result in unpredictable behavior.
> 
> Signed-off-by: Boris Brezillon <boris.brezillon@free-electrons.com>
> ---
>  drivers/gpu/drm/panel/panel-simple.c | 8 ++++++++
>  1 file changed, 8 insertions(+)
> 
> diff --git a/drivers/gpu/drm/panel/panel-simple.c b/drivers/gpu/drm/panel/panel-simple.c
> index d14b904..95ae390 100644
> --- a/drivers/gpu/drm/panel/panel-simple.c
> +++ b/drivers/gpu/drm/panel/panel-simple.c
> @@ -111,6 +111,10 @@ static int panel_simple_get_fixed_modes(struct panel_simple *panel)
>  			continue;
>  		}
>  
> +		mode->type |= DRM_MODE_TYPE_DRIVER;
> +		if (panel->desc->num_modes == 1)
> +			mode->type |= DRM_MODE_TYPE_PREFERRED;
> +
>  		drm_display_mode_from_videomode(&vm, mode);
>  
>  		drm_mode_probed_add(connector, mode);
> @@ -127,6 +131,10 @@ static int panel_simple_get_fixed_modes(struct panel_simple *panel)
>  			continue;
>  		}
>  
> +		mode->type |= DRM_MODE_TYPE_DRIVER;
> +		if (panel->desc->num_modes == 1)
> +			mode->type |= DRM_MODE_TYPE_PREFERRED;
> +
>  		drm_mode_set_name(mode);
>  
>  		drm_mode_probed_add(connector, mode);
Nicolas Ferre April 15, 2016, 4:04 p.m. UTC | #3
Le 28/05/2015 16:25, Boris Brezillon a écrit :
> Hi Thierry,
> 
> Could you have a look at this patch (a.k.a. ping) ?

It's been a long time and... It seems that this patch doesn't apply
anymore but:

Reviewed-by: Nicolas Ferre <nicolas.ferre@atmel.com>

So, I'm updating it and resending right now.

Bye,

> On Thu, 30 Apr 2015 16:39:30 +0200
> Boris Brezillon <boris.brezillon@free-electrons.com> wrote:
> 
>> All modes exposed by simple panels should be tagged as driver defined
>> modes.
>> Moreover, if a panel supports only one mode, this mode is obviously the
>> preferred one.
>>
>> Doing this also fix a problem occurring when a 'video=' parameter is passed
>> on the kernel cmdline. In some cases the user provided mode is preferred
>> over the simple panel ones, which might result in unpredictable behavior.
>>
>> Signed-off-by: Boris Brezillon <boris.brezillon@free-electrons.com>
>> ---
>>  drivers/gpu/drm/panel/panel-simple.c | 8 ++++++++
>>  1 file changed, 8 insertions(+)
>>
>> diff --git a/drivers/gpu/drm/panel/panel-simple.c b/drivers/gpu/drm/panel/panel-simple.c
>> index d14b904..95ae390 100644
>> --- a/drivers/gpu/drm/panel/panel-simple.c
>> +++ b/drivers/gpu/drm/panel/panel-simple.c
>> @@ -111,6 +111,10 @@ static int panel_simple_get_fixed_modes(struct panel_simple *panel)
>>  			continue;
>>  		}
>>  
>> +		mode->type |= DRM_MODE_TYPE_DRIVER;
>> +		if (panel->desc->num_modes == 1)
>> +			mode->type |= DRM_MODE_TYPE_PREFERRED;
>> +
>>  		drm_display_mode_from_videomode(&vm, mode);
>>  
>>  		drm_mode_probed_add(connector, mode);
>> @@ -127,6 +131,10 @@ static int panel_simple_get_fixed_modes(struct panel_simple *panel)
>>  			continue;
>>  		}
>>  
>> +		mode->type |= DRM_MODE_TYPE_DRIVER;
>> +		if (panel->desc->num_modes == 1)
>> +			mode->type |= DRM_MODE_TYPE_PREFERRED;
>> +
>>  		drm_mode_set_name(mode);
>>  
>>  		drm_mode_probed_add(connector, mode);
> 
> 
>
diff mbox

Patch

diff --git a/drivers/gpu/drm/panel/panel-simple.c b/drivers/gpu/drm/panel/panel-simple.c
index d14b904..95ae390 100644
--- a/drivers/gpu/drm/panel/panel-simple.c
+++ b/drivers/gpu/drm/panel/panel-simple.c
@@ -111,6 +111,10 @@  static int panel_simple_get_fixed_modes(struct panel_simple *panel)
 			continue;
 		}
 
+		mode->type |= DRM_MODE_TYPE_DRIVER;
+		if (panel->desc->num_modes == 1)
+			mode->type |= DRM_MODE_TYPE_PREFERRED;
+
 		drm_display_mode_from_videomode(&vm, mode);
 
 		drm_mode_probed_add(connector, mode);
@@ -127,6 +131,10 @@  static int panel_simple_get_fixed_modes(struct panel_simple *panel)
 			continue;
 		}
 
+		mode->type |= DRM_MODE_TYPE_DRIVER;
+		if (panel->desc->num_modes == 1)
+			mode->type |= DRM_MODE_TYPE_PREFERRED;
+
 		drm_mode_set_name(mode);
 
 		drm_mode_probed_add(connector, mode);