From mboxrd@z Thu Jan 1 00:00:00 1970 From: Imre Deak Subject: Re: [PATCH 9/9] drm/i915: Add rotation property for sprites Date: Mon, 14 Oct 2013 16:59:13 +0300 Message-ID: <1381759153.12668.67.camel@intelbox> References: <1380552272-32585-1-git-send-email-ville.syrjala@linux.intel.com> <1380552272-32585-10-git-send-email-ville.syrjala@linux.intel.com> Reply-To: imre.deak@intel.com Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="===============1014993156==" Return-path: In-Reply-To: <1380552272-32585-10-git-send-email-ville.syrjala@linux.intel.com> List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: intel-gfx-bounces+gcfxdi-intel-gfx=m.gmane.org@lists.freedesktop.org Errors-To: intel-gfx-bounces+gcfxdi-intel-gfx=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 --===============1014993156== Content-Type: multipart/signed; micalg="pgp-sha1"; protocol="application/pgp-signature"; boundary="=-x8ffHG0jnUcsXkaD/z6K" --=-x8ffHG0jnUcsXkaD/z6K 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 > Sprite planes support 180 degree rotation. The lower layers are now in > place, so hook in the standard rotation property to expose the feature > to the users. >=20 > Signed-off-by: Ville Syrj=C3=A4l=C3=A4 > --- > drivers/gpu/drm/i915/i915_drv.h | 1 + > drivers/gpu/drm/i915/intel_sprite.c | 42 +++++++++++++++++++++++++++++++= +++++- > 2 files changed, 42 insertions(+), 1 deletion(-) >=20 > diff --git a/drivers/gpu/drm/i915/i915_drv.h b/drivers/gpu/drm/i915/i915_= drv.h > index 08e96a8..48d4d5f 100644 > --- a/drivers/gpu/drm/i915/i915_drv.h > +++ b/drivers/gpu/drm/i915/i915_drv.h > @@ -1356,6 +1356,7 @@ typedef struct drm_i915_private { > =20 > struct drm_property *broadcast_rgb_property; > struct drm_property *force_audio_property; > + struct drm_property *rotation_property; > =20 > bool hw_contexts_disabled; > uint32_t hw_context_size; > diff --git a/drivers/gpu/drm/i915/intel_sprite.c b/drivers/gpu/drm/i915/i= ntel_sprite.c > index 028a979..49f8238 100644 > --- a/drivers/gpu/drm/i915/intel_sprite.c > +++ b/drivers/gpu/drm/i915/intel_sprite.c > @@ -1033,6 +1033,30 @@ out_unlock: > return ret; > } > =20 > +static int intel_plane_set_property(struct drm_plane *plane, > + struct drm_property *prop, > + uint64_t val) > +{ > + struct drm_i915_private *dev_priv =3D plane->dev->dev_private; > + struct intel_plane *intel_plane =3D to_intel_plane(plane); > + uint64_t old_val; > + int ret =3D -ENOENT; > + > + if (prop =3D=3D dev_priv->rotation_property) { > + /* exactly one rotation angle please */ > + if (hweight32(val & 0xf) !=3D 1) > + return -EINVAL; > + > + old_val =3D intel_plane->rotation; > + intel_plane->rotation =3D val; > + ret =3D intel_plane_restore(plane); > + if (ret) > + intel_plane->rotation =3D old_val; > + } > + > + return ret; > +} > + > int intel_plane_restore(struct drm_plane *plane) > { > struct intel_plane *intel_plane =3D to_intel_plane(plane); > @@ -1059,6 +1083,7 @@ static const struct drm_plane_funcs intel_plane_fun= cs =3D { > .update_plane =3D intel_update_plane, > .disable_plane =3D intel_disable_plane, > .destroy =3D intel_destroy_plane, > + .set_property =3D intel_plane_set_property, > }; > =20 > static uint32_t ilk_plane_formats[] =3D { > @@ -1095,6 +1120,7 @@ static uint32_t vlv_plane_formats[] =3D { > int > intel_plane_init(struct drm_device *dev, enum pipe pipe, int plane) > { > + struct drm_i915_private *dev_priv =3D dev->dev_private; > struct intel_plane *intel_plane; > unsigned long possible_crtcs; > const uint32_t *plane_formats; > @@ -1168,8 +1194,22 @@ intel_plane_init(struct drm_device *dev, enum pipe= pipe, int plane) > &intel_plane_funcs, > plane_formats, num_plane_formats, > false); > - if (ret) > + if (ret) { > kfree(intel_plane); > + goto out; > + } > + > + if (!dev_priv->rotation_property) > + dev_priv->rotation_property =3D > + drm_mode_create_rotation_property(dev, > + BIT(DRM_ROTATE_0) | > + BIT(DRM_ROTATE_180)); > + > + if (dev_priv->rotation_property) > + drm_object_attach_property(&intel_plane->base.base, > + dev_priv->rotation_property, > + intel_plane->rotation); drm_mode_create_rotation_property() can fail silently, I think we should handle it. --Imre --=-x8ffHG0jnUcsXkaD/z6K 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/ixAAoJEORIIAnNuWDFv34H/jWpcdBgy+n3CK6oW/JRdhpa CrncP+tvo3mksXFmMxXV6+Br2g72zPok3a9OpXnqddDnnHHIDtALVwSApxOZTk96 kuuzW5il52YD+KgwXyt6uvpmXr+MXbeM/CaKpW2pxtnFYQUcxUmLw25fSn1bmf88 v1fPhLYYTliTOPKXA7rh1WpPjOf3/JHg2d8RTBA2ieIlZIiYJDDN+OMwKfY3GmHb XqgEPvXGrO867qfENx0EKWvKOdcdS14BhG0NIZI23xLCIPx36+ASixpYEA1qQyuw M5xeIt4o37na8HeJ2SWHdSd8BV30kaqGfPSUpaJqzfTIAcEGJ/2uYq2pvl7QD7Q= =frCt -----END PGP SIGNATURE----- --=-x8ffHG0jnUcsXkaD/z6K-- --===============1014993156== Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline _______________________________________________ Intel-gfx mailing list Intel-gfx@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/intel-gfx --===============1014993156==--