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

Commit f8909614 authored by Robert Foss's avatar Robert Foss Committed by Gerrit - the friendly Code Review server
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


Patch-mainline: 20170519205017.23307-2-robert.foss@collabora.com @ 19/05/17, 08:50 p.m.
[stalek@codeaurora.org:
1. Add and drop extra changes due to conflict.
2. Drop file malidp_drv.h, malidp_planes.c, armada_overlay.c, atmel_hlcdc_plane.c, i915_debugfs.c,
intel_atomic_plane.c, intel_display.c, intel_fbc.c, intel_fbdev.c, intel_sprite.c, ipuv3-plane.c,
imdp5_plane.c, nv50_display.c, omap_drv.c, omap_fb.c, omap_plane.c, vmwgfx_kms.c
2. Add changes in sde_plane.c to resolv compilation issues].

Change-Id: I2ad1b07bdb781bef45658ca0fd6a371f10a791ff
Signed-off-by: default avatarShubham Talekar <stalek@codeaurora.org>
parent e420f65b
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -2421,7 +2421,7 @@ int __drm_atomic_helper_set_config(struct drm_mode_set *set,
	primary_state->crtc_h = vdisplay;
	primary_state->src_x = set->x << 16;
	primary_state->src_y = set->y << 16;
	if (primary_state->rotation & (DRM_ROTATE_90 | DRM_ROTATE_270)) {
	if (primary_state->rotation & (DRM_MODE_ROTATE_90 | DRM_MODE_ROTATE_270)) {
		primary_state->src_w = vdisplay << 16;
		primary_state->src_h = hdisplay << 16;
	} else {
@@ -3106,7 +3106,7 @@ void drm_atomic_helper_plane_reset(struct drm_plane *plane)

	if (plane->state) {
		plane->state->plane = plane;
		plane->state->rotation = DRM_ROTATE_0;
		plane->state->rotation = DRM_MODE_ROTATE_0;
	}
}
EXPORT_SYMBOL(drm_atomic_helper_plane_reset);
+19 −19
Original line number Diff line number Diff line
@@ -126,15 +126,15 @@
 * drm_property_create_bitmask()) called "rotation" and has the following
 * bitmask enumaration values:
 *
 * DRM_ROTATE_0:
 * DRM_MODE_ROTATE_0:
 * 	"rotate-0"
 * DRM_ROTATE_90:
 * DRM_MODE_ROTATE_90:
 * 	"rotate-90"
 * DRM_ROTATE_180:
 * DRM_MODE_ROTATE_180:
 * 	"rotate-180"
 * DRM_ROTATE_270:
 * DRM_MODE_ROTATE_270:
 * 	"rotate-270"
 * DRM_REFLECT_X:
 * DRM_MODE_REFLECT_X:
 * 	"reflect-x"
 * DRM_REFELCT_Y:
 * 	"reflect-y"
@@ -148,12 +148,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[] = {
		{ __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" },
		{ __builtin_ffs(DRM_MODE_ROTATE_0) - 1,   "rotate-0" },
		{ __builtin_ffs(DRM_MODE_ROTATE_90) - 1,  "rotate-90" },
		{ __builtin_ffs(DRM_MODE_ROTATE_180) - 1, "rotate-180" },
		{ __builtin_ffs(DRM_MODE_ROTATE_270) - 1, "rotate-270" },
		{ __builtin_ffs(DRM_MODE_REFLECT_X) - 1,  "reflect-x" },
		{ __builtin_ffs(DRM_MODE_REFLECT_Y) - 1,  "reflect-y" },
	};

	return drm_property_create_bitmask(dev, 0, "rotation",
@@ -168,14 +168,14 @@ EXPORT_SYMBOL(drm_mode_create_rotation_property);
 * @supported_rotations: Supported rotations
 *
 * Attempt to simplify the rotation to a form that is supported.
 * Eg. if the hardware supports everything except DRM_REFLECT_X
 * Eg. if the hardware supports everything except DRM_MODE_REFLECT_X
 * one could call this function like this:
 *
 * drm_rotation_simplify(rotation, DRM_ROTATE_0 |
 *                       DRM_ROTATE_90 | DRM_ROTATE_180 |
 *                       DRM_ROTATE_270 | DRM_REFLECT_Y);
 * drm_rotation_simplify(rotation, DRM_MODE_ROTATE_0 |
 *                       DRM_MODE_ROTATE_90 | DRM_MODE_ROTATE_180 |
 *                       DRM_MODE_ROTATE_270 | DRM_MODE_REFLECT_Y);
 *
 * to eliminate the DRM_ROTATE_X flag. Depending on what kind of
 * to eliminate the DRM_MODE_ROTATE_X flag. Depending on what kind of
 * transforms the hardware supports, this function may not
 * be able to produce a supported transform, so the caller should
 * check the result afterwards.
@@ -184,9 +184,9 @@ unsigned int drm_rotation_simplify(unsigned int rotation,
				   unsigned int supported_rotations)
{
	if (rotation & ~supported_rotations) {
		rotation ^= DRM_REFLECT_X | DRM_REFLECT_Y;
		rotation = (rotation & DRM_REFLECT_MASK) |
		           BIT((ffs(rotation & DRM_ROTATE_MASK) + 1) % 4);
		rotation ^= DRM_MODE_REFLECT_X | DRM_MODE_REFLECT_Y;
		rotation = (rotation & DRM_MODE_REFLECT_MASK) |
		           BIT((ffs(rotation & DRM_MODE_ROTATE_MASK) + 1) % 4);
	}

	return rotation;
+2 −2
Original line number Diff line number Diff line
@@ -763,8 +763,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 & (DRM_ROTATE_90 |
					      DRM_ROTATE_270))
	    crtc->primary->state->rotation & (DRM_MODE_ROTATE_90 |
					      DRM_MODE_ROTATE_270))
		swap(hdisplay, vdisplay);

	return drm_framebuffer_check_src_coords(x << 16, y << 16,
+2 −2
Original line number Diff line number Diff line
@@ -342,7 +342,7 @@ static int restore_fbdev_mode_atomic(struct drm_fb_helper *fb_helper)
			goto fail;
		}

		plane_state->rotation = DRM_ROTATE_0;
		plane_state->rotation = DRM_MODE_ROTATE_0;

		plane->old_fb = plane->fb;
		plane_mask |= 1 << drm_plane_index(plane);
@@ -402,7 +402,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,
						    DRM_ROTATE_0);
						    DRM_MODE_ROTATE_0);
		}
	}

+1 −1
Original line number Diff line number Diff line
@@ -337,7 +337,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,
					    DRM_ROTATE_0,
					    DRM_MODE_ROTATE_0,
					    DRM_PLANE_HELPER_NO_SCALING,
					    DRM_PLANE_HELPER_NO_SCALING,
					    false, false, &visible);
Loading