Skip to content

Commit cc6e6be

Browse files
mripardPhil Elwell
authored andcommitted
drm/modes: Parse overscan properties
Commit 3d46a30 upstream. 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
1 parent fe3ebae commit cc6e6be

3 files changed

Lines changed: 51 additions & 0 deletions

File tree

‎Documentation/fb/modedb.txt‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,8 @@ Options can also be passed after the mode, using commas as separator.
5757

5858
Valid options are:
5959

60+
- margin_top, margin_bottom, margin_left, margin_right (integer):
61+
Number of pixels in the margins, typically to deal with overscan on TVs
6062
- reflect_x (boolean): Perform an axial symmetry on the X axis
6163
- reflect_y (boolean): Perform an axial symmetry on the Y axis
6264
- rotate (integer): Rotate the initial framebuffer by x

‎drivers/gpu/drm/drm_modes.c‎

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1606,6 +1606,50 @@ static int drm_mode_parse_cmdline_options(char *str, size_t len,
16061606
} else if (!strncmp(option, "reflect_y", delim - option)) {
16071607
rotation |= DRM_MODE_REFLECT_Y;
16081608
sep = delim;
1609+
} else if (!strncmp(option, "margin_right", delim - option)) {
1610+
const char *value = delim + 1;
1611+
unsigned int margin;
1612+
1613+
margin = simple_strtol(value, &sep, 10);
1614+
1615+
/* Make sure we have parsed something */
1616+
if (sep == value)
1617+
return -EINVAL;
1618+
1619+
mode->tv_margins.right = margin;
1620+
} else if (!strncmp(option, "margin_left", delim - option)) {
1621+
const char *value = delim + 1;
1622+
unsigned int margin;
1623+
1624+
margin = simple_strtol(value, &sep, 10);
1625+
1626+
/* Make sure we have parsed something */
1627+
if (sep == value)
1628+
return -EINVAL;
1629+
1630+
mode->tv_margins.left = margin;
1631+
} else if (!strncmp(option, "margin_top", delim - option)) {
1632+
const char *value = delim + 1;
1633+
unsigned int margin;
1634+
1635+
margin = simple_strtol(value, &sep, 10);
1636+
1637+
/* Make sure we have parsed something */
1638+
if (sep == value)
1639+
return -EINVAL;
1640+
1641+
mode->tv_margins.top = margin;
1642+
} else if (!strncmp(option, "margin_bottom", delim - option)) {
1643+
const char *value = delim + 1;
1644+
unsigned int margin;
1645+
1646+
margin = simple_strtol(value, &sep, 10);
1647+
1648+
/* Make sure we have parsed something */
1649+
if (sep == value)
1650+
return -EINVAL;
1651+
1652+
mode->tv_margins.bottom = margin;
16091653
} else {
16101654
return -EINVAL;
16111655
}

‎include/drm/drm_connector.h‎

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1025,6 +1025,11 @@ struct drm_cmdline_mode {
10251025
* DRM_MODE_ROTATE_0 and DRM_MODE_ROTATE_180.
10261026
*/
10271027
unsigned int rotation_reflection;
1028+
1029+
/**
1030+
* @tv_margins: TV margins to apply to the mode.
1031+
*/
1032+
struct drm_connector_tv_margins tv_margins;
10281033
};
10291034

10301035
/**

0 commit comments

Comments
 (0)