brcm63xx: rename target to bcm63xx
[openwrt/openwrt.git] / target / linux / brcm2708 / patches-4.19 / 950-0643-drm-modes-Parse-overscan-properties.patch
1 From 99b367ee521e48beae92bea59515dd0f08f2e55b Mon Sep 17 00:00:00 2001
2 From: Maxime Ripard <maxime.ripard@bootlin.com>
3 Date: Wed, 19 Jun 2019 12:17:51 +0200
4 Subject: [PATCH] drm/modes: Parse overscan properties
5 MIME-Version: 1.0
6 Content-Type: text/plain; charset=UTF-8
7 Content-Transfer-Encoding: 8bit
8
9 Commit 3d46a3007cd8f73bae502bf5c171977b91d7aacc upstream.
10
11 Properly configuring the overscan properties might be needed for the
12 initial setup of the framebuffer for display that still have overscan.
13 Let's allow for more properties on the kernel command line to setup each
14 margin.
15
16 Reviewed-by: Noralf Trønnes <noralf@tronnes.org>
17 Signed-off-by: Maxime Ripard <maxime.ripard@bootlin.com>
18 Link: https://patchwork.freedesktop.org/patch/msgid/e481f1628e3768ca49226ec2115cfa4dfcbd5e4c.1560783090.git-series.maxime.ripard@bootlin.com
19 ---
20 Documentation/fb/modedb.txt | 2 ++
21 drivers/gpu/drm/drm_modes.c | 44 +++++++++++++++++++++++++++++++++++++
22 include/drm/drm_connector.h | 5 +++++
23 3 files changed, 51 insertions(+)
24
25 --- a/Documentation/fb/modedb.txt
26 +++ b/Documentation/fb/modedb.txt
27 @@ -57,6 +57,8 @@ Options can also be passed after the mod
28
29 Valid options are:
30
31 + - margin_top, margin_bottom, margin_left, margin_right (integer):
32 + Number of pixels in the margins, typically to deal with overscan on TVs
33 - reflect_x (boolean): Perform an axial symmetry on the X axis
34 - reflect_y (boolean): Perform an axial symmetry on the Y axis
35 - rotate (integer): Rotate the initial framebuffer by x
36 --- a/drivers/gpu/drm/drm_modes.c
37 +++ b/drivers/gpu/drm/drm_modes.c
38 @@ -1615,6 +1615,50 @@ static int drm_mode_parse_cmdline_option
39 } else if (!strncmp(option, "reflect_y", delim - option)) {
40 rotation |= DRM_MODE_REFLECT_Y;
41 sep = delim;
42 + } else if (!strncmp(option, "margin_right", delim - option)) {
43 + const char *value = delim + 1;
44 + unsigned int margin;
45 +
46 + margin = simple_strtol(value, &sep, 10);
47 +
48 + /* Make sure we have parsed something */
49 + if (sep == value)
50 + return -EINVAL;
51 +
52 + mode->tv_margins.right = margin;
53 + } else if (!strncmp(option, "margin_left", delim - option)) {
54 + const char *value = delim + 1;
55 + unsigned int margin;
56 +
57 + margin = simple_strtol(value, &sep, 10);
58 +
59 + /* Make sure we have parsed something */
60 + if (sep == value)
61 + return -EINVAL;
62 +
63 + mode->tv_margins.left = margin;
64 + } else if (!strncmp(option, "margin_top", delim - option)) {
65 + const char *value = delim + 1;
66 + unsigned int margin;
67 +
68 + margin = simple_strtol(value, &sep, 10);
69 +
70 + /* Make sure we have parsed something */
71 + if (sep == value)
72 + return -EINVAL;
73 +
74 + mode->tv_margins.top = margin;
75 + } else if (!strncmp(option, "margin_bottom", delim - option)) {
76 + const char *value = delim + 1;
77 + unsigned int margin;
78 +
79 + margin = simple_strtol(value, &sep, 10);
80 +
81 + /* Make sure we have parsed something */
82 + if (sep == value)
83 + return -EINVAL;
84 +
85 + mode->tv_margins.bottom = margin;
86 } else {
87 return -EINVAL;
88 }
89 --- a/include/drm/drm_connector.h
90 +++ b/include/drm/drm_connector.h
91 @@ -886,6 +886,11 @@ struct drm_cmdline_mode {
92 * DRM_MODE_ROTATE_0 and DRM_MODE_ROTATE_180.
93 */
94 unsigned int rotation_reflection;
95 +
96 + /**
97 + * @tv_margins: TV margins to apply to the mode.
98 + */
99 + struct drm_connector_tv_margins tv_margins;
100 };
101
102 /**