[PATCH v2 3/5] drm/modes: Allow to specify rotation and reflection on the commandline

Maxime Ripard maxime.ripard at bootlin.com
Wed Apr 17 14:30:29 UTC 2019


Hi Noralf,

On Tue, Apr 16, 2019 at 04:50:00PM +0200, Noralf Trønnes wrote:
> Den 11.04.2019 15.22, skrev Maxime Ripard:
> > Rotations and reflections setup are needed in some scenarios to initialise
> > properly the initial framebuffer. Some drivers already had a bunch of
> > quirks to deal with this, such as either a private kernel command line
> > parameter (omapdss) or on the device tree (various panels).
> >
> > In order to accomodate this, let's create a video mode parameter to deal
> > with the rotation and reflexion.
> >
> > Signed-off-by: Maxime Ripard <maxime.ripard at bootlin.com>
> > ---
> >  drivers/gpu/drm/drm_fb_helper.c |   4 +-
> >  drivers/gpu/drm/drm_modes.c     | 110 +++++++++++++++++++++++++++------
> >  include/drm/drm_connector.h     |   1 +-
> >  3 files changed, 95 insertions(+), 20 deletions(-)
> >
> > diff --git a/drivers/gpu/drm/drm_fb_helper.c b/drivers/gpu/drm/drm_fb_helper.c
> > index b3a5d79436ae..8781897559b2 100644
> > --- a/drivers/gpu/drm/drm_fb_helper.c
> > +++ b/drivers/gpu/drm/drm_fb_helper.c
> > @@ -2521,6 +2521,7 @@ static void drm_setup_crtc_rotation(struct drm_fb_helper *fb_helper,
> >  				    struct drm_connector *connector)
> >  {
> >  	struct drm_plane *plane = fb_crtc->mode_set.crtc->primary;
> > +	struct drm_cmdline_mode *mode = &connector->cmdline_mode;
> >  	uint64_t valid_mask = 0;
> >  	int i, rotation;
> >
> > @@ -2540,6 +2541,9 @@ static void drm_setup_crtc_rotation(struct drm_fb_helper *fb_helper,
> >  		rotation = DRM_MODE_ROTATE_0;
> >  	}
> >
> > +	if (mode->rotation != DRM_MODE_ROTATE_0)
> > +		fb_crtc->rotation = mode->rotation;
> > +
>
> We already have a property to describe initial display/panel rotation.
> If we can set connector->display_info.panel_orientation from the video=
> parameter, then there's no need to modify drm_fb_helper, it will just work.
>
> In that case, maybe 'orientation' is a better argument name with values
> mapped to the enum.

I wouldn't put it at the same level though. As far as I understand it,
the orientation is a hardware constraint: the hardware has been
designed that way, and should honor that orientation to make it look
with the top, well, on top.

However, the rotation is more of a user choice, and you could
definitely envision having a combination of a rotation and an
orientation constraint.

Maxime

--
Maxime Ripard, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 228 bytes
Desc: not available
URL: <https://lists.freedesktop.org/archives/dri-devel/attachments/20190417/a116e3bd/attachment.sig>


More information about the dri-devel mailing list