Commit 31ad61e4 authored by Joonas Lahtinen's avatar Joonas Lahtinen Committed by Sean Paul
Browse files

drm: BIT(DRM_ROTATE_?) -> DRM_ROTATE_?



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: default avatarLiviu Dudau <Liviu.Dudau@arm.com>
Reviewed-by: Ville Syrjälä <ville.syrjala@linux.intel.com> (v1)
Signed-off-by: default avatarJoonas Lahtinen <joonas.lahtinen@linux.intel.com>
Signed-off-by: default avatarSean Paul <seanpaul@chromium.org>
Link: http://patchwork.freedesktop.org/patch/msgid/1469771405-17653-1-git-send-email-joonas.lahtinen@linux.intel.com
parent fcc60b41
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -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__ */
+10 −10
Original line number Diff line number Diff line
@@ -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);
+1 −1
Original line number Diff line number Diff line
@@ -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;
+11 −11
Original line number Diff line number Diff line
@@ -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);

+2 −2
Original line number Diff line number Diff line
@@ -2362,7 +2362,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 {
@@ -3047,7 +3047,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);
Loading