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 18:10:23 +0300 Message-ID: <1381763423.12668.73.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> <1381759153.12668.67.camel@intelbox> <20131014143925.GF13047@intel.com> Reply-To: imre.deak@intel.com Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="===============1083163826==" Return-path: In-Reply-To: <20131014143925.GF13047@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 =?ISO-8859-1?Q?Syrj=E4l=E4?= Cc: intel-gfx@lists.freedesktop.org, dri-devel@lists.freedesktop.org List-Id: intel-gfx@lists.freedesktop.org --===============1083163826== Content-Type: multipart/signed; micalg="pgp-sha1"; protocol="application/pgp-signature"; boundary="=-Ozw2AfouDuKeDnKK3QEA" --=-Ozw2AfouDuKeDnKK3QEA Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable On Mon, 2013-10-14 at 17:39 +0300, Ville Syrj=C3=A4l=C3=A4 wrote: > On Mon, Oct 14, 2013 at 04:59:13PM +0300, Imre Deak wrote: > > 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 i= n > > > place, so hook in the standard rotation property to expose the featur= e > > > 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/i= 915_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/i9= 15/intel_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= _funcs =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); > >=20 > > drm_mode_create_rotation_property() can fail silently, I think we shoul= d > > handle it. >=20 > I figured I'd just move it to intel_modeset_init() but turns out we > don't really handle errors there either. Frankly this looks like > another rathole. Seeing as we already ignore property creation errors > in other places (in a way that could oops even), I'm just going to > run away before the urge to fix it all takes over. Ok, since properties are already unreliable in this sense, I'm fine with leaving this as-is for now. The series looks ok, so: Reviewed-by: Imre Deak --=-Ozw2AfouDuKeDnKK3QEA 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) iQEcBAABAgAGBQJSXAlfAAoJEORIIAnNuWDF9OQIAMxfSnmswwEuU1llmt64tMgY Jry5xphDM7mh4sG4zPcHNaNta4AV90UK3ekMb/gt7ciXYyo6y/TvWczJH1axg0G8 qFbe7bCv2kq7qAt+fVXOFY4CkrCWokO2qc0MJ+7MV3rfVF/v/qVITMVn6JAbVB9c i23I5muyTF8cz2sMxxmas2nRcgbDdopiuQZNZp96u9G00Z/aARPHEZCekHSg5z2T vzbjfsrZe5WJqBV/fOG9T/JEybg6eIGNlWKMWZTNEPXqKZY3FEw0c6wtJOGt1qbc 8vzOihHLnzCulNyVsBE+tEhy7BMqs+THU+dpQSZwet4NjX183CDfzOCmZDemJSk= =5Lzv -----END PGP SIGNATURE----- --=-Ozw2AfouDuKeDnKK3QEA-- --===============1083163826== 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 --===============1083163826==--