From mboxrd@z Thu Jan 1 00:00:00 1970 From: Daniel Vetter Subject: Re: [PATCH 2/2] drm/i915: Add rotation support for cursor plane (v5) Date: Thu, 23 Oct 2014 17:36:47 +0200 Message-ID: <20141023153647.GO26941@phenom.ffwll.local> References: <20141023084916.GC26941@phenom.ffwll.local> <1414075294-4396-1-git-send-email-matthew.d.roper@intel.com> <1414075294-4396-2-git-send-email-matthew.d.roper@intel.com> Mime-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable Return-path: Received: from mail-wi0-f171.google.com (mail-wi0-f171.google.com [209.85.212.171]) by gabe.freedesktop.org (Postfix) with ESMTP id BDA866E4AA for ; Thu, 23 Oct 2014 08:36:39 -0700 (PDT) Received: by mail-wi0-f171.google.com with SMTP id em10so4477748wid.10 for ; Thu, 23 Oct 2014 08:36:39 -0700 (PDT) Content-Disposition: inline In-Reply-To: <1414075294-4396-2-git-send-email-matthew.d.roper@intel.com> List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: intel-gfx-bounces@lists.freedesktop.org Sender: "Intel-gfx" To: Matt Roper Cc: intel-gfx@lists.freedesktop.org, Sagar Kamble List-Id: intel-gfx@lists.freedesktop.org On Thu, Oct 23, 2014 at 07:41:34AM -0700, Matt Roper wrote: > From: Ville Syrj=E4l=E4 > = > The cursor plane also supports 180 degree rotation. Add a new > "cursor-rotation" property on the crtc which controls this. > = > Unlike sprites, the cursor has a fixed size, so if you have a small > cursor image with the rest of the bo filled by transparent pixels, > simply flipping the rotation property will cause the visible part > of the cursor to shift. This is something to keep in mind when > using cursor rotation. > = > v2: Fix gen4/vlv by offsetting the base address appropriately > = > v3: Removing cursor-rotation property and using rotation property on curs= or > plane. > v4: Changing the author name back to Ville. > = > v5 (by Matt Roper): Slight tweaking to apply against latest di-nightly > codebase. > = > Cc: Sagar Kamble > Signed-off-by: Ville Syrj=E4l=E4 > Signed-off-by: Sonika Jindal > Reviewed-by: Matt Roper > Tested-by (IVB): Matt Roper > Signed-off-by: Matt Roper > --- > = > This is the tweaked version of the patch I used for my review/testing. M= y only > review comment was about a comment that I thought could use some clarific= ation, > so I'll leave it up to Sonika whether she wants to incorporate my suggest= ion or > not; either way this patch has my r-b tag. I think together with the HAS_GMCH_DISPLAY check the comment is clear. Queued for -next, thanks for the patch. -Daniel > = > = > drivers/gpu/drm/i915/i915_reg.h | 1 + > drivers/gpu/drm/i915/intel_display.c | 25 +++++++++++++++++++++++++ > 2 files changed, 26 insertions(+) > = > diff --git a/drivers/gpu/drm/i915/i915_reg.h b/drivers/gpu/drm/i915/i915_= reg.h > index 345293c..7e7002b 100644 > --- a/drivers/gpu/drm/i915/i915_reg.h > +++ b/drivers/gpu/drm/i915/i915_reg.h > @@ -4207,6 +4207,7 @@ enum punit_power_well { > #define MCURSOR_PIPE_A 0x00 > #define MCURSOR_PIPE_B (1 << 28) > #define MCURSOR_GAMMA_ENABLE (1 << 26) > +#define CURSOR_ROTATE_180 (1<<15) > #define CURSOR_TRICKLE_FEED_DISABLE (1 << 14) > #define _CURABASE 0x70084 > #define _CURAPOS 0x70088 > diff --git a/drivers/gpu/drm/i915/intel_display.c b/drivers/gpu/drm/i915/= intel_display.c > index 0529462..910e8a4 100644 > --- a/drivers/gpu/drm/i915/intel_display.c > +++ b/drivers/gpu/drm/i915/intel_display.c > @@ -8343,6 +8343,9 @@ static void i9xx_update_cursor(struct drm_crtc *crt= c, u32 base) > cntl |=3D CURSOR_PIPE_CSC_ENABLE; > } > = > + if (to_intel_plane(crtc->cursor)->rotation =3D=3D BIT(DRM_ROTATE_180)) > + cntl |=3D CURSOR_ROTATE_180; > + > if (intel_crtc->cursor_cntl !=3D cntl) { > I915_WRITE(CURCNTR(pipe), cntl); > POSTING_READ(CURCNTR(pipe)); > @@ -8400,6 +8403,13 @@ static void intel_crtc_update_cursor(struct drm_cr= tc *crtc, > = > I915_WRITE(CURPOS(pipe), pos); > = > + /* ILK+ do this automagically */ > + if (HAS_GMCH_DISPLAY(dev) && > + to_intel_plane(crtc->cursor)->rotation =3D=3D BIT(DRM_ROTATE_180)) { > + base +=3D (intel_crtc->cursor_height * > + intel_crtc->cursor_width - 1) * 4; > + } > + > if (IS_845G(dev) || IS_I865G(dev)) > i845_update_cursor(crtc, base); > else > @@ -12022,6 +12032,7 @@ static const struct drm_plane_funcs intel_cursor_= plane_funcs =3D { > .update_plane =3D intel_cursor_plane_update, > .disable_plane =3D intel_cursor_plane_disable, > .destroy =3D intel_plane_destroy, > + .set_property =3D intel_plane_set_property, > }; > = > static struct drm_plane *intel_cursor_plane_create(struct drm_device *de= v, > @@ -12037,12 +12048,26 @@ static struct drm_plane *intel_cursor_plane_cre= ate(struct drm_device *dev, > cursor->max_downscale =3D 1; > cursor->pipe =3D pipe; > cursor->plane =3D pipe; > + cursor->rotation =3D BIT(DRM_ROTATE_0); > = > drm_universal_plane_init(dev, &cursor->base, 0, > &intel_cursor_plane_funcs, > intel_cursor_formats, > ARRAY_SIZE(intel_cursor_formats), > DRM_PLANE_TYPE_CURSOR); > + > + if (INTEL_INFO(dev)->gen >=3D 4) { > + if (!dev->mode_config.rotation_property) > + dev->mode_config.rotation_property =3D > + drm_mode_create_rotation_property(dev, > + BIT(DRM_ROTATE_0) | > + BIT(DRM_ROTATE_180)); > + if (dev->mode_config.rotation_property) > + drm_object_attach_property(&cursor->base.base, > + dev->mode_config.rotation_property, > + cursor->rotation); > + } > + > return &cursor->base; > } > = > -- = > 1.8.5.1 > = > _______________________________________________ > Intel-gfx mailing list > Intel-gfx@lists.freedesktop.org > http://lists.freedesktop.org/mailman/listinfo/intel-gfx -- = Daniel Vetter Software Engineer, Intel Corporation +41 (0) 79 365 57 48 - http://blog.ffwll.ch