All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v2 00/16] drm: drm: Per-plane rotation etc.
@ 2016-09-26 16:30 ville.syrjala
  2016-09-26 16:30 ` [PATCH v2 01/15] drm: Add drm_rotation_90_or_270() ville.syrjala
                   ` (17 more replies)
  0 siblings, 18 replies; 32+ messages in thread
From: ville.syrjala @ 2016-09-26 16:30 UTC (permalink / raw)
  To: dri-devel; +Cc: intel-gfx, Tomi Valkeinen

From: Ville Syrjälä <ville.syrjala@linux.intel.com>

Another, rebased, version of my earlier series [1] to add the per-plane
rotation property. One thing holding back the previous version was the
weird regression on omap, but apparently I managed to fix it (see [2]).

msm and omap still lack r-bs/acks.

Entire series available here:
git://github.com/vsyrjala/linux.git chv_mirror_4

Cc: Tomi Valkeinen <tomi.valkeinen@ti.com>
Cc: Rob Clark <robdclark@gmail.com>
Cc: Jilai Wang <jilaiw@codeaurora.org>
Cc: Archit Taneja <architt@codeaurora.org>

Ville Syrjälä (15):
  drm: Add drm_rotation_90_or_270()
  drm/atomic: Reject attempts to use multiple rotation angles at once
  drm: Add support for optional per-plane rotation property
  drm/arm: Use per-plane rotation property
  drm/atmel-hlcdc: Use per-plane rotation property
  drm/omap: Set rotation property initial value to BIT(DRM_ROTATE_0)
    insted of 0
  drm/omap: Use per-plane rotation property
  drm/msm/mdp5: Set rotation property initial value to BIT(DRM_ROTATE_0)
    insted of 0
  drm/msm/mdp5: Use per-plane rotation property
  drm/msm/mdp5: Advertize 180 degree rotation
  drm/i915: Use the per-plane rotation property
  drm: RIP mode_config->rotation_property
  drm/i915: Use & instead if == to check for rotations
  drm/i915: Clean up rotation DSPCNTR/DVSCNTR/etc. setup
  drm/i915: Add horizontal mirroring support for CHV pipe B planes

 drivers/gpu/drm/arm/malidp_planes.c             |  13 ++-
 drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_plane.c |  41 ++++-----
 drivers/gpu/drm/drm_atomic.c                    |   6 +-
 drivers/gpu/drm/drm_atomic_helper.c             |   2 +-
 drivers/gpu/drm/drm_blend.c                     |  39 +++++----
 drivers/gpu/drm/drm_crtc.c                      |   3 +-
 drivers/gpu/drm/drm_fb_helper.c                 |   5 +-
 drivers/gpu/drm/i915/intel_atomic_plane.c       |  11 ++-
 drivers/gpu/drm/i915/intel_display.c            | 107 ++++++++++++------------
 drivers/gpu/drm/i915/intel_drv.h                |   9 --
 drivers/gpu/drm/i915/intel_fbc.c                |   2 +-
 drivers/gpu/drm/i915/intel_pm.c                 |  12 +--
 drivers/gpu/drm/i915/intel_sprite.c             |  53 ++++++++----
 drivers/gpu/drm/msm/mdp/mdp5/mdp5_plane.c       |  35 +++++---
 drivers/gpu/drm/omapdrm/omap_crtc.c             |  13 ++-
 drivers/gpu/drm/omapdrm/omap_drv.c              |  50 +++++------
 drivers/gpu/drm/omapdrm/omap_plane.c            |  21 +++--
 include/drm/drm_blend.h                         |  10 ++-
 include/drm/drm_crtc.h                          |   5 --
 include/drm/drm_plane.h                         |   2 +
 20 files changed, 243 insertions(+), 196 deletions(-)

-- 
2.7.4

_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

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

* [PATCH v2 01/15] drm: Add drm_rotation_90_or_270()
  2016-09-26 16:30 [PATCH v2 00/16] drm: drm: Per-plane rotation etc ville.syrjala
@ 2016-09-26 16:30 ` ville.syrjala
  2016-09-27  9:32   ` Joonas Lahtinen
  2016-09-26 16:30 ` [PATCH 02/15] drm/atomic: Reject attempts to use multiple rotation angles at once ville.syrjala
                   ` (16 subsequent siblings)
  17 siblings, 1 reply; 32+ messages in thread
From: ville.syrjala @ 2016-09-26 16:30 UTC (permalink / raw)
  To: dri-devel; +Cc: intel-gfx

From: Ville Syrjälä <ville.syrjala@linux.intel.com>

We have intel_rotation_90_or_270() in i915 to check if the rotation is
90 or 270 degrees. Similar checks are elsewhere in drm, so let's move
the helper into a central place and use it everwhere.

v2: Drop the BIT()
    Convert all new intel_rotation_90_or_270() calls
    Deal with superfluous code shuffling

Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Reviewed-by: Joonas Lahtinen <joonas.lahtinen@linux.intel.com> (v1)
Reviewed-by: Chris Wilson <chris@chris-wilson.co.uk> (v1)
---
 drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_plane.c |  4 ++--
 drivers/gpu/drm/drm_atomic_helper.c             |  2 +-
 drivers/gpu/drm/drm_crtc.c                      |  3 +--
 drivers/gpu/drm/i915/intel_atomic_plane.c       |  3 ++-
 drivers/gpu/drm/i915/intel_display.c            | 16 ++++++++--------
 drivers/gpu/drm/i915/intel_drv.h                |  6 ------
 drivers/gpu/drm/i915/intel_fbc.c                |  2 +-
 drivers/gpu/drm/i915/intel_pm.c                 | 12 ++++++------
 drivers/gpu/drm/omapdrm/omap_plane.c            |  8 ++------
 include/drm/drm_blend.h                         |  5 +++++
 10 files changed, 28 insertions(+), 33 deletions(-)

diff --git a/drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_plane.c b/drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_plane.c
index 9d4c030672f0..b380179d4013 100644
--- a/drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_plane.c
+++ b/drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_plane.c
@@ -393,7 +393,7 @@ static void atmel_hlcdc_plane_update_format(struct atmel_hlcdc_plane *plane,
 
 	if ((state->base.fb->pixel_format == DRM_FORMAT_YUV422 ||
 	     state->base.fb->pixel_format == DRM_FORMAT_NV61) &&
-	    (state->base.rotation & (DRM_ROTATE_90 | DRM_ROTATE_270)))
+	    drm_rotation_90_or_270(state->base.rotation))
 		cfg |= ATMEL_HLCDC_YUV422ROT;
 
 	atmel_hlcdc_layer_update_cfg(&plane->layer,
@@ -628,7 +628,7 @@ static int atmel_hlcdc_plane_atomic_check(struct drm_plane *p,
 	/*
 	 * Swap width and size in case of 90 or 270 degrees rotation
 	 */
-	if (state->base.rotation & (DRM_ROTATE_90 | DRM_ROTATE_270)) {
+	if (drm_rotation_90_or_270(state->base.rotation)) {
 		tmp = state->crtc_w;
 		state->crtc_w = state->crtc_h;
 		state->crtc_h = tmp;
diff --git a/drivers/gpu/drm/drm_atomic_helper.c b/drivers/gpu/drm/drm_atomic_helper.c
index c3f83476f996..13038bdb50ac 100644
--- a/drivers/gpu/drm/drm_atomic_helper.c
+++ b/drivers/gpu/drm/drm_atomic_helper.c
@@ -2412,7 +2412,7 @@ int __drm_atomic_helper_set_config(struct drm_mode_set *set,
 	primary_state->crtc_h = vdisplay;
 	primary_state->src_x = set->x << 16;
 	primary_state->src_y = set->y << 16;
-	if (primary_state->rotation & (DRM_ROTATE_90 | DRM_ROTATE_270)) {
+	if (drm_rotation_90_or_270(primary_state->rotation)) {
 		primary_state->src_w = vdisplay << 16;
 		primary_state->src_h = hdisplay << 16;
 	} else {
diff --git a/drivers/gpu/drm/drm_crtc.c b/drivers/gpu/drm/drm_crtc.c
index 2d7bedf28647..3307a114f6d2 100644
--- a/drivers/gpu/drm/drm_crtc.c
+++ b/drivers/gpu/drm/drm_crtc.c
@@ -695,8 +695,7 @@ int drm_crtc_check_viewport(const struct drm_crtc *crtc,
 	drm_crtc_get_hv_timing(mode, &hdisplay, &vdisplay);
 
 	if (crtc->state &&
-	    crtc->primary->state->rotation & (DRM_ROTATE_90 |
-					      DRM_ROTATE_270))
+	    drm_rotation_90_or_270(crtc->primary->state->rotation))
 		swap(hdisplay, vdisplay);
 
 	return drm_framebuffer_check_src_coords(x << 16, y << 16,
diff --git a/drivers/gpu/drm/i915/intel_atomic_plane.c b/drivers/gpu/drm/i915/intel_atomic_plane.c
index b82de3072d4f..c762ae549a1c 100644
--- a/drivers/gpu/drm/i915/intel_atomic_plane.c
+++ b/drivers/gpu/drm/i915/intel_atomic_plane.c
@@ -142,8 +142,9 @@ static int intel_plane_atomic_check(struct drm_plane *plane,
 	intel_state->clip.y2 =
 		crtc_state->base.enable ? crtc_state->pipe_src_h : 0;
 
-	if (state->fb && intel_rotation_90_or_270(state->rotation)) {
+	if (state->fb && drm_rotation_90_or_270(state->rotation)) {
 		char *format_name;
+
 		if (!(state->fb->modifier[0] == I915_FORMAT_MOD_Y_TILED ||
 			state->fb->modifier[0] == I915_FORMAT_MOD_Yf_TILED)) {
 			DRM_DEBUG_KMS("Y/Yf tiling required for 90/270!\n");
diff --git a/drivers/gpu/drm/i915/intel_display.c b/drivers/gpu/drm/i915/intel_display.c
index e5ad1010c8b1..9e475c41b723 100644
--- a/drivers/gpu/drm/i915/intel_display.c
+++ b/drivers/gpu/drm/i915/intel_display.c
@@ -2139,7 +2139,7 @@ intel_fill_fb_ggtt_view(struct i915_ggtt_view *view,
 			const struct drm_framebuffer *fb,
 			unsigned int rotation)
 {
-	if (intel_rotation_90_or_270(rotation)) {
+	if (drm_rotation_90_or_270(rotation)) {
 		*view = i915_ggtt_view_rotated;
 		view->params.rotated = to_intel_framebuffer(fb)->rot_info;
 	} else {
@@ -2260,7 +2260,7 @@ void intel_unpin_fb_obj(struct drm_framebuffer *fb, unsigned int rotation)
 static int intel_fb_pitch(const struct drm_framebuffer *fb, int plane,
 			  unsigned int rotation)
 {
-	if (intel_rotation_90_or_270(rotation))
+	if (drm_rotation_90_or_270(rotation))
 		return to_intel_framebuffer(fb)->rotated[plane].pitch;
 	else
 		return fb->pitches[plane];
@@ -2296,7 +2296,7 @@ void intel_add_fb_offsets(int *x, int *y,
 	const struct intel_framebuffer *intel_fb = to_intel_framebuffer(state->base.fb);
 	unsigned int rotation = state->base.rotation;
 
-	if (intel_rotation_90_or_270(rotation)) {
+	if (drm_rotation_90_or_270(rotation)) {
 		*x += intel_fb->rotated[plane].x;
 		*y += intel_fb->rotated[plane].y;
 	} else {
@@ -2360,7 +2360,7 @@ static u32 intel_adjust_tile_offset(int *x, int *y,
 		intel_tile_dims(dev_priv, &tile_width, &tile_height,
 				fb->modifier[plane], cpp);
 
-		if (intel_rotation_90_or_270(rotation)) {
+		if (drm_rotation_90_or_270(rotation)) {
 			pitch_tiles = pitch / tile_height;
 			swap(tile_width, tile_height);
 		} else {
@@ -2416,7 +2416,7 @@ static u32 _intel_compute_tile_offset(const struct drm_i915_private *dev_priv,
 		intel_tile_dims(dev_priv, &tile_width, &tile_height,
 				fb_modifier, cpp);
 
-		if (intel_rotation_90_or_270(rotation)) {
+		if (drm_rotation_90_or_270(rotation)) {
 			pitch_tiles = pitch / tile_height;
 			swap(tile_width, tile_height);
 		} else {
@@ -2976,7 +2976,7 @@ int skl_check_plane_surface(struct intel_plane_state *plane_state)
 	int ret;
 
 	/* Rotate src coordinates to match rotated GTT view */
-	if (intel_rotation_90_or_270(rotation))
+	if (drm_rotation_90_or_270(rotation))
 		drm_rect_rotate(&plane_state->base.src,
 				fb->width, fb->height, DRM_ROTATE_270);
 
@@ -3276,7 +3276,7 @@ u32 skl_plane_stride(const struct drm_framebuffer *fb, int plane,
 	 * The stride is either expressed as a multiple of 64 bytes chunks for
 	 * linear buffers or in number of tiles for tiled buffers.
 	 */
-	if (intel_rotation_90_or_270(rotation)) {
+	if (drm_rotation_90_or_270(rotation)) {
 		int cpp = drm_format_plane_cpp(fb->pixel_format, plane);
 
 		stride /= intel_tile_height(dev_priv, fb->modifier[0], cpp);
@@ -4667,7 +4667,7 @@ skl_update_scaler(struct intel_crtc_state *crtc_state, bool force_detach,
 		to_intel_crtc(crtc_state->base.crtc);
 	int need_scaling;
 
-	need_scaling = intel_rotation_90_or_270(rotation) ?
+	need_scaling = drm_rotation_90_or_270(rotation) ?
 		(src_h != dst_w || src_w != dst_h):
 		(src_w != dst_w || src_h != dst_h);
 
diff --git a/drivers/gpu/drm/i915/intel_drv.h b/drivers/gpu/drm/i915/intel_drv.h
index 9ce26112da22..ea8516297370 100644
--- a/drivers/gpu/drm/i915/intel_drv.h
+++ b/drivers/gpu/drm/i915/intel_drv.h
@@ -1288,12 +1288,6 @@ int intel_plane_atomic_calc_changes(struct drm_crtc_state *crtc_state,
 unsigned int intel_tile_height(const struct drm_i915_private *dev_priv,
 			       uint64_t fb_modifier, unsigned int cpp);
 
-static inline bool
-intel_rotation_90_or_270(unsigned int rotation)
-{
-	return rotation & (DRM_ROTATE_90 | DRM_ROTATE_270);
-}
-
 void intel_create_rotation_property(struct drm_device *dev,
 					struct intel_plane *plane);
 
diff --git a/drivers/gpu/drm/i915/intel_fbc.c b/drivers/gpu/drm/i915/intel_fbc.c
index 617189ae04b4..49048d9d7895 100644
--- a/drivers/gpu/drm/i915/intel_fbc.c
+++ b/drivers/gpu/drm/i915/intel_fbc.c
@@ -84,7 +84,7 @@ static void intel_fbc_get_plane_source_size(struct intel_fbc_state_cache *cache,
 {
 	int w, h;
 
-	if (intel_rotation_90_or_270(cache->plane.rotation)) {
+	if (drm_rotation_90_or_270(cache->plane.rotation)) {
 		w = cache->plane.src_h;
 		h = cache->plane.src_w;
 	} else {
diff --git a/drivers/gpu/drm/i915/intel_pm.c b/drivers/gpu/drm/i915/intel_pm.c
index 2df06b703e3d..1472400ddce3 100644
--- a/drivers/gpu/drm/i915/intel_pm.c
+++ b/drivers/gpu/drm/i915/intel_pm.c
@@ -3151,7 +3151,7 @@ skl_plane_downscale_amount(const struct intel_plane_state *pstate)
 	src_h = drm_rect_height(&pstate->base.src);
 	dst_w = drm_rect_width(&pstate->base.dst);
 	dst_h = drm_rect_height(&pstate->base.dst);
-	if (intel_rotation_90_or_270(pstate->base.rotation))
+	if (drm_rotation_90_or_270(pstate->base.rotation))
 		swap(dst_w, dst_h);
 
 	downscale_h = max(src_h / dst_h, (uint32_t)DRM_PLANE_HELPER_NO_SCALING);
@@ -3182,7 +3182,7 @@ skl_plane_relative_data_rate(const struct intel_crtc_state *cstate,
 	width = drm_rect_width(&intel_pstate->base.src) >> 16;
 	height = drm_rect_height(&intel_pstate->base.src) >> 16;
 
-	if (intel_rotation_90_or_270(pstate->rotation))
+	if (drm_rotation_90_or_270(pstate->rotation))
 		swap(width, height);
 
 	/* for planar format */
@@ -3282,7 +3282,7 @@ skl_ddb_min_alloc(const struct drm_plane_state *pstate,
 	src_w = drm_rect_width(&intel_pstate->base.src) >> 16;
 	src_h = drm_rect_height(&intel_pstate->base.src) >> 16;
 
-	if (intel_rotation_90_or_270(pstate->rotation))
+	if (drm_rotation_90_or_270(pstate->rotation))
 		swap(src_w, src_h);
 
 	/* Halve UV plane width and height for NV12 */
@@ -3296,7 +3296,7 @@ skl_ddb_min_alloc(const struct drm_plane_state *pstate,
 	else
 		plane_bpp = drm_format_plane_cpp(fb->pixel_format, 0);
 
-	if (intel_rotation_90_or_270(pstate->rotation)) {
+	if (drm_rotation_90_or_270(pstate->rotation)) {
 		switch (plane_bpp) {
 		case 1:
 			min_scanlines = 32;
@@ -3554,7 +3554,7 @@ static int skl_compute_plane_wm(const struct drm_i915_private *dev_priv,
 	width = drm_rect_width(&intel_pstate->base.src) >> 16;
 	height = drm_rect_height(&intel_pstate->base.src) >> 16;
 
-	if (intel_rotation_90_or_270(pstate->rotation))
+	if (drm_rotation_90_or_270(pstate->rotation))
 		swap(width, height);
 
 	cpp = drm_format_plane_cpp(fb->pixel_format, 0);
@@ -3575,7 +3575,7 @@ static int skl_compute_plane_wm(const struct drm_i915_private *dev_priv,
 	    fb->modifier[0] == I915_FORMAT_MOD_Yf_TILED) {
 		uint32_t min_scanlines = 4;
 		uint32_t y_tile_minimum;
-		if (intel_rotation_90_or_270(pstate->rotation)) {
+		if (drm_rotation_90_or_270(pstate->rotation)) {
 			int cpp = (fb->pixel_format == DRM_FORMAT_NV12) ?
 				drm_format_plane_cpp(fb->pixel_format, 1) :
 				drm_format_plane_cpp(fb->pixel_format, 0);
diff --git a/drivers/gpu/drm/omapdrm/omap_plane.c b/drivers/gpu/drm/omapdrm/omap_plane.c
index 66ac8c40db26..1549e8393056 100644
--- a/drivers/gpu/drm/omapdrm/omap_plane.c
+++ b/drivers/gpu/drm/omapdrm/omap_plane.c
@@ -108,16 +108,12 @@ static void omap_plane_atomic_update(struct drm_plane *plane,
 	win.src_x = state->src_x >> 16;
 	win.src_y = state->src_y >> 16;
 
-	switch (state->rotation & DRM_ROTATE_MASK) {
-	case DRM_ROTATE_90:
-	case DRM_ROTATE_270:
+	if (drm_rotation_90_or_270(state->rotation)) {
 		win.src_w = state->src_h >> 16;
 		win.src_h = state->src_w >> 16;
-		break;
-	default:
+	} else {
 		win.src_w = state->src_w >> 16;
 		win.src_h = state->src_h >> 16;
-		break;
 	}
 
 	/* update scanout: */
diff --git a/include/drm/drm_blend.h b/include/drm/drm_blend.h
index 36baa175de99..bb493410396c 100644
--- a/include/drm/drm_blend.h
+++ b/include/drm/drm_blend.h
@@ -47,6 +47,11 @@ struct drm_atomic_state;
 #define DRM_REFLECT_Y	BIT(5)
 #define DRM_REFLECT_MASK (DRM_REFLECT_X | DRM_REFLECT_Y)
 
+static inline bool drm_rotation_90_or_270(unsigned int rotation)
+{
+	return rotation & (DRM_ROTATE_90 | DRM_ROTATE_270);
+}
+
 struct drm_property *drm_mode_create_rotation_property(struct drm_device *dev,
 						       unsigned int supported_rotations);
 unsigned int drm_rotation_simplify(unsigned int rotation,
-- 
2.7.4

_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

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

* [PATCH 02/15] drm/atomic: Reject attempts to use multiple rotation angles at once
  2016-09-26 16:30 [PATCH v2 00/16] drm: drm: Per-plane rotation etc ville.syrjala
  2016-09-26 16:30 ` [PATCH v2 01/15] drm: Add drm_rotation_90_or_270() ville.syrjala
@ 2016-09-26 16:30 ` ville.syrjala
  2016-09-26 16:30 ` [PATCH v3 03/15] drm: Add support for optional per-plane rotation property ville.syrjala
                   ` (15 subsequent siblings)
  17 siblings, 0 replies; 32+ messages in thread
From: ville.syrjala @ 2016-09-26 16:30 UTC (permalink / raw)
  To: dri-devel; +Cc: intel-gfx

From: Ville Syrjälä <ville.syrjala@linux.intel.com>

The rotation property should only accept exactly one rotation angle
at once. Let's reject attempts to set none or multiple angles.

Testcase: igt/kms_rotation_crc/bad-rotation
Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Reviewed-by: Joonas Lahtinen <joonas.lahtinen@linux.intel.com>
Reviewed-by: Chris Wilson <chris@chris-wilson.co.uk>
---
 drivers/gpu/drm/drm_atomic.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/gpu/drm/drm_atomic.c b/drivers/gpu/drm/drm_atomic.c
index 23739609427d..58b90c247153 100644
--- a/drivers/gpu/drm/drm_atomic.c
+++ b/drivers/gpu/drm/drm_atomic.c
@@ -710,6 +710,8 @@ int drm_atomic_plane_set_property(struct drm_plane *plane,
 	} else if (property == config->prop_src_h) {
 		state->src_h = val;
 	} else if (property == config->rotation_property) {
+		if (!is_power_of_2(val & DRM_ROTATE_MASK))
+			return -EINVAL;
 		state->rotation = val;
 	} else if (property == plane->zpos_property) {
 		state->zpos = val;
-- 
2.7.4

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

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

* [PATCH v3 03/15] drm: Add support for optional per-plane rotation property
  2016-09-26 16:30 [PATCH v2 00/16] drm: drm: Per-plane rotation etc ville.syrjala
  2016-09-26 16:30 ` [PATCH v2 01/15] drm: Add drm_rotation_90_or_270() ville.syrjala
  2016-09-26 16:30 ` [PATCH 02/15] drm/atomic: Reject attempts to use multiple rotation angles at once ville.syrjala
@ 2016-09-26 16:30 ` ville.syrjala
  2016-09-27  9:54   ` [Intel-gfx] " Joonas Lahtinen
  2016-09-26 16:30 ` [PATCH v2 04/15] drm/arm: Use " ville.syrjala
                   ` (14 subsequent siblings)
  17 siblings, 1 reply; 32+ messages in thread
From: ville.syrjala @ 2016-09-26 16:30 UTC (permalink / raw)
  To: dri-devel; +Cc: intel-gfx

From: Ville Syrjälä <ville.syrjala@linux.intel.com>

Not all planes on the system may support the same rotations/reflections,
so make it possible to create a separate property for each plane.
This way userspace gets told exactly which rotations/reflections are
possible for each plane.

v2: Add drm_plane_create_rotation_property() helper
v3: Drop the BIT(), __builtin_ffs(x) - 1,
    Moar WARNs for bad parameters
    Deal with superfluous code shuffling

Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Reviewed-by: Chris Wilson <chris@chris-wilson.co.uk> (v1)
Reviewed-by: Joonas Lahtinen <joonas.lahtinen@linux.intel.com> (v2)
---
 drivers/gpu/drm/drm_atomic.c    |  6 ++++--
 drivers/gpu/drm/drm_blend.c     | 35 +++++++++++++++++++++++++++++++++++
 drivers/gpu/drm/drm_fb_helper.c |  6 +++++-
 include/drm/drm_blend.h         |  3 +++
 include/drm/drm_plane.h         |  2 ++
 5 files changed, 49 insertions(+), 3 deletions(-)

diff --git a/drivers/gpu/drm/drm_atomic.c b/drivers/gpu/drm/drm_atomic.c
index 58b90c247153..a747bb1d486f 100644
--- a/drivers/gpu/drm/drm_atomic.c
+++ b/drivers/gpu/drm/drm_atomic.c
@@ -709,7 +709,8 @@ int drm_atomic_plane_set_property(struct drm_plane *plane,
 		state->src_w = val;
 	} else if (property == config->prop_src_h) {
 		state->src_h = val;
-	} else if (property == config->rotation_property) {
+	} else if (property == config->rotation_property ||
+		   property == plane->rotation_property) {
 		if (!is_power_of_2(val & DRM_ROTATE_MASK))
 			return -EINVAL;
 		state->rotation = val;
@@ -769,7 +770,8 @@ drm_atomic_plane_get_property(struct drm_plane *plane,
 		*val = state->src_w;
 	} else if (property == config->prop_src_h) {
 		*val = state->src_h;
-	} else if (property == config->rotation_property) {
+	} else if (property == config->rotation_property ||
+		   property == plane->rotation_property) {
 		*val = state->rotation;
 	} else if (property == plane->zpos_property) {
 		*val = state->zpos;
diff --git a/drivers/gpu/drm/drm_blend.c b/drivers/gpu/drm/drm_blend.c
index 85172a977bf3..e52aece30900 100644
--- a/drivers/gpu/drm/drm_blend.c
+++ b/drivers/gpu/drm/drm_blend.c
@@ -162,6 +162,41 @@ struct drm_property *drm_mode_create_rotation_property(struct drm_device *dev,
 }
 EXPORT_SYMBOL(drm_mode_create_rotation_property);
 
+int drm_plane_create_rotation_property(struct drm_plane *plane,
+				       unsigned int rotation,
+				       unsigned int supported_rotations)
+{
+	static const struct drm_prop_enum_list props[] = {
+		{ __builtin_ffs(DRM_ROTATE_0) - 1,   "rotate-0" },
+		{ __builtin_ffs(DRM_ROTATE_90) - 1,  "rotate-90" },
+		{ __builtin_ffs(DRM_ROTATE_180) - 1, "rotate-180" },
+		{ __builtin_ffs(DRM_ROTATE_270) - 1, "rotate-270" },
+		{ __builtin_ffs(DRM_REFLECT_X) - 1,  "reflect-x" },
+		{ __builtin_ffs(DRM_REFLECT_Y) - 1,  "reflect-y" },
+	};
+	struct drm_property *prop;
+
+	WARN_ON((supported_rotations & DRM_ROTATE_MASK) == 0);
+	WARN_ON(!is_power_of_2(rotation & DRM_ROTATE_MASK));
+	WARN_ON(rotation & ~supported_rotations);
+
+	prop = drm_property_create_bitmask(plane->dev, 0, "rotation",
+					   props, ARRAY_SIZE(props),
+					   supported_rotations);
+	if (!prop)
+		return -ENOMEM;
+
+	drm_object_attach_property(&plane->base, prop, rotation);
+
+	if (plane->state)
+		plane->state->rotation = rotation;
+
+	plane->rotation_property = prop;
+
+	return 0;
+}
+EXPORT_SYMBOL(drm_plane_create_rotation_property);
+
 /**
  * drm_rotation_simplify() - Try to simplify the rotation
  * @rotation: Rotation to be simplified
diff --git a/drivers/gpu/drm/drm_fb_helper.c b/drivers/gpu/drm/drm_fb_helper.c
index 03414bde1f15..54ca3675a745 100644
--- a/drivers/gpu/drm/drm_fb_helper.c
+++ b/drivers/gpu/drm/drm_fb_helper.c
@@ -394,7 +394,11 @@ static int restore_fbdev_mode(struct drm_fb_helper *fb_helper)
 		if (plane->type != DRM_PLANE_TYPE_PRIMARY)
 			drm_plane_force_disable(plane);
 
-		if (dev->mode_config.rotation_property) {
+		if (plane->rotation_property) {
+			drm_mode_plane_set_obj_prop(plane,
+						    plane->rotation_property,
+						    DRM_ROTATE_0);
+		} else if (dev->mode_config.rotation_property) {
 			drm_mode_plane_set_obj_prop(plane,
 						    dev->mode_config.rotation_property,
 						    DRM_ROTATE_0);
diff --git a/include/drm/drm_blend.h b/include/drm/drm_blend.h
index bb493410396c..fd351924e1c5 100644
--- a/include/drm/drm_blend.h
+++ b/include/drm/drm_blend.h
@@ -54,6 +54,9 @@ static inline bool drm_rotation_90_or_270(unsigned int rotation)
 
 struct drm_property *drm_mode_create_rotation_property(struct drm_device *dev,
 						       unsigned int supported_rotations);
+int drm_plane_create_rotation_property(struct drm_plane *plane,
+				       unsigned int rotation,
+				       unsigned int supported_rotations);
 unsigned int drm_rotation_simplify(unsigned int rotation,
 				   unsigned int supported_rotations);
 
diff --git a/include/drm/drm_plane.h b/include/drm/drm_plane.h
index 43cf193e54d6..02d1882058e5 100644
--- a/include/drm/drm_plane.h
+++ b/include/drm/drm_plane.h
@@ -386,6 +386,7 @@ enum drm_plane_type {
  * @type: type of plane (overlay, primary, cursor)
  * @state: current atomic state for this plane
  * @zpos_property: zpos property for this plane
+ * @rotation_property: rotation property for this plane
  * @helper_private: mid-layer private data
  */
 struct drm_plane {
@@ -432,6 +433,7 @@ struct drm_plane {
 	struct drm_plane_state *state;
 
 	struct drm_property *zpos_property;
+	struct drm_property *rotation_property;
 };
 
 #define obj_to_plane(x) container_of(x, struct drm_plane, base)
-- 
2.7.4

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

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

* [PATCH v2 04/15] drm/arm: Use per-plane rotation property
  2016-09-26 16:30 [PATCH v2 00/16] drm: drm: Per-plane rotation etc ville.syrjala
                   ` (2 preceding siblings ...)
  2016-09-26 16:30 ` [PATCH v3 03/15] drm: Add support for optional per-plane rotation property ville.syrjala
@ 2016-09-26 16:30 ` ville.syrjala
  2016-09-26 16:30 ` [PATCH v3 05/15] drm/atmel-hlcdc: " ville.syrjala
                   ` (13 subsequent siblings)
  17 siblings, 0 replies; 32+ messages in thread
From: ville.syrjala @ 2016-09-26 16:30 UTC (permalink / raw)
  To: dri-devel; +Cc: Mali DP Maintainers, intel-gfx, Liviu Dudau

From: Ville Syrjälä <ville.syrjala@linux.intel.com>

The global mode_config.rotation_property is going away, switch over to
per-plane rotation_property.

v2: Drop the BIT()

Cc: Liviu Dudau <liviu.dudau@arm.com>
Cc: Brian Starkey <brian.starkey@arm.com>
Cc: Mali DP Maintainers <malidp@foss.arm.com>
Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Acked-by: Brian Starkey <brian.starkey@arm.com>
---
 drivers/gpu/drm/arm/malidp_planes.c | 13 +++++--------
 1 file changed, 5 insertions(+), 8 deletions(-)

diff --git a/drivers/gpu/drm/arm/malidp_planes.c b/drivers/gpu/drm/arm/malidp_planes.c
index 82c193e5e0d6..abaca03b9d36 100644
--- a/drivers/gpu/drm/arm/malidp_planes.c
+++ b/drivers/gpu/drm/arm/malidp_planes.c
@@ -254,21 +254,18 @@ int malidp_de_planes_init(struct drm_device *drm)
 		if (ret < 0)
 			goto cleanup;
 
-		if (!drm->mode_config.rotation_property) {
+		/* SMART layer can't be rotated */
+		if (id != DE_SMART) {
 			unsigned long flags = DRM_ROTATE_0 |
 					      DRM_ROTATE_90 |
 					      DRM_ROTATE_180 |
 					      DRM_ROTATE_270 |
 					      DRM_REFLECT_X |
 					      DRM_REFLECT_Y;
-			drm->mode_config.rotation_property =
-				drm_mode_create_rotation_property(drm, flags);
+			drm_plane_create_rotation_property(&plane->base,
+							   DRM_ROTATE_0,
+							   flags);
 		}
-		/* SMART layer can't be rotated */
-		if (drm->mode_config.rotation_property && (id != DE_SMART))
-			drm_object_attach_property(&plane->base.base,
-						   drm->mode_config.rotation_property,
-						   DRM_ROTATE_0);
 
 		drm_plane_helper_add(&plane->base,
 				     &malidp_de_plane_helper_funcs);
-- 
2.7.4

_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

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

* [PATCH v3 05/15] drm/atmel-hlcdc: Use per-plane rotation property
  2016-09-26 16:30 [PATCH v2 00/16] drm: drm: Per-plane rotation etc ville.syrjala
                   ` (3 preceding siblings ...)
  2016-09-26 16:30 ` [PATCH v2 04/15] drm/arm: Use " ville.syrjala
@ 2016-09-26 16:30 ` ville.syrjala
  2016-09-26 16:30 ` [PATCH v2 06/15] drm/omap: Set rotation property initial value to BIT(DRM_ROTATE_0) insted of 0 ville.syrjala
                   ` (12 subsequent siblings)
  17 siblings, 0 replies; 32+ messages in thread
From: ville.syrjala @ 2016-09-26 16:30 UTC (permalink / raw)
  To: dri-devel; +Cc: Boris Brezillon, intel-gfx

From: Ville Syrjälä <ville.syrjala@linux.intel.com>

The global mode_config.rotation_property is going away, switch over to
per-plane rotation_property.

v2: Propagate error upwards (Boris)
v3: Drop the BIT()

Cc: Boris Brezillon <boris.brezillon@free-electrons.com>
Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Acked-by: Boris Brezillon <boris.brezillon@free-electrons.com>
---
 drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_plane.c | 37 +++++++++++++------------
 1 file changed, 20 insertions(+), 17 deletions(-)

diff --git a/drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_plane.c b/drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_plane.c
index b380179d4013..246ed1e33d8a 100644
--- a/drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_plane.c
+++ b/drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_plane.c
@@ -883,9 +883,9 @@ static int atmel_hlcdc_plane_atomic_get_property(struct drm_plane *p,
 	return 0;
 }
 
-static void atmel_hlcdc_plane_init_properties(struct atmel_hlcdc_plane *plane,
-				const struct atmel_hlcdc_layer_desc *desc,
-				struct atmel_hlcdc_plane_properties *props)
+static int atmel_hlcdc_plane_init_properties(struct atmel_hlcdc_plane *plane,
+					     const struct atmel_hlcdc_layer_desc *desc,
+					     struct atmel_hlcdc_plane_properties *props)
 {
 	struct regmap *regmap = plane->layer.hlcdc->regmap;
 
@@ -902,10 +902,18 @@ static void atmel_hlcdc_plane_init_properties(struct atmel_hlcdc_plane *plane,
 				ATMEL_HLCDC_LAYER_GA_MASK);
 	}
 
-	if (desc->layout.xstride && desc->layout.pstride)
-		drm_object_attach_property(&plane->base.base,
-				plane->base.dev->mode_config.rotation_property,
-				DRM_ROTATE_0);
+	if (desc->layout.xstride && desc->layout.pstride) {
+		int ret;
+
+		ret = drm_plane_create_rotation_property(&plane->base,
+							 DRM_ROTATE_0,
+							 DRM_ROTATE_0 |
+							 DRM_ROTATE_90 |
+							 DRM_ROTATE_180 |
+							 DRM_ROTATE_270);
+		if (ret)
+			return ret;
+	}
 
 	if (desc->layout.csc) {
 		/*
@@ -925,6 +933,8 @@ static void atmel_hlcdc_plane_init_properties(struct atmel_hlcdc_plane *plane,
 			     ATMEL_HLCDC_LAYER_CSC_CFG(&plane->layer, 2),
 			     0x40040890);
 	}
+
+	return 0;
 }
 
 static struct drm_plane_helper_funcs atmel_hlcdc_layer_plane_helper_funcs = {
@@ -1036,7 +1046,9 @@ atmel_hlcdc_plane_create(struct drm_device *dev,
 			     &atmel_hlcdc_layer_plane_helper_funcs);
 
 	/* Set default property values*/
-	atmel_hlcdc_plane_init_properties(plane, desc, props);
+	ret = atmel_hlcdc_plane_init_properties(plane, desc, props);
+	if (ret)
+		return ERR_PTR(ret);
 
 	return plane;
 }
@@ -1054,15 +1066,6 @@ atmel_hlcdc_plane_create_properties(struct drm_device *dev)
 	if (!props->alpha)
 		return ERR_PTR(-ENOMEM);
 
-	dev->mode_config.rotation_property =
-			drm_mode_create_rotation_property(dev,
-							  DRM_ROTATE_0 |
-							  DRM_ROTATE_90 |
-							  DRM_ROTATE_180 |
-							  DRM_ROTATE_270);
-	if (!dev->mode_config.rotation_property)
-		return ERR_PTR(-ENOMEM);
-
 	return props;
 }
 
-- 
2.7.4

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

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

* [PATCH v2 06/15] drm/omap: Set rotation property initial value to BIT(DRM_ROTATE_0) insted of 0
  2016-09-26 16:30 [PATCH v2 00/16] drm: drm: Per-plane rotation etc ville.syrjala
                   ` (4 preceding siblings ...)
  2016-09-26 16:30 ` [PATCH v3 05/15] drm/atmel-hlcdc: " ville.syrjala
@ 2016-09-26 16:30 ` ville.syrjala
  2016-09-26 16:30 ` [PATCH v2 07/15] drm/omap: Use per-plane rotation property ville.syrjala
                   ` (11 subsequent siblings)
  17 siblings, 0 replies; 32+ messages in thread
From: ville.syrjala @ 2016-09-26 16:30 UTC (permalink / raw)
  To: dri-devel; +Cc: intel-gfx, Tomi Valkeinen

From: Ville Syrjälä <ville.syrjala@linux.intel.com>

0 isn't a valid rotation property value, so let's set the initial value
of the property to BIT(DRM_ROTATE_0) instead.

v2: Drop the BIT()

Cc: Tomi Valkeinen <tomi.valkeinen@ti.com>
Cc: Rob Clark <robdclark@gmail.com>
Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
---
 drivers/gpu/drm/omapdrm/omap_drv.c   | 6 ++++--
 drivers/gpu/drm/omapdrm/omap_plane.c | 2 +-
 2 files changed, 5 insertions(+), 3 deletions(-)

diff --git a/drivers/gpu/drm/omapdrm/omap_drv.c b/drivers/gpu/drm/omapdrm/omap_drv.c
index e1cfba51cff6..ae7f9c099aa0 100644
--- a/drivers/gpu/drm/omapdrm/omap_drv.c
+++ b/drivers/gpu/drm/omapdrm/omap_drv.c
@@ -761,12 +761,14 @@ static void dev_lastclose(struct drm_device *dev)
 		 */
 		for (i = 0; i < priv->num_crtcs; i++) {
 			drm_object_property_set_value(&priv->crtcs[i]->base,
-					dev->mode_config.rotation_property, 0);
+					dev->mode_config.rotation_property,
+					DRM_ROTATE_0);
 		}
 
 		for (i = 0; i < priv->num_planes; i++) {
 			drm_object_property_set_value(&priv->planes[i]->base,
-					dev->mode_config.rotation_property, 0);
+					dev->mode_config.rotation_property,
+					DRM_ROTATE_0);
 		}
 	}
 
diff --git a/drivers/gpu/drm/omapdrm/omap_plane.c b/drivers/gpu/drm/omapdrm/omap_plane.c
index 1549e8393056..6ddaa5ea4b6b 100644
--- a/drivers/gpu/drm/omapdrm/omap_plane.c
+++ b/drivers/gpu/drm/omapdrm/omap_plane.c
@@ -213,7 +213,7 @@ void omap_plane_install_properties(struct drm_plane *plane,
 	if (priv->has_dmm) {
 		struct drm_property *prop = dev->mode_config.rotation_property;
 
-		drm_object_attach_property(obj, prop, 0);
+		drm_object_attach_property(obj, prop, DRM_ROTATE_0);
 	}
 
 	drm_object_attach_property(obj, priv->zorder_prop, 0);
-- 
2.7.4

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

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

* [PATCH v2 07/15] drm/omap: Use per-plane rotation property
  2016-09-26 16:30 [PATCH v2 00/16] drm: drm: Per-plane rotation etc ville.syrjala
                   ` (5 preceding siblings ...)
  2016-09-26 16:30 ` [PATCH v2 06/15] drm/omap: Set rotation property initial value to BIT(DRM_ROTATE_0) insted of 0 ville.syrjala
@ 2016-09-26 16:30 ` ville.syrjala
  2016-10-06  9:59   ` Tomi Valkeinen
  2016-09-26 16:30 ` [PATCH v2 08/15] drm/msm/mdp5: Set rotation property initial value to BIT(DRM_ROTATE_0) insted of 0 ville.syrjala
                   ` (10 subsequent siblings)
  17 siblings, 1 reply; 32+ messages in thread
From: ville.syrjala @ 2016-09-26 16:30 UTC (permalink / raw)
  To: dri-devel; +Cc: intel-gfx, Tomi Valkeinen

From: Ville Syrjälä <ville.syrjala@linux.intel.com>

The global mode_config.rotation_property is going away, switch over to
per-plane rotation_property.

Not sure I got the annoying crtc rotation_property handling right.
Might work, or migth not.

v2: Drop the BIT()
    Don't create rotation property twice for each primary plane

Cc: Tomi Valkeinen <tomi.valkeinen@ti.com>
Cc: Rob Clark <robdclark@gmail.com>
Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
---
 drivers/gpu/drm/omapdrm/omap_crtc.c  | 13 ++++-----
 drivers/gpu/drm/omapdrm/omap_drv.c   | 52 +++++++++++++++++-------------------
 drivers/gpu/drm/omapdrm/omap_plane.c | 13 ++++++---
 3 files changed, 40 insertions(+), 38 deletions(-)

diff --git a/drivers/gpu/drm/omapdrm/omap_crtc.c b/drivers/gpu/drm/omapdrm/omap_crtc.c
index 180f644e861e..16c691dbc372 100644
--- a/drivers/gpu/drm/omapdrm/omap_crtc.c
+++ b/drivers/gpu/drm/omapdrm/omap_crtc.c
@@ -438,13 +438,14 @@ static void omap_crtc_atomic_flush(struct drm_crtc *crtc,
 	}
 }
 
-static bool omap_crtc_is_plane_prop(struct drm_device *dev,
+static bool omap_crtc_is_plane_prop(struct drm_crtc *crtc,
 	struct drm_property *property)
 {
+	struct drm_device *dev = crtc->dev;
 	struct omap_drm_private *priv = dev->dev_private;
 
 	return property == priv->zorder_prop ||
-		property == dev->mode_config.rotation_property;
+		property == crtc->primary->rotation_property;
 }
 
 static int omap_crtc_atomic_set_property(struct drm_crtc *crtc,
@@ -452,9 +453,7 @@ static int omap_crtc_atomic_set_property(struct drm_crtc *crtc,
 					 struct drm_property *property,
 					 uint64_t val)
 {
-	struct drm_device *dev = crtc->dev;
-
-	if (omap_crtc_is_plane_prop(dev, property)) {
+	if (omap_crtc_is_plane_prop(crtc, property)) {
 		struct drm_plane_state *plane_state;
 		struct drm_plane *plane = crtc->primary;
 
@@ -479,9 +478,7 @@ static int omap_crtc_atomic_get_property(struct drm_crtc *crtc,
 					 struct drm_property *property,
 					 uint64_t *val)
 {
-	struct drm_device *dev = crtc->dev;
-
-	if (omap_crtc_is_plane_prop(dev, property)) {
+	if (omap_crtc_is_plane_prop(crtc, property)) {
 		/*
 		 * Delegate property get to the primary plane. The
 		 * drm_atomic_plane_get_property() function isn't exported, but
diff --git a/drivers/gpu/drm/omapdrm/omap_drv.c b/drivers/gpu/drm/omapdrm/omap_drv.c
index ae7f9c099aa0..05cd2cf67ea3 100644
--- a/drivers/gpu/drm/omapdrm/omap_drv.c
+++ b/drivers/gpu/drm/omapdrm/omap_drv.c
@@ -292,16 +292,6 @@ static int omap_modeset_init_properties(struct drm_device *dev)
 {
 	struct omap_drm_private *priv = dev->dev_private;
 
-	if (priv->has_dmm) {
-		dev->mode_config.rotation_property =
-			drm_mode_create_rotation_property(dev,
-				DRM_ROTATE_0 | DRM_ROTATE_90 |
-				DRM_ROTATE_180 | DRM_ROTATE_270 |
-				DRM_REFLECT_X | DRM_REFLECT_Y);
-		if (!dev->mode_config.rotation_property)
-			return -ENOMEM;
-	}
-
 	priv->zorder_prop = drm_property_create_range(dev, 0, "zorder", 0, 3);
 	if (!priv->zorder_prop)
 		return -ENOMEM;
@@ -752,24 +742,32 @@ static void dev_lastclose(struct drm_device *dev)
 
 	DBG("lastclose: dev=%p", dev);
 
-	if (dev->mode_config.rotation_property) {
-		/* need to restore default rotation state.. not sure
-		 * if there is a cleaner way to restore properties to
-		 * default state?  Maybe a flag that properties should
-		 * automatically be restored to default state on
-		 * lastclose?
-		 */
-		for (i = 0; i < priv->num_crtcs; i++) {
-			drm_object_property_set_value(&priv->crtcs[i]->base,
-					dev->mode_config.rotation_property,
-					DRM_ROTATE_0);
-		}
+	/* need to restore default rotation state.. not sure
+	 * if there is a cleaner way to restore properties to
+	 * default state?  Maybe a flag that properties should
+	 * automatically be restored to default state on
+	 * lastclose?
+	 */
+	for (i = 0; i < priv->num_crtcs; i++) {
+		struct drm_crtc *crtc = priv->crtcs[i];
 
-		for (i = 0; i < priv->num_planes; i++) {
-			drm_object_property_set_value(&priv->planes[i]->base,
-					dev->mode_config.rotation_property,
-					DRM_ROTATE_0);
-		}
+		if (!crtc->primary->rotation_property)
+			continue;
+
+		drm_object_property_set_value(&crtc->base,
+					      crtc->primary->rotation_property,
+					      DRM_ROTATE_0);
+	}
+
+	for (i = 0; i < priv->num_planes; i++) {
+		struct drm_plane *plane = priv->planes[i];
+
+		if (!plane->rotation_property)
+			continue;
+
+		drm_object_property_set_value(&plane->base,
+					      plane->rotation_property,
+					      DRM_ROTATE_0);
 	}
 
 	if (priv->fbdev) {
diff --git a/drivers/gpu/drm/omapdrm/omap_plane.c b/drivers/gpu/drm/omapdrm/omap_plane.c
index 6ddaa5ea4b6b..b272f810989e 100644
--- a/drivers/gpu/drm/omapdrm/omap_plane.c
+++ b/drivers/gpu/drm/omapdrm/omap_plane.c
@@ -211,9 +211,16 @@ void omap_plane_install_properties(struct drm_plane *plane,
 	struct omap_drm_private *priv = dev->dev_private;
 
 	if (priv->has_dmm) {
-		struct drm_property *prop = dev->mode_config.rotation_property;
-
-		drm_object_attach_property(obj, prop, DRM_ROTATE_0);
+		if (!plane->rotation_property)
+			drm_plane_create_rotation_property(plane,
+							   DRM_ROTATE_0,
+							   DRM_ROTATE_0 | DRM_ROTATE_90 |
+							   DRM_ROTATE_180 | DRM_ROTATE_270 |
+							   DRM_REFLECT_X | DRM_REFLECT_Y);
+
+		if (plane->rotation_property && obj != &plane->base)
+			drm_object_attach_property(obj, plane->rotation_property,
+						   DRM_ROTATE_0);
 	}
 
 	drm_object_attach_property(obj, priv->zorder_prop, 0);
-- 
2.7.4

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

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

* [PATCH v2 08/15] drm/msm/mdp5: Set rotation property initial value to BIT(DRM_ROTATE_0) insted of 0
  2016-09-26 16:30 [PATCH v2 00/16] drm: drm: Per-plane rotation etc ville.syrjala
                   ` (6 preceding siblings ...)
  2016-09-26 16:30 ` [PATCH v2 07/15] drm/omap: Use per-plane rotation property ville.syrjala
@ 2016-09-26 16:30 ` ville.syrjala
  2016-10-21 16:26   ` Daniel Vetter
  2016-09-26 16:30 ` [PATCH v2 09/15] drm/msm/mdp5: Use per-plane rotation property ville.syrjala
                   ` (9 subsequent siblings)
  17 siblings, 1 reply; 32+ messages in thread
From: ville.syrjala @ 2016-09-26 16:30 UTC (permalink / raw)
  To: dri-devel; +Cc: intel-gfx

From: Ville Syrjälä <ville.syrjala@linux.intel.com>

0 isn't a valid rotation property value, so let's set the initial value
of the property to BIT(DRM_ROTATE_0) instead.

In the same vein, we must always have at leat one angle as part of
set of supported rotation bits, so let's include DRM_ROTATE_0
in there.

v2: Drop the BIT()

Cc: Rob Clark <robdclark@gmail.com>
Cc: Jilai Wang <jilaiw@codeaurora.org>
Cc: Archit Taneja <architt@codeaurora.org>
Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
---
 drivers/gpu/drm/msm/mdp/mdp5/mdp5_plane.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/gpu/drm/msm/mdp/mdp5/mdp5_plane.c b/drivers/gpu/drm/msm/mdp/mdp5/mdp5_plane.c
index ba8f43278a44..b0ecf5357bfd 100644
--- a/drivers/gpu/drm/msm/mdp/mdp5/mdp5_plane.c
+++ b/drivers/gpu/drm/msm/mdp/mdp5/mdp5_plane.c
@@ -78,12 +78,12 @@ static void mdp5_plane_install_rotation_property(struct drm_device *dev,
 	if (!dev->mode_config.rotation_property)
 		dev->mode_config.rotation_property =
 			drm_mode_create_rotation_property(dev,
-			DRM_REFLECT_X | DRM_REFLECT_Y);
+			DRM_ROTATE_0 | DRM_REFLECT_X | DRM_REFLECT_Y);
 
 	if (dev->mode_config.rotation_property)
 		drm_object_attach_property(&plane->base,
 			dev->mode_config.rotation_property,
-			0);
+			DRM_ROTATE_0);
 }
 
 /* helper to install properties which are common to planes and crtcs */
-- 
2.7.4

_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

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

* [PATCH v2 09/15] drm/msm/mdp5: Use per-plane rotation property
  2016-09-26 16:30 [PATCH v2 00/16] drm: drm: Per-plane rotation etc ville.syrjala
                   ` (7 preceding siblings ...)
  2016-09-26 16:30 ` [PATCH v2 08/15] drm/msm/mdp5: Set rotation property initial value to BIT(DRM_ROTATE_0) insted of 0 ville.syrjala
@ 2016-09-26 16:30 ` ville.syrjala
  2016-09-26 16:30 ` [PATCH v2 10/15] drm/msm/mdp5: Advertize 180 degree rotation ville.syrjala
                   ` (8 subsequent siblings)
  17 siblings, 0 replies; 32+ messages in thread
From: ville.syrjala @ 2016-09-26 16:30 UTC (permalink / raw)
  To: dri-devel; +Cc: intel-gfx

From: Ville Syrjälä <ville.syrjala@linux.intel.com>

The global mode_config.rotation_property is going away, switch over to
per-plane rotation_property.

v2: Drop the BIT()

Cc: Rob Clark <robdclark@gmail.com>
Cc: Jilai Wang <jilaiw@codeaurora.org>
Cc: Archit Taneja <architt@codeaurora.org>
Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
---
 drivers/gpu/drm/msm/mdp/mdp5/mdp5_plane.c | 14 +++++---------
 1 file changed, 5 insertions(+), 9 deletions(-)

diff --git a/drivers/gpu/drm/msm/mdp/mdp5/mdp5_plane.c b/drivers/gpu/drm/msm/mdp/mdp5/mdp5_plane.c
index b0ecf5357bfd..2653ad893ebc 100644
--- a/drivers/gpu/drm/msm/mdp/mdp5/mdp5_plane.c
+++ b/drivers/gpu/drm/msm/mdp/mdp5/mdp5_plane.c
@@ -75,15 +75,11 @@ static void mdp5_plane_install_rotation_property(struct drm_device *dev,
 		!(mdp5_plane->caps & MDP_PIPE_CAP_VFLIP))
 		return;
 
-	if (!dev->mode_config.rotation_property)
-		dev->mode_config.rotation_property =
-			drm_mode_create_rotation_property(dev,
-			DRM_ROTATE_0 | DRM_REFLECT_X | DRM_REFLECT_Y);
-
-	if (dev->mode_config.rotation_property)
-		drm_object_attach_property(&plane->base,
-			dev->mode_config.rotation_property,
-			DRM_ROTATE_0);
+	drm_plane_create_rotation_property(plane,
+					   DRM_ROTATE_0,
+					   DRM_ROTATE_0 |
+					   DRM_REFLECT_X |
+					   DRM_REFLECT_Y);
 }
 
 /* helper to install properties which are common to planes and crtcs */
-- 
2.7.4

_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

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

* [PATCH v2 10/15] drm/msm/mdp5: Advertize 180 degree rotation
  2016-09-26 16:30 [PATCH v2 00/16] drm: drm: Per-plane rotation etc ville.syrjala
                   ` (8 preceding siblings ...)
  2016-09-26 16:30 ` [PATCH v2 09/15] drm/msm/mdp5: Use per-plane rotation property ville.syrjala
@ 2016-09-26 16:30 ` ville.syrjala
  2016-09-26 16:30 ` [PATCH v3 11/15] drm/i915: Use the per-plane rotation property ville.syrjala
                   ` (7 subsequent siblings)
  17 siblings, 0 replies; 32+ messages in thread
From: ville.syrjala @ 2016-09-26 16:30 UTC (permalink / raw)
  To: dri-devel; +Cc: Jilai Wang, intel-gfx, Archit Taneja

From: Ville Syrjälä <ville.syrjala@linux.intel.com>

Since the hardware can apparently do both X and Y reflection, we
can advertize also 180 degree rotation as thats just X+Y reflection.

v2: Drop the BIT()

Cc: Rob Clark <robdclark@gmail.com>
Cc: Jilai Wang <jilaiw@codeaurora.org>
Cc: Archit Taneja <architt@codeaurora.org>
Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
---
 drivers/gpu/drm/msm/mdp/mdp5/mdp5_plane.c | 21 +++++++++++++++++----
 1 file changed, 17 insertions(+), 4 deletions(-)

diff --git a/drivers/gpu/drm/msm/mdp/mdp5/mdp5_plane.c b/drivers/gpu/drm/msm/mdp/mdp5/mdp5_plane.c
index 2653ad893ebc..cf50d3ec8d1b 100644
--- a/drivers/gpu/drm/msm/mdp/mdp5/mdp5_plane.c
+++ b/drivers/gpu/drm/msm/mdp/mdp5/mdp5_plane.c
@@ -78,6 +78,7 @@ static void mdp5_plane_install_rotation_property(struct drm_device *dev,
 	drm_plane_create_rotation_property(plane,
 					   DRM_ROTATE_0,
 					   DRM_ROTATE_0 |
+					   DRM_ROTATE_180 |
 					   DRM_REFLECT_X |
 					   DRM_REFLECT_Y);
 }
@@ -285,6 +286,8 @@ static int mdp5_plane_atomic_check(struct drm_plane *plane,
 			plane_enabled(old_state), plane_enabled(state));
 
 	if (plane_enabled(state)) {
+		unsigned int rotation;
+
 		format = to_mdp_format(msm_framebuffer_format(state->fb));
 		if (MDP_FORMAT_IS_YUV(format) &&
 			!pipe_supports_yuv(mdp5_plane->caps)) {
@@ -305,8 +308,13 @@ static int mdp5_plane_atomic_check(struct drm_plane *plane,
 			return -EINVAL;
 		}
 
-		hflip = !!(state->rotation & DRM_REFLECT_X);
-		vflip = !!(state->rotation & DRM_REFLECT_Y);
+		rotation = drm_rotation_simplify(state->rotation,
+						 DRM_ROTATE_0 |
+						 DRM_REFLECT_X |
+						 DRM_REFLECT_Y);
+		hflip = !!(rotation & DRM_REFLECT_X);
+		vflip = !!(rotation & DRM_REFLECT_Y);
+
 		if ((vflip && !(mdp5_plane->caps & MDP_PIPE_CAP_VFLIP)) ||
 			(hflip && !(mdp5_plane->caps & MDP_PIPE_CAP_HFLIP))) {
 			dev_err(plane->dev->dev,
@@ -677,6 +685,7 @@ static int mdp5_plane_mode_set(struct drm_plane *plane,
 	int pe_top[COMP_MAX], pe_bottom[COMP_MAX];
 	uint32_t hdecm = 0, vdecm = 0;
 	uint32_t pix_format;
+	unsigned int rotation;
 	bool vflip, hflip;
 	unsigned long flags;
 	int ret;
@@ -739,8 +748,12 @@ static int mdp5_plane_mode_set(struct drm_plane *plane,
 	config |= get_scale_config(format, src_h, crtc_h, false);
 	DBG("scale config = %x", config);
 
-	hflip = !!(pstate->rotation & DRM_REFLECT_X);
-	vflip = !!(pstate->rotation & DRM_REFLECT_Y);
+	rotation = drm_rotation_simplify(pstate->rotation,
+					 DRM_ROTATE_0 |
+					 DRM_REFLECT_X |
+					 DRM_REFLECT_Y);
+	hflip = !!(rotation & DRM_REFLECT_X);
+	vflip = !!(rotation & DRM_REFLECT_Y);
 
 	spin_lock_irqsave(&mdp5_plane->pipe_lock, flags);
 
-- 
2.7.4

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

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

* [PATCH v3 11/15] drm/i915: Use the per-plane rotation property
  2016-09-26 16:30 [PATCH v2 00/16] drm: drm: Per-plane rotation etc ville.syrjala
                   ` (9 preceding siblings ...)
  2016-09-26 16:30 ` [PATCH v2 10/15] drm/msm/mdp5: Advertize 180 degree rotation ville.syrjala
@ 2016-09-26 16:30 ` ville.syrjala
  2016-09-27  9:58   ` Joonas Lahtinen
  2016-09-26 16:30 ` [PATCH v2 12/15] drm: RIP mode_config->rotation_property ville.syrjala
                   ` (6 subsequent siblings)
  17 siblings, 1 reply; 32+ messages in thread
From: ville.syrjala @ 2016-09-26 16:30 UTC (permalink / raw)
  To: dri-devel; +Cc: intel-gfx

From: Ville Syrjälä <ville.syrjala@linux.intel.com>

On certain platforms not all planes support the same set of
rotations/reflections, so let's use the per-plane property
for this.

This is already a problem on SKL when we use the legay cursor plane
as it only supports 0|180 whereas the universal planes support
0|90|180|270, and it will be a problem on CHV soon.

v2: Use drm_plane_create_rotation_property() helper
v3: Drop the BIT(), use INTEL_GEN()

Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Reviewed-by: Chris Wilson <chris@chris-wilson.co.uk> (v1)
Reviewed-by: Joonas Lahtinen <joonas.lahtinen@linux.intel.com> (v2)
---
 drivers/gpu/drm/i915/intel_display.c | 52 +++++++++++++++---------------------
 drivers/gpu/drm/i915/intel_drv.h     |  3 ---
 drivers/gpu/drm/i915/intel_sprite.c  | 14 +++++++++-
 3 files changed, 34 insertions(+), 35 deletions(-)

diff --git a/drivers/gpu/drm/i915/intel_display.c b/drivers/gpu/drm/i915/intel_display.c
index 9e475c41b723..bd1642d0f5a8 100644
--- a/drivers/gpu/drm/i915/intel_display.c
+++ b/drivers/gpu/drm/i915/intel_display.c
@@ -14884,6 +14884,7 @@ static struct drm_plane *intel_primary_plane_create(struct drm_device *dev,
 	struct intel_plane *primary = NULL;
 	struct intel_plane_state *state = NULL;
 	const uint32_t *intel_primary_formats;
+	unsigned int supported_rotations;
 	unsigned int num_formats;
 	int ret;
 
@@ -14956,8 +14957,21 @@ static struct drm_plane *intel_primary_plane_create(struct drm_device *dev,
 	if (ret)
 		goto fail;
 
-	if (INTEL_INFO(dev)->gen >= 4)
-		intel_create_rotation_property(dev, primary);
+	if (INTEL_GEN(dev) >= 9) {
+		supported_rotations =
+			DRM_ROTATE_0 | DRM_ROTATE_90 |
+			DRM_ROTATE_180 | DRM_ROTATE_270;
+	} else if (INTEL_GEN(dev) >= 4) {
+		supported_rotations =
+			DRM_ROTATE_0 | DRM_ROTATE_180;
+	} else {
+		supported_rotations = DRM_ROTATE_0;
+	}
+
+	if (INTEL_GEN(dev) >= 4)
+		drm_plane_create_rotation_property(&primary->base,
+						   DRM_ROTATE_0,
+						   supported_rotations);
 
 	drm_plane_helper_add(&primary->base, &intel_plane_helper_funcs);
 
@@ -14970,24 +14984,6 @@ fail:
 	return NULL;
 }
 
-void intel_create_rotation_property(struct drm_device *dev, struct intel_plane *plane)
-{
-	if (!dev->mode_config.rotation_property) {
-		unsigned long flags = DRM_ROTATE_0 |
-			DRM_ROTATE_180;
-
-		if (INTEL_INFO(dev)->gen >= 9)
-			flags |= DRM_ROTATE_90 | DRM_ROTATE_270;
-
-		dev->mode_config.rotation_property =
-			drm_mode_create_rotation_property(dev, flags);
-	}
-	if (dev->mode_config.rotation_property)
-		drm_object_attach_property(&plane->base.base,
-				dev->mode_config.rotation_property,
-				plane->base.state->rotation);
-}
-
 static int
 intel_check_cursor_plane(struct drm_plane *plane,
 			 struct intel_crtc_state *crtc_state,
@@ -15114,17 +15110,11 @@ static struct drm_plane *intel_cursor_plane_create(struct drm_device *dev,
 	if (ret)
 		goto fail;
 
-	if (INTEL_INFO(dev)->gen >= 4) {
-		if (!dev->mode_config.rotation_property)
-			dev->mode_config.rotation_property =
-				drm_mode_create_rotation_property(dev,
-							DRM_ROTATE_0 |
-							DRM_ROTATE_180);
-		if (dev->mode_config.rotation_property)
-			drm_object_attach_property(&cursor->base.base,
-				dev->mode_config.rotation_property,
-				state->base.rotation);
-	}
+	if (INTEL_GEN(dev) >= 4)
+		drm_plane_create_rotation_property(&cursor->base,
+						   DRM_ROTATE_0,
+						   DRM_ROTATE_0 |
+						   DRM_ROTATE_180);
 
 	if (INTEL_INFO(dev)->gen >=9)
 		state->scaler_id = -1;
diff --git a/drivers/gpu/drm/i915/intel_drv.h b/drivers/gpu/drm/i915/intel_drv.h
index ea8516297370..43ebb623358a 100644
--- a/drivers/gpu/drm/i915/intel_drv.h
+++ b/drivers/gpu/drm/i915/intel_drv.h
@@ -1288,9 +1288,6 @@ int intel_plane_atomic_calc_changes(struct drm_crtc_state *crtc_state,
 unsigned int intel_tile_height(const struct drm_i915_private *dev_priv,
 			       uint64_t fb_modifier, unsigned int cpp);
 
-void intel_create_rotation_property(struct drm_device *dev,
-					struct intel_plane *plane);
-
 void assert_pch_transcoder_disabled(struct drm_i915_private *dev_priv,
 				    enum pipe pipe);
 
diff --git a/drivers/gpu/drm/i915/intel_sprite.c b/drivers/gpu/drm/i915/intel_sprite.c
index 73a521fdf1bd..947610dc7b23 100644
--- a/drivers/gpu/drm/i915/intel_sprite.c
+++ b/drivers/gpu/drm/i915/intel_sprite.c
@@ -1046,6 +1046,7 @@ intel_plane_init(struct drm_device *dev, enum pipe pipe, int plane)
 	struct intel_plane_state *state = NULL;
 	unsigned long possible_crtcs;
 	const uint32_t *plane_formats;
+	unsigned int supported_rotations;
 	int num_plane_formats;
 	int ret;
 
@@ -1121,6 +1122,15 @@ intel_plane_init(struct drm_device *dev, enum pipe pipe, int plane)
 		goto fail;
 	}
 
+	if (INTEL_GEN(dev) >= 9) {
+		supported_rotations =
+			DRM_ROTATE_0 | DRM_ROTATE_90 |
+			DRM_ROTATE_180 | DRM_ROTATE_270;
+	} else {
+		supported_rotations =
+			DRM_ROTATE_0 | DRM_ROTATE_180;
+	}
+
 	intel_plane->pipe = pipe;
 	intel_plane->plane = plane;
 	intel_plane->frontbuffer_bit = INTEL_FRONTBUFFER_SPRITE(pipe, plane);
@@ -1143,7 +1153,9 @@ intel_plane_init(struct drm_device *dev, enum pipe pipe, int plane)
 	if (ret)
 		goto fail;
 
-	intel_create_rotation_property(dev, intel_plane);
+	drm_plane_create_rotation_property(&intel_plane->base,
+					   DRM_ROTATE_0,
+					   supported_rotations);
 
 	drm_plane_helper_add(&intel_plane->base, &intel_plane_helper_funcs);
 
-- 
2.7.4

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

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

* [PATCH v2 12/15] drm: RIP mode_config->rotation_property
  2016-09-26 16:30 [PATCH v2 00/16] drm: drm: Per-plane rotation etc ville.syrjala
                   ` (10 preceding siblings ...)
  2016-09-26 16:30 ` [PATCH v3 11/15] drm/i915: Use the per-plane rotation property ville.syrjala
@ 2016-09-26 16:30 ` ville.syrjala
  2016-09-27 10:00   ` [Intel-gfx] " Joonas Lahtinen
  2016-09-26 16:30 ` [PATCH v2 13/15] drm/i915: Use & instead if == to check for rotations ville.syrjala
                   ` (5 subsequent siblings)
  17 siblings, 1 reply; 32+ messages in thread
From: ville.syrjala @ 2016-09-26 16:30 UTC (permalink / raw)
  To: dri-devel; +Cc: intel-gfx

From: Ville Syrjälä <ville.syrjala@linux.intel.com>

Now that all drivers have been converted over to the per-plane rotation
property, we can just nuke the global rotation property.

v2: Rebase due to BIT(),__builtin_ffs() & co.
    Deal with superfluous code shuffling

Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Reviewed-by: Joonas Lahtinen <joonas.lahtinen@linux.intel.com> (v1)
---
 drivers/gpu/drm/drm_atomic.c    |  6 ++----
 drivers/gpu/drm/drm_blend.c     | 32 ++++----------------------------
 drivers/gpu/drm/drm_fb_helper.c |  7 +------
 include/drm/drm_blend.h         |  2 --
 include/drm/drm_crtc.h          |  5 -----
 5 files changed, 7 insertions(+), 45 deletions(-)

diff --git a/drivers/gpu/drm/drm_atomic.c b/drivers/gpu/drm/drm_atomic.c
index a747bb1d486f..197c94f94a2c 100644
--- a/drivers/gpu/drm/drm_atomic.c
+++ b/drivers/gpu/drm/drm_atomic.c
@@ -709,8 +709,7 @@ int drm_atomic_plane_set_property(struct drm_plane *plane,
 		state->src_w = val;
 	} else if (property == config->prop_src_h) {
 		state->src_h = val;
-	} else if (property == config->rotation_property ||
-		   property == plane->rotation_property) {
+	} else if (property == plane->rotation_property) {
 		if (!is_power_of_2(val & DRM_ROTATE_MASK))
 			return -EINVAL;
 		state->rotation = val;
@@ -770,8 +769,7 @@ drm_atomic_plane_get_property(struct drm_plane *plane,
 		*val = state->src_w;
 	} else if (property == config->prop_src_h) {
 		*val = state->src_h;
-	} else if (property == config->rotation_property ||
-		   property == plane->rotation_property) {
+	} else if (property == plane->rotation_property) {
 		*val = state->rotation;
 	} else if (property == plane->zpos_property) {
 		*val = state->zpos;
diff --git a/drivers/gpu/drm/drm_blend.c b/drivers/gpu/drm/drm_blend.c
index e52aece30900..1f2412c7ccfd 100644
--- a/drivers/gpu/drm/drm_blend.c
+++ b/drivers/gpu/drm/drm_blend.c
@@ -89,7 +89,7 @@
  * On top of this basic transformation additional properties can be exposed by
  * the driver:
  *
- * - Rotation is set up with drm_mode_create_rotation_property(). It adds a
+ * - Rotation is set up with drm_plane_create_rotation_property(). It adds a
  *   rotation and reflection step between the source and destination rectangles.
  *   Without this property the rectangle is only scaled, but not rotated or
  *   reflected.
@@ -105,18 +105,12 @@
  */
 
 /**
- * drm_mode_create_rotation_property - create a new rotation property
- * @dev: DRM device
+ * drm_plane_create_rotation_property - create a new rotation property
+ * @plane: drm plane
+ * @rotation: initial value of the rotation property
  * @supported_rotations: bitmask of supported rotations and reflections
  *
  * This creates a new property with the selected support for transformations.
- * The resulting property should be stored in @rotation_property in
- * &drm_mode_config. It then must be attached to each plane which supports
- * rotations using drm_object_attach_property().
- *
- * FIXME: Probably better if the rotation property is created on each plane,
- * like the zpos property. Otherwise it's not possible to allow different
- * rotation modes on different planes.
  *
  * Since a rotation by 180° degress is the same as reflecting both along the x
  * and the y axis the rotation property is somewhat redundant. Drivers can use
@@ -144,24 +138,6 @@
  * rotation. After reflection, the rotation is applied to the image sampled from
  * the source rectangle, before scaling it to fit the destination rectangle.
  */
-struct drm_property *drm_mode_create_rotation_property(struct drm_device *dev,
-						       unsigned int supported_rotations)
-{
-	static const struct drm_prop_enum_list props[] = {
-		{ __builtin_ffs(DRM_ROTATE_0) - 1,   "rotate-0" },
-		{ __builtin_ffs(DRM_ROTATE_90) - 1,  "rotate-90" },
-		{ __builtin_ffs(DRM_ROTATE_180) - 1, "rotate-180" },
-		{ __builtin_ffs(DRM_ROTATE_270) - 1, "rotate-270" },
-		{ __builtin_ffs(DRM_REFLECT_X) - 1,  "reflect-x" },
-		{ __builtin_ffs(DRM_REFLECT_Y) - 1,  "reflect-y" },
-	};
-
-	return drm_property_create_bitmask(dev, 0, "rotation",
-					   props, ARRAY_SIZE(props),
-					   supported_rotations);
-}
-EXPORT_SYMBOL(drm_mode_create_rotation_property);
-
 int drm_plane_create_rotation_property(struct drm_plane *plane,
 				       unsigned int rotation,
 				       unsigned int supported_rotations)
diff --git a/drivers/gpu/drm/drm_fb_helper.c b/drivers/gpu/drm/drm_fb_helper.c
index 54ca3675a745..c5668c2bda1b 100644
--- a/drivers/gpu/drm/drm_fb_helper.c
+++ b/drivers/gpu/drm/drm_fb_helper.c
@@ -394,15 +394,10 @@ static int restore_fbdev_mode(struct drm_fb_helper *fb_helper)
 		if (plane->type != DRM_PLANE_TYPE_PRIMARY)
 			drm_plane_force_disable(plane);
 
-		if (plane->rotation_property) {
+		if (plane->rotation_property)
 			drm_mode_plane_set_obj_prop(plane,
 						    plane->rotation_property,
 						    DRM_ROTATE_0);
-		} else if (dev->mode_config.rotation_property) {
-			drm_mode_plane_set_obj_prop(plane,
-						    dev->mode_config.rotation_property,
-						    DRM_ROTATE_0);
-		}
 	}
 
 	for (i = 0; i < fb_helper->crtc_count; i++) {
diff --git a/include/drm/drm_blend.h b/include/drm/drm_blend.h
index fd351924e1c5..13221cf9b3eb 100644
--- a/include/drm/drm_blend.h
+++ b/include/drm/drm_blend.h
@@ -52,8 +52,6 @@ static inline bool drm_rotation_90_or_270(unsigned int rotation)
 	return rotation & (DRM_ROTATE_90 | DRM_ROTATE_270);
 }
 
-struct drm_property *drm_mode_create_rotation_property(struct drm_device *dev,
-						       unsigned int supported_rotations);
 int drm_plane_create_rotation_property(struct drm_plane *plane,
 				       unsigned int rotation,
 				       unsigned int supported_rotations);
diff --git a/include/drm/drm_crtc.h b/include/drm/drm_crtc.h
index a544b7502493..da915ecd1f14 100644
--- a/include/drm/drm_crtc.h
+++ b/include/drm/drm_crtc.h
@@ -1080,11 +1080,6 @@ struct drm_mode_config {
 	 */
 	struct drm_property *plane_type_property;
 	/**
-	 * @rotation_property: Optional property for planes or CRTCs to specifiy
-	 * rotation.
-	 */
-	struct drm_property *rotation_property;
-	/**
 	 * @prop_src_x: Default atomic plane property for the plane source
 	 * position in the connected &drm_framebuffer.
 	 */
-- 
2.7.4

_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

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

* [PATCH v2 13/15] drm/i915: Use & instead if == to check for rotations
  2016-09-26 16:30 [PATCH v2 00/16] drm: drm: Per-plane rotation etc ville.syrjala
                   ` (11 preceding siblings ...)
  2016-09-26 16:30 ` [PATCH v2 12/15] drm: RIP mode_config->rotation_property ville.syrjala
@ 2016-09-26 16:30 ` ville.syrjala
  2016-09-26 16:30 ` [PATCH v2 14/15] drm/i915: Clean up rotation DSPCNTR/DVSCNTR/etc. setup ville.syrjala
                   ` (4 subsequent siblings)
  17 siblings, 0 replies; 32+ messages in thread
From: ville.syrjala @ 2016-09-26 16:30 UTC (permalink / raw)
  To: dri-devel; +Cc: intel-gfx

From: Ville Syrjälä <ville.syrjala@linux.intel.com>

Using == to check for 180 degree rotation only works as long as the
reflection bits aren't set. That will change soon enough for CHV, so
let's stop doing things the wrong way.

v2: Drop the BIT()

Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Reviewed-by: Chris Wilson <chris@chris-wilson.co.uk>
Reviewed-by: Joonas Lahtinen <joonas.lahtinen@linux.intel.com>
---
 drivers/gpu/drm/i915/intel_display.c | 8 ++++----
 drivers/gpu/drm/i915/intel_sprite.c  | 6 +++---
 2 files changed, 7 insertions(+), 7 deletions(-)

diff --git a/drivers/gpu/drm/i915/intel_display.c b/drivers/gpu/drm/i915/intel_display.c
index bd1642d0f5a8..b19516dd967c 100644
--- a/drivers/gpu/drm/i915/intel_display.c
+++ b/drivers/gpu/drm/i915/intel_display.c
@@ -3080,7 +3080,7 @@ static void i9xx_update_primary_plane(struct drm_plane *primary,
 		intel_crtc->dspaddr_offset =
 			intel_compute_tile_offset(&x, &y, plane_state, 0);
 
-	if (rotation == DRM_ROTATE_180) {
+	if (rotation & DRM_ROTATE_180) {
 		dspcntr |= DISPPLANE_ROTATE_180;
 
 		x += (crtc_state->pipe_src_w - 1);
@@ -3181,7 +3181,7 @@ static void ironlake_update_primary_plane(struct drm_plane *primary,
 	intel_crtc->dspaddr_offset =
 		intel_compute_tile_offset(&x, &y, plane_state, 0);
 
-	if (rotation == DRM_ROTATE_180) {
+	if (rotation & DRM_ROTATE_180) {
 		dspcntr |= DISPPLANE_ROTATE_180;
 
 		if (!IS_HASWELL(dev) && !IS_BROADWELL(dev)) {
@@ -10832,7 +10832,7 @@ static void i9xx_update_cursor(struct drm_crtc *crtc, u32 base,
 		if (HAS_DDI(dev))
 			cntl |= CURSOR_PIPE_CSC_ENABLE;
 
-		if (plane_state->base.rotation == DRM_ROTATE_180)
+		if (plane_state->base.rotation & DRM_ROTATE_180)
 			cntl |= CURSOR_ROTATE_180;
 	}
 
@@ -10878,7 +10878,7 @@ static void intel_crtc_update_cursor(struct drm_crtc *crtc,
 
 		/* ILK+ do this automagically */
 		if (HAS_GMCH_DISPLAY(dev) &&
-		    plane_state->base.rotation == DRM_ROTATE_180) {
+		    plane_state->base.rotation & DRM_ROTATE_180) {
 			base += (plane_state->base.crtc_h *
 				 plane_state->base.crtc_w - 1) * 4;
 		}
diff --git a/drivers/gpu/drm/i915/intel_sprite.c b/drivers/gpu/drm/i915/intel_sprite.c
index 947610dc7b23..4c0fe317d76e 100644
--- a/drivers/gpu/drm/i915/intel_sprite.c
+++ b/drivers/gpu/drm/i915/intel_sprite.c
@@ -432,7 +432,7 @@ vlv_update_plane(struct drm_plane *dplane,
 	intel_add_fb_offsets(&x, &y, plane_state, 0);
 	sprsurf_offset = intel_compute_tile_offset(&x, &y, plane_state, 0);
 
-	if (rotation == DRM_ROTATE_180) {
+	if (rotation & DRM_ROTATE_180) {
 		sprctl |= SP_ROTATE_180;
 
 		x += src_w;
@@ -562,7 +562,7 @@ ivb_update_plane(struct drm_plane *plane,
 	intel_add_fb_offsets(&x, &y, plane_state, 0);
 	sprsurf_offset = intel_compute_tile_offset(&x, &y, plane_state, 0);
 
-	if (rotation == DRM_ROTATE_180) {
+	if (rotation & DRM_ROTATE_180) {
 		sprctl |= SPRITE_ROTATE_180;
 
 		/* HSW and BDW does this automagically in hardware */
@@ -696,7 +696,7 @@ ilk_update_plane(struct drm_plane *plane,
 	intel_add_fb_offsets(&x, &y, plane_state, 0);
 	dvssurf_offset = intel_compute_tile_offset(&x, &y, plane_state, 0);
 
-	if (rotation == DRM_ROTATE_180) {
+	if (rotation & DRM_ROTATE_180) {
 		dvscntr |= DVS_ROTATE_180;
 
 		x += src_w;
-- 
2.7.4

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

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

* [PATCH v2 14/15] drm/i915: Clean up rotation DSPCNTR/DVSCNTR/etc. setup
  2016-09-26 16:30 [PATCH v2 00/16] drm: drm: Per-plane rotation etc ville.syrjala
                   ` (12 preceding siblings ...)
  2016-09-26 16:30 ` [PATCH v2 13/15] drm/i915: Use & instead if == to check for rotations ville.syrjala
@ 2016-09-26 16:30 ` ville.syrjala
  2016-09-26 16:31 ` [PATCH v2 15/15] drm/i915: Add horizontal mirroring support for CHV pipe B planes ville.syrjala
                   ` (3 subsequent siblings)
  17 siblings, 0 replies; 32+ messages in thread
From: ville.syrjala @ 2016-09-26 16:30 UTC (permalink / raw)
  To: dri-devel; +Cc: intel-gfx

From: Ville Syrjälä <ville.syrjala@linux.intel.com>

Move the plane control register rotation setup away from the
coordinate munging code. This will result in neater looking
code once we add reflection support for CHV.

v2: Drop the BIT(), drop some usless parens,

Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Reviewed-by: Chris Wilson <chris@chris-wilson.co.uk>
Reviewed-by: Joonas Lahtinen <joonas.lahtinen@linux.intel.com>
---
 drivers/gpu/drm/i915/intel_display.c | 24 +++++++++++++-----------
 drivers/gpu/drm/i915/intel_sprite.c  | 26 ++++++++++++++------------
 2 files changed, 27 insertions(+), 23 deletions(-)

diff --git a/drivers/gpu/drm/i915/intel_display.c b/drivers/gpu/drm/i915/intel_display.c
index b19516dd967c..c8fa35e921f9 100644
--- a/drivers/gpu/drm/i915/intel_display.c
+++ b/drivers/gpu/drm/i915/intel_display.c
@@ -3071,6 +3071,9 @@ static void i9xx_update_primary_plane(struct drm_plane *primary,
 	    fb->modifier[0] == I915_FORMAT_MOD_X_TILED)
 		dspcntr |= DISPPLANE_TILED;
 
+	if (rotation & DRM_ROTATE_180)
+		dspcntr |= DISPPLANE_ROTATE_180;
+
 	if (IS_G4X(dev))
 		dspcntr |= DISPPLANE_TRICKLE_FEED_DISABLE;
 
@@ -3081,10 +3084,8 @@ static void i9xx_update_primary_plane(struct drm_plane *primary,
 			intel_compute_tile_offset(&x, &y, plane_state, 0);
 
 	if (rotation & DRM_ROTATE_180) {
-		dspcntr |= DISPPLANE_ROTATE_180;
-
-		x += (crtc_state->pipe_src_w - 1);
-		y += (crtc_state->pipe_src_h - 1);
+		x += crtc_state->pipe_src_w - 1;
+		y += crtc_state->pipe_src_h - 1;
 	}
 
 	linear_offset = intel_fb_xy_to_linear(x, y, plane_state, 0);
@@ -3173,6 +3174,9 @@ static void ironlake_update_primary_plane(struct drm_plane *primary,
 	if (fb->modifier[0] == I915_FORMAT_MOD_X_TILED)
 		dspcntr |= DISPPLANE_TILED;
 
+	if (rotation & DRM_ROTATE_180)
+		dspcntr |= DISPPLANE_ROTATE_180;
+
 	if (!IS_HASWELL(dev) && !IS_BROADWELL(dev))
 		dspcntr |= DISPPLANE_TRICKLE_FEED_DISABLE;
 
@@ -3181,13 +3185,11 @@ static void ironlake_update_primary_plane(struct drm_plane *primary,
 	intel_crtc->dspaddr_offset =
 		intel_compute_tile_offset(&x, &y, plane_state, 0);
 
-	if (rotation & DRM_ROTATE_180) {
-		dspcntr |= DISPPLANE_ROTATE_180;
-
-		if (!IS_HASWELL(dev) && !IS_BROADWELL(dev)) {
-			x += (crtc_state->pipe_src_w - 1);
-			y += (crtc_state->pipe_src_h - 1);
-		}
+	/* HSW+ does this automagically in hardware */
+	if (!IS_HASWELL(dev_priv) && !IS_BROADWELL(dev_priv) &&
+	    rotation & DRM_ROTATE_180) {
+		x += crtc_state->pipe_src_w - 1;
+		y += crtc_state->pipe_src_h - 1;
 	}
 
 	linear_offset = intel_fb_xy_to_linear(x, y, plane_state, 0);
diff --git a/drivers/gpu/drm/i915/intel_sprite.c b/drivers/gpu/drm/i915/intel_sprite.c
index 4c0fe317d76e..3670f462888f 100644
--- a/drivers/gpu/drm/i915/intel_sprite.c
+++ b/drivers/gpu/drm/i915/intel_sprite.c
@@ -423,6 +423,9 @@ vlv_update_plane(struct drm_plane *dplane,
 	if (fb->modifier[0] == I915_FORMAT_MOD_X_TILED)
 		sprctl |= SP_TILED;
 
+	if (rotation & DRM_ROTATE_180)
+		sprctl |= SP_ROTATE_180;
+
 	/* Sizes are 0 based */
 	src_w--;
 	src_h--;
@@ -433,8 +436,6 @@ vlv_update_plane(struct drm_plane *dplane,
 	sprsurf_offset = intel_compute_tile_offset(&x, &y, plane_state, 0);
 
 	if (rotation & DRM_ROTATE_180) {
-		sprctl |= SP_ROTATE_180;
-
 		x += src_w;
 		y += src_h;
 	}
@@ -542,6 +543,9 @@ ivb_update_plane(struct drm_plane *plane,
 	if (fb->modifier[0] == I915_FORMAT_MOD_X_TILED)
 		sprctl |= SPRITE_TILED;
 
+	if (rotation & DRM_ROTATE_180)
+		sprctl |= SPRITE_ROTATE_180;
+
 	if (IS_HASWELL(dev) || IS_BROADWELL(dev))
 		sprctl &= ~SPRITE_TRICKLE_FEED_DISABLE;
 	else
@@ -562,14 +566,11 @@ ivb_update_plane(struct drm_plane *plane,
 	intel_add_fb_offsets(&x, &y, plane_state, 0);
 	sprsurf_offset = intel_compute_tile_offset(&x, &y, plane_state, 0);
 
-	if (rotation & DRM_ROTATE_180) {
-		sprctl |= SPRITE_ROTATE_180;
-
-		/* HSW and BDW does this automagically in hardware */
-		if (!IS_HASWELL(dev) && !IS_BROADWELL(dev)) {
-			x += src_w;
-			y += src_h;
-		}
+	/* HSW+ does this automagically in hardware */
+	if (!IS_HASWELL(dev_priv) && !IS_BROADWELL(dev_priv) &&
+	    rotation & DRM_ROTATE_180) {
+		x += src_w;
+		y += src_h;
 	}
 
 	linear_offset = intel_fb_xy_to_linear(x, y, plane_state, 0);
@@ -680,6 +681,9 @@ ilk_update_plane(struct drm_plane *plane,
 	if (fb->modifier[0] == I915_FORMAT_MOD_X_TILED)
 		dvscntr |= DVS_TILED;
 
+	if (rotation & DRM_ROTATE_180)
+		dvscntr |= DVS_ROTATE_180;
+
 	if (IS_GEN6(dev))
 		dvscntr |= DVS_TRICKLE_FEED_DISABLE; /* must disable */
 
@@ -697,8 +701,6 @@ ilk_update_plane(struct drm_plane *plane,
 	dvssurf_offset = intel_compute_tile_offset(&x, &y, plane_state, 0);
 
 	if (rotation & DRM_ROTATE_180) {
-		dvscntr |= DVS_ROTATE_180;
-
 		x += src_w;
 		y += src_h;
 	}
-- 
2.7.4

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

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

* [PATCH v2 15/15] drm/i915: Add horizontal mirroring support for CHV pipe B planes
  2016-09-26 16:30 [PATCH v2 00/16] drm: drm: Per-plane rotation etc ville.syrjala
                   ` (13 preceding siblings ...)
  2016-09-26 16:30 ` [PATCH v2 14/15] drm/i915: Clean up rotation DSPCNTR/DVSCNTR/etc. setup ville.syrjala
@ 2016-09-26 16:31 ` ville.syrjala
  2016-09-27 10:02   ` [Intel-gfx] " Joonas Lahtinen
  2016-09-26 16:40 ` [PATCH v2 00/16] drm: drm: Per-plane rotation etc Ville Syrjälä
                   ` (2 subsequent siblings)
  17 siblings, 1 reply; 32+ messages in thread
From: ville.syrjala @ 2016-09-26 16:31 UTC (permalink / raw)
  To: dri-devel; +Cc: intel-gfx

From: Ville Syrjälä <ville.syrjala@linux.intel.com>

The primary and sprite planes on CHV pipe B support horizontal
mirroring. Expose it to the world.

Sadly the hardware ignores the mirror bit when the rotate bit is
set, so we'll have to reject the 180+X case.

v2: Drop the BIT()

Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Reviewed-by: Joonas Lahtinen <joonas.lahtinen@linux.intel.com> (v1)
---
 drivers/gpu/drm/i915/intel_atomic_plane.c | 8 ++++++++
 drivers/gpu/drm/i915/intel_display.c      | 9 +++++++++
 drivers/gpu/drm/i915/intel_sprite.c       | 9 +++++++++
 3 files changed, 26 insertions(+)

diff --git a/drivers/gpu/drm/i915/intel_atomic_plane.c b/drivers/gpu/drm/i915/intel_atomic_plane.c
index c762ae549a1c..45e67e3842db 100644
--- a/drivers/gpu/drm/i915/intel_atomic_plane.c
+++ b/drivers/gpu/drm/i915/intel_atomic_plane.c
@@ -169,6 +169,14 @@ static int intel_plane_atomic_check(struct drm_plane *plane,
 		}
 	}
 
+	/* CHV ignores the mirror bit when the rotate bit is set :( */
+	if (IS_CHERRYVIEW(plane->dev) &&
+	    state->rotation & DRM_ROTATE_180 &&
+	    state->rotation & DRM_REFLECT_X) {
+		DRM_DEBUG_KMS("Cannot rotate and reflect at the same time\n");
+		return -EINVAL;
+	}
+
 	intel_state->base.visible = false;
 	ret = intel_plane->check_plane(plane, crtc_state, intel_state);
 	if (ret)
diff --git a/drivers/gpu/drm/i915/intel_display.c b/drivers/gpu/drm/i915/intel_display.c
index c8fa35e921f9..5a347469bf39 100644
--- a/drivers/gpu/drm/i915/intel_display.c
+++ b/drivers/gpu/drm/i915/intel_display.c
@@ -3074,6 +3074,9 @@ static void i9xx_update_primary_plane(struct drm_plane *primary,
 	if (rotation & DRM_ROTATE_180)
 		dspcntr |= DISPPLANE_ROTATE_180;
 
+	if (rotation & DRM_REFLECT_X)
+		dspcntr |= DISPPLANE_MIRROR;
+
 	if (IS_G4X(dev))
 		dspcntr |= DISPPLANE_TRICKLE_FEED_DISABLE;
 
@@ -3086,6 +3089,8 @@ static void i9xx_update_primary_plane(struct drm_plane *primary,
 	if (rotation & DRM_ROTATE_180) {
 		x += crtc_state->pipe_src_w - 1;
 		y += crtc_state->pipe_src_h - 1;
+	} else if (rotation & DRM_REFLECT_X) {
+		x += crtc_state->pipe_src_w - 1;
 	}
 
 	linear_offset = intel_fb_xy_to_linear(x, y, plane_state, 0);
@@ -14963,6 +14968,10 @@ static struct drm_plane *intel_primary_plane_create(struct drm_device *dev,
 		supported_rotations =
 			DRM_ROTATE_0 | DRM_ROTATE_90 |
 			DRM_ROTATE_180 | DRM_ROTATE_270;
+	} else if (IS_CHERRYVIEW(dev) && pipe == PIPE_B) {
+		supported_rotations =
+			DRM_ROTATE_0 | DRM_ROTATE_180 |
+			DRM_REFLECT_X;
 	} else if (INTEL_GEN(dev) >= 4) {
 		supported_rotations =
 			DRM_ROTATE_0 | DRM_ROTATE_180;
diff --git a/drivers/gpu/drm/i915/intel_sprite.c b/drivers/gpu/drm/i915/intel_sprite.c
index 3670f462888f..7f3e419786d6 100644
--- a/drivers/gpu/drm/i915/intel_sprite.c
+++ b/drivers/gpu/drm/i915/intel_sprite.c
@@ -426,6 +426,9 @@ vlv_update_plane(struct drm_plane *dplane,
 	if (rotation & DRM_ROTATE_180)
 		sprctl |= SP_ROTATE_180;
 
+	if (rotation & DRM_REFLECT_X)
+		sprctl |= SP_MIRROR;
+
 	/* Sizes are 0 based */
 	src_w--;
 	src_h--;
@@ -438,6 +441,8 @@ vlv_update_plane(struct drm_plane *dplane,
 	if (rotation & DRM_ROTATE_180) {
 		x += src_w;
 		y += src_h;
+	} else if (rotation & DRM_REFLECT_X) {
+		x += src_w;
 	}
 
 	linear_offset = intel_fb_xy_to_linear(x, y, plane_state, 0);
@@ -1128,6 +1133,10 @@ intel_plane_init(struct drm_device *dev, enum pipe pipe, int plane)
 		supported_rotations =
 			DRM_ROTATE_0 | DRM_ROTATE_90 |
 			DRM_ROTATE_180 | DRM_ROTATE_270;
+	} else if (IS_CHERRYVIEW(dev) && pipe == PIPE_B) {
+		supported_rotations =
+			DRM_ROTATE_0 | DRM_ROTATE_180 |
+			DRM_REFLECT_X;
 	} else {
 		supported_rotations =
 			DRM_ROTATE_0 | DRM_ROTATE_180;
-- 
2.7.4

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

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

* Re: [PATCH v2 00/16] drm: drm: Per-plane rotation etc.
  2016-09-26 16:30 [PATCH v2 00/16] drm: drm: Per-plane rotation etc ville.syrjala
                   ` (14 preceding siblings ...)
  2016-09-26 16:31 ` [PATCH v2 15/15] drm/i915: Add horizontal mirroring support for CHV pipe B planes ville.syrjala
@ 2016-09-26 16:40 ` Ville Syrjälä
  2016-09-26 17:12 ` Rob Clark
  2016-09-26 17:19 ` ✗ Fi.CI.BAT: warning for " Patchwork
  17 siblings, 0 replies; 32+ messages in thread
From: Ville Syrjälä @ 2016-09-26 16:40 UTC (permalink / raw)
  To: dri-devel; +Cc: intel-gfx, Tomi Valkeinen

On Mon, Sep 26, 2016 at 07:30:45PM +0300, ville.syrjala@linux.intel.com wrote:
> From: Ville Syrjälä <ville.syrjala@linux.intel.com>
> 
> Another, rebased, version of my earlier series [1] to add the per-plane
> rotation property. One thing holding back the previous version was the
> weird regression on omap, but apparently I managed to fix it (see [2]).

And natrually I forgot to fill in the references:
[1] https://lists.freedesktop.org/archives/dri-devel/2016-July/113821.html
[2] https://lists.freedesktop.org/archives/dri-devel/2016-September/119227.html

> 
> msm and omap still lack r-bs/acks.
> 
> Entire series available here:
> git://github.com/vsyrjala/linux.git chv_mirror_4
> 
> Cc: Tomi Valkeinen <tomi.valkeinen@ti.com>
> Cc: Rob Clark <robdclark@gmail.com>
> Cc: Jilai Wang <jilaiw@codeaurora.org>
> Cc: Archit Taneja <architt@codeaurora.org>
> 
> Ville Syrjälä (15):
>   drm: Add drm_rotation_90_or_270()
>   drm/atomic: Reject attempts to use multiple rotation angles at once
>   drm: Add support for optional per-plane rotation property
>   drm/arm: Use per-plane rotation property
>   drm/atmel-hlcdc: Use per-plane rotation property
>   drm/omap: Set rotation property initial value to BIT(DRM_ROTATE_0)
>     insted of 0
>   drm/omap: Use per-plane rotation property
>   drm/msm/mdp5: Set rotation property initial value to BIT(DRM_ROTATE_0)
>     insted of 0
>   drm/msm/mdp5: Use per-plane rotation property
>   drm/msm/mdp5: Advertize 180 degree rotation
>   drm/i915: Use the per-plane rotation property
>   drm: RIP mode_config->rotation_property
>   drm/i915: Use & instead if == to check for rotations
>   drm/i915: Clean up rotation DSPCNTR/DVSCNTR/etc. setup
>   drm/i915: Add horizontal mirroring support for CHV pipe B planes
> 
>  drivers/gpu/drm/arm/malidp_planes.c             |  13 ++-
>  drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_plane.c |  41 ++++-----
>  drivers/gpu/drm/drm_atomic.c                    |   6 +-
>  drivers/gpu/drm/drm_atomic_helper.c             |   2 +-
>  drivers/gpu/drm/drm_blend.c                     |  39 +++++----
>  drivers/gpu/drm/drm_crtc.c                      |   3 +-
>  drivers/gpu/drm/drm_fb_helper.c                 |   5 +-
>  drivers/gpu/drm/i915/intel_atomic_plane.c       |  11 ++-
>  drivers/gpu/drm/i915/intel_display.c            | 107 ++++++++++++------------
>  drivers/gpu/drm/i915/intel_drv.h                |   9 --
>  drivers/gpu/drm/i915/intel_fbc.c                |   2 +-
>  drivers/gpu/drm/i915/intel_pm.c                 |  12 +--
>  drivers/gpu/drm/i915/intel_sprite.c             |  53 ++++++++----
>  drivers/gpu/drm/msm/mdp/mdp5/mdp5_plane.c       |  35 +++++---
>  drivers/gpu/drm/omapdrm/omap_crtc.c             |  13 ++-
>  drivers/gpu/drm/omapdrm/omap_drv.c              |  50 +++++------
>  drivers/gpu/drm/omapdrm/omap_plane.c            |  21 +++--
>  include/drm/drm_blend.h                         |  10 ++-
>  include/drm/drm_crtc.h                          |   5 --
>  include/drm/drm_plane.h                         |   2 +
>  20 files changed, 243 insertions(+), 196 deletions(-)
> 
> -- 
> 2.7.4

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

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

* Re: [PATCH v2 00/16] drm: drm: Per-plane rotation etc.
  2016-09-26 16:30 [PATCH v2 00/16] drm: drm: Per-plane rotation etc ville.syrjala
                   ` (15 preceding siblings ...)
  2016-09-26 16:40 ` [PATCH v2 00/16] drm: drm: Per-plane rotation etc Ville Syrjälä
@ 2016-09-26 17:12 ` Rob Clark
  2016-09-26 17:19 ` ✗ Fi.CI.BAT: warning for " Patchwork
  17 siblings, 0 replies; 32+ messages in thread
From: Rob Clark @ 2016-09-26 17:12 UTC (permalink / raw)
  To: Ville Syrjälä
  Cc: Intel Graphics Development, Tomi Valkeinen, dri-devel

On Mon, Sep 26, 2016 at 12:30 PM,  <ville.syrjala@linux.intel.com> wrote:
> From: Ville Syrjälä <ville.syrjala@linux.intel.com>
>
> Another, rebased, version of my earlier series [1] to add the per-plane
> rotation property. One thing holding back the previous version was the
> weird regression on omap, but apparently I managed to fix it (see [2]).
>
> msm and omap still lack r-bs/acks.
>
> Entire series available here:
> git://github.com/vsyrjala/linux.git chv_mirror_4
>
> Cc: Tomi Valkeinen <tomi.valkeinen@ti.com>
> Cc: Rob Clark <robdclark@gmail.com>
> Cc: Jilai Wang <jilaiw@codeaurora.org>
> Cc: Archit Taneja <architt@codeaurora.org>
>
> Ville Syrjälä (15):
>   drm: Add drm_rotation_90_or_270()
>   drm/atomic: Reject attempts to use multiple rotation angles at once
>   drm: Add support for optional per-plane rotation property
>   drm/arm: Use per-plane rotation property
>   drm/atmel-hlcdc: Use per-plane rotation property
>   drm/omap: Set rotation property initial value to BIT(DRM_ROTATE_0)
>     insted of 0
>   drm/omap: Use per-plane rotation property
>   drm/msm/mdp5: Set rotation property initial value to BIT(DRM_ROTATE_0)
>     insted of 0

fwiw, this one (but with s/BIT(DRM_ROTATE_x)/DRM_ROTATE_x/) is in
msm-next for 4.9..  the other msm patches (from previous patchset)
looked reasonable but needed some rebasing so I skipped them.  But you
can go ahead and slap on my r-b.

BR,
-R

>   drm/msm/mdp5: Use per-plane rotation property
>   drm/msm/mdp5: Advertize 180 degree rotation
>   drm/i915: Use the per-plane rotation property
>   drm: RIP mode_config->rotation_property
>   drm/i915: Use & instead if == to check for rotations
>   drm/i915: Clean up rotation DSPCNTR/DVSCNTR/etc. setup
>   drm/i915: Add horizontal mirroring support for CHV pipe B planes
>
>  drivers/gpu/drm/arm/malidp_planes.c             |  13 ++-
>  drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_plane.c |  41 ++++-----
>  drivers/gpu/drm/drm_atomic.c                    |   6 +-
>  drivers/gpu/drm/drm_atomic_helper.c             |   2 +-
>  drivers/gpu/drm/drm_blend.c                     |  39 +++++----
>  drivers/gpu/drm/drm_crtc.c                      |   3 +-
>  drivers/gpu/drm/drm_fb_helper.c                 |   5 +-
>  drivers/gpu/drm/i915/intel_atomic_plane.c       |  11 ++-
>  drivers/gpu/drm/i915/intel_display.c            | 107 ++++++++++++------------
>  drivers/gpu/drm/i915/intel_drv.h                |   9 --
>  drivers/gpu/drm/i915/intel_fbc.c                |   2 +-
>  drivers/gpu/drm/i915/intel_pm.c                 |  12 +--
>  drivers/gpu/drm/i915/intel_sprite.c             |  53 ++++++++----
>  drivers/gpu/drm/msm/mdp/mdp5/mdp5_plane.c       |  35 +++++---
>  drivers/gpu/drm/omapdrm/omap_crtc.c             |  13 ++-
>  drivers/gpu/drm/omapdrm/omap_drv.c              |  50 +++++------
>  drivers/gpu/drm/omapdrm/omap_plane.c            |  21 +++--
>  include/drm/drm_blend.h                         |  10 ++-
>  include/drm/drm_crtc.h                          |   5 --
>  include/drm/drm_plane.h                         |   2 +
>  20 files changed, 243 insertions(+), 196 deletions(-)
>
> --
> 2.7.4
>
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

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

* ✗ Fi.CI.BAT: warning for drm: drm: Per-plane rotation etc.
  2016-09-26 16:30 [PATCH v2 00/16] drm: drm: Per-plane rotation etc ville.syrjala
                   ` (16 preceding siblings ...)
  2016-09-26 17:12 ` Rob Clark
@ 2016-09-26 17:19 ` Patchwork
  17 siblings, 0 replies; 32+ messages in thread
From: Patchwork @ 2016-09-26 17:19 UTC (permalink / raw)
  To: ville.syrjala; +Cc: intel-gfx

== Series Details ==

Series: drm: drm: Per-plane rotation etc.
URL   : https://patchwork.freedesktop.org/series/12938/
State : warning

== Summary ==

Series 12938v1 drm: drm: Per-plane rotation etc.
https://patchwork.freedesktop.org/api/1.0/series/12938/revisions/1/mbox/

Test gem_exec_gttfill:
        Subgroup basic:
                pass       -> SKIP       (fi-snb-2600)
Test kms_psr_sink_crc:
        Subgroup psr_basic:
                dmesg-warn -> PASS       (fi-skl-6700hq)

fi-bdw-5557u     total:244  pass:229  dwarn:0   dfail:0   fail:0   skip:15 
fi-bsw-n3050     total:244  pass:202  dwarn:0   dfail:0   fail:0   skip:42 
fi-byt-n2820     total:244  pass:208  dwarn:0   dfail:0   fail:1   skip:35 
fi-hsw-4770      total:244  pass:222  dwarn:0   dfail:0   fail:0   skip:22 
fi-hsw-4770r     total:244  pass:222  dwarn:0   dfail:0   fail:0   skip:22 
fi-ilk-650       total:244  pass:182  dwarn:0   dfail:0   fail:2   skip:60 
fi-ivb-3520m     total:244  pass:219  dwarn:0   dfail:0   fail:0   skip:25 
fi-ivb-3770      total:244  pass:207  dwarn:0   dfail:0   fail:0   skip:37 
fi-skl-6260u     total:244  pass:230  dwarn:0   dfail:0   fail:0   skip:14 
fi-skl-6700hq    total:244  pass:222  dwarn:0   dfail:0   fail:0   skip:22 
fi-skl-6700k     total:244  pass:219  dwarn:1   dfail:0   fail:0   skip:24 
fi-skl-6770hq    total:244  pass:228  dwarn:1   dfail:0   fail:1   skip:14 
fi-snb-2520m     total:244  pass:208  dwarn:0   dfail:0   fail:0   skip:36 
fi-snb-2600      total:244  pass:206  dwarn:0   dfail:0   fail:0   skip:38 

Results at /archive/results/CI_IGT_test/Patchwork_2578/

aab15c274da587bcab19376d2caa9d6626440335 drm-intel-nightly: 2016y-09m-26d-12h-11m-33s UTC integration manifest
da52158 drm/i915: Add horizontal mirroring support for CHV pipe B planes
6387b64 drm/i915: Clean up rotation DSPCNTR/DVSCNTR/etc. setup
5b6f868 drm/i915: Use & instead if == to check for rotations
e21ce97 drm: RIP mode_config->rotation_property
9c176d2 drm/i915: Use the per-plane rotation property
4660959 drm/msm/mdp5: Advertize 180 degree rotation
dc3f1d1 drm/msm/mdp5: Use per-plane rotation property
775e893 drm/msm/mdp5: Set rotation property initial value to BIT(DRM_ROTATE_0) insted of 0
f60a872 drm/omap: Use per-plane rotation property
44b6f0d drm/omap: Set rotation property initial value to BIT(DRM_ROTATE_0) insted of 0
3d03bc1 drm/atmel-hlcdc: Use per-plane rotation property
ce8714f drm/arm: Use per-plane rotation property
1484269 drm: Add support for optional per-plane rotation property
9dd3ecf drm/atomic: Reject attempts to use multiple rotation angles at once
2dc324a drm: Add drm_rotation_90_or_270()

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

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

* Re: [PATCH v2 01/15] drm: Add drm_rotation_90_or_270()
  2016-09-26 16:30 ` [PATCH v2 01/15] drm: Add drm_rotation_90_or_270() ville.syrjala
@ 2016-09-27  9:32   ` Joonas Lahtinen
  0 siblings, 0 replies; 32+ messages in thread
From: Joonas Lahtinen @ 2016-09-27  9:32 UTC (permalink / raw)
  To: ville.syrjala, dri-devel; +Cc: intel-gfx

On ma, 2016-09-26 at 19:30 +0300, ville.syrjala@linux.intel.com wrote:
> > From: Ville Syrjälä <ville.syrjala@linux.intel.com>
> 
> We have intel_rotation_90_or_270() in i915 to check if the rotation is
> 90 or 270 degrees. Similar checks are elsewhere in drm, so let's move
> the helper into a central place and use it everwhere.
> 
> v2: Drop the BIT()
>     Convert all new intel_rotation_90_or_270() calls
>     Deal with superfluous code shuffling
> 
> Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
> Reviewed-by: Joonas Lahtinen <joonas.lahtinen@linux.intel.com> (v1)

Looks good.

Reviewed-by: Joonas Lahtinen <joonas.lahtinen@linux.intel.com>

Regards, Joonas
-- 
Joonas Lahtinen
Open Source Technology Center
Intel Corporation
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

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

* Re: [Intel-gfx] [PATCH v3 03/15] drm: Add support for optional per-plane rotation property
  2016-09-26 16:30 ` [PATCH v3 03/15] drm: Add support for optional per-plane rotation property ville.syrjala
@ 2016-09-27  9:54   ` Joonas Lahtinen
  2016-09-27 10:22     ` Ville Syrjälä
  0 siblings, 1 reply; 32+ messages in thread
From: Joonas Lahtinen @ 2016-09-27  9:54 UTC (permalink / raw)
  To: ville.syrjala, dri-devel; +Cc: intel-gfx

On ma, 2016-09-26 at 19:30 +0300, ville.syrjala@linux.intel.com wrote:
> diff --git a/drivers/gpu/drm/drm_blend.c b/drivers/gpu/drm/drm_blend.c
> 
> index 85172a977bf3..e52aece30900 100644
> --- a/drivers/gpu/drm/drm_blend.c
> +++ b/drivers/gpu/drm/drm_blend.c

Now that I'm thinking, *_zpos_* fits to drm_blend.c nicely, but not
sure if rotation is related to blending so much. Maybe it should be
like a new file drm_transform.c (or drm_plane.c to be overly generic),
not sure.

Anyway,

Reviewed-by: Joonas Lahtinen <joonas.lahtinen@linux.intel.com>

Regards, Joonas
-- 
Joonas Lahtinen
Open Source Technology Center
Intel Corporation
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

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

* Re: [PATCH v3 11/15] drm/i915: Use the per-plane rotation property
  2016-09-26 16:30 ` [PATCH v3 11/15] drm/i915: Use the per-plane rotation property ville.syrjala
@ 2016-09-27  9:58   ` Joonas Lahtinen
  2016-10-21 16:28     ` [Intel-gfx] " Daniel Vetter
  0 siblings, 1 reply; 32+ messages in thread
From: Joonas Lahtinen @ 2016-09-27  9:58 UTC (permalink / raw)
  To: ville.syrjala, dri-devel; +Cc: intel-gfx

On ma, 2016-09-26 at 19:30 +0300, ville.syrjala@linux.intel.com wrote:
> > From: Ville Syrjälä <ville.syrjala@linux.intel.com>
> 
> On certain platforms not all planes support the same set of
> rotations/reflections, so let's use the per-plane property
> for this.
> 
> This is already a problem on SKL when we use the legay cursor plane
> as it only supports 0|180 whereas the universal planes support
> 0|90|180|270, and it will be a problem on CHV soon.
> 
> v2: Use drm_plane_create_rotation_property() helper
> v3: Drop the BIT(), use INTEL_GEN()
> 
> Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
> Reviewed-by: Chris Wilson <chris@chris-wilson.co.uk> (v1)
> Reviewed-by: Joonas Lahtinen <joonas.lahtinen@linux.intel.com> (v2)

Reviewed-by: Joonas Lahtinen <joonas.lahtinen@linux.intel.com>

Regards, Joonas
-- 
Joonas Lahtinen
Open Source Technology Center
Intel Corporation
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

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

* Re: [Intel-gfx] [PATCH v2 12/15] drm: RIP mode_config->rotation_property
  2016-09-26 16:30 ` [PATCH v2 12/15] drm: RIP mode_config->rotation_property ville.syrjala
@ 2016-09-27 10:00   ` Joonas Lahtinen
  0 siblings, 0 replies; 32+ messages in thread
From: Joonas Lahtinen @ 2016-09-27 10:00 UTC (permalink / raw)
  To: ville.syrjala, dri-devel; +Cc: intel-gfx

On ma, 2016-09-26 at 19:30 +0300, ville.syrjala@linux.intel.com wrote:
> From: Ville Syrjälä <ville.syrjala@linux.intel.com>
> 
> Now that all drivers have been converted over to the per-plane rotation
> property, we can just nuke the global rotation property.
> 
> v2: Rebase due to BIT(),__builtin_ffs() & co.
>     Deal with superfluous code shuffling
> 
> Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
> Reviewed-by: Joonas Lahtinen <joonas.lahtinen@linux.intel.com> (v1)

Reviewed-by: Joonas Lahtinen <joonas.lahtinen@linux.intel.com>

Regards, Joonas
-- 
Joonas Lahtinen
Open Source Technology Center
Intel Corporation
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

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

* Re: [Intel-gfx] [PATCH v2 15/15] drm/i915: Add horizontal mirroring support for CHV pipe B planes
  2016-09-26 16:31 ` [PATCH v2 15/15] drm/i915: Add horizontal mirroring support for CHV pipe B planes ville.syrjala
@ 2016-09-27 10:02   ` Joonas Lahtinen
  0 siblings, 0 replies; 32+ messages in thread
From: Joonas Lahtinen @ 2016-09-27 10:02 UTC (permalink / raw)
  To: ville.syrjala, dri-devel; +Cc: intel-gfx

On ma, 2016-09-26 at 19:31 +0300, ville.syrjala@linux.intel.com wrote:
> From: Ville Syrjälä <ville.syrjala@linux.intel.com>
> 
> The primary and sprite planes on CHV pipe B support horizontal
> mirroring. Expose it to the world.
> 
> Sadly the hardware ignores the mirror bit when the rotate bit is
> set, so we'll have to reject the 180+X case.
> 
> v2: Drop the BIT()
> 
> Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
> Reviewed-by: Joonas Lahtinen <joonas.lahtinen@linux.intel.com> (v1)

Reviewed-by: Joonas Lahtinen <joonas.lahtinen@linux.intel.com>

Regards, Joonas
-- 
Joonas Lahtinen
Open Source Technology Center
Intel Corporation
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

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

* Re: [Intel-gfx] [PATCH v3 03/15] drm: Add support for optional per-plane rotation property
  2016-09-27  9:54   ` [Intel-gfx] " Joonas Lahtinen
@ 2016-09-27 10:22     ` Ville Syrjälä
  2016-10-21 16:23       ` Daniel Vetter
  0 siblings, 1 reply; 32+ messages in thread
From: Ville Syrjälä @ 2016-09-27 10:22 UTC (permalink / raw)
  To: Joonas Lahtinen; +Cc: intel-gfx, dri-devel

On Tue, Sep 27, 2016 at 12:54:46PM +0300, Joonas Lahtinen wrote:
> On ma, 2016-09-26 at 19:30 +0300, ville.syrjala@linux.intel.com wrote:
> > diff --git a/drivers/gpu/drm/drm_blend.c b/drivers/gpu/drm/drm_blend.c
> > 
> > index 85172a977bf3..e52aece30900 100644
> > --- a/drivers/gpu/drm/drm_blend.c
> > +++ b/drivers/gpu/drm/drm_blend.c
> 
> Now that I'm thinking, *_zpos_* fits to drm_blend.c nicely, but not
> sure if rotation is related to blending so much. Maybe it should be
> like a new file drm_transform.c (or drm_plane.c to be overly generic),
> not sure.

The next guy who moves it gets to rebase all of my ~500 branches! Or
alternatively gets to make git smarter so it'll detect the pointless
shuffling automagically.

> 
> Anyway,
> 
> Reviewed-by: Joonas Lahtinen <joonas.lahtinen@linux.intel.com>
> 
> Regards, Joonas
> -- 
> Joonas Lahtinen
> Open Source Technology Center
> Intel Corporation

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

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

* Re: [PATCH v2 07/15] drm/omap: Use per-plane rotation property
  2016-09-26 16:30 ` [PATCH v2 07/15] drm/omap: Use per-plane rotation property ville.syrjala
@ 2016-10-06  9:59   ` Tomi Valkeinen
  2016-10-06 10:30     ` Ville Syrjälä
  0 siblings, 1 reply; 32+ messages in thread
From: Tomi Valkeinen @ 2016-10-06  9:59 UTC (permalink / raw)
  To: ville.syrjala, dri-devel; +Cc: intel-gfx


[-- Attachment #1.1.1: Type: text/plain, Size: 1741 bytes --]


On 26/09/16 19:30, ville.syrjala@linux.intel.com wrote:
> From: Ville Syrjälä <ville.syrjala@linux.intel.com>
> 
> The global mode_config.rotation_property is going away, switch over to
> per-plane rotation_property.
> 
> Not sure I got the annoying crtc rotation_property handling right.
> Might work, or migth not.
> 
> v2: Drop the BIT()
>     Don't create rotation property twice for each primary plane
> 
> Cc: Tomi Valkeinen <tomi.valkeinen@ti.com>
> Cc: Rob Clark <robdclark@gmail.com>
> Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
> ---


> diff --git a/drivers/gpu/drm/omapdrm/omap_plane.c b/drivers/gpu/drm/omapdrm/omap_plane.c
> index 6ddaa5ea4b6b..b272f810989e 100644
> --- a/drivers/gpu/drm/omapdrm/omap_plane.c
> +++ b/drivers/gpu/drm/omapdrm/omap_plane.c
> @@ -211,9 +211,16 @@ void omap_plane_install_properties(struct drm_plane *plane,
>  	struct omap_drm_private *priv = dev->dev_private;
>  
>  	if (priv->has_dmm) {
> -		struct drm_property *prop = dev->mode_config.rotation_property;
> -
> -		drm_object_attach_property(obj, prop, DRM_ROTATE_0);
> +		if (!plane->rotation_property)
> +			drm_plane_create_rotation_property(plane,
> +							   DRM_ROTATE_0,
> +							   DRM_ROTATE_0 | DRM_ROTATE_90 |
> +							   DRM_ROTATE_180 | DRM_ROTATE_270 |
> +							   DRM_REFLECT_X | DRM_REFLECT_Y);
> +
> +		if (plane->rotation_property && obj != &plane->base)
> +			drm_object_attach_property(obj, plane->rotation_property,
> +						   DRM_ROTATE_0);

I think this could use a short comment, as it's not obvious wth is going
on here =).

Otherwise both omap patches look fine, and test fine.

Reviewed-by: Tomi Valkeinen <tomi.valkeinen@ti.com>

 Tomi


[-- Attachment #1.2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 819 bytes --]

[-- Attachment #2: Type: text/plain, Size: 160 bytes --]

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

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

* Re: [PATCH v2 07/15] drm/omap: Use per-plane rotation property
  2016-10-06  9:59   ` Tomi Valkeinen
@ 2016-10-06 10:30     ` Ville Syrjälä
  2016-10-06 10:32       ` Tomi Valkeinen
  0 siblings, 1 reply; 32+ messages in thread
From: Ville Syrjälä @ 2016-10-06 10:30 UTC (permalink / raw)
  To: Tomi Valkeinen; +Cc: intel-gfx, dri-devel

On Thu, Oct 06, 2016 at 12:59:17PM +0300, Tomi Valkeinen wrote:
> 
> On 26/09/16 19:30, ville.syrjala@linux.intel.com wrote:
> > From: Ville Syrjälä <ville.syrjala@linux.intel.com>
> > 
> > The global mode_config.rotation_property is going away, switch over to
> > per-plane rotation_property.
> > 
> > Not sure I got the annoying crtc rotation_property handling right.
> > Might work, or migth not.
> > 
> > v2: Drop the BIT()
> >     Don't create rotation property twice for each primary plane
> > 
> > Cc: Tomi Valkeinen <tomi.valkeinen@ti.com>
> > Cc: Rob Clark <robdclark@gmail.com>
> > Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
> > ---
> 
> 
> > diff --git a/drivers/gpu/drm/omapdrm/omap_plane.c b/drivers/gpu/drm/omapdrm/omap_plane.c
> > index 6ddaa5ea4b6b..b272f810989e 100644
> > --- a/drivers/gpu/drm/omapdrm/omap_plane.c
> > +++ b/drivers/gpu/drm/omapdrm/omap_plane.c
> > @@ -211,9 +211,16 @@ void omap_plane_install_properties(struct drm_plane *plane,
> >  	struct omap_drm_private *priv = dev->dev_private;
> >  
> >  	if (priv->has_dmm) {
> > -		struct drm_property *prop = dev->mode_config.rotation_property;
> > -
> > -		drm_object_attach_property(obj, prop, DRM_ROTATE_0);
> > +		if (!plane->rotation_property)
> > +			drm_plane_create_rotation_property(plane,
> > +							   DRM_ROTATE_0,
> > +							   DRM_ROTATE_0 | DRM_ROTATE_90 |
> > +							   DRM_ROTATE_180 | DRM_ROTATE_270 |
> > +							   DRM_REFLECT_X | DRM_REFLECT_Y);
> > +
> > +		if (plane->rotation_property && obj != &plane->base)
> > +			drm_object_attach_property(obj, plane->rotation_property,
> > +						   DRM_ROTATE_0);
> 
> I think this could use a short comment, as it's not obvious wth is going
> on here =).

/* Attach the rotation property also to the crtc object */ ?

> 
> Otherwise both omap patches look fine, and test fine.
> 
> Reviewed-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
> 
>  Tomi
> 




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

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

* Re: [PATCH v2 07/15] drm/omap: Use per-plane rotation property
  2016-10-06 10:30     ` Ville Syrjälä
@ 2016-10-06 10:32       ` Tomi Valkeinen
  0 siblings, 0 replies; 32+ messages in thread
From: Tomi Valkeinen @ 2016-10-06 10:32 UTC (permalink / raw)
  To: Ville Syrjälä; +Cc: intel-gfx, dri-devel


[-- Attachment #1.1.1: Type: text/plain, Size: 1923 bytes --]



On 06/10/16 13:30, Ville Syrjälä wrote:
> On Thu, Oct 06, 2016 at 12:59:17PM +0300, Tomi Valkeinen wrote:
>>
>> On 26/09/16 19:30, ville.syrjala@linux.intel.com wrote:
>>> From: Ville Syrjälä <ville.syrjala@linux.intel.com>
>>>
>>> The global mode_config.rotation_property is going away, switch over to
>>> per-plane rotation_property.
>>>
>>> Not sure I got the annoying crtc rotation_property handling right.
>>> Might work, or migth not.
>>>
>>> v2: Drop the BIT()
>>>     Don't create rotation property twice for each primary plane
>>>
>>> Cc: Tomi Valkeinen <tomi.valkeinen@ti.com>
>>> Cc: Rob Clark <robdclark@gmail.com>
>>> Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
>>> ---
>>
>>
>>> diff --git a/drivers/gpu/drm/omapdrm/omap_plane.c b/drivers/gpu/drm/omapdrm/omap_plane.c
>>> index 6ddaa5ea4b6b..b272f810989e 100644
>>> --- a/drivers/gpu/drm/omapdrm/omap_plane.c
>>> +++ b/drivers/gpu/drm/omapdrm/omap_plane.c
>>> @@ -211,9 +211,16 @@ void omap_plane_install_properties(struct drm_plane *plane,
>>>  	struct omap_drm_private *priv = dev->dev_private;
>>>  
>>>  	if (priv->has_dmm) {
>>> -		struct drm_property *prop = dev->mode_config.rotation_property;
>>> -
>>> -		drm_object_attach_property(obj, prop, DRM_ROTATE_0);
>>> +		if (!plane->rotation_property)
>>> +			drm_plane_create_rotation_property(plane,
>>> +							   DRM_ROTATE_0,
>>> +							   DRM_ROTATE_0 | DRM_ROTATE_90 |
>>> +							   DRM_ROTATE_180 | DRM_ROTATE_270 |
>>> +							   DRM_REFLECT_X | DRM_REFLECT_Y);
>>> +
>>> +		if (plane->rotation_property && obj != &plane->base)
>>> +			drm_object_attach_property(obj, plane->rotation_property,
>>> +						   DRM_ROTATE_0);
>>
>> I think this could use a short comment, as it's not obvious wth is going
>> on here =).
> 
> /* Attach the rotation property also to the crtc object */ ?

Yes, sounds fine to me.

 Tomi


[-- Attachment #1.2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 819 bytes --]

[-- Attachment #2: Type: text/plain, Size: 160 bytes --]

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

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

* Re: [PATCH v3 03/15] drm: Add support for optional per-plane rotation property
  2016-09-27 10:22     ` Ville Syrjälä
@ 2016-10-21 16:23       ` Daniel Vetter
  0 siblings, 0 replies; 32+ messages in thread
From: Daniel Vetter @ 2016-10-21 16:23 UTC (permalink / raw)
  To: Ville Syrjälä; +Cc: intel-gfx, dri-devel

On Tue, Sep 27, 2016 at 01:22:48PM +0300, Ville Syrjälä wrote:
> On Tue, Sep 27, 2016 at 12:54:46PM +0300, Joonas Lahtinen wrote:
> > On ma, 2016-09-26 at 19:30 +0300, ville.syrjala@linux.intel.com wrote:
> > > diff --git a/drivers/gpu/drm/drm_blend.c b/drivers/gpu/drm/drm_blend.c
> > > 
> > > index 85172a977bf3..e52aece30900 100644
> > > --- a/drivers/gpu/drm/drm_blend.c
> > > +++ b/drivers/gpu/drm/drm_blend.c
> > 
> > Now that I'm thinking, *_zpos_* fits to drm_blend.c nicely, but not
> > sure if rotation is related to blending so much. Maybe it should be
> > like a new file drm_transform.c (or drm_plane.c to be overly generic),
> > not sure.
> 
> The next guy who moves it gets to rebase all of my ~500 branches! Or
> alternatively gets to make git smarter so it'll detect the pointless
> shuffling automagically.

My idea behind drm_blend is to cover _everything_ between the raw
framebuffer data and the final crtc picture. So scaling, rotation,
blending and anything like that.

I should probably have called it compositing, but oh well that fail is now
done.
-Daniel

> 
> > 
> > Anyway,
> > 
> > Reviewed-by: Joonas Lahtinen <joonas.lahtinen@linux.intel.com>
> > 
> > Regards, Joonas
> > -- 
> > Joonas Lahtinen
> > Open Source Technology Center
> > Intel Corporation
> 
> -- 
> Ville Syrjälä
> Intel OTC
> _______________________________________________
> Intel-gfx mailing list
> Intel-gfx@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/intel-gfx

-- 
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

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

* Re: [PATCH v2 08/15] drm/msm/mdp5: Set rotation property initial value to BIT(DRM_ROTATE_0) insted of 0
  2016-09-26 16:30 ` [PATCH v2 08/15] drm/msm/mdp5: Set rotation property initial value to BIT(DRM_ROTATE_0) insted of 0 ville.syrjala
@ 2016-10-21 16:26   ` Daniel Vetter
  2016-10-21 16:40     ` Ville Syrjälä
  0 siblings, 1 reply; 32+ messages in thread
From: Daniel Vetter @ 2016-10-21 16:26 UTC (permalink / raw)
  To: ville.syrjala; +Cc: intel-gfx, dri-devel

On Mon, Sep 26, 2016 at 07:30:53PM +0300, ville.syrjala@linux.intel.com wrote:
> From: Ville Syrjälä <ville.syrjala@linux.intel.com>
> 
> 0 isn't a valid rotation property value, so let's set the initial value
> of the property to BIT(DRM_ROTATE_0) instead.
> 
> In the same vein, we must always have at leat one angle as part of
> set of supported rotation bits, so let's include DRM_ROTATE_0
> in there.
> 
> v2: Drop the BIT()
> 
> Cc: Rob Clark <robdclark@gmail.com>
> Cc: Jilai Wang <jilaiw@codeaurora.org>
> Cc: Archit Taneja <architt@codeaurora.org>
> Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>

This one here had a conflict, so didn't apply. Not sure if still needed.
-Daniel

> ---
>  drivers/gpu/drm/msm/mdp/mdp5/mdp5_plane.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/gpu/drm/msm/mdp/mdp5/mdp5_plane.c b/drivers/gpu/drm/msm/mdp/mdp5/mdp5_plane.c
> index ba8f43278a44..b0ecf5357bfd 100644
> --- a/drivers/gpu/drm/msm/mdp/mdp5/mdp5_plane.c
> +++ b/drivers/gpu/drm/msm/mdp/mdp5/mdp5_plane.c
> @@ -78,12 +78,12 @@ static void mdp5_plane_install_rotation_property(struct drm_device *dev,
>  	if (!dev->mode_config.rotation_property)
>  		dev->mode_config.rotation_property =
>  			drm_mode_create_rotation_property(dev,
> -			DRM_REFLECT_X | DRM_REFLECT_Y);
> +			DRM_ROTATE_0 | DRM_REFLECT_X | DRM_REFLECT_Y);
>  
>  	if (dev->mode_config.rotation_property)
>  		drm_object_attach_property(&plane->base,
>  			dev->mode_config.rotation_property,
> -			0);
> +			DRM_ROTATE_0);
>  }
>  
>  /* helper to install properties which are common to planes and crtcs */
> -- 
> 2.7.4
> 
> _______________________________________________
> dri-devel mailing list
> dri-devel@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/dri-devel

-- 
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

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

* Re: [Intel-gfx] [PATCH v3 11/15] drm/i915: Use the per-plane rotation property
  2016-09-27  9:58   ` Joonas Lahtinen
@ 2016-10-21 16:28     ` Daniel Vetter
  0 siblings, 0 replies; 32+ messages in thread
From: Daniel Vetter @ 2016-10-21 16:28 UTC (permalink / raw)
  To: Joonas Lahtinen; +Cc: intel-gfx, dri-devel

On Tue, Sep 27, 2016 at 12:58:49PM +0300, Joonas Lahtinen wrote:
> On ma, 2016-09-26 at 19:30 +0300, ville.syrjala@linux.intel.com wrote:
> > > From: Ville Syrjälä <ville.syrjala@linux.intel.com>
> > 
> > On certain platforms not all planes support the same set of
> > rotations/reflections, so let's use the per-plane property
> > for this.
> > 
> > This is already a problem on SKL when we use the legay cursor plane
> > as it only supports 0|180 whereas the universal planes support
> > 0|90|180|270, and it will be a problem on CHV soon.
> > 
> > v2: Use drm_plane_create_rotation_property() helper
> > v3: Drop the BIT(), use INTEL_GEN()
> > 
> > Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
> > Reviewed-by: Chris Wilson <chris@chris-wilson.co.uk> (v1)
> > Reviewed-by: Joonas Lahtinen <joonas.lahtinen@linux.intel.com> (v2)
> 
> Reviewed-by: Joonas Lahtinen <joonas.lahtinen@linux.intel.com>

Applied up to this one because I hit a small snag in msm.

Thanks, Daniel
-- 
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

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

* Re: [PATCH v2 08/15] drm/msm/mdp5: Set rotation property initial value to BIT(DRM_ROTATE_0) insted of 0
  2016-10-21 16:26   ` Daniel Vetter
@ 2016-10-21 16:40     ` Ville Syrjälä
  0 siblings, 0 replies; 32+ messages in thread
From: Ville Syrjälä @ 2016-10-21 16:40 UTC (permalink / raw)
  To: Daniel Vetter; +Cc: intel-gfx, dri-devel

On Fri, Oct 21, 2016 at 06:26:54PM +0200, Daniel Vetter wrote:
> On Mon, Sep 26, 2016 at 07:30:53PM +0300, ville.syrjala@linux.intel.com wrote:
> > From: Ville Syrjälä <ville.syrjala@linux.intel.com>
> > 
> > 0 isn't a valid rotation property value, so let's set the initial value
> > of the property to BIT(DRM_ROTATE_0) instead.
> > 
> > In the same vein, we must always have at leat one angle as part of
> > set of supported rotation bits, so let's include DRM_ROTATE_0
> > in there.
> > 
> > v2: Drop the BIT()
> > 
> > Cc: Rob Clark <robdclark@gmail.com>
> > Cc: Jilai Wang <jilaiw@codeaurora.org>
> > Cc: Archit Taneja <architt@codeaurora.org>
> > Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
> 
> This one here had a conflict, so didn't apply. Not sure if still needed.

I think Rob picked it up already.

> -Daniel
> 
> > ---
> >  drivers/gpu/drm/msm/mdp/mdp5/mdp5_plane.c | 4 ++--
> >  1 file changed, 2 insertions(+), 2 deletions(-)
> > 
> > diff --git a/drivers/gpu/drm/msm/mdp/mdp5/mdp5_plane.c b/drivers/gpu/drm/msm/mdp/mdp5/mdp5_plane.c
> > index ba8f43278a44..b0ecf5357bfd 100644
> > --- a/drivers/gpu/drm/msm/mdp/mdp5/mdp5_plane.c
> > +++ b/drivers/gpu/drm/msm/mdp/mdp5/mdp5_plane.c
> > @@ -78,12 +78,12 @@ static void mdp5_plane_install_rotation_property(struct drm_device *dev,
> >  	if (!dev->mode_config.rotation_property)
> >  		dev->mode_config.rotation_property =
> >  			drm_mode_create_rotation_property(dev,
> > -			DRM_REFLECT_X | DRM_REFLECT_Y);
> > +			DRM_ROTATE_0 | DRM_REFLECT_X | DRM_REFLECT_Y);
> >  
> >  	if (dev->mode_config.rotation_property)
> >  		drm_object_attach_property(&plane->base,
> >  			dev->mode_config.rotation_property,
> > -			0);
> > +			DRM_ROTATE_0);
> >  }
> >  
> >  /* helper to install properties which are common to planes and crtcs */
> > -- 
> > 2.7.4
> > 
> > _______________________________________________
> > dri-devel mailing list
> > dri-devel@lists.freedesktop.org
> > https://lists.freedesktop.org/mailman/listinfo/dri-devel
> 
> -- 
> Daniel Vetter
> Software Engineer, Intel Corporation
> http://blog.ffwll.ch

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

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

end of thread, other threads:[~2016-10-21 16:40 UTC | newest]

Thread overview: 32+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-09-26 16:30 [PATCH v2 00/16] drm: drm: Per-plane rotation etc ville.syrjala
2016-09-26 16:30 ` [PATCH v2 01/15] drm: Add drm_rotation_90_or_270() ville.syrjala
2016-09-27  9:32   ` Joonas Lahtinen
2016-09-26 16:30 ` [PATCH 02/15] drm/atomic: Reject attempts to use multiple rotation angles at once ville.syrjala
2016-09-26 16:30 ` [PATCH v3 03/15] drm: Add support for optional per-plane rotation property ville.syrjala
2016-09-27  9:54   ` [Intel-gfx] " Joonas Lahtinen
2016-09-27 10:22     ` Ville Syrjälä
2016-10-21 16:23       ` Daniel Vetter
2016-09-26 16:30 ` [PATCH v2 04/15] drm/arm: Use " ville.syrjala
2016-09-26 16:30 ` [PATCH v3 05/15] drm/atmel-hlcdc: " ville.syrjala
2016-09-26 16:30 ` [PATCH v2 06/15] drm/omap: Set rotation property initial value to BIT(DRM_ROTATE_0) insted of 0 ville.syrjala
2016-09-26 16:30 ` [PATCH v2 07/15] drm/omap: Use per-plane rotation property ville.syrjala
2016-10-06  9:59   ` Tomi Valkeinen
2016-10-06 10:30     ` Ville Syrjälä
2016-10-06 10:32       ` Tomi Valkeinen
2016-09-26 16:30 ` [PATCH v2 08/15] drm/msm/mdp5: Set rotation property initial value to BIT(DRM_ROTATE_0) insted of 0 ville.syrjala
2016-10-21 16:26   ` Daniel Vetter
2016-10-21 16:40     ` Ville Syrjälä
2016-09-26 16:30 ` [PATCH v2 09/15] drm/msm/mdp5: Use per-plane rotation property ville.syrjala
2016-09-26 16:30 ` [PATCH v2 10/15] drm/msm/mdp5: Advertize 180 degree rotation ville.syrjala
2016-09-26 16:30 ` [PATCH v3 11/15] drm/i915: Use the per-plane rotation property ville.syrjala
2016-09-27  9:58   ` Joonas Lahtinen
2016-10-21 16:28     ` [Intel-gfx] " Daniel Vetter
2016-09-26 16:30 ` [PATCH v2 12/15] drm: RIP mode_config->rotation_property ville.syrjala
2016-09-27 10:00   ` [Intel-gfx] " Joonas Lahtinen
2016-09-26 16:30 ` [PATCH v2 13/15] drm/i915: Use & instead if == to check for rotations ville.syrjala
2016-09-26 16:30 ` [PATCH v2 14/15] drm/i915: Clean up rotation DSPCNTR/DVSCNTR/etc. setup ville.syrjala
2016-09-26 16:31 ` [PATCH v2 15/15] drm/i915: Add horizontal mirroring support for CHV pipe B planes ville.syrjala
2016-09-27 10:02   ` [Intel-gfx] " Joonas Lahtinen
2016-09-26 16:40 ` [PATCH v2 00/16] drm: drm: Per-plane rotation etc Ville Syrjälä
2016-09-26 17:12 ` Rob Clark
2016-09-26 17:19 ` ✗ Fi.CI.BAT: warning for " Patchwork

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.