All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] drm: BIT(DRM_ROTATE_?) -> DRM_ROTATE_?
@ 2016-07-25  7:00 Joonas Lahtinen
  2016-07-25  7:39 ` ✗ Ro.CI.BAT: failure for " Patchwork
                   ` (4 more replies)
  0 siblings, 5 replies; 14+ messages in thread
From: Joonas Lahtinen @ 2016-07-25  7:00 UTC (permalink / raw)
  To: Direct Rendering Infrastructure - Development
  Cc: Joonas Lahtinen, intel-gfx, linux-arm-msm, freedreno,
	David Airlie, Daniel Vetter, Ville Syrjälä

Only property creation uses the rotation as an index, so convert the
#define to the more used BIT(DRM_ROTATE_?) form and use __builtin_ffs
to figure the index when needed.

Cc: intel-gfx@lists.freedesktop.org
Cc: linux-arm-msm@vger.kernel.org
Cc: freedreno@lists.freedesktop.org
Cc: David Airlie <airlied@linux.ie>
Cc: Daniel Vetter <daniel.vetter@ffwll.ch>
Cc: Ville Syrjälä <ville.syrjala@linux.intel.com>
Signed-off-by: Joonas Lahtinen <joonas.lahtinen@linux.intel.com>
---
 drivers/gpu/drm/arm/malidp_drv.h                |  2 +-
 drivers/gpu/drm/arm/malidp_planes.c             | 20 +++++++++---------
 drivers/gpu/drm/armada/armada_overlay.c         |  2 +-
 drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_plane.c | 22 +++++++++----------
 drivers/gpu/drm/drm_atomic_helper.c             |  4 ++--
 drivers/gpu/drm/drm_crtc.c                      | 24 ++++++++++-----------
 drivers/gpu/drm/drm_fb_helper.c                 |  4 ++--
 drivers/gpu/drm/drm_plane_helper.c              |  2 +-
 drivers/gpu/drm/drm_rect.c                      | 28 ++++++++++++-------------
 drivers/gpu/drm/i915/i915_debugfs.c             | 12 +++++------
 drivers/gpu/drm/i915/intel_atomic_plane.c       |  2 +-
 drivers/gpu/drm/i915/intel_display.c            | 28 ++++++++++++-------------
 drivers/gpu/drm/i915/intel_drv.h                |  2 +-
 drivers/gpu/drm/i915/intel_fbc.c                |  2 +-
 drivers/gpu/drm/i915/intel_fbdev.c              |  6 +++---
 drivers/gpu/drm/i915/intel_sprite.c             |  6 +++---
 drivers/gpu/drm/msm/mdp/mdp5/mdp5_plane.c       | 10 ++++-----
 drivers/gpu/drm/omapdrm/omap_drv.c              |  6 +++---
 drivers/gpu/drm/omapdrm/omap_fb.c               | 14 ++++++-------
 drivers/gpu/drm/omapdrm/omap_plane.c            | 10 ++++-----
 include/drm/drm_crtc.h                          | 12 +++++------
 21 files changed, 109 insertions(+), 109 deletions(-)

diff --git a/drivers/gpu/drm/arm/malidp_drv.h b/drivers/gpu/drm/arm/malidp_drv.h
index 95558fd..271d2fb 100644
--- a/drivers/gpu/drm/arm/malidp_drv.h
+++ b/drivers/gpu/drm/arm/malidp_drv.h
@@ -49,6 +49,6 @@ void malidp_de_planes_destroy(struct drm_device *drm);
 int malidp_crtc_init(struct drm_device *drm);
 
 /* often used combination of rotational bits */
-#define MALIDP_ROTATED_MASK	(BIT(DRM_ROTATE_90) | BIT(DRM_ROTATE_270))
+#define MALIDP_ROTATED_MASK	(DRM_ROTATE_90 | DRM_ROTATE_270)
 
 #endif  /* __MALIDP_DRV_H__ */
diff --git a/drivers/gpu/drm/arm/malidp_planes.c b/drivers/gpu/drm/arm/malidp_planes.c
index 725098d..82c193e 100644
--- a/drivers/gpu/drm/arm/malidp_planes.c
+++ b/drivers/gpu/drm/arm/malidp_planes.c
@@ -108,7 +108,7 @@ static int malidp_de_plane_check(struct drm_plane *plane,
 		return -EINVAL;
 
 	/* packed RGB888 / BGR888 can't be rotated or flipped */
-	if (state->rotation != BIT(DRM_ROTATE_0) &&
+	if (state->rotation != DRM_ROTATE_0 &&
 	    (state->fb->pixel_format == DRM_FORMAT_RGB888 ||
 	     state->fb->pixel_format == DRM_FORMAT_BGR888))
 		return -EINVAL;
@@ -188,9 +188,9 @@ static void malidp_de_plane_update(struct drm_plane *plane,
 	/* setup the rotation and axis flip bits */
 	if (plane->state->rotation & DRM_ROTATE_MASK)
 		val = ilog2(plane->state->rotation & DRM_ROTATE_MASK) << LAYER_ROT_OFFSET;
-	if (plane->state->rotation & BIT(DRM_REFLECT_X))
+	if (plane->state->rotation & DRM_REFLECT_X)
 		val |= LAYER_V_FLIP;
-	if (plane->state->rotation & BIT(DRM_REFLECT_Y))
+	if (plane->state->rotation & DRM_REFLECT_Y)
 		val |= LAYER_H_FLIP;
 
 	/* set the 'enable layer' bit */
@@ -255,12 +255,12 @@ int malidp_de_planes_init(struct drm_device *drm)
 			goto cleanup;
 
 		if (!drm->mode_config.rotation_property) {
-			unsigned long flags = BIT(DRM_ROTATE_0) |
-					      BIT(DRM_ROTATE_90) |
-					      BIT(DRM_ROTATE_180) |
-					      BIT(DRM_ROTATE_270) |
-					      BIT(DRM_REFLECT_X) |
-					      BIT(DRM_REFLECT_Y);
+			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);
 		}
@@ -268,7 +268,7 @@ int malidp_de_planes_init(struct drm_device *drm)
 		if (drm->mode_config.rotation_property && (id != DE_SMART))
 			drm_object_attach_property(&plane->base.base,
 						   drm->mode_config.rotation_property,
-						   BIT(DRM_ROTATE_0));
+						   DRM_ROTATE_0);
 
 		drm_plane_helper_add(&plane->base,
 				     &malidp_de_plane_helper_funcs);
diff --git a/drivers/gpu/drm/armada/armada_overlay.c b/drivers/gpu/drm/armada/armada_overlay.c
index 1ee707e..152b4e7 100644
--- a/drivers/gpu/drm/armada/armada_overlay.c
+++ b/drivers/gpu/drm/armada/armada_overlay.c
@@ -121,7 +121,7 @@ armada_ovl_plane_update(struct drm_plane *plane, struct drm_crtc *crtc,
 	int ret;
 
 	ret = drm_plane_helper_check_update(plane, crtc, fb, &src, &dest, &clip,
-					    BIT(DRM_ROTATE_0),
+					    DRM_ROTATE_0,
 					    0, INT_MAX, true, false, &visible);
 	if (ret)
 		return ret;
diff --git a/drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_plane.c b/drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_plane.c
index 016c191..146809a 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 & (BIT(DRM_ROTATE_90) | BIT(DRM_ROTATE_270))))
+	    (state->base.rotation & (DRM_ROTATE_90 | DRM_ROTATE_270)))
 		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 & (BIT(DRM_ROTATE_90) | BIT(DRM_ROTATE_270))) {
+	if (state->base.rotation & (DRM_ROTATE_90 | DRM_ROTATE_270)) {
 		tmp = state->crtc_w;
 		state->crtc_w = state->crtc_h;
 		state->crtc_h = tmp;
@@ -677,7 +677,7 @@ static int atmel_hlcdc_plane_atomic_check(struct drm_plane *p,
 			return -EINVAL;
 
 		switch (state->base.rotation & DRM_ROTATE_MASK) {
-		case BIT(DRM_ROTATE_90):
+		case DRM_ROTATE_90:
 			offset = ((y_offset + state->src_y + patched_src_w - 1) /
 				  ydiv) * fb->pitches[i];
 			offset += ((x_offset + state->src_x) / xdiv) *
@@ -686,7 +686,7 @@ static int atmel_hlcdc_plane_atomic_check(struct drm_plane *p,
 					  fb->pitches[i];
 			state->pstride[i] = -fb->pitches[i] - state->bpp[i];
 			break;
-		case BIT(DRM_ROTATE_180):
+		case DRM_ROTATE_180:
 			offset = ((y_offset + state->src_y + patched_src_h - 1) /
 				  ydiv) * fb->pitches[i];
 			offset += ((x_offset + state->src_x + patched_src_w - 1) /
@@ -695,7 +695,7 @@ static int atmel_hlcdc_plane_atomic_check(struct drm_plane *p,
 					   state->bpp[i]) - fb->pitches[i];
 			state->pstride[i] = -2 * state->bpp[i];
 			break;
-		case BIT(DRM_ROTATE_270):
+		case DRM_ROTATE_270:
 			offset = ((y_offset + state->src_y) / ydiv) *
 				 fb->pitches[i];
 			offset += ((x_offset + state->src_x + patched_src_h - 1) /
@@ -705,7 +705,7 @@ static int atmel_hlcdc_plane_atomic_check(struct drm_plane *p,
 					  (2 * state->bpp[i]);
 			state->pstride[i] = fb->pitches[i] - state->bpp[i];
 			break;
-		case BIT(DRM_ROTATE_0):
+		case DRM_ROTATE_0:
 		default:
 			offset = ((y_offset + state->src_y) / ydiv) *
 				 fb->pitches[i];
@@ -905,7 +905,7 @@ static void atmel_hlcdc_plane_init_properties(struct atmel_hlcdc_plane *plane,
 	if (desc->layout.xstride && desc->layout.pstride)
 		drm_object_attach_property(&plane->base.base,
 				plane->base.dev->mode_config.rotation_property,
-				BIT(DRM_ROTATE_0));
+				DRM_ROTATE_0);
 
 	if (desc->layout.csc) {
 		/*
@@ -1056,10 +1056,10 @@ atmel_hlcdc_plane_create_properties(struct drm_device *dev)
 
 	dev->mode_config.rotation_property =
 			drm_mode_create_rotation_property(dev,
-							  BIT(DRM_ROTATE_0) |
-							  BIT(DRM_ROTATE_90) |
-							  BIT(DRM_ROTATE_180) |
-							  BIT(DRM_ROTATE_270));
+							  DRM_ROTATE_0 |
+							  DRM_ROTATE_90 |
+							  DRM_ROTATE_180 |
+							  DRM_ROTATE_270);
 	if (!dev->mode_config.rotation_property)
 		return ERR_PTR(-ENOMEM);
 
diff --git a/drivers/gpu/drm/drm_atomic_helper.c b/drivers/gpu/drm/drm_atomic_helper.c
index de7fddc..61afd85 100644
--- a/drivers/gpu/drm/drm_atomic_helper.c
+++ b/drivers/gpu/drm/drm_atomic_helper.c
@@ -2348,7 +2348,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 & (BIT(DRM_ROTATE_90) | BIT(DRM_ROTATE_270))) {
+	if (primary_state->rotation & (DRM_ROTATE_90 | DRM_ROTATE_270)) {
 		primary_state->src_w = vdisplay << 16;
 		primary_state->src_h = hdisplay << 16;
 	} else {
@@ -3032,7 +3032,7 @@ void drm_atomic_helper_plane_reset(struct drm_plane *plane)
 
 	if (plane->state) {
 		plane->state->plane = plane;
-		plane->state->rotation = BIT(DRM_ROTATE_0);
+		plane->state->rotation = DRM_ROTATE_0;
 	}
 }
 EXPORT_SYMBOL(drm_atomic_helper_plane_reset);
diff --git a/drivers/gpu/drm/drm_crtc.c b/drivers/gpu/drm/drm_crtc.c
index f1d9f05..909a025 100644
--- a/drivers/gpu/drm/drm_crtc.c
+++ b/drivers/gpu/drm/drm_crtc.c
@@ -2804,8 +2804,8 @@ 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 & (BIT(DRM_ROTATE_90) |
-					      BIT(DRM_ROTATE_270)))
+	    crtc->primary->state->rotation & (DRM_ROTATE_90 |
+					      DRM_ROTATE_270))
 		swap(hdisplay, vdisplay);
 
 	return check_src_coords(x << 16, y << 16,
@@ -5646,9 +5646,9 @@ int drm_mode_destroy_dumb_ioctl(struct drm_device *dev,
  * Eg. if the hardware supports everything except DRM_REFLECT_X
  * one could call this function like this:
  *
- * drm_rotation_simplify(rotation, BIT(DRM_ROTATE_0) |
- *                       BIT(DRM_ROTATE_90) | BIT(DRM_ROTATE_180) |
- *                       BIT(DRM_ROTATE_270) | BIT(DRM_REFLECT_Y));
+ * drm_rotation_simplify(rotation, DRM_ROTATE_0 |
+ *                       DRM_ROTATE_90 | DRM_ROTATE_180 |
+ *                       DRM_ROTATE_270 | DRM_REFLECT_Y);
  *
  * to eliminate the DRM_ROTATE_X flag. Depending on what kind of
  * transforms the hardware supports, this function may not
@@ -5659,7 +5659,7 @@ unsigned int drm_rotation_simplify(unsigned int rotation,
 				   unsigned int supported_rotations)
 {
 	if (rotation & ~supported_rotations) {
-		rotation ^= BIT(DRM_REFLECT_X) | BIT(DRM_REFLECT_Y);
+		rotation ^= DRM_REFLECT_X | DRM_REFLECT_Y;
 		rotation = (rotation & DRM_REFLECT_MASK) |
 		           BIT((ffs(rotation & DRM_ROTATE_MASK) + 1) % 4);
 	}
@@ -5788,12 +5788,12 @@ struct drm_property *drm_mode_create_rotation_property(struct drm_device *dev,
 						       unsigned int supported_rotations)
 {
 	static const struct drm_prop_enum_list props[] = {
-		{ DRM_ROTATE_0,   "rotate-0" },
-		{ DRM_ROTATE_90,  "rotate-90" },
-		{ DRM_ROTATE_180, "rotate-180" },
-		{ DRM_ROTATE_270, "rotate-270" },
-		{ DRM_REFLECT_X,  "reflect-x" },
-		{ DRM_REFLECT_Y,  "reflect-y" },
+		{ __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",
diff --git a/drivers/gpu/drm/drm_fb_helper.c b/drivers/gpu/drm/drm_fb_helper.c
index ce54e98..d4896f9 100644
--- a/drivers/gpu/drm/drm_fb_helper.c
+++ b/drivers/gpu/drm/drm_fb_helper.c
@@ -335,7 +335,7 @@ retry:
 			goto fail;
 		}
 
-		plane_state->rotation = BIT(DRM_ROTATE_0);
+		plane_state->rotation = DRM_ROTATE_0;
 
 		plane->old_fb = plane->fb;
 		plane_mask |= 1 << drm_plane_index(plane);
@@ -395,7 +395,7 @@ static int restore_fbdev_mode(struct drm_fb_helper *fb_helper)
 		if (dev->mode_config.rotation_property) {
 			drm_mode_plane_set_obj_prop(plane,
 						    dev->mode_config.rotation_property,
-						    BIT(DRM_ROTATE_0));
+						    DRM_ROTATE_0);
 		}
 	}
 
diff --git a/drivers/gpu/drm/drm_plane_helper.c b/drivers/gpu/drm/drm_plane_helper.c
index 16c4a7b..c360e30 100644
--- a/drivers/gpu/drm/drm_plane_helper.c
+++ b/drivers/gpu/drm/drm_plane_helper.c
@@ -274,7 +274,7 @@ int drm_primary_helper_update(struct drm_plane *plane, struct drm_crtc *crtc,
 
 	ret = drm_plane_helper_check_update(plane, crtc, fb,
 					    &src, &dest, &clip,
-					    BIT(DRM_ROTATE_0),
+					    DRM_ROTATE_0,
 					    DRM_PLANE_HELPER_NO_SCALING,
 					    DRM_PLANE_HELPER_NO_SCALING,
 					    false, false, &visible);
diff --git a/drivers/gpu/drm/drm_rect.c b/drivers/gpu/drm/drm_rect.c
index a8e2c86..4063f6e 100644
--- a/drivers/gpu/drm/drm_rect.c
+++ b/drivers/gpu/drm/drm_rect.c
@@ -317,38 +317,38 @@ void drm_rect_rotate(struct drm_rect *r,
 {
 	struct drm_rect tmp;
 
-	if (rotation & (BIT(DRM_REFLECT_X) | BIT(DRM_REFLECT_Y))) {
+	if (rotation & (DRM_REFLECT_X | DRM_REFLECT_Y)) {
 		tmp = *r;
 
-		if (rotation & BIT(DRM_REFLECT_X)) {
+		if (rotation & DRM_REFLECT_X) {
 			r->x1 = width - tmp.x2;
 			r->x2 = width - tmp.x1;
 		}
 
-		if (rotation & BIT(DRM_REFLECT_Y)) {
+		if (rotation & DRM_REFLECT_Y) {
 			r->y1 = height - tmp.y2;
 			r->y2 = height - tmp.y1;
 		}
 	}
 
 	switch (rotation & DRM_ROTATE_MASK) {
-	case BIT(DRM_ROTATE_0):
+	case DRM_ROTATE_0:
 		break;
-	case BIT(DRM_ROTATE_90):
+	case DRM_ROTATE_90:
 		tmp = *r;
 		r->x1 = tmp.y1;
 		r->x2 = tmp.y2;
 		r->y1 = width - tmp.x2;
 		r->y2 = width - tmp.x1;
 		break;
-	case BIT(DRM_ROTATE_180):
+	case DRM_ROTATE_180:
 		tmp = *r;
 		r->x1 = width - tmp.x2;
 		r->x2 = width - tmp.x1;
 		r->y1 = height - tmp.y2;
 		r->y2 = height - tmp.y1;
 		break;
-	case BIT(DRM_ROTATE_270):
+	case DRM_ROTATE_270:
 		tmp = *r;
 		r->x1 = height - tmp.y2;
 		r->x2 = height - tmp.y1;
@@ -392,23 +392,23 @@ void drm_rect_rotate_inv(struct drm_rect *r,
 	struct drm_rect tmp;
 
 	switch (rotation & DRM_ROTATE_MASK) {
-	case BIT(DRM_ROTATE_0):
+	case DRM_ROTATE_0:
 		break;
-	case BIT(DRM_ROTATE_90):
+	case DRM_ROTATE_90:
 		tmp = *r;
 		r->x1 = width - tmp.y2;
 		r->x2 = width - tmp.y1;
 		r->y1 = tmp.x1;
 		r->y2 = tmp.x2;
 		break;
-	case BIT(DRM_ROTATE_180):
+	case DRM_ROTATE_180:
 		tmp = *r;
 		r->x1 = width - tmp.x2;
 		r->x2 = width - tmp.x1;
 		r->y1 = height - tmp.y2;
 		r->y2 = height - tmp.y1;
 		break;
-	case BIT(DRM_ROTATE_270):
+	case DRM_ROTATE_270:
 		tmp = *r;
 		r->x1 = tmp.y1;
 		r->x2 = tmp.y2;
@@ -419,15 +419,15 @@ void drm_rect_rotate_inv(struct drm_rect *r,
 		break;
 	}
 
-	if (rotation & (BIT(DRM_REFLECT_X) | BIT(DRM_REFLECT_Y))) {
+	if (rotation & (DRM_REFLECT_X | DRM_REFLECT_Y)) {
 		tmp = *r;
 
-		if (rotation & BIT(DRM_REFLECT_X)) {
+		if (rotation & DRM_REFLECT_X) {
 			r->x1 = width - tmp.x2;
 			r->x2 = width - tmp.x1;
 		}
 
-		if (rotation & BIT(DRM_REFLECT_Y)) {
+		if (rotation & DRM_REFLECT_Y) {
 			r->y1 = height - tmp.y2;
 			r->y2 = height - tmp.y1;
 		}
diff --git a/drivers/gpu/drm/i915/i915_debugfs.c b/drivers/gpu/drm/i915/i915_debugfs.c
index 9aa62c5..815232c 100644
--- a/drivers/gpu/drm/i915/i915_debugfs.c
+++ b/drivers/gpu/drm/i915/i915_debugfs.c
@@ -3081,12 +3081,12 @@ static const char *plane_rotation(unsigned int rotation)
 	 */
 	snprintf(buf, sizeof(buf),
 		 "%s%s%s%s%s%s(0x%08x)",
-		 (rotation & BIT(DRM_ROTATE_0)) ? "0 " : "",
-		 (rotation & BIT(DRM_ROTATE_90)) ? "90 " : "",
-		 (rotation & BIT(DRM_ROTATE_180)) ? "180 " : "",
-		 (rotation & BIT(DRM_ROTATE_270)) ? "270 " : "",
-		 (rotation & BIT(DRM_REFLECT_X)) ? "FLIPX " : "",
-		 (rotation & BIT(DRM_REFLECT_Y)) ? "FLIPY " : "",
+		 (rotation & DRM_ROTATE_0) ? "0 " : "",
+		 (rotation & DRM_ROTATE_90) ? "90 " : "",
+		 (rotation & DRM_ROTATE_180) ? "180 " : "",
+		 (rotation & DRM_ROTATE_270) ? "270 " : "",
+		 (rotation & DRM_REFLECT_X) ? "FLIPX " : "",
+		 (rotation & DRM_REFLECT_Y) ? "FLIPY " : "",
 		 rotation);
 
 	return buf;
diff --git a/drivers/gpu/drm/i915/intel_atomic_plane.c b/drivers/gpu/drm/i915/intel_atomic_plane.c
index 7de7721..7cc9c76 100644
--- a/drivers/gpu/drm/i915/intel_atomic_plane.c
+++ b/drivers/gpu/drm/i915/intel_atomic_plane.c
@@ -55,7 +55,7 @@ intel_create_plane_state(struct drm_plane *plane)
 		return NULL;
 
 	state->base.plane = plane;
-	state->base.rotation = BIT(DRM_ROTATE_0);
+	state->base.rotation = DRM_ROTATE_0;
 	state->ckey.flags = I915_SET_COLORKEY_NONE;
 
 	return state;
diff --git a/drivers/gpu/drm/i915/intel_display.c b/drivers/gpu/drm/i915/intel_display.c
index 78beb7e..773954d 100644
--- a/drivers/gpu/drm/i915/intel_display.c
+++ b/drivers/gpu/drm/i915/intel_display.c
@@ -2688,7 +2688,7 @@ static void i9xx_update_primary_plane(struct drm_plane *primary,
 		intel_crtc->dspaddr_offset = linear_offset;
 	}
 
-	if (rotation == BIT(DRM_ROTATE_180)) {
+	if (rotation == DRM_ROTATE_180) {
 		dspcntr |= DISPPLANE_ROTATE_180;
 
 		x += (crtc_state->pipe_src_w - 1);
@@ -2791,7 +2791,7 @@ static void ironlake_update_primary_plane(struct drm_plane *primary,
 		intel_compute_tile_offset(&x, &y, fb, 0,
 					  fb->pitches[0], rotation);
 	linear_offset -= intel_crtc->dspaddr_offset;
-	if (rotation == BIT(DRM_ROTATE_180)) {
+	if (rotation == DRM_ROTATE_180) {
 		dspcntr |= DISPPLANE_ROTATE_180;
 
 		if (!IS_HASWELL(dev) && !IS_BROADWELL(dev)) {
@@ -2952,17 +2952,17 @@ u32 skl_plane_ctl_tiling(uint64_t fb_modifier)
 u32 skl_plane_ctl_rotation(unsigned int rotation)
 {
 	switch (rotation) {
-	case BIT(DRM_ROTATE_0):
+	case DRM_ROTATE_0:
 		break;
 	/*
 	 * DRM_ROTATE_ is counter clockwise to stay compatible with Xrandr
 	 * while i915 HW rotation is clockwise, thats why this swapping.
 	 */
-	case BIT(DRM_ROTATE_90):
+	case DRM_ROTATE_90:
 		return PLANE_CTL_ROTATE_270;
-	case BIT(DRM_ROTATE_180):
+	case DRM_ROTATE_180:
 		return PLANE_CTL_ROTATE_180;
-	case BIT(DRM_ROTATE_270):
+	case DRM_ROTATE_270:
 		return PLANE_CTL_ROTATE_90;
 	default:
 		MISSING_CASE(rotation);
@@ -4248,7 +4248,7 @@ int skl_update_scaler_crtc(struct intel_crtc_state *state)
 		      intel_crtc->pipe, SKL_CRTC_INDEX);
 
 	return skl_update_scaler(state, !state->base.active, SKL_CRTC_INDEX,
-		&state->scaler_state.scaler_id, BIT(DRM_ROTATE_0),
+		&state->scaler_state.scaler_id, DRM_ROTATE_0,
 		state->pipe_src_w, state->pipe_src_h,
 		adjusted_mode->crtc_hdisplay, adjusted_mode->crtc_vdisplay);
 }
@@ -10263,7 +10263,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 == BIT(DRM_ROTATE_180))
+		if (plane_state->base.rotation == DRM_ROTATE_180)
 			cntl |= CURSOR_ROTATE_180;
 	}
 
@@ -10309,7 +10309,7 @@ static void intel_crtc_update_cursor(struct drm_crtc *crtc,
 
 		/* ILK+ do this automagically */
 		if (HAS_GMCH_DISPLAY(dev) &&
-		    plane_state->base.rotation == BIT(DRM_ROTATE_180)) {
+		    plane_state->base.rotation == DRM_ROTATE_180) {
 			base += (plane_state->base.crtc_h *
 				 plane_state->base.crtc_w - 1) * 4;
 		}
@@ -14304,11 +14304,11 @@ fail:
 void intel_create_rotation_property(struct drm_device *dev, struct intel_plane *plane)
 {
 	if (!dev->mode_config.rotation_property) {
-		unsigned long flags = BIT(DRM_ROTATE_0) |
-			BIT(DRM_ROTATE_180);
+		unsigned long flags = DRM_ROTATE_0 |
+			DRM_ROTATE_180;
 
 		if (INTEL_INFO(dev)->gen >= 9)
-			flags |= BIT(DRM_ROTATE_90) | BIT(DRM_ROTATE_270);
+			flags |= DRM_ROTATE_90 | DRM_ROTATE_270;
 
 		dev->mode_config.rotation_property =
 			drm_mode_create_rotation_property(dev, flags);
@@ -14451,8 +14451,8 @@ static struct drm_plane *intel_cursor_plane_create(struct drm_device *dev,
 		if (!dev->mode_config.rotation_property)
 			dev->mode_config.rotation_property =
 				drm_mode_create_rotation_property(dev,
-							BIT(DRM_ROTATE_0) |
-							BIT(DRM_ROTATE_180));
+							DRM_ROTATE_0 |
+							DRM_ROTATE_180);
 		if (dev->mode_config.rotation_property)
 			drm_object_attach_property(&cursor->base.base,
 				dev->mode_config.rotation_property,
diff --git a/drivers/gpu/drm/i915/intel_drv.h b/drivers/gpu/drm/i915/intel_drv.h
index e74d851..f82dcc5 100644
--- a/drivers/gpu/drm/i915/intel_drv.h
+++ b/drivers/gpu/drm/i915/intel_drv.h
@@ -1258,7 +1258,7 @@ unsigned int intel_tile_height(const struct drm_i915_private *dev_priv,
 static inline bool
 intel_rotation_90_or_270(unsigned int rotation)
 {
-	return rotation & (BIT(DRM_ROTATE_90) | BIT(DRM_ROTATE_270));
+	return rotation & (DRM_ROTATE_90 | DRM_ROTATE_270);
 }
 
 void intel_create_rotation_property(struct drm_device *dev,
diff --git a/drivers/gpu/drm/i915/intel_fbc.c b/drivers/gpu/drm/i915/intel_fbc.c
index 781e2f5..eff26d7 100644
--- a/drivers/gpu/drm/i915/intel_fbc.c
+++ b/drivers/gpu/drm/i915/intel_fbc.c
@@ -775,7 +775,7 @@ static bool intel_fbc_can_activate(struct intel_crtc *crtc)
 		return false;
 	}
 	if (INTEL_INFO(dev_priv)->gen <= 4 && !IS_G4X(dev_priv) &&
-	    cache->plane.rotation != BIT(DRM_ROTATE_0)) {
+	    cache->plane.rotation != DRM_ROTATE_0) {
 		fbc->no_fbc_reason = "rotation unsupported";
 		return false;
 	}
diff --git a/drivers/gpu/drm/i915/intel_fbdev.c b/drivers/gpu/drm/i915/intel_fbdev.c
index 6344999..4fee93d 100644
--- a/drivers/gpu/drm/i915/intel_fbdev.c
+++ b/drivers/gpu/drm/i915/intel_fbdev.c
@@ -223,7 +223,7 @@ static int intelfb_create(struct drm_fb_helper *helper,
 	 * This also validates that any existing fb inherited from the
 	 * BIOS is suitable for own access.
 	 */
-	ret = intel_pin_and_fence_fb_obj(&ifbdev->fb->base, BIT(DRM_ROTATE_0));
+	ret = intel_pin_and_fence_fb_obj(&ifbdev->fb->base, DRM_ROTATE_0);
 	if (ret)
 		goto out_unlock;
 
@@ -289,7 +289,7 @@ static int intelfb_create(struct drm_fb_helper *helper,
 out_destroy_fbi:
 	drm_fb_helper_release_fbi(helper);
 out_unpin:
-	intel_unpin_fb_obj(&ifbdev->fb->base, BIT(DRM_ROTATE_0));
+	intel_unpin_fb_obj(&ifbdev->fb->base, DRM_ROTATE_0);
 out_unlock:
 	mutex_unlock(&dev->struct_mutex);
 	return ret;
@@ -554,7 +554,7 @@ static void intel_fbdev_destroy(struct intel_fbdev *ifbdev)
 
 	if (ifbdev->fb) {
 		mutex_lock(&ifbdev->helper.dev->struct_mutex);
-		intel_unpin_fb_obj(&ifbdev->fb->base, BIT(DRM_ROTATE_0));
+		intel_unpin_fb_obj(&ifbdev->fb->base, DRM_ROTATE_0);
 		mutex_unlock(&ifbdev->helper.dev->struct_mutex);
 
 		drm_framebuffer_remove(&ifbdev->fb->base);
diff --git a/drivers/gpu/drm/i915/intel_sprite.c b/drivers/gpu/drm/i915/intel_sprite.c
index 0de935a..22ae2298 100644
--- a/drivers/gpu/drm/i915/intel_sprite.c
+++ b/drivers/gpu/drm/i915/intel_sprite.c
@@ -444,7 +444,7 @@ vlv_update_plane(struct drm_plane *dplane,
 						   fb->pitches[0], rotation);
 	linear_offset -= sprsurf_offset;
 
-	if (rotation == BIT(DRM_ROTATE_180)) {
+	if (rotation == DRM_ROTATE_180) {
 		sprctl |= SP_ROTATE_180;
 
 		x += src_w;
@@ -577,7 +577,7 @@ ivb_update_plane(struct drm_plane *plane,
 						   fb->pitches[0], rotation);
 	linear_offset -= sprsurf_offset;
 
-	if (rotation == BIT(DRM_ROTATE_180)) {
+	if (rotation == DRM_ROTATE_180) {
 		sprctl |= SPRITE_ROTATE_180;
 
 		/* HSW and BDW does this automagically in hardware */
@@ -714,7 +714,7 @@ ilk_update_plane(struct drm_plane *plane,
 						   fb->pitches[0], rotation);
 	linear_offset -= dvssurf_offset;
 
-	if (rotation == BIT(DRM_ROTATE_180)) {
+	if (rotation == DRM_ROTATE_180) {
 		dvscntr |= DVS_ROTATE_180;
 
 		x += src_w;
diff --git a/drivers/gpu/drm/msm/mdp/mdp5/mdp5_plane.c b/drivers/gpu/drm/msm/mdp/mdp5/mdp5_plane.c
index 432c098..a02a24e 100644
--- a/drivers/gpu/drm/msm/mdp/mdp5/mdp5_plane.c
+++ b/drivers/gpu/drm/msm/mdp/mdp5/mdp5_plane.c
@@ -78,7 +78,7 @@ 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,
-			BIT(DRM_REFLECT_X) | BIT(DRM_REFLECT_Y));
+			DRM_REFLECT_X | DRM_REFLECT_Y);
 
 	if (dev->mode_config.rotation_property)
 		drm_object_attach_property(&plane->base,
@@ -309,8 +309,8 @@ static int mdp5_plane_atomic_check(struct drm_plane *plane,
 			return -EINVAL;
 		}
 
-		hflip = !!(state->rotation & BIT(DRM_REFLECT_X));
-		vflip = !!(state->rotation & BIT(DRM_REFLECT_Y));
+		hflip = !!(state->rotation & DRM_REFLECT_X);
+		vflip = !!(state->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,
@@ -743,8 +743,8 @@ 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 & BIT(DRM_REFLECT_X));
-	vflip = !!(pstate->rotation & BIT(DRM_REFLECT_Y));
+	hflip = !!(pstate->rotation & DRM_REFLECT_X);
+	vflip = !!(pstate->rotation & DRM_REFLECT_Y);
 
 	spin_lock_irqsave(&mdp5_plane->pipe_lock, flags);
 
diff --git a/drivers/gpu/drm/omapdrm/omap_drv.c b/drivers/gpu/drm/omapdrm/omap_drv.c
index 26c6134..3dd78f2 100644
--- a/drivers/gpu/drm/omapdrm/omap_drv.c
+++ b/drivers/gpu/drm/omapdrm/omap_drv.c
@@ -295,9 +295,9 @@ static int omap_modeset_init_properties(struct drm_device *dev)
 	if (priv->has_dmm) {
 		dev->mode_config.rotation_property =
 			drm_mode_create_rotation_property(dev,
-				BIT(DRM_ROTATE_0) | BIT(DRM_ROTATE_90) |
-				BIT(DRM_ROTATE_180) | BIT(DRM_ROTATE_270) |
-				BIT(DRM_REFLECT_X) | BIT(DRM_REFLECT_Y));
+				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;
 	}
diff --git a/drivers/gpu/drm/omapdrm/omap_fb.c b/drivers/gpu/drm/omapdrm/omap_fb.c
index 31f5178..5f3337f 100644
--- a/drivers/gpu/drm/omapdrm/omap_fb.c
+++ b/drivers/gpu/drm/omapdrm/omap_fb.c
@@ -179,24 +179,24 @@ void omap_framebuffer_update_scanout(struct drm_framebuffer *fb,
 					(uint32_t)win->rotation);
 			/* fallthru to default to no rotation */
 		case 0:
-		case BIT(DRM_ROTATE_0):
+		case DRM_ROTATE_0:
 			orient = 0;
 			break;
-		case BIT(DRM_ROTATE_90):
+		case DRM_ROTATE_90:
 			orient = MASK_XY_FLIP | MASK_X_INVERT;
 			break;
-		case BIT(DRM_ROTATE_180):
+		case DRM_ROTATE_180:
 			orient = MASK_X_INVERT | MASK_Y_INVERT;
 			break;
-		case BIT(DRM_ROTATE_270):
+		case DRM_ROTATE_270:
 			orient = MASK_XY_FLIP | MASK_Y_INVERT;
 			break;
 		}
 
-		if (win->rotation & BIT(DRM_REFLECT_X))
+		if (win->rotation & DRM_REFLECT_X)
 			orient ^= MASK_X_INVERT;
 
-		if (win->rotation & BIT(DRM_REFLECT_Y))
+		if (win->rotation & DRM_REFLECT_Y)
 			orient ^= MASK_Y_INVERT;
 
 		/* adjust x,y offset for flip/invert: */
@@ -213,7 +213,7 @@ void omap_framebuffer_update_scanout(struct drm_framebuffer *fb,
 	} else {
 		switch (win->rotation & DRM_ROTATE_MASK) {
 		case 0:
-		case BIT(DRM_ROTATE_0):
+		case DRM_ROTATE_0:
 			/* OK */
 			break;
 
diff --git a/drivers/gpu/drm/omapdrm/omap_plane.c b/drivers/gpu/drm/omapdrm/omap_plane.c
index 5252ab7..4c7727e 100644
--- a/drivers/gpu/drm/omapdrm/omap_plane.c
+++ b/drivers/gpu/drm/omapdrm/omap_plane.c
@@ -109,8 +109,8 @@ static void omap_plane_atomic_update(struct drm_plane *plane,
 	win.src_y = state->src_y >> 16;
 
 	switch (state->rotation & DRM_ROTATE_MASK) {
-	case BIT(DRM_ROTATE_90):
-	case BIT(DRM_ROTATE_270):
+	case DRM_ROTATE_90:
+	case DRM_ROTATE_270:
 		win.src_w = state->src_h >> 16;
 		win.src_h = state->src_w >> 16;
 		break;
@@ -149,7 +149,7 @@ static void omap_plane_atomic_disable(struct drm_plane *plane,
 	struct omap_plane_state *omap_state = to_omap_plane_state(plane->state);
 	struct omap_plane *omap_plane = to_omap_plane(plane);
 
-	plane->state->rotation = BIT(DRM_ROTATE_0);
+	plane->state->rotation = DRM_ROTATE_0;
 	omap_state->zorder = plane->type == DRM_PLANE_TYPE_PRIMARY
 			   ? 0 : omap_plane->id;
 
@@ -178,7 +178,7 @@ static int omap_plane_atomic_check(struct drm_plane *plane,
 		return -EINVAL;
 
 	if (state->fb) {
-		if (state->rotation != BIT(DRM_ROTATE_0) &&
+		if (state->rotation != DRM_ROTATE_0 &&
 		    !omap_framebuffer_supports_rotation(state->fb))
 			return -EINVAL;
 	}
@@ -269,7 +269,7 @@ static void omap_plane_reset(struct drm_plane *plane)
 	 */
 	omap_state->zorder = plane->type == DRM_PLANE_TYPE_PRIMARY
 			   ? 0 : omap_plane->id;
-	omap_state->base.rotation = BIT(DRM_ROTATE_0);
+	omap_state->base.rotation = DRM_ROTATE_0;
 
 	plane->state = &omap_state->base;
 	plane->state->plane = plane;
diff --git a/include/drm/drm_crtc.h b/include/drm/drm_crtc.h
index 3edeaf8..57bbc61 100644
--- a/include/drm/drm_crtc.h
+++ b/include/drm/drm_crtc.h
@@ -84,13 +84,13 @@ static inline uint64_t I642U64(int64_t val)
  * DRM_REFLECT_Y reflects the image along the specified axis prior to rotation
  */
 #define DRM_ROTATE_MASK 0x0f
-#define DRM_ROTATE_0	0
-#define DRM_ROTATE_90	1
-#define DRM_ROTATE_180	2
-#define DRM_ROTATE_270	3
+#define DRM_ROTATE_0	BIT(0)
+#define DRM_ROTATE_90	BIT(1)
+#define DRM_ROTATE_180	BIT(2)
+#define DRM_ROTATE_270	BIT(3)
 #define DRM_REFLECT_MASK (~DRM_ROTATE_MASK)
-#define DRM_REFLECT_X	4
-#define DRM_REFLECT_Y	5
+#define DRM_REFLECT_X	BIT(4)
+#define DRM_REFLECT_Y	BIT(5)
 
 enum drm_connector_force {
 	DRM_FORCE_UNSPECIFIED,
-- 
2.5.5

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

* ✗ Ro.CI.BAT: failure for drm: BIT(DRM_ROTATE_?) -> DRM_ROTATE_?
  2016-07-25  7:00 [PATCH] drm: BIT(DRM_ROTATE_?) -> DRM_ROTATE_? Joonas Lahtinen
@ 2016-07-25  7:39 ` Patchwork
  2016-07-25 10:23   ` Joonas Lahtinen
       [not found] ` <1469430025-13540-1-git-send-email-joonas.lahtinen-VuQAYsv1563Yd54FQh9/CA@public.gmane.org>
                   ` (3 subsequent siblings)
  4 siblings, 1 reply; 14+ messages in thread
From: Patchwork @ 2016-07-25  7:39 UTC (permalink / raw)
  To: Joonas Lahtinen; +Cc: intel-gfx

== Series Details ==

Series: drm: BIT(DRM_ROTATE_?) -> DRM_ROTATE_?
URL   : https://patchwork.freedesktop.org/series/10229/
State : failure

== Summary ==

Series 10229v1 drm: BIT(DRM_ROTATE_?) -> DRM_ROTATE_?
http://patchwork.freedesktop.org/api/1.0/series/10229/revisions/1/mbox

Test drv_module_reload_basic:
                pass       -> SKIP       (ro-hsw-i3-4010u)
Test gem_sync:
        Subgroup basic-store-each:
                pass       -> DMESG-FAIL (ro-bdw-i7-5600u)

ro-bdw-i5-5250u  total:244  pass:219  dwarn:4   dfail:0   fail:8   skip:13 
ro-bdw-i7-5600u  total:244  pass:203  dwarn:0   dfail:1   fail:8   skip:32 
ro-bsw-n3050     total:218  pass:173  dwarn:0   dfail:0   fail:2   skip:42 
ro-byt-n2820     total:244  pass:197  dwarn:0   dfail:0   fail:9   skip:38 
ro-hsw-i3-4010u  total:244  pass:211  dwarn:0   dfail:0   fail:8   skip:25 
ro-hsw-i7-4770r  total:244  pass:212  dwarn:0   dfail:0   fail:8   skip:24 
ro-ilk-i7-620lm  total:244  pass:172  dwarn:0   dfail:0   fail:9   skip:63 
ro-ilk1-i5-650   total:239  pass:172  dwarn:0   dfail:0   fail:9   skip:58 
ro-ivb-i7-3770   total:244  pass:203  dwarn:0   dfail:0   fail:8   skip:33 
ro-skl3-i5-6260u total:244  pass:224  dwarn:0   dfail:0   fail:8   skip:12 
ro-snb-i7-2620M  total:244  pass:193  dwarn:0   dfail:0   fail:9   skip:42 
ro-bdw-i7-5557U failed to connect after reboot

Results at /archive/results/CI_IGT_test/RO_Patchwork_1594/

5c9e3d9 drm-intel-nightly: 2016y-07m-25d-06h-32m-37s UTC integration manifest
7e91383 drm: BIT(DRM_ROTATE_?) -> DRM_ROTATE_?

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

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

* Re: ✗ Ro.CI.BAT: failure for drm: BIT(DRM_ROTATE_?) -> DRM_ROTATE_?
  2016-07-25  7:39 ` ✗ Ro.CI.BAT: failure for " Patchwork
@ 2016-07-25 10:23   ` Joonas Lahtinen
  0 siblings, 0 replies; 14+ messages in thread
From: Joonas Lahtinen @ 2016-07-25 10:23 UTC (permalink / raw)
  To: intel-gfx

On ma, 2016-07-25 at 07:39 +0000, Patchwork wrote:
> == Series Details ==
> 
> Series: drm: BIT(DRM_ROTATE_?) -> DRM_ROTATE_?
> URL   : https://patchwork.freedesktop.org/series/10229/
> State : failure
> 
> == Summary ==
> 
> Series 10229v1 drm: BIT(DRM_ROTATE_?) -> DRM_ROTATE_?
> http://patchwork.freedesktop.org/api/1.0/series/10229/revisions/1/mbox
> 
> Test drv_module_reload_basic:
>                 pass       -> SKIP       (ro-hsw-i3-4010u)
> Test gem_sync:
>         Subgroup basic-store-each:
>                 pass       -> DMESG-FAIL (ro-bdw-i7-5600u)

Filed a new bug;

https://bugs.freedesktop.org/show_bug.cgi?id=97071

Kernel error:

[drm:i915_hangcheck_elapsed [i915]] *ERROR* Hangcheck timer elapsed...
video enhancement ring idle

> 
> ro-bdw-i5-5250u  total:244  pass:219  dwarn:4   dfail:0   fail:8   skip:13 
> ro-bdw-i7-5600u  total:244  pass:203  dwarn:0   dfail:1   fail:8   skip:32 
> ro-bsw-n3050     total:218  pass:173  dwarn:0   dfail:0   fail:2   skip:42 
> ro-byt-n2820     total:244  pass:197  dwarn:0   dfail:0   fail:9   skip:38 
> ro-hsw-i3-4010u  total:244  pass:211  dwarn:0   dfail:0   fail:8   skip:25 
> ro-hsw-i7-4770r  total:244  pass:212  dwarn:0   dfail:0   fail:8   skip:24 
> ro-ilk-i7-620lm  total:244  pass:172  dwarn:0   dfail:0   fail:9   skip:63 
> ro-ilk1-i5-650   total:239  pass:172  dwarn:0   dfail:0   fail:9   skip:58 
> ro-ivb-i7-3770   total:244  pass:203  dwarn:0   dfail:0   fail:8   skip:33 
> ro-skl3-i5-6260u total:244  pass:224  dwarn:0   dfail:0   fail:8   skip:12 
> ro-snb-i7-2620M  total:244  pass:193  dwarn:0   dfail:0   fail:9   skip:42 
> ro-bdw-i7-5557U failed to connect after reboot
> 
> Results at /archive/results/CI_IGT_test/RO_Patchwork_1594/
> 
> 5c9e3d9 drm-intel-nightly: 2016y-07m-25d-06h-32m-37s UTC integration manifest
> 7e91383 drm: BIT(DRM_ROTATE_?) -> DRM_ROTATE_?
> 
-- 
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] 14+ messages in thread

* Re: [PATCH] drm: BIT(DRM_ROTATE_?) -> DRM_ROTATE_?
       [not found] ` <1469430025-13540-1-git-send-email-joonas.lahtinen-VuQAYsv1563Yd54FQh9/CA@public.gmane.org>
@ 2016-07-26  9:05   ` Liviu Dudau
  2016-07-26 11:53     ` Joonas Lahtinen
  0 siblings, 1 reply; 14+ messages in thread
From: Liviu Dudau @ 2016-07-26  9:05 UTC (permalink / raw)
  To: Joonas Lahtinen
  Cc: linux-arm-msm-u79uwXL29TY76Z2rM5mHXA,
	intel-gfx-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW,
	freedreno-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW,
	Direct Rendering Infrastructure - Development, Daniel Vetter

Hi Joonas,

On Mon, Jul 25, 2016 at 10:00:25AM +0300, Joonas Lahtinen wrote:
> Only property creation uses the rotation as an index, so convert the
> #define to the more used BIT(DRM_ROTATE_?) form and use __builtin_ffs
> to figure the index when needed.
> 
> Cc: intel-gfx@lists.freedesktop.org
> Cc: linux-arm-msm@vger.kernel.org
> Cc: freedreno@lists.freedesktop.org
> Cc: David Airlie <airlied@linux.ie>
> Cc: Daniel Vetter <daniel.vetter@ffwll.ch>
> Cc: Ville Syrjälä <ville.syrjala@linux.intel.com>
> Signed-off-by: Joonas Lahtinen <joonas.lahtinen@linux.intel.com>
> ---
>  drivers/gpu/drm/arm/malidp_drv.h                |  2 +-
>  drivers/gpu/drm/arm/malidp_planes.c             | 20 +++++++++---------
>  drivers/gpu/drm/armada/armada_overlay.c         |  2 +-
>  drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_plane.c | 22 +++++++++----------
>  drivers/gpu/drm/drm_atomic_helper.c             |  4 ++--
>  drivers/gpu/drm/drm_crtc.c                      | 24 ++++++++++-----------
>  drivers/gpu/drm/drm_fb_helper.c                 |  4 ++--
>  drivers/gpu/drm/drm_plane_helper.c              |  2 +-
>  drivers/gpu/drm/drm_rect.c                      | 28 ++++++++++++-------------
>  drivers/gpu/drm/i915/i915_debugfs.c             | 12 +++++------
>  drivers/gpu/drm/i915/intel_atomic_plane.c       |  2 +-
>  drivers/gpu/drm/i915/intel_display.c            | 28 ++++++++++++-------------
>  drivers/gpu/drm/i915/intel_drv.h                |  2 +-
>  drivers/gpu/drm/i915/intel_fbc.c                |  2 +-
>  drivers/gpu/drm/i915/intel_fbdev.c              |  6 +++---
>  drivers/gpu/drm/i915/intel_sprite.c             |  6 +++---
>  drivers/gpu/drm/msm/mdp/mdp5/mdp5_plane.c       | 10 ++++-----
>  drivers/gpu/drm/omapdrm/omap_drv.c              |  6 +++---
>  drivers/gpu/drm/omapdrm/omap_fb.c               | 14 ++++++-------
>  drivers/gpu/drm/omapdrm/omap_plane.c            | 10 ++++-----
>  include/drm/drm_crtc.h                          | 12 +++++------
>  21 files changed, 109 insertions(+), 109 deletions(-)
> 
> diff --git a/drivers/gpu/drm/arm/malidp_drv.h b/drivers/gpu/drm/arm/malidp_drv.h
> index 95558fd..271d2fb 100644
> --- a/drivers/gpu/drm/arm/malidp_drv.h
> +++ b/drivers/gpu/drm/arm/malidp_drv.h
> @@ -49,6 +49,6 @@ void malidp_de_planes_destroy(struct drm_device *drm);
>  int malidp_crtc_init(struct drm_device *drm);
>  
>  /* often used combination of rotational bits */
> -#define MALIDP_ROTATED_MASK	(BIT(DRM_ROTATE_90) | BIT(DRM_ROTATE_270))
> +#define MALIDP_ROTATED_MASK	(DRM_ROTATE_90 | DRM_ROTATE_270)
>  
>  #endif  /* __MALIDP_DRV_H__ */
> diff --git a/drivers/gpu/drm/arm/malidp_planes.c b/drivers/gpu/drm/arm/malidp_planes.c
> index 725098d..82c193e 100644
> --- a/drivers/gpu/drm/arm/malidp_planes.c
> +++ b/drivers/gpu/drm/arm/malidp_planes.c
> @@ -108,7 +108,7 @@ static int malidp_de_plane_check(struct drm_plane *plane,
>  		return -EINVAL;
>  
>  	/* packed RGB888 / BGR888 can't be rotated or flipped */
> -	if (state->rotation != BIT(DRM_ROTATE_0) &&
> +	if (state->rotation != DRM_ROTATE_0 &&
>  	    (state->fb->pixel_format == DRM_FORMAT_RGB888 ||
>  	     state->fb->pixel_format == DRM_FORMAT_BGR888))
>  		return -EINVAL;
> @@ -188,9 +188,9 @@ static void malidp_de_plane_update(struct drm_plane *plane,
>  	/* setup the rotation and axis flip bits */
>  	if (plane->state->rotation & DRM_ROTATE_MASK)
>  		val = ilog2(plane->state->rotation & DRM_ROTATE_MASK) << LAYER_ROT_OFFSET;
> -	if (plane->state->rotation & BIT(DRM_REFLECT_X))
> +	if (plane->state->rotation & DRM_REFLECT_X)
>  		val |= LAYER_V_FLIP;
> -	if (plane->state->rotation & BIT(DRM_REFLECT_Y))
> +	if (plane->state->rotation & DRM_REFLECT_Y)
>  		val |= LAYER_H_FLIP;
>  
>  	/* set the 'enable layer' bit */
> @@ -255,12 +255,12 @@ int malidp_de_planes_init(struct drm_device *drm)
>  			goto cleanup;
>  
>  		if (!drm->mode_config.rotation_property) {
> -			unsigned long flags = BIT(DRM_ROTATE_0) |
> -					      BIT(DRM_ROTATE_90) |
> -					      BIT(DRM_ROTATE_180) |
> -					      BIT(DRM_ROTATE_270) |
> -					      BIT(DRM_REFLECT_X) |
> -					      BIT(DRM_REFLECT_Y);
> +			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);
>  		}
> @@ -268,7 +268,7 @@ int malidp_de_planes_init(struct drm_device *drm)
>  		if (drm->mode_config.rotation_property && (id != DE_SMART))
>  			drm_object_attach_property(&plane->base.base,
>  						   drm->mode_config.rotation_property,
> -						   BIT(DRM_ROTATE_0));
> +						   DRM_ROTATE_0);
>  
>  		drm_plane_helper_add(&plane->base,
>  				     &malidp_de_plane_helper_funcs);

This patch touches arm/mali-dp driver but the maintainers have not been Cc-ed in the patch? Did
get_maintainer.pl fail to show our e-mails? (Driver has been added recently, wondering if there
are issues with MAINTAINERS entry).

The change looks OK to me for mali-dp. So:

Acked-by: Liviu Dudau <Liviu.Dudau@arm.com>

(one comment at the end of email as well).

Best regards,
Liviu

> diff --git a/drivers/gpu/drm/armada/armada_overlay.c b/drivers/gpu/drm/armada/armada_overlay.c
> index 1ee707e..152b4e7 100644
> --- a/drivers/gpu/drm/armada/armada_overlay.c
> +++ b/drivers/gpu/drm/armada/armada_overlay.c
> @@ -121,7 +121,7 @@ armada_ovl_plane_update(struct drm_plane *plane, struct drm_crtc *crtc,
>  	int ret;
>  
>  	ret = drm_plane_helper_check_update(plane, crtc, fb, &src, &dest, &clip,
> -					    BIT(DRM_ROTATE_0),
> +					    DRM_ROTATE_0,
>  					    0, INT_MAX, true, false, &visible);
>  	if (ret)
>  		return ret;
> diff --git a/drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_plane.c b/drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_plane.c
> index 016c191..146809a 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 & (BIT(DRM_ROTATE_90) | BIT(DRM_ROTATE_270))))
> +	    (state->base.rotation & (DRM_ROTATE_90 | DRM_ROTATE_270)))
>  		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 & (BIT(DRM_ROTATE_90) | BIT(DRM_ROTATE_270))) {
> +	if (state->base.rotation & (DRM_ROTATE_90 | DRM_ROTATE_270)) {
>  		tmp = state->crtc_w;
>  		state->crtc_w = state->crtc_h;
>  		state->crtc_h = tmp;
> @@ -677,7 +677,7 @@ static int atmel_hlcdc_plane_atomic_check(struct drm_plane *p,
>  			return -EINVAL;
>  
>  		switch (state->base.rotation & DRM_ROTATE_MASK) {
> -		case BIT(DRM_ROTATE_90):
> +		case DRM_ROTATE_90:
>  			offset = ((y_offset + state->src_y + patched_src_w - 1) /
>  				  ydiv) * fb->pitches[i];
>  			offset += ((x_offset + state->src_x) / xdiv) *
> @@ -686,7 +686,7 @@ static int atmel_hlcdc_plane_atomic_check(struct drm_plane *p,
>  					  fb->pitches[i];
>  			state->pstride[i] = -fb->pitches[i] - state->bpp[i];
>  			break;
> -		case BIT(DRM_ROTATE_180):
> +		case DRM_ROTATE_180:
>  			offset = ((y_offset + state->src_y + patched_src_h - 1) /
>  				  ydiv) * fb->pitches[i];
>  			offset += ((x_offset + state->src_x + patched_src_w - 1) /
> @@ -695,7 +695,7 @@ static int atmel_hlcdc_plane_atomic_check(struct drm_plane *p,
>  					   state->bpp[i]) - fb->pitches[i];
>  			state->pstride[i] = -2 * state->bpp[i];
>  			break;
> -		case BIT(DRM_ROTATE_270):
> +		case DRM_ROTATE_270:
>  			offset = ((y_offset + state->src_y) / ydiv) *
>  				 fb->pitches[i];
>  			offset += ((x_offset + state->src_x + patched_src_h - 1) /
> @@ -705,7 +705,7 @@ static int atmel_hlcdc_plane_atomic_check(struct drm_plane *p,
>  					  (2 * state->bpp[i]);
>  			state->pstride[i] = fb->pitches[i] - state->bpp[i];
>  			break;
> -		case BIT(DRM_ROTATE_0):
> +		case DRM_ROTATE_0:
>  		default:
>  			offset = ((y_offset + state->src_y) / ydiv) *
>  				 fb->pitches[i];
> @@ -905,7 +905,7 @@ static void atmel_hlcdc_plane_init_properties(struct atmel_hlcdc_plane *plane,
>  	if (desc->layout.xstride && desc->layout.pstride)
>  		drm_object_attach_property(&plane->base.base,
>  				plane->base.dev->mode_config.rotation_property,
> -				BIT(DRM_ROTATE_0));
> +				DRM_ROTATE_0);
>  
>  	if (desc->layout.csc) {
>  		/*
> @@ -1056,10 +1056,10 @@ atmel_hlcdc_plane_create_properties(struct drm_device *dev)
>  
>  	dev->mode_config.rotation_property =
>  			drm_mode_create_rotation_property(dev,
> -							  BIT(DRM_ROTATE_0) |
> -							  BIT(DRM_ROTATE_90) |
> -							  BIT(DRM_ROTATE_180) |
> -							  BIT(DRM_ROTATE_270));
> +							  DRM_ROTATE_0 |
> +							  DRM_ROTATE_90 |
> +							  DRM_ROTATE_180 |
> +							  DRM_ROTATE_270);
>  	if (!dev->mode_config.rotation_property)
>  		return ERR_PTR(-ENOMEM);
>  
> diff --git a/drivers/gpu/drm/drm_atomic_helper.c b/drivers/gpu/drm/drm_atomic_helper.c
> index de7fddc..61afd85 100644
> --- a/drivers/gpu/drm/drm_atomic_helper.c
> +++ b/drivers/gpu/drm/drm_atomic_helper.c
> @@ -2348,7 +2348,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 & (BIT(DRM_ROTATE_90) | BIT(DRM_ROTATE_270))) {
> +	if (primary_state->rotation & (DRM_ROTATE_90 | DRM_ROTATE_270)) {
>  		primary_state->src_w = vdisplay << 16;
>  		primary_state->src_h = hdisplay << 16;
>  	} else {
> @@ -3032,7 +3032,7 @@ void drm_atomic_helper_plane_reset(struct drm_plane *plane)
>  
>  	if (plane->state) {
>  		plane->state->plane = plane;
> -		plane->state->rotation = BIT(DRM_ROTATE_0);
> +		plane->state->rotation = DRM_ROTATE_0;
>  	}
>  }
>  EXPORT_SYMBOL(drm_atomic_helper_plane_reset);
> diff --git a/drivers/gpu/drm/drm_crtc.c b/drivers/gpu/drm/drm_crtc.c
> index f1d9f05..909a025 100644
> --- a/drivers/gpu/drm/drm_crtc.c
> +++ b/drivers/gpu/drm/drm_crtc.c
> @@ -2804,8 +2804,8 @@ 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 & (BIT(DRM_ROTATE_90) |
> -					      BIT(DRM_ROTATE_270)))
> +	    crtc->primary->state->rotation & (DRM_ROTATE_90 |
> +					      DRM_ROTATE_270))
>  		swap(hdisplay, vdisplay);
>  
>  	return check_src_coords(x << 16, y << 16,
> @@ -5646,9 +5646,9 @@ int drm_mode_destroy_dumb_ioctl(struct drm_device *dev,
>   * Eg. if the hardware supports everything except DRM_REFLECT_X
>   * one could call this function like this:
>   *
> - * drm_rotation_simplify(rotation, BIT(DRM_ROTATE_0) |
> - *                       BIT(DRM_ROTATE_90) | BIT(DRM_ROTATE_180) |
> - *                       BIT(DRM_ROTATE_270) | BIT(DRM_REFLECT_Y));
> + * drm_rotation_simplify(rotation, DRM_ROTATE_0 |
> + *                       DRM_ROTATE_90 | DRM_ROTATE_180 |
> + *                       DRM_ROTATE_270 | DRM_REFLECT_Y);
>   *
>   * to eliminate the DRM_ROTATE_X flag. Depending on what kind of
>   * transforms the hardware supports, this function may not
> @@ -5659,7 +5659,7 @@ unsigned int drm_rotation_simplify(unsigned int rotation,
>  				   unsigned int supported_rotations)
>  {
>  	if (rotation & ~supported_rotations) {
> -		rotation ^= BIT(DRM_REFLECT_X) | BIT(DRM_REFLECT_Y);
> +		rotation ^= DRM_REFLECT_X | DRM_REFLECT_Y;
>  		rotation = (rotation & DRM_REFLECT_MASK) |
>  		           BIT((ffs(rotation & DRM_ROTATE_MASK) + 1) % 4);
>  	}
> @@ -5788,12 +5788,12 @@ struct drm_property *drm_mode_create_rotation_property(struct drm_device *dev,
>  						       unsigned int supported_rotations)
>  {
>  	static const struct drm_prop_enum_list props[] = {
> -		{ DRM_ROTATE_0,   "rotate-0" },
> -		{ DRM_ROTATE_90,  "rotate-90" },
> -		{ DRM_ROTATE_180, "rotate-180" },
> -		{ DRM_ROTATE_270, "rotate-270" },
> -		{ DRM_REFLECT_X,  "reflect-x" },
> -		{ DRM_REFLECT_Y,  "reflect-y" },
> +		{ __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",
> diff --git a/drivers/gpu/drm/drm_fb_helper.c b/drivers/gpu/drm/drm_fb_helper.c
> index ce54e98..d4896f9 100644
> --- a/drivers/gpu/drm/drm_fb_helper.c
> +++ b/drivers/gpu/drm/drm_fb_helper.c
> @@ -335,7 +335,7 @@ retry:
>  			goto fail;
>  		}
>  
> -		plane_state->rotation = BIT(DRM_ROTATE_0);
> +		plane_state->rotation = DRM_ROTATE_0;
>  
>  		plane->old_fb = plane->fb;
>  		plane_mask |= 1 << drm_plane_index(plane);
> @@ -395,7 +395,7 @@ static int restore_fbdev_mode(struct drm_fb_helper *fb_helper)
>  		if (dev->mode_config.rotation_property) {
>  			drm_mode_plane_set_obj_prop(plane,
>  						    dev->mode_config.rotation_property,
> -						    BIT(DRM_ROTATE_0));
> +						    DRM_ROTATE_0);
>  		}
>  	}
>  
> diff --git a/drivers/gpu/drm/drm_plane_helper.c b/drivers/gpu/drm/drm_plane_helper.c
> index 16c4a7b..c360e30 100644
> --- a/drivers/gpu/drm/drm_plane_helper.c
> +++ b/drivers/gpu/drm/drm_plane_helper.c
> @@ -274,7 +274,7 @@ int drm_primary_helper_update(struct drm_plane *plane, struct drm_crtc *crtc,
>  
>  	ret = drm_plane_helper_check_update(plane, crtc, fb,
>  					    &src, &dest, &clip,
> -					    BIT(DRM_ROTATE_0),
> +					    DRM_ROTATE_0,
>  					    DRM_PLANE_HELPER_NO_SCALING,
>  					    DRM_PLANE_HELPER_NO_SCALING,
>  					    false, false, &visible);
> diff --git a/drivers/gpu/drm/drm_rect.c b/drivers/gpu/drm/drm_rect.c
> index a8e2c86..4063f6e 100644
> --- a/drivers/gpu/drm/drm_rect.c
> +++ b/drivers/gpu/drm/drm_rect.c
> @@ -317,38 +317,38 @@ void drm_rect_rotate(struct drm_rect *r,
>  {
>  	struct drm_rect tmp;
>  
> -	if (rotation & (BIT(DRM_REFLECT_X) | BIT(DRM_REFLECT_Y))) {
> +	if (rotation & (DRM_REFLECT_X | DRM_REFLECT_Y)) {
>  		tmp = *r;
>  
> -		if (rotation & BIT(DRM_REFLECT_X)) {
> +		if (rotation & DRM_REFLECT_X) {
>  			r->x1 = width - tmp.x2;
>  			r->x2 = width - tmp.x1;
>  		}
>  
> -		if (rotation & BIT(DRM_REFLECT_Y)) {
> +		if (rotation & DRM_REFLECT_Y) {
>  			r->y1 = height - tmp.y2;
>  			r->y2 = height - tmp.y1;
>  		}
>  	}
>  
>  	switch (rotation & DRM_ROTATE_MASK) {
> -	case BIT(DRM_ROTATE_0):
> +	case DRM_ROTATE_0:
>  		break;
> -	case BIT(DRM_ROTATE_90):
> +	case DRM_ROTATE_90:
>  		tmp = *r;
>  		r->x1 = tmp.y1;
>  		r->x2 = tmp.y2;
>  		r->y1 = width - tmp.x2;
>  		r->y2 = width - tmp.x1;
>  		break;
> -	case BIT(DRM_ROTATE_180):
> +	case DRM_ROTATE_180:
>  		tmp = *r;
>  		r->x1 = width - tmp.x2;
>  		r->x2 = width - tmp.x1;
>  		r->y1 = height - tmp.y2;
>  		r->y2 = height - tmp.y1;
>  		break;
> -	case BIT(DRM_ROTATE_270):
> +	case DRM_ROTATE_270:
>  		tmp = *r;
>  		r->x1 = height - tmp.y2;
>  		r->x2 = height - tmp.y1;
> @@ -392,23 +392,23 @@ void drm_rect_rotate_inv(struct drm_rect *r,
>  	struct drm_rect tmp;
>  
>  	switch (rotation & DRM_ROTATE_MASK) {
> -	case BIT(DRM_ROTATE_0):
> +	case DRM_ROTATE_0:
>  		break;
> -	case BIT(DRM_ROTATE_90):
> +	case DRM_ROTATE_90:
>  		tmp = *r;
>  		r->x1 = width - tmp.y2;
>  		r->x2 = width - tmp.y1;
>  		r->y1 = tmp.x1;
>  		r->y2 = tmp.x2;
>  		break;
> -	case BIT(DRM_ROTATE_180):
> +	case DRM_ROTATE_180:
>  		tmp = *r;
>  		r->x1 = width - tmp.x2;
>  		r->x2 = width - tmp.x1;
>  		r->y1 = height - tmp.y2;
>  		r->y2 = height - tmp.y1;
>  		break;
> -	case BIT(DRM_ROTATE_270):
> +	case DRM_ROTATE_270:
>  		tmp = *r;
>  		r->x1 = tmp.y1;
>  		r->x2 = tmp.y2;
> @@ -419,15 +419,15 @@ void drm_rect_rotate_inv(struct drm_rect *r,
>  		break;
>  	}
>  
> -	if (rotation & (BIT(DRM_REFLECT_X) | BIT(DRM_REFLECT_Y))) {
> +	if (rotation & (DRM_REFLECT_X | DRM_REFLECT_Y)) {
>  		tmp = *r;
>  
> -		if (rotation & BIT(DRM_REFLECT_X)) {
> +		if (rotation & DRM_REFLECT_X) {
>  			r->x1 = width - tmp.x2;
>  			r->x2 = width - tmp.x1;
>  		}
>  
> -		if (rotation & BIT(DRM_REFLECT_Y)) {
> +		if (rotation & DRM_REFLECT_Y) {
>  			r->y1 = height - tmp.y2;
>  			r->y2 = height - tmp.y1;
>  		}
> diff --git a/drivers/gpu/drm/i915/i915_debugfs.c b/drivers/gpu/drm/i915/i915_debugfs.c
> index 9aa62c5..815232c 100644
> --- a/drivers/gpu/drm/i915/i915_debugfs.c
> +++ b/drivers/gpu/drm/i915/i915_debugfs.c
> @@ -3081,12 +3081,12 @@ static const char *plane_rotation(unsigned int rotation)
>  	 */
>  	snprintf(buf, sizeof(buf),
>  		 "%s%s%s%s%s%s(0x%08x)",
> -		 (rotation & BIT(DRM_ROTATE_0)) ? "0 " : "",
> -		 (rotation & BIT(DRM_ROTATE_90)) ? "90 " : "",
> -		 (rotation & BIT(DRM_ROTATE_180)) ? "180 " : "",
> -		 (rotation & BIT(DRM_ROTATE_270)) ? "270 " : "",
> -		 (rotation & BIT(DRM_REFLECT_X)) ? "FLIPX " : "",
> -		 (rotation & BIT(DRM_REFLECT_Y)) ? "FLIPY " : "",
> +		 (rotation & DRM_ROTATE_0) ? "0 " : "",
> +		 (rotation & DRM_ROTATE_90) ? "90 " : "",
> +		 (rotation & DRM_ROTATE_180) ? "180 " : "",
> +		 (rotation & DRM_ROTATE_270) ? "270 " : "",
> +		 (rotation & DRM_REFLECT_X) ? "FLIPX " : "",
> +		 (rotation & DRM_REFLECT_Y) ? "FLIPY " : "",
>  		 rotation);
>  
>  	return buf;
> diff --git a/drivers/gpu/drm/i915/intel_atomic_plane.c b/drivers/gpu/drm/i915/intel_atomic_plane.c
> index 7de7721..7cc9c76 100644
> --- a/drivers/gpu/drm/i915/intel_atomic_plane.c
> +++ b/drivers/gpu/drm/i915/intel_atomic_plane.c
> @@ -55,7 +55,7 @@ intel_create_plane_state(struct drm_plane *plane)
>  		return NULL;
>  
>  	state->base.plane = plane;
> -	state->base.rotation = BIT(DRM_ROTATE_0);
> +	state->base.rotation = DRM_ROTATE_0;
>  	state->ckey.flags = I915_SET_COLORKEY_NONE;
>  
>  	return state;
> diff --git a/drivers/gpu/drm/i915/intel_display.c b/drivers/gpu/drm/i915/intel_display.c
> index 78beb7e..773954d 100644
> --- a/drivers/gpu/drm/i915/intel_display.c
> +++ b/drivers/gpu/drm/i915/intel_display.c
> @@ -2688,7 +2688,7 @@ static void i9xx_update_primary_plane(struct drm_plane *primary,
>  		intel_crtc->dspaddr_offset = linear_offset;
>  	}
>  
> -	if (rotation == BIT(DRM_ROTATE_180)) {
> +	if (rotation == DRM_ROTATE_180) {
>  		dspcntr |= DISPPLANE_ROTATE_180;
>  
>  		x += (crtc_state->pipe_src_w - 1);
> @@ -2791,7 +2791,7 @@ static void ironlake_update_primary_plane(struct drm_plane *primary,
>  		intel_compute_tile_offset(&x, &y, fb, 0,
>  					  fb->pitches[0], rotation);
>  	linear_offset -= intel_crtc->dspaddr_offset;
> -	if (rotation == BIT(DRM_ROTATE_180)) {
> +	if (rotation == DRM_ROTATE_180) {
>  		dspcntr |= DISPPLANE_ROTATE_180;
>  
>  		if (!IS_HASWELL(dev) && !IS_BROADWELL(dev)) {
> @@ -2952,17 +2952,17 @@ u32 skl_plane_ctl_tiling(uint64_t fb_modifier)
>  u32 skl_plane_ctl_rotation(unsigned int rotation)
>  {
>  	switch (rotation) {
> -	case BIT(DRM_ROTATE_0):
> +	case DRM_ROTATE_0:
>  		break;
>  	/*
>  	 * DRM_ROTATE_ is counter clockwise to stay compatible with Xrandr
>  	 * while i915 HW rotation is clockwise, thats why this swapping.
>  	 */
> -	case BIT(DRM_ROTATE_90):
> +	case DRM_ROTATE_90:
>  		return PLANE_CTL_ROTATE_270;
> -	case BIT(DRM_ROTATE_180):
> +	case DRM_ROTATE_180:
>  		return PLANE_CTL_ROTATE_180;
> -	case BIT(DRM_ROTATE_270):
> +	case DRM_ROTATE_270:
>  		return PLANE_CTL_ROTATE_90;
>  	default:
>  		MISSING_CASE(rotation);
> @@ -4248,7 +4248,7 @@ int skl_update_scaler_crtc(struct intel_crtc_state *state)
>  		      intel_crtc->pipe, SKL_CRTC_INDEX);
>  
>  	return skl_update_scaler(state, !state->base.active, SKL_CRTC_INDEX,
> -		&state->scaler_state.scaler_id, BIT(DRM_ROTATE_0),
> +		&state->scaler_state.scaler_id, DRM_ROTATE_0,
>  		state->pipe_src_w, state->pipe_src_h,
>  		adjusted_mode->crtc_hdisplay, adjusted_mode->crtc_vdisplay);
>  }
> @@ -10263,7 +10263,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 == BIT(DRM_ROTATE_180))
> +		if (plane_state->base.rotation == DRM_ROTATE_180)
>  			cntl |= CURSOR_ROTATE_180;
>  	}
>  
> @@ -10309,7 +10309,7 @@ static void intel_crtc_update_cursor(struct drm_crtc *crtc,
>  
>  		/* ILK+ do this automagically */
>  		if (HAS_GMCH_DISPLAY(dev) &&
> -		    plane_state->base.rotation == BIT(DRM_ROTATE_180)) {
> +		    plane_state->base.rotation == DRM_ROTATE_180) {
>  			base += (plane_state->base.crtc_h *
>  				 plane_state->base.crtc_w - 1) * 4;
>  		}
> @@ -14304,11 +14304,11 @@ fail:
>  void intel_create_rotation_property(struct drm_device *dev, struct intel_plane *plane)
>  {
>  	if (!dev->mode_config.rotation_property) {
> -		unsigned long flags = BIT(DRM_ROTATE_0) |
> -			BIT(DRM_ROTATE_180);
> +		unsigned long flags = DRM_ROTATE_0 |
> +			DRM_ROTATE_180;
>  
>  		if (INTEL_INFO(dev)->gen >= 9)
> -			flags |= BIT(DRM_ROTATE_90) | BIT(DRM_ROTATE_270);
> +			flags |= DRM_ROTATE_90 | DRM_ROTATE_270;
>  
>  		dev->mode_config.rotation_property =
>  			drm_mode_create_rotation_property(dev, flags);
> @@ -14451,8 +14451,8 @@ static struct drm_plane *intel_cursor_plane_create(struct drm_device *dev,
>  		if (!dev->mode_config.rotation_property)
>  			dev->mode_config.rotation_property =
>  				drm_mode_create_rotation_property(dev,
> -							BIT(DRM_ROTATE_0) |
> -							BIT(DRM_ROTATE_180));
> +							DRM_ROTATE_0 |
> +							DRM_ROTATE_180);
>  		if (dev->mode_config.rotation_property)
>  			drm_object_attach_property(&cursor->base.base,
>  				dev->mode_config.rotation_property,
> diff --git a/drivers/gpu/drm/i915/intel_drv.h b/drivers/gpu/drm/i915/intel_drv.h
> index e74d851..f82dcc5 100644
> --- a/drivers/gpu/drm/i915/intel_drv.h
> +++ b/drivers/gpu/drm/i915/intel_drv.h
> @@ -1258,7 +1258,7 @@ unsigned int intel_tile_height(const struct drm_i915_private *dev_priv,
>  static inline bool
>  intel_rotation_90_or_270(unsigned int rotation)
>  {
> -	return rotation & (BIT(DRM_ROTATE_90) | BIT(DRM_ROTATE_270));
> +	return rotation & (DRM_ROTATE_90 | DRM_ROTATE_270);
>  }
>  
>  void intel_create_rotation_property(struct drm_device *dev,
> diff --git a/drivers/gpu/drm/i915/intel_fbc.c b/drivers/gpu/drm/i915/intel_fbc.c
> index 781e2f5..eff26d7 100644
> --- a/drivers/gpu/drm/i915/intel_fbc.c
> +++ b/drivers/gpu/drm/i915/intel_fbc.c
> @@ -775,7 +775,7 @@ static bool intel_fbc_can_activate(struct intel_crtc *crtc)
>  		return false;
>  	}
>  	if (INTEL_INFO(dev_priv)->gen <= 4 && !IS_G4X(dev_priv) &&
> -	    cache->plane.rotation != BIT(DRM_ROTATE_0)) {
> +	    cache->plane.rotation != DRM_ROTATE_0) {
>  		fbc->no_fbc_reason = "rotation unsupported";
>  		return false;
>  	}
> diff --git a/drivers/gpu/drm/i915/intel_fbdev.c b/drivers/gpu/drm/i915/intel_fbdev.c
> index 6344999..4fee93d 100644
> --- a/drivers/gpu/drm/i915/intel_fbdev.c
> +++ b/drivers/gpu/drm/i915/intel_fbdev.c
> @@ -223,7 +223,7 @@ static int intelfb_create(struct drm_fb_helper *helper,
>  	 * This also validates that any existing fb inherited from the
>  	 * BIOS is suitable for own access.
>  	 */
> -	ret = intel_pin_and_fence_fb_obj(&ifbdev->fb->base, BIT(DRM_ROTATE_0));
> +	ret = intel_pin_and_fence_fb_obj(&ifbdev->fb->base, DRM_ROTATE_0);
>  	if (ret)
>  		goto out_unlock;
>  
> @@ -289,7 +289,7 @@ static int intelfb_create(struct drm_fb_helper *helper,
>  out_destroy_fbi:
>  	drm_fb_helper_release_fbi(helper);
>  out_unpin:
> -	intel_unpin_fb_obj(&ifbdev->fb->base, BIT(DRM_ROTATE_0));
> +	intel_unpin_fb_obj(&ifbdev->fb->base, DRM_ROTATE_0);
>  out_unlock:
>  	mutex_unlock(&dev->struct_mutex);
>  	return ret;
> @@ -554,7 +554,7 @@ static void intel_fbdev_destroy(struct intel_fbdev *ifbdev)
>  
>  	if (ifbdev->fb) {
>  		mutex_lock(&ifbdev->helper.dev->struct_mutex);
> -		intel_unpin_fb_obj(&ifbdev->fb->base, BIT(DRM_ROTATE_0));
> +		intel_unpin_fb_obj(&ifbdev->fb->base, DRM_ROTATE_0);
>  		mutex_unlock(&ifbdev->helper.dev->struct_mutex);
>  
>  		drm_framebuffer_remove(&ifbdev->fb->base);
> diff --git a/drivers/gpu/drm/i915/intel_sprite.c b/drivers/gpu/drm/i915/intel_sprite.c
> index 0de935a..22ae2298 100644
> --- a/drivers/gpu/drm/i915/intel_sprite.c
> +++ b/drivers/gpu/drm/i915/intel_sprite.c
> @@ -444,7 +444,7 @@ vlv_update_plane(struct drm_plane *dplane,
>  						   fb->pitches[0], rotation);
>  	linear_offset -= sprsurf_offset;
>  
> -	if (rotation == BIT(DRM_ROTATE_180)) {
> +	if (rotation == DRM_ROTATE_180) {
>  		sprctl |= SP_ROTATE_180;
>  
>  		x += src_w;
> @@ -577,7 +577,7 @@ ivb_update_plane(struct drm_plane *plane,
>  						   fb->pitches[0], rotation);
>  	linear_offset -= sprsurf_offset;
>  
> -	if (rotation == BIT(DRM_ROTATE_180)) {
> +	if (rotation == DRM_ROTATE_180) {
>  		sprctl |= SPRITE_ROTATE_180;
>  
>  		/* HSW and BDW does this automagically in hardware */
> @@ -714,7 +714,7 @@ ilk_update_plane(struct drm_plane *plane,
>  						   fb->pitches[0], rotation);
>  	linear_offset -= dvssurf_offset;
>  
> -	if (rotation == BIT(DRM_ROTATE_180)) {
> +	if (rotation == DRM_ROTATE_180) {
>  		dvscntr |= DVS_ROTATE_180;
>  
>  		x += src_w;
> diff --git a/drivers/gpu/drm/msm/mdp/mdp5/mdp5_plane.c b/drivers/gpu/drm/msm/mdp/mdp5/mdp5_plane.c
> index 432c098..a02a24e 100644
> --- a/drivers/gpu/drm/msm/mdp/mdp5/mdp5_plane.c
> +++ b/drivers/gpu/drm/msm/mdp/mdp5/mdp5_plane.c
> @@ -78,7 +78,7 @@ 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,
> -			BIT(DRM_REFLECT_X) | BIT(DRM_REFLECT_Y));
> +			DRM_REFLECT_X | DRM_REFLECT_Y);
>  
>  	if (dev->mode_config.rotation_property)
>  		drm_object_attach_property(&plane->base,
> @@ -309,8 +309,8 @@ static int mdp5_plane_atomic_check(struct drm_plane *plane,
>  			return -EINVAL;
>  		}
>  
> -		hflip = !!(state->rotation & BIT(DRM_REFLECT_X));
> -		vflip = !!(state->rotation & BIT(DRM_REFLECT_Y));
> +		hflip = !!(state->rotation & DRM_REFLECT_X);
> +		vflip = !!(state->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,
> @@ -743,8 +743,8 @@ 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 & BIT(DRM_REFLECT_X));
> -	vflip = !!(pstate->rotation & BIT(DRM_REFLECT_Y));
> +	hflip = !!(pstate->rotation & DRM_REFLECT_X);
> +	vflip = !!(pstate->rotation & DRM_REFLECT_Y);
>  
>  	spin_lock_irqsave(&mdp5_plane->pipe_lock, flags);
>  
> diff --git a/drivers/gpu/drm/omapdrm/omap_drv.c b/drivers/gpu/drm/omapdrm/omap_drv.c
> index 26c6134..3dd78f2 100644
> --- a/drivers/gpu/drm/omapdrm/omap_drv.c
> +++ b/drivers/gpu/drm/omapdrm/omap_drv.c
> @@ -295,9 +295,9 @@ static int omap_modeset_init_properties(struct drm_device *dev)
>  	if (priv->has_dmm) {
>  		dev->mode_config.rotation_property =
>  			drm_mode_create_rotation_property(dev,
> -				BIT(DRM_ROTATE_0) | BIT(DRM_ROTATE_90) |
> -				BIT(DRM_ROTATE_180) | BIT(DRM_ROTATE_270) |
> -				BIT(DRM_REFLECT_X) | BIT(DRM_REFLECT_Y));
> +				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;
>  	}
> diff --git a/drivers/gpu/drm/omapdrm/omap_fb.c b/drivers/gpu/drm/omapdrm/omap_fb.c
> index 31f5178..5f3337f 100644
> --- a/drivers/gpu/drm/omapdrm/omap_fb.c
> +++ b/drivers/gpu/drm/omapdrm/omap_fb.c
> @@ -179,24 +179,24 @@ void omap_framebuffer_update_scanout(struct drm_framebuffer *fb,
>  					(uint32_t)win->rotation);
>  			/* fallthru to default to no rotation */
>  		case 0:
> -		case BIT(DRM_ROTATE_0):
> +		case DRM_ROTATE_0:
>  			orient = 0;
>  			break;
> -		case BIT(DRM_ROTATE_90):
> +		case DRM_ROTATE_90:
>  			orient = MASK_XY_FLIP | MASK_X_INVERT;
>  			break;
> -		case BIT(DRM_ROTATE_180):
> +		case DRM_ROTATE_180:
>  			orient = MASK_X_INVERT | MASK_Y_INVERT;
>  			break;
> -		case BIT(DRM_ROTATE_270):
> +		case DRM_ROTATE_270:
>  			orient = MASK_XY_FLIP | MASK_Y_INVERT;
>  			break;
>  		}
>  
> -		if (win->rotation & BIT(DRM_REFLECT_X))
> +		if (win->rotation & DRM_REFLECT_X)
>  			orient ^= MASK_X_INVERT;
>  
> -		if (win->rotation & BIT(DRM_REFLECT_Y))
> +		if (win->rotation & DRM_REFLECT_Y)
>  			orient ^= MASK_Y_INVERT;
>  
>  		/* adjust x,y offset for flip/invert: */
> @@ -213,7 +213,7 @@ void omap_framebuffer_update_scanout(struct drm_framebuffer *fb,
>  	} else {
>  		switch (win->rotation & DRM_ROTATE_MASK) {
>  		case 0:
> -		case BIT(DRM_ROTATE_0):
> +		case DRM_ROTATE_0:
>  			/* OK */
>  			break;
>  
> diff --git a/drivers/gpu/drm/omapdrm/omap_plane.c b/drivers/gpu/drm/omapdrm/omap_plane.c
> index 5252ab7..4c7727e 100644
> --- a/drivers/gpu/drm/omapdrm/omap_plane.c
> +++ b/drivers/gpu/drm/omapdrm/omap_plane.c
> @@ -109,8 +109,8 @@ static void omap_plane_atomic_update(struct drm_plane *plane,
>  	win.src_y = state->src_y >> 16;
>  
>  	switch (state->rotation & DRM_ROTATE_MASK) {
> -	case BIT(DRM_ROTATE_90):
> -	case BIT(DRM_ROTATE_270):
> +	case DRM_ROTATE_90:
> +	case DRM_ROTATE_270:
>  		win.src_w = state->src_h >> 16;
>  		win.src_h = state->src_w >> 16;
>  		break;
> @@ -149,7 +149,7 @@ static void omap_plane_atomic_disable(struct drm_plane *plane,
>  	struct omap_plane_state *omap_state = to_omap_plane_state(plane->state);
>  	struct omap_plane *omap_plane = to_omap_plane(plane);
>  
> -	plane->state->rotation = BIT(DRM_ROTATE_0);
> +	plane->state->rotation = DRM_ROTATE_0;
>  	omap_state->zorder = plane->type == DRM_PLANE_TYPE_PRIMARY
>  			   ? 0 : omap_plane->id;
>  
> @@ -178,7 +178,7 @@ static int omap_plane_atomic_check(struct drm_plane *plane,
>  		return -EINVAL;
>  
>  	if (state->fb) {
> -		if (state->rotation != BIT(DRM_ROTATE_0) &&
> +		if (state->rotation != DRM_ROTATE_0 &&
>  		    !omap_framebuffer_supports_rotation(state->fb))
>  			return -EINVAL;
>  	}
> @@ -269,7 +269,7 @@ static void omap_plane_reset(struct drm_plane *plane)
>  	 */
>  	omap_state->zorder = plane->type == DRM_PLANE_TYPE_PRIMARY
>  			   ? 0 : omap_plane->id;
> -	omap_state->base.rotation = BIT(DRM_ROTATE_0);
> +	omap_state->base.rotation = DRM_ROTATE_0;
>  
>  	plane->state = &omap_state->base;
>  	plane->state->plane = plane;
> diff --git a/include/drm/drm_crtc.h b/include/drm/drm_crtc.h
> index 3edeaf8..57bbc61 100644
> --- a/include/drm/drm_crtc.h
> +++ b/include/drm/drm_crtc.h
> @@ -84,13 +84,13 @@ static inline uint64_t I642U64(int64_t val)
>   * DRM_REFLECT_Y reflects the image along the specified axis prior to rotation
>   */
>  #define DRM_ROTATE_MASK 0x0f
> -#define DRM_ROTATE_0	0
> -#define DRM_ROTATE_90	1
> -#define DRM_ROTATE_180	2
> -#define DRM_ROTATE_270	3
> +#define DRM_ROTATE_0	BIT(0)

This seems not to be indented properly?

> +#define DRM_ROTATE_90	BIT(1)
> +#define DRM_ROTATE_180	BIT(2)
> +#define DRM_ROTATE_270	BIT(3)
>  #define DRM_REFLECT_MASK (~DRM_ROTATE_MASK)
> -#define DRM_REFLECT_X	4
> -#define DRM_REFLECT_Y	5
> +#define DRM_REFLECT_X	BIT(4)
> +#define DRM_REFLECT_Y	BIT(5)
>  
>  enum drm_connector_force {
>  	DRM_FORCE_UNSPECIFIED,
> -- 
> 2.5.5
> 
> _______________________________________________
> dri-devel mailing list
> dri-devel@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/dri-devel

-- 
====================
| I would like to |
| fix the world,  |
| but they're not |
| giving me the   |
 \ source code!  /
  ---------------
    ¯\_(ツ)_/¯
_______________________________________________
Freedreno mailing list
Freedreno@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/freedreno

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

* Re: [PATCH] drm: BIT(DRM_ROTATE_?) -> DRM_ROTATE_?
  2016-07-26  9:05   ` [PATCH] " Liviu Dudau
@ 2016-07-26 11:53     ` Joonas Lahtinen
  0 siblings, 0 replies; 14+ messages in thread
From: Joonas Lahtinen @ 2016-07-26 11:53 UTC (permalink / raw)
  To: Liviu Dudau
  Cc: Direct Rendering Infrastructure - Development, linux-arm-msm,
	intel-gfx, Daniel Vetter, freedreno, Mali DP Maintainers

On ti, 2016-07-26 at 10:05 +0100, Liviu Dudau wrote:
> > --- a/drivers/gpu/drm/arm/malidp_planes.c
> > +++ b/drivers/gpu/drm/arm/malidp_planes.c
> > @@ -108,7 +108,7 @@ static int malidp_de_plane_check(struct drm_plane *plane,
> >  		return -EINVAL;
> >  
> >  	/* packed RGB888 / BGR888 can't be rotated or flipped */
> > -	if (state->rotation != BIT(DRM_ROTATE_0) &&
> > +	if (state->rotation != DRM_ROTATE_0 &&
> >  	    (state->fb->pixel_format == DRM_FORMAT_RGB888 ||
> >  	     state->fb->pixel_format == DRM_FORMAT_BGR888))
> >  		return -EINVAL;
> > @@ -188,9 +188,9 @@ static void malidp_de_plane_update(struct drm_plane *plane,
> >  	/* setup the rotation and axis flip bits */
> >  	if (plane->state->rotation & DRM_ROTATE_MASK)
> >  		val = ilog2(plane->state->rotation & DRM_ROTATE_MASK) << LAYER_ROT_OFFSET;
> > -	if (plane->state->rotation & BIT(DRM_REFLECT_X))
> > +	if (plane->state->rotation & DRM_REFLECT_X)
> >  		val |= LAYER_V_FLIP;
> > -	if (plane->state->rotation & BIT(DRM_REFLECT_Y))
> > +	if (plane->state->rotation & DRM_REFLECT_Y)
> >  		val |= LAYER_H_FLIP;
> >  
> >  	/* set the 'enable layer' bit */
> > @@ -255,12 +255,12 @@ int malidp_de_planes_init(struct drm_device *drm)
> >  			goto cleanup;
> >  
> >  		if (!drm->mode_config.rotation_property) {
> > -			unsigned long flags = BIT(DRM_ROTATE_0) |
> > -					      BIT(DRM_ROTATE_90) |
> > -					      BIT(DRM_ROTATE_180) |
> > -					      BIT(DRM_ROTATE_270) |
> > -					      BIT(DRM_REFLECT_X) |
> > -					      BIT(DRM_REFLECT_Y);
> > +			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);
> >  		}
> > @@ -268,7 +268,7 @@ int malidp_de_planes_init(struct drm_device *drm)
> >  		if (drm->mode_config.rotation_property && (id != DE_SMART))
> >  			drm_object_attach_property(&plane->base.base,
> >  						   drm->mode_config.rotation_property,
> > -						   BIT(DRM_ROTATE_0));
> > +						   DRM_ROTATE_0);
> >  
> >  		drm_plane_helper_add(&plane->base,
> >  				     &malidp_de_plane_helper_funcs);
> This patch touches arm/mali-dp driver but the maintainers have not been Cc-ed in the patch? Did
> get_maintainer.pl fail to show our e-mails? (Driver has been added recently, wondering if there
> are issues with MAINTAINERS entry).
> 

Being a mechanical change, I just picked all mailing lists from "open
list" or "maintainer" entries with grep, only adding David and the ones
who I've discussed the intent to do the change with (in the hope they
will review)

But now looking looking, I missed the "supporter" entries and thus your
mailing list. CC'ing the Mali DP mailing list now too.

So my bad, and thanks for notifying.

> The change looks OK to me for mali-dp. So:
> 
> Acked-by: Liviu Dudau <Liviu.Dudau@arm.com>
> 
> (one comment at the end of email as well).
> 
> Best regards,
> Liviu
> 

<SNIP>

> > --- a/include/drm/drm_crtc.h
> > +++ b/include/drm/drm_crtc.h
> > @@ -84,13 +84,13 @@ static inline uint64_t I642U64(int64_t val)
> >   * DRM_REFLECT_Y reflects the image along the specified axis prior to rotation
> >   */
> >  #define DRM_ROTATE_MASK 0x0f
> > -#define DRM_ROTATE_0	0
> > -#define DRM_ROTATE_90	1
> > -#define DRM_ROTATE_180	2
> > -#define DRM_ROTATE_270	3
> > +#define DRM_ROTATE_0	BIT(0)
> This seems not to be indented properly?

This is result of being in patch form where '+'/' '/'-' is being added
to the beginning of line before the tab, so the spacing might be off.
When applied, the code is indented properly.

Regards, Joonas
-- 
Joonas Lahtinen
Open Source Technology Center
Intel Corporation

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

* Re: [PATCH] drm: BIT(DRM_ROTATE_?) -> DRM_ROTATE_?
  2016-07-25  7:00 [PATCH] drm: BIT(DRM_ROTATE_?) -> DRM_ROTATE_? Joonas Lahtinen
  2016-07-25  7:39 ` ✗ Ro.CI.BAT: failure for " Patchwork
       [not found] ` <1469430025-13540-1-git-send-email-joonas.lahtinen-VuQAYsv1563Yd54FQh9/CA@public.gmane.org>
@ 2016-07-26 12:41 ` Ville Syrjälä
  2016-07-26 14:49 ` Sean Paul
  2016-07-29  6:16 ` ✗ Ro.CI.BAT: failure for drm: BIT(DRM_ROTATE_?) -> DRM_ROTATE_? (rev3) Patchwork
  4 siblings, 0 replies; 14+ messages in thread
From: Ville Syrjälä @ 2016-07-26 12:41 UTC (permalink / raw)
  To: Joonas Lahtinen
  Cc: David Airlie, linux-arm-msm, intel-gfx,
	Direct Rendering Infrastructure - Development, Daniel Vetter,
	freedreno

On Mon, Jul 25, 2016 at 10:00:25AM +0300, Joonas Lahtinen wrote:
> Only property creation uses the rotation as an index, so convert the
> #define to the more used BIT(DRM_ROTATE_?) form and use __builtin_ffs
> to figure the index when needed.
> 
> Cc: intel-gfx@lists.freedesktop.org
> Cc: linux-arm-msm@vger.kernel.org
> Cc: freedreno@lists.freedesktop.org
> Cc: David Airlie <airlied@linux.ie>
> Cc: Daniel Vetter <daniel.vetter@ffwll.ch>
> Cc: Ville Syrjälä <ville.syrjala@linux.intel.com>
> Signed-off-by: Joonas Lahtinen <joonas.lahtinen@linux.intel.com>

Patch lgtm

Reviewed-by: Ville Syrjälä <ville.syrjala@linux.intel.com>

Will conflict badly with my stuff, however.

> ---
>  drivers/gpu/drm/arm/malidp_drv.h                |  2 +-
>  drivers/gpu/drm/arm/malidp_planes.c             | 20 +++++++++---------
>  drivers/gpu/drm/armada/armada_overlay.c         |  2 +-
>  drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_plane.c | 22 +++++++++----------
>  drivers/gpu/drm/drm_atomic_helper.c             |  4 ++--
>  drivers/gpu/drm/drm_crtc.c                      | 24 ++++++++++-----------
>  drivers/gpu/drm/drm_fb_helper.c                 |  4 ++--
>  drivers/gpu/drm/drm_plane_helper.c              |  2 +-
>  drivers/gpu/drm/drm_rect.c                      | 28 ++++++++++++-------------
>  drivers/gpu/drm/i915/i915_debugfs.c             | 12 +++++------
>  drivers/gpu/drm/i915/intel_atomic_plane.c       |  2 +-
>  drivers/gpu/drm/i915/intel_display.c            | 28 ++++++++++++-------------
>  drivers/gpu/drm/i915/intel_drv.h                |  2 +-
>  drivers/gpu/drm/i915/intel_fbc.c                |  2 +-
>  drivers/gpu/drm/i915/intel_fbdev.c              |  6 +++---
>  drivers/gpu/drm/i915/intel_sprite.c             |  6 +++---
>  drivers/gpu/drm/msm/mdp/mdp5/mdp5_plane.c       | 10 ++++-----
>  drivers/gpu/drm/omapdrm/omap_drv.c              |  6 +++---
>  drivers/gpu/drm/omapdrm/omap_fb.c               | 14 ++++++-------
>  drivers/gpu/drm/omapdrm/omap_plane.c            | 10 ++++-----
>  include/drm/drm_crtc.h                          | 12 +++++------
>  21 files changed, 109 insertions(+), 109 deletions(-)
> 
> diff --git a/drivers/gpu/drm/arm/malidp_drv.h b/drivers/gpu/drm/arm/malidp_drv.h
> index 95558fd..271d2fb 100644
> --- a/drivers/gpu/drm/arm/malidp_drv.h
> +++ b/drivers/gpu/drm/arm/malidp_drv.h
> @@ -49,6 +49,6 @@ void malidp_de_planes_destroy(struct drm_device *drm);
>  int malidp_crtc_init(struct drm_device *drm);
>  
>  /* often used combination of rotational bits */
> -#define MALIDP_ROTATED_MASK	(BIT(DRM_ROTATE_90) | BIT(DRM_ROTATE_270))
> +#define MALIDP_ROTATED_MASK	(DRM_ROTATE_90 | DRM_ROTATE_270)
>  
>  #endif  /* __MALIDP_DRV_H__ */
> diff --git a/drivers/gpu/drm/arm/malidp_planes.c b/drivers/gpu/drm/arm/malidp_planes.c
> index 725098d..82c193e 100644
> --- a/drivers/gpu/drm/arm/malidp_planes.c
> +++ b/drivers/gpu/drm/arm/malidp_planes.c
> @@ -108,7 +108,7 @@ static int malidp_de_plane_check(struct drm_plane *plane,
>  		return -EINVAL;
>  
>  	/* packed RGB888 / BGR888 can't be rotated or flipped */
> -	if (state->rotation != BIT(DRM_ROTATE_0) &&
> +	if (state->rotation != DRM_ROTATE_0 &&
>  	    (state->fb->pixel_format == DRM_FORMAT_RGB888 ||
>  	     state->fb->pixel_format == DRM_FORMAT_BGR888))
>  		return -EINVAL;
> @@ -188,9 +188,9 @@ static void malidp_de_plane_update(struct drm_plane *plane,
>  	/* setup the rotation and axis flip bits */
>  	if (plane->state->rotation & DRM_ROTATE_MASK)
>  		val = ilog2(plane->state->rotation & DRM_ROTATE_MASK) << LAYER_ROT_OFFSET;
> -	if (plane->state->rotation & BIT(DRM_REFLECT_X))
> +	if (plane->state->rotation & DRM_REFLECT_X)
>  		val |= LAYER_V_FLIP;
> -	if (plane->state->rotation & BIT(DRM_REFLECT_Y))
> +	if (plane->state->rotation & DRM_REFLECT_Y)
>  		val |= LAYER_H_FLIP;
>  
>  	/* set the 'enable layer' bit */
> @@ -255,12 +255,12 @@ int malidp_de_planes_init(struct drm_device *drm)
>  			goto cleanup;
>  
>  		if (!drm->mode_config.rotation_property) {
> -			unsigned long flags = BIT(DRM_ROTATE_0) |
> -					      BIT(DRM_ROTATE_90) |
> -					      BIT(DRM_ROTATE_180) |
> -					      BIT(DRM_ROTATE_270) |
> -					      BIT(DRM_REFLECT_X) |
> -					      BIT(DRM_REFLECT_Y);
> +			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);
>  		}
> @@ -268,7 +268,7 @@ int malidp_de_planes_init(struct drm_device *drm)
>  		if (drm->mode_config.rotation_property && (id != DE_SMART))
>  			drm_object_attach_property(&plane->base.base,
>  						   drm->mode_config.rotation_property,
> -						   BIT(DRM_ROTATE_0));
> +						   DRM_ROTATE_0);
>  
>  		drm_plane_helper_add(&plane->base,
>  				     &malidp_de_plane_helper_funcs);
> diff --git a/drivers/gpu/drm/armada/armada_overlay.c b/drivers/gpu/drm/armada/armada_overlay.c
> index 1ee707e..152b4e7 100644
> --- a/drivers/gpu/drm/armada/armada_overlay.c
> +++ b/drivers/gpu/drm/armada/armada_overlay.c
> @@ -121,7 +121,7 @@ armada_ovl_plane_update(struct drm_plane *plane, struct drm_crtc *crtc,
>  	int ret;
>  
>  	ret = drm_plane_helper_check_update(plane, crtc, fb, &src, &dest, &clip,
> -					    BIT(DRM_ROTATE_0),
> +					    DRM_ROTATE_0,
>  					    0, INT_MAX, true, false, &visible);
>  	if (ret)
>  		return ret;
> diff --git a/drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_plane.c b/drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_plane.c
> index 016c191..146809a 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 & (BIT(DRM_ROTATE_90) | BIT(DRM_ROTATE_270))))
> +	    (state->base.rotation & (DRM_ROTATE_90 | DRM_ROTATE_270)))
>  		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 & (BIT(DRM_ROTATE_90) | BIT(DRM_ROTATE_270))) {
> +	if (state->base.rotation & (DRM_ROTATE_90 | DRM_ROTATE_270)) {
>  		tmp = state->crtc_w;
>  		state->crtc_w = state->crtc_h;
>  		state->crtc_h = tmp;
> @@ -677,7 +677,7 @@ static int atmel_hlcdc_plane_atomic_check(struct drm_plane *p,
>  			return -EINVAL;
>  
>  		switch (state->base.rotation & DRM_ROTATE_MASK) {
> -		case BIT(DRM_ROTATE_90):
> +		case DRM_ROTATE_90:
>  			offset = ((y_offset + state->src_y + patched_src_w - 1) /
>  				  ydiv) * fb->pitches[i];
>  			offset += ((x_offset + state->src_x) / xdiv) *
> @@ -686,7 +686,7 @@ static int atmel_hlcdc_plane_atomic_check(struct drm_plane *p,
>  					  fb->pitches[i];
>  			state->pstride[i] = -fb->pitches[i] - state->bpp[i];
>  			break;
> -		case BIT(DRM_ROTATE_180):
> +		case DRM_ROTATE_180:
>  			offset = ((y_offset + state->src_y + patched_src_h - 1) /
>  				  ydiv) * fb->pitches[i];
>  			offset += ((x_offset + state->src_x + patched_src_w - 1) /
> @@ -695,7 +695,7 @@ static int atmel_hlcdc_plane_atomic_check(struct drm_plane *p,
>  					   state->bpp[i]) - fb->pitches[i];
>  			state->pstride[i] = -2 * state->bpp[i];
>  			break;
> -		case BIT(DRM_ROTATE_270):
> +		case DRM_ROTATE_270:
>  			offset = ((y_offset + state->src_y) / ydiv) *
>  				 fb->pitches[i];
>  			offset += ((x_offset + state->src_x + patched_src_h - 1) /
> @@ -705,7 +705,7 @@ static int atmel_hlcdc_plane_atomic_check(struct drm_plane *p,
>  					  (2 * state->bpp[i]);
>  			state->pstride[i] = fb->pitches[i] - state->bpp[i];
>  			break;
> -		case BIT(DRM_ROTATE_0):
> +		case DRM_ROTATE_0:
>  		default:
>  			offset = ((y_offset + state->src_y) / ydiv) *
>  				 fb->pitches[i];
> @@ -905,7 +905,7 @@ static void atmel_hlcdc_plane_init_properties(struct atmel_hlcdc_plane *plane,
>  	if (desc->layout.xstride && desc->layout.pstride)
>  		drm_object_attach_property(&plane->base.base,
>  				plane->base.dev->mode_config.rotation_property,
> -				BIT(DRM_ROTATE_0));
> +				DRM_ROTATE_0);
>  
>  	if (desc->layout.csc) {
>  		/*
> @@ -1056,10 +1056,10 @@ atmel_hlcdc_plane_create_properties(struct drm_device *dev)
>  
>  	dev->mode_config.rotation_property =
>  			drm_mode_create_rotation_property(dev,
> -							  BIT(DRM_ROTATE_0) |
> -							  BIT(DRM_ROTATE_90) |
> -							  BIT(DRM_ROTATE_180) |
> -							  BIT(DRM_ROTATE_270));
> +							  DRM_ROTATE_0 |
> +							  DRM_ROTATE_90 |
> +							  DRM_ROTATE_180 |
> +							  DRM_ROTATE_270);
>  	if (!dev->mode_config.rotation_property)
>  		return ERR_PTR(-ENOMEM);
>  
> diff --git a/drivers/gpu/drm/drm_atomic_helper.c b/drivers/gpu/drm/drm_atomic_helper.c
> index de7fddc..61afd85 100644
> --- a/drivers/gpu/drm/drm_atomic_helper.c
> +++ b/drivers/gpu/drm/drm_atomic_helper.c
> @@ -2348,7 +2348,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 & (BIT(DRM_ROTATE_90) | BIT(DRM_ROTATE_270))) {
> +	if (primary_state->rotation & (DRM_ROTATE_90 | DRM_ROTATE_270)) {
>  		primary_state->src_w = vdisplay << 16;
>  		primary_state->src_h = hdisplay << 16;
>  	} else {
> @@ -3032,7 +3032,7 @@ void drm_atomic_helper_plane_reset(struct drm_plane *plane)
>  
>  	if (plane->state) {
>  		plane->state->plane = plane;
> -		plane->state->rotation = BIT(DRM_ROTATE_0);
> +		plane->state->rotation = DRM_ROTATE_0;
>  	}
>  }
>  EXPORT_SYMBOL(drm_atomic_helper_plane_reset);
> diff --git a/drivers/gpu/drm/drm_crtc.c b/drivers/gpu/drm/drm_crtc.c
> index f1d9f05..909a025 100644
> --- a/drivers/gpu/drm/drm_crtc.c
> +++ b/drivers/gpu/drm/drm_crtc.c
> @@ -2804,8 +2804,8 @@ 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 & (BIT(DRM_ROTATE_90) |
> -					      BIT(DRM_ROTATE_270)))
> +	    crtc->primary->state->rotation & (DRM_ROTATE_90 |
> +					      DRM_ROTATE_270))
>  		swap(hdisplay, vdisplay);
>  
>  	return check_src_coords(x << 16, y << 16,
> @@ -5646,9 +5646,9 @@ int drm_mode_destroy_dumb_ioctl(struct drm_device *dev,
>   * Eg. if the hardware supports everything except DRM_REFLECT_X
>   * one could call this function like this:
>   *
> - * drm_rotation_simplify(rotation, BIT(DRM_ROTATE_0) |
> - *                       BIT(DRM_ROTATE_90) | BIT(DRM_ROTATE_180) |
> - *                       BIT(DRM_ROTATE_270) | BIT(DRM_REFLECT_Y));
> + * drm_rotation_simplify(rotation, DRM_ROTATE_0 |
> + *                       DRM_ROTATE_90 | DRM_ROTATE_180 |
> + *                       DRM_ROTATE_270 | DRM_REFLECT_Y);
>   *
>   * to eliminate the DRM_ROTATE_X flag. Depending on what kind of
>   * transforms the hardware supports, this function may not
> @@ -5659,7 +5659,7 @@ unsigned int drm_rotation_simplify(unsigned int rotation,
>  				   unsigned int supported_rotations)
>  {
>  	if (rotation & ~supported_rotations) {
> -		rotation ^= BIT(DRM_REFLECT_X) | BIT(DRM_REFLECT_Y);
> +		rotation ^= DRM_REFLECT_X | DRM_REFLECT_Y;
>  		rotation = (rotation & DRM_REFLECT_MASK) |
>  		           BIT((ffs(rotation & DRM_ROTATE_MASK) + 1) % 4);
>  	}
> @@ -5788,12 +5788,12 @@ struct drm_property *drm_mode_create_rotation_property(struct drm_device *dev,
>  						       unsigned int supported_rotations)
>  {
>  	static const struct drm_prop_enum_list props[] = {
> -		{ DRM_ROTATE_0,   "rotate-0" },
> -		{ DRM_ROTATE_90,  "rotate-90" },
> -		{ DRM_ROTATE_180, "rotate-180" },
> -		{ DRM_ROTATE_270, "rotate-270" },
> -		{ DRM_REFLECT_X,  "reflect-x" },
> -		{ DRM_REFLECT_Y,  "reflect-y" },
> +		{ __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",
> diff --git a/drivers/gpu/drm/drm_fb_helper.c b/drivers/gpu/drm/drm_fb_helper.c
> index ce54e98..d4896f9 100644
> --- a/drivers/gpu/drm/drm_fb_helper.c
> +++ b/drivers/gpu/drm/drm_fb_helper.c
> @@ -335,7 +335,7 @@ retry:
>  			goto fail;
>  		}
>  
> -		plane_state->rotation = BIT(DRM_ROTATE_0);
> +		plane_state->rotation = DRM_ROTATE_0;
>  
>  		plane->old_fb = plane->fb;
>  		plane_mask |= 1 << drm_plane_index(plane);
> @@ -395,7 +395,7 @@ static int restore_fbdev_mode(struct drm_fb_helper *fb_helper)
>  		if (dev->mode_config.rotation_property) {
>  			drm_mode_plane_set_obj_prop(plane,
>  						    dev->mode_config.rotation_property,
> -						    BIT(DRM_ROTATE_0));
> +						    DRM_ROTATE_0);
>  		}
>  	}
>  
> diff --git a/drivers/gpu/drm/drm_plane_helper.c b/drivers/gpu/drm/drm_plane_helper.c
> index 16c4a7b..c360e30 100644
> --- a/drivers/gpu/drm/drm_plane_helper.c
> +++ b/drivers/gpu/drm/drm_plane_helper.c
> @@ -274,7 +274,7 @@ int drm_primary_helper_update(struct drm_plane *plane, struct drm_crtc *crtc,
>  
>  	ret = drm_plane_helper_check_update(plane, crtc, fb,
>  					    &src, &dest, &clip,
> -					    BIT(DRM_ROTATE_0),
> +					    DRM_ROTATE_0,
>  					    DRM_PLANE_HELPER_NO_SCALING,
>  					    DRM_PLANE_HELPER_NO_SCALING,
>  					    false, false, &visible);
> diff --git a/drivers/gpu/drm/drm_rect.c b/drivers/gpu/drm/drm_rect.c
> index a8e2c86..4063f6e 100644
> --- a/drivers/gpu/drm/drm_rect.c
> +++ b/drivers/gpu/drm/drm_rect.c
> @@ -317,38 +317,38 @@ void drm_rect_rotate(struct drm_rect *r,
>  {
>  	struct drm_rect tmp;
>  
> -	if (rotation & (BIT(DRM_REFLECT_X) | BIT(DRM_REFLECT_Y))) {
> +	if (rotation & (DRM_REFLECT_X | DRM_REFLECT_Y)) {
>  		tmp = *r;
>  
> -		if (rotation & BIT(DRM_REFLECT_X)) {
> +		if (rotation & DRM_REFLECT_X) {
>  			r->x1 = width - tmp.x2;
>  			r->x2 = width - tmp.x1;
>  		}
>  
> -		if (rotation & BIT(DRM_REFLECT_Y)) {
> +		if (rotation & DRM_REFLECT_Y) {
>  			r->y1 = height - tmp.y2;
>  			r->y2 = height - tmp.y1;
>  		}
>  	}
>  
>  	switch (rotation & DRM_ROTATE_MASK) {
> -	case BIT(DRM_ROTATE_0):
> +	case DRM_ROTATE_0:
>  		break;
> -	case BIT(DRM_ROTATE_90):
> +	case DRM_ROTATE_90:
>  		tmp = *r;
>  		r->x1 = tmp.y1;
>  		r->x2 = tmp.y2;
>  		r->y1 = width - tmp.x2;
>  		r->y2 = width - tmp.x1;
>  		break;
> -	case BIT(DRM_ROTATE_180):
> +	case DRM_ROTATE_180:
>  		tmp = *r;
>  		r->x1 = width - tmp.x2;
>  		r->x2 = width - tmp.x1;
>  		r->y1 = height - tmp.y2;
>  		r->y2 = height - tmp.y1;
>  		break;
> -	case BIT(DRM_ROTATE_270):
> +	case DRM_ROTATE_270:
>  		tmp = *r;
>  		r->x1 = height - tmp.y2;
>  		r->x2 = height - tmp.y1;
> @@ -392,23 +392,23 @@ void drm_rect_rotate_inv(struct drm_rect *r,
>  	struct drm_rect tmp;
>  
>  	switch (rotation & DRM_ROTATE_MASK) {
> -	case BIT(DRM_ROTATE_0):
> +	case DRM_ROTATE_0:
>  		break;
> -	case BIT(DRM_ROTATE_90):
> +	case DRM_ROTATE_90:
>  		tmp = *r;
>  		r->x1 = width - tmp.y2;
>  		r->x2 = width - tmp.y1;
>  		r->y1 = tmp.x1;
>  		r->y2 = tmp.x2;
>  		break;
> -	case BIT(DRM_ROTATE_180):
> +	case DRM_ROTATE_180:
>  		tmp = *r;
>  		r->x1 = width - tmp.x2;
>  		r->x2 = width - tmp.x1;
>  		r->y1 = height - tmp.y2;
>  		r->y2 = height - tmp.y1;
>  		break;
> -	case BIT(DRM_ROTATE_270):
> +	case DRM_ROTATE_270:
>  		tmp = *r;
>  		r->x1 = tmp.y1;
>  		r->x2 = tmp.y2;
> @@ -419,15 +419,15 @@ void drm_rect_rotate_inv(struct drm_rect *r,
>  		break;
>  	}
>  
> -	if (rotation & (BIT(DRM_REFLECT_X) | BIT(DRM_REFLECT_Y))) {
> +	if (rotation & (DRM_REFLECT_X | DRM_REFLECT_Y)) {
>  		tmp = *r;
>  
> -		if (rotation & BIT(DRM_REFLECT_X)) {
> +		if (rotation & DRM_REFLECT_X) {
>  			r->x1 = width - tmp.x2;
>  			r->x2 = width - tmp.x1;
>  		}
>  
> -		if (rotation & BIT(DRM_REFLECT_Y)) {
> +		if (rotation & DRM_REFLECT_Y) {
>  			r->y1 = height - tmp.y2;
>  			r->y2 = height - tmp.y1;
>  		}
> diff --git a/drivers/gpu/drm/i915/i915_debugfs.c b/drivers/gpu/drm/i915/i915_debugfs.c
> index 9aa62c5..815232c 100644
> --- a/drivers/gpu/drm/i915/i915_debugfs.c
> +++ b/drivers/gpu/drm/i915/i915_debugfs.c
> @@ -3081,12 +3081,12 @@ static const char *plane_rotation(unsigned int rotation)
>  	 */
>  	snprintf(buf, sizeof(buf),
>  		 "%s%s%s%s%s%s(0x%08x)",
> -		 (rotation & BIT(DRM_ROTATE_0)) ? "0 " : "",
> -		 (rotation & BIT(DRM_ROTATE_90)) ? "90 " : "",
> -		 (rotation & BIT(DRM_ROTATE_180)) ? "180 " : "",
> -		 (rotation & BIT(DRM_ROTATE_270)) ? "270 " : "",
> -		 (rotation & BIT(DRM_REFLECT_X)) ? "FLIPX " : "",
> -		 (rotation & BIT(DRM_REFLECT_Y)) ? "FLIPY " : "",
> +		 (rotation & DRM_ROTATE_0) ? "0 " : "",
> +		 (rotation & DRM_ROTATE_90) ? "90 " : "",
> +		 (rotation & DRM_ROTATE_180) ? "180 " : "",
> +		 (rotation & DRM_ROTATE_270) ? "270 " : "",
> +		 (rotation & DRM_REFLECT_X) ? "FLIPX " : "",
> +		 (rotation & DRM_REFLECT_Y) ? "FLIPY " : "",
>  		 rotation);
>  
>  	return buf;
> diff --git a/drivers/gpu/drm/i915/intel_atomic_plane.c b/drivers/gpu/drm/i915/intel_atomic_plane.c
> index 7de7721..7cc9c76 100644
> --- a/drivers/gpu/drm/i915/intel_atomic_plane.c
> +++ b/drivers/gpu/drm/i915/intel_atomic_plane.c
> @@ -55,7 +55,7 @@ intel_create_plane_state(struct drm_plane *plane)
>  		return NULL;
>  
>  	state->base.plane = plane;
> -	state->base.rotation = BIT(DRM_ROTATE_0);
> +	state->base.rotation = DRM_ROTATE_0;
>  	state->ckey.flags = I915_SET_COLORKEY_NONE;
>  
>  	return state;
> diff --git a/drivers/gpu/drm/i915/intel_display.c b/drivers/gpu/drm/i915/intel_display.c
> index 78beb7e..773954d 100644
> --- a/drivers/gpu/drm/i915/intel_display.c
> +++ b/drivers/gpu/drm/i915/intel_display.c
> @@ -2688,7 +2688,7 @@ static void i9xx_update_primary_plane(struct drm_plane *primary,
>  		intel_crtc->dspaddr_offset = linear_offset;
>  	}
>  
> -	if (rotation == BIT(DRM_ROTATE_180)) {
> +	if (rotation == DRM_ROTATE_180) {
>  		dspcntr |= DISPPLANE_ROTATE_180;
>  
>  		x += (crtc_state->pipe_src_w - 1);
> @@ -2791,7 +2791,7 @@ static void ironlake_update_primary_plane(struct drm_plane *primary,
>  		intel_compute_tile_offset(&x, &y, fb, 0,
>  					  fb->pitches[0], rotation);
>  	linear_offset -= intel_crtc->dspaddr_offset;
> -	if (rotation == BIT(DRM_ROTATE_180)) {
> +	if (rotation == DRM_ROTATE_180) {
>  		dspcntr |= DISPPLANE_ROTATE_180;
>  
>  		if (!IS_HASWELL(dev) && !IS_BROADWELL(dev)) {
> @@ -2952,17 +2952,17 @@ u32 skl_plane_ctl_tiling(uint64_t fb_modifier)
>  u32 skl_plane_ctl_rotation(unsigned int rotation)
>  {
>  	switch (rotation) {
> -	case BIT(DRM_ROTATE_0):
> +	case DRM_ROTATE_0:
>  		break;
>  	/*
>  	 * DRM_ROTATE_ is counter clockwise to stay compatible with Xrandr
>  	 * while i915 HW rotation is clockwise, thats why this swapping.
>  	 */
> -	case BIT(DRM_ROTATE_90):
> +	case DRM_ROTATE_90:
>  		return PLANE_CTL_ROTATE_270;
> -	case BIT(DRM_ROTATE_180):
> +	case DRM_ROTATE_180:
>  		return PLANE_CTL_ROTATE_180;
> -	case BIT(DRM_ROTATE_270):
> +	case DRM_ROTATE_270:
>  		return PLANE_CTL_ROTATE_90;
>  	default:
>  		MISSING_CASE(rotation);
> @@ -4248,7 +4248,7 @@ int skl_update_scaler_crtc(struct intel_crtc_state *state)
>  		      intel_crtc->pipe, SKL_CRTC_INDEX);
>  
>  	return skl_update_scaler(state, !state->base.active, SKL_CRTC_INDEX,
> -		&state->scaler_state.scaler_id, BIT(DRM_ROTATE_0),
> +		&state->scaler_state.scaler_id, DRM_ROTATE_0,
>  		state->pipe_src_w, state->pipe_src_h,
>  		adjusted_mode->crtc_hdisplay, adjusted_mode->crtc_vdisplay);
>  }
> @@ -10263,7 +10263,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 == BIT(DRM_ROTATE_180))
> +		if (plane_state->base.rotation == DRM_ROTATE_180)
>  			cntl |= CURSOR_ROTATE_180;
>  	}
>  
> @@ -10309,7 +10309,7 @@ static void intel_crtc_update_cursor(struct drm_crtc *crtc,
>  
>  		/* ILK+ do this automagically */
>  		if (HAS_GMCH_DISPLAY(dev) &&
> -		    plane_state->base.rotation == BIT(DRM_ROTATE_180)) {
> +		    plane_state->base.rotation == DRM_ROTATE_180) {
>  			base += (plane_state->base.crtc_h *
>  				 plane_state->base.crtc_w - 1) * 4;
>  		}
> @@ -14304,11 +14304,11 @@ fail:
>  void intel_create_rotation_property(struct drm_device *dev, struct intel_plane *plane)
>  {
>  	if (!dev->mode_config.rotation_property) {
> -		unsigned long flags = BIT(DRM_ROTATE_0) |
> -			BIT(DRM_ROTATE_180);
> +		unsigned long flags = DRM_ROTATE_0 |
> +			DRM_ROTATE_180;
>  
>  		if (INTEL_INFO(dev)->gen >= 9)
> -			flags |= BIT(DRM_ROTATE_90) | BIT(DRM_ROTATE_270);
> +			flags |= DRM_ROTATE_90 | DRM_ROTATE_270;
>  
>  		dev->mode_config.rotation_property =
>  			drm_mode_create_rotation_property(dev, flags);
> @@ -14451,8 +14451,8 @@ static struct drm_plane *intel_cursor_plane_create(struct drm_device *dev,
>  		if (!dev->mode_config.rotation_property)
>  			dev->mode_config.rotation_property =
>  				drm_mode_create_rotation_property(dev,
> -							BIT(DRM_ROTATE_0) |
> -							BIT(DRM_ROTATE_180));
> +							DRM_ROTATE_0 |
> +							DRM_ROTATE_180);
>  		if (dev->mode_config.rotation_property)
>  			drm_object_attach_property(&cursor->base.base,
>  				dev->mode_config.rotation_property,
> diff --git a/drivers/gpu/drm/i915/intel_drv.h b/drivers/gpu/drm/i915/intel_drv.h
> index e74d851..f82dcc5 100644
> --- a/drivers/gpu/drm/i915/intel_drv.h
> +++ b/drivers/gpu/drm/i915/intel_drv.h
> @@ -1258,7 +1258,7 @@ unsigned int intel_tile_height(const struct drm_i915_private *dev_priv,
>  static inline bool
>  intel_rotation_90_or_270(unsigned int rotation)
>  {
> -	return rotation & (BIT(DRM_ROTATE_90) | BIT(DRM_ROTATE_270));
> +	return rotation & (DRM_ROTATE_90 | DRM_ROTATE_270);
>  }
>  
>  void intel_create_rotation_property(struct drm_device *dev,
> diff --git a/drivers/gpu/drm/i915/intel_fbc.c b/drivers/gpu/drm/i915/intel_fbc.c
> index 781e2f5..eff26d7 100644
> --- a/drivers/gpu/drm/i915/intel_fbc.c
> +++ b/drivers/gpu/drm/i915/intel_fbc.c
> @@ -775,7 +775,7 @@ static bool intel_fbc_can_activate(struct intel_crtc *crtc)
>  		return false;
>  	}
>  	if (INTEL_INFO(dev_priv)->gen <= 4 && !IS_G4X(dev_priv) &&
> -	    cache->plane.rotation != BIT(DRM_ROTATE_0)) {
> +	    cache->plane.rotation != DRM_ROTATE_0) {
>  		fbc->no_fbc_reason = "rotation unsupported";
>  		return false;
>  	}
> diff --git a/drivers/gpu/drm/i915/intel_fbdev.c b/drivers/gpu/drm/i915/intel_fbdev.c
> index 6344999..4fee93d 100644
> --- a/drivers/gpu/drm/i915/intel_fbdev.c
> +++ b/drivers/gpu/drm/i915/intel_fbdev.c
> @@ -223,7 +223,7 @@ static int intelfb_create(struct drm_fb_helper *helper,
>  	 * This also validates that any existing fb inherited from the
>  	 * BIOS is suitable for own access.
>  	 */
> -	ret = intel_pin_and_fence_fb_obj(&ifbdev->fb->base, BIT(DRM_ROTATE_0));
> +	ret = intel_pin_and_fence_fb_obj(&ifbdev->fb->base, DRM_ROTATE_0);
>  	if (ret)
>  		goto out_unlock;
>  
> @@ -289,7 +289,7 @@ static int intelfb_create(struct drm_fb_helper *helper,
>  out_destroy_fbi:
>  	drm_fb_helper_release_fbi(helper);
>  out_unpin:
> -	intel_unpin_fb_obj(&ifbdev->fb->base, BIT(DRM_ROTATE_0));
> +	intel_unpin_fb_obj(&ifbdev->fb->base, DRM_ROTATE_0);
>  out_unlock:
>  	mutex_unlock(&dev->struct_mutex);
>  	return ret;
> @@ -554,7 +554,7 @@ static void intel_fbdev_destroy(struct intel_fbdev *ifbdev)
>  
>  	if (ifbdev->fb) {
>  		mutex_lock(&ifbdev->helper.dev->struct_mutex);
> -		intel_unpin_fb_obj(&ifbdev->fb->base, BIT(DRM_ROTATE_0));
> +		intel_unpin_fb_obj(&ifbdev->fb->base, DRM_ROTATE_0);
>  		mutex_unlock(&ifbdev->helper.dev->struct_mutex);
>  
>  		drm_framebuffer_remove(&ifbdev->fb->base);
> diff --git a/drivers/gpu/drm/i915/intel_sprite.c b/drivers/gpu/drm/i915/intel_sprite.c
> index 0de935a..22ae2298 100644
> --- a/drivers/gpu/drm/i915/intel_sprite.c
> +++ b/drivers/gpu/drm/i915/intel_sprite.c
> @@ -444,7 +444,7 @@ vlv_update_plane(struct drm_plane *dplane,
>  						   fb->pitches[0], rotation);
>  	linear_offset -= sprsurf_offset;
>  
> -	if (rotation == BIT(DRM_ROTATE_180)) {
> +	if (rotation == DRM_ROTATE_180) {
>  		sprctl |= SP_ROTATE_180;
>  
>  		x += src_w;
> @@ -577,7 +577,7 @@ ivb_update_plane(struct drm_plane *plane,
>  						   fb->pitches[0], rotation);
>  	linear_offset -= sprsurf_offset;
>  
> -	if (rotation == BIT(DRM_ROTATE_180)) {
> +	if (rotation == DRM_ROTATE_180) {
>  		sprctl |= SPRITE_ROTATE_180;
>  
>  		/* HSW and BDW does this automagically in hardware */
> @@ -714,7 +714,7 @@ ilk_update_plane(struct drm_plane *plane,
>  						   fb->pitches[0], rotation);
>  	linear_offset -= dvssurf_offset;
>  
> -	if (rotation == BIT(DRM_ROTATE_180)) {
> +	if (rotation == DRM_ROTATE_180) {
>  		dvscntr |= DVS_ROTATE_180;
>  
>  		x += src_w;
> diff --git a/drivers/gpu/drm/msm/mdp/mdp5/mdp5_plane.c b/drivers/gpu/drm/msm/mdp/mdp5/mdp5_plane.c
> index 432c098..a02a24e 100644
> --- a/drivers/gpu/drm/msm/mdp/mdp5/mdp5_plane.c
> +++ b/drivers/gpu/drm/msm/mdp/mdp5/mdp5_plane.c
> @@ -78,7 +78,7 @@ 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,
> -			BIT(DRM_REFLECT_X) | BIT(DRM_REFLECT_Y));
> +			DRM_REFLECT_X | DRM_REFLECT_Y);
>  
>  	if (dev->mode_config.rotation_property)
>  		drm_object_attach_property(&plane->base,
> @@ -309,8 +309,8 @@ static int mdp5_plane_atomic_check(struct drm_plane *plane,
>  			return -EINVAL;
>  		}
>  
> -		hflip = !!(state->rotation & BIT(DRM_REFLECT_X));
> -		vflip = !!(state->rotation & BIT(DRM_REFLECT_Y));
> +		hflip = !!(state->rotation & DRM_REFLECT_X);
> +		vflip = !!(state->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,
> @@ -743,8 +743,8 @@ 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 & BIT(DRM_REFLECT_X));
> -	vflip = !!(pstate->rotation & BIT(DRM_REFLECT_Y));
> +	hflip = !!(pstate->rotation & DRM_REFLECT_X);
> +	vflip = !!(pstate->rotation & DRM_REFLECT_Y);
>  
>  	spin_lock_irqsave(&mdp5_plane->pipe_lock, flags);
>  
> diff --git a/drivers/gpu/drm/omapdrm/omap_drv.c b/drivers/gpu/drm/omapdrm/omap_drv.c
> index 26c6134..3dd78f2 100644
> --- a/drivers/gpu/drm/omapdrm/omap_drv.c
> +++ b/drivers/gpu/drm/omapdrm/omap_drv.c
> @@ -295,9 +295,9 @@ static int omap_modeset_init_properties(struct drm_device *dev)
>  	if (priv->has_dmm) {
>  		dev->mode_config.rotation_property =
>  			drm_mode_create_rotation_property(dev,
> -				BIT(DRM_ROTATE_0) | BIT(DRM_ROTATE_90) |
> -				BIT(DRM_ROTATE_180) | BIT(DRM_ROTATE_270) |
> -				BIT(DRM_REFLECT_X) | BIT(DRM_REFLECT_Y));
> +				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;
>  	}
> diff --git a/drivers/gpu/drm/omapdrm/omap_fb.c b/drivers/gpu/drm/omapdrm/omap_fb.c
> index 31f5178..5f3337f 100644
> --- a/drivers/gpu/drm/omapdrm/omap_fb.c
> +++ b/drivers/gpu/drm/omapdrm/omap_fb.c
> @@ -179,24 +179,24 @@ void omap_framebuffer_update_scanout(struct drm_framebuffer *fb,
>  					(uint32_t)win->rotation);
>  			/* fallthru to default to no rotation */
>  		case 0:
> -		case BIT(DRM_ROTATE_0):
> +		case DRM_ROTATE_0:
>  			orient = 0;
>  			break;
> -		case BIT(DRM_ROTATE_90):
> +		case DRM_ROTATE_90:
>  			orient = MASK_XY_FLIP | MASK_X_INVERT;
>  			break;
> -		case BIT(DRM_ROTATE_180):
> +		case DRM_ROTATE_180:
>  			orient = MASK_X_INVERT | MASK_Y_INVERT;
>  			break;
> -		case BIT(DRM_ROTATE_270):
> +		case DRM_ROTATE_270:
>  			orient = MASK_XY_FLIP | MASK_Y_INVERT;
>  			break;
>  		}
>  
> -		if (win->rotation & BIT(DRM_REFLECT_X))
> +		if (win->rotation & DRM_REFLECT_X)
>  			orient ^= MASK_X_INVERT;
>  
> -		if (win->rotation & BIT(DRM_REFLECT_Y))
> +		if (win->rotation & DRM_REFLECT_Y)
>  			orient ^= MASK_Y_INVERT;
>  
>  		/* adjust x,y offset for flip/invert: */
> @@ -213,7 +213,7 @@ void omap_framebuffer_update_scanout(struct drm_framebuffer *fb,
>  	} else {
>  		switch (win->rotation & DRM_ROTATE_MASK) {
>  		case 0:
> -		case BIT(DRM_ROTATE_0):
> +		case DRM_ROTATE_0:
>  			/* OK */
>  			break;
>  
> diff --git a/drivers/gpu/drm/omapdrm/omap_plane.c b/drivers/gpu/drm/omapdrm/omap_plane.c
> index 5252ab7..4c7727e 100644
> --- a/drivers/gpu/drm/omapdrm/omap_plane.c
> +++ b/drivers/gpu/drm/omapdrm/omap_plane.c
> @@ -109,8 +109,8 @@ static void omap_plane_atomic_update(struct drm_plane *plane,
>  	win.src_y = state->src_y >> 16;
>  
>  	switch (state->rotation & DRM_ROTATE_MASK) {
> -	case BIT(DRM_ROTATE_90):
> -	case BIT(DRM_ROTATE_270):
> +	case DRM_ROTATE_90:
> +	case DRM_ROTATE_270:
>  		win.src_w = state->src_h >> 16;
>  		win.src_h = state->src_w >> 16;
>  		break;
> @@ -149,7 +149,7 @@ static void omap_plane_atomic_disable(struct drm_plane *plane,
>  	struct omap_plane_state *omap_state = to_omap_plane_state(plane->state);
>  	struct omap_plane *omap_plane = to_omap_plane(plane);
>  
> -	plane->state->rotation = BIT(DRM_ROTATE_0);
> +	plane->state->rotation = DRM_ROTATE_0;
>  	omap_state->zorder = plane->type == DRM_PLANE_TYPE_PRIMARY
>  			   ? 0 : omap_plane->id;
>  
> @@ -178,7 +178,7 @@ static int omap_plane_atomic_check(struct drm_plane *plane,
>  		return -EINVAL;
>  
>  	if (state->fb) {
> -		if (state->rotation != BIT(DRM_ROTATE_0) &&
> +		if (state->rotation != DRM_ROTATE_0 &&
>  		    !omap_framebuffer_supports_rotation(state->fb))
>  			return -EINVAL;
>  	}
> @@ -269,7 +269,7 @@ static void omap_plane_reset(struct drm_plane *plane)
>  	 */
>  	omap_state->zorder = plane->type == DRM_PLANE_TYPE_PRIMARY
>  			   ? 0 : omap_plane->id;
> -	omap_state->base.rotation = BIT(DRM_ROTATE_0);
> +	omap_state->base.rotation = DRM_ROTATE_0;
>  
>  	plane->state = &omap_state->base;
>  	plane->state->plane = plane;
> diff --git a/include/drm/drm_crtc.h b/include/drm/drm_crtc.h
> index 3edeaf8..57bbc61 100644
> --- a/include/drm/drm_crtc.h
> +++ b/include/drm/drm_crtc.h
> @@ -84,13 +84,13 @@ static inline uint64_t I642U64(int64_t val)
>   * DRM_REFLECT_Y reflects the image along the specified axis prior to rotation
>   */
>  #define DRM_ROTATE_MASK 0x0f
> -#define DRM_ROTATE_0	0
> -#define DRM_ROTATE_90	1
> -#define DRM_ROTATE_180	2
> -#define DRM_ROTATE_270	3
> +#define DRM_ROTATE_0	BIT(0)
> +#define DRM_ROTATE_90	BIT(1)
> +#define DRM_ROTATE_180	BIT(2)
> +#define DRM_ROTATE_270	BIT(3)
>  #define DRM_REFLECT_MASK (~DRM_ROTATE_MASK)
> -#define DRM_REFLECT_X	4
> -#define DRM_REFLECT_Y	5
> +#define DRM_REFLECT_X	BIT(4)
> +#define DRM_REFLECT_Y	BIT(5)
>  
>  enum drm_connector_force {
>  	DRM_FORCE_UNSPECIFIED,
> -- 
> 2.5.5

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

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

* Re: [PATCH] drm: BIT(DRM_ROTATE_?) -> DRM_ROTATE_?
  2016-07-25  7:00 [PATCH] drm: BIT(DRM_ROTATE_?) -> DRM_ROTATE_? Joonas Lahtinen
                   ` (2 preceding siblings ...)
  2016-07-26 12:41 ` Ville Syrjälä
@ 2016-07-26 14:49 ` Sean Paul
       [not found]   ` <CAOw6vbKGJYdN+aZqM7+EDGut3LU3YkDD1HT4QE=AObh4r2UVtQ-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
  2016-07-29  6:16 ` ✗ Ro.CI.BAT: failure for drm: BIT(DRM_ROTATE_?) -> DRM_ROTATE_? (rev3) Patchwork
  4 siblings, 1 reply; 14+ messages in thread
From: Sean Paul @ 2016-07-26 14:49 UTC (permalink / raw)
  To: Joonas Lahtinen
  Cc: Direct Rendering Infrastructure - Development, linux-arm-msm,
	Intel Graphics Development, Daniel Vetter, freedreno

On Mon, Jul 25, 2016 at 3:00 AM, Joonas Lahtinen
<joonas.lahtinen@linux.intel.com> wrote:
> Only property creation uses the rotation as an index, so convert the
> #define to the more used BIT(DRM_ROTATE_?) form and use __builtin_ffs
> to figure the index when needed.
>
> Cc: intel-gfx@lists.freedesktop.org
> Cc: linux-arm-msm@vger.kernel.org
> Cc: freedreno@lists.freedesktop.org
> Cc: David Airlie <airlied@linux.ie>
> Cc: Daniel Vetter <daniel.vetter@ffwll.ch>
> Cc: Ville Syrjälä <ville.syrjala@linux.intel.com>
> Signed-off-by: Joonas Lahtinen <joonas.lahtinen@linux.intel.com>
> ---
>  drivers/gpu/drm/arm/malidp_drv.h                |  2 +-
>  drivers/gpu/drm/arm/malidp_planes.c             | 20 +++++++++---------
>  drivers/gpu/drm/armada/armada_overlay.c         |  2 +-
>  drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_plane.c | 22 +++++++++----------
>  drivers/gpu/drm/drm_atomic_helper.c             |  4 ++--
>  drivers/gpu/drm/drm_crtc.c                      | 24 ++++++++++-----------
>  drivers/gpu/drm/drm_fb_helper.c                 |  4 ++--
>  drivers/gpu/drm/drm_plane_helper.c              |  2 +-
>  drivers/gpu/drm/drm_rect.c                      | 28 ++++++++++++-------------
>  drivers/gpu/drm/i915/i915_debugfs.c             | 12 +++++------
>  drivers/gpu/drm/i915/intel_atomic_plane.c       |  2 +-
>  drivers/gpu/drm/i915/intel_display.c            | 28 ++++++++++++-------------
>  drivers/gpu/drm/i915/intel_drv.h                |  2 +-
>  drivers/gpu/drm/i915/intel_fbc.c                |  2 +-
>  drivers/gpu/drm/i915/intel_fbdev.c              |  6 +++---
>  drivers/gpu/drm/i915/intel_sprite.c             |  6 +++---
>  drivers/gpu/drm/msm/mdp/mdp5/mdp5_plane.c       | 10 ++++-----
>  drivers/gpu/drm/omapdrm/omap_drv.c              |  6 +++---
>  drivers/gpu/drm/omapdrm/omap_fb.c               | 14 ++++++-------
>  drivers/gpu/drm/omapdrm/omap_plane.c            | 10 ++++-----
>  include/drm/drm_crtc.h                          | 12 +++++------
>  21 files changed, 109 insertions(+), 109 deletions(-)
>
> diff --git a/drivers/gpu/drm/arm/malidp_drv.h b/drivers/gpu/drm/arm/malidp_drv.h
> index 95558fd..271d2fb 100644
> --- a/drivers/gpu/drm/arm/malidp_drv.h
> +++ b/drivers/gpu/drm/arm/malidp_drv.h
> @@ -49,6 +49,6 @@ void malidp_de_planes_destroy(struct drm_device *drm);
>  int malidp_crtc_init(struct drm_device *drm);
>
>  /* often used combination of rotational bits */
> -#define MALIDP_ROTATED_MASK    (BIT(DRM_ROTATE_90) | BIT(DRM_ROTATE_270))
> +#define MALIDP_ROTATED_MASK    (DRM_ROTATE_90 | DRM_ROTATE_270)
>
>  #endif  /* __MALIDP_DRV_H__ */
> diff --git a/drivers/gpu/drm/arm/malidp_planes.c b/drivers/gpu/drm/arm/malidp_planes.c
> index 725098d..82c193e 100644
> --- a/drivers/gpu/drm/arm/malidp_planes.c
> +++ b/drivers/gpu/drm/arm/malidp_planes.c
> @@ -108,7 +108,7 @@ static int malidp_de_plane_check(struct drm_plane *plane,
>                 return -EINVAL;
>
>         /* packed RGB888 / BGR888 can't be rotated or flipped */
> -       if (state->rotation != BIT(DRM_ROTATE_0) &&
> +       if (state->rotation != DRM_ROTATE_0 &&
>             (state->fb->pixel_format == DRM_FORMAT_RGB888 ||
>              state->fb->pixel_format == DRM_FORMAT_BGR888))
>                 return -EINVAL;
> @@ -188,9 +188,9 @@ static void malidp_de_plane_update(struct drm_plane *plane,
>         /* setup the rotation and axis flip bits */
>         if (plane->state->rotation & DRM_ROTATE_MASK)
>                 val = ilog2(plane->state->rotation & DRM_ROTATE_MASK) << LAYER_ROT_OFFSET;
> -       if (plane->state->rotation & BIT(DRM_REFLECT_X))
> +       if (plane->state->rotation & DRM_REFLECT_X)
>                 val |= LAYER_V_FLIP;
> -       if (plane->state->rotation & BIT(DRM_REFLECT_Y))
> +       if (plane->state->rotation & DRM_REFLECT_Y)
>                 val |= LAYER_H_FLIP;
>
>         /* set the 'enable layer' bit */
> @@ -255,12 +255,12 @@ int malidp_de_planes_init(struct drm_device *drm)
>                         goto cleanup;
>
>                 if (!drm->mode_config.rotation_property) {
> -                       unsigned long flags = BIT(DRM_ROTATE_0) |
> -                                             BIT(DRM_ROTATE_90) |
> -                                             BIT(DRM_ROTATE_180) |
> -                                             BIT(DRM_ROTATE_270) |
> -                                             BIT(DRM_REFLECT_X) |
> -                                             BIT(DRM_REFLECT_Y);
> +                       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);
>                 }
> @@ -268,7 +268,7 @@ int malidp_de_planes_init(struct drm_device *drm)
>                 if (drm->mode_config.rotation_property && (id != DE_SMART))
>                         drm_object_attach_property(&plane->base.base,
>                                                    drm->mode_config.rotation_property,
> -                                                  BIT(DRM_ROTATE_0));
> +                                                  DRM_ROTATE_0);
>
>                 drm_plane_helper_add(&plane->base,
>                                      &malidp_de_plane_helper_funcs);
> diff --git a/drivers/gpu/drm/armada/armada_overlay.c b/drivers/gpu/drm/armada/armada_overlay.c
> index 1ee707e..152b4e7 100644
> --- a/drivers/gpu/drm/armada/armada_overlay.c
> +++ b/drivers/gpu/drm/armada/armada_overlay.c
> @@ -121,7 +121,7 @@ armada_ovl_plane_update(struct drm_plane *plane, struct drm_crtc *crtc,
>         int ret;
>
>         ret = drm_plane_helper_check_update(plane, crtc, fb, &src, &dest, &clip,
> -                                           BIT(DRM_ROTATE_0),
> +                                           DRM_ROTATE_0,
>                                             0, INT_MAX, true, false, &visible);
>         if (ret)
>                 return ret;
> diff --git a/drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_plane.c b/drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_plane.c
> index 016c191..146809a 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 & (BIT(DRM_ROTATE_90) | BIT(DRM_ROTATE_270))))
> +           (state->base.rotation & (DRM_ROTATE_90 | DRM_ROTATE_270)))
>                 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 & (BIT(DRM_ROTATE_90) | BIT(DRM_ROTATE_270))) {
> +       if (state->base.rotation & (DRM_ROTATE_90 | DRM_ROTATE_270)) {
>                 tmp = state->crtc_w;
>                 state->crtc_w = state->crtc_h;
>                 state->crtc_h = tmp;
> @@ -677,7 +677,7 @@ static int atmel_hlcdc_plane_atomic_check(struct drm_plane *p,
>                         return -EINVAL;
>
>                 switch (state->base.rotation & DRM_ROTATE_MASK) {
> -               case BIT(DRM_ROTATE_90):
> +               case DRM_ROTATE_90:
>                         offset = ((y_offset + state->src_y + patched_src_w - 1) /
>                                   ydiv) * fb->pitches[i];
>                         offset += ((x_offset + state->src_x) / xdiv) *
> @@ -686,7 +686,7 @@ static int atmel_hlcdc_plane_atomic_check(struct drm_plane *p,
>                                           fb->pitches[i];
>                         state->pstride[i] = -fb->pitches[i] - state->bpp[i];
>                         break;
> -               case BIT(DRM_ROTATE_180):
> +               case DRM_ROTATE_180:
>                         offset = ((y_offset + state->src_y + patched_src_h - 1) /
>                                   ydiv) * fb->pitches[i];
>                         offset += ((x_offset + state->src_x + patched_src_w - 1) /
> @@ -695,7 +695,7 @@ static int atmel_hlcdc_plane_atomic_check(struct drm_plane *p,
>                                            state->bpp[i]) - fb->pitches[i];
>                         state->pstride[i] = -2 * state->bpp[i];
>                         break;
> -               case BIT(DRM_ROTATE_270):
> +               case DRM_ROTATE_270:
>                         offset = ((y_offset + state->src_y) / ydiv) *
>                                  fb->pitches[i];
>                         offset += ((x_offset + state->src_x + patched_src_h - 1) /
> @@ -705,7 +705,7 @@ static int atmel_hlcdc_plane_atomic_check(struct drm_plane *p,
>                                           (2 * state->bpp[i]);
>                         state->pstride[i] = fb->pitches[i] - state->bpp[i];
>                         break;
> -               case BIT(DRM_ROTATE_0):
> +               case DRM_ROTATE_0:
>                 default:
>                         offset = ((y_offset + state->src_y) / ydiv) *
>                                  fb->pitches[i];
> @@ -905,7 +905,7 @@ static void atmel_hlcdc_plane_init_properties(struct atmel_hlcdc_plane *plane,
>         if (desc->layout.xstride && desc->layout.pstride)
>                 drm_object_attach_property(&plane->base.base,
>                                 plane->base.dev->mode_config.rotation_property,
> -                               BIT(DRM_ROTATE_0));
> +                               DRM_ROTATE_0);
>
>         if (desc->layout.csc) {
>                 /*
> @@ -1056,10 +1056,10 @@ atmel_hlcdc_plane_create_properties(struct drm_device *dev)
>
>         dev->mode_config.rotation_property =
>                         drm_mode_create_rotation_property(dev,
> -                                                         BIT(DRM_ROTATE_0) |
> -                                                         BIT(DRM_ROTATE_90) |
> -                                                         BIT(DRM_ROTATE_180) |
> -                                                         BIT(DRM_ROTATE_270));
> +                                                         DRM_ROTATE_0 |
> +                                                         DRM_ROTATE_90 |
> +                                                         DRM_ROTATE_180 |
> +                                                         DRM_ROTATE_270);
>         if (!dev->mode_config.rotation_property)
>                 return ERR_PTR(-ENOMEM);
>
> diff --git a/drivers/gpu/drm/drm_atomic_helper.c b/drivers/gpu/drm/drm_atomic_helper.c
> index de7fddc..61afd85 100644
> --- a/drivers/gpu/drm/drm_atomic_helper.c
> +++ b/drivers/gpu/drm/drm_atomic_helper.c
> @@ -2348,7 +2348,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 & (BIT(DRM_ROTATE_90) | BIT(DRM_ROTATE_270))) {
> +       if (primary_state->rotation & (DRM_ROTATE_90 | DRM_ROTATE_270)) {
>                 primary_state->src_w = vdisplay << 16;
>                 primary_state->src_h = hdisplay << 16;
>         } else {
> @@ -3032,7 +3032,7 @@ void drm_atomic_helper_plane_reset(struct drm_plane *plane)
>
>         if (plane->state) {
>                 plane->state->plane = plane;
> -               plane->state->rotation = BIT(DRM_ROTATE_0);
> +               plane->state->rotation = DRM_ROTATE_0;
>         }
>  }
>  EXPORT_SYMBOL(drm_atomic_helper_plane_reset);
> diff --git a/drivers/gpu/drm/drm_crtc.c b/drivers/gpu/drm/drm_crtc.c
> index f1d9f05..909a025 100644
> --- a/drivers/gpu/drm/drm_crtc.c
> +++ b/drivers/gpu/drm/drm_crtc.c
> @@ -2804,8 +2804,8 @@ 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 & (BIT(DRM_ROTATE_90) |
> -                                             BIT(DRM_ROTATE_270)))
> +           crtc->primary->state->rotation & (DRM_ROTATE_90 |
> +                                             DRM_ROTATE_270))
>                 swap(hdisplay, vdisplay);
>
>         return check_src_coords(x << 16, y << 16,
> @@ -5646,9 +5646,9 @@ int drm_mode_destroy_dumb_ioctl(struct drm_device *dev,
>   * Eg. if the hardware supports everything except DRM_REFLECT_X
>   * one could call this function like this:
>   *
> - * drm_rotation_simplify(rotation, BIT(DRM_ROTATE_0) |
> - *                       BIT(DRM_ROTATE_90) | BIT(DRM_ROTATE_180) |
> - *                       BIT(DRM_ROTATE_270) | BIT(DRM_REFLECT_Y));
> + * drm_rotation_simplify(rotation, DRM_ROTATE_0 |
> + *                       DRM_ROTATE_90 | DRM_ROTATE_180 |
> + *                       DRM_ROTATE_270 | DRM_REFLECT_Y);
>   *
>   * to eliminate the DRM_ROTATE_X flag. Depending on what kind of
>   * transforms the hardware supports, this function may not
> @@ -5659,7 +5659,7 @@ unsigned int drm_rotation_simplify(unsigned int rotation,
>                                    unsigned int supported_rotations)
>  {
>         if (rotation & ~supported_rotations) {
> -               rotation ^= BIT(DRM_REFLECT_X) | BIT(DRM_REFLECT_Y);
> +               rotation ^= DRM_REFLECT_X | DRM_REFLECT_Y;
>                 rotation = (rotation & DRM_REFLECT_MASK) |
>                            BIT((ffs(rotation & DRM_ROTATE_MASK) + 1) % 4);
>         }
> @@ -5788,12 +5788,12 @@ struct drm_property *drm_mode_create_rotation_property(struct drm_device *dev,
>                                                        unsigned int supported_rotations)
>  {
>         static const struct drm_prop_enum_list props[] = {
> -               { DRM_ROTATE_0,   "rotate-0" },
> -               { DRM_ROTATE_90,  "rotate-90" },
> -               { DRM_ROTATE_180, "rotate-180" },
> -               { DRM_ROTATE_270, "rotate-270" },
> -               { DRM_REFLECT_X,  "reflect-x" },
> -               { DRM_REFLECT_Y,  "reflect-y" },
> +               { __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",
> diff --git a/drivers/gpu/drm/drm_fb_helper.c b/drivers/gpu/drm/drm_fb_helper.c
> index ce54e98..d4896f9 100644
> --- a/drivers/gpu/drm/drm_fb_helper.c
> +++ b/drivers/gpu/drm/drm_fb_helper.c
> @@ -335,7 +335,7 @@ retry:
>                         goto fail;
>                 }
>
> -               plane_state->rotation = BIT(DRM_ROTATE_0);
> +               plane_state->rotation = DRM_ROTATE_0;
>
>                 plane->old_fb = plane->fb;
>                 plane_mask |= 1 << drm_plane_index(plane);
> @@ -395,7 +395,7 @@ static int restore_fbdev_mode(struct drm_fb_helper *fb_helper)
>                 if (dev->mode_config.rotation_property) {
>                         drm_mode_plane_set_obj_prop(plane,
>                                                     dev->mode_config.rotation_property,
> -                                                   BIT(DRM_ROTATE_0));
> +                                                   DRM_ROTATE_0);
>                 }
>         }
>
> diff --git a/drivers/gpu/drm/drm_plane_helper.c b/drivers/gpu/drm/drm_plane_helper.c
> index 16c4a7b..c360e30 100644
> --- a/drivers/gpu/drm/drm_plane_helper.c
> +++ b/drivers/gpu/drm/drm_plane_helper.c
> @@ -274,7 +274,7 @@ int drm_primary_helper_update(struct drm_plane *plane, struct drm_crtc *crtc,
>
>         ret = drm_plane_helper_check_update(plane, crtc, fb,
>                                             &src, &dest, &clip,
> -                                           BIT(DRM_ROTATE_0),
> +                                           DRM_ROTATE_0,
>                                             DRM_PLANE_HELPER_NO_SCALING,
>                                             DRM_PLANE_HELPER_NO_SCALING,
>                                             false, false, &visible);
> diff --git a/drivers/gpu/drm/drm_rect.c b/drivers/gpu/drm/drm_rect.c
> index a8e2c86..4063f6e 100644
> --- a/drivers/gpu/drm/drm_rect.c
> +++ b/drivers/gpu/drm/drm_rect.c
> @@ -317,38 +317,38 @@ void drm_rect_rotate(struct drm_rect *r,
>  {
>         struct drm_rect tmp;
>
> -       if (rotation & (BIT(DRM_REFLECT_X) | BIT(DRM_REFLECT_Y))) {
> +       if (rotation & (DRM_REFLECT_X | DRM_REFLECT_Y)) {
>                 tmp = *r;
>
> -               if (rotation & BIT(DRM_REFLECT_X)) {
> +               if (rotation & DRM_REFLECT_X) {
>                         r->x1 = width - tmp.x2;
>                         r->x2 = width - tmp.x1;
>                 }
>
> -               if (rotation & BIT(DRM_REFLECT_Y)) {
> +               if (rotation & DRM_REFLECT_Y) {
>                         r->y1 = height - tmp.y2;
>                         r->y2 = height - tmp.y1;
>                 }
>         }
>
>         switch (rotation & DRM_ROTATE_MASK) {
> -       case BIT(DRM_ROTATE_0):
> +       case DRM_ROTATE_0:
>                 break;
> -       case BIT(DRM_ROTATE_90):
> +       case DRM_ROTATE_90:
>                 tmp = *r;
>                 r->x1 = tmp.y1;
>                 r->x2 = tmp.y2;
>                 r->y1 = width - tmp.x2;
>                 r->y2 = width - tmp.x1;
>                 break;
> -       case BIT(DRM_ROTATE_180):
> +       case DRM_ROTATE_180:
>                 tmp = *r;
>                 r->x1 = width - tmp.x2;
>                 r->x2 = width - tmp.x1;
>                 r->y1 = height - tmp.y2;
>                 r->y2 = height - tmp.y1;
>                 break;
> -       case BIT(DRM_ROTATE_270):
> +       case DRM_ROTATE_270:
>                 tmp = *r;
>                 r->x1 = height - tmp.y2;
>                 r->x2 = height - tmp.y1;
> @@ -392,23 +392,23 @@ void drm_rect_rotate_inv(struct drm_rect *r,
>         struct drm_rect tmp;
>
>         switch (rotation & DRM_ROTATE_MASK) {
> -       case BIT(DRM_ROTATE_0):
> +       case DRM_ROTATE_0:
>                 break;
> -       case BIT(DRM_ROTATE_90):
> +       case DRM_ROTATE_90:
>                 tmp = *r;
>                 r->x1 = width - tmp.y2;
>                 r->x2 = width - tmp.y1;
>                 r->y1 = tmp.x1;
>                 r->y2 = tmp.x2;
>                 break;
> -       case BIT(DRM_ROTATE_180):
> +       case DRM_ROTATE_180:
>                 tmp = *r;
>                 r->x1 = width - tmp.x2;
>                 r->x2 = width - tmp.x1;
>                 r->y1 = height - tmp.y2;
>                 r->y2 = height - tmp.y1;
>                 break;
> -       case BIT(DRM_ROTATE_270):
> +       case DRM_ROTATE_270:
>                 tmp = *r;
>                 r->x1 = tmp.y1;
>                 r->x2 = tmp.y2;
> @@ -419,15 +419,15 @@ void drm_rect_rotate_inv(struct drm_rect *r,
>                 break;
>         }
>
> -       if (rotation & (BIT(DRM_REFLECT_X) | BIT(DRM_REFLECT_Y))) {
> +       if (rotation & (DRM_REFLECT_X | DRM_REFLECT_Y)) {
>                 tmp = *r;
>
> -               if (rotation & BIT(DRM_REFLECT_X)) {
> +               if (rotation & DRM_REFLECT_X) {
>                         r->x1 = width - tmp.x2;
>                         r->x2 = width - tmp.x1;
>                 }
>
> -               if (rotation & BIT(DRM_REFLECT_Y)) {
> +               if (rotation & DRM_REFLECT_Y) {
>                         r->y1 = height - tmp.y2;
>                         r->y2 = height - tmp.y1;
>                 }
> diff --git a/drivers/gpu/drm/i915/i915_debugfs.c b/drivers/gpu/drm/i915/i915_debugfs.c
> index 9aa62c5..815232c 100644
> --- a/drivers/gpu/drm/i915/i915_debugfs.c
> +++ b/drivers/gpu/drm/i915/i915_debugfs.c
> @@ -3081,12 +3081,12 @@ static const char *plane_rotation(unsigned int rotation)
>          */
>         snprintf(buf, sizeof(buf),
>                  "%s%s%s%s%s%s(0x%08x)",
> -                (rotation & BIT(DRM_ROTATE_0)) ? "0 " : "",
> -                (rotation & BIT(DRM_ROTATE_90)) ? "90 " : "",
> -                (rotation & BIT(DRM_ROTATE_180)) ? "180 " : "",
> -                (rotation & BIT(DRM_ROTATE_270)) ? "270 " : "",
> -                (rotation & BIT(DRM_REFLECT_X)) ? "FLIPX " : "",
> -                (rotation & BIT(DRM_REFLECT_Y)) ? "FLIPY " : "",
> +                (rotation & DRM_ROTATE_0) ? "0 " : "",
> +                (rotation & DRM_ROTATE_90) ? "90 " : "",
> +                (rotation & DRM_ROTATE_180) ? "180 " : "",
> +                (rotation & DRM_ROTATE_270) ? "270 " : "",
> +                (rotation & DRM_REFLECT_X) ? "FLIPX " : "",
> +                (rotation & DRM_REFLECT_Y) ? "FLIPY " : "",
>                  rotation);
>
>         return buf;
> diff --git a/drivers/gpu/drm/i915/intel_atomic_plane.c b/drivers/gpu/drm/i915/intel_atomic_plane.c
> index 7de7721..7cc9c76 100644
> --- a/drivers/gpu/drm/i915/intel_atomic_plane.c
> +++ b/drivers/gpu/drm/i915/intel_atomic_plane.c
> @@ -55,7 +55,7 @@ intel_create_plane_state(struct drm_plane *plane)
>                 return NULL;
>
>         state->base.plane = plane;
> -       state->base.rotation = BIT(DRM_ROTATE_0);
> +       state->base.rotation = DRM_ROTATE_0;
>         state->ckey.flags = I915_SET_COLORKEY_NONE;
>
>         return state;
> diff --git a/drivers/gpu/drm/i915/intel_display.c b/drivers/gpu/drm/i915/intel_display.c
> index 78beb7e..773954d 100644
> --- a/drivers/gpu/drm/i915/intel_display.c
> +++ b/drivers/gpu/drm/i915/intel_display.c
> @@ -2688,7 +2688,7 @@ static void i9xx_update_primary_plane(struct drm_plane *primary,
>                 intel_crtc->dspaddr_offset = linear_offset;
>         }
>
> -       if (rotation == BIT(DRM_ROTATE_180)) {
> +       if (rotation == DRM_ROTATE_180) {
>                 dspcntr |= DISPPLANE_ROTATE_180;
>
>                 x += (crtc_state->pipe_src_w - 1);
> @@ -2791,7 +2791,7 @@ static void ironlake_update_primary_plane(struct drm_plane *primary,
>                 intel_compute_tile_offset(&x, &y, fb, 0,
>                                           fb->pitches[0], rotation);
>         linear_offset -= intel_crtc->dspaddr_offset;
> -       if (rotation == BIT(DRM_ROTATE_180)) {
> +       if (rotation == DRM_ROTATE_180) {
>                 dspcntr |= DISPPLANE_ROTATE_180;
>
>                 if (!IS_HASWELL(dev) && !IS_BROADWELL(dev)) {
> @@ -2952,17 +2952,17 @@ u32 skl_plane_ctl_tiling(uint64_t fb_modifier)
>  u32 skl_plane_ctl_rotation(unsigned int rotation)
>  {
>         switch (rotation) {
> -       case BIT(DRM_ROTATE_0):
> +       case DRM_ROTATE_0:
>                 break;
>         /*
>          * DRM_ROTATE_ is counter clockwise to stay compatible with Xrandr
>          * while i915 HW rotation is clockwise, thats why this swapping.
>          */
> -       case BIT(DRM_ROTATE_90):
> +       case DRM_ROTATE_90:
>                 return PLANE_CTL_ROTATE_270;
> -       case BIT(DRM_ROTATE_180):
> +       case DRM_ROTATE_180:
>                 return PLANE_CTL_ROTATE_180;
> -       case BIT(DRM_ROTATE_270):
> +       case DRM_ROTATE_270:
>                 return PLANE_CTL_ROTATE_90;
>         default:
>                 MISSING_CASE(rotation);
> @@ -4248,7 +4248,7 @@ int skl_update_scaler_crtc(struct intel_crtc_state *state)
>                       intel_crtc->pipe, SKL_CRTC_INDEX);
>
>         return skl_update_scaler(state, !state->base.active, SKL_CRTC_INDEX,
> -               &state->scaler_state.scaler_id, BIT(DRM_ROTATE_0),
> +               &state->scaler_state.scaler_id, DRM_ROTATE_0,
>                 state->pipe_src_w, state->pipe_src_h,
>                 adjusted_mode->crtc_hdisplay, adjusted_mode->crtc_vdisplay);
>  }
> @@ -10263,7 +10263,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 == BIT(DRM_ROTATE_180))
> +               if (plane_state->base.rotation == DRM_ROTATE_180)
>                         cntl |= CURSOR_ROTATE_180;
>         }
>
> @@ -10309,7 +10309,7 @@ static void intel_crtc_update_cursor(struct drm_crtc *crtc,
>
>                 /* ILK+ do this automagically */
>                 if (HAS_GMCH_DISPLAY(dev) &&
> -                   plane_state->base.rotation == BIT(DRM_ROTATE_180)) {
> +                   plane_state->base.rotation == DRM_ROTATE_180) {
>                         base += (plane_state->base.crtc_h *
>                                  plane_state->base.crtc_w - 1) * 4;
>                 }
> @@ -14304,11 +14304,11 @@ fail:
>  void intel_create_rotation_property(struct drm_device *dev, struct intel_plane *plane)
>  {
>         if (!dev->mode_config.rotation_property) {
> -               unsigned long flags = BIT(DRM_ROTATE_0) |
> -                       BIT(DRM_ROTATE_180);
> +               unsigned long flags = DRM_ROTATE_0 |
> +                       DRM_ROTATE_180;
>
>                 if (INTEL_INFO(dev)->gen >= 9)
> -                       flags |= BIT(DRM_ROTATE_90) | BIT(DRM_ROTATE_270);
> +                       flags |= DRM_ROTATE_90 | DRM_ROTATE_270;
>
>                 dev->mode_config.rotation_property =
>                         drm_mode_create_rotation_property(dev, flags);
> @@ -14451,8 +14451,8 @@ static struct drm_plane *intel_cursor_plane_create(struct drm_device *dev,
>                 if (!dev->mode_config.rotation_property)
>                         dev->mode_config.rotation_property =
>                                 drm_mode_create_rotation_property(dev,
> -                                                       BIT(DRM_ROTATE_0) |
> -                                                       BIT(DRM_ROTATE_180));
> +                                                       DRM_ROTATE_0 |
> +                                                       DRM_ROTATE_180);
>                 if (dev->mode_config.rotation_property)
>                         drm_object_attach_property(&cursor->base.base,
>                                 dev->mode_config.rotation_property,
> diff --git a/drivers/gpu/drm/i915/intel_drv.h b/drivers/gpu/drm/i915/intel_drv.h
> index e74d851..f82dcc5 100644
> --- a/drivers/gpu/drm/i915/intel_drv.h
> +++ b/drivers/gpu/drm/i915/intel_drv.h
> @@ -1258,7 +1258,7 @@ unsigned int intel_tile_height(const struct drm_i915_private *dev_priv,
>  static inline bool
>  intel_rotation_90_or_270(unsigned int rotation)
>  {
> -       return rotation & (BIT(DRM_ROTATE_90) | BIT(DRM_ROTATE_270));
> +       return rotation & (DRM_ROTATE_90 | DRM_ROTATE_270);
>  }
>
>  void intel_create_rotation_property(struct drm_device *dev,
> diff --git a/drivers/gpu/drm/i915/intel_fbc.c b/drivers/gpu/drm/i915/intel_fbc.c
> index 781e2f5..eff26d7 100644
> --- a/drivers/gpu/drm/i915/intel_fbc.c
> +++ b/drivers/gpu/drm/i915/intel_fbc.c
> @@ -775,7 +775,7 @@ static bool intel_fbc_can_activate(struct intel_crtc *crtc)
>                 return false;
>         }
>         if (INTEL_INFO(dev_priv)->gen <= 4 && !IS_G4X(dev_priv) &&
> -           cache->plane.rotation != BIT(DRM_ROTATE_0)) {
> +           cache->plane.rotation != DRM_ROTATE_0) {
>                 fbc->no_fbc_reason = "rotation unsupported";
>                 return false;
>         }
> diff --git a/drivers/gpu/drm/i915/intel_fbdev.c b/drivers/gpu/drm/i915/intel_fbdev.c
> index 6344999..4fee93d 100644
> --- a/drivers/gpu/drm/i915/intel_fbdev.c
> +++ b/drivers/gpu/drm/i915/intel_fbdev.c
> @@ -223,7 +223,7 @@ static int intelfb_create(struct drm_fb_helper *helper,
>          * This also validates that any existing fb inherited from the
>          * BIOS is suitable for own access.
>          */
> -       ret = intel_pin_and_fence_fb_obj(&ifbdev->fb->base, BIT(DRM_ROTATE_0));
> +       ret = intel_pin_and_fence_fb_obj(&ifbdev->fb->base, DRM_ROTATE_0);
>         if (ret)
>                 goto out_unlock;
>
> @@ -289,7 +289,7 @@ static int intelfb_create(struct drm_fb_helper *helper,
>  out_destroy_fbi:
>         drm_fb_helper_release_fbi(helper);
>  out_unpin:
> -       intel_unpin_fb_obj(&ifbdev->fb->base, BIT(DRM_ROTATE_0));
> +       intel_unpin_fb_obj(&ifbdev->fb->base, DRM_ROTATE_0);
>  out_unlock:
>         mutex_unlock(&dev->struct_mutex);
>         return ret;
> @@ -554,7 +554,7 @@ static void intel_fbdev_destroy(struct intel_fbdev *ifbdev)
>
>         if (ifbdev->fb) {
>                 mutex_lock(&ifbdev->helper.dev->struct_mutex);
> -               intel_unpin_fb_obj(&ifbdev->fb->base, BIT(DRM_ROTATE_0));
> +               intel_unpin_fb_obj(&ifbdev->fb->base, DRM_ROTATE_0);
>                 mutex_unlock(&ifbdev->helper.dev->struct_mutex);
>
>                 drm_framebuffer_remove(&ifbdev->fb->base);
> diff --git a/drivers/gpu/drm/i915/intel_sprite.c b/drivers/gpu/drm/i915/intel_sprite.c
> index 0de935a..22ae2298 100644
> --- a/drivers/gpu/drm/i915/intel_sprite.c
> +++ b/drivers/gpu/drm/i915/intel_sprite.c
> @@ -444,7 +444,7 @@ vlv_update_plane(struct drm_plane *dplane,
>                                                    fb->pitches[0], rotation);
>         linear_offset -= sprsurf_offset;
>
> -       if (rotation == BIT(DRM_ROTATE_180)) {
> +       if (rotation == DRM_ROTATE_180) {
>                 sprctl |= SP_ROTATE_180;
>
>                 x += src_w;
> @@ -577,7 +577,7 @@ ivb_update_plane(struct drm_plane *plane,
>                                                    fb->pitches[0], rotation);
>         linear_offset -= sprsurf_offset;
>
> -       if (rotation == BIT(DRM_ROTATE_180)) {
> +       if (rotation == DRM_ROTATE_180) {
>                 sprctl |= SPRITE_ROTATE_180;
>
>                 /* HSW and BDW does this automagically in hardware */
> @@ -714,7 +714,7 @@ ilk_update_plane(struct drm_plane *plane,
>                                                    fb->pitches[0], rotation);
>         linear_offset -= dvssurf_offset;
>
> -       if (rotation == BIT(DRM_ROTATE_180)) {
> +       if (rotation == DRM_ROTATE_180) {
>                 dvscntr |= DVS_ROTATE_180;
>
>                 x += src_w;
> diff --git a/drivers/gpu/drm/msm/mdp/mdp5/mdp5_plane.c b/drivers/gpu/drm/msm/mdp/mdp5/mdp5_plane.c
> index 432c098..a02a24e 100644
> --- a/drivers/gpu/drm/msm/mdp/mdp5/mdp5_plane.c
> +++ b/drivers/gpu/drm/msm/mdp/mdp5/mdp5_plane.c
> @@ -78,7 +78,7 @@ 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,
> -                       BIT(DRM_REFLECT_X) | BIT(DRM_REFLECT_Y));
> +                       DRM_REFLECT_X | DRM_REFLECT_Y);
>
>         if (dev->mode_config.rotation_property)
>                 drm_object_attach_property(&plane->base,
> @@ -309,8 +309,8 @@ static int mdp5_plane_atomic_check(struct drm_plane *plane,
>                         return -EINVAL;
>                 }
>
> -               hflip = !!(state->rotation & BIT(DRM_REFLECT_X));
> -               vflip = !!(state->rotation & BIT(DRM_REFLECT_Y));
> +               hflip = !!(state->rotation & DRM_REFLECT_X);
> +               vflip = !!(state->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,
> @@ -743,8 +743,8 @@ 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 & BIT(DRM_REFLECT_X));
> -       vflip = !!(pstate->rotation & BIT(DRM_REFLECT_Y));
> +       hflip = !!(pstate->rotation & DRM_REFLECT_X);
> +       vflip = !!(pstate->rotation & DRM_REFLECT_Y);
>
>         spin_lock_irqsave(&mdp5_plane->pipe_lock, flags);
>
> diff --git a/drivers/gpu/drm/omapdrm/omap_drv.c b/drivers/gpu/drm/omapdrm/omap_drv.c
> index 26c6134..3dd78f2 100644
> --- a/drivers/gpu/drm/omapdrm/omap_drv.c
> +++ b/drivers/gpu/drm/omapdrm/omap_drv.c
> @@ -295,9 +295,9 @@ static int omap_modeset_init_properties(struct drm_device *dev)
>         if (priv->has_dmm) {
>                 dev->mode_config.rotation_property =
>                         drm_mode_create_rotation_property(dev,
> -                               BIT(DRM_ROTATE_0) | BIT(DRM_ROTATE_90) |
> -                               BIT(DRM_ROTATE_180) | BIT(DRM_ROTATE_270) |
> -                               BIT(DRM_REFLECT_X) | BIT(DRM_REFLECT_Y));
> +                               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;
>         }
> diff --git a/drivers/gpu/drm/omapdrm/omap_fb.c b/drivers/gpu/drm/omapdrm/omap_fb.c
> index 31f5178..5f3337f 100644
> --- a/drivers/gpu/drm/omapdrm/omap_fb.c
> +++ b/drivers/gpu/drm/omapdrm/omap_fb.c
> @@ -179,24 +179,24 @@ void omap_framebuffer_update_scanout(struct drm_framebuffer *fb,
>                                         (uint32_t)win->rotation);
>                         /* fallthru to default to no rotation */
>                 case 0:
> -               case BIT(DRM_ROTATE_0):
> +               case DRM_ROTATE_0:
>                         orient = 0;
>                         break;
> -               case BIT(DRM_ROTATE_90):
> +               case DRM_ROTATE_90:
>                         orient = MASK_XY_FLIP | MASK_X_INVERT;
>                         break;
> -               case BIT(DRM_ROTATE_180):
> +               case DRM_ROTATE_180:
>                         orient = MASK_X_INVERT | MASK_Y_INVERT;
>                         break;
> -               case BIT(DRM_ROTATE_270):
> +               case DRM_ROTATE_270:
>                         orient = MASK_XY_FLIP | MASK_Y_INVERT;
>                         break;
>                 }
>
> -               if (win->rotation & BIT(DRM_REFLECT_X))
> +               if (win->rotation & DRM_REFLECT_X)
>                         orient ^= MASK_X_INVERT;
>
> -               if (win->rotation & BIT(DRM_REFLECT_Y))
> +               if (win->rotation & DRM_REFLECT_Y)
>                         orient ^= MASK_Y_INVERT;
>
>                 /* adjust x,y offset for flip/invert: */
> @@ -213,7 +213,7 @@ void omap_framebuffer_update_scanout(struct drm_framebuffer *fb,
>         } else {
>                 switch (win->rotation & DRM_ROTATE_MASK) {
>                 case 0:
> -               case BIT(DRM_ROTATE_0):
> +               case DRM_ROTATE_0:
>                         /* OK */
>                         break;
>
> diff --git a/drivers/gpu/drm/omapdrm/omap_plane.c b/drivers/gpu/drm/omapdrm/omap_plane.c
> index 5252ab7..4c7727e 100644
> --- a/drivers/gpu/drm/omapdrm/omap_plane.c
> +++ b/drivers/gpu/drm/omapdrm/omap_plane.c
> @@ -109,8 +109,8 @@ static void omap_plane_atomic_update(struct drm_plane *plane,
>         win.src_y = state->src_y >> 16;
>
>         switch (state->rotation & DRM_ROTATE_MASK) {
> -       case BIT(DRM_ROTATE_90):
> -       case BIT(DRM_ROTATE_270):
> +       case DRM_ROTATE_90:
> +       case DRM_ROTATE_270:
>                 win.src_w = state->src_h >> 16;
>                 win.src_h = state->src_w >> 16;
>                 break;
> @@ -149,7 +149,7 @@ static void omap_plane_atomic_disable(struct drm_plane *plane,
>         struct omap_plane_state *omap_state = to_omap_plane_state(plane->state);
>         struct omap_plane *omap_plane = to_omap_plane(plane);
>
> -       plane->state->rotation = BIT(DRM_ROTATE_0);
> +       plane->state->rotation = DRM_ROTATE_0;
>         omap_state->zorder = plane->type == DRM_PLANE_TYPE_PRIMARY
>                            ? 0 : omap_plane->id;
>
> @@ -178,7 +178,7 @@ static int omap_plane_atomic_check(struct drm_plane *plane,
>                 return -EINVAL;
>
>         if (state->fb) {
> -               if (state->rotation != BIT(DRM_ROTATE_0) &&
> +               if (state->rotation != DRM_ROTATE_0 &&
>                     !omap_framebuffer_supports_rotation(state->fb))
>                         return -EINVAL;
>         }
> @@ -269,7 +269,7 @@ static void omap_plane_reset(struct drm_plane *plane)
>          */
>         omap_state->zorder = plane->type == DRM_PLANE_TYPE_PRIMARY
>                            ? 0 : omap_plane->id;
> -       omap_state->base.rotation = BIT(DRM_ROTATE_0);
> +       omap_state->base.rotation = DRM_ROTATE_0;
>
>         plane->state = &omap_state->base;
>         plane->state->plane = plane;
> diff --git a/include/drm/drm_crtc.h b/include/drm/drm_crtc.h
> index 3edeaf8..57bbc61 100644
> --- a/include/drm/drm_crtc.h
> +++ b/include/drm/drm_crtc.h
> @@ -84,13 +84,13 @@ static inline uint64_t I642U64(int64_t val)
>   * DRM_REFLECT_Y reflects the image along the specified axis prior to rotation
>   */
>  #define DRM_ROTATE_MASK 0x0f
> -#define DRM_ROTATE_0   0
> -#define DRM_ROTATE_90  1
> -#define DRM_ROTATE_180 2
> -#define DRM_ROTATE_270 3
> +#define DRM_ROTATE_0   BIT(0)
> +#define DRM_ROTATE_90  BIT(1)
> +#define DRM_ROTATE_180 BIT(2)
> +#define DRM_ROTATE_270 BIT(3)
>  #define DRM_REFLECT_MASK (~DRM_ROTATE_MASK)

It's probably a good time to give these masks a little love. Could we
just generate them (both ROTATE and REFLECT) from the ROTATE and
REFLECT values now?

Sean

> -#define DRM_REFLECT_X  4
> -#define DRM_REFLECT_Y  5
> +#define DRM_REFLECT_X  BIT(4)
> +#define DRM_REFLECT_Y  BIT(5)
>
>  enum drm_connector_force {
>         DRM_FORCE_UNSPECIFIED,
> --
> 2.5.5
>
> _______________________________________________
> dri-devel mailing list
> dri-devel@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/dri-devel

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

* Re: [PATCH] drm: BIT(DRM_ROTATE_?) -> DRM_ROTATE_?
       [not found]   ` <CAOw6vbKGJYdN+aZqM7+EDGut3LU3YkDD1HT4QE=AObh4r2UVtQ-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
@ 2016-07-28  6:44     ` Joonas Lahtinen
  2016-07-28 14:04       ` Sean Paul
  0 siblings, 1 reply; 14+ messages in thread
From: Joonas Lahtinen @ 2016-07-28  6:44 UTC (permalink / raw)
  To: Sean Paul
  Cc: linux-arm-msm, Intel Graphics Development,
	freedreno-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW,
	Direct Rendering Infrastructure - Development, Daniel Vetter

On ti, 2016-07-26 at 10:49 -0400, Sean Paul wrote:
> On Mon, Jul 25, 2016 at 3:00 AM, Joonas Lahtinen
> <joonas.lahtinen@linux.intel.com> wrote:
> > diff --git a/include/drm/drm_crtc.h b/include/drm/drm_crtc.h
> > index 3edeaf8..57bbc61 100644
> > --- a/include/drm/drm_crtc.h
> > +++ b/include/drm/drm_crtc.h
> > @@ -84,13 +84,13 @@ static inline uint64_t I642U64(int64_t val)
> >   * DRM_REFLECT_Y reflects the image along the specified axis prior to rotation
> >   */
> >  #define DRM_ROTATE_MASK 0x0f
> > -#define DRM_ROTATE_0   0
> > -#define DRM_ROTATE_90  1
> > -#define DRM_ROTATE_180 2
> > -#define DRM_ROTATE_270 3
> > +#define DRM_ROTATE_0   BIT(0)
> > +#define DRM_ROTATE_90  BIT(1)
> > +#define DRM_ROTATE_180 BIT(2)
> > +#define DRM_ROTATE_270 BIT(3)
> >  #define DRM_REFLECT_MASK (~DRM_ROTATE_MASK)
> It's probably a good time to give these masks a little love. Could we
> just generate them (both ROTATE and REFLECT) from the ROTATE and
> REFLECT values now?

I was consider it too, so I think it would be an OK change. Fine with
the patch otherwise? I can send a revised version with that changed.

Regards, Joonas

> 
> Sean
> 
> > 
> > -#define DRM_REFLECT_X  4
> > -#define DRM_REFLECT_Y  5
> > +#define DRM_REFLECT_X  BIT(4)
> > +#define DRM_REFLECT_Y  BIT(5)
> > 
> >  enum drm_connector_force {
> >         DRM_FORCE_UNSPECIFIED,
> > --
> > 2.5.5
> > 
> > _______________________________________________
> > dri-devel mailing list
> > dri-devel@lists.freedesktop.org
> > https://lists.freedesktop.org/mailman/listinfo/dri-devel
-- 
Joonas Lahtinen
Open Source Technology Center
Intel Corporation
_______________________________________________
Freedreno mailing list
Freedreno@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/freedreno

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

* Re: [PATCH] drm: BIT(DRM_ROTATE_?) -> DRM_ROTATE_?
  2016-07-28  6:44     ` Joonas Lahtinen
@ 2016-07-28 14:04       ` Sean Paul
  2016-07-29  5:49         ` Joonas Lahtinen
  2016-07-29  5:50         ` [PATCH v2] " Joonas Lahtinen
  0 siblings, 2 replies; 14+ messages in thread
From: Sean Paul @ 2016-07-28 14:04 UTC (permalink / raw)
  To: Joonas Lahtinen
  Cc: Direct Rendering Infrastructure - Development, linux-arm-msm,
	Intel Graphics Development, Daniel Vetter, freedreno

On Thu, Jul 28, 2016 at 2:44 AM, Joonas Lahtinen
<joonas.lahtinen@linux.intel.com> wrote:
> On ti, 2016-07-26 at 10:49 -0400, Sean Paul wrote:
>> On Mon, Jul 25, 2016 at 3:00 AM, Joonas Lahtinen
>> <joonas.lahtinen@linux.intel.com> wrote:
>> > diff --git a/include/drm/drm_crtc.h b/include/drm/drm_crtc.h
>> > index 3edeaf8..57bbc61 100644
>> > --- a/include/drm/drm_crtc.h
>> > +++ b/include/drm/drm_crtc.h
>> > @@ -84,13 +84,13 @@ static inline uint64_t I642U64(int64_t val)
>> >   * DRM_REFLECT_Y reflects the image along the specified axis prior to rotation
>> >   */
>> >  #define DRM_ROTATE_MASK 0x0f
>> > -#define DRM_ROTATE_0   0
>> > -#define DRM_ROTATE_90  1
>> > -#define DRM_ROTATE_180 2
>> > -#define DRM_ROTATE_270 3
>> > +#define DRM_ROTATE_0   BIT(0)
>> > +#define DRM_ROTATE_90  BIT(1)
>> > +#define DRM_ROTATE_180 BIT(2)
>> > +#define DRM_ROTATE_270 BIT(3)
>> >  #define DRM_REFLECT_MASK (~DRM_ROTATE_MASK)
>> It's probably a good time to give these masks a little love. Could we
>> just generate them (both ROTATE and REFLECT) from the ROTATE and
>> REFLECT values now?
>
> I was consider it too, so I think it would be an OK change. Fine with
> the patch otherwise? I can send a revised version with that changed.
>

Yeah, everything else looks good to me. Please resend.

Sean

> Regards, Joonas
>
>>
>> Sean
>>
>> >
>> > -#define DRM_REFLECT_X  4
>> > -#define DRM_REFLECT_Y  5
>> > +#define DRM_REFLECT_X  BIT(4)
>> > +#define DRM_REFLECT_Y  BIT(5)
>> >
>> >  enum drm_connector_force {
>> >         DRM_FORCE_UNSPECIFIED,
>> > --
>> > 2.5.5
>> >
>> > _______________________________________________
>> > dri-devel mailing list
>> > dri-devel@lists.freedesktop.org
>> > https://lists.freedesktop.org/mailman/listinfo/dri-devel
> --
> Joonas Lahtinen
> Open Source Technology Center
> Intel Corporation

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

* [PATCH] drm: BIT(DRM_ROTATE_?) -> DRM_ROTATE_?
  2016-07-28 14:04       ` Sean Paul
@ 2016-07-29  5:49         ` Joonas Lahtinen
  2016-07-29  5:51           ` Joonas Lahtinen
  2016-07-29  5:50         ` [PATCH v2] " Joonas Lahtinen
  1 sibling, 1 reply; 14+ messages in thread
From: Joonas Lahtinen @ 2016-07-29  5:49 UTC (permalink / raw)
  To: Direct Rendering Infrastructure - Development
  Cc: Joonas Lahtinen, intel-gfx, linux-arm-msm, freedreno, malidp,
	David Airlie, Daniel Vetter, Ville Syrjälä,
	Liviu Dudau, Sean Paul

Only property creation uses the rotation as an index, so convert the
to figure the index when needed.

v2: Use the new defines to build the _MASK defines (Sean)

Cc: intel-gfx@lists.freedesktop.org
Cc: linux-arm-msm@vger.kernel.org
Cc: freedreno@lists.freedesktop.org
Cc: malidp@foss.arm.com
Cc: David Airlie <airlied@linux.ie>
Cc: Daniel Vetter <daniel.vetter@ffwll.ch>
Cc: Ville Syrjälä <ville.syrjala@linux.intel.com>
Cc: Liviu Dudau <Liviu.Dudau@arm.com>
Cc: Sean Paul <seanpaul@chromium.org>
Acked-by: Liviu Dudau <Liviu.Dudau@arm.com>
Reviewed-by: Ville Syrjälä <ville.syrjala@linux.intel.com> (v1)
Signed-off-by: Joonas Lahtinen <joonas.lahtinen@linux.intel.com>
---
 drivers/gpu/drm/arm/malidp_drv.h                |  2 +-
 drivers/gpu/drm/arm/malidp_planes.c             | 20 +++++++++---------
 drivers/gpu/drm/armada/armada_overlay.c         |  2 +-
 drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_plane.c | 22 +++++++++----------
 drivers/gpu/drm/drm_atomic_helper.c             |  4 ++--
 drivers/gpu/drm/drm_crtc.c                      | 24 ++++++++++-----------
 drivers/gpu/drm/drm_fb_helper.c                 |  4 ++--
 drivers/gpu/drm/drm_plane_helper.c              |  2 +-
 drivers/gpu/drm/drm_rect.c                      | 28 ++++++++++++-------------
 drivers/gpu/drm/i915/i915_debugfs.c             | 12 +++++------
 drivers/gpu/drm/i915/intel_atomic_plane.c       |  2 +-
 drivers/gpu/drm/i915/intel_display.c            | 28 ++++++++++++-------------
 drivers/gpu/drm/i915/intel_drv.h                |  2 +-
 drivers/gpu/drm/i915/intel_fbc.c                |  2 +-
 drivers/gpu/drm/i915/intel_fbdev.c              |  6 +++---
 drivers/gpu/drm/i915/intel_sprite.c             |  6 +++---
 drivers/gpu/drm/msm/mdp/mdp5/mdp5_plane.c       | 10 ++++-----
 drivers/gpu/drm/omapdrm/omap_drv.c              |  6 +++---
 drivers/gpu/drm/omapdrm/omap_fb.c               | 14 ++++++-------
 drivers/gpu/drm/omapdrm/omap_plane.c            | 10 ++++-----
 include/drm/drm_crtc.h                          | 17 ++++++++-------
 21 files changed, 112 insertions(+), 111 deletions(-)

diff --git a/drivers/gpu/drm/arm/malidp_drv.h b/drivers/gpu/drm/arm/malidp_drv.h
index 95558fd..271d2fb 100644
--- a/drivers/gpu/drm/arm/malidp_drv.h
+++ b/drivers/gpu/drm/arm/malidp_drv.h
@@ -49,6 +49,6 @@ void malidp_de_planes_destroy(struct drm_device *drm);
 int malidp_crtc_init(struct drm_device *drm);
 
 /* often used combination of rotational bits */
-#define MALIDP_ROTATED_MASK	(BIT(DRM_ROTATE_90) | BIT(DRM_ROTATE_270))
+#define MALIDP_ROTATED_MASK	(DRM_ROTATE_90 | DRM_ROTATE_270)
 
 #endif  /* __MALIDP_DRV_H__ */
diff --git a/drivers/gpu/drm/arm/malidp_planes.c b/drivers/gpu/drm/arm/malidp_planes.c
index 725098d..82c193e 100644
--- a/drivers/gpu/drm/arm/malidp_planes.c
+++ b/drivers/gpu/drm/arm/malidp_planes.c
@@ -108,7 +108,7 @@ static int malidp_de_plane_check(struct drm_plane *plane,
 		return -EINVAL;
 
 	/* packed RGB888 / BGR888 can't be rotated or flipped */
-	if (state->rotation != BIT(DRM_ROTATE_0) &&
+	if (state->rotation != DRM_ROTATE_0 &&
 	    (state->fb->pixel_format == DRM_FORMAT_RGB888 ||
 	     state->fb->pixel_format == DRM_FORMAT_BGR888))
 		return -EINVAL;
@@ -188,9 +188,9 @@ static void malidp_de_plane_update(struct drm_plane *plane,
 	/* setup the rotation and axis flip bits */
 	if (plane->state->rotation & DRM_ROTATE_MASK)
 		val = ilog2(plane->state->rotation & DRM_ROTATE_MASK) << LAYER_ROT_OFFSET;
-	if (plane->state->rotation & BIT(DRM_REFLECT_X))
+	if (plane->state->rotation & DRM_REFLECT_X)
 		val |= LAYER_V_FLIP;
-	if (plane->state->rotation & BIT(DRM_REFLECT_Y))
+	if (plane->state->rotation & DRM_REFLECT_Y)
 		val |= LAYER_H_FLIP;
 
 	/* set the 'enable layer' bit */
@@ -255,12 +255,12 @@ int malidp_de_planes_init(struct drm_device *drm)
 			goto cleanup;
 
 		if (!drm->mode_config.rotation_property) {
-			unsigned long flags = BIT(DRM_ROTATE_0) |
-					      BIT(DRM_ROTATE_90) |
-					      BIT(DRM_ROTATE_180) |
-					      BIT(DRM_ROTATE_270) |
-					      BIT(DRM_REFLECT_X) |
-					      BIT(DRM_REFLECT_Y);
+			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);
 		}
@@ -268,7 +268,7 @@ int malidp_de_planes_init(struct drm_device *drm)
 		if (drm->mode_config.rotation_property && (id != DE_SMART))
 			drm_object_attach_property(&plane->base.base,
 						   drm->mode_config.rotation_property,
-						   BIT(DRM_ROTATE_0));
+						   DRM_ROTATE_0);
 
 		drm_plane_helper_add(&plane->base,
 				     &malidp_de_plane_helper_funcs);
diff --git a/drivers/gpu/drm/armada/armada_overlay.c b/drivers/gpu/drm/armada/armada_overlay.c
index 1ee707e..152b4e7 100644
--- a/drivers/gpu/drm/armada/armada_overlay.c
+++ b/drivers/gpu/drm/armada/armada_overlay.c
@@ -121,7 +121,7 @@ armada_ovl_plane_update(struct drm_plane *plane, struct drm_crtc *crtc,
 	int ret;
 
 	ret = drm_plane_helper_check_update(plane, crtc, fb, &src, &dest, &clip,
-					    BIT(DRM_ROTATE_0),
+					    DRM_ROTATE_0,
 					    0, INT_MAX, true, false, &visible);
 	if (ret)
 		return ret;
diff --git a/drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_plane.c b/drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_plane.c
index 016c191..146809a 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 & (BIT(DRM_ROTATE_90) | BIT(DRM_ROTATE_270))))
+	    (state->base.rotation & (DRM_ROTATE_90 | DRM_ROTATE_270)))
 		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 & (BIT(DRM_ROTATE_90) | BIT(DRM_ROTATE_270))) {
+	if (state->base.rotation & (DRM_ROTATE_90 | DRM_ROTATE_270)) {
 		tmp = state->crtc_w;
 		state->crtc_w = state->crtc_h;
 		state->crtc_h = tmp;
@@ -677,7 +677,7 @@ static int atmel_hlcdc_plane_atomic_check(struct drm_plane *p,
 			return -EINVAL;
 
 		switch (state->base.rotation & DRM_ROTATE_MASK) {
-		case BIT(DRM_ROTATE_90):
+		case DRM_ROTATE_90:
 			offset = ((y_offset + state->src_y + patched_src_w - 1) /
 				  ydiv) * fb->pitches[i];
 			offset += ((x_offset + state->src_x) / xdiv) *
@@ -686,7 +686,7 @@ static int atmel_hlcdc_plane_atomic_check(struct drm_plane *p,
 					  fb->pitches[i];
 			state->pstride[i] = -fb->pitches[i] - state->bpp[i];
 			break;
-		case BIT(DRM_ROTATE_180):
+		case DRM_ROTATE_180:
 			offset = ((y_offset + state->src_y + patched_src_h - 1) /
 				  ydiv) * fb->pitches[i];
 			offset += ((x_offset + state->src_x + patched_src_w - 1) /
@@ -695,7 +695,7 @@ static int atmel_hlcdc_plane_atomic_check(struct drm_plane *p,
 					   state->bpp[i]) - fb->pitches[i];
 			state->pstride[i] = -2 * state->bpp[i];
 			break;
-		case BIT(DRM_ROTATE_270):
+		case DRM_ROTATE_270:
 			offset = ((y_offset + state->src_y) / ydiv) *
 				 fb->pitches[i];
 			offset += ((x_offset + state->src_x + patched_src_h - 1) /
@@ -705,7 +705,7 @@ static int atmel_hlcdc_plane_atomic_check(struct drm_plane *p,
 					  (2 * state->bpp[i]);
 			state->pstride[i] = fb->pitches[i] - state->bpp[i];
 			break;
-		case BIT(DRM_ROTATE_0):
+		case DRM_ROTATE_0:
 		default:
 			offset = ((y_offset + state->src_y) / ydiv) *
 				 fb->pitches[i];
@@ -905,7 +905,7 @@ static void atmel_hlcdc_plane_init_properties(struct atmel_hlcdc_plane *plane,
 	if (desc->layout.xstride && desc->layout.pstride)
 		drm_object_attach_property(&plane->base.base,
 				plane->base.dev->mode_config.rotation_property,
-				BIT(DRM_ROTATE_0));
+				DRM_ROTATE_0);
 
 	if (desc->layout.csc) {
 		/*
@@ -1056,10 +1056,10 @@ atmel_hlcdc_plane_create_properties(struct drm_device *dev)
 
 	dev->mode_config.rotation_property =
 			drm_mode_create_rotation_property(dev,
-							  BIT(DRM_ROTATE_0) |
-							  BIT(DRM_ROTATE_90) |
-							  BIT(DRM_ROTATE_180) |
-							  BIT(DRM_ROTATE_270));
+							  DRM_ROTATE_0 |
+							  DRM_ROTATE_90 |
+							  DRM_ROTATE_180 |
+							  DRM_ROTATE_270);
 	if (!dev->mode_config.rotation_property)
 		return ERR_PTR(-ENOMEM);
 
diff --git a/drivers/gpu/drm/drm_atomic_helper.c b/drivers/gpu/drm/drm_atomic_helper.c
index de7fddc..61afd85 100644
--- a/drivers/gpu/drm/drm_atomic_helper.c
+++ b/drivers/gpu/drm/drm_atomic_helper.c
@@ -2348,7 +2348,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 & (BIT(DRM_ROTATE_90) | BIT(DRM_ROTATE_270))) {
+	if (primary_state->rotation & (DRM_ROTATE_90 | DRM_ROTATE_270)) {
 		primary_state->src_w = vdisplay << 16;
 		primary_state->src_h = hdisplay << 16;
 	} else {
@@ -3032,7 +3032,7 @@ void drm_atomic_helper_plane_reset(struct drm_plane *plane)
 
 	if (plane->state) {
 		plane->state->plane = plane;
-		plane->state->rotation = BIT(DRM_ROTATE_0);
+		plane->state->rotation = DRM_ROTATE_0;
 	}
 }
 EXPORT_SYMBOL(drm_atomic_helper_plane_reset);
diff --git a/drivers/gpu/drm/drm_crtc.c b/drivers/gpu/drm/drm_crtc.c
index f1d9f05..909a025 100644
--- a/drivers/gpu/drm/drm_crtc.c
+++ b/drivers/gpu/drm/drm_crtc.c
@@ -2804,8 +2804,8 @@ 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 & (BIT(DRM_ROTATE_90) |
-					      BIT(DRM_ROTATE_270)))
+	    crtc->primary->state->rotation & (DRM_ROTATE_90 |
+					      DRM_ROTATE_270))
 		swap(hdisplay, vdisplay);
 
 	return check_src_coords(x << 16, y << 16,
@@ -5646,9 +5646,9 @@ int drm_mode_destroy_dumb_ioctl(struct drm_device *dev,
  * Eg. if the hardware supports everything except DRM_REFLECT_X
  * one could call this function like this:
  *
- * drm_rotation_simplify(rotation, BIT(DRM_ROTATE_0) |
- *                       BIT(DRM_ROTATE_90) | BIT(DRM_ROTATE_180) |
- *                       BIT(DRM_ROTATE_270) | BIT(DRM_REFLECT_Y));
+ * drm_rotation_simplify(rotation, DRM_ROTATE_0 |
+ *                       DRM_ROTATE_90 | DRM_ROTATE_180 |
+ *                       DRM_ROTATE_270 | DRM_REFLECT_Y);
  *
  * to eliminate the DRM_ROTATE_X flag. Depending on what kind of
  * transforms the hardware supports, this function may not
@@ -5659,7 +5659,7 @@ unsigned int drm_rotation_simplify(unsigned int rotation,
 				   unsigned int supported_rotations)
 {
 	if (rotation & ~supported_rotations) {
-		rotation ^= BIT(DRM_REFLECT_X) | BIT(DRM_REFLECT_Y);
+		rotation ^= DRM_REFLECT_X | DRM_REFLECT_Y;
 		rotation = (rotation & DRM_REFLECT_MASK) |
 		           BIT((ffs(rotation & DRM_ROTATE_MASK) + 1) % 4);
 	}
@@ -5788,12 +5788,12 @@ struct drm_property *drm_mode_create_rotation_property(struct drm_device *dev,
 						       unsigned int supported_rotations)
 {
 	static const struct drm_prop_enum_list props[] = {
-		{ DRM_ROTATE_0,   "rotate-0" },
-		{ DRM_ROTATE_90,  "rotate-90" },
-		{ DRM_ROTATE_180, "rotate-180" },
-		{ DRM_ROTATE_270, "rotate-270" },
-		{ DRM_REFLECT_X,  "reflect-x" },
-		{ DRM_REFLECT_Y,  "reflect-y" },
+		{ __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",
diff --git a/drivers/gpu/drm/drm_fb_helper.c b/drivers/gpu/drm/drm_fb_helper.c
index ce54e98..d4896f9 100644
--- a/drivers/gpu/drm/drm_fb_helper.c
+++ b/drivers/gpu/drm/drm_fb_helper.c
@@ -335,7 +335,7 @@ retry:
 			goto fail;
 		}
 
-		plane_state->rotation = BIT(DRM_ROTATE_0);
+		plane_state->rotation = DRM_ROTATE_0;
 
 		plane->old_fb = plane->fb;
 		plane_mask |= 1 << drm_plane_index(plane);
@@ -395,7 +395,7 @@ static int restore_fbdev_mode(struct drm_fb_helper *fb_helper)
 		if (dev->mode_config.rotation_property) {
 			drm_mode_plane_set_obj_prop(plane,
 						    dev->mode_config.rotation_property,
-						    BIT(DRM_ROTATE_0));
+						    DRM_ROTATE_0);
 		}
 	}
 
diff --git a/drivers/gpu/drm/drm_plane_helper.c b/drivers/gpu/drm/drm_plane_helper.c
index 16c4a7b..c360e30 100644
--- a/drivers/gpu/drm/drm_plane_helper.c
+++ b/drivers/gpu/drm/drm_plane_helper.c
@@ -274,7 +274,7 @@ int drm_primary_helper_update(struct drm_plane *plane, struct drm_crtc *crtc,
 
 	ret = drm_plane_helper_check_update(plane, crtc, fb,
 					    &src, &dest, &clip,
-					    BIT(DRM_ROTATE_0),
+					    DRM_ROTATE_0,
 					    DRM_PLANE_HELPER_NO_SCALING,
 					    DRM_PLANE_HELPER_NO_SCALING,
 					    false, false, &visible);
diff --git a/drivers/gpu/drm/drm_rect.c b/drivers/gpu/drm/drm_rect.c
index a8e2c86..4063f6e 100644
--- a/drivers/gpu/drm/drm_rect.c
+++ b/drivers/gpu/drm/drm_rect.c
@@ -317,38 +317,38 @@ void drm_rect_rotate(struct drm_rect *r,
 {
 	struct drm_rect tmp;
 
-	if (rotation & (BIT(DRM_REFLECT_X) | BIT(DRM_REFLECT_Y))) {
+	if (rotation & (DRM_REFLECT_X | DRM_REFLECT_Y)) {
 		tmp = *r;
 
-		if (rotation & BIT(DRM_REFLECT_X)) {
+		if (rotation & DRM_REFLECT_X) {
 			r->x1 = width - tmp.x2;
 			r->x2 = width - tmp.x1;
 		}
 
-		if (rotation & BIT(DRM_REFLECT_Y)) {
+		if (rotation & DRM_REFLECT_Y) {
 			r->y1 = height - tmp.y2;
 			r->y2 = height - tmp.y1;
 		}
 	}
 
 	switch (rotation & DRM_ROTATE_MASK) {
-	case BIT(DRM_ROTATE_0):
+	case DRM_ROTATE_0:
 		break;
-	case BIT(DRM_ROTATE_90):
+	case DRM_ROTATE_90:
 		tmp = *r;
 		r->x1 = tmp.y1;
 		r->x2 = tmp.y2;
 		r->y1 = width - tmp.x2;
 		r->y2 = width - tmp.x1;
 		break;
-	case BIT(DRM_ROTATE_180):
+	case DRM_ROTATE_180:
 		tmp = *r;
 		r->x1 = width - tmp.x2;
 		r->x2 = width - tmp.x1;
 		r->y1 = height - tmp.y2;
 		r->y2 = height - tmp.y1;
 		break;
-	case BIT(DRM_ROTATE_270):
+	case DRM_ROTATE_270:
 		tmp = *r;
 		r->x1 = height - tmp.y2;
 		r->x2 = height - tmp.y1;
@@ -392,23 +392,23 @@ void drm_rect_rotate_inv(struct drm_rect *r,
 	struct drm_rect tmp;
 
 	switch (rotation & DRM_ROTATE_MASK) {
-	case BIT(DRM_ROTATE_0):
+	case DRM_ROTATE_0:
 		break;
-	case BIT(DRM_ROTATE_90):
+	case DRM_ROTATE_90:
 		tmp = *r;
 		r->x1 = width - tmp.y2;
 		r->x2 = width - tmp.y1;
 		r->y1 = tmp.x1;
 		r->y2 = tmp.x2;
 		break;
-	case BIT(DRM_ROTATE_180):
+	case DRM_ROTATE_180:
 		tmp = *r;
 		r->x1 = width - tmp.x2;
 		r->x2 = width - tmp.x1;
 		r->y1 = height - tmp.y2;
 		r->y2 = height - tmp.y1;
 		break;
-	case BIT(DRM_ROTATE_270):
+	case DRM_ROTATE_270:
 		tmp = *r;
 		r->x1 = tmp.y1;
 		r->x2 = tmp.y2;
@@ -419,15 +419,15 @@ void drm_rect_rotate_inv(struct drm_rect *r,
 		break;
 	}
 
-	if (rotation & (BIT(DRM_REFLECT_X) | BIT(DRM_REFLECT_Y))) {
+	if (rotation & (DRM_REFLECT_X | DRM_REFLECT_Y)) {
 		tmp = *r;
 
-		if (rotation & BIT(DRM_REFLECT_X)) {
+		if (rotation & DRM_REFLECT_X) {
 			r->x1 = width - tmp.x2;
 			r->x2 = width - tmp.x1;
 		}
 
-		if (rotation & BIT(DRM_REFLECT_Y)) {
+		if (rotation & DRM_REFLECT_Y) {
 			r->y1 = height - tmp.y2;
 			r->y2 = height - tmp.y1;
 		}
diff --git a/drivers/gpu/drm/i915/i915_debugfs.c b/drivers/gpu/drm/i915/i915_debugfs.c
index 9aa62c5..815232c 100644
--- a/drivers/gpu/drm/i915/i915_debugfs.c
+++ b/drivers/gpu/drm/i915/i915_debugfs.c
@@ -3081,12 +3081,12 @@ static const char *plane_rotation(unsigned int rotation)
 	 */
 	snprintf(buf, sizeof(buf),
 		 "%s%s%s%s%s%s(0x%08x)",
-		 (rotation & BIT(DRM_ROTATE_0)) ? "0 " : "",
-		 (rotation & BIT(DRM_ROTATE_90)) ? "90 " : "",
-		 (rotation & BIT(DRM_ROTATE_180)) ? "180 " : "",
-		 (rotation & BIT(DRM_ROTATE_270)) ? "270 " : "",
-		 (rotation & BIT(DRM_REFLECT_X)) ? "FLIPX " : "",
-		 (rotation & BIT(DRM_REFLECT_Y)) ? "FLIPY " : "",
+		 (rotation & DRM_ROTATE_0) ? "0 " : "",
+		 (rotation & DRM_ROTATE_90) ? "90 " : "",
+		 (rotation & DRM_ROTATE_180) ? "180 " : "",
+		 (rotation & DRM_ROTATE_270) ? "270 " : "",
+		 (rotation & DRM_REFLECT_X) ? "FLIPX " : "",
+		 (rotation & DRM_REFLECT_Y) ? "FLIPY " : "",
 		 rotation);
 
 	return buf;
diff --git a/drivers/gpu/drm/i915/intel_atomic_plane.c b/drivers/gpu/drm/i915/intel_atomic_plane.c
index 7de7721..7cc9c76 100644
--- a/drivers/gpu/drm/i915/intel_atomic_plane.c
+++ b/drivers/gpu/drm/i915/intel_atomic_plane.c
@@ -55,7 +55,7 @@ intel_create_plane_state(struct drm_plane *plane)
 		return NULL;
 
 	state->base.plane = plane;
-	state->base.rotation = BIT(DRM_ROTATE_0);
+	state->base.rotation = DRM_ROTATE_0;
 	state->ckey.flags = I915_SET_COLORKEY_NONE;
 
 	return state;
diff --git a/drivers/gpu/drm/i915/intel_display.c b/drivers/gpu/drm/i915/intel_display.c
index c4c1c85..9275b5d 100644
--- a/drivers/gpu/drm/i915/intel_display.c
+++ b/drivers/gpu/drm/i915/intel_display.c
@@ -2688,7 +2688,7 @@ static void i9xx_update_primary_plane(struct drm_plane *primary,
 		intel_crtc->dspaddr_offset = linear_offset;
 	}
 
-	if (rotation == BIT(DRM_ROTATE_180)) {
+	if (rotation == DRM_ROTATE_180) {
 		dspcntr |= DISPPLANE_ROTATE_180;
 
 		x += (crtc_state->pipe_src_w - 1);
@@ -2791,7 +2791,7 @@ static void ironlake_update_primary_plane(struct drm_plane *primary,
 		intel_compute_tile_offset(&x, &y, fb, 0,
 					  fb->pitches[0], rotation);
 	linear_offset -= intel_crtc->dspaddr_offset;
-	if (rotation == BIT(DRM_ROTATE_180)) {
+	if (rotation == DRM_ROTATE_180) {
 		dspcntr |= DISPPLANE_ROTATE_180;
 
 		if (!IS_HASWELL(dev) && !IS_BROADWELL(dev)) {
@@ -2952,17 +2952,17 @@ u32 skl_plane_ctl_tiling(uint64_t fb_modifier)
 u32 skl_plane_ctl_rotation(unsigned int rotation)
 {
 	switch (rotation) {
-	case BIT(DRM_ROTATE_0):
+	case DRM_ROTATE_0:
 		break;
 	/*
 	 * DRM_ROTATE_ is counter clockwise to stay compatible with Xrandr
 	 * while i915 HW rotation is clockwise, thats why this swapping.
 	 */
-	case BIT(DRM_ROTATE_90):
+	case DRM_ROTATE_90:
 		return PLANE_CTL_ROTATE_270;
-	case BIT(DRM_ROTATE_180):
+	case DRM_ROTATE_180:
 		return PLANE_CTL_ROTATE_180;
-	case BIT(DRM_ROTATE_270):
+	case DRM_ROTATE_270:
 		return PLANE_CTL_ROTATE_90;
 	default:
 		MISSING_CASE(rotation);
@@ -4248,7 +4248,7 @@ int skl_update_scaler_crtc(struct intel_crtc_state *state)
 		      intel_crtc->pipe, SKL_CRTC_INDEX);
 
 	return skl_update_scaler(state, !state->base.active, SKL_CRTC_INDEX,
-		&state->scaler_state.scaler_id, BIT(DRM_ROTATE_0),
+		&state->scaler_state.scaler_id, DRM_ROTATE_0,
 		state->pipe_src_w, state->pipe_src_h,
 		adjusted_mode->crtc_hdisplay, adjusted_mode->crtc_vdisplay);
 }
@@ -10255,7 +10255,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 == BIT(DRM_ROTATE_180))
+		if (plane_state->base.rotation == DRM_ROTATE_180)
 			cntl |= CURSOR_ROTATE_180;
 	}
 
@@ -10301,7 +10301,7 @@ static void intel_crtc_update_cursor(struct drm_crtc *crtc,
 
 		/* ILK+ do this automagically */
 		if (HAS_GMCH_DISPLAY(dev) &&
-		    plane_state->base.rotation == BIT(DRM_ROTATE_180)) {
+		    plane_state->base.rotation == DRM_ROTATE_180) {
 			base += (plane_state->base.crtc_h *
 				 plane_state->base.crtc_w - 1) * 4;
 		}
@@ -14296,11 +14296,11 @@ fail:
 void intel_create_rotation_property(struct drm_device *dev, struct intel_plane *plane)
 {
 	if (!dev->mode_config.rotation_property) {
-		unsigned long flags = BIT(DRM_ROTATE_0) |
-			BIT(DRM_ROTATE_180);
+		unsigned long flags = DRM_ROTATE_0 |
+			DRM_ROTATE_180;
 
 		if (INTEL_INFO(dev)->gen >= 9)
-			flags |= BIT(DRM_ROTATE_90) | BIT(DRM_ROTATE_270);
+			flags |= DRM_ROTATE_90 | DRM_ROTATE_270;
 
 		dev->mode_config.rotation_property =
 			drm_mode_create_rotation_property(dev, flags);
@@ -14443,8 +14443,8 @@ static struct drm_plane *intel_cursor_plane_create(struct drm_device *dev,
 		if (!dev->mode_config.rotation_property)
 			dev->mode_config.rotation_property =
 				drm_mode_create_rotation_property(dev,
-							BIT(DRM_ROTATE_0) |
-							BIT(DRM_ROTATE_180));
+							DRM_ROTATE_0 |
+							DRM_ROTATE_180);
 		if (dev->mode_config.rotation_property)
 			drm_object_attach_property(&cursor->base.base,
 				dev->mode_config.rotation_property,
diff --git a/drivers/gpu/drm/i915/intel_drv.h b/drivers/gpu/drm/i915/intel_drv.h
index e74d851..f82dcc5 100644
--- a/drivers/gpu/drm/i915/intel_drv.h
+++ b/drivers/gpu/drm/i915/intel_drv.h
@@ -1258,7 +1258,7 @@ unsigned int intel_tile_height(const struct drm_i915_private *dev_priv,
 static inline bool
 intel_rotation_90_or_270(unsigned int rotation)
 {
-	return rotation & (BIT(DRM_ROTATE_90) | BIT(DRM_ROTATE_270));
+	return rotation & (DRM_ROTATE_90 | DRM_ROTATE_270);
 }
 
 void intel_create_rotation_property(struct drm_device *dev,
diff --git a/drivers/gpu/drm/i915/intel_fbc.c b/drivers/gpu/drm/i915/intel_fbc.c
index 781e2f5..eff26d7 100644
--- a/drivers/gpu/drm/i915/intel_fbc.c
+++ b/drivers/gpu/drm/i915/intel_fbc.c
@@ -775,7 +775,7 @@ static bool intel_fbc_can_activate(struct intel_crtc *crtc)
 		return false;
 	}
 	if (INTEL_INFO(dev_priv)->gen <= 4 && !IS_G4X(dev_priv) &&
-	    cache->plane.rotation != BIT(DRM_ROTATE_0)) {
+	    cache->plane.rotation != DRM_ROTATE_0) {
 		fbc->no_fbc_reason = "rotation unsupported";
 		return false;
 	}
diff --git a/drivers/gpu/drm/i915/intel_fbdev.c b/drivers/gpu/drm/i915/intel_fbdev.c
index 6344999..4fee93d 100644
--- a/drivers/gpu/drm/i915/intel_fbdev.c
+++ b/drivers/gpu/drm/i915/intel_fbdev.c
@@ -223,7 +223,7 @@ static int intelfb_create(struct drm_fb_helper *helper,
 	 * This also validates that any existing fb inherited from the
 	 * BIOS is suitable for own access.
 	 */
-	ret = intel_pin_and_fence_fb_obj(&ifbdev->fb->base, BIT(DRM_ROTATE_0));
+	ret = intel_pin_and_fence_fb_obj(&ifbdev->fb->base, DRM_ROTATE_0);
 	if (ret)
 		goto out_unlock;
 
@@ -289,7 +289,7 @@ static int intelfb_create(struct drm_fb_helper *helper,
 out_destroy_fbi:
 	drm_fb_helper_release_fbi(helper);
 out_unpin:
-	intel_unpin_fb_obj(&ifbdev->fb->base, BIT(DRM_ROTATE_0));
+	intel_unpin_fb_obj(&ifbdev->fb->base, DRM_ROTATE_0);
 out_unlock:
 	mutex_unlock(&dev->struct_mutex);
 	return ret;
@@ -554,7 +554,7 @@ static void intel_fbdev_destroy(struct intel_fbdev *ifbdev)
 
 	if (ifbdev->fb) {
 		mutex_lock(&ifbdev->helper.dev->struct_mutex);
-		intel_unpin_fb_obj(&ifbdev->fb->base, BIT(DRM_ROTATE_0));
+		intel_unpin_fb_obj(&ifbdev->fb->base, DRM_ROTATE_0);
 		mutex_unlock(&ifbdev->helper.dev->struct_mutex);
 
 		drm_framebuffer_remove(&ifbdev->fb->base);
diff --git a/drivers/gpu/drm/i915/intel_sprite.c b/drivers/gpu/drm/i915/intel_sprite.c
index 0de935a..22ae2298 100644
--- a/drivers/gpu/drm/i915/intel_sprite.c
+++ b/drivers/gpu/drm/i915/intel_sprite.c
@@ -444,7 +444,7 @@ vlv_update_plane(struct drm_plane *dplane,
 						   fb->pitches[0], rotation);
 	linear_offset -= sprsurf_offset;
 
-	if (rotation == BIT(DRM_ROTATE_180)) {
+	if (rotation == DRM_ROTATE_180) {
 		sprctl |= SP_ROTATE_180;
 
 		x += src_w;
@@ -577,7 +577,7 @@ ivb_update_plane(struct drm_plane *plane,
 						   fb->pitches[0], rotation);
 	linear_offset -= sprsurf_offset;
 
-	if (rotation == BIT(DRM_ROTATE_180)) {
+	if (rotation == DRM_ROTATE_180) {
 		sprctl |= SPRITE_ROTATE_180;
 
 		/* HSW and BDW does this automagically in hardware */
@@ -714,7 +714,7 @@ ilk_update_plane(struct drm_plane *plane,
 						   fb->pitches[0], rotation);
 	linear_offset -= dvssurf_offset;
 
-	if (rotation == BIT(DRM_ROTATE_180)) {
+	if (rotation == DRM_ROTATE_180) {
 		dvscntr |= DVS_ROTATE_180;
 
 		x += src_w;
diff --git a/drivers/gpu/drm/msm/mdp/mdp5/mdp5_plane.c b/drivers/gpu/drm/msm/mdp/mdp5/mdp5_plane.c
index 432c098..a02a24e 100644
--- a/drivers/gpu/drm/msm/mdp/mdp5/mdp5_plane.c
+++ b/drivers/gpu/drm/msm/mdp/mdp5/mdp5_plane.c
@@ -78,7 +78,7 @@ 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,
-			BIT(DRM_REFLECT_X) | BIT(DRM_REFLECT_Y));
+			DRM_REFLECT_X | DRM_REFLECT_Y);
 
 	if (dev->mode_config.rotation_property)
 		drm_object_attach_property(&plane->base,
@@ -309,8 +309,8 @@ static int mdp5_plane_atomic_check(struct drm_plane *plane,
 			return -EINVAL;
 		}
 
-		hflip = !!(state->rotation & BIT(DRM_REFLECT_X));
-		vflip = !!(state->rotation & BIT(DRM_REFLECT_Y));
+		hflip = !!(state->rotation & DRM_REFLECT_X);
+		vflip = !!(state->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,
@@ -743,8 +743,8 @@ 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 & BIT(DRM_REFLECT_X));
-	vflip = !!(pstate->rotation & BIT(DRM_REFLECT_Y));
+	hflip = !!(pstate->rotation & DRM_REFLECT_X);
+	vflip = !!(pstate->rotation & DRM_REFLECT_Y);
 
 	spin_lock_irqsave(&mdp5_plane->pipe_lock, flags);
 
diff --git a/drivers/gpu/drm/omapdrm/omap_drv.c b/drivers/gpu/drm/omapdrm/omap_drv.c
index 26c6134..3dd78f2 100644
--- a/drivers/gpu/drm/omapdrm/omap_drv.c
+++ b/drivers/gpu/drm/omapdrm/omap_drv.c
@@ -295,9 +295,9 @@ static int omap_modeset_init_properties(struct drm_device *dev)
 	if (priv->has_dmm) {
 		dev->mode_config.rotation_property =
 			drm_mode_create_rotation_property(dev,
-				BIT(DRM_ROTATE_0) | BIT(DRM_ROTATE_90) |
-				BIT(DRM_ROTATE_180) | BIT(DRM_ROTATE_270) |
-				BIT(DRM_REFLECT_X) | BIT(DRM_REFLECT_Y));
+				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;
 	}
diff --git a/drivers/gpu/drm/omapdrm/omap_fb.c b/drivers/gpu/drm/omapdrm/omap_fb.c
index 31f5178..5f3337f 100644
--- a/drivers/gpu/drm/omapdrm/omap_fb.c
+++ b/drivers/gpu/drm/omapdrm/omap_fb.c
@@ -179,24 +179,24 @@ void omap_framebuffer_update_scanout(struct drm_framebuffer *fb,
 					(uint32_t)win->rotation);
 			/* fallthru to default to no rotation */
 		case 0:
-		case BIT(DRM_ROTATE_0):
+		case DRM_ROTATE_0:
 			orient = 0;
 			break;
-		case BIT(DRM_ROTATE_90):
+		case DRM_ROTATE_90:
 			orient = MASK_XY_FLIP | MASK_X_INVERT;
 			break;
-		case BIT(DRM_ROTATE_180):
+		case DRM_ROTATE_180:
 			orient = MASK_X_INVERT | MASK_Y_INVERT;
 			break;
-		case BIT(DRM_ROTATE_270):
+		case DRM_ROTATE_270:
 			orient = MASK_XY_FLIP | MASK_Y_INVERT;
 			break;
 		}
 
-		if (win->rotation & BIT(DRM_REFLECT_X))
+		if (win->rotation & DRM_REFLECT_X)
 			orient ^= MASK_X_INVERT;
 
-		if (win->rotation & BIT(DRM_REFLECT_Y))
+		if (win->rotation & DRM_REFLECT_Y)
 			orient ^= MASK_Y_INVERT;
 
 		/* adjust x,y offset for flip/invert: */
@@ -213,7 +213,7 @@ void omap_framebuffer_update_scanout(struct drm_framebuffer *fb,
 	} else {
 		switch (win->rotation & DRM_ROTATE_MASK) {
 		case 0:
-		case BIT(DRM_ROTATE_0):
+		case DRM_ROTATE_0:
 			/* OK */
 			break;
 
diff --git a/drivers/gpu/drm/omapdrm/omap_plane.c b/drivers/gpu/drm/omapdrm/omap_plane.c
index 5252ab7..4c7727e 100644
--- a/drivers/gpu/drm/omapdrm/omap_plane.c
+++ b/drivers/gpu/drm/omapdrm/omap_plane.c
@@ -109,8 +109,8 @@ static void omap_plane_atomic_update(struct drm_plane *plane,
 	win.src_y = state->src_y >> 16;
 
 	switch (state->rotation & DRM_ROTATE_MASK) {
-	case BIT(DRM_ROTATE_90):
-	case BIT(DRM_ROTATE_270):
+	case DRM_ROTATE_90:
+	case DRM_ROTATE_270:
 		win.src_w = state->src_h >> 16;
 		win.src_h = state->src_w >> 16;
 		break;
@@ -149,7 +149,7 @@ static void omap_plane_atomic_disable(struct drm_plane *plane,
 	struct omap_plane_state *omap_state = to_omap_plane_state(plane->state);
 	struct omap_plane *omap_plane = to_omap_plane(plane);
 
-	plane->state->rotation = BIT(DRM_ROTATE_0);
+	plane->state->rotation = DRM_ROTATE_0;
 	omap_state->zorder = plane->type == DRM_PLANE_TYPE_PRIMARY
 			   ? 0 : omap_plane->id;
 
@@ -178,7 +178,7 @@ static int omap_plane_atomic_check(struct drm_plane *plane,
 		return -EINVAL;
 
 	if (state->fb) {
-		if (state->rotation != BIT(DRM_ROTATE_0) &&
+		if (state->rotation != DRM_ROTATE_0 &&
 		    !omap_framebuffer_supports_rotation(state->fb))
 			return -EINVAL;
 	}
@@ -269,7 +269,7 @@ static void omap_plane_reset(struct drm_plane *plane)
 	 */
 	omap_state->zorder = plane->type == DRM_PLANE_TYPE_PRIMARY
 			   ? 0 : omap_plane->id;
-	omap_state->base.rotation = BIT(DRM_ROTATE_0);
+	omap_state->base.rotation = DRM_ROTATE_0;
 
 	plane->state = &omap_state->base;
 	plane->state->plane = plane;
diff --git a/include/drm/drm_crtc.h b/include/drm/drm_crtc.h
index 3edeaf8..448625d 100644
--- a/include/drm/drm_crtc.h
+++ b/include/drm/drm_crtc.h
@@ -83,14 +83,15 @@ static inline uint64_t I642U64(int64_t val)
  * specified amount in degrees in counter clockwise direction. DRM_REFLECT_X and
  * DRM_REFLECT_Y reflects the image along the specified axis prior to rotation
  */
-#define DRM_ROTATE_MASK 0x0f
-#define DRM_ROTATE_0	0
-#define DRM_ROTATE_90	1
-#define DRM_ROTATE_180	2
-#define DRM_ROTATE_270	3
-#define DRM_REFLECT_MASK (~DRM_ROTATE_MASK)
-#define DRM_REFLECT_X	4
-#define DRM_REFLECT_Y	5
+#define DRM_ROTATE_0	BIT(0)
+#define DRM_ROTATE_90	BIT(1)
+#define DRM_ROTATE_180	BIT(2)
+#define DRM_ROTATE_270	BIT(3)
+#define DRM_ROTATE_MASK (DRM_ROTATE_0   | DRM_ROTATE_90 | \
+			 DRM_ROTATE_180 | DRM_ROTATE_270)
+#define DRM_REFLECT_X	BIT(4)
+#define DRM_REFLECT_Y	BIT(5)
+#define DRM_REFLECT_MASK (DRM_REFLECT_X | DRM_REFLECT_Y)
 
 enum drm_connector_force {
 	DRM_FORCE_UNSPECIFIED,
-- 
2.5.5

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

* [PATCH v2] drm: BIT(DRM_ROTATE_?) -> DRM_ROTATE_?
  2016-07-28 14:04       ` Sean Paul
  2016-07-29  5:49         ` Joonas Lahtinen
@ 2016-07-29  5:50         ` Joonas Lahtinen
  2016-07-29 19:33           ` Sean Paul
  1 sibling, 1 reply; 14+ messages in thread
From: Joonas Lahtinen @ 2016-07-29  5:50 UTC (permalink / raw)
  To: Direct Rendering Infrastructure - Development
  Cc: Joonas Lahtinen, intel-gfx, linux-arm-msm, freedreno, malidp,
	David Airlie, Daniel Vetter, Ville Syrjälä,
	Liviu Dudau, Sean Paul

Only property creation uses the rotation as an index, so convert the
to figure the index when needed.

v2: Use the new defines to build the _MASK defines (Sean)

Cc: intel-gfx@lists.freedesktop.org
Cc: linux-arm-msm@vger.kernel.org
Cc: freedreno@lists.freedesktop.org
Cc: malidp@foss.arm.com
Cc: David Airlie <airlied@linux.ie>
Cc: Daniel Vetter <daniel.vetter@ffwll.ch>
Cc: Ville Syrjälä <ville.syrjala@linux.intel.com>
Cc: Liviu Dudau <Liviu.Dudau@arm.com>
Cc: Sean Paul <seanpaul@chromium.org>
Acked-by: Liviu Dudau <Liviu.Dudau@arm.com>
Reviewed-by: Ville Syrjälä <ville.syrjala@linux.intel.com> (v1)
Signed-off-by: Joonas Lahtinen <joonas.lahtinen@linux.intel.com>
---
 drivers/gpu/drm/arm/malidp_drv.h                |  2 +-
 drivers/gpu/drm/arm/malidp_planes.c             | 20 +++++++++---------
 drivers/gpu/drm/armada/armada_overlay.c         |  2 +-
 drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_plane.c | 22 +++++++++----------
 drivers/gpu/drm/drm_atomic_helper.c             |  4 ++--
 drivers/gpu/drm/drm_crtc.c                      | 24 ++++++++++-----------
 drivers/gpu/drm/drm_fb_helper.c                 |  4 ++--
 drivers/gpu/drm/drm_plane_helper.c              |  2 +-
 drivers/gpu/drm/drm_rect.c                      | 28 ++++++++++++-------------
 drivers/gpu/drm/i915/i915_debugfs.c             | 12 +++++------
 drivers/gpu/drm/i915/intel_atomic_plane.c       |  2 +-
 drivers/gpu/drm/i915/intel_display.c            | 28 ++++++++++++-------------
 drivers/gpu/drm/i915/intel_drv.h                |  2 +-
 drivers/gpu/drm/i915/intel_fbc.c                |  2 +-
 drivers/gpu/drm/i915/intel_fbdev.c              |  6 +++---
 drivers/gpu/drm/i915/intel_sprite.c             |  6 +++---
 drivers/gpu/drm/msm/mdp/mdp5/mdp5_plane.c       | 10 ++++-----
 drivers/gpu/drm/omapdrm/omap_drv.c              |  6 +++---
 drivers/gpu/drm/omapdrm/omap_fb.c               | 14 ++++++-------
 drivers/gpu/drm/omapdrm/omap_plane.c            | 10 ++++-----
 include/drm/drm_crtc.h                          | 17 ++++++++-------
 21 files changed, 112 insertions(+), 111 deletions(-)

diff --git a/drivers/gpu/drm/arm/malidp_drv.h b/drivers/gpu/drm/arm/malidp_drv.h
index 95558fd..271d2fb 100644
--- a/drivers/gpu/drm/arm/malidp_drv.h
+++ b/drivers/gpu/drm/arm/malidp_drv.h
@@ -49,6 +49,6 @@ void malidp_de_planes_destroy(struct drm_device *drm);
 int malidp_crtc_init(struct drm_device *drm);
 
 /* often used combination of rotational bits */
-#define MALIDP_ROTATED_MASK	(BIT(DRM_ROTATE_90) | BIT(DRM_ROTATE_270))
+#define MALIDP_ROTATED_MASK	(DRM_ROTATE_90 | DRM_ROTATE_270)
 
 #endif  /* __MALIDP_DRV_H__ */
diff --git a/drivers/gpu/drm/arm/malidp_planes.c b/drivers/gpu/drm/arm/malidp_planes.c
index 725098d..82c193e 100644
--- a/drivers/gpu/drm/arm/malidp_planes.c
+++ b/drivers/gpu/drm/arm/malidp_planes.c
@@ -108,7 +108,7 @@ static int malidp_de_plane_check(struct drm_plane *plane,
 		return -EINVAL;
 
 	/* packed RGB888 / BGR888 can't be rotated or flipped */
-	if (state->rotation != BIT(DRM_ROTATE_0) &&
+	if (state->rotation != DRM_ROTATE_0 &&
 	    (state->fb->pixel_format == DRM_FORMAT_RGB888 ||
 	     state->fb->pixel_format == DRM_FORMAT_BGR888))
 		return -EINVAL;
@@ -188,9 +188,9 @@ static void malidp_de_plane_update(struct drm_plane *plane,
 	/* setup the rotation and axis flip bits */
 	if (plane->state->rotation & DRM_ROTATE_MASK)
 		val = ilog2(plane->state->rotation & DRM_ROTATE_MASK) << LAYER_ROT_OFFSET;
-	if (plane->state->rotation & BIT(DRM_REFLECT_X))
+	if (plane->state->rotation & DRM_REFLECT_X)
 		val |= LAYER_V_FLIP;
-	if (plane->state->rotation & BIT(DRM_REFLECT_Y))
+	if (plane->state->rotation & DRM_REFLECT_Y)
 		val |= LAYER_H_FLIP;
 
 	/* set the 'enable layer' bit */
@@ -255,12 +255,12 @@ int malidp_de_planes_init(struct drm_device *drm)
 			goto cleanup;
 
 		if (!drm->mode_config.rotation_property) {
-			unsigned long flags = BIT(DRM_ROTATE_0) |
-					      BIT(DRM_ROTATE_90) |
-					      BIT(DRM_ROTATE_180) |
-					      BIT(DRM_ROTATE_270) |
-					      BIT(DRM_REFLECT_X) |
-					      BIT(DRM_REFLECT_Y);
+			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);
 		}
@@ -268,7 +268,7 @@ int malidp_de_planes_init(struct drm_device *drm)
 		if (drm->mode_config.rotation_property && (id != DE_SMART))
 			drm_object_attach_property(&plane->base.base,
 						   drm->mode_config.rotation_property,
-						   BIT(DRM_ROTATE_0));
+						   DRM_ROTATE_0);
 
 		drm_plane_helper_add(&plane->base,
 				     &malidp_de_plane_helper_funcs);
diff --git a/drivers/gpu/drm/armada/armada_overlay.c b/drivers/gpu/drm/armada/armada_overlay.c
index 1ee707e..152b4e7 100644
--- a/drivers/gpu/drm/armada/armada_overlay.c
+++ b/drivers/gpu/drm/armada/armada_overlay.c
@@ -121,7 +121,7 @@ armada_ovl_plane_update(struct drm_plane *plane, struct drm_crtc *crtc,
 	int ret;
 
 	ret = drm_plane_helper_check_update(plane, crtc, fb, &src, &dest, &clip,
-					    BIT(DRM_ROTATE_0),
+					    DRM_ROTATE_0,
 					    0, INT_MAX, true, false, &visible);
 	if (ret)
 		return ret;
diff --git a/drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_plane.c b/drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_plane.c
index 016c191..146809a 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 & (BIT(DRM_ROTATE_90) | BIT(DRM_ROTATE_270))))
+	    (state->base.rotation & (DRM_ROTATE_90 | DRM_ROTATE_270)))
 		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 & (BIT(DRM_ROTATE_90) | BIT(DRM_ROTATE_270))) {
+	if (state->base.rotation & (DRM_ROTATE_90 | DRM_ROTATE_270)) {
 		tmp = state->crtc_w;
 		state->crtc_w = state->crtc_h;
 		state->crtc_h = tmp;
@@ -677,7 +677,7 @@ static int atmel_hlcdc_plane_atomic_check(struct drm_plane *p,
 			return -EINVAL;
 
 		switch (state->base.rotation & DRM_ROTATE_MASK) {
-		case BIT(DRM_ROTATE_90):
+		case DRM_ROTATE_90:
 			offset = ((y_offset + state->src_y + patched_src_w - 1) /
 				  ydiv) * fb->pitches[i];
 			offset += ((x_offset + state->src_x) / xdiv) *
@@ -686,7 +686,7 @@ static int atmel_hlcdc_plane_atomic_check(struct drm_plane *p,
 					  fb->pitches[i];
 			state->pstride[i] = -fb->pitches[i] - state->bpp[i];
 			break;
-		case BIT(DRM_ROTATE_180):
+		case DRM_ROTATE_180:
 			offset = ((y_offset + state->src_y + patched_src_h - 1) /
 				  ydiv) * fb->pitches[i];
 			offset += ((x_offset + state->src_x + patched_src_w - 1) /
@@ -695,7 +695,7 @@ static int atmel_hlcdc_plane_atomic_check(struct drm_plane *p,
 					   state->bpp[i]) - fb->pitches[i];
 			state->pstride[i] = -2 * state->bpp[i];
 			break;
-		case BIT(DRM_ROTATE_270):
+		case DRM_ROTATE_270:
 			offset = ((y_offset + state->src_y) / ydiv) *
 				 fb->pitches[i];
 			offset += ((x_offset + state->src_x + patched_src_h - 1) /
@@ -705,7 +705,7 @@ static int atmel_hlcdc_plane_atomic_check(struct drm_plane *p,
 					  (2 * state->bpp[i]);
 			state->pstride[i] = fb->pitches[i] - state->bpp[i];
 			break;
-		case BIT(DRM_ROTATE_0):
+		case DRM_ROTATE_0:
 		default:
 			offset = ((y_offset + state->src_y) / ydiv) *
 				 fb->pitches[i];
@@ -905,7 +905,7 @@ static void atmel_hlcdc_plane_init_properties(struct atmel_hlcdc_plane *plane,
 	if (desc->layout.xstride && desc->layout.pstride)
 		drm_object_attach_property(&plane->base.base,
 				plane->base.dev->mode_config.rotation_property,
-				BIT(DRM_ROTATE_0));
+				DRM_ROTATE_0);
 
 	if (desc->layout.csc) {
 		/*
@@ -1056,10 +1056,10 @@ atmel_hlcdc_plane_create_properties(struct drm_device *dev)
 
 	dev->mode_config.rotation_property =
 			drm_mode_create_rotation_property(dev,
-							  BIT(DRM_ROTATE_0) |
-							  BIT(DRM_ROTATE_90) |
-							  BIT(DRM_ROTATE_180) |
-							  BIT(DRM_ROTATE_270));
+							  DRM_ROTATE_0 |
+							  DRM_ROTATE_90 |
+							  DRM_ROTATE_180 |
+							  DRM_ROTATE_270);
 	if (!dev->mode_config.rotation_property)
 		return ERR_PTR(-ENOMEM);
 
diff --git a/drivers/gpu/drm/drm_atomic_helper.c b/drivers/gpu/drm/drm_atomic_helper.c
index de7fddc..61afd85 100644
--- a/drivers/gpu/drm/drm_atomic_helper.c
+++ b/drivers/gpu/drm/drm_atomic_helper.c
@@ -2348,7 +2348,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 & (BIT(DRM_ROTATE_90) | BIT(DRM_ROTATE_270))) {
+	if (primary_state->rotation & (DRM_ROTATE_90 | DRM_ROTATE_270)) {
 		primary_state->src_w = vdisplay << 16;
 		primary_state->src_h = hdisplay << 16;
 	} else {
@@ -3032,7 +3032,7 @@ void drm_atomic_helper_plane_reset(struct drm_plane *plane)
 
 	if (plane->state) {
 		plane->state->plane = plane;
-		plane->state->rotation = BIT(DRM_ROTATE_0);
+		plane->state->rotation = DRM_ROTATE_0;
 	}
 }
 EXPORT_SYMBOL(drm_atomic_helper_plane_reset);
diff --git a/drivers/gpu/drm/drm_crtc.c b/drivers/gpu/drm/drm_crtc.c
index f1d9f05..909a025 100644
--- a/drivers/gpu/drm/drm_crtc.c
+++ b/drivers/gpu/drm/drm_crtc.c
@@ -2804,8 +2804,8 @@ 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 & (BIT(DRM_ROTATE_90) |
-					      BIT(DRM_ROTATE_270)))
+	    crtc->primary->state->rotation & (DRM_ROTATE_90 |
+					      DRM_ROTATE_270))
 		swap(hdisplay, vdisplay);
 
 	return check_src_coords(x << 16, y << 16,
@@ -5646,9 +5646,9 @@ int drm_mode_destroy_dumb_ioctl(struct drm_device *dev,
  * Eg. if the hardware supports everything except DRM_REFLECT_X
  * one could call this function like this:
  *
- * drm_rotation_simplify(rotation, BIT(DRM_ROTATE_0) |
- *                       BIT(DRM_ROTATE_90) | BIT(DRM_ROTATE_180) |
- *                       BIT(DRM_ROTATE_270) | BIT(DRM_REFLECT_Y));
+ * drm_rotation_simplify(rotation, DRM_ROTATE_0 |
+ *                       DRM_ROTATE_90 | DRM_ROTATE_180 |
+ *                       DRM_ROTATE_270 | DRM_REFLECT_Y);
  *
  * to eliminate the DRM_ROTATE_X flag. Depending on what kind of
  * transforms the hardware supports, this function may not
@@ -5659,7 +5659,7 @@ unsigned int drm_rotation_simplify(unsigned int rotation,
 				   unsigned int supported_rotations)
 {
 	if (rotation & ~supported_rotations) {
-		rotation ^= BIT(DRM_REFLECT_X) | BIT(DRM_REFLECT_Y);
+		rotation ^= DRM_REFLECT_X | DRM_REFLECT_Y;
 		rotation = (rotation & DRM_REFLECT_MASK) |
 		           BIT((ffs(rotation & DRM_ROTATE_MASK) + 1) % 4);
 	}
@@ -5788,12 +5788,12 @@ struct drm_property *drm_mode_create_rotation_property(struct drm_device *dev,
 						       unsigned int supported_rotations)
 {
 	static const struct drm_prop_enum_list props[] = {
-		{ DRM_ROTATE_0,   "rotate-0" },
-		{ DRM_ROTATE_90,  "rotate-90" },
-		{ DRM_ROTATE_180, "rotate-180" },
-		{ DRM_ROTATE_270, "rotate-270" },
-		{ DRM_REFLECT_X,  "reflect-x" },
-		{ DRM_REFLECT_Y,  "reflect-y" },
+		{ __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",
diff --git a/drivers/gpu/drm/drm_fb_helper.c b/drivers/gpu/drm/drm_fb_helper.c
index ce54e98..d4896f9 100644
--- a/drivers/gpu/drm/drm_fb_helper.c
+++ b/drivers/gpu/drm/drm_fb_helper.c
@@ -335,7 +335,7 @@ retry:
 			goto fail;
 		}
 
-		plane_state->rotation = BIT(DRM_ROTATE_0);
+		plane_state->rotation = DRM_ROTATE_0;
 
 		plane->old_fb = plane->fb;
 		plane_mask |= 1 << drm_plane_index(plane);
@@ -395,7 +395,7 @@ static int restore_fbdev_mode(struct drm_fb_helper *fb_helper)
 		if (dev->mode_config.rotation_property) {
 			drm_mode_plane_set_obj_prop(plane,
 						    dev->mode_config.rotation_property,
-						    BIT(DRM_ROTATE_0));
+						    DRM_ROTATE_0);
 		}
 	}
 
diff --git a/drivers/gpu/drm/drm_plane_helper.c b/drivers/gpu/drm/drm_plane_helper.c
index 16c4a7b..c360e30 100644
--- a/drivers/gpu/drm/drm_plane_helper.c
+++ b/drivers/gpu/drm/drm_plane_helper.c
@@ -274,7 +274,7 @@ int drm_primary_helper_update(struct drm_plane *plane, struct drm_crtc *crtc,
 
 	ret = drm_plane_helper_check_update(plane, crtc, fb,
 					    &src, &dest, &clip,
-					    BIT(DRM_ROTATE_0),
+					    DRM_ROTATE_0,
 					    DRM_PLANE_HELPER_NO_SCALING,
 					    DRM_PLANE_HELPER_NO_SCALING,
 					    false, false, &visible);
diff --git a/drivers/gpu/drm/drm_rect.c b/drivers/gpu/drm/drm_rect.c
index a8e2c86..4063f6e 100644
--- a/drivers/gpu/drm/drm_rect.c
+++ b/drivers/gpu/drm/drm_rect.c
@@ -317,38 +317,38 @@ void drm_rect_rotate(struct drm_rect *r,
 {
 	struct drm_rect tmp;
 
-	if (rotation & (BIT(DRM_REFLECT_X) | BIT(DRM_REFLECT_Y))) {
+	if (rotation & (DRM_REFLECT_X | DRM_REFLECT_Y)) {
 		tmp = *r;
 
-		if (rotation & BIT(DRM_REFLECT_X)) {
+		if (rotation & DRM_REFLECT_X) {
 			r->x1 = width - tmp.x2;
 			r->x2 = width - tmp.x1;
 		}
 
-		if (rotation & BIT(DRM_REFLECT_Y)) {
+		if (rotation & DRM_REFLECT_Y) {
 			r->y1 = height - tmp.y2;
 			r->y2 = height - tmp.y1;
 		}
 	}
 
 	switch (rotation & DRM_ROTATE_MASK) {
-	case BIT(DRM_ROTATE_0):
+	case DRM_ROTATE_0:
 		break;
-	case BIT(DRM_ROTATE_90):
+	case DRM_ROTATE_90:
 		tmp = *r;
 		r->x1 = tmp.y1;
 		r->x2 = tmp.y2;
 		r->y1 = width - tmp.x2;
 		r->y2 = width - tmp.x1;
 		break;
-	case BIT(DRM_ROTATE_180):
+	case DRM_ROTATE_180:
 		tmp = *r;
 		r->x1 = width - tmp.x2;
 		r->x2 = width - tmp.x1;
 		r->y1 = height - tmp.y2;
 		r->y2 = height - tmp.y1;
 		break;
-	case BIT(DRM_ROTATE_270):
+	case DRM_ROTATE_270:
 		tmp = *r;
 		r->x1 = height - tmp.y2;
 		r->x2 = height - tmp.y1;
@@ -392,23 +392,23 @@ void drm_rect_rotate_inv(struct drm_rect *r,
 	struct drm_rect tmp;
 
 	switch (rotation & DRM_ROTATE_MASK) {
-	case BIT(DRM_ROTATE_0):
+	case DRM_ROTATE_0:
 		break;
-	case BIT(DRM_ROTATE_90):
+	case DRM_ROTATE_90:
 		tmp = *r;
 		r->x1 = width - tmp.y2;
 		r->x2 = width - tmp.y1;
 		r->y1 = tmp.x1;
 		r->y2 = tmp.x2;
 		break;
-	case BIT(DRM_ROTATE_180):
+	case DRM_ROTATE_180:
 		tmp = *r;
 		r->x1 = width - tmp.x2;
 		r->x2 = width - tmp.x1;
 		r->y1 = height - tmp.y2;
 		r->y2 = height - tmp.y1;
 		break;
-	case BIT(DRM_ROTATE_270):
+	case DRM_ROTATE_270:
 		tmp = *r;
 		r->x1 = tmp.y1;
 		r->x2 = tmp.y2;
@@ -419,15 +419,15 @@ void drm_rect_rotate_inv(struct drm_rect *r,
 		break;
 	}
 
-	if (rotation & (BIT(DRM_REFLECT_X) | BIT(DRM_REFLECT_Y))) {
+	if (rotation & (DRM_REFLECT_X | DRM_REFLECT_Y)) {
 		tmp = *r;
 
-		if (rotation & BIT(DRM_REFLECT_X)) {
+		if (rotation & DRM_REFLECT_X) {
 			r->x1 = width - tmp.x2;
 			r->x2 = width - tmp.x1;
 		}
 
-		if (rotation & BIT(DRM_REFLECT_Y)) {
+		if (rotation & DRM_REFLECT_Y) {
 			r->y1 = height - tmp.y2;
 			r->y2 = height - tmp.y1;
 		}
diff --git a/drivers/gpu/drm/i915/i915_debugfs.c b/drivers/gpu/drm/i915/i915_debugfs.c
index 9aa62c5..815232c 100644
--- a/drivers/gpu/drm/i915/i915_debugfs.c
+++ b/drivers/gpu/drm/i915/i915_debugfs.c
@@ -3081,12 +3081,12 @@ static const char *plane_rotation(unsigned int rotation)
 	 */
 	snprintf(buf, sizeof(buf),
 		 "%s%s%s%s%s%s(0x%08x)",
-		 (rotation & BIT(DRM_ROTATE_0)) ? "0 " : "",
-		 (rotation & BIT(DRM_ROTATE_90)) ? "90 " : "",
-		 (rotation & BIT(DRM_ROTATE_180)) ? "180 " : "",
-		 (rotation & BIT(DRM_ROTATE_270)) ? "270 " : "",
-		 (rotation & BIT(DRM_REFLECT_X)) ? "FLIPX " : "",
-		 (rotation & BIT(DRM_REFLECT_Y)) ? "FLIPY " : "",
+		 (rotation & DRM_ROTATE_0) ? "0 " : "",
+		 (rotation & DRM_ROTATE_90) ? "90 " : "",
+		 (rotation & DRM_ROTATE_180) ? "180 " : "",
+		 (rotation & DRM_ROTATE_270) ? "270 " : "",
+		 (rotation & DRM_REFLECT_X) ? "FLIPX " : "",
+		 (rotation & DRM_REFLECT_Y) ? "FLIPY " : "",
 		 rotation);
 
 	return buf;
diff --git a/drivers/gpu/drm/i915/intel_atomic_plane.c b/drivers/gpu/drm/i915/intel_atomic_plane.c
index 7de7721..7cc9c76 100644
--- a/drivers/gpu/drm/i915/intel_atomic_plane.c
+++ b/drivers/gpu/drm/i915/intel_atomic_plane.c
@@ -55,7 +55,7 @@ intel_create_plane_state(struct drm_plane *plane)
 		return NULL;
 
 	state->base.plane = plane;
-	state->base.rotation = BIT(DRM_ROTATE_0);
+	state->base.rotation = DRM_ROTATE_0;
 	state->ckey.flags = I915_SET_COLORKEY_NONE;
 
 	return state;
diff --git a/drivers/gpu/drm/i915/intel_display.c b/drivers/gpu/drm/i915/intel_display.c
index c4c1c85..9275b5d 100644
--- a/drivers/gpu/drm/i915/intel_display.c
+++ b/drivers/gpu/drm/i915/intel_display.c
@@ -2688,7 +2688,7 @@ static void i9xx_update_primary_plane(struct drm_plane *primary,
 		intel_crtc->dspaddr_offset = linear_offset;
 	}
 
-	if (rotation == BIT(DRM_ROTATE_180)) {
+	if (rotation == DRM_ROTATE_180) {
 		dspcntr |= DISPPLANE_ROTATE_180;
 
 		x += (crtc_state->pipe_src_w - 1);
@@ -2791,7 +2791,7 @@ static void ironlake_update_primary_plane(struct drm_plane *primary,
 		intel_compute_tile_offset(&x, &y, fb, 0,
 					  fb->pitches[0], rotation);
 	linear_offset -= intel_crtc->dspaddr_offset;
-	if (rotation == BIT(DRM_ROTATE_180)) {
+	if (rotation == DRM_ROTATE_180) {
 		dspcntr |= DISPPLANE_ROTATE_180;
 
 		if (!IS_HASWELL(dev) && !IS_BROADWELL(dev)) {
@@ -2952,17 +2952,17 @@ u32 skl_plane_ctl_tiling(uint64_t fb_modifier)
 u32 skl_plane_ctl_rotation(unsigned int rotation)
 {
 	switch (rotation) {
-	case BIT(DRM_ROTATE_0):
+	case DRM_ROTATE_0:
 		break;
 	/*
 	 * DRM_ROTATE_ is counter clockwise to stay compatible with Xrandr
 	 * while i915 HW rotation is clockwise, thats why this swapping.
 	 */
-	case BIT(DRM_ROTATE_90):
+	case DRM_ROTATE_90:
 		return PLANE_CTL_ROTATE_270;
-	case BIT(DRM_ROTATE_180):
+	case DRM_ROTATE_180:
 		return PLANE_CTL_ROTATE_180;
-	case BIT(DRM_ROTATE_270):
+	case DRM_ROTATE_270:
 		return PLANE_CTL_ROTATE_90;
 	default:
 		MISSING_CASE(rotation);
@@ -4248,7 +4248,7 @@ int skl_update_scaler_crtc(struct intel_crtc_state *state)
 		      intel_crtc->pipe, SKL_CRTC_INDEX);
 
 	return skl_update_scaler(state, !state->base.active, SKL_CRTC_INDEX,
-		&state->scaler_state.scaler_id, BIT(DRM_ROTATE_0),
+		&state->scaler_state.scaler_id, DRM_ROTATE_0,
 		state->pipe_src_w, state->pipe_src_h,
 		adjusted_mode->crtc_hdisplay, adjusted_mode->crtc_vdisplay);
 }
@@ -10255,7 +10255,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 == BIT(DRM_ROTATE_180))
+		if (plane_state->base.rotation == DRM_ROTATE_180)
 			cntl |= CURSOR_ROTATE_180;
 	}
 
@@ -10301,7 +10301,7 @@ static void intel_crtc_update_cursor(struct drm_crtc *crtc,
 
 		/* ILK+ do this automagically */
 		if (HAS_GMCH_DISPLAY(dev) &&
-		    plane_state->base.rotation == BIT(DRM_ROTATE_180)) {
+		    plane_state->base.rotation == DRM_ROTATE_180) {
 			base += (plane_state->base.crtc_h *
 				 plane_state->base.crtc_w - 1) * 4;
 		}
@@ -14296,11 +14296,11 @@ fail:
 void intel_create_rotation_property(struct drm_device *dev, struct intel_plane *plane)
 {
 	if (!dev->mode_config.rotation_property) {
-		unsigned long flags = BIT(DRM_ROTATE_0) |
-			BIT(DRM_ROTATE_180);
+		unsigned long flags = DRM_ROTATE_0 |
+			DRM_ROTATE_180;
 
 		if (INTEL_INFO(dev)->gen >= 9)
-			flags |= BIT(DRM_ROTATE_90) | BIT(DRM_ROTATE_270);
+			flags |= DRM_ROTATE_90 | DRM_ROTATE_270;
 
 		dev->mode_config.rotation_property =
 			drm_mode_create_rotation_property(dev, flags);
@@ -14443,8 +14443,8 @@ static struct drm_plane *intel_cursor_plane_create(struct drm_device *dev,
 		if (!dev->mode_config.rotation_property)
 			dev->mode_config.rotation_property =
 				drm_mode_create_rotation_property(dev,
-							BIT(DRM_ROTATE_0) |
-							BIT(DRM_ROTATE_180));
+							DRM_ROTATE_0 |
+							DRM_ROTATE_180);
 		if (dev->mode_config.rotation_property)
 			drm_object_attach_property(&cursor->base.base,
 				dev->mode_config.rotation_property,
diff --git a/drivers/gpu/drm/i915/intel_drv.h b/drivers/gpu/drm/i915/intel_drv.h
index e74d851..f82dcc5 100644
--- a/drivers/gpu/drm/i915/intel_drv.h
+++ b/drivers/gpu/drm/i915/intel_drv.h
@@ -1258,7 +1258,7 @@ unsigned int intel_tile_height(const struct drm_i915_private *dev_priv,
 static inline bool
 intel_rotation_90_or_270(unsigned int rotation)
 {
-	return rotation & (BIT(DRM_ROTATE_90) | BIT(DRM_ROTATE_270));
+	return rotation & (DRM_ROTATE_90 | DRM_ROTATE_270);
 }
 
 void intel_create_rotation_property(struct drm_device *dev,
diff --git a/drivers/gpu/drm/i915/intel_fbc.c b/drivers/gpu/drm/i915/intel_fbc.c
index 781e2f5..eff26d7 100644
--- a/drivers/gpu/drm/i915/intel_fbc.c
+++ b/drivers/gpu/drm/i915/intel_fbc.c
@@ -775,7 +775,7 @@ static bool intel_fbc_can_activate(struct intel_crtc *crtc)
 		return false;
 	}
 	if (INTEL_INFO(dev_priv)->gen <= 4 && !IS_G4X(dev_priv) &&
-	    cache->plane.rotation != BIT(DRM_ROTATE_0)) {
+	    cache->plane.rotation != DRM_ROTATE_0) {
 		fbc->no_fbc_reason = "rotation unsupported";
 		return false;
 	}
diff --git a/drivers/gpu/drm/i915/intel_fbdev.c b/drivers/gpu/drm/i915/intel_fbdev.c
index 6344999..4fee93d 100644
--- a/drivers/gpu/drm/i915/intel_fbdev.c
+++ b/drivers/gpu/drm/i915/intel_fbdev.c
@@ -223,7 +223,7 @@ static int intelfb_create(struct drm_fb_helper *helper,
 	 * This also validates that any existing fb inherited from the
 	 * BIOS is suitable for own access.
 	 */
-	ret = intel_pin_and_fence_fb_obj(&ifbdev->fb->base, BIT(DRM_ROTATE_0));
+	ret = intel_pin_and_fence_fb_obj(&ifbdev->fb->base, DRM_ROTATE_0);
 	if (ret)
 		goto out_unlock;
 
@@ -289,7 +289,7 @@ static int intelfb_create(struct drm_fb_helper *helper,
 out_destroy_fbi:
 	drm_fb_helper_release_fbi(helper);
 out_unpin:
-	intel_unpin_fb_obj(&ifbdev->fb->base, BIT(DRM_ROTATE_0));
+	intel_unpin_fb_obj(&ifbdev->fb->base, DRM_ROTATE_0);
 out_unlock:
 	mutex_unlock(&dev->struct_mutex);
 	return ret;
@@ -554,7 +554,7 @@ static void intel_fbdev_destroy(struct intel_fbdev *ifbdev)
 
 	if (ifbdev->fb) {
 		mutex_lock(&ifbdev->helper.dev->struct_mutex);
-		intel_unpin_fb_obj(&ifbdev->fb->base, BIT(DRM_ROTATE_0));
+		intel_unpin_fb_obj(&ifbdev->fb->base, DRM_ROTATE_0);
 		mutex_unlock(&ifbdev->helper.dev->struct_mutex);
 
 		drm_framebuffer_remove(&ifbdev->fb->base);
diff --git a/drivers/gpu/drm/i915/intel_sprite.c b/drivers/gpu/drm/i915/intel_sprite.c
index 0de935a..22ae2298 100644
--- a/drivers/gpu/drm/i915/intel_sprite.c
+++ b/drivers/gpu/drm/i915/intel_sprite.c
@@ -444,7 +444,7 @@ vlv_update_plane(struct drm_plane *dplane,
 						   fb->pitches[0], rotation);
 	linear_offset -= sprsurf_offset;
 
-	if (rotation == BIT(DRM_ROTATE_180)) {
+	if (rotation == DRM_ROTATE_180) {
 		sprctl |= SP_ROTATE_180;
 
 		x += src_w;
@@ -577,7 +577,7 @@ ivb_update_plane(struct drm_plane *plane,
 						   fb->pitches[0], rotation);
 	linear_offset -= sprsurf_offset;
 
-	if (rotation == BIT(DRM_ROTATE_180)) {
+	if (rotation == DRM_ROTATE_180) {
 		sprctl |= SPRITE_ROTATE_180;
 
 		/* HSW and BDW does this automagically in hardware */
@@ -714,7 +714,7 @@ ilk_update_plane(struct drm_plane *plane,
 						   fb->pitches[0], rotation);
 	linear_offset -= dvssurf_offset;
 
-	if (rotation == BIT(DRM_ROTATE_180)) {
+	if (rotation == DRM_ROTATE_180) {
 		dvscntr |= DVS_ROTATE_180;
 
 		x += src_w;
diff --git a/drivers/gpu/drm/msm/mdp/mdp5/mdp5_plane.c b/drivers/gpu/drm/msm/mdp/mdp5/mdp5_plane.c
index 432c098..a02a24e 100644
--- a/drivers/gpu/drm/msm/mdp/mdp5/mdp5_plane.c
+++ b/drivers/gpu/drm/msm/mdp/mdp5/mdp5_plane.c
@@ -78,7 +78,7 @@ 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,
-			BIT(DRM_REFLECT_X) | BIT(DRM_REFLECT_Y));
+			DRM_REFLECT_X | DRM_REFLECT_Y);
 
 	if (dev->mode_config.rotation_property)
 		drm_object_attach_property(&plane->base,
@@ -309,8 +309,8 @@ static int mdp5_plane_atomic_check(struct drm_plane *plane,
 			return -EINVAL;
 		}
 
-		hflip = !!(state->rotation & BIT(DRM_REFLECT_X));
-		vflip = !!(state->rotation & BIT(DRM_REFLECT_Y));
+		hflip = !!(state->rotation & DRM_REFLECT_X);
+		vflip = !!(state->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,
@@ -743,8 +743,8 @@ 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 & BIT(DRM_REFLECT_X));
-	vflip = !!(pstate->rotation & BIT(DRM_REFLECT_Y));
+	hflip = !!(pstate->rotation & DRM_REFLECT_X);
+	vflip = !!(pstate->rotation & DRM_REFLECT_Y);
 
 	spin_lock_irqsave(&mdp5_plane->pipe_lock, flags);
 
diff --git a/drivers/gpu/drm/omapdrm/omap_drv.c b/drivers/gpu/drm/omapdrm/omap_drv.c
index 26c6134..3dd78f2 100644
--- a/drivers/gpu/drm/omapdrm/omap_drv.c
+++ b/drivers/gpu/drm/omapdrm/omap_drv.c
@@ -295,9 +295,9 @@ static int omap_modeset_init_properties(struct drm_device *dev)
 	if (priv->has_dmm) {
 		dev->mode_config.rotation_property =
 			drm_mode_create_rotation_property(dev,
-				BIT(DRM_ROTATE_0) | BIT(DRM_ROTATE_90) |
-				BIT(DRM_ROTATE_180) | BIT(DRM_ROTATE_270) |
-				BIT(DRM_REFLECT_X) | BIT(DRM_REFLECT_Y));
+				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;
 	}
diff --git a/drivers/gpu/drm/omapdrm/omap_fb.c b/drivers/gpu/drm/omapdrm/omap_fb.c
index 31f5178..5f3337f 100644
--- a/drivers/gpu/drm/omapdrm/omap_fb.c
+++ b/drivers/gpu/drm/omapdrm/omap_fb.c
@@ -179,24 +179,24 @@ void omap_framebuffer_update_scanout(struct drm_framebuffer *fb,
 					(uint32_t)win->rotation);
 			/* fallthru to default to no rotation */
 		case 0:
-		case BIT(DRM_ROTATE_0):
+		case DRM_ROTATE_0:
 			orient = 0;
 			break;
-		case BIT(DRM_ROTATE_90):
+		case DRM_ROTATE_90:
 			orient = MASK_XY_FLIP | MASK_X_INVERT;
 			break;
-		case BIT(DRM_ROTATE_180):
+		case DRM_ROTATE_180:
 			orient = MASK_X_INVERT | MASK_Y_INVERT;
 			break;
-		case BIT(DRM_ROTATE_270):
+		case DRM_ROTATE_270:
 			orient = MASK_XY_FLIP | MASK_Y_INVERT;
 			break;
 		}
 
-		if (win->rotation & BIT(DRM_REFLECT_X))
+		if (win->rotation & DRM_REFLECT_X)
 			orient ^= MASK_X_INVERT;
 
-		if (win->rotation & BIT(DRM_REFLECT_Y))
+		if (win->rotation & DRM_REFLECT_Y)
 			orient ^= MASK_Y_INVERT;
 
 		/* adjust x,y offset for flip/invert: */
@@ -213,7 +213,7 @@ void omap_framebuffer_update_scanout(struct drm_framebuffer *fb,
 	} else {
 		switch (win->rotation & DRM_ROTATE_MASK) {
 		case 0:
-		case BIT(DRM_ROTATE_0):
+		case DRM_ROTATE_0:
 			/* OK */
 			break;
 
diff --git a/drivers/gpu/drm/omapdrm/omap_plane.c b/drivers/gpu/drm/omapdrm/omap_plane.c
index 5252ab7..4c7727e 100644
--- a/drivers/gpu/drm/omapdrm/omap_plane.c
+++ b/drivers/gpu/drm/omapdrm/omap_plane.c
@@ -109,8 +109,8 @@ static void omap_plane_atomic_update(struct drm_plane *plane,
 	win.src_y = state->src_y >> 16;
 
 	switch (state->rotation & DRM_ROTATE_MASK) {
-	case BIT(DRM_ROTATE_90):
-	case BIT(DRM_ROTATE_270):
+	case DRM_ROTATE_90:
+	case DRM_ROTATE_270:
 		win.src_w = state->src_h >> 16;
 		win.src_h = state->src_w >> 16;
 		break;
@@ -149,7 +149,7 @@ static void omap_plane_atomic_disable(struct drm_plane *plane,
 	struct omap_plane_state *omap_state = to_omap_plane_state(plane->state);
 	struct omap_plane *omap_plane = to_omap_plane(plane);
 
-	plane->state->rotation = BIT(DRM_ROTATE_0);
+	plane->state->rotation = DRM_ROTATE_0;
 	omap_state->zorder = plane->type == DRM_PLANE_TYPE_PRIMARY
 			   ? 0 : omap_plane->id;
 
@@ -178,7 +178,7 @@ static int omap_plane_atomic_check(struct drm_plane *plane,
 		return -EINVAL;
 
 	if (state->fb) {
-		if (state->rotation != BIT(DRM_ROTATE_0) &&
+		if (state->rotation != DRM_ROTATE_0 &&
 		    !omap_framebuffer_supports_rotation(state->fb))
 			return -EINVAL;
 	}
@@ -269,7 +269,7 @@ static void omap_plane_reset(struct drm_plane *plane)
 	 */
 	omap_state->zorder = plane->type == DRM_PLANE_TYPE_PRIMARY
 			   ? 0 : omap_plane->id;
-	omap_state->base.rotation = BIT(DRM_ROTATE_0);
+	omap_state->base.rotation = DRM_ROTATE_0;
 
 	plane->state = &omap_state->base;
 	plane->state->plane = plane;
diff --git a/include/drm/drm_crtc.h b/include/drm/drm_crtc.h
index 3edeaf8..448625d 100644
--- a/include/drm/drm_crtc.h
+++ b/include/drm/drm_crtc.h
@@ -83,14 +83,15 @@ static inline uint64_t I642U64(int64_t val)
  * specified amount in degrees in counter clockwise direction. DRM_REFLECT_X and
  * DRM_REFLECT_Y reflects the image along the specified axis prior to rotation
  */
-#define DRM_ROTATE_MASK 0x0f
-#define DRM_ROTATE_0	0
-#define DRM_ROTATE_90	1
-#define DRM_ROTATE_180	2
-#define DRM_ROTATE_270	3
-#define DRM_REFLECT_MASK (~DRM_ROTATE_MASK)
-#define DRM_REFLECT_X	4
-#define DRM_REFLECT_Y	5
+#define DRM_ROTATE_0	BIT(0)
+#define DRM_ROTATE_90	BIT(1)
+#define DRM_ROTATE_180	BIT(2)
+#define DRM_ROTATE_270	BIT(3)
+#define DRM_ROTATE_MASK (DRM_ROTATE_0   | DRM_ROTATE_90 | \
+			 DRM_ROTATE_180 | DRM_ROTATE_270)
+#define DRM_REFLECT_X	BIT(4)
+#define DRM_REFLECT_Y	BIT(5)
+#define DRM_REFLECT_MASK (DRM_REFLECT_X | DRM_REFLECT_Y)
 
 enum drm_connector_force {
 	DRM_FORCE_UNSPECIFIED,
-- 
2.5.5

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

* Re: [PATCH] drm: BIT(DRM_ROTATE_?) -> DRM_ROTATE_?
  2016-07-29  5:49         ` Joonas Lahtinen
@ 2016-07-29  5:51           ` Joonas Lahtinen
  0 siblings, 0 replies; 14+ messages in thread
From: Joonas Lahtinen @ 2016-07-29  5:51 UTC (permalink / raw)
  To: Direct Rendering Infrastructure - Development
  Cc: intel-gfx, linux-arm-msm, freedreno, malidp, David Airlie,
	Daniel Vetter, Ville Syrjälä,
	Liviu Dudau, Sean Paul

This can be disregarded.
-- 
Joonas Lahtinen
Open Source Technology Center
Intel Corporation

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

* ✗ Ro.CI.BAT: failure for drm: BIT(DRM_ROTATE_?) -> DRM_ROTATE_? (rev3)
  2016-07-25  7:00 [PATCH] drm: BIT(DRM_ROTATE_?) -> DRM_ROTATE_? Joonas Lahtinen
                   ` (3 preceding siblings ...)
  2016-07-26 14:49 ` Sean Paul
@ 2016-07-29  6:16 ` Patchwork
  4 siblings, 0 replies; 14+ messages in thread
From: Patchwork @ 2016-07-29  6:16 UTC (permalink / raw)
  To: Joonas Lahtinen; +Cc: intel-gfx

== Series Details ==

Series: drm: BIT(DRM_ROTATE_?) -> DRM_ROTATE_? (rev3)
URL   : https://patchwork.freedesktop.org/series/10229/
State : failure

== Summary ==

Series 10229v3 drm: BIT(DRM_ROTATE_?) -> DRM_ROTATE_?
http://patchwork.freedesktop.org/api/1.0/series/10229/revisions/3/mbox

Test drv_module_reload_basic:
                skip       -> PASS       (ro-ivb-i7-3770)
                skip       -> PASS       (ro-skl3-i5-6260u)
Test gem_exec_suspend:
        Subgroup basic-s3:
                pass       -> INCOMPLETE (fi-skl-i5-6260u)
                pass       -> INCOMPLETE (fi-skl-i7-6700k)
Test kms_cursor_legacy:
        Subgroup basic-cursor-vs-flip-legacy:
                fail       -> PASS       (ro-ilk1-i5-650)
        Subgroup basic-cursor-vs-flip-varying-size:
                pass       -> FAIL       (ro-ilk1-i5-650)
        Subgroup basic-flip-vs-cursor-varying-size:
                fail       -> PASS       (ro-snb-i7-2620M)
                pass       -> FAIL       (ro-bdw-i5-5250u)

fi-hsw-i7-4770k  total:239  pass:217  dwarn:0   dfail:0   fail:0   skip:22 
fi-skl-i5-6260u  total:107  pass:98   dwarn:0   dfail:0   fail:0   skip:8  
fi-skl-i7-6700k  total:107  pass:84   dwarn:0   dfail:0   fail:0   skip:22 
fi-snb-i7-2600   total:239  pass:197  dwarn:0   dfail:0   fail:0   skip:42 
ro-bdw-i5-5250u  total:239  pass:218  dwarn:4   dfail:0   fail:1   skip:16 
ro-bdw-i7-5557U  total:239  pass:222  dwarn:0   dfail:0   fail:1   skip:16 
ro-bdw-i7-5600u  total:239  pass:206  dwarn:0   dfail:0   fail:1   skip:32 
ro-bsw-n3050     total:239  pass:193  dwarn:0   dfail:0   fail:4   skip:42 
ro-hsw-i3-4010u  total:239  pass:213  dwarn:0   dfail:0   fail:0   skip:26 
ro-hsw-i7-4770r  total:239  pass:213  dwarn:0   dfail:0   fail:0   skip:26 
ro-ilk-i7-620lm  total:239  pass:172  dwarn:1   dfail:0   fail:1   skip:65 
ro-ilk1-i5-650   total:234  pass:172  dwarn:0   dfail:0   fail:2   skip:60 
ro-ivb-i7-3770   total:239  pass:204  dwarn:0   dfail:0   fail:0   skip:35 
ro-ivb2-i7-3770  total:239  pass:208  dwarn:0   dfail:0   fail:0   skip:31 
ro-skl3-i5-6260u total:239  pass:221  dwarn:0   dfail:0   fail:4   skip:14 
ro-snb-i7-2620M  total:239  pass:197  dwarn:0   dfail:0   fail:1   skip:41 

Results at /archive/results/CI_IGT_test/RO_Patchwork_1637/

cb7629d drm-intel-nightly: 2016y-07m-28d-11h-02m-33s UTC integration manifest
784b86f drm: BIT(DRM_ROTATE_?) -> DRM_ROTATE_?

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

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

* Re: [PATCH v2] drm: BIT(DRM_ROTATE_?) -> DRM_ROTATE_?
  2016-07-29  5:50         ` [PATCH v2] " Joonas Lahtinen
@ 2016-07-29 19:33           ` Sean Paul
  0 siblings, 0 replies; 14+ messages in thread
From: Sean Paul @ 2016-07-29 19:33 UTC (permalink / raw)
  To: Joonas Lahtinen
  Cc: David Airlie, linux-arm-msm, intel-gfx, Liviu Dudau,
	Direct Rendering Infrastructure - Development, malidp,
	Daniel Vetter, freedreno

On Fri, Jul 29, 2016 at 08:50:05AM +0300, Joonas Lahtinen wrote:
> Only property creation uses the rotation as an index, so convert the
> to figure the index when needed.
> 
> v2: Use the new defines to build the _MASK defines (Sean)
> 
> Cc: intel-gfx@lists.freedesktop.org
> Cc: linux-arm-msm@vger.kernel.org
> Cc: freedreno@lists.freedesktop.org
> Cc: malidp@foss.arm.com
> Cc: David Airlie <airlied@linux.ie>
> Cc: Daniel Vetter <daniel.vetter@ffwll.ch>
> Cc: Ville Syrjälä <ville.syrjala@linux.intel.com>
> Cc: Liviu Dudau <Liviu.Dudau@arm.com>
> Cc: Sean Paul <seanpaul@chromium.org>
> Acked-by: Liviu Dudau <Liviu.Dudau@arm.com>
> Reviewed-by: Ville Syrjälä <ville.syrjala@linux.intel.com> (v1)
> Signed-off-by: Joonas Lahtinen <joonas.lahtinen@linux.intel.com>

Thanks for respinning this, Joonas. I've added this to my queue for -misc after
the merge window is closed.

Acked-by: Sean Paul <seanpaul@chromium.org>

> ---
>  drivers/gpu/drm/arm/malidp_drv.h                |  2 +-
>  drivers/gpu/drm/arm/malidp_planes.c             | 20 +++++++++---------
>  drivers/gpu/drm/armada/armada_overlay.c         |  2 +-
>  drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_plane.c | 22 +++++++++----------
>  drivers/gpu/drm/drm_atomic_helper.c             |  4 ++--
>  drivers/gpu/drm/drm_crtc.c                      | 24 ++++++++++-----------
>  drivers/gpu/drm/drm_fb_helper.c                 |  4 ++--
>  drivers/gpu/drm/drm_plane_helper.c              |  2 +-
>  drivers/gpu/drm/drm_rect.c                      | 28 ++++++++++++-------------
>  drivers/gpu/drm/i915/i915_debugfs.c             | 12 +++++------
>  drivers/gpu/drm/i915/intel_atomic_plane.c       |  2 +-
>  drivers/gpu/drm/i915/intel_display.c            | 28 ++++++++++++-------------
>  drivers/gpu/drm/i915/intel_drv.h                |  2 +-
>  drivers/gpu/drm/i915/intel_fbc.c                |  2 +-
>  drivers/gpu/drm/i915/intel_fbdev.c              |  6 +++---
>  drivers/gpu/drm/i915/intel_sprite.c             |  6 +++---
>  drivers/gpu/drm/msm/mdp/mdp5/mdp5_plane.c       | 10 ++++-----
>  drivers/gpu/drm/omapdrm/omap_drv.c              |  6 +++---
>  drivers/gpu/drm/omapdrm/omap_fb.c               | 14 ++++++-------
>  drivers/gpu/drm/omapdrm/omap_plane.c            | 10 ++++-----
>  include/drm/drm_crtc.h                          | 17 ++++++++-------
>  21 files changed, 112 insertions(+), 111 deletions(-)
> 
> diff --git a/drivers/gpu/drm/arm/malidp_drv.h b/drivers/gpu/drm/arm/malidp_drv.h
> index 95558fd..271d2fb 100644
> --- a/drivers/gpu/drm/arm/malidp_drv.h
> +++ b/drivers/gpu/drm/arm/malidp_drv.h
> @@ -49,6 +49,6 @@ void malidp_de_planes_destroy(struct drm_device *drm);
>  int malidp_crtc_init(struct drm_device *drm);
>  
>  /* often used combination of rotational bits */
> -#define MALIDP_ROTATED_MASK	(BIT(DRM_ROTATE_90) | BIT(DRM_ROTATE_270))
> +#define MALIDP_ROTATED_MASK	(DRM_ROTATE_90 | DRM_ROTATE_270)
>  
>  #endif  /* __MALIDP_DRV_H__ */
> diff --git a/drivers/gpu/drm/arm/malidp_planes.c b/drivers/gpu/drm/arm/malidp_planes.c
> index 725098d..82c193e 100644
> --- a/drivers/gpu/drm/arm/malidp_planes.c
> +++ b/drivers/gpu/drm/arm/malidp_planes.c
> @@ -108,7 +108,7 @@ static int malidp_de_plane_check(struct drm_plane *plane,
>  		return -EINVAL;
>  
>  	/* packed RGB888 / BGR888 can't be rotated or flipped */
> -	if (state->rotation != BIT(DRM_ROTATE_0) &&
> +	if (state->rotation != DRM_ROTATE_0 &&
>  	    (state->fb->pixel_format == DRM_FORMAT_RGB888 ||
>  	     state->fb->pixel_format == DRM_FORMAT_BGR888))
>  		return -EINVAL;
> @@ -188,9 +188,9 @@ static void malidp_de_plane_update(struct drm_plane *plane,
>  	/* setup the rotation and axis flip bits */
>  	if (plane->state->rotation & DRM_ROTATE_MASK)
>  		val = ilog2(plane->state->rotation & DRM_ROTATE_MASK) << LAYER_ROT_OFFSET;
> -	if (plane->state->rotation & BIT(DRM_REFLECT_X))
> +	if (plane->state->rotation & DRM_REFLECT_X)
>  		val |= LAYER_V_FLIP;
> -	if (plane->state->rotation & BIT(DRM_REFLECT_Y))
> +	if (plane->state->rotation & DRM_REFLECT_Y)
>  		val |= LAYER_H_FLIP;
>  
>  	/* set the 'enable layer' bit */
> @@ -255,12 +255,12 @@ int malidp_de_planes_init(struct drm_device *drm)
>  			goto cleanup;
>  
>  		if (!drm->mode_config.rotation_property) {
> -			unsigned long flags = BIT(DRM_ROTATE_0) |
> -					      BIT(DRM_ROTATE_90) |
> -					      BIT(DRM_ROTATE_180) |
> -					      BIT(DRM_ROTATE_270) |
> -					      BIT(DRM_REFLECT_X) |
> -					      BIT(DRM_REFLECT_Y);
> +			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);
>  		}
> @@ -268,7 +268,7 @@ int malidp_de_planes_init(struct drm_device *drm)
>  		if (drm->mode_config.rotation_property && (id != DE_SMART))
>  			drm_object_attach_property(&plane->base.base,
>  						   drm->mode_config.rotation_property,
> -						   BIT(DRM_ROTATE_0));
> +						   DRM_ROTATE_0);
>  
>  		drm_plane_helper_add(&plane->base,
>  				     &malidp_de_plane_helper_funcs);
> diff --git a/drivers/gpu/drm/armada/armada_overlay.c b/drivers/gpu/drm/armada/armada_overlay.c
> index 1ee707e..152b4e7 100644
> --- a/drivers/gpu/drm/armada/armada_overlay.c
> +++ b/drivers/gpu/drm/armada/armada_overlay.c
> @@ -121,7 +121,7 @@ armada_ovl_plane_update(struct drm_plane *plane, struct drm_crtc *crtc,
>  	int ret;
>  
>  	ret = drm_plane_helper_check_update(plane, crtc, fb, &src, &dest, &clip,
> -					    BIT(DRM_ROTATE_0),
> +					    DRM_ROTATE_0,
>  					    0, INT_MAX, true, false, &visible);
>  	if (ret)
>  		return ret;
> diff --git a/drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_plane.c b/drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_plane.c
> index 016c191..146809a 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 & (BIT(DRM_ROTATE_90) | BIT(DRM_ROTATE_270))))
> +	    (state->base.rotation & (DRM_ROTATE_90 | DRM_ROTATE_270)))
>  		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 & (BIT(DRM_ROTATE_90) | BIT(DRM_ROTATE_270))) {
> +	if (state->base.rotation & (DRM_ROTATE_90 | DRM_ROTATE_270)) {
>  		tmp = state->crtc_w;
>  		state->crtc_w = state->crtc_h;
>  		state->crtc_h = tmp;
> @@ -677,7 +677,7 @@ static int atmel_hlcdc_plane_atomic_check(struct drm_plane *p,
>  			return -EINVAL;
>  
>  		switch (state->base.rotation & DRM_ROTATE_MASK) {
> -		case BIT(DRM_ROTATE_90):
> +		case DRM_ROTATE_90:
>  			offset = ((y_offset + state->src_y + patched_src_w - 1) /
>  				  ydiv) * fb->pitches[i];
>  			offset += ((x_offset + state->src_x) / xdiv) *
> @@ -686,7 +686,7 @@ static int atmel_hlcdc_plane_atomic_check(struct drm_plane *p,
>  					  fb->pitches[i];
>  			state->pstride[i] = -fb->pitches[i] - state->bpp[i];
>  			break;
> -		case BIT(DRM_ROTATE_180):
> +		case DRM_ROTATE_180:
>  			offset = ((y_offset + state->src_y + patched_src_h - 1) /
>  				  ydiv) * fb->pitches[i];
>  			offset += ((x_offset + state->src_x + patched_src_w - 1) /
> @@ -695,7 +695,7 @@ static int atmel_hlcdc_plane_atomic_check(struct drm_plane *p,
>  					   state->bpp[i]) - fb->pitches[i];
>  			state->pstride[i] = -2 * state->bpp[i];
>  			break;
> -		case BIT(DRM_ROTATE_270):
> +		case DRM_ROTATE_270:
>  			offset = ((y_offset + state->src_y) / ydiv) *
>  				 fb->pitches[i];
>  			offset += ((x_offset + state->src_x + patched_src_h - 1) /
> @@ -705,7 +705,7 @@ static int atmel_hlcdc_plane_atomic_check(struct drm_plane *p,
>  					  (2 * state->bpp[i]);
>  			state->pstride[i] = fb->pitches[i] - state->bpp[i];
>  			break;
> -		case BIT(DRM_ROTATE_0):
> +		case DRM_ROTATE_0:
>  		default:
>  			offset = ((y_offset + state->src_y) / ydiv) *
>  				 fb->pitches[i];
> @@ -905,7 +905,7 @@ static void atmel_hlcdc_plane_init_properties(struct atmel_hlcdc_plane *plane,
>  	if (desc->layout.xstride && desc->layout.pstride)
>  		drm_object_attach_property(&plane->base.base,
>  				plane->base.dev->mode_config.rotation_property,
> -				BIT(DRM_ROTATE_0));
> +				DRM_ROTATE_0);
>  
>  	if (desc->layout.csc) {
>  		/*
> @@ -1056,10 +1056,10 @@ atmel_hlcdc_plane_create_properties(struct drm_device *dev)
>  
>  	dev->mode_config.rotation_property =
>  			drm_mode_create_rotation_property(dev,
> -							  BIT(DRM_ROTATE_0) |
> -							  BIT(DRM_ROTATE_90) |
> -							  BIT(DRM_ROTATE_180) |
> -							  BIT(DRM_ROTATE_270));
> +							  DRM_ROTATE_0 |
> +							  DRM_ROTATE_90 |
> +							  DRM_ROTATE_180 |
> +							  DRM_ROTATE_270);
>  	if (!dev->mode_config.rotation_property)
>  		return ERR_PTR(-ENOMEM);
>  
> diff --git a/drivers/gpu/drm/drm_atomic_helper.c b/drivers/gpu/drm/drm_atomic_helper.c
> index de7fddc..61afd85 100644
> --- a/drivers/gpu/drm/drm_atomic_helper.c
> +++ b/drivers/gpu/drm/drm_atomic_helper.c
> @@ -2348,7 +2348,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 & (BIT(DRM_ROTATE_90) | BIT(DRM_ROTATE_270))) {
> +	if (primary_state->rotation & (DRM_ROTATE_90 | DRM_ROTATE_270)) {
>  		primary_state->src_w = vdisplay << 16;
>  		primary_state->src_h = hdisplay << 16;
>  	} else {
> @@ -3032,7 +3032,7 @@ void drm_atomic_helper_plane_reset(struct drm_plane *plane)
>  
>  	if (plane->state) {
>  		plane->state->plane = plane;
> -		plane->state->rotation = BIT(DRM_ROTATE_0);
> +		plane->state->rotation = DRM_ROTATE_0;
>  	}
>  }
>  EXPORT_SYMBOL(drm_atomic_helper_plane_reset);
> diff --git a/drivers/gpu/drm/drm_crtc.c b/drivers/gpu/drm/drm_crtc.c
> index f1d9f05..909a025 100644
> --- a/drivers/gpu/drm/drm_crtc.c
> +++ b/drivers/gpu/drm/drm_crtc.c
> @@ -2804,8 +2804,8 @@ 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 & (BIT(DRM_ROTATE_90) |
> -					      BIT(DRM_ROTATE_270)))
> +	    crtc->primary->state->rotation & (DRM_ROTATE_90 |
> +					      DRM_ROTATE_270))
>  		swap(hdisplay, vdisplay);
>  
>  	return check_src_coords(x << 16, y << 16,
> @@ -5646,9 +5646,9 @@ int drm_mode_destroy_dumb_ioctl(struct drm_device *dev,
>   * Eg. if the hardware supports everything except DRM_REFLECT_X
>   * one could call this function like this:
>   *
> - * drm_rotation_simplify(rotation, BIT(DRM_ROTATE_0) |
> - *                       BIT(DRM_ROTATE_90) | BIT(DRM_ROTATE_180) |
> - *                       BIT(DRM_ROTATE_270) | BIT(DRM_REFLECT_Y));
> + * drm_rotation_simplify(rotation, DRM_ROTATE_0 |
> + *                       DRM_ROTATE_90 | DRM_ROTATE_180 |
> + *                       DRM_ROTATE_270 | DRM_REFLECT_Y);
>   *
>   * to eliminate the DRM_ROTATE_X flag. Depending on what kind of
>   * transforms the hardware supports, this function may not
> @@ -5659,7 +5659,7 @@ unsigned int drm_rotation_simplify(unsigned int rotation,
>  				   unsigned int supported_rotations)
>  {
>  	if (rotation & ~supported_rotations) {
> -		rotation ^= BIT(DRM_REFLECT_X) | BIT(DRM_REFLECT_Y);
> +		rotation ^= DRM_REFLECT_X | DRM_REFLECT_Y;
>  		rotation = (rotation & DRM_REFLECT_MASK) |
>  		           BIT((ffs(rotation & DRM_ROTATE_MASK) + 1) % 4);
>  	}
> @@ -5788,12 +5788,12 @@ struct drm_property *drm_mode_create_rotation_property(struct drm_device *dev,
>  						       unsigned int supported_rotations)
>  {
>  	static const struct drm_prop_enum_list props[] = {
> -		{ DRM_ROTATE_0,   "rotate-0" },
> -		{ DRM_ROTATE_90,  "rotate-90" },
> -		{ DRM_ROTATE_180, "rotate-180" },
> -		{ DRM_ROTATE_270, "rotate-270" },
> -		{ DRM_REFLECT_X,  "reflect-x" },
> -		{ DRM_REFLECT_Y,  "reflect-y" },
> +		{ __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",
> diff --git a/drivers/gpu/drm/drm_fb_helper.c b/drivers/gpu/drm/drm_fb_helper.c
> index ce54e98..d4896f9 100644
> --- a/drivers/gpu/drm/drm_fb_helper.c
> +++ b/drivers/gpu/drm/drm_fb_helper.c
> @@ -335,7 +335,7 @@ retry:
>  			goto fail;
>  		}
>  
> -		plane_state->rotation = BIT(DRM_ROTATE_0);
> +		plane_state->rotation = DRM_ROTATE_0;
>  
>  		plane->old_fb = plane->fb;
>  		plane_mask |= 1 << drm_plane_index(plane);
> @@ -395,7 +395,7 @@ static int restore_fbdev_mode(struct drm_fb_helper *fb_helper)
>  		if (dev->mode_config.rotation_property) {
>  			drm_mode_plane_set_obj_prop(plane,
>  						    dev->mode_config.rotation_property,
> -						    BIT(DRM_ROTATE_0));
> +						    DRM_ROTATE_0);
>  		}
>  	}
>  
> diff --git a/drivers/gpu/drm/drm_plane_helper.c b/drivers/gpu/drm/drm_plane_helper.c
> index 16c4a7b..c360e30 100644
> --- a/drivers/gpu/drm/drm_plane_helper.c
> +++ b/drivers/gpu/drm/drm_plane_helper.c
> @@ -274,7 +274,7 @@ int drm_primary_helper_update(struct drm_plane *plane, struct drm_crtc *crtc,
>  
>  	ret = drm_plane_helper_check_update(plane, crtc, fb,
>  					    &src, &dest, &clip,
> -					    BIT(DRM_ROTATE_0),
> +					    DRM_ROTATE_0,
>  					    DRM_PLANE_HELPER_NO_SCALING,
>  					    DRM_PLANE_HELPER_NO_SCALING,
>  					    false, false, &visible);
> diff --git a/drivers/gpu/drm/drm_rect.c b/drivers/gpu/drm/drm_rect.c
> index a8e2c86..4063f6e 100644
> --- a/drivers/gpu/drm/drm_rect.c
> +++ b/drivers/gpu/drm/drm_rect.c
> @@ -317,38 +317,38 @@ void drm_rect_rotate(struct drm_rect *r,
>  {
>  	struct drm_rect tmp;
>  
> -	if (rotation & (BIT(DRM_REFLECT_X) | BIT(DRM_REFLECT_Y))) {
> +	if (rotation & (DRM_REFLECT_X | DRM_REFLECT_Y)) {
>  		tmp = *r;
>  
> -		if (rotation & BIT(DRM_REFLECT_X)) {
> +		if (rotation & DRM_REFLECT_X) {
>  			r->x1 = width - tmp.x2;
>  			r->x2 = width - tmp.x1;
>  		}
>  
> -		if (rotation & BIT(DRM_REFLECT_Y)) {
> +		if (rotation & DRM_REFLECT_Y) {
>  			r->y1 = height - tmp.y2;
>  			r->y2 = height - tmp.y1;
>  		}
>  	}
>  
>  	switch (rotation & DRM_ROTATE_MASK) {
> -	case BIT(DRM_ROTATE_0):
> +	case DRM_ROTATE_0:
>  		break;
> -	case BIT(DRM_ROTATE_90):
> +	case DRM_ROTATE_90:
>  		tmp = *r;
>  		r->x1 = tmp.y1;
>  		r->x2 = tmp.y2;
>  		r->y1 = width - tmp.x2;
>  		r->y2 = width - tmp.x1;
>  		break;
> -	case BIT(DRM_ROTATE_180):
> +	case DRM_ROTATE_180:
>  		tmp = *r;
>  		r->x1 = width - tmp.x2;
>  		r->x2 = width - tmp.x1;
>  		r->y1 = height - tmp.y2;
>  		r->y2 = height - tmp.y1;
>  		break;
> -	case BIT(DRM_ROTATE_270):
> +	case DRM_ROTATE_270:
>  		tmp = *r;
>  		r->x1 = height - tmp.y2;
>  		r->x2 = height - tmp.y1;
> @@ -392,23 +392,23 @@ void drm_rect_rotate_inv(struct drm_rect *r,
>  	struct drm_rect tmp;
>  
>  	switch (rotation & DRM_ROTATE_MASK) {
> -	case BIT(DRM_ROTATE_0):
> +	case DRM_ROTATE_0:
>  		break;
> -	case BIT(DRM_ROTATE_90):
> +	case DRM_ROTATE_90:
>  		tmp = *r;
>  		r->x1 = width - tmp.y2;
>  		r->x2 = width - tmp.y1;
>  		r->y1 = tmp.x1;
>  		r->y2 = tmp.x2;
>  		break;
> -	case BIT(DRM_ROTATE_180):
> +	case DRM_ROTATE_180:
>  		tmp = *r;
>  		r->x1 = width - tmp.x2;
>  		r->x2 = width - tmp.x1;
>  		r->y1 = height - tmp.y2;
>  		r->y2 = height - tmp.y1;
>  		break;
> -	case BIT(DRM_ROTATE_270):
> +	case DRM_ROTATE_270:
>  		tmp = *r;
>  		r->x1 = tmp.y1;
>  		r->x2 = tmp.y2;
> @@ -419,15 +419,15 @@ void drm_rect_rotate_inv(struct drm_rect *r,
>  		break;
>  	}
>  
> -	if (rotation & (BIT(DRM_REFLECT_X) | BIT(DRM_REFLECT_Y))) {
> +	if (rotation & (DRM_REFLECT_X | DRM_REFLECT_Y)) {
>  		tmp = *r;
>  
> -		if (rotation & BIT(DRM_REFLECT_X)) {
> +		if (rotation & DRM_REFLECT_X) {
>  			r->x1 = width - tmp.x2;
>  			r->x2 = width - tmp.x1;
>  		}
>  
> -		if (rotation & BIT(DRM_REFLECT_Y)) {
> +		if (rotation & DRM_REFLECT_Y) {
>  			r->y1 = height - tmp.y2;
>  			r->y2 = height - tmp.y1;
>  		}
> diff --git a/drivers/gpu/drm/i915/i915_debugfs.c b/drivers/gpu/drm/i915/i915_debugfs.c
> index 9aa62c5..815232c 100644
> --- a/drivers/gpu/drm/i915/i915_debugfs.c
> +++ b/drivers/gpu/drm/i915/i915_debugfs.c
> @@ -3081,12 +3081,12 @@ static const char *plane_rotation(unsigned int rotation)
>  	 */
>  	snprintf(buf, sizeof(buf),
>  		 "%s%s%s%s%s%s(0x%08x)",
> -		 (rotation & BIT(DRM_ROTATE_0)) ? "0 " : "",
> -		 (rotation & BIT(DRM_ROTATE_90)) ? "90 " : "",
> -		 (rotation & BIT(DRM_ROTATE_180)) ? "180 " : "",
> -		 (rotation & BIT(DRM_ROTATE_270)) ? "270 " : "",
> -		 (rotation & BIT(DRM_REFLECT_X)) ? "FLIPX " : "",
> -		 (rotation & BIT(DRM_REFLECT_Y)) ? "FLIPY " : "",
> +		 (rotation & DRM_ROTATE_0) ? "0 " : "",
> +		 (rotation & DRM_ROTATE_90) ? "90 " : "",
> +		 (rotation & DRM_ROTATE_180) ? "180 " : "",
> +		 (rotation & DRM_ROTATE_270) ? "270 " : "",
> +		 (rotation & DRM_REFLECT_X) ? "FLIPX " : "",
> +		 (rotation & DRM_REFLECT_Y) ? "FLIPY " : "",
>  		 rotation);
>  
>  	return buf;
> diff --git a/drivers/gpu/drm/i915/intel_atomic_plane.c b/drivers/gpu/drm/i915/intel_atomic_plane.c
> index 7de7721..7cc9c76 100644
> --- a/drivers/gpu/drm/i915/intel_atomic_plane.c
> +++ b/drivers/gpu/drm/i915/intel_atomic_plane.c
> @@ -55,7 +55,7 @@ intel_create_plane_state(struct drm_plane *plane)
>  		return NULL;
>  
>  	state->base.plane = plane;
> -	state->base.rotation = BIT(DRM_ROTATE_0);
> +	state->base.rotation = DRM_ROTATE_0;
>  	state->ckey.flags = I915_SET_COLORKEY_NONE;
>  
>  	return state;
> diff --git a/drivers/gpu/drm/i915/intel_display.c b/drivers/gpu/drm/i915/intel_display.c
> index c4c1c85..9275b5d 100644
> --- a/drivers/gpu/drm/i915/intel_display.c
> +++ b/drivers/gpu/drm/i915/intel_display.c
> @@ -2688,7 +2688,7 @@ static void i9xx_update_primary_plane(struct drm_plane *primary,
>  		intel_crtc->dspaddr_offset = linear_offset;
>  	}
>  
> -	if (rotation == BIT(DRM_ROTATE_180)) {
> +	if (rotation == DRM_ROTATE_180) {
>  		dspcntr |= DISPPLANE_ROTATE_180;
>  
>  		x += (crtc_state->pipe_src_w - 1);
> @@ -2791,7 +2791,7 @@ static void ironlake_update_primary_plane(struct drm_plane *primary,
>  		intel_compute_tile_offset(&x, &y, fb, 0,
>  					  fb->pitches[0], rotation);
>  	linear_offset -= intel_crtc->dspaddr_offset;
> -	if (rotation == BIT(DRM_ROTATE_180)) {
> +	if (rotation == DRM_ROTATE_180) {
>  		dspcntr |= DISPPLANE_ROTATE_180;
>  
>  		if (!IS_HASWELL(dev) && !IS_BROADWELL(dev)) {
> @@ -2952,17 +2952,17 @@ u32 skl_plane_ctl_tiling(uint64_t fb_modifier)
>  u32 skl_plane_ctl_rotation(unsigned int rotation)
>  {
>  	switch (rotation) {
> -	case BIT(DRM_ROTATE_0):
> +	case DRM_ROTATE_0:
>  		break;
>  	/*
>  	 * DRM_ROTATE_ is counter clockwise to stay compatible with Xrandr
>  	 * while i915 HW rotation is clockwise, thats why this swapping.
>  	 */
> -	case BIT(DRM_ROTATE_90):
> +	case DRM_ROTATE_90:
>  		return PLANE_CTL_ROTATE_270;
> -	case BIT(DRM_ROTATE_180):
> +	case DRM_ROTATE_180:
>  		return PLANE_CTL_ROTATE_180;
> -	case BIT(DRM_ROTATE_270):
> +	case DRM_ROTATE_270:
>  		return PLANE_CTL_ROTATE_90;
>  	default:
>  		MISSING_CASE(rotation);
> @@ -4248,7 +4248,7 @@ int skl_update_scaler_crtc(struct intel_crtc_state *state)
>  		      intel_crtc->pipe, SKL_CRTC_INDEX);
>  
>  	return skl_update_scaler(state, !state->base.active, SKL_CRTC_INDEX,
> -		&state->scaler_state.scaler_id, BIT(DRM_ROTATE_0),
> +		&state->scaler_state.scaler_id, DRM_ROTATE_0,
>  		state->pipe_src_w, state->pipe_src_h,
>  		adjusted_mode->crtc_hdisplay, adjusted_mode->crtc_vdisplay);
>  }
> @@ -10255,7 +10255,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 == BIT(DRM_ROTATE_180))
> +		if (plane_state->base.rotation == DRM_ROTATE_180)
>  			cntl |= CURSOR_ROTATE_180;
>  	}
>  
> @@ -10301,7 +10301,7 @@ static void intel_crtc_update_cursor(struct drm_crtc *crtc,
>  
>  		/* ILK+ do this automagically */
>  		if (HAS_GMCH_DISPLAY(dev) &&
> -		    plane_state->base.rotation == BIT(DRM_ROTATE_180)) {
> +		    plane_state->base.rotation == DRM_ROTATE_180) {
>  			base += (plane_state->base.crtc_h *
>  				 plane_state->base.crtc_w - 1) * 4;
>  		}
> @@ -14296,11 +14296,11 @@ fail:
>  void intel_create_rotation_property(struct drm_device *dev, struct intel_plane *plane)
>  {
>  	if (!dev->mode_config.rotation_property) {
> -		unsigned long flags = BIT(DRM_ROTATE_0) |
> -			BIT(DRM_ROTATE_180);
> +		unsigned long flags = DRM_ROTATE_0 |
> +			DRM_ROTATE_180;
>  
>  		if (INTEL_INFO(dev)->gen >= 9)
> -			flags |= BIT(DRM_ROTATE_90) | BIT(DRM_ROTATE_270);
> +			flags |= DRM_ROTATE_90 | DRM_ROTATE_270;
>  
>  		dev->mode_config.rotation_property =
>  			drm_mode_create_rotation_property(dev, flags);
> @@ -14443,8 +14443,8 @@ static struct drm_plane *intel_cursor_plane_create(struct drm_device *dev,
>  		if (!dev->mode_config.rotation_property)
>  			dev->mode_config.rotation_property =
>  				drm_mode_create_rotation_property(dev,
> -							BIT(DRM_ROTATE_0) |
> -							BIT(DRM_ROTATE_180));
> +							DRM_ROTATE_0 |
> +							DRM_ROTATE_180);
>  		if (dev->mode_config.rotation_property)
>  			drm_object_attach_property(&cursor->base.base,
>  				dev->mode_config.rotation_property,
> diff --git a/drivers/gpu/drm/i915/intel_drv.h b/drivers/gpu/drm/i915/intel_drv.h
> index e74d851..f82dcc5 100644
> --- a/drivers/gpu/drm/i915/intel_drv.h
> +++ b/drivers/gpu/drm/i915/intel_drv.h
> @@ -1258,7 +1258,7 @@ unsigned int intel_tile_height(const struct drm_i915_private *dev_priv,
>  static inline bool
>  intel_rotation_90_or_270(unsigned int rotation)
>  {
> -	return rotation & (BIT(DRM_ROTATE_90) | BIT(DRM_ROTATE_270));
> +	return rotation & (DRM_ROTATE_90 | DRM_ROTATE_270);
>  }
>  
>  void intel_create_rotation_property(struct drm_device *dev,
> diff --git a/drivers/gpu/drm/i915/intel_fbc.c b/drivers/gpu/drm/i915/intel_fbc.c
> index 781e2f5..eff26d7 100644
> --- a/drivers/gpu/drm/i915/intel_fbc.c
> +++ b/drivers/gpu/drm/i915/intel_fbc.c
> @@ -775,7 +775,7 @@ static bool intel_fbc_can_activate(struct intel_crtc *crtc)
>  		return false;
>  	}
>  	if (INTEL_INFO(dev_priv)->gen <= 4 && !IS_G4X(dev_priv) &&
> -	    cache->plane.rotation != BIT(DRM_ROTATE_0)) {
> +	    cache->plane.rotation != DRM_ROTATE_0) {
>  		fbc->no_fbc_reason = "rotation unsupported";
>  		return false;
>  	}
> diff --git a/drivers/gpu/drm/i915/intel_fbdev.c b/drivers/gpu/drm/i915/intel_fbdev.c
> index 6344999..4fee93d 100644
> --- a/drivers/gpu/drm/i915/intel_fbdev.c
> +++ b/drivers/gpu/drm/i915/intel_fbdev.c
> @@ -223,7 +223,7 @@ static int intelfb_create(struct drm_fb_helper *helper,
>  	 * This also validates that any existing fb inherited from the
>  	 * BIOS is suitable for own access.
>  	 */
> -	ret = intel_pin_and_fence_fb_obj(&ifbdev->fb->base, BIT(DRM_ROTATE_0));
> +	ret = intel_pin_and_fence_fb_obj(&ifbdev->fb->base, DRM_ROTATE_0);
>  	if (ret)
>  		goto out_unlock;
>  
> @@ -289,7 +289,7 @@ static int intelfb_create(struct drm_fb_helper *helper,
>  out_destroy_fbi:
>  	drm_fb_helper_release_fbi(helper);
>  out_unpin:
> -	intel_unpin_fb_obj(&ifbdev->fb->base, BIT(DRM_ROTATE_0));
> +	intel_unpin_fb_obj(&ifbdev->fb->base, DRM_ROTATE_0);
>  out_unlock:
>  	mutex_unlock(&dev->struct_mutex);
>  	return ret;
> @@ -554,7 +554,7 @@ static void intel_fbdev_destroy(struct intel_fbdev *ifbdev)
>  
>  	if (ifbdev->fb) {
>  		mutex_lock(&ifbdev->helper.dev->struct_mutex);
> -		intel_unpin_fb_obj(&ifbdev->fb->base, BIT(DRM_ROTATE_0));
> +		intel_unpin_fb_obj(&ifbdev->fb->base, DRM_ROTATE_0);
>  		mutex_unlock(&ifbdev->helper.dev->struct_mutex);
>  
>  		drm_framebuffer_remove(&ifbdev->fb->base);
> diff --git a/drivers/gpu/drm/i915/intel_sprite.c b/drivers/gpu/drm/i915/intel_sprite.c
> index 0de935a..22ae2298 100644
> --- a/drivers/gpu/drm/i915/intel_sprite.c
> +++ b/drivers/gpu/drm/i915/intel_sprite.c
> @@ -444,7 +444,7 @@ vlv_update_plane(struct drm_plane *dplane,
>  						   fb->pitches[0], rotation);
>  	linear_offset -= sprsurf_offset;
>  
> -	if (rotation == BIT(DRM_ROTATE_180)) {
> +	if (rotation == DRM_ROTATE_180) {
>  		sprctl |= SP_ROTATE_180;
>  
>  		x += src_w;
> @@ -577,7 +577,7 @@ ivb_update_plane(struct drm_plane *plane,
>  						   fb->pitches[0], rotation);
>  	linear_offset -= sprsurf_offset;
>  
> -	if (rotation == BIT(DRM_ROTATE_180)) {
> +	if (rotation == DRM_ROTATE_180) {
>  		sprctl |= SPRITE_ROTATE_180;
>  
>  		/* HSW and BDW does this automagically in hardware */
> @@ -714,7 +714,7 @@ ilk_update_plane(struct drm_plane *plane,
>  						   fb->pitches[0], rotation);
>  	linear_offset -= dvssurf_offset;
>  
> -	if (rotation == BIT(DRM_ROTATE_180)) {
> +	if (rotation == DRM_ROTATE_180) {
>  		dvscntr |= DVS_ROTATE_180;
>  
>  		x += src_w;
> diff --git a/drivers/gpu/drm/msm/mdp/mdp5/mdp5_plane.c b/drivers/gpu/drm/msm/mdp/mdp5/mdp5_plane.c
> index 432c098..a02a24e 100644
> --- a/drivers/gpu/drm/msm/mdp/mdp5/mdp5_plane.c
> +++ b/drivers/gpu/drm/msm/mdp/mdp5/mdp5_plane.c
> @@ -78,7 +78,7 @@ 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,
> -			BIT(DRM_REFLECT_X) | BIT(DRM_REFLECT_Y));
> +			DRM_REFLECT_X | DRM_REFLECT_Y);
>  
>  	if (dev->mode_config.rotation_property)
>  		drm_object_attach_property(&plane->base,
> @@ -309,8 +309,8 @@ static int mdp5_plane_atomic_check(struct drm_plane *plane,
>  			return -EINVAL;
>  		}
>  
> -		hflip = !!(state->rotation & BIT(DRM_REFLECT_X));
> -		vflip = !!(state->rotation & BIT(DRM_REFLECT_Y));
> +		hflip = !!(state->rotation & DRM_REFLECT_X);
> +		vflip = !!(state->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,
> @@ -743,8 +743,8 @@ 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 & BIT(DRM_REFLECT_X));
> -	vflip = !!(pstate->rotation & BIT(DRM_REFLECT_Y));
> +	hflip = !!(pstate->rotation & DRM_REFLECT_X);
> +	vflip = !!(pstate->rotation & DRM_REFLECT_Y);
>  
>  	spin_lock_irqsave(&mdp5_plane->pipe_lock, flags);
>  
> diff --git a/drivers/gpu/drm/omapdrm/omap_drv.c b/drivers/gpu/drm/omapdrm/omap_drv.c
> index 26c6134..3dd78f2 100644
> --- a/drivers/gpu/drm/omapdrm/omap_drv.c
> +++ b/drivers/gpu/drm/omapdrm/omap_drv.c
> @@ -295,9 +295,9 @@ static int omap_modeset_init_properties(struct drm_device *dev)
>  	if (priv->has_dmm) {
>  		dev->mode_config.rotation_property =
>  			drm_mode_create_rotation_property(dev,
> -				BIT(DRM_ROTATE_0) | BIT(DRM_ROTATE_90) |
> -				BIT(DRM_ROTATE_180) | BIT(DRM_ROTATE_270) |
> -				BIT(DRM_REFLECT_X) | BIT(DRM_REFLECT_Y));
> +				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;
>  	}
> diff --git a/drivers/gpu/drm/omapdrm/omap_fb.c b/drivers/gpu/drm/omapdrm/omap_fb.c
> index 31f5178..5f3337f 100644
> --- a/drivers/gpu/drm/omapdrm/omap_fb.c
> +++ b/drivers/gpu/drm/omapdrm/omap_fb.c
> @@ -179,24 +179,24 @@ void omap_framebuffer_update_scanout(struct drm_framebuffer *fb,
>  					(uint32_t)win->rotation);
>  			/* fallthru to default to no rotation */
>  		case 0:
> -		case BIT(DRM_ROTATE_0):
> +		case DRM_ROTATE_0:
>  			orient = 0;
>  			break;
> -		case BIT(DRM_ROTATE_90):
> +		case DRM_ROTATE_90:
>  			orient = MASK_XY_FLIP | MASK_X_INVERT;
>  			break;
> -		case BIT(DRM_ROTATE_180):
> +		case DRM_ROTATE_180:
>  			orient = MASK_X_INVERT | MASK_Y_INVERT;
>  			break;
> -		case BIT(DRM_ROTATE_270):
> +		case DRM_ROTATE_270:
>  			orient = MASK_XY_FLIP | MASK_Y_INVERT;
>  			break;
>  		}
>  
> -		if (win->rotation & BIT(DRM_REFLECT_X))
> +		if (win->rotation & DRM_REFLECT_X)
>  			orient ^= MASK_X_INVERT;
>  
> -		if (win->rotation & BIT(DRM_REFLECT_Y))
> +		if (win->rotation & DRM_REFLECT_Y)
>  			orient ^= MASK_Y_INVERT;
>  
>  		/* adjust x,y offset for flip/invert: */
> @@ -213,7 +213,7 @@ void omap_framebuffer_update_scanout(struct drm_framebuffer *fb,
>  	} else {
>  		switch (win->rotation & DRM_ROTATE_MASK) {
>  		case 0:
> -		case BIT(DRM_ROTATE_0):
> +		case DRM_ROTATE_0:
>  			/* OK */
>  			break;
>  
> diff --git a/drivers/gpu/drm/omapdrm/omap_plane.c b/drivers/gpu/drm/omapdrm/omap_plane.c
> index 5252ab7..4c7727e 100644
> --- a/drivers/gpu/drm/omapdrm/omap_plane.c
> +++ b/drivers/gpu/drm/omapdrm/omap_plane.c
> @@ -109,8 +109,8 @@ static void omap_plane_atomic_update(struct drm_plane *plane,
>  	win.src_y = state->src_y >> 16;
>  
>  	switch (state->rotation & DRM_ROTATE_MASK) {
> -	case BIT(DRM_ROTATE_90):
> -	case BIT(DRM_ROTATE_270):
> +	case DRM_ROTATE_90:
> +	case DRM_ROTATE_270:
>  		win.src_w = state->src_h >> 16;
>  		win.src_h = state->src_w >> 16;
>  		break;
> @@ -149,7 +149,7 @@ static void omap_plane_atomic_disable(struct drm_plane *plane,
>  	struct omap_plane_state *omap_state = to_omap_plane_state(plane->state);
>  	struct omap_plane *omap_plane = to_omap_plane(plane);
>  
> -	plane->state->rotation = BIT(DRM_ROTATE_0);
> +	plane->state->rotation = DRM_ROTATE_0;
>  	omap_state->zorder = plane->type == DRM_PLANE_TYPE_PRIMARY
>  			   ? 0 : omap_plane->id;
>  
> @@ -178,7 +178,7 @@ static int omap_plane_atomic_check(struct drm_plane *plane,
>  		return -EINVAL;
>  
>  	if (state->fb) {
> -		if (state->rotation != BIT(DRM_ROTATE_0) &&
> +		if (state->rotation != DRM_ROTATE_0 &&
>  		    !omap_framebuffer_supports_rotation(state->fb))
>  			return -EINVAL;
>  	}
> @@ -269,7 +269,7 @@ static void omap_plane_reset(struct drm_plane *plane)
>  	 */
>  	omap_state->zorder = plane->type == DRM_PLANE_TYPE_PRIMARY
>  			   ? 0 : omap_plane->id;
> -	omap_state->base.rotation = BIT(DRM_ROTATE_0);
> +	omap_state->base.rotation = DRM_ROTATE_0;
>  
>  	plane->state = &omap_state->base;
>  	plane->state->plane = plane;
> diff --git a/include/drm/drm_crtc.h b/include/drm/drm_crtc.h
> index 3edeaf8..448625d 100644
> --- a/include/drm/drm_crtc.h
> +++ b/include/drm/drm_crtc.h
> @@ -83,14 +83,15 @@ static inline uint64_t I642U64(int64_t val)
>   * specified amount in degrees in counter clockwise direction. DRM_REFLECT_X and
>   * DRM_REFLECT_Y reflects the image along the specified axis prior to rotation
>   */
> -#define DRM_ROTATE_MASK 0x0f
> -#define DRM_ROTATE_0	0
> -#define DRM_ROTATE_90	1
> -#define DRM_ROTATE_180	2
> -#define DRM_ROTATE_270	3
> -#define DRM_REFLECT_MASK (~DRM_ROTATE_MASK)
> -#define DRM_REFLECT_X	4
> -#define DRM_REFLECT_Y	5
> +#define DRM_ROTATE_0	BIT(0)
> +#define DRM_ROTATE_90	BIT(1)
> +#define DRM_ROTATE_180	BIT(2)
> +#define DRM_ROTATE_270	BIT(3)
> +#define DRM_ROTATE_MASK (DRM_ROTATE_0   | DRM_ROTATE_90 | \
> +			 DRM_ROTATE_180 | DRM_ROTATE_270)
> +#define DRM_REFLECT_X	BIT(4)
> +#define DRM_REFLECT_Y	BIT(5)
> +#define DRM_REFLECT_MASK (DRM_REFLECT_X | DRM_REFLECT_Y)
>  
>  enum drm_connector_force {
>  	DRM_FORCE_UNSPECIFIED,
> -- 
> 2.5.5
> 
> _______________________________________________
> Intel-gfx mailing list
> Intel-gfx@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/intel-gfx
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

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

end of thread, other threads:[~2016-07-29 19:33 UTC | newest]

Thread overview: 14+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-07-25  7:00 [PATCH] drm: BIT(DRM_ROTATE_?) -> DRM_ROTATE_? Joonas Lahtinen
2016-07-25  7:39 ` ✗ Ro.CI.BAT: failure for " Patchwork
2016-07-25 10:23   ` Joonas Lahtinen
     [not found] ` <1469430025-13540-1-git-send-email-joonas.lahtinen-VuQAYsv1563Yd54FQh9/CA@public.gmane.org>
2016-07-26  9:05   ` [PATCH] " Liviu Dudau
2016-07-26 11:53     ` Joonas Lahtinen
2016-07-26 12:41 ` Ville Syrjälä
2016-07-26 14:49 ` Sean Paul
     [not found]   ` <CAOw6vbKGJYdN+aZqM7+EDGut3LU3YkDD1HT4QE=AObh4r2UVtQ-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2016-07-28  6:44     ` Joonas Lahtinen
2016-07-28 14:04       ` Sean Paul
2016-07-29  5:49         ` Joonas Lahtinen
2016-07-29  5:51           ` Joonas Lahtinen
2016-07-29  5:50         ` [PATCH v2] " Joonas Lahtinen
2016-07-29 19:33           ` Sean Paul
2016-07-29  6:16 ` ✗ Ro.CI.BAT: failure for drm: BIT(DRM_ROTATE_?) -> DRM_ROTATE_? (rev3) 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.