Message ID | 92e60e2aedee460f600eea91d2dafc801a52a9e3.1555591281.git-series.maxime.ripard@bootlin.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
Series | drm/vc4: Allow for more boot-time configuration | expand |
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@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@tronnes.org> > + struct { > + unsigned int left; > + unsigned int right; > + unsigned int top; > + unsigned int bottom; > + } tv_margins; > }; > > /** >
Den 18.04.2019 18.50, skrev Noralf Trønnes: > > > 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@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: > I discovered that the drm_mode_parse_command_line_for_connector() kernel doc has the parameters mentioned, so it also needs to be updated. > Reviewed-by: Noralf Trønnes <noralf@tronnes.org> > >> + struct { >> + unsigned int left; >> + unsigned int right; >> + unsigned int top; >> + unsigned int bottom; >> + } tv_margins; >> }; >> >> /** >> > _______________________________________________ > dri-devel mailing list > dri-devel@lists.freedesktop.org > https://lists.freedesktop.org/mailman/listinfo/dri-devel >
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 + */ + struct { + unsigned int left; + unsigned int right; + unsigned int top; + unsigned int bottom; + } tv_margins; }; /**
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@bootlin.com> --- drivers/gpu/drm/drm_modes.c | 44 ++++++++++++++++++++++++++++++++++++++- include/drm/drm_connector.h | 14 ++++++++++++- 2 files changed, 58 insertions(+)