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

Jani Nikula jani.nikula at linux.intel.com
Wed Jun 12 08:11:30 UTC 2019


On Tue, 11 Jun 2019, Maxime Ripard <maxime.ripard at bootlin.com> wrote:
> Hi Noralf,
>
> On Fri, Apr 19, 2019 at 10:53:28AM +0200, Noralf Trønnes wrote:
>> Den 18.04.2019 18.40, skrev Noralf Trønnes:
>> >
>> >
>> > Den 18.04.2019 14.41, 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_client_modeset.c |  10 +++-
>> >>  drivers/gpu/drm/drm_modes.c          | 110 ++++++++++++++++++++++------
>> >>  include/drm/drm_connector.h          |   9 ++-
>> >>  3 files changed, 109 insertions(+), 20 deletions(-)
>> >>
>> >> diff --git a/drivers/gpu/drm/drm_client_modeset.c b/drivers/gpu/drm/drm_client_modeset.c
>> >> index f2869c82510c..15145d2c86d5 100644
>> >> --- a/drivers/gpu/drm/drm_client_modeset.c
>> >> +++ b/drivers/gpu/drm/drm_client_modeset.c
>> >> @@ -823,6 +823,7 @@ EXPORT_SYMBOL(drm_client_modeset_probe);
>> >>  bool drm_client_panel_rotation(struct drm_mode_set *modeset, unsigned int *rotation)
>> >>  {
>> >>  	struct drm_connector *connector = modeset->connectors[0];
>> >> +	struct drm_cmdline_mode *cmdline;
>> >>  	struct drm_plane *plane = modeset->crtc->primary;
>> >>  	u64 valid_mask = 0;
>> >>  	unsigned int i;
>> >> @@ -844,6 +845,15 @@ bool drm_client_panel_rotation(struct drm_mode_set *modeset, unsigned int *rotat
>> >>  		*rotation = DRM_MODE_ROTATE_0;
>> >>  	}
>> >>
>> >> +	/**
>> >> +	 * We want the rotation on the command line to overwrite
>> >> +	 * whatever comes from the panel.
>> >> +	 */
>> >> +	cmdline = &connector->cmdline_mode;
>> >> +	if (cmdline->specified &&
>> >> +	    cmdline->rotation != DRM_MODE_ROTATE_0)
>> >
>> > I believe you need to drop that second check, otherwise rotate=0 will
>> > not overwrite panel rotation.
>> >
>> >> +		*rotation = cmdline->rotation;
>>
>> I remembered that you wanted this to propagate to DRM userspace. That's
>> not happening here.
>
> It's propated to the userspace through the plane's rotation property,
> I just checked.
>
>> The only way I see for that to happen, is to set
>> ->panel_orientation. And to repeat myself, imo that makes
>> 'orientation' a better name for this video= option.
>
> orientation and rotation are two different things to me. The
> orientation of a panel for example is absolute, while the rotation is
> a transformation. In this particular case, I think that both the
> orientation and the rotation should be taken into account, with the
> orientation being the default state, and the hardware / panel will
> tell us that, while the rotation would be a transformation from that
> default to whatever the user wants.
>
> More importantly, the orientation is a property of the hardware (ie,
> how the display has been assembled), while the rotation is a software
> construct.

FWIW, agreed. The immutable orientation property is exposed using the
drm_connector_init_panel_orientation_property() call. You then rotate to
take the orientation into account, to not display stuff sideways or
upside down wrt the natural orientation of the device.

BR,
Jani.

>
> And if the property being used to expose that is the rotation, I guess
> it would make sense to just use the same name and remain consistent.
>
> Maxime
>
> --
> Maxime Ripard, Bootlin
> Embedded Linux and Kernel engineering
> https://bootlin.com
> _______________________________________________
> dri-devel mailing list
> dri-devel at lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/dri-devel

-- 
Jani Nikula, Intel Open Source Graphics Center


More information about the dri-devel mailing list