Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit c2c446ad authored by Robert Foss's avatar Robert Foss Committed by Daniel Vetter
Browse files

drm: Add DRM_MODE_ROTATE_ and DRM_MODE_REFLECT_ to UAPI



Add DRM_MODE_ROTATE_ and DRM_MODE_REFLECT_ defines to the UAPI
as a convenience.

Ideally the DRM_ROTATE_ and DRM_REFLECT_ property ids are looked up
through the atomic API, but realizing that userspace is likely to take
shortcuts and assume that the enum values are what is sent over the
wire.

As a result these defines are provided purely as a convenience to
userspace applications.

Changes since v3:
 - Switched away from past tense in comments
 - Add define name change to previously mis-spelled DRM_REFLECT_X comment
 - Improved the comment for the DRM_MODE_REFLECT_<axis> comment

Changes since v2:
 - Changed define prefix from DRM_MODE_PROP_ to DRM_MODE_
 - Fix compilation errors
 - Changed comment formatting
 - Deduplicated comment lines
 - Clarified DRM_MODE_PROP_REFLECT_ comment

Changes since v1:
 - Moved defines from drm.h to drm_mode.h
 - Changed define prefix from DRM_ to DRM_MODE_PROP_
 - Updated uses of the defines to the new prefix
 - Removed include from drm_rect.c
 - Stopped using the BIT() macro

Signed-off-by: default avatarRobert Foss <robert.foss@collabora.com>
Reviewed-by: default avatarEmil Velikov <emil.velikov@collabora.com>
Reviewed-by: default avatarSinclair Yeh <syeh@vmware.com>
Acked-by: default avatarLiviu Dudau <Liviu.Dudau@arm.com>
Signed-off-by: default avatarDaniel Vetter <daniel.vetter@ffwll.ch>
Link: http://patchwork.freedesktop.org/patch/msgid/20170519205017.23307-2-robert.foss@collabora.com
parent e8fa49b5
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -65,6 +65,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	(DRM_ROTATE_90 | DRM_ROTATE_270)
#define MALIDP_ROTATED_MASK	(DRM_MODE_ROTATE_90 | DRM_MODE_ROTATE_270)

#endif  /* __MALIDP_DRV_H__ */
+9 −9
Original line number Diff line number Diff line
@@ -80,7 +80,7 @@ static void malidp_plane_reset(struct drm_plane *plane)
	state = kzalloc(sizeof(*state), GFP_KERNEL);
	if (state) {
		state->base.plane = plane;
		state->base.rotation = DRM_ROTATE_0;
		state->base.rotation = DRM_MODE_ROTATE_0;
		plane->state = &state->base;
	}
}
@@ -221,7 +221,7 @@ static int malidp_de_plane_check(struct drm_plane *plane,
		return ret;

	/* packed RGB888 / BGR888 can't be rotated or flipped */
	if (state->rotation != DRM_ROTATE_0 &&
	if (state->rotation != DRM_MODE_ROTATE_0 &&
	    (fb->format->format == DRM_FORMAT_RGB888 ||
	     fb->format->format == DRM_FORMAT_BGR888))
		return -EINVAL;
@@ -315,12 +315,12 @@ static void malidp_de_plane_update(struct drm_plane *plane,
	val &= ~LAYER_ROT_MASK;

	/* setup the rotation and axis flip bits */
	if (plane->state->rotation & DRM_ROTATE_MASK)
		val |= ilog2(plane->state->rotation & DRM_ROTATE_MASK) <<
	if (plane->state->rotation & DRM_MODE_ROTATE_MASK)
		val |= ilog2(plane->state->rotation & DRM_MODE_ROTATE_MASK) <<
		       LAYER_ROT_OFFSET;
	if (plane->state->rotation & DRM_REFLECT_X)
	if (plane->state->rotation & DRM_MODE_REFLECT_X)
		val |= LAYER_H_FLIP;
	if (plane->state->rotation & DRM_REFLECT_Y)
	if (plane->state->rotation & DRM_MODE_REFLECT_Y)
		val |= LAYER_V_FLIP;

	/*
@@ -370,8 +370,8 @@ int malidp_de_planes_init(struct drm_device *drm)
	struct malidp_plane *plane = NULL;
	enum drm_plane_type plane_type;
	unsigned long crtcs = 1 << drm->mode_config.num_crtc;
	unsigned long flags = DRM_ROTATE_0 | DRM_ROTATE_90 | DRM_ROTATE_180 |
			      DRM_ROTATE_270 | DRM_REFLECT_X | DRM_REFLECT_Y;
	unsigned long flags = DRM_MODE_ROTATE_0 | DRM_MODE_ROTATE_90 | DRM_MODE_ROTATE_180 |
			      DRM_MODE_ROTATE_270 | DRM_MODE_REFLECT_X | DRM_MODE_REFLECT_Y;
	u32 *formats;
	int ret, i, j, n;

@@ -420,7 +420,7 @@ int malidp_de_planes_init(struct drm_device *drm)
			continue;
		}

		drm_plane_create_rotation_property(&plane->base, DRM_ROTATE_0, flags);
		drm_plane_create_rotation_property(&plane->base, DRM_MODE_ROTATE_0, flags);
		malidp_hw_write(malidp->dev, MALIDP_ALPHA_LUT,
				plane->layer->base + MALIDP_LAYER_COMPOSE);
	}
+1 −1
Original line number Diff line number Diff line
@@ -125,7 +125,7 @@ armada_ovl_plane_update(struct drm_plane *plane, struct drm_crtc *crtc,
				 src_x, src_y, src_w, src_h);

	ret = drm_plane_helper_check_update(plane, crtc, fb, &src, &dest, &clip,
					    DRM_ROTATE_0,
					    DRM_MODE_ROTATE_0,
					    0, INT_MAX, true, false, &visible);
	if (ret)
		return ret;
+10 −10
Original line number Diff line number Diff line
@@ -678,8 +678,8 @@ static int atmel_hlcdc_plane_atomic_check(struct drm_plane *p,
		if (!state->bpp[i])
			return -EINVAL;

		switch (state->base.rotation & DRM_ROTATE_MASK) {
		case DRM_ROTATE_90:
		switch (state->base.rotation & DRM_MODE_ROTATE_MASK) {
		case DRM_MODE_ROTATE_90:
			offset = ((y_offset + state->src_y + patched_src_w - 1) /
				  ydiv) * fb->pitches[i];
			offset += ((x_offset + state->src_x) / xdiv) *
@@ -688,7 +688,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 DRM_ROTATE_180:
		case DRM_MODE_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) /
@@ -697,7 +697,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 DRM_ROTATE_270:
		case DRM_MODE_ROTATE_270:
			offset = ((y_offset + state->src_y) / ydiv) *
				 fb->pitches[i];
			offset += ((x_offset + state->src_x + patched_src_h - 1) /
@@ -707,7 +707,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 DRM_ROTATE_0:
		case DRM_MODE_ROTATE_0:
		default:
			offset = ((y_offset + state->src_y) / ydiv) *
				 fb->pitches[i];
@@ -864,11 +864,11 @@ static int atmel_hlcdc_plane_init_properties(struct atmel_hlcdc_plane *plane,
		int ret;

		ret = drm_plane_create_rotation_property(&plane->base,
							 DRM_ROTATE_0,
							 DRM_ROTATE_0 |
							 DRM_ROTATE_90 |
							 DRM_ROTATE_180 |
							 DRM_ROTATE_270);
							 DRM_MODE_ROTATE_0,
							 DRM_MODE_ROTATE_0 |
							 DRM_MODE_ROTATE_90 |
							 DRM_MODE_ROTATE_180 |
							 DRM_MODE_ROTATE_270);
		if (ret)
			return ret;
	}
+1 −1
Original line number Diff line number Diff line
@@ -781,7 +781,7 @@ int drm_atomic_plane_set_property(struct drm_plane *plane,
	} else if (property == config->prop_src_h) {
		state->src_h = val;
	} else if (property == plane->rotation_property) {
		if (!is_power_of_2(val & DRM_ROTATE_MASK))
		if (!is_power_of_2(val & DRM_MODE_ROTATE_MASK))
			return -EINVAL;
		state->rotation = val;
	} else if (property == plane->zpos_property) {
Loading