[PATCH v3 4/6] drm/modes: Parse overscan properties

Noralf Trønnes noralf at tronnes.org
Thu Apr 18 16:50:09 UTC 2019



Den 18.04.2019 14.41, skrev Maxime Ripard:
> Properly configuring the overscan properties might be needed for the
> initial setup of the framebuffer for display that still have overscan.
> Let's allow for more properties on the kernel command line to setup each
> margin.
> 
> Signed-off-by: Maxime Ripard <maxime.ripard at bootlin.com>
> ---
>  drivers/gpu/drm/drm_modes.c | 44 ++++++++++++++++++++++++++++++++++++++-
>  include/drm/drm_connector.h | 14 ++++++++++++-
>  2 files changed, 58 insertions(+)
> 
> diff --git a/drivers/gpu/drm/drm_modes.c b/drivers/gpu/drm/drm_modes.c
> index ac8d70b92b62..d93c44a97ce9 100644
> --- a/drivers/gpu/drm/drm_modes.c
> +++ b/drivers/gpu/drm/drm_modes.c
> @@ -1586,6 +1586,50 @@ static int drm_mode_parse_cmdline_options(char *str, size_t len,
>  		} else if (!strncmp(option, "reflect_y", delim - option)) {
>  			rotation |= DRM_MODE_REFLECT_Y;
>  			sep = delim;
> +		} else if (!strncmp(option, "margin_right", delim - option)) {
> +			const char *value = delim + 1;
> +			unsigned int margin;
> +
> +			margin = simple_strtol(value, &sep, 10);
> +
> +			/* Make sure we have parsed something */
> +			if (sep == value)
> +				return -EINVAL;
> +
> +			mode->tv_margins.right = margin;
> +		} else if (!strncmp(option, "margin_left", delim - option)) {
> +			const char *value = delim + 1;
> +			unsigned int margin;
> +
> +			margin = simple_strtol(value, &sep, 10);
> +
> +			/* Make sure we have parsed something */
> +			if (sep == value)
> +				return -EINVAL;
> +
> +			mode->tv_margins.left = margin;
> +		} else if (!strncmp(option, "margin_top", delim - option)) {
> +			const char *value = delim + 1;
> +			unsigned int margin;
> +
> +			margin = simple_strtol(value, &sep, 10);
> +
> +			/* Make sure we have parsed something */
> +			if (sep == value)
> +				return -EINVAL;
> +
> +			mode->tv_margins.top = margin;
> +		} else if (!strncmp(option, "margin_bottom", delim - option)) {
> +			const char *value = delim + 1;
> +			unsigned int margin;
> +
> +			margin = simple_strtol(value, &sep, 10);
> +
> +			/* Make sure we have parsed something */
> +			if (sep == value)
> +				return -EINVAL;
> +
> +			mode->tv_margins.bottom = margin;
>  		} else {
>  			return -EINVAL;
>  		}
> diff --git a/include/drm/drm_connector.h b/include/drm/drm_connector.h
> index 6f57c1a3afff..89bc6ac38043 100644
> --- a/include/drm/drm_connector.h
> +++ b/include/drm/drm_connector.h
> @@ -917,6 +917,20 @@ struct drm_cmdline_mode {
>  	 * DRM_MODE_ROTATE_180 are supported at the moment.
>  	 */
>  	unsigned int rotation;
> +
> +	/**
> +	 * @tv_margins: TV margins (in pixels)
> +	 * @tv_margins.left: left margin
> +	 * @tv_margins.right: right margin
> +	 * @tv_margins.top: top margin
> +	 * @tv_margins.bottom: bottom margin
> +	 */

I haven't seen kernel docs like this before so I assume you have tested
with make htmldocs.

This one also needs mention in Documentation/fb/modedb.txt. With that:

Reviewed-by: Noralf Trønnes <noralf at tronnes.org>

> +	struct {
> +		unsigned int left;
> +		unsigned int right;
> +		unsigned int top;
> +		unsigned int bottom;
> +	} tv_margins;
>  };
>  
>  /**
> 


More information about the dri-devel mailing list