mbox series

[v3,0/2] drm/modes: Apply video parameters with only reflect option

Message ID 20200117153429.54700-1-stephan@gerhold.net (mailing list archive)
Headers show
Series drm/modes: Apply video parameters with only reflect option | expand

Message

Stephan Gerhold Jan. 17, 2020, 3:34 p.m. UTC
At the moment, video mode parameters like video=540x960,reflect_x,
(without rotation set) are not taken into account when applying the
mode in drm_client_modeset.c.

One of the reasons for this is that the calculation that
combines the panel_orientation with cmdline->rotation_reflection
does not handle the case when cmdline->rotation_reflection does
not have any rotation set.
(i.e. cmdline->rotation_reflection & DRM_MODE_ROTATE_MASK == 0)

However, we really should not generate such a value in the first place.
Rotation values should have exactly one rotation angle set
(DRM_MODE_ROTATE_0 for "no rotation").

This patch set changes the command line parser to make sure that we generate
only valid rotation values (defaulting to DRM_MODE_ROTATE_0).

Finally it allows DRM_MODE_ROTATE_0 when applying the rotation from
the video mode parameters to make parameters without rotation work correctly.


Changes in v3:
  - Fix the cmdline parser to generate only valid rotation values instead.
    (There should be exactly one rotation angle in a rotation value.)
  - Removed most of the original patch - combining the rotations works correctly
    if we only have valid rotation values

v2: https://lore.kernel.org/dri-devel/20191216171017.173326-1-stephan@gerhold.net/
  - Clarified commit message - parameters are parsed correctly,
    but not taken into account when applying the mode.
v1: https://lore.kernel.org/dri-devel/20191209183254.211428-1-stephan@gerhold.net/


Stephan Gerhold (2):
  drm/modes: Make sure to parse valid rotation value from cmdline
  drm/modes: Allow DRM_MODE_ROTATE_0 when applying video mode parameters

 drivers/gpu/drm/drm_client_modeset.c              |  3 ++-
 drivers/gpu/drm/drm_modes.c                       |  7 +++++++
 drivers/gpu/drm/selftests/drm_cmdline_selftests.h |  1 +
 .../gpu/drm/selftests/test-drm_cmdline_parser.c   | 15 +++++++++++++--
 4 files changed, 23 insertions(+), 3 deletions(-)

Comments

Maxime Ripard Jan. 17, 2020, 6:51 p.m. UTC | #1
On Fri, Jan 17, 2020 at 04:34:27PM +0100, Stephan Gerhold wrote:
> At the moment, video mode parameters like video=540x960,reflect_x,
> (without rotation set) are not taken into account when applying the
> mode in drm_client_modeset.c.
>
> One of the reasons for this is that the calculation that
> combines the panel_orientation with cmdline->rotation_reflection
> does not handle the case when cmdline->rotation_reflection does
> not have any rotation set.
> (i.e. cmdline->rotation_reflection & DRM_MODE_ROTATE_MASK == 0)
>
> However, we really should not generate such a value in the first place.
> Rotation values should have exactly one rotation angle set
> (DRM_MODE_ROTATE_0 for "no rotation").
>
> This patch set changes the command line parser to make sure that we generate
> only valid rotation values (defaulting to DRM_MODE_ROTATE_0).
>
> Finally it allows DRM_MODE_ROTATE_0 when applying the rotation from
> the video mode parameters to make parameters without rotation work correctly.

For both,
Acked-by: Maxime Ripard <mripard@kernel.org>

Thanks!
Maxime
Stephan Gerhold Feb. 12, 2020, 3:29 p.m. UTC | #2
Hi Maxime,

On Fri, Jan 17, 2020 at 07:51:00PM +0100, Maxime Ripard wrote:
> On Fri, Jan 17, 2020 at 04:34:27PM +0100, Stephan Gerhold wrote:
> > At the moment, video mode parameters like video=540x960,reflect_x,
> > (without rotation set) are not taken into account when applying the
> > mode in drm_client_modeset.c.
> >
> > One of the reasons for this is that the calculation that
> > combines the panel_orientation with cmdline->rotation_reflection
> > does not handle the case when cmdline->rotation_reflection does
> > not have any rotation set.
> > (i.e. cmdline->rotation_reflection & DRM_MODE_ROTATE_MASK == 0)
> >
> > However, we really should not generate such a value in the first place.
> > Rotation values should have exactly one rotation angle set
> > (DRM_MODE_ROTATE_0 for "no rotation").
> >
> > This patch set changes the command line parser to make sure that we generate
> > only valid rotation values (defaulting to DRM_MODE_ROTATE_0).
> >
> > Finally it allows DRM_MODE_ROTATE_0 when applying the rotation from
> > the video mode parameters to make parameters without rotation work correctly.
> 
> For both,
> Acked-by: Maxime Ripard <mripard@kernel.org>

Can you apply these two patches for me?
This is my second contribution to the DRM subsystem, so I don't have
commit access to drm-misc yet.

Thanks,
Stephan
Maxime Ripard Feb. 12, 2020, 5:33 p.m. UTC | #3
On Wed, Feb 12, 2020 at 04:29:48PM +0100, Stephan Gerhold wrote:
> Hi Maxime,
>
> On Fri, Jan 17, 2020 at 07:51:00PM +0100, Maxime Ripard wrote:
> > On Fri, Jan 17, 2020 at 04:34:27PM +0100, Stephan Gerhold wrote:
> > > At the moment, video mode parameters like video=540x960,reflect_x,
> > > (without rotation set) are not taken into account when applying the
> > > mode in drm_client_modeset.c.
> > >
> > > One of the reasons for this is that the calculation that
> > > combines the panel_orientation with cmdline->rotation_reflection
> > > does not handle the case when cmdline->rotation_reflection does
> > > not have any rotation set.
> > > (i.e. cmdline->rotation_reflection & DRM_MODE_ROTATE_MASK == 0)
> > >
> > > However, we really should not generate such a value in the first place.
> > > Rotation values should have exactly one rotation angle set
> > > (DRM_MODE_ROTATE_0 for "no rotation").
> > >
> > > This patch set changes the command line parser to make sure that we generate
> > > only valid rotation values (defaulting to DRM_MODE_ROTATE_0).
> > >
> > > Finally it allows DRM_MODE_ROTATE_0 when applying the rotation from
> > > the video mode parameters to make parameters without rotation work correctly.
> >
> > For both,
> > Acked-by: Maxime Ripard <mripard@kernel.org>
>
> Can you apply these two patches for me?
> This is my second contribution to the DRM subsystem, so I don't have
> commit access to drm-misc yet.

Applied both, thanks!
Maxime