]> git.baikalelectronics.ru Git - kernel.git/commitdiff
drm/modes: Parse overscan properties
authorMaxime Ripard <maxime.ripard@bootlin.com>
Wed, 19 Jun 2019 10:17:51 +0000 (12:17 +0200)
committerMaxime Ripard <maxime.ripard@bootlin.com>
Wed, 19 Jun 2019 10:17:51 +0000 (12:17 +0200)
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.

Reviewed-by: Noralf Trønnes <noralf@tronnes.org>
Signed-off-by: Maxime Ripard <maxime.ripard@bootlin.com>
Link: https://patchwork.freedesktop.org/patch/msgid/e481f1628e3768ca49226ec2115cfa4dfcbd5e4c.1560783090.git-series.maxime.ripard@bootlin.com
Documentation/fb/modedb.txt
drivers/gpu/drm/drm_modes.c
include/drm/drm_connector.h

index 52418c6dbfc45bc31cf552bf224fc563a3205b6c..1dd5a52f9390fe85dfeae72c2722fc3759939799 100644 (file)
@@ -57,6 +57,8 @@ Options can also be passed after the mode, using commas as separator.
 
 Valid options are:
 
+  - margin_top, margin_bottom, margin_left, margin_right (integer):
+    Number of pixels in the margins, typically to deal with overscan on TVs
   - reflect_x (boolean): Perform an axial symmetry on the X axis
   - reflect_y (boolean): Perform an axial symmetry on the Y axis
   - rotate (integer): Rotate the initial framebuffer by x
index dc6d112926851254b08635a5a9a226a559742e0a..57e6408288c80f6adb86c2b29b23a1b0e1829627 100644 (file)
@@ -1609,6 +1609,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;
                }
index b22e3150e33d1607ebf2da8d55221e76b2ebaa05..ca745d9feaf541949b44126408b0cc9626158fbf 100644 (file)
@@ -1054,6 +1054,11 @@ struct drm_cmdline_mode {
         * DRM_MODE_ROTATE_0 and DRM_MODE_ROTATE_180.
         */
        unsigned int rotation_reflection;
+
+       /**
+        * @tv_margins: TV margins to apply to the mode.
+        */
+       struct drm_connector_tv_margins tv_margins;
 };
 
 /**