drm/modes: Make sure to parse valid rotation value from cmdline
authorStephan Gerhold <stephan@gerhold.net>
Fri, 17 Jan 2020 15:34:28 +0000 (16:34 +0100)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 12 Mar 2020 12:00:11 +0000 (13:00 +0100)
commit9a426889f435b6a40b71bb4477ec13764e63c723
treed78655b9ca57dc1b25136cec939db7166df61ba6
parent85c17bb5bf0f1c2772e99e900f622c78831d8269
drm/modes: Make sure to parse valid rotation value from cmdline

[ Upstream commit e6980a727154b793adb218fbc7b4d6af52a7e364 ]

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
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/gpu/drm/drm_modes.c
drivers/gpu/drm/selftests/drm_cmdline_selftests.h
drivers/gpu/drm/selftests/test-drm_cmdline_parser.c