diff mbox series

[v4,03/12] drm/client: Restrict the rotation check to the rotation itself

Message ID 4b1a140ab66dc31571e07c0881f9d9dc6397f403.1560514379.git-series.maxime.ripard@bootlin.com (mailing list archive)
State New, archived
Headers show
Series drm/vc4: Allow for more boot-time configuration | expand

Commit Message

Maxime Ripard June 14, 2019, 12:13 p.m. UTC
The drm_client_rotation has a check on the rotation value, but the
reflections are also stored in the same variable, and the check doesn't
take this into account.

Therefore, even though we might have a valid rotation, if we're also using
a reflection parameter, the test will fail for no particular reason.

Signed-off-by: Maxime Ripard <maxime.ripard@bootlin.com>
---
 drivers/gpu/drm/drm_client_modeset.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

Comments

Noralf Trønnes June 15, 2019, 8:59 a.m. UTC | #1
Den 14.06.2019 14.13, skrev Maxime Ripard:
> The drm_client_rotation has a check on the rotation value, but the
> reflections are also stored in the same variable, and the check doesn't
> take this into account.
> 
> Therefore, even though we might have a valid rotation, if we're also using
> a reflection parameter, the test will fail for no particular reason.
> 
> Signed-off-by: Maxime Ripard <maxime.ripard@bootlin.com>
> ---

Reviewed-by: Noralf Trønnes <noralf@tronnes.org>
diff mbox series

Patch

diff --git a/drivers/gpu/drm/drm_client_modeset.c b/drivers/gpu/drm/drm_client_modeset.c
index 8264c3a732b0..b4e5fb0a17cf 100644
--- a/drivers/gpu/drm/drm_client_modeset.c
+++ b/drivers/gpu/drm/drm_client_modeset.c
@@ -845,7 +845,8 @@  bool drm_client_panel_rotation(struct drm_mode_set *modeset, unsigned int *rotat
 	 * depending on the hardware this may require the framebuffer
 	 * to be in a specific tiling format.
 	 */
-	if (*rotation != DRM_MODE_ROTATE_180 || !plane->rotation_property)
+	if ((*rotation & DRM_MODE_ROTATE_MASK) != DRM_MODE_ROTATE_180 ||
+	    !plane->rotation_property)
 		return false;
 
 	for (i = 0; i < plane->rotation_property->num_values; i++)