From: Eric Anholt Subject: Re: [PATCH 2/2] drm/i915: Deal with upside-down mounted LCD panels Date: Mon, 08 May 2017 09:25:40 -0700 Message-ID: <8760hb2u4b.fsf@eliezer.anholt.net> References: <20170507091056.3406-1-hdegoede@redhat.com> <20170507091056.3406-2-hdegoede@redhat.com> <20170508122729.GB7978@nuc-i3427.alporthouse.com> <773e8aa0-c4b1-2041-215a-8be668cf7c27@redhat.com> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="===============0381325366==" Return-path: In-Reply-To: <773e8aa0-c4b1-2041-215a-8be668cf7c27@redhat.com> List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: intel-gfx-bounces@lists.freedesktop.org Sender: "Intel-gfx" To: Hans de Goede , Chris Wilson , Daniel Vetter , Jani Nikula , Ville =?utf-8?B?U3lyasOkbMOk?= , intel-gfx , dri-devel@lists.freedesktop.org, Bastien Nocera List-Id: dri-devel@lists.freedesktop.org --===============0381325366== Content-Type: multipart/signed; boundary="=-=-="; micalg=pgp-sha512; protocol="application/pgp-signature" --=-=-= Content-Type: text/plain Content-Transfer-Encoding: quoted-printable Hans de Goede writes: > HI, > > On 08-05-17 14:27, Chris Wilson wrote: >> On Sun, May 07, 2017 at 11:10:56AM +0200, Hans de Goede wrote: >>> On some (Bay Trail) devices the LCD panel is mounted upside-down. >>> >>> This commit uses the code to read back the initial rotation of the >>> primary plane in get_initial_plane_config from Ville Syrjala's >>> "drm/fb-helper: Inherit rotation wip" patch and when re-using the >>> initial fb it stores that in intel_crtc.initial_rotation. >>> >>> It adds an intel_plane_get_rotation helper which combines this >>> initial_rotation with any rotation requested by userspace and >>> uses this in all places which look at a planes rotation, thus >>> transparently dealing with upside-down LCD panels without requiring >>> any user-space or fbcon changes. >>> >>> This fixes the kernel boot messages switching from being shown the right >>> way up in efifb to being shown upside down as soon as a native kms driv= er >>> loads, as well as any graphics displayed by userspace being upside-down. >>> >>> Note this only deals with upside-down LCD panels / 180 degrees >>> rotation as the hardware in question only supports 180 degrees >>> rotation in hardware. The one model known which has a panel mounted >>> with 90/270 degrees rotation will need to be fully dealt with in >>> userspace, even the firmware boot screen / menus are rotated 90 degrees >>> on this one and there simply is nothing the kernel can do about this. >>=20 >> I shall just mention a concern with hiding the transformation on the >> connection, we do expose the subpixel layout to userspace and that >> should be adjusted based on this lie. There are probably other places >> where the orientation of the output leaks through the current interface. >>=20 >> The commit message fails to explain how userspace, which should already >> have the tools available to it, is unable to reapply the existing >> rotation - i.e. why this is a kernel problem, > > This is a kernel problem because one of the things the kernel does > is hardware abstraction, as I mentioned in my reply to Ville, there is > not single userspace to fix here, there is a large supply of userspace > consumers of the kms API which need fixing to fix this in userspace. > > For touchscreens which are mounted with a wrong orientation the > input layer fixes things up, I don't see how this is any different > really. Now if it was impossible or very complicated to fix this > in the kernel that would be a different story, but as this patch > shows it is quite doable to fix this in the kernel. FWIW, Raspberry Pi has a similar problem: The panel has an appropriate orientation due to its viewing angle, but the cabling is such that many people mount it upside down and use a firmware configuration to have everything flipped. It would be nice if I could do readback of the panel's orientation reg (I haven't tested) and retain automatically that after boot, as a default policy. --=-=-= Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQIzBAEBCgAdFiEE/JuuFDWp9/ZkuCBXtdYpNtH8nugFAlkQnAQACgkQtdYpNtH8 nuhlXBAAhe7PrFskYm9oPN6GzMxBO1oJ/+jCv3JLfJoWEOsFLz48KJO3T9+9wr96 tNAMTXmZfpmYhjca4GxbHNlpx5qatE5KOaxHAb2xopBwAFF1SXQ4RukVzh2dUmVZ XclDIcwFzN6AWTPHTT9pXSIIe7h5qKq3myHMlggkjtZXBwXRXH/nr2br0XsFRzFI B2TI2zIHwDb3Fuzd0raVCCWWC+w6s9tvNdVyn2z0j5wovkGXTvyNgk45j/+PRMc2 LzgupHwvoHT2MV/t+8fZVv7vBBbhxFVZ2LFx/4XVlhFstBBXtSDi18C6rjuvn84+ UdB+2H8wFohhKPrk+N8vuWePE5agCYtVbfM3ErnIl9KAg2KMlQTwJVH26RT0oGX+ WnVuXmtEc0HLmGCXHq4BFE1EGci08GXH+d4tP90KfM0A6pHvrL7Lugyc0SPsTrUo i3yVIq4QJ3FCFOJywMNSnmkA6EFarfJMzA8/5+QSHHfhf2T2RDMmivQNxsLCyHYi IgJVVAwNI8Fk9BlK57io1VWCxnQgJulldi4oRXsLvRmCFniueOQ5EtaMhI/L8NWD RVaudpb40GyCe89dZoF/WT+oO++5An4kG79eqQNI0JdxGcGZrxttA6HkU7vSGsO3 Vhr61RrJ3wLxZrUUmdGPoRjYOrOPdtkXyNBOUz/UahbMPToaEhI= =55Ic -----END PGP SIGNATURE----- --=-=-=-- --===============0381325366== Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: base64 Content-Disposition: inline X19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX18KSW50ZWwtZ2Z4 IG1haWxpbmcgbGlzdApJbnRlbC1nZnhAbGlzdHMuZnJlZWRlc2t0b3Aub3JnCmh0dHBzOi8vbGlz dHMuZnJlZWRlc2t0b3Aub3JnL21haWxtYW4vbGlzdGluZm8vaW50ZWwtZ2Z4Cg== --===============0381325366==--