From mboxrd@z Thu Jan 1 00:00:00 1970 From: Imre Deak Subject: Re: [Intel-gfx] [PATCH 6/9] drm: Add drm_rotation_simplify() Date: Mon, 14 Oct 2013 16:46:50 +0300 Message-ID: <1381758410.12668.60.camel@intelbox> References: <1380552272-32585-1-git-send-email-ville.syrjala@linux.intel.com> <1380552272-32585-7-git-send-email-ville.syrjala@linux.intel.com> Reply-To: imre.deak@intel.com Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="===============1629929096==" Return-path: In-Reply-To: <1380552272-32585-7-git-send-email-ville.syrjala@linux.intel.com> List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: dri-devel-bounces+sf-dri-devel=m.gmane.org@lists.freedesktop.org Errors-To: dri-devel-bounces+sf-dri-devel=m.gmane.org@lists.freedesktop.org To: ville.syrjala@linux.intel.com Cc: intel-gfx@lists.freedesktop.org, dri-devel@lists.freedesktop.org List-Id: intel-gfx@lists.freedesktop.org --===============1629929096== Content-Type: multipart/signed; micalg="pgp-sha1"; protocol="application/pgp-signature"; boundary="=-0OA6Ks2tSuJ1W8vSBLSD" --=-0OA6Ks2tSuJ1W8vSBLSD Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable On Mon, 2013-09-30 at 17:44 +0300, ville.syrjala@linux.intel.com wrote: > From: Ville Syrj=C3=A4l=C3=A4 >=20 > drm_rotation_simplify() can be used to eliminate unsupported rotation > flags. It will check if any unsupported flags are present, and if so > it will modify the rotation to an alternate form by adding 180 degrees > to rotation angle, and flipping the reflect x and y bits. The hope is > that this identity transform will eliminate the unsupported flags. >=20 > Of course that might not result in any more supported rotation, so > the caller is still responsible for checking the result afterwards. >=20 > Signed-off-by: Ville Syrj=C3=A4l=C3=A4 > --- > drivers/gpu/drm/drm_crtc.c | 30 ++++++++++++++++++++++++++++++ > include/drm/drm_crtc.h | 2 ++ > 2 files changed, 32 insertions(+) >=20 > diff --git a/drivers/gpu/drm/drm_crtc.c b/drivers/gpu/drm/drm_crtc.c > index 0218681..665b807 100644 > --- a/drivers/gpu/drm/drm_crtc.c > +++ b/drivers/gpu/drm/drm_crtc.c > @@ -3976,6 +3976,36 @@ int drm_format_vert_chroma_subsampling(uint32_t fo= rmat) > EXPORT_SYMBOL(drm_format_vert_chroma_subsampling); > =20 > /** > + * drm_rotation_simplify() - Try to simplify the rotation > + * @rotation: Rotation to be simplified > + * @supported_rotations: Supported rotations > + * > + * Attempt to simplify the rotation to a form that is supported. > + * Eg. if the hardware supports everything except DRM_REFLECT_X > + * one could call this function like this: > + * > + * drm_rotation_simplify(rotation, BIT(DRM_ROTATE_0) | > + * BIT(DRM_ROTATE_90) | BIT(DRM_ROTATE_180) | > + * BIT(DRM_ROTATE_270) | BIT(DRM_REFLECT_Y)); > + * > + * to eliminate the DRM_ROTATE_X flag. Depending on what kind of ^ DRM_REFLECT_X You don't use this function in your patchset, though intel_plane_set_property() could use it by accepting REFLECT_X|REFLECT_Y too. But it does what it says, so I'm also ok if you leave it unused for now. --Imre > + * transforms the hardware supports, this function may not > + * be able to produce a supported transform, so the caller should > + * check the result afterwards. > + */ > +unsigned int drm_rotation_simplify(unsigned int rotation, > + unsigned int supported_rotations) > +{ > + if (rotation & ~supported_rotations) { > + rotation ^=3D BIT(DRM_REFLECT_X) | BIT(DRM_REFLECT_Y); > + rotation =3D (rotation & ~0xf) | BIT((ffs(rotation & 0xf) + 1) % 4); > + } > + > + return rotation; > +} > +EXPORT_SYMBOL(drm_rotation_simplify); > + > +/** > * drm_mode_config_init - initialize DRM mode_configuration structure > * @dev: DRM device > * > diff --git a/include/drm/drm_crtc.h b/include/drm/drm_crtc.h > index d25ba84..b97b367 100644 > --- a/include/drm/drm_crtc.h > +++ b/include/drm/drm_crtc.h > @@ -1154,5 +1154,7 @@ extern int drm_format_vert_chroma_subsampling(uint3= 2_t format); > extern const char *drm_get_format_name(uint32_t format); > extern struct drm_property *drm_mode_create_rotation_property(struct drm= _device *dev, > unsigned int supported_rotations); > +extern unsigned int drm_rotation_simplify(unsigned int rotation, > + unsigned int supported_rotations); > =20 > #endif /* __DRM_CRTC_H__ */ --=-0OA6Ks2tSuJ1W8vSBLSD Content-Type: application/pgp-signature; name="signature.asc" Content-Description: This is a digitally signed message part Content-Transfer-Encoding: 7bit -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.12 (GNU/Linux) iQEcBAABAgAGBQJSW/XLAAoJEORIIAnNuWDFQMQH/iIZoaFLqdX32EVYkIoQ/5ZC QC7sB0HdF5JA03Z6ntb6y4ZdhJtuCh8ao9tWypXCS34uMjbfHxXGREdyxBHA62UE FsvIlZ3p6LI9XPIPP9Sdc7+xLsoAfBOMoPbDGonQmobPnb1jdso7nNkdygre3CUk DAPyAAsfb9ewORvPtvRyFBRy/xvxMvQnjxswliLMcdJdFjuTnNACm9BZ3zGNefgX l/SMUJ0wi4uZ6+4T9Ge/8QjkZAFbGOcgl4QlUz8qRgU3WwDZc0mSUD1u1x0AUlXi iKu3P+pf0mO8PLM0Vbpf1/GaiiY7XlAFRDO7OIdMdCd+JPuLA4Hy2/+9aPCH9CA= =7a9B -----END PGP SIGNATURE----- --=-0OA6Ks2tSuJ1W8vSBLSD-- --===============1629929096== Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline _______________________________________________ dri-devel mailing list dri-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/dri-devel --===============1629929096==--