All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] drm/i915/cnl: Add support for horizontal plane flipping
@ 2017-08-21 23:58 Rodrigo Vivi
  2017-08-22  0:29 ` ✓ Fi.CI.BAT: success for " Patchwork
  0 siblings, 1 reply; 6+ messages in thread
From: Rodrigo Vivi @ 2017-08-21 23:58 UTC (permalink / raw)
  To: intel-gfx; +Cc: Rodrigo Vivi

From: Joonas Lahtinen <joonas.lahtinen@linux.intel.com>

CNL supports horizontal plane flipping on non-linear plane formats.

v2:
- Avoid BUG unlike elsewhere in the code (Ville)
- Hoist the rotation-tiling restriction check (Ville)

Bspec: 7656
Suggested-by: Anusha Srivatsa <anusha.srivatsa@intel.com>
Cc: Ville Syrjala <ville.syrjala@linux.intel.com>
Cc: Rodrigo Vivi <rodrigo.vivi@intel.com>
Cc: Anusha Srivatsa <anusha.srivatsa@intel.com>
Signed-off-by: Joonas Lahtinen <joonas.lahtinen@linux.intel.com>
Reviewed-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
---
 drivers/gpu/drm/i915/i915_reg.h      |  1 +
 drivers/gpu/drm/i915/intel_display.c | 39 +++++++++++++++++++++++++++++++-----
 2 files changed, 35 insertions(+), 5 deletions(-)

diff --git a/drivers/gpu/drm/i915/i915_reg.h b/drivers/gpu/drm/i915/i915_reg.h
index d4ecb1905ad8..d7621622b58b 100644
--- a/drivers/gpu/drm/i915/i915_reg.h
+++ b/drivers/gpu/drm/i915/i915_reg.h
@@ -6268,6 +6268,7 @@ enum {
 #define   PLANE_CTL_TILED_X			(  1 << 10)
 #define   PLANE_CTL_TILED_Y			(  4 << 10)
 #define   PLANE_CTL_TILED_YF			(  5 << 10)
+#define   PLANE_CTL_FLIP_HORIZONTAL		(  1 << 8)
 #define   PLANE_CTL_ALPHA_MASK			(0x3 << 4)
 #define   PLANE_CTL_ALPHA_DISABLE		(  0 << 4)
 #define   PLANE_CTL_ALPHA_SW_PREMULTIPLY	(  2 << 4)
diff --git a/drivers/gpu/drm/i915/intel_display.c b/drivers/gpu/drm/i915/intel_display.c
index 3b95cf953335..e312096273c0 100644
--- a/drivers/gpu/drm/i915/intel_display.c
+++ b/drivers/gpu/drm/i915/intel_display.c
@@ -3139,6 +3139,12 @@ int skl_check_plane_surface(struct intel_plane_state *plane_state)
 	unsigned int rotation = plane_state->base.rotation;
 	int ret;
 
+	if (rotation & DRM_MODE_REFLECT_X &&
+	    fb->modifier == DRM_FORMAT_MOD_LINEAR) {
+                DRM_DEBUG_KMS("horizontal flip is not supported with linear surface formats\n");
+                return -EINVAL;
+	}
+
 	if (!plane_state->base.visible)
 		return 0;
 
@@ -3480,9 +3486,9 @@ static u32 skl_plane_ctl_tiling(uint64_t fb_modifier)
 	return 0;
 }
 
-static u32 skl_plane_ctl_rotation(unsigned int rotation)
+static u32 skl_plane_ctl_rotate(unsigned int rotate)
 {
-	switch (rotation) {
+	switch (rotate) {
 	case DRM_MODE_ROTATE_0:
 		break;
 	/*
@@ -3496,7 +3502,22 @@ static u32 skl_plane_ctl_rotation(unsigned int rotation)
 	case DRM_MODE_ROTATE_270:
 		return PLANE_CTL_ROTATE_90;
 	default:
-		MISSING_CASE(rotation);
+		MISSING_CASE(rotate);
+	}
+
+	return 0;
+}
+
+static u32 cnl_plane_ctl_flip(unsigned int reflect)
+{
+	switch (reflect) {
+	case 0:
+		break;
+	case DRM_MODE_REFLECT_X:
+		return PLANE_CTL_FLIP_HORIZONTAL;
+	case DRM_MODE_REFLECT_Y:
+	default:
+		MISSING_CASE(reflect);
 	}
 
 	return 0;
@@ -3523,7 +3544,10 @@ u32 skl_plane_ctl(const struct intel_crtc_state *crtc_state,
 
 	plane_ctl |= skl_plane_ctl_format(fb->format->format);
 	plane_ctl |= skl_plane_ctl_tiling(fb->modifier);
-	plane_ctl |= skl_plane_ctl_rotation(rotation);
+	plane_ctl |= skl_plane_ctl_rotate(rotation & DRM_MODE_ROTATE_MASK);
+
+	if (INTEL_GEN(dev_priv) >= 10)
+		plane_ctl |= cnl_plane_ctl_flip(rotation & DRM_MODE_REFLECT_MASK);
 
 	if (key->flags & I915_SET_COLORKEY_DESTINATION)
 		plane_ctl |= PLANE_CTL_KEY_ENABLE_DESTINATION;
@@ -13249,7 +13273,12 @@ intel_primary_plane_create(struct drm_i915_private *dev_priv, enum pipe pipe)
 	if (ret)
 		goto fail;
 
-	if (INTEL_GEN(dev_priv) >= 9) {
+	if (INTEL_GEN(dev_priv) >= 10) {
+		supported_rotations =
+			DRM_MODE_ROTATE_0 | DRM_MODE_ROTATE_90 |
+			DRM_MODE_ROTATE_180 | DRM_MODE_ROTATE_270 |
+			DRM_MODE_REFLECT_X;
+	} else if (INTEL_GEN(dev_priv) >= 9) {
 		supported_rotations =
 			DRM_MODE_ROTATE_0 | DRM_MODE_ROTATE_90 |
 			DRM_MODE_ROTATE_180 | DRM_MODE_ROTATE_270;
-- 
2.13.2

_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply related	[flat|nested] 6+ messages in thread

* ✓ Fi.CI.BAT: success for drm/i915/cnl: Add support for horizontal plane flipping
  2017-08-21 23:58 [PATCH] drm/i915/cnl: Add support for horizontal plane flipping Rodrigo Vivi
@ 2017-08-22  0:29 ` Patchwork
  0 siblings, 0 replies; 6+ messages in thread
From: Patchwork @ 2017-08-22  0:29 UTC (permalink / raw)
  To: Rodrigo Vivi; +Cc: intel-gfx

== Series Details ==

Series: drm/i915/cnl: Add support for horizontal plane flipping
URL   : https://patchwork.freedesktop.org/series/29114/
State : success

== Summary ==

Series 29114v1 drm/i915/cnl: Add support for horizontal plane flipping
https://patchwork.freedesktop.org/api/1.0/series/29114/revisions/1/mbox/

Test gem_exec_flush:
        Subgroup basic-batch-kernel-default-uc:
                pass       -> FAIL       (fi-snb-2600) fdo#100007
Test kms_pipe_crc_basic:
        Subgroup suspend-read-crc-pipe-c:
                pass       -> FAIL       (fi-skl-6700k) fdo#100367
Test drv_module_reload:
        Subgroup basic-reload-inject:
                pass       -> DMESG-WARN (fi-kbl-7260u) fdo#102295

fdo#100007 https://bugs.freedesktop.org/show_bug.cgi?id=100007
fdo#100367 https://bugs.freedesktop.org/show_bug.cgi?id=100367
fdo#102295 https://bugs.freedesktop.org/show_bug.cgi?id=102295

fi-bdw-5557u     total:279  pass:268  dwarn:0   dfail:0   fail:0   skip:11  time:456s
fi-bdw-gvtdvm    total:279  pass:265  dwarn:0   dfail:0   fail:0   skip:14  time:436s
fi-blb-e6850     total:279  pass:224  dwarn:1   dfail:0   fail:0   skip:54  time:361s
fi-bsw-n3050     total:279  pass:243  dwarn:0   dfail:0   fail:0   skip:36  time:553s
fi-bwr-2160      total:279  pass:184  dwarn:0   dfail:0   fail:0   skip:95  time:252s
fi-bxt-j4205     total:279  pass:260  dwarn:0   dfail:0   fail:0   skip:19  time:523s
fi-byt-j1900     total:279  pass:254  dwarn:1   dfail:0   fail:0   skip:24  time:525s
fi-byt-n2820     total:279  pass:251  dwarn:0   dfail:0   fail:0   skip:28  time:515s
fi-elk-e7500     total:279  pass:230  dwarn:0   dfail:0   fail:0   skip:49  time:438s
fi-glk-2a        total:279  pass:260  dwarn:0   dfail:0   fail:0   skip:19  time:609s
fi-hsw-4770      total:279  pass:263  dwarn:0   dfail:0   fail:0   skip:16  time:445s
fi-hsw-4770r     total:279  pass:263  dwarn:0   dfail:0   fail:0   skip:16  time:423s
fi-ilk-650       total:279  pass:229  dwarn:0   dfail:0   fail:0   skip:50  time:420s
fi-ivb-3520m     total:279  pass:261  dwarn:0   dfail:0   fail:0   skip:18  time:511s
fi-ivb-3770      total:279  pass:261  dwarn:0   dfail:0   fail:0   skip:18  time:472s
fi-kbl-7260u     total:279  pass:267  dwarn:2   dfail:0   fail:0   skip:10  time:495s
fi-kbl-7500u     total:279  pass:261  dwarn:0   dfail:0   fail:0   skip:18  time:476s
fi-kbl-7560u     total:279  pass:269  dwarn:0   dfail:0   fail:0   skip:10  time:598s
fi-kbl-r         total:279  pass:261  dwarn:0   dfail:0   fail:0   skip:18  time:599s
fi-pnv-d510      total:279  pass:223  dwarn:1   dfail:0   fail:0   skip:55  time:526s
fi-skl-6260u     total:279  pass:269  dwarn:0   dfail:0   fail:0   skip:10  time:465s
fi-skl-6700k     total:279  pass:260  dwarn:0   dfail:0   fail:1   skip:18  time:461s
fi-skl-6770hq    total:279  pass:269  dwarn:0   dfail:0   fail:0   skip:10  time:489s
fi-skl-gvtdvm    total:279  pass:266  dwarn:0   dfail:0   fail:0   skip:13  time:441s
fi-skl-x1585l    total:279  pass:268  dwarn:0   dfail:0   fail:0   skip:11  time:492s
fi-snb-2520m     total:279  pass:251  dwarn:0   dfail:0   fail:0   skip:28  time:546s
fi-snb-2600      total:279  pass:249  dwarn:0   dfail:0   fail:1   skip:29  time:409s

dbfb2f62576e1c3550d10398b097589959356db3 drm-tip: 2017y-08m-21d-08h-13m-34s UTC integration manifest
ffbce08d5fd9 drm/i915/cnl: Add support for horizontal plane flipping

== Logs ==

For more details see: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_5455/
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] drm/i915/cnl: Add support for horizontal plane flipping
  2017-12-16 15:25   ` Ville Syrjälä
@ 2017-12-18 22:46     ` Rodrigo Vivi
  0 siblings, 0 replies; 6+ messages in thread
From: Rodrigo Vivi @ 2017-12-18 22:46 UTC (permalink / raw)
  To: Ville Syrjälä; +Cc: intel-gfx

On Sat, Dec 16, 2017 at 03:25:01PM +0000, Ville Syrjälä wrote:
> On Fri, Dec 15, 2017 at 10:22:25PM +0000, Chris Wilson wrote:
> > Quoting Rodrigo Vivi (2017-12-15 21:38:00)
> > > From: Joonas Lahtinen <joonas.lahtinen@linux.intel.com>
> > > 
> > > CNL supports horizontal plane flipping on non-linear plane formats.
> > > 
> > > v2:
> > > - Avoid BUG unlike elsewhere in the code (Ville)
> > > - Hoist the rotation-tiling restriction check (Ville)
> > > 
> > > v3 (Rodrigo):
> > > - Rebased after a while.
> > > - Fix small indentation issues.
> > > 
> > > Bspec: 7656
> > > Suggested-by: Anusha Srivatsa <anusha.srivatsa@intel.com>
> > > Cc: Ville Syrjala <ville.syrjala@linux.intel.com>
> > > Cc: Rodrigo Vivi <rodrigo.vivi@intel.com>
> > > Cc: Anusha Srivatsa <anusha.srivatsa@intel.com>
> > > Signed-off-by: Joonas Lahtinen <joonas.lahtinen@linux.intel.com>
> > > Reviewed-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
> > > Signed-off-by: Rodrigo Vivi <rodrigo.vivi@intel.com>
> > > ---
> > >  drivers/gpu/drm/i915/i915_reg.h      |  1 +
> > >  drivers/gpu/drm/i915/intel_display.c | 40 +++++++++++++++++++++++++++++++-----
> > >  2 files changed, 36 insertions(+), 5 deletions(-)
> > > 
> > > diff --git a/drivers/gpu/drm/i915/i915_reg.h b/drivers/gpu/drm/i915/i915_reg.h
> > > index 09bf043c1c2e..14ade8f88dcc 100644
> > > --- a/drivers/gpu/drm/i915/i915_reg.h
> > > +++ b/drivers/gpu/drm/i915/i915_reg.h
> > > @@ -6329,6 +6329,7 @@ enum {
> > >  #define   PLANE_CTL_TILED_X                    (  1 << 10)
> > >  #define   PLANE_CTL_TILED_Y                    (  4 << 10)
> > >  #define   PLANE_CTL_TILED_YF                   (  5 << 10)
> > > +#define   PLANE_CTL_FLIP_HORIZONTAL            (  1 << 8)
> > >  #define   PLANE_CTL_ALPHA_MASK                 (0x3 << 4) /* Pre-GLK */
> > >  #define   PLANE_CTL_ALPHA_DISABLE              (  0 << 4)
> > >  #define   PLANE_CTL_ALPHA_SW_PREMULTIPLY       (  2 << 4)
> > > diff --git a/drivers/gpu/drm/i915/intel_display.c b/drivers/gpu/drm/i915/intel_display.c
> > > index efa6c6d19664..fb5ee413dc30 100644
> > > --- a/drivers/gpu/drm/i915/intel_display.c
> > > +++ b/drivers/gpu/drm/i915/intel_display.c
> > > @@ -3073,6 +3073,12 @@ int skl_check_plane_surface(struct intel_plane_state *plane_state)
> > >         unsigned int rotation = plane_state->base.rotation;
> > >         int ret;
> > >  
> > > +       if (rotation & DRM_MODE_REFLECT_X &&
> > > +           fb->modifier == DRM_FORMAT_MOD_LINEAR) {
> > > +               DRM_DEBUG_KMS("horizontal flip is not supported with linear surface formats\n");
> > > +               return -EINVAL;
> > > +       }
> > > +
> > >         if (!plane_state->base.visible)
> > >                 return 0;
> > >  
> > > @@ -3453,9 +3459,9 @@ static u32 skl_plane_ctl_tiling(uint64_t fb_modifier)
> > >         return 0;
> > >  }
> > >  
> > > -static u32 skl_plane_ctl_rotation(unsigned int rotation)
> > > +static u32 skl_plane_ctl_rotate(unsigned int rotate)
> > >  {
> > > -       switch (rotation) {
> > > +       switch (rotate) {
> > >         case DRM_MODE_ROTATE_0:
> > >                 break;
> > >         /*
> > > @@ -3469,7 +3475,22 @@ static u32 skl_plane_ctl_rotation(unsigned int rotation)
> > >         case DRM_MODE_ROTATE_270:
> > >                 return PLANE_CTL_ROTATE_90;
> > >         default:
> > > -               MISSING_CASE(rotation);
> > > +               MISSING_CASE(rotate);
> > > +       }
> > > +
> > > +       return 0;
> > > +}
> > > +
> > > +static u32 cnl_plane_ctl_flip(unsigned int reflect)
> > > +{
> > > +       switch (reflect) {
> > > +       case 0:
> > > +               break;
> > > +       case DRM_MODE_REFLECT_X:
> > > +               return PLANE_CTL_FLIP_HORIZONTAL;
> > > +       case DRM_MODE_REFLECT_Y:
> > > +       default:
> > > +               MISSING_CASE(reflect);
> > >         }
> > >  
> > >         return 0;
> > > @@ -3497,7 +3518,11 @@ u32 skl_plane_ctl(const struct intel_crtc_state *crtc_state,
> > >  
> > >         plane_ctl |= skl_plane_ctl_format(fb->format->format);
> > >         plane_ctl |= skl_plane_ctl_tiling(fb->modifier);
> > > -       plane_ctl |= skl_plane_ctl_rotation(rotation);
> > > +       plane_ctl |= skl_plane_ctl_rotate(rotation & DRM_MODE_ROTATE_MASK);
> > > +
> > > +       if (INTEL_GEN(dev_priv) >= 10)
> > > +               plane_ctl |= cnl_plane_ctl_flip(rotation &
> > > +                                               DRM_MODE_REFLECT_MASK);
> > >  
> > >         if (key->flags & I915_SET_COLORKEY_DESTINATION)
> > >                 plane_ctl |= PLANE_CTL_KEY_ENABLE_DESTINATION;
> > > @@ -13300,7 +13325,12 @@ intel_primary_plane_create(struct drm_i915_private *dev_priv, enum pipe pipe)
> > >         if (ret)
> > >                 goto fail;
> > >  
> > > -       if (INTEL_GEN(dev_priv) >= 9) {
> > > +       if (INTEL_GEN(dev_priv) >= 10) {
> > > +               supported_rotations =
> > > +                       DRM_MODE_ROTATE_0 | DRM_MODE_ROTATE_90 |
> > > +                       DRM_MODE_ROTATE_180 | DRM_MODE_ROTATE_270 |
> > > +                       DRM_MODE_REFLECT_X;
> > 
> > REFLECT_Y == ROTATE_180 | REFLECT_X
> > 
> > Where does that conversion belong? Should the kernel just say it
> > supports REFLECT_Y and fixup skl_plane_ctl(), that seems pretty simple.
> 
> We have drm_rotation_simplify() for that exactly. I hooked it up for
> msm some time ago: 574a37b1bb07 ("drm/msm/mdp5: Advertize 180 degree
> rotation")
> 
> I guess we could even move that into to the core, but that would
> require duplicating supported_rotations and plane_state->rotation
> into user visible and internal values.

Ok... So I'm taking this as good enough for now and merging the patch.

We can continue the discussion, but for following up patches if we
decided we need something different...

Thanks,
Rodrigo.

> 
> -- 
> Ville Syrjälä
> Intel OTC
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] drm/i915/cnl: Add support for horizontal plane flipping
  2017-12-15 22:22 ` Chris Wilson
@ 2017-12-16 15:25   ` Ville Syrjälä
  2017-12-18 22:46     ` Rodrigo Vivi
  0 siblings, 1 reply; 6+ messages in thread
From: Ville Syrjälä @ 2017-12-16 15:25 UTC (permalink / raw)
  To: Chris Wilson; +Cc: intel-gfx, Rodrigo Vivi

On Fri, Dec 15, 2017 at 10:22:25PM +0000, Chris Wilson wrote:
> Quoting Rodrigo Vivi (2017-12-15 21:38:00)
> > From: Joonas Lahtinen <joonas.lahtinen@linux.intel.com>
> > 
> > CNL supports horizontal plane flipping on non-linear plane formats.
> > 
> > v2:
> > - Avoid BUG unlike elsewhere in the code (Ville)
> > - Hoist the rotation-tiling restriction check (Ville)
> > 
> > v3 (Rodrigo):
> > - Rebased after a while.
> > - Fix small indentation issues.
> > 
> > Bspec: 7656
> > Suggested-by: Anusha Srivatsa <anusha.srivatsa@intel.com>
> > Cc: Ville Syrjala <ville.syrjala@linux.intel.com>
> > Cc: Rodrigo Vivi <rodrigo.vivi@intel.com>
> > Cc: Anusha Srivatsa <anusha.srivatsa@intel.com>
> > Signed-off-by: Joonas Lahtinen <joonas.lahtinen@linux.intel.com>
> > Reviewed-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
> > Signed-off-by: Rodrigo Vivi <rodrigo.vivi@intel.com>
> > ---
> >  drivers/gpu/drm/i915/i915_reg.h      |  1 +
> >  drivers/gpu/drm/i915/intel_display.c | 40 +++++++++++++++++++++++++++++++-----
> >  2 files changed, 36 insertions(+), 5 deletions(-)
> > 
> > diff --git a/drivers/gpu/drm/i915/i915_reg.h b/drivers/gpu/drm/i915/i915_reg.h
> > index 09bf043c1c2e..14ade8f88dcc 100644
> > --- a/drivers/gpu/drm/i915/i915_reg.h
> > +++ b/drivers/gpu/drm/i915/i915_reg.h
> > @@ -6329,6 +6329,7 @@ enum {
> >  #define   PLANE_CTL_TILED_X                    (  1 << 10)
> >  #define   PLANE_CTL_TILED_Y                    (  4 << 10)
> >  #define   PLANE_CTL_TILED_YF                   (  5 << 10)
> > +#define   PLANE_CTL_FLIP_HORIZONTAL            (  1 << 8)
> >  #define   PLANE_CTL_ALPHA_MASK                 (0x3 << 4) /* Pre-GLK */
> >  #define   PLANE_CTL_ALPHA_DISABLE              (  0 << 4)
> >  #define   PLANE_CTL_ALPHA_SW_PREMULTIPLY       (  2 << 4)
> > diff --git a/drivers/gpu/drm/i915/intel_display.c b/drivers/gpu/drm/i915/intel_display.c
> > index efa6c6d19664..fb5ee413dc30 100644
> > --- a/drivers/gpu/drm/i915/intel_display.c
> > +++ b/drivers/gpu/drm/i915/intel_display.c
> > @@ -3073,6 +3073,12 @@ int skl_check_plane_surface(struct intel_plane_state *plane_state)
> >         unsigned int rotation = plane_state->base.rotation;
> >         int ret;
> >  
> > +       if (rotation & DRM_MODE_REFLECT_X &&
> > +           fb->modifier == DRM_FORMAT_MOD_LINEAR) {
> > +               DRM_DEBUG_KMS("horizontal flip is not supported with linear surface formats\n");
> > +               return -EINVAL;
> > +       }
> > +
> >         if (!plane_state->base.visible)
> >                 return 0;
> >  
> > @@ -3453,9 +3459,9 @@ static u32 skl_plane_ctl_tiling(uint64_t fb_modifier)
> >         return 0;
> >  }
> >  
> > -static u32 skl_plane_ctl_rotation(unsigned int rotation)
> > +static u32 skl_plane_ctl_rotate(unsigned int rotate)
> >  {
> > -       switch (rotation) {
> > +       switch (rotate) {
> >         case DRM_MODE_ROTATE_0:
> >                 break;
> >         /*
> > @@ -3469,7 +3475,22 @@ static u32 skl_plane_ctl_rotation(unsigned int rotation)
> >         case DRM_MODE_ROTATE_270:
> >                 return PLANE_CTL_ROTATE_90;
> >         default:
> > -               MISSING_CASE(rotation);
> > +               MISSING_CASE(rotate);
> > +       }
> > +
> > +       return 0;
> > +}
> > +
> > +static u32 cnl_plane_ctl_flip(unsigned int reflect)
> > +{
> > +       switch (reflect) {
> > +       case 0:
> > +               break;
> > +       case DRM_MODE_REFLECT_X:
> > +               return PLANE_CTL_FLIP_HORIZONTAL;
> > +       case DRM_MODE_REFLECT_Y:
> > +       default:
> > +               MISSING_CASE(reflect);
> >         }
> >  
> >         return 0;
> > @@ -3497,7 +3518,11 @@ u32 skl_plane_ctl(const struct intel_crtc_state *crtc_state,
> >  
> >         plane_ctl |= skl_plane_ctl_format(fb->format->format);
> >         plane_ctl |= skl_plane_ctl_tiling(fb->modifier);
> > -       plane_ctl |= skl_plane_ctl_rotation(rotation);
> > +       plane_ctl |= skl_plane_ctl_rotate(rotation & DRM_MODE_ROTATE_MASK);
> > +
> > +       if (INTEL_GEN(dev_priv) >= 10)
> > +               plane_ctl |= cnl_plane_ctl_flip(rotation &
> > +                                               DRM_MODE_REFLECT_MASK);
> >  
> >         if (key->flags & I915_SET_COLORKEY_DESTINATION)
> >                 plane_ctl |= PLANE_CTL_KEY_ENABLE_DESTINATION;
> > @@ -13300,7 +13325,12 @@ intel_primary_plane_create(struct drm_i915_private *dev_priv, enum pipe pipe)
> >         if (ret)
> >                 goto fail;
> >  
> > -       if (INTEL_GEN(dev_priv) >= 9) {
> > +       if (INTEL_GEN(dev_priv) >= 10) {
> > +               supported_rotations =
> > +                       DRM_MODE_ROTATE_0 | DRM_MODE_ROTATE_90 |
> > +                       DRM_MODE_ROTATE_180 | DRM_MODE_ROTATE_270 |
> > +                       DRM_MODE_REFLECT_X;
> 
> REFLECT_Y == ROTATE_180 | REFLECT_X
> 
> Where does that conversion belong? Should the kernel just say it
> supports REFLECT_Y and fixup skl_plane_ctl(), that seems pretty simple.

We have drm_rotation_simplify() for that exactly. I hooked it up for
msm some time ago: 574a37b1bb07 ("drm/msm/mdp5: Advertize 180 degree
rotation")

I guess we could even move that into to the core, but that would
require duplicating supported_rotations and plane_state->rotation
into user visible and internal values.

-- 
Ville Syrjälä
Intel OTC
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] drm/i915/cnl: Add support for horizontal plane flipping
  2017-12-15 21:38 [PATCH] " Rodrigo Vivi
@ 2017-12-15 22:22 ` Chris Wilson
  2017-12-16 15:25   ` Ville Syrjälä
  0 siblings, 1 reply; 6+ messages in thread
From: Chris Wilson @ 2017-12-15 22:22 UTC (permalink / raw)
  To: intel-gfx; +Cc: Rodrigo Vivi

Quoting Rodrigo Vivi (2017-12-15 21:38:00)
> From: Joonas Lahtinen <joonas.lahtinen@linux.intel.com>
> 
> CNL supports horizontal plane flipping on non-linear plane formats.
> 
> v2:
> - Avoid BUG unlike elsewhere in the code (Ville)
> - Hoist the rotation-tiling restriction check (Ville)
> 
> v3 (Rodrigo):
> - Rebased after a while.
> - Fix small indentation issues.
> 
> Bspec: 7656
> Suggested-by: Anusha Srivatsa <anusha.srivatsa@intel.com>
> Cc: Ville Syrjala <ville.syrjala@linux.intel.com>
> Cc: Rodrigo Vivi <rodrigo.vivi@intel.com>
> Cc: Anusha Srivatsa <anusha.srivatsa@intel.com>
> Signed-off-by: Joonas Lahtinen <joonas.lahtinen@linux.intel.com>
> Reviewed-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
> Signed-off-by: Rodrigo Vivi <rodrigo.vivi@intel.com>
> ---
>  drivers/gpu/drm/i915/i915_reg.h      |  1 +
>  drivers/gpu/drm/i915/intel_display.c | 40 +++++++++++++++++++++++++++++++-----
>  2 files changed, 36 insertions(+), 5 deletions(-)
> 
> diff --git a/drivers/gpu/drm/i915/i915_reg.h b/drivers/gpu/drm/i915/i915_reg.h
> index 09bf043c1c2e..14ade8f88dcc 100644
> --- a/drivers/gpu/drm/i915/i915_reg.h
> +++ b/drivers/gpu/drm/i915/i915_reg.h
> @@ -6329,6 +6329,7 @@ enum {
>  #define   PLANE_CTL_TILED_X                    (  1 << 10)
>  #define   PLANE_CTL_TILED_Y                    (  4 << 10)
>  #define   PLANE_CTL_TILED_YF                   (  5 << 10)
> +#define   PLANE_CTL_FLIP_HORIZONTAL            (  1 << 8)
>  #define   PLANE_CTL_ALPHA_MASK                 (0x3 << 4) /* Pre-GLK */
>  #define   PLANE_CTL_ALPHA_DISABLE              (  0 << 4)
>  #define   PLANE_CTL_ALPHA_SW_PREMULTIPLY       (  2 << 4)
> diff --git a/drivers/gpu/drm/i915/intel_display.c b/drivers/gpu/drm/i915/intel_display.c
> index efa6c6d19664..fb5ee413dc30 100644
> --- a/drivers/gpu/drm/i915/intel_display.c
> +++ b/drivers/gpu/drm/i915/intel_display.c
> @@ -3073,6 +3073,12 @@ int skl_check_plane_surface(struct intel_plane_state *plane_state)
>         unsigned int rotation = plane_state->base.rotation;
>         int ret;
>  
> +       if (rotation & DRM_MODE_REFLECT_X &&
> +           fb->modifier == DRM_FORMAT_MOD_LINEAR) {
> +               DRM_DEBUG_KMS("horizontal flip is not supported with linear surface formats\n");
> +               return -EINVAL;
> +       }
> +
>         if (!plane_state->base.visible)
>                 return 0;
>  
> @@ -3453,9 +3459,9 @@ static u32 skl_plane_ctl_tiling(uint64_t fb_modifier)
>         return 0;
>  }
>  
> -static u32 skl_plane_ctl_rotation(unsigned int rotation)
> +static u32 skl_plane_ctl_rotate(unsigned int rotate)
>  {
> -       switch (rotation) {
> +       switch (rotate) {
>         case DRM_MODE_ROTATE_0:
>                 break;
>         /*
> @@ -3469,7 +3475,22 @@ static u32 skl_plane_ctl_rotation(unsigned int rotation)
>         case DRM_MODE_ROTATE_270:
>                 return PLANE_CTL_ROTATE_90;
>         default:
> -               MISSING_CASE(rotation);
> +               MISSING_CASE(rotate);
> +       }
> +
> +       return 0;
> +}
> +
> +static u32 cnl_plane_ctl_flip(unsigned int reflect)
> +{
> +       switch (reflect) {
> +       case 0:
> +               break;
> +       case DRM_MODE_REFLECT_X:
> +               return PLANE_CTL_FLIP_HORIZONTAL;
> +       case DRM_MODE_REFLECT_Y:
> +       default:
> +               MISSING_CASE(reflect);
>         }
>  
>         return 0;
> @@ -3497,7 +3518,11 @@ u32 skl_plane_ctl(const struct intel_crtc_state *crtc_state,
>  
>         plane_ctl |= skl_plane_ctl_format(fb->format->format);
>         plane_ctl |= skl_plane_ctl_tiling(fb->modifier);
> -       plane_ctl |= skl_plane_ctl_rotation(rotation);
> +       plane_ctl |= skl_plane_ctl_rotate(rotation & DRM_MODE_ROTATE_MASK);
> +
> +       if (INTEL_GEN(dev_priv) >= 10)
> +               plane_ctl |= cnl_plane_ctl_flip(rotation &
> +                                               DRM_MODE_REFLECT_MASK);
>  
>         if (key->flags & I915_SET_COLORKEY_DESTINATION)
>                 plane_ctl |= PLANE_CTL_KEY_ENABLE_DESTINATION;
> @@ -13300,7 +13325,12 @@ intel_primary_plane_create(struct drm_i915_private *dev_priv, enum pipe pipe)
>         if (ret)
>                 goto fail;
>  
> -       if (INTEL_GEN(dev_priv) >= 9) {
> +       if (INTEL_GEN(dev_priv) >= 10) {
> +               supported_rotations =
> +                       DRM_MODE_ROTATE_0 | DRM_MODE_ROTATE_90 |
> +                       DRM_MODE_ROTATE_180 | DRM_MODE_ROTATE_270 |
> +                       DRM_MODE_REFLECT_X;

REFLECT_Y == ROTATE_180 | REFLECT_X

Where does that conversion belong? Should the kernel just say it
supports REFLECT_Y and fixup skl_plane_ctl(), that seems pretty simple.
-Chris
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply	[flat|nested] 6+ messages in thread

* [PATCH] drm/i915/cnl: Add support for horizontal plane flipping
@ 2017-12-15 21:38 Rodrigo Vivi
  2017-12-15 22:22 ` Chris Wilson
  0 siblings, 1 reply; 6+ messages in thread
From: Rodrigo Vivi @ 2017-12-15 21:38 UTC (permalink / raw)
  To: intel-gfx; +Cc: Rodrigo Vivi

From: Joonas Lahtinen <joonas.lahtinen@linux.intel.com>

CNL supports horizontal plane flipping on non-linear plane formats.

v2:
- Avoid BUG unlike elsewhere in the code (Ville)
- Hoist the rotation-tiling restriction check (Ville)

v3 (Rodrigo):
- Rebased after a while.
- Fix small indentation issues.

Bspec: 7656
Suggested-by: Anusha Srivatsa <anusha.srivatsa@intel.com>
Cc: Ville Syrjala <ville.syrjala@linux.intel.com>
Cc: Rodrigo Vivi <rodrigo.vivi@intel.com>
Cc: Anusha Srivatsa <anusha.srivatsa@intel.com>
Signed-off-by: Joonas Lahtinen <joonas.lahtinen@linux.intel.com>
Reviewed-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Signed-off-by: Rodrigo Vivi <rodrigo.vivi@intel.com>
---
 drivers/gpu/drm/i915/i915_reg.h      |  1 +
 drivers/gpu/drm/i915/intel_display.c | 40 +++++++++++++++++++++++++++++++-----
 2 files changed, 36 insertions(+), 5 deletions(-)

diff --git a/drivers/gpu/drm/i915/i915_reg.h b/drivers/gpu/drm/i915/i915_reg.h
index 09bf043c1c2e..14ade8f88dcc 100644
--- a/drivers/gpu/drm/i915/i915_reg.h
+++ b/drivers/gpu/drm/i915/i915_reg.h
@@ -6329,6 +6329,7 @@ enum {
 #define   PLANE_CTL_TILED_X			(  1 << 10)
 #define   PLANE_CTL_TILED_Y			(  4 << 10)
 #define   PLANE_CTL_TILED_YF			(  5 << 10)
+#define   PLANE_CTL_FLIP_HORIZONTAL		(  1 << 8)
 #define   PLANE_CTL_ALPHA_MASK			(0x3 << 4) /* Pre-GLK */
 #define   PLANE_CTL_ALPHA_DISABLE		(  0 << 4)
 #define   PLANE_CTL_ALPHA_SW_PREMULTIPLY	(  2 << 4)
diff --git a/drivers/gpu/drm/i915/intel_display.c b/drivers/gpu/drm/i915/intel_display.c
index efa6c6d19664..fb5ee413dc30 100644
--- a/drivers/gpu/drm/i915/intel_display.c
+++ b/drivers/gpu/drm/i915/intel_display.c
@@ -3073,6 +3073,12 @@ int skl_check_plane_surface(struct intel_plane_state *plane_state)
 	unsigned int rotation = plane_state->base.rotation;
 	int ret;
 
+	if (rotation & DRM_MODE_REFLECT_X &&
+	    fb->modifier == DRM_FORMAT_MOD_LINEAR) {
+		DRM_DEBUG_KMS("horizontal flip is not supported with linear surface formats\n");
+		return -EINVAL;
+	}
+
 	if (!plane_state->base.visible)
 		return 0;
 
@@ -3453,9 +3459,9 @@ static u32 skl_plane_ctl_tiling(uint64_t fb_modifier)
 	return 0;
 }
 
-static u32 skl_plane_ctl_rotation(unsigned int rotation)
+static u32 skl_plane_ctl_rotate(unsigned int rotate)
 {
-	switch (rotation) {
+	switch (rotate) {
 	case DRM_MODE_ROTATE_0:
 		break;
 	/*
@@ -3469,7 +3475,22 @@ static u32 skl_plane_ctl_rotation(unsigned int rotation)
 	case DRM_MODE_ROTATE_270:
 		return PLANE_CTL_ROTATE_90;
 	default:
-		MISSING_CASE(rotation);
+		MISSING_CASE(rotate);
+	}
+
+	return 0;
+}
+
+static u32 cnl_plane_ctl_flip(unsigned int reflect)
+{
+	switch (reflect) {
+	case 0:
+		break;
+	case DRM_MODE_REFLECT_X:
+		return PLANE_CTL_FLIP_HORIZONTAL;
+	case DRM_MODE_REFLECT_Y:
+	default:
+		MISSING_CASE(reflect);
 	}
 
 	return 0;
@@ -3497,7 +3518,11 @@ u32 skl_plane_ctl(const struct intel_crtc_state *crtc_state,
 
 	plane_ctl |= skl_plane_ctl_format(fb->format->format);
 	plane_ctl |= skl_plane_ctl_tiling(fb->modifier);
-	plane_ctl |= skl_plane_ctl_rotation(rotation);
+	plane_ctl |= skl_plane_ctl_rotate(rotation & DRM_MODE_ROTATE_MASK);
+
+	if (INTEL_GEN(dev_priv) >= 10)
+		plane_ctl |= cnl_plane_ctl_flip(rotation &
+						DRM_MODE_REFLECT_MASK);
 
 	if (key->flags & I915_SET_COLORKEY_DESTINATION)
 		plane_ctl |= PLANE_CTL_KEY_ENABLE_DESTINATION;
@@ -13300,7 +13325,12 @@ intel_primary_plane_create(struct drm_i915_private *dev_priv, enum pipe pipe)
 	if (ret)
 		goto fail;
 
-	if (INTEL_GEN(dev_priv) >= 9) {
+	if (INTEL_GEN(dev_priv) >= 10) {
+		supported_rotations =
+			DRM_MODE_ROTATE_0 | DRM_MODE_ROTATE_90 |
+			DRM_MODE_ROTATE_180 | DRM_MODE_ROTATE_270 |
+			DRM_MODE_REFLECT_X;
+	} else if (INTEL_GEN(dev_priv) >= 9) {
 		supported_rotations =
 			DRM_MODE_ROTATE_0 | DRM_MODE_ROTATE_90 |
 			DRM_MODE_ROTATE_180 | DRM_MODE_ROTATE_270;
-- 
2.13.6

_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply related	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2017-12-18 22:46 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-08-21 23:58 [PATCH] drm/i915/cnl: Add support for horizontal plane flipping Rodrigo Vivi
2017-08-22  0:29 ` ✓ Fi.CI.BAT: success for " Patchwork
2017-12-15 21:38 [PATCH] " Rodrigo Vivi
2017-12-15 22:22 ` Chris Wilson
2017-12-16 15:25   ` Ville Syrjälä
2017-12-18 22:46     ` Rodrigo Vivi

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.