mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/herbert/cryptodev-2.6.git
synced 2026-04-21 04:53:46 -04:00
drm/modes: Make sure to parse valid rotation value from cmdline
A rotation value should have exactly one rotation angle.
At the moment there is no validation for this when parsing video=
parameters from the command line. This causes problems later on
when we try to combine the command line rotation with the panel
orientation.
To make sure that we generate a valid rotation value:
- Set DRM_MODE_ROTATE_0 by default (if no rotate= option is set)
- Validate that there is exactly one rotation angle set
(i.e. specifying the rotate= option multiple times is invalid)
Signed-off-by: Stephan Gerhold <stephan@gerhold.net>
Signed-off-by: Maxime Ripard <maxime@cerno.tech>
Link: https://patchwork.freedesktop.org/patch/msgid/20200117153429.54700-2-stephan@gerhold.net
This commit is contained in:
committed by
Maxime Ripard
parent
b50f4f940b
commit
e6980a7271
@@ -53,6 +53,7 @@ cmdline_test(drm_cmdline_test_rotate_0)
|
||||
cmdline_test(drm_cmdline_test_rotate_90)
|
||||
cmdline_test(drm_cmdline_test_rotate_180)
|
||||
cmdline_test(drm_cmdline_test_rotate_270)
|
||||
cmdline_test(drm_cmdline_test_rotate_multiple)
|
||||
cmdline_test(drm_cmdline_test_rotate_invalid_val)
|
||||
cmdline_test(drm_cmdline_test_rotate_truncated)
|
||||
cmdline_test(drm_cmdline_test_hmirror)
|
||||
|
||||
@@ -856,6 +856,17 @@ static int drm_cmdline_test_rotate_270(void *ignored)
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int drm_cmdline_test_rotate_multiple(void *ignored)
|
||||
{
|
||||
struct drm_cmdline_mode mode = { };
|
||||
|
||||
FAIL_ON(drm_mode_parse_command_line_for_connector("720x480,rotate=0,rotate=90",
|
||||
&no_connector,
|
||||
&mode));
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int drm_cmdline_test_rotate_invalid_val(void *ignored)
|
||||
{
|
||||
struct drm_cmdline_mode mode = { };
|
||||
@@ -888,7 +899,7 @@ static int drm_cmdline_test_hmirror(void *ignored)
|
||||
FAIL_ON(!mode.specified);
|
||||
FAIL_ON(mode.xres != 720);
|
||||
FAIL_ON(mode.yres != 480);
|
||||
FAIL_ON(mode.rotation_reflection != DRM_MODE_REFLECT_X);
|
||||
FAIL_ON(mode.rotation_reflection != (DRM_MODE_ROTATE_0 | DRM_MODE_REFLECT_X));
|
||||
|
||||
FAIL_ON(mode.refresh_specified);
|
||||
|
||||
@@ -913,7 +924,7 @@ static int drm_cmdline_test_vmirror(void *ignored)
|
||||
FAIL_ON(!mode.specified);
|
||||
FAIL_ON(mode.xres != 720);
|
||||
FAIL_ON(mode.yres != 480);
|
||||
FAIL_ON(mode.rotation_reflection != DRM_MODE_REFLECT_Y);
|
||||
FAIL_ON(mode.rotation_reflection != (DRM_MODE_ROTATE_0 | DRM_MODE_REFLECT_Y));
|
||||
|
||||
FAIL_ON(mode.refresh_specified);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user