[v2] drm: Add DRM_ROTATE_ and DRM_REFLECT_ defines to UAPI
diff mbox

Message ID 20170516155500.25616-1-robert.foss@collabora.com
State New
Headers show

Commit Message

Robert Foss May 16, 2017, 3:55 p.m. UTC
Add DRM_ROTATE_ and DRM_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.

Signed-off-by: Robert Foss <robert.foss@collabora.com>
---
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

 drivers/gpu/drm/drm_atomic.c           |  2 +-
 drivers/gpu/drm/drm_atomic_helper.c    |  2 +-
 drivers/gpu/drm/drm_blend.c            | 43 +++++++++----------
 drivers/gpu/drm/drm_fb_helper.c        |  4 +-
 drivers/gpu/drm/drm_plane_helper.c     |  2 +-
 drivers/gpu/drm/drm_rect.c             | 36 ++++++++--------
 drivers/gpu/drm/nouveau/nv50_display.c |  2 +-
 include/drm/drm_blend.h                | 21 +---------
 include/uapi/drm/drm_mode.h            | 76 ++++++++++++++++++++++++++++++++++
 9 files changed, 124 insertions(+), 64 deletions(-)

Comments

Ville Syrjala May 16, 2017, 4:20 p.m. UTC | #1
On Tue, May 16, 2017 at 11:55:00AM -0400, Robert Foss wrote:
> Add DRM_ROTATE_ and DRM_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.
> 
> Signed-off-by: Robert Foss <robert.foss@collabora.com>
> ---
> Changes since v1:
>  - Moved defines from drm.h to drm_mode.h
>  - Changed define prefix from DRM_ to DRM_MODE_PROP_

DRM_MODE_PROP_ would potentially cause confusion with the prop types.
DRM_MODE_ROTATE_ etc. could be acceptable I suppose.

>  - Updated uses of the defines to the new prefix
>  - Removed include from drm_rect.c
>  - Stopped using the BIT() macro
> 
>  drivers/gpu/drm/drm_atomic.c           |  2 +-
>  drivers/gpu/drm/drm_atomic_helper.c    |  2 +-
>  drivers/gpu/drm/drm_blend.c            | 43 +++++++++----------
>  drivers/gpu/drm/drm_fb_helper.c        |  4 +-
>  drivers/gpu/drm/drm_plane_helper.c     |  2 +-
>  drivers/gpu/drm/drm_rect.c             | 36 ++++++++--------
>  drivers/gpu/drm/nouveau/nv50_display.c |  2 +-
>  include/drm/drm_blend.h                | 21 +---------
>  include/uapi/drm/drm_mode.h            | 76 ++++++++++++++++++++++++++++++++++

I'm pretty sure this won't even compile properly since it's missing all
but one driver.

>  9 files changed, 124 insertions(+), 64 deletions(-)
> 
> diff --git a/drivers/gpu/drm/drm_atomic.c b/drivers/gpu/drm/drm_atomic.c
> index f32506a7c1d6..ec1839b01d2a 100644
> --- a/drivers/gpu/drm/drm_atomic.c
> +++ b/drivers/gpu/drm/drm_atomic.c
> @@ -769,7 +769,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_PROP_ROTATE_MASK))
>  			return -EINVAL;
>  		state->rotation = val;
>  	} else if (property == plane->zpos_property) {
> diff --git a/drivers/gpu/drm/drm_atomic_helper.c b/drivers/gpu/drm/drm_atomic_helper.c
> index 8be9719284b0..37f461aa5e66 100644
> --- a/drivers/gpu/drm/drm_atomic_helper.c
> +++ b/drivers/gpu/drm/drm_atomic_helper.c
> @@ -3220,7 +3220,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_PROP_ROTATE_0;
>  	}
>  }
>  EXPORT_SYMBOL(drm_atomic_helper_plane_reset);
> diff --git a/drivers/gpu/drm/drm_blend.c b/drivers/gpu/drm/drm_blend.c
> index a0d0d6843288..044640a04d51 100644
> --- a/drivers/gpu/drm/drm_blend.c
> +++ b/drivers/gpu/drm/drm_blend.c
> @@ -119,15 +119,15 @@
>   * drm_property_create_bitmask()) called "rotation" and has the following
>   * bitmask enumaration values:
>   *
> - * DRM_ROTATE_0:
> + * DRM_MODE_PROP_ROTATE_0:
>   * 	"rotate-0"
> - * DRM_ROTATE_90:
> + * DRM_MODE_PROP_ROTATE_90:
>   * 	"rotate-90"
> - * DRM_ROTATE_180:
> + * DRM_MODE_PROP_ROTATE_180:
>   * 	"rotate-180"
> - * DRM_ROTATE_270:
> + * DRM_MODE_PROP_ROTATE_270:
>   * 	"rotate-270"
> - * DRM_REFLECT_X:
> + * DRM_MODE_PROP_REFLECT_X:
>   * 	"reflect-x"
>   * DRM_REFELCT_Y:
>   * 	"reflect-y"
> @@ -142,17 +142,17 @@ int drm_plane_create_rotation_property(struct drm_plane *plane,
>  				       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_PROP_ROTATE_0) - 1,   "rotate-0" },
> +		{ __builtin_ffs(DRM_MODE_PROP_ROTATE_90) - 1,  "rotate-90" },
> +		{ __builtin_ffs(DRM_MODE_PROP_ROTATE_180) - 1, "rotate-180" },
> +		{ __builtin_ffs(DRM_MODE_PROP_ROTATE_270) - 1, "rotate-270" },
> +		{ __builtin_ffs(DRM_MODE_PROP_REFLECT_X) - 1,  "reflect-x" },
> +		{ __builtin_ffs(DRM_MODE_PROP_REFLECT_Y) - 1,  "reflect-y" },
>  	};
>  	struct drm_property *prop;
>  
> -	WARN_ON((supported_rotations & DRM_ROTATE_MASK) == 0);
> -	WARN_ON(!is_power_of_2(rotation & DRM_ROTATE_MASK));
> +	WARN_ON((supported_rotations & DRM_MODE_PROP_ROTATE_MASK) == 0);
> +	WARN_ON(!is_power_of_2(rotation & DRM_MODE_PROP_ROTATE_MASK));
>  	WARN_ON(rotation & ~supported_rotations);
>  
>  	prop = drm_property_create_bitmask(plane->dev, 0, "rotation",
> @@ -178,14 +178,14 @@ EXPORT_SYMBOL(drm_plane_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_PROP_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_PROP_ROTATE_0 |
> + *                       DRM_MODE_PROP_ROTATE_90 | DRM_MODE_PROP_ROTATE_180 |
> + *                       DRM_MODE_PROP_ROTATE_270 | DRM_MODE_PROP_REFLECT_Y);
>   *
> - * to eliminate the DRM_ROTATE_X flag. Depending on what kind of
> + * to eliminate the DRM_MODE_PROP_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.
> @@ -194,9 +194,10 @@ 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_PROP_REFLECT_X | DRM_MODE_PROP_REFLECT_Y;
> +		rotation = (rotation & DRM_MODE_PROP_REFLECT_MASK) |
> +		           BIT((ffs(rotation & DRM_MODE_PROP_ROTATE_MASK) + 1)
> +		           % 4);
>  	}
>  
>  	return rotation;
> diff --git a/drivers/gpu/drm/drm_fb_helper.c b/drivers/gpu/drm/drm_fb_helper.c
> index 1f178b878e42..0af024a9ff1d 100644
> --- a/drivers/gpu/drm/drm_fb_helper.c
> +++ b/drivers/gpu/drm/drm_fb_helper.c
> @@ -378,7 +378,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_PROP_ROTATE_0;
>  
>  		plane->old_fb = plane->fb;
>  		plane_mask |= 1 << drm_plane_index(plane);
> @@ -431,7 +431,7 @@ static int restore_fbdev_mode_legacy(struct drm_fb_helper *fb_helper)
>  		if (plane->rotation_property)
>  			drm_mode_plane_set_obj_prop(plane,
>  						    plane->rotation_property,
> -						    DRM_ROTATE_0);
> +						    DRM_MODE_PROP_ROTATE_0);
>  	}
>  
>  	for (i = 0; i < fb_helper->crtc_count; i++) {
> diff --git a/drivers/gpu/drm/drm_plane_helper.c b/drivers/gpu/drm/drm_plane_helper.c
> index b84a295230fc..d46deea69baf 100644
> --- a/drivers/gpu/drm/drm_plane_helper.c
> +++ b/drivers/gpu/drm/drm_plane_helper.c
> @@ -336,7 +336,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_PROP_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 bc5575960ebc..5adb528adb88 100644
> --- a/drivers/gpu/drm/drm_rect.c
> +++ b/drivers/gpu/drm/drm_rect.c
> @@ -310,38 +310,38 @@ void drm_rect_rotate(struct drm_rect *r,
>  {
>  	struct drm_rect tmp;
>  
> -	if (rotation & (DRM_REFLECT_X | DRM_REFLECT_Y)) {
> +	if (rotation & (DRM_MODE_PROP_REFLECT_X | DRM_MODE_PROP_REFLECT_Y)) {
>  		tmp = *r;
>  
> -		if (rotation & DRM_REFLECT_X) {
> +		if (rotation & DRM_MODE_PROP_REFLECT_X) {
>  			r->x1 = width - tmp.x2;
>  			r->x2 = width - tmp.x1;
>  		}
>  
> -		if (rotation & DRM_REFLECT_Y) {
> +		if (rotation & DRM_MODE_PROP_REFLECT_Y) {
>  			r->y1 = height - tmp.y2;
>  			r->y2 = height - tmp.y1;
>  		}
>  	}
>  
> -	switch (rotation & DRM_ROTATE_MASK) {
> -	case DRM_ROTATE_0:
> +	switch (rotation & DRM_MODE_PROP_ROTATE_MASK) {
> +	case DRM_MODE_PROP_ROTATE_0:
>  		break;
> -	case DRM_ROTATE_90:
> +	case DRM_MODE_PROP_ROTATE_90:
>  		tmp = *r;
>  		r->x1 = tmp.y1;
>  		r->x2 = tmp.y2;
>  		r->y1 = width - tmp.x2;
>  		r->y2 = width - tmp.x1;
>  		break;
> -	case DRM_ROTATE_180:
> +	case DRM_MODE_PROP_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 DRM_ROTATE_270:
> +	case DRM_MODE_PROP_ROTATE_270:
>  		tmp = *r;
>  		r->x1 = height - tmp.y2;
>  		r->x2 = height - tmp.y1;
> @@ -373,8 +373,8 @@ EXPORT_SYMBOL(drm_rect_rotate);
>   * them when doing a rotatation and its inverse.
>   * That is, if you do ::
>   *
> - *     drm_rotate(&r, width, height, rotation);
> - *     drm_rotate_inv(&r, width, height, rotation);
> + *     DRM_MODE_PROP_ROTATE(&r, width, height, rotation);
> + *     DRM_MODE_PROP_ROTATE_inv(&r, width, height, rotation);
>   *
>   * you will always get back the original rectangle.
>   */
> @@ -384,24 +384,24 @@ void drm_rect_rotate_inv(struct drm_rect *r,
>  {
>  	struct drm_rect tmp;
>  
> -	switch (rotation & DRM_ROTATE_MASK) {
> -	case DRM_ROTATE_0:
> +	switch (rotation & DRM_MODE_PROP_ROTATE_MASK) {
> +	case DRM_MODE_PROP_ROTATE_0:
>  		break;
> -	case DRM_ROTATE_90:
> +	case DRM_MODE_PROP_ROTATE_90:
>  		tmp = *r;
>  		r->x1 = width - tmp.y2;
>  		r->x2 = width - tmp.y1;
>  		r->y1 = tmp.x1;
>  		r->y2 = tmp.x2;
>  		break;
> -	case DRM_ROTATE_180:
> +	case DRM_MODE_PROP_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 DRM_ROTATE_270:
> +	case DRM_MODE_PROP_ROTATE_270:
>  		tmp = *r;
>  		r->x1 = tmp.y1;
>  		r->x2 = tmp.y2;
> @@ -412,15 +412,15 @@ void drm_rect_rotate_inv(struct drm_rect *r,
>  		break;
>  	}
>  
> -	if (rotation & (DRM_REFLECT_X | DRM_REFLECT_Y)) {
> +	if (rotation & (DRM_MODE_PROP_REFLECT_X | DRM_MODE_PROP_REFLECT_Y)) {
>  		tmp = *r;
>  
> -		if (rotation & DRM_REFLECT_X) {
> +		if (rotation & DRM_MODE_PROP_REFLECT_X) {
>  			r->x1 = width - tmp.x2;
>  			r->x2 = width - tmp.x1;
>  		}
>  
> -		if (rotation & DRM_REFLECT_Y) {
> +		if (rotation & DRM_MODE_PROP_REFLECT_Y) {
>  			r->y1 = height - tmp.y2;
>  			r->y2 = height - tmp.y1;
>  		}
> diff --git a/drivers/gpu/drm/nouveau/nv50_display.c b/drivers/gpu/drm/nouveau/nv50_display.c
> index a7663249b3ba..082c1012b138 100644
> --- a/drivers/gpu/drm/nouveau/nv50_display.c
> +++ b/drivers/gpu/drm/nouveau/nv50_display.c
> @@ -1033,7 +1033,7 @@ nv50_wndw_reset(struct drm_plane *plane)
>  		plane->funcs->atomic_destroy_state(plane, plane->state);
>  	plane->state = &asyw->state;
>  	plane->state->plane = plane;
> -	plane->state->rotation = DRM_ROTATE_0;
> +	plane->state->rotation = DRM_MODE_PROP_ROTATE_0;
>  }
>  
>  static void
> diff --git a/include/drm/drm_blend.h b/include/drm/drm_blend.h
> index 13221cf9b3eb..b59708c1e7a6 100644
> --- a/include/drm/drm_blend.h
> +++ b/include/drm/drm_blend.h
> @@ -25,31 +25,14 @@
>  
>  #include <linux/list.h>
>  #include <linux/ctype.h>
> +#include <drm/drm_mode.h>
>  
>  struct drm_device;
>  struct drm_atomic_state;
>  
> -/*
> - * Rotation property bits. DRM_ROTATE_<degrees> rotates the image by the
> - * 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
> - *
> - * WARNING: These defines are UABI since they're exposed in the rotation
> - * property.
> - */
> -#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)
> -
>  static inline bool drm_rotation_90_or_270(unsigned int rotation)
>  {
> -	return rotation & (DRM_ROTATE_90 | DRM_ROTATE_270);
> +	return rotation & (DRM_MODE_PROP_ROTATE_90 | DRM_MODE_PROP_ROTATE_270);
>  }
>  
>  int drm_plane_create_rotation_property(struct drm_plane *plane,
> diff --git a/include/uapi/drm/drm_mode.h b/include/uapi/drm/drm_mode.h
> index 8c67fc03d53d..787a70ba974c 100644
> --- a/include/uapi/drm/drm_mode.h
> +++ b/include/uapi/drm/drm_mode.h
> @@ -127,6 +127,82 @@ extern "C" {
>  #define DRM_MODE_LINK_STATUS_GOOD	0
>  #define DRM_MODE_LINK_STATUS_BAD	1
>  
> +/** DRM_MODE_PROP_ROTATE_0

Is this supposed to be kernel-doc or something like that?

> + *
> + * Signals that a drm plane has been rotated 0 degrees.

Past tense doesn't feel right to me. Maybe "is rotated"?
But I'm not a native speaker so maybe it's just me.

> + *
> + * This define is provided as a convenience, looking up the property id
> + * using the name->prop id lookup is the preferred method.

Repeating this for every define seems redundant.

> + */
> +#define DRM_MODE_PROP_ROTATE_0           (1<<0)
> +
> +/** DRM_MODE_PROP_ROTATE_90
> + *
> + * Signals that a drm plane has been rotated 90 degrees in counter clockwise
> + * direction.
> + *
> + * This define is provided as a convenience, looking up the property id
> + * using the name->prop id lookup is the preferred method.
> + */
> +#define DRM_MODE_PROP_ROTATE_90          (1<<1)
> +
> +/** DRM_MODE_PROP_ROTATE_180
> + *
> + * Signals that a drm plane has been rotated 180 degrees in counter clockwise
> + * direction.
> + *
> + * This define is provided as a convenience, looking up the property id
> + * using the name->prop id lookup is the preferred method.
> + */
> +#define DRM_MODE_PROP_ROTATE_180         (1<<2)
> +
> +/** DRM_MODE_PROP_ROTATE_270
> + *
> + * Signals that a drm plane has been rotated 270 degrees in counter clockwise
> + * direction.
> + *
> + * This define is provided as a convenience, looking up the property id
> + * using the name->prop id lookup is the preferred method.
> + */
> +#define DRM_MODE_PROP_ROTATE_270         (1<<3)
> +
> +
> +/** DRM_MODE_PROP_ROTATE_MASK
> + *
> + * Bitmask used to look for drm plane rotations.
> + */
> +#define DRM_MODE_PROP_ROTATE_MASK (DRM_MODE_PROP_ROTATE_0  | \
> +                                  DRM_MODE_PROP_ROTATE_90  | \
> +                                  DRM_MODE_PROP_ROTATE_180 | \
> +                                  DRM_MODE_PROP_ROTATE_270)
> +
> +/** DRM_MODE_PROP_REFLECT_X
> + *
> + * Signals that a drm plane has been reflected in the X axis.

Seems more vague that what we had before.

> + *
> + * This define is provided as a convenience, looking up the property id
> + * using the name->prop id lookup is the preferred method.
> + */
> +#define DRM_MODE_PROP_REFLECT_X          (1<<4)
> +
> +/** DRM_MODE_PROP_REFLECT_Y
> + *
> + * Signals that a drm plane has been reflected in the Y axis.
> + *
> + * This define is provided as a convenience, looking up the property id
> + * using the name->prop id lookup is the preferred method.
> + */
> +#define DRM_MODE_PROP_REFLECT_Y          (1<<5)
> +
> +
> +/** DRM_MODE_PROP_REFLECT_MASK
> + *
> + * Bitmask used to look for drm plane reflections.
> + */
> +#define DRM_MODE_PROP_REFLECT_MASK (DRM_MODE_PROP_REFLECT_X \
> +                                   | DRM_MODE_PROP_REFLECT_Y)
> +
> +
>  struct drm_mode_modeinfo {
>  	__u32 clock;
>  	__u16 hdisplay;
> -- 
> 2.11.0.453.g787f75f05
> 
> _______________________________________________
> dri-devel mailing list
> dri-devel@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/dri-devel
kernel test robot May 16, 2017, 6:41 p.m. UTC | #2
Hi Robert,

[auto build test ERROR on drm/drm-next]
[also build test ERROR on v4.12-rc1 next-20170516]
[if your patch is applied to the wrong git tree, please drop us a note to help improve the system]

url:    https://github.com/0day-ci/linux/commits/Robert-Foss/drm-Add-DRM_ROTATE_-and-DRM_REFLECT_-defines-to-UAPI/20170517-003242
base:   git://people.freedesktop.org/~airlied/linux.git drm-next
config: arm64-defconfig (attached as .config)
compiler: aarch64-linux-gnu-gcc (Debian 6.1.1-9) 6.1.1 20160705
reproduce:
        wget https://raw.githubusercontent.com/01org/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
        chmod +x ~/bin/make.cross
        # save the attached .config to linux build tree
        make.cross ARCH=arm64 

All errors (new ones prefixed by >>):

   drivers/gpu/drm/msm/mdp/mdp5/mdp5_plane.c: In function 'mdp5_plane_install_rotation_property':
>> drivers/gpu/drm/msm/mdp/mdp5/mdp5_plane.c:70:9: error: 'DRM_ROTATE_0' undeclared (first use in this function)
            DRM_ROTATE_0,
            ^~~~~~~~~~~~
   drivers/gpu/drm/msm/mdp/mdp5/mdp5_plane.c:70:9: note: each undeclared identifier is reported only once for each function it appears in
>> drivers/gpu/drm/msm/mdp/mdp5/mdp5_plane.c:72:9: error: 'DRM_ROTATE_180' undeclared (first use in this function)
            DRM_ROTATE_180 |
            ^~~~~~~~~~~~~~
>> drivers/gpu/drm/msm/mdp/mdp5/mdp5_plane.c:73:9: error: 'DRM_REFLECT_X' undeclared (first use in this function)
            DRM_REFLECT_X |
            ^~~~~~~~~~~~~
>> drivers/gpu/drm/msm/mdp/mdp5/mdp5_plane.c:74:9: error: 'DRM_REFLECT_Y' undeclared (first use in this function)
            DRM_REFLECT_Y);
            ^~~~~~~~~~~~~
   drivers/gpu/drm/msm/mdp/mdp5/mdp5_plane.c: In function 'mdp5_plane_atomic_check_with_state':
   drivers/gpu/drm/msm/mdp/mdp5/mdp5_plane.c:372:8: error: 'DRM_ROTATE_0' undeclared (first use in this function)
           DRM_ROTATE_0 |
           ^~~~~~~~~~~~
   drivers/gpu/drm/msm/mdp/mdp5/mdp5_plane.c:373:8: error: 'DRM_REFLECT_X' undeclared (first use in this function)
           DRM_REFLECT_X |
           ^~~~~~~~~~~~~
   drivers/gpu/drm/msm/mdp/mdp5/mdp5_plane.c:374:8: error: 'DRM_REFLECT_Y' undeclared (first use in this function)
           DRM_REFLECT_Y);
           ^~~~~~~~~~~~~
   drivers/gpu/drm/msm/mdp/mdp5/mdp5_plane.c: In function 'mdp5_plane_mode_set':
   drivers/gpu/drm/msm/mdp/mdp5/mdp5_plane.c:973:7: error: 'DRM_ROTATE_0' undeclared (first use in this function)
          DRM_ROTATE_0 |
          ^~~~~~~~~~~~
   drivers/gpu/drm/msm/mdp/mdp5/mdp5_plane.c:974:7: error: 'DRM_REFLECT_X' undeclared (first use in this function)
          DRM_REFLECT_X |
          ^~~~~~~~~~~~~
   drivers/gpu/drm/msm/mdp/mdp5/mdp5_plane.c:975:7: error: 'DRM_REFLECT_Y' undeclared (first use in this function)
          DRM_REFLECT_Y);
          ^~~~~~~~~~~~~

vim +/DRM_ROTATE_0 +70 drivers/gpu/drm/msm/mdp/mdp5/mdp5_plane.c

06c0dd96 Rob Clark     2013-11-30  64  }
06c0dd96 Rob Clark     2013-11-30  65  
8089082f jilai wang    2015-07-31  66  static void mdp5_plane_install_rotation_property(struct drm_device *dev,
8089082f jilai wang    2015-07-31  67  		struct drm_plane *plane)
8089082f jilai wang    2015-07-31  68  {
5b560c3a Ville Syrjälä 2016-10-21  69  	drm_plane_create_rotation_property(plane,
5b560c3a Ville Syrjälä 2016-10-21 @70  					   DRM_ROTATE_0,
5b560c3a Ville Syrjälä 2016-10-21  71  					   DRM_ROTATE_0 |
574a37b1 Ville Syrjälä 2016-10-21 @72  					   DRM_ROTATE_180 |
5b560c3a Ville Syrjälä 2016-10-21 @73  					   DRM_REFLECT_X |
5b560c3a Ville Syrjälä 2016-10-21 @74  					   DRM_REFLECT_Y);
8089082f jilai wang    2015-07-31  75  }
8089082f jilai wang    2015-07-31  76  
06c0dd96 Rob Clark     2013-11-30  77  /* helper to install properties which are common to planes and crtcs */

:::::: The code at line 70 was first introduced by commit
:::::: 5b560c3a99a0d1a65132ce6f2f5a8505536613e4 drm/msm/mdp5: Use per-plane rotation property

:::::: TO: Ville Syrjälä <ville.syrjala@linux.intel.com>
:::::: CC: Daniel Vetter <daniel.vetter@ffwll.ch>

---
0-DAY kernel test infrastructure                Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all                   Intel Corporation
kernel test robot May 16, 2017, 7:19 p.m. UTC | #3
Hi Robert,

[auto build test ERROR on drm/drm-next]
[also build test ERROR on v4.12-rc1 next-20170516]
[if your patch is applied to the wrong git tree, please drop us a note to help improve the system]

url:    https://github.com/0day-ci/linux/commits/Robert-Foss/drm-Add-DRM_ROTATE_-and-DRM_REFLECT_-defines-to-UAPI/20170517-003242
base:   git://people.freedesktop.org/~airlied/linux.git drm-next
config: arm-allmodconfig (attached as .config)
compiler: arm-linux-gnueabi-gcc (Debian 6.1.1-9) 6.1.1 20160705
reproduce:
        wget https://raw.githubusercontent.com/01org/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
        chmod +x ~/bin/make.cross
        # save the attached .config to linux build tree
        make.cross ARCH=arm 

All error/warnings (new ones prefixed by >>):

   drivers/gpu//drm/imx/ipuv3-plane.c: In function 'ipu_plane_state_reset':
>> drivers/gpu//drm/imx/ipuv3-plane.c:276:30: error: 'DRM_ROTATE_0' undeclared (first use in this function)
      ipu_state->base.rotation = DRM_ROTATE_0;
                                 ^~~~~~~~~~~~
   drivers/gpu//drm/imx/ipuv3-plane.c:276:30: note: each undeclared identifier is reported only once for each function it appears in
--
   drivers/gpu//drm/omapdrm/omap_drv.c: In function 'dev_lastclose':
>> drivers/gpu//drm/omapdrm/omap_drv.c:580:12: error: 'DRM_ROTATE_0' undeclared (first use in this function)
               DRM_ROTATE_0);
               ^~~~~~~~~~~~
   drivers/gpu//drm/omapdrm/omap_drv.c:580:12: note: each undeclared identifier is reported only once for each function it appears in
--
   drivers/gpu//drm/omapdrm/omap_plane.c: In function 'omap_plane_atomic_disable':
>> drivers/gpu//drm/omapdrm/omap_plane.c:144:27: error: 'DRM_ROTATE_0' undeclared (first use in this function)
     plane->state->rotation = DRM_ROTATE_0;
                              ^~~~~~~~~~~~
   drivers/gpu//drm/omapdrm/omap_plane.c:144:27: note: each undeclared identifier is reported only once for each function it appears in
   drivers/gpu//drm/omapdrm/omap_plane.c: In function 'omap_plane_atomic_check':
   drivers/gpu//drm/omapdrm/omap_plane.c:180:25: error: 'DRM_ROTATE_0' undeclared (first use in this function)
     if (state->rotation != DRM_ROTATE_0 &&
                            ^~~~~~~~~~~~
   drivers/gpu//drm/omapdrm/omap_plane.c: In function 'omap_plane_install_properties':
   drivers/gpu//drm/omapdrm/omap_plane.c:216:11: error: 'DRM_ROTATE_0' undeclared (first use in this function)
              DRM_ROTATE_0,
              ^~~~~~~~~~~~
>> drivers/gpu//drm/omapdrm/omap_plane.c:217:26: error: 'DRM_ROTATE_90' undeclared (first use in this function)
              DRM_ROTATE_0 | DRM_ROTATE_90 |
                             ^~~~~~~~~~~~~
>> drivers/gpu//drm/omapdrm/omap_plane.c:218:11: error: 'DRM_ROTATE_180' undeclared (first use in this function)
              DRM_ROTATE_180 | DRM_ROTATE_270 |
              ^~~~~~~~~~~~~~
>> drivers/gpu//drm/omapdrm/omap_plane.c:218:28: error: 'DRM_ROTATE_270' undeclared (first use in this function)
              DRM_ROTATE_180 | DRM_ROTATE_270 |
                               ^~~~~~~~~~~~~~
>> drivers/gpu//drm/omapdrm/omap_plane.c:219:11: error: 'DRM_REFLECT_X' undeclared (first use in this function)
              DRM_REFLECT_X | DRM_REFLECT_Y);
              ^~~~~~~~~~~~~
>> drivers/gpu//drm/omapdrm/omap_plane.c:219:27: error: 'DRM_REFLECT_Y' undeclared (first use in this function)
              DRM_REFLECT_X | DRM_REFLECT_Y);
                              ^~~~~~~~~~~~~
   drivers/gpu//drm/omapdrm/omap_plane.c: In function 'omap_plane_reset':
   drivers/gpu//drm/omapdrm/omap_plane.c:276:30: error: 'DRM_ROTATE_0' undeclared (first use in this function)
     omap_state->base.rotation = DRM_ROTATE_0;
                                 ^~~~~~~~~~~~
--
   drivers/gpu//drm/omapdrm/omap_fb.c: In function 'omap_framebuffer_update_scanout':
>> drivers/gpu//drm/omapdrm/omap_fb.c:170:27: error: 'DRM_ROTATE_MASK' undeclared (first use in this function)
      switch (win->rotation & DRM_ROTATE_MASK) {
                              ^~~~~~~~~~~~~~~
   drivers/gpu//drm/omapdrm/omap_fb.c:170:27: note: each undeclared identifier is reported only once for each function it appears in
>> drivers/gpu//drm/omapdrm/omap_fb.c:176:8: error: 'DRM_ROTATE_0' undeclared (first use in this function)
      case DRM_ROTATE_0:
           ^~~~~~~~~~~~
>> drivers/gpu//drm/omapdrm/omap_fb.c:179:8: error: 'DRM_ROTATE_90' undeclared (first use in this function)
      case DRM_ROTATE_90:
           ^~~~~~~~~~~~~
>> drivers/gpu//drm/omapdrm/omap_fb.c:182:8: error: 'DRM_ROTATE_180' undeclared (first use in this function)
      case DRM_ROTATE_180:
           ^~~~~~~~~~~~~~
>> drivers/gpu//drm/omapdrm/omap_fb.c:185:8: error: 'DRM_ROTATE_270' undeclared (first use in this function)
      case DRM_ROTATE_270:
           ^~~~~~~~~~~~~~
>> drivers/gpu//drm/omapdrm/omap_fb.c:190:23: error: 'DRM_REFLECT_X' undeclared (first use in this function)
      if (win->rotation & DRM_REFLECT_X)
                          ^~~~~~~~~~~~~
>> drivers/gpu//drm/omapdrm/omap_fb.c:193:23: error: 'DRM_REFLECT_Y' undeclared (first use in this function)
      if (win->rotation & DRM_REFLECT_Y)
                          ^~~~~~~~~~~~~
--
   drivers/gpu/drm/arm/malidp_planes.c: In function 'malidp_plane_reset':
>> drivers/gpu/drm/arm/malidp_planes.c:83:26: error: 'DRM_ROTATE_0' undeclared (first use in this function)
      state->base.rotation = DRM_ROTATE_0;
                             ^~~~~~~~~~~~
   drivers/gpu/drm/arm/malidp_planes.c:83:26: note: each undeclared identifier is reported only once for each function it appears in
   drivers/gpu/drm/arm/malidp_planes.c: In function 'malidp_de_plane_check':
   drivers/gpu/drm/arm/malidp_planes.c:224:25: error: 'DRM_ROTATE_0' undeclared (first use in this function)
     if (state->rotation != DRM_ROTATE_0 &&
                            ^~~~~~~~~~~~
   In file included from drivers/gpu/drm/arm/malidp_planes.c:22:0:
>> drivers/gpu/drm/arm/malidp_drv.h:68:30: error: 'DRM_ROTATE_90' undeclared (first use in this function)
    #define MALIDP_ROTATED_MASK (DRM_ROTATE_90 | DRM_ROTATE_270)
                                 ^
>> drivers/gpu/drm/arm/malidp_planes.c:230:24: note: in expansion of macro 'MALIDP_ROTATED_MASK'
     if (state->rotation & MALIDP_ROTATED_MASK) {
                           ^~~~~~~~~~~~~~~~~~~
>> drivers/gpu/drm/arm/malidp_drv.h:68:46: error: 'DRM_ROTATE_270' undeclared (first use in this function)
    #define MALIDP_ROTATED_MASK (DRM_ROTATE_90 | DRM_ROTATE_270)
                                                 ^
>> drivers/gpu/drm/arm/malidp_planes.c:230:24: note: in expansion of macro 'MALIDP_ROTATED_MASK'
     if (state->rotation & MALIDP_ROTATED_MASK) {
                           ^~~~~~~~~~~~~~~~~~~
   drivers/gpu/drm/arm/malidp_planes.c: In function 'malidp_de_plane_update':
>> drivers/gpu/drm/arm/malidp_planes.c:318:31: error: 'DRM_ROTATE_MASK' undeclared (first use in this function)
     if (plane->state->rotation & DRM_ROTATE_MASK)
                                  ^~~~~~~~~~~~~~~
>> drivers/gpu/drm/arm/malidp_planes.c:321:31: error: 'DRM_REFLECT_X' undeclared (first use in this function)
     if (plane->state->rotation & DRM_REFLECT_X)
                                  ^~~~~~~~~~~~~
>> drivers/gpu/drm/arm/malidp_planes.c:323:31: error: 'DRM_REFLECT_Y' undeclared (first use in this function)
     if (plane->state->rotation & DRM_REFLECT_Y)
                                  ^~~~~~~~~~~~~
   drivers/gpu/drm/arm/malidp_planes.c: In function 'malidp_de_planes_init':
   drivers/gpu/drm/arm/malidp_planes.c:373:24: error: 'DRM_ROTATE_0' undeclared (first use in this function)
     unsigned long flags = DRM_ROTATE_0 | DRM_ROTATE_90 | DRM_ROTATE_180 |
                           ^~~~~~~~~~~~
>> drivers/gpu/drm/arm/malidp_planes.c:373:39: error: 'DRM_ROTATE_90' undeclared (first use in this function)
     unsigned long flags = DRM_ROTATE_0 | DRM_ROTATE_90 | DRM_ROTATE_180 |
                                          ^~~~~~~~~~~~~
>> drivers/gpu/drm/arm/malidp_planes.c:373:55: error: 'DRM_ROTATE_180' undeclared (first use in this function)
     unsigned long flags = DRM_ROTATE_0 | DRM_ROTATE_90 | DRM_ROTATE_180 |
                                                          ^~~~~~~~~~~~~~
>> drivers/gpu/drm/arm/malidp_planes.c:374:10: error: 'DRM_ROTATE_270' undeclared (first use in this function)
             DRM_ROTATE_270 | DRM_REFLECT_X | DRM_REFLECT_Y;
             ^~~~~~~~~~~~~~
   drivers/gpu/drm/arm/malidp_planes.c:374:27: error: 'DRM_REFLECT_X' undeclared (first use in this function)
             DRM_ROTATE_270 | DRM_REFLECT_X | DRM_REFLECT_Y;
                              ^~~~~~~~~~~~~
   drivers/gpu/drm/arm/malidp_planes.c:374:43: error: 'DRM_REFLECT_Y' undeclared (first use in this function)
             DRM_ROTATE_270 | DRM_REFLECT_X | DRM_REFLECT_Y;
                                              ^~~~~~~~~~~~~
--
   In file included from drivers/gpu/drm/arm/malidp_crtc.c:22:0:
   drivers/gpu/drm/arm/malidp_crtc.c: In function 'malidp_crtc_atomic_check':
>> drivers/gpu/drm/arm/malidp_drv.h:68:30: error: 'DRM_ROTATE_90' undeclared (first use in this function)
    #define MALIDP_ROTATED_MASK (DRM_ROTATE_90 | DRM_ROTATE_270)
                                 ^
>> drivers/gpu/drm/arm/malidp_crtc.c:364:26: note: in expansion of macro 'MALIDP_ROTATED_MASK'
      if (pstate->rotation & MALIDP_ROTATED_MASK)
                             ^~~~~~~~~~~~~~~~~~~
   drivers/gpu/drm/arm/malidp_drv.h:68:30: note: each undeclared identifier is reported only once for each function it appears in
    #define MALIDP_ROTATED_MASK (DRM_ROTATE_90 | DRM_ROTATE_270)
                                 ^
>> drivers/gpu/drm/arm/malidp_crtc.c:364:26: note: in expansion of macro 'MALIDP_ROTATED_MASK'
      if (pstate->rotation & MALIDP_ROTATED_MASK)
                             ^~~~~~~~~~~~~~~~~~~
>> drivers/gpu/drm/arm/malidp_drv.h:68:46: error: 'DRM_ROTATE_270' undeclared (first use in this function)
    #define MALIDP_ROTATED_MASK (DRM_ROTATE_90 | DRM_ROTATE_270)
                                                 ^
>> drivers/gpu/drm/arm/malidp_crtc.c:364:26: note: in expansion of macro 'MALIDP_ROTATED_MASK'
      if (pstate->rotation & MALIDP_ROTATED_MASK)
                             ^~~~~~~~~~~~~~~~~~~
--
   drivers/gpu/drm/armada/armada_overlay.c: In function 'armada_ovl_plane_update':
>> drivers/gpu/drm/armada/armada_overlay.c:128:10: error: 'DRM_ROTATE_0' undeclared (first use in this function)
             DRM_ROTATE_0,
             ^~~~~~~~~~~~
   drivers/gpu/drm/armada/armada_overlay.c:128:10: note: each undeclared identifier is reported only once for each function it appears in

vim +/DRM_ROTATE_0 +276 drivers/gpu//drm/imx/ipuv3-plane.c

00514e85 Lucas Stach 2017-03-08  270  	}
00514e85 Lucas Stach 2017-03-08  271  
00514e85 Lucas Stach 2017-03-08  272  	ipu_state = kzalloc(sizeof(*ipu_state), GFP_KERNEL);
00514e85 Lucas Stach 2017-03-08  273  
00514e85 Lucas Stach 2017-03-08  274  	if (ipu_state) {
00514e85 Lucas Stach 2017-03-08  275  		ipu_state->base.plane = plane;
00514e85 Lucas Stach 2017-03-08 @276  		ipu_state->base.rotation = DRM_ROTATE_0;
00514e85 Lucas Stach 2017-03-08  277  	}
00514e85 Lucas Stach 2017-03-08  278  
00514e85 Lucas Stach 2017-03-08  279  	plane->state = &ipu_state->base;

:::::: The code at line 276 was first introduced by commit
:::::: 00514e8593350498790d19c7e21b720fee899cf7 drm/imx: use PRG/PRE when possible

:::::: TO: Lucas Stach <l.stach@pengutronix.de>
:::::: CC: Philipp Zabel <p.zabel@pengutronix.de>

---
0-DAY kernel test infrastructure                Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all                   Intel Corporation
Robert Foss May 17, 2017, 2:30 p.m. UTC | #4
Hey Ville,

On 2017-05-16 12:20 PM, Ville Syrjälä wrote:
> On Tue, May 16, 2017 at 11:55:00AM -0400, Robert Foss wrote:
>> Add DRM_ROTATE_ and DRM_REFLECT_ defines to the UAPI as a convenience.

I just noticed this line using the wrong define names.
Will fix in v3.

>>
>> 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.
>>
>> Signed-off-by: Robert Foss <robert.foss@collabora.com>
>> ---
>> Changes since v1:
>>  - Moved defines from drm.h to drm_mode.h
>>  - Changed define prefix from DRM_ to DRM_MODE_PROP_
>
> DRM_MODE_PROP_ would potentially cause confusion with the prop types.
> DRM_MODE_ROTATE_ etc. could be acceptable I suppose.
>
>>  - Updated uses of the defines to the new prefix
>>  - Removed include from drm_rect.c
>>  - Stopped using the BIT() macro
>>
>>  drivers/gpu/drm/drm_atomic.c           |  2 +-
>>  drivers/gpu/drm/drm_atomic_helper.c    |  2 +-
>>  drivers/gpu/drm/drm_blend.c            | 43 +++++++++----------
>>  drivers/gpu/drm/drm_fb_helper.c        |  4 +-
>>  drivers/gpu/drm/drm_plane_helper.c     |  2 +-
>>  drivers/gpu/drm/drm_rect.c             | 36 ++++++++--------
>>  drivers/gpu/drm/nouveau/nv50_display.c |  2 +-
>>  include/drm/drm_blend.h                | 21 +---------
>>  include/uapi/drm/drm_mode.h            | 76 ++++++++++++++++++++++++++++++++++
>
> I'm pretty sure this won't even compile properly since it's missing all
> but one driver.

I did check it using an arbitrary Kconfig, but I also missed a ton of uses.
Will fix in v3.

>
>>  9 files changed, 124 insertions(+), 64 deletions(-)
>>
>> diff --git a/drivers/gpu/drm/drm_atomic.c b/drivers/gpu/drm/drm_atomic.c
>> index f32506a7c1d6..ec1839b01d2a 100644
>> --- a/drivers/gpu/drm/drm_atomic.c
>> +++ b/drivers/gpu/drm/drm_atomic.c
>> @@ -769,7 +769,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_PROP_ROTATE_MASK))
>>  			return -EINVAL;
>>  		state->rotation = val;
>>  	} else if (property == plane->zpos_property) {
>> diff --git a/drivers/gpu/drm/drm_atomic_helper.c b/drivers/gpu/drm/drm_atomic_helper.c
>> index 8be9719284b0..37f461aa5e66 100644
>> --- a/drivers/gpu/drm/drm_atomic_helper.c
>> +++ b/drivers/gpu/drm/drm_atomic_helper.c
>> @@ -3220,7 +3220,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_PROP_ROTATE_0;
>>  	}
>>  }
>>  EXPORT_SYMBOL(drm_atomic_helper_plane_reset);
>> diff --git a/drivers/gpu/drm/drm_blend.c b/drivers/gpu/drm/drm_blend.c
>> index a0d0d6843288..044640a04d51 100644
>> --- a/drivers/gpu/drm/drm_blend.c
>> +++ b/drivers/gpu/drm/drm_blend.c
>> @@ -119,15 +119,15 @@
>>   * drm_property_create_bitmask()) called "rotation" and has the following
>>   * bitmask enumaration values:
>>   *
>> - * DRM_ROTATE_0:
>> + * DRM_MODE_PROP_ROTATE_0:
>>   * 	"rotate-0"
>> - * DRM_ROTATE_90:
>> + * DRM_MODE_PROP_ROTATE_90:
>>   * 	"rotate-90"
>> - * DRM_ROTATE_180:
>> + * DRM_MODE_PROP_ROTATE_180:
>>   * 	"rotate-180"
>> - * DRM_ROTATE_270:
>> + * DRM_MODE_PROP_ROTATE_270:
>>   * 	"rotate-270"
>> - * DRM_REFLECT_X:
>> + * DRM_MODE_PROP_REFLECT_X:
>>   * 	"reflect-x"
>>   * DRM_REFELCT_Y:
>>   * 	"reflect-y"
>> @@ -142,17 +142,17 @@ int drm_plane_create_rotation_property(struct drm_plane *plane,
>>  				       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_PROP_ROTATE_0) - 1,   "rotate-0" },
>> +		{ __builtin_ffs(DRM_MODE_PROP_ROTATE_90) - 1,  "rotate-90" },
>> +		{ __builtin_ffs(DRM_MODE_PROP_ROTATE_180) - 1, "rotate-180" },
>> +		{ __builtin_ffs(DRM_MODE_PROP_ROTATE_270) - 1, "rotate-270" },
>> +		{ __builtin_ffs(DRM_MODE_PROP_REFLECT_X) - 1,  "reflect-x" },
>> +		{ __builtin_ffs(DRM_MODE_PROP_REFLECT_Y) - 1,  "reflect-y" },
>>  	};
>>  	struct drm_property *prop;
>>
>> -	WARN_ON((supported_rotations & DRM_ROTATE_MASK) == 0);
>> -	WARN_ON(!is_power_of_2(rotation & DRM_ROTATE_MASK));
>> +	WARN_ON((supported_rotations & DRM_MODE_PROP_ROTATE_MASK) == 0);
>> +	WARN_ON(!is_power_of_2(rotation & DRM_MODE_PROP_ROTATE_MASK));
>>  	WARN_ON(rotation & ~supported_rotations);
>>
>>  	prop = drm_property_create_bitmask(plane->dev, 0, "rotation",
>> @@ -178,14 +178,14 @@ EXPORT_SYMBOL(drm_plane_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_PROP_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_PROP_ROTATE_0 |
>> + *                       DRM_MODE_PROP_ROTATE_90 | DRM_MODE_PROP_ROTATE_180 |
>> + *                       DRM_MODE_PROP_ROTATE_270 | DRM_MODE_PROP_REFLECT_Y);
>>   *
>> - * to eliminate the DRM_ROTATE_X flag. Depending on what kind of
>> + * to eliminate the DRM_MODE_PROP_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.
>> @@ -194,9 +194,10 @@ 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_PROP_REFLECT_X | DRM_MODE_PROP_REFLECT_Y;
>> +		rotation = (rotation & DRM_MODE_PROP_REFLECT_MASK) |
>> +		           BIT((ffs(rotation & DRM_MODE_PROP_ROTATE_MASK) + 1)
>> +		           % 4);
>>  	}
>>
>>  	return rotation;
>> diff --git a/drivers/gpu/drm/drm_fb_helper.c b/drivers/gpu/drm/drm_fb_helper.c
>> index 1f178b878e42..0af024a9ff1d 100644
>> --- a/drivers/gpu/drm/drm_fb_helper.c
>> +++ b/drivers/gpu/drm/drm_fb_helper.c
>> @@ -378,7 +378,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_PROP_ROTATE_0;
>>
>>  		plane->old_fb = plane->fb;
>>  		plane_mask |= 1 << drm_plane_index(plane);
>> @@ -431,7 +431,7 @@ static int restore_fbdev_mode_legacy(struct drm_fb_helper *fb_helper)
>>  		if (plane->rotation_property)
>>  			drm_mode_plane_set_obj_prop(plane,
>>  						    plane->rotation_property,
>> -						    DRM_ROTATE_0);
>> +						    DRM_MODE_PROP_ROTATE_0);
>>  	}
>>
>>  	for (i = 0; i < fb_helper->crtc_count; i++) {
>> diff --git a/drivers/gpu/drm/drm_plane_helper.c b/drivers/gpu/drm/drm_plane_helper.c
>> index b84a295230fc..d46deea69baf 100644
>> --- a/drivers/gpu/drm/drm_plane_helper.c
>> +++ b/drivers/gpu/drm/drm_plane_helper.c
>> @@ -336,7 +336,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_PROP_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 bc5575960ebc..5adb528adb88 100644
>> --- a/drivers/gpu/drm/drm_rect.c
>> +++ b/drivers/gpu/drm/drm_rect.c
>> @@ -310,38 +310,38 @@ void drm_rect_rotate(struct drm_rect *r,
>>  {
>>  	struct drm_rect tmp;
>>
>> -	if (rotation & (DRM_REFLECT_X | DRM_REFLECT_Y)) {
>> +	if (rotation & (DRM_MODE_PROP_REFLECT_X | DRM_MODE_PROP_REFLECT_Y)) {
>>  		tmp = *r;
>>
>> -		if (rotation & DRM_REFLECT_X) {
>> +		if (rotation & DRM_MODE_PROP_REFLECT_X) {
>>  			r->x1 = width - tmp.x2;
>>  			r->x2 = width - tmp.x1;
>>  		}
>>
>> -		if (rotation & DRM_REFLECT_Y) {
>> +		if (rotation & DRM_MODE_PROP_REFLECT_Y) {
>>  			r->y1 = height - tmp.y2;
>>  			r->y2 = height - tmp.y1;
>>  		}
>>  	}
>>
>> -	switch (rotation & DRM_ROTATE_MASK) {
>> -	case DRM_ROTATE_0:
>> +	switch (rotation & DRM_MODE_PROP_ROTATE_MASK) {
>> +	case DRM_MODE_PROP_ROTATE_0:
>>  		break;
>> -	case DRM_ROTATE_90:
>> +	case DRM_MODE_PROP_ROTATE_90:
>>  		tmp = *r;
>>  		r->x1 = tmp.y1;
>>  		r->x2 = tmp.y2;
>>  		r->y1 = width - tmp.x2;
>>  		r->y2 = width - tmp.x1;
>>  		break;
>> -	case DRM_ROTATE_180:
>> +	case DRM_MODE_PROP_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 DRM_ROTATE_270:
>> +	case DRM_MODE_PROP_ROTATE_270:
>>  		tmp = *r;
>>  		r->x1 = height - tmp.y2;
>>  		r->x2 = height - tmp.y1;
>> @@ -373,8 +373,8 @@ EXPORT_SYMBOL(drm_rect_rotate);
>>   * them when doing a rotatation and its inverse.
>>   * That is, if you do ::
>>   *
>> - *     drm_rotate(&r, width, height, rotation);
>> - *     drm_rotate_inv(&r, width, height, rotation);
>> + *     DRM_MODE_PROP_ROTATE(&r, width, height, rotation);
>> + *     DRM_MODE_PROP_ROTATE_inv(&r, width, height, rotation);
>>   *
>>   * you will always get back the original rectangle.
>>   */
>> @@ -384,24 +384,24 @@ void drm_rect_rotate_inv(struct drm_rect *r,
>>  {
>>  	struct drm_rect tmp;
>>
>> -	switch (rotation & DRM_ROTATE_MASK) {
>> -	case DRM_ROTATE_0:
>> +	switch (rotation & DRM_MODE_PROP_ROTATE_MASK) {
>> +	case DRM_MODE_PROP_ROTATE_0:
>>  		break;
>> -	case DRM_ROTATE_90:
>> +	case DRM_MODE_PROP_ROTATE_90:
>>  		tmp = *r;
>>  		r->x1 = width - tmp.y2;
>>  		r->x2 = width - tmp.y1;
>>  		r->y1 = tmp.x1;
>>  		r->y2 = tmp.x2;
>>  		break;
>> -	case DRM_ROTATE_180:
>> +	case DRM_MODE_PROP_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 DRM_ROTATE_270:
>> +	case DRM_MODE_PROP_ROTATE_270:
>>  		tmp = *r;
>>  		r->x1 = tmp.y1;
>>  		r->x2 = tmp.y2;
>> @@ -412,15 +412,15 @@ void drm_rect_rotate_inv(struct drm_rect *r,
>>  		break;
>>  	}
>>
>> -	if (rotation & (DRM_REFLECT_X | DRM_REFLECT_Y)) {
>> +	if (rotation & (DRM_MODE_PROP_REFLECT_X | DRM_MODE_PROP_REFLECT_Y)) {
>>  		tmp = *r;
>>
>> -		if (rotation & DRM_REFLECT_X) {
>> +		if (rotation & DRM_MODE_PROP_REFLECT_X) {
>>  			r->x1 = width - tmp.x2;
>>  			r->x2 = width - tmp.x1;
>>  		}
>>
>> -		if (rotation & DRM_REFLECT_Y) {
>> +		if (rotation & DRM_MODE_PROP_REFLECT_Y) {
>>  			r->y1 = height - tmp.y2;
>>  			r->y2 = height - tmp.y1;
>>  		}
>> diff --git a/drivers/gpu/drm/nouveau/nv50_display.c b/drivers/gpu/drm/nouveau/nv50_display.c
>> index a7663249b3ba..082c1012b138 100644
>> --- a/drivers/gpu/drm/nouveau/nv50_display.c
>> +++ b/drivers/gpu/drm/nouveau/nv50_display.c
>> @@ -1033,7 +1033,7 @@ nv50_wndw_reset(struct drm_plane *plane)
>>  		plane->funcs->atomic_destroy_state(plane, plane->state);
>>  	plane->state = &asyw->state;
>>  	plane->state->plane = plane;
>> -	plane->state->rotation = DRM_ROTATE_0;
>> +	plane->state->rotation = DRM_MODE_PROP_ROTATE_0;
>>  }
>>
>>  static void
>> diff --git a/include/drm/drm_blend.h b/include/drm/drm_blend.h
>> index 13221cf9b3eb..b59708c1e7a6 100644
>> --- a/include/drm/drm_blend.h
>> +++ b/include/drm/drm_blend.h
>> @@ -25,31 +25,14 @@
>>
>>  #include <linux/list.h>
>>  #include <linux/ctype.h>
>> +#include <drm/drm_mode.h>
>>
>>  struct drm_device;
>>  struct drm_atomic_state;
>>
>> -/*
>> - * Rotation property bits. DRM_ROTATE_<degrees> rotates the image by the
>> - * 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
>> - *
>> - * WARNING: These defines are UABI since they're exposed in the rotation
>> - * property.
>> - */
>> -#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)
>> -
>>  static inline bool drm_rotation_90_or_270(unsigned int rotation)
>>  {
>> -	return rotation & (DRM_ROTATE_90 | DRM_ROTATE_270);
>> +	return rotation & (DRM_MODE_PROP_ROTATE_90 | DRM_MODE_PROP_ROTATE_270);
>>  }
>>
>>  int drm_plane_create_rotation_property(struct drm_plane *plane,
>> diff --git a/include/uapi/drm/drm_mode.h b/include/uapi/drm/drm_mode.h
>> index 8c67fc03d53d..787a70ba974c 100644
>> --- a/include/uapi/drm/drm_mode.h
>> +++ b/include/uapi/drm/drm_mode.h
>> @@ -127,6 +127,82 @@ extern "C" {
>>  #define DRM_MODE_LINK_STATUS_GOOD	0
>>  #define DRM_MODE_LINK_STATUS_BAD	1
>>
>> +/** DRM_MODE_PROP_ROTATE_0
>
> Is this supposed to be kernel-doc or something like that?

No, not intentionally so. Do I can rework the formatting.
Will fix in v3.

>
>> + *
>> + * Signals that a drm plane has been rotated 0 degrees.
>
> Past tense doesn't feel right to me. Maybe "is rotated"?
> But I'm not a native speaker so maybe it's just me.
>
>> + *
>> + * This define is provided as a convenience, looking up the property id
>> + * using the name->prop id lookup is the preferred method.
>
> Repeating this for every define seems redundant.

Ack. Will fix in v3.

>
>> + */
>> +#define DRM_MODE_PROP_ROTATE_0           (1<<0)
>> +
>> +/** DRM_MODE_PROP_ROTATE_90
>> + *
>> + * Signals that a drm plane has been rotated 90 degrees in counter clockwise
>> + * direction.
>> + *
>> + * This define is provided as a convenience, looking up the property id
>> + * using the name->prop id lookup is the preferred method.
>> + */
>> +#define DRM_MODE_PROP_ROTATE_90          (1<<1)
>> +
>> +/** DRM_MODE_PROP_ROTATE_180
>> + *
>> + * Signals that a drm plane has been rotated 180 degrees in counter clockwise
>> + * direction.
>> + *
>> + * This define is provided as a convenience, looking up the property id
>> + * using the name->prop id lookup is the preferred method.
>> + */
>> +#define DRM_MODE_PROP_ROTATE_180         (1<<2)
>> +
>> +/** DRM_MODE_PROP_ROTATE_270
>> + *
>> + * Signals that a drm plane has been rotated 270 degrees in counter clockwise
>> + * direction.
>> + *
>> + * This define is provided as a convenience, looking up the property id
>> + * using the name->prop id lookup is the preferred method.
>> + */
>> +#define DRM_MODE_PROP_ROTATE_270         (1<<3)
>> +
>> +
>> +/** DRM_MODE_PROP_ROTATE_MASK
>> + *
>> + * Bitmask used to look for drm plane rotations.
>> + */
>> +#define DRM_MODE_PROP_ROTATE_MASK (DRM_MODE_PROP_ROTATE_0  | \
>> +                                  DRM_MODE_PROP_ROTATE_90  | \
>> +                                  DRM_MODE_PROP_ROTATE_180 | \
>> +                                  DRM_MODE_PROP_ROTATE_270)
>> +
>> +/** DRM_MODE_PROP_REFLECT_X
>> + *
>> + * Signals that a drm plane has been reflected in the X axis.
>
> Seems more vague that what we had before.

I'll add some clarifications.

>
>> + *
>> + * This define is provided as a convenience, looking up the property id
>> + * using the name->prop id lookup is the preferred method.
>> + */
>> +#define DRM_MODE_PROP_REFLECT_X          (1<<4)
>> +
>> +/** DRM_MODE_PROP_REFLECT_Y
>> + *
>> + * Signals that a drm plane has been reflected in the Y axis.
>> + *
>> + * This define is provided as a convenience, looking up the property id
>> + * using the name->prop id lookup is the preferred method.
>> + */
>> +#define DRM_MODE_PROP_REFLECT_Y          (1<<5)
>> +
>> +
>> +/** DRM_MODE_PROP_REFLECT_MASK
>> + *
>> + * Bitmask used to look for drm plane reflections.
>> + */
>> +#define DRM_MODE_PROP_REFLECT_MASK (DRM_MODE_PROP_REFLECT_X \
>> +                                   | DRM_MODE_PROP_REFLECT_Y)
>> +
>> +
>>  struct drm_mode_modeinfo {
>>  	__u32 clock;
>>  	__u16 hdisplay;
>> --
>> 2.11.0.453.g787f75f05
>>
>> _______________________________________________
>> dri-devel mailing list
>> dri-devel@lists.freedesktop.org
>> https://lists.freedesktop.org/mailman/listinfo/dri-devel
>

Patch
diff mbox

diff --git a/drivers/gpu/drm/drm_atomic.c b/drivers/gpu/drm/drm_atomic.c
index f32506a7c1d6..ec1839b01d2a 100644
--- a/drivers/gpu/drm/drm_atomic.c
+++ b/drivers/gpu/drm/drm_atomic.c
@@ -769,7 +769,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_PROP_ROTATE_MASK))
 			return -EINVAL;
 		state->rotation = val;
 	} else if (property == plane->zpos_property) {
diff --git a/drivers/gpu/drm/drm_atomic_helper.c b/drivers/gpu/drm/drm_atomic_helper.c
index 8be9719284b0..37f461aa5e66 100644
--- a/drivers/gpu/drm/drm_atomic_helper.c
+++ b/drivers/gpu/drm/drm_atomic_helper.c
@@ -3220,7 +3220,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_PROP_ROTATE_0;
 	}
 }
 EXPORT_SYMBOL(drm_atomic_helper_plane_reset);
diff --git a/drivers/gpu/drm/drm_blend.c b/drivers/gpu/drm/drm_blend.c
index a0d0d6843288..044640a04d51 100644
--- a/drivers/gpu/drm/drm_blend.c
+++ b/drivers/gpu/drm/drm_blend.c
@@ -119,15 +119,15 @@ 
  * drm_property_create_bitmask()) called "rotation" and has the following
  * bitmask enumaration values:
  *
- * DRM_ROTATE_0:
+ * DRM_MODE_PROP_ROTATE_0:
  * 	"rotate-0"
- * DRM_ROTATE_90:
+ * DRM_MODE_PROP_ROTATE_90:
  * 	"rotate-90"
- * DRM_ROTATE_180:
+ * DRM_MODE_PROP_ROTATE_180:
  * 	"rotate-180"
- * DRM_ROTATE_270:
+ * DRM_MODE_PROP_ROTATE_270:
  * 	"rotate-270"
- * DRM_REFLECT_X:
+ * DRM_MODE_PROP_REFLECT_X:
  * 	"reflect-x"
  * DRM_REFELCT_Y:
  * 	"reflect-y"
@@ -142,17 +142,17 @@  int drm_plane_create_rotation_property(struct drm_plane *plane,
 				       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_PROP_ROTATE_0) - 1,   "rotate-0" },
+		{ __builtin_ffs(DRM_MODE_PROP_ROTATE_90) - 1,  "rotate-90" },
+		{ __builtin_ffs(DRM_MODE_PROP_ROTATE_180) - 1, "rotate-180" },
+		{ __builtin_ffs(DRM_MODE_PROP_ROTATE_270) - 1, "rotate-270" },
+		{ __builtin_ffs(DRM_MODE_PROP_REFLECT_X) - 1,  "reflect-x" },
+		{ __builtin_ffs(DRM_MODE_PROP_REFLECT_Y) - 1,  "reflect-y" },
 	};
 	struct drm_property *prop;
 
-	WARN_ON((supported_rotations & DRM_ROTATE_MASK) == 0);
-	WARN_ON(!is_power_of_2(rotation & DRM_ROTATE_MASK));
+	WARN_ON((supported_rotations & DRM_MODE_PROP_ROTATE_MASK) == 0);
+	WARN_ON(!is_power_of_2(rotation & DRM_MODE_PROP_ROTATE_MASK));
 	WARN_ON(rotation & ~supported_rotations);
 
 	prop = drm_property_create_bitmask(plane->dev, 0, "rotation",
@@ -178,14 +178,14 @@  EXPORT_SYMBOL(drm_plane_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_PROP_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_PROP_ROTATE_0 |
+ *                       DRM_MODE_PROP_ROTATE_90 | DRM_MODE_PROP_ROTATE_180 |
+ *                       DRM_MODE_PROP_ROTATE_270 | DRM_MODE_PROP_REFLECT_Y);
  *
- * to eliminate the DRM_ROTATE_X flag. Depending on what kind of
+ * to eliminate the DRM_MODE_PROP_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.
@@ -194,9 +194,10 @@  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_PROP_REFLECT_X | DRM_MODE_PROP_REFLECT_Y;
+		rotation = (rotation & DRM_MODE_PROP_REFLECT_MASK) |
+		           BIT((ffs(rotation & DRM_MODE_PROP_ROTATE_MASK) + 1)
+		           % 4);
 	}
 
 	return rotation;
diff --git a/drivers/gpu/drm/drm_fb_helper.c b/drivers/gpu/drm/drm_fb_helper.c
index 1f178b878e42..0af024a9ff1d 100644
--- a/drivers/gpu/drm/drm_fb_helper.c
+++ b/drivers/gpu/drm/drm_fb_helper.c
@@ -378,7 +378,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_PROP_ROTATE_0;
 
 		plane->old_fb = plane->fb;
 		plane_mask |= 1 << drm_plane_index(plane);
@@ -431,7 +431,7 @@  static int restore_fbdev_mode_legacy(struct drm_fb_helper *fb_helper)
 		if (plane->rotation_property)
 			drm_mode_plane_set_obj_prop(plane,
 						    plane->rotation_property,
-						    DRM_ROTATE_0);
+						    DRM_MODE_PROP_ROTATE_0);
 	}
 
 	for (i = 0; i < fb_helper->crtc_count; i++) {
diff --git a/drivers/gpu/drm/drm_plane_helper.c b/drivers/gpu/drm/drm_plane_helper.c
index b84a295230fc..d46deea69baf 100644
--- a/drivers/gpu/drm/drm_plane_helper.c
+++ b/drivers/gpu/drm/drm_plane_helper.c
@@ -336,7 +336,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_PROP_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 bc5575960ebc..5adb528adb88 100644
--- a/drivers/gpu/drm/drm_rect.c
+++ b/drivers/gpu/drm/drm_rect.c
@@ -310,38 +310,38 @@  void drm_rect_rotate(struct drm_rect *r,
 {
 	struct drm_rect tmp;
 
-	if (rotation & (DRM_REFLECT_X | DRM_REFLECT_Y)) {
+	if (rotation & (DRM_MODE_PROP_REFLECT_X | DRM_MODE_PROP_REFLECT_Y)) {
 		tmp = *r;
 
-		if (rotation & DRM_REFLECT_X) {
+		if (rotation & DRM_MODE_PROP_REFLECT_X) {
 			r->x1 = width - tmp.x2;
 			r->x2 = width - tmp.x1;
 		}
 
-		if (rotation & DRM_REFLECT_Y) {
+		if (rotation & DRM_MODE_PROP_REFLECT_Y) {
 			r->y1 = height - tmp.y2;
 			r->y2 = height - tmp.y1;
 		}
 	}
 
-	switch (rotation & DRM_ROTATE_MASK) {
-	case DRM_ROTATE_0:
+	switch (rotation & DRM_MODE_PROP_ROTATE_MASK) {
+	case DRM_MODE_PROP_ROTATE_0:
 		break;
-	case DRM_ROTATE_90:
+	case DRM_MODE_PROP_ROTATE_90:
 		tmp = *r;
 		r->x1 = tmp.y1;
 		r->x2 = tmp.y2;
 		r->y1 = width - tmp.x2;
 		r->y2 = width - tmp.x1;
 		break;
-	case DRM_ROTATE_180:
+	case DRM_MODE_PROP_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 DRM_ROTATE_270:
+	case DRM_MODE_PROP_ROTATE_270:
 		tmp = *r;
 		r->x1 = height - tmp.y2;
 		r->x2 = height - tmp.y1;
@@ -373,8 +373,8 @@  EXPORT_SYMBOL(drm_rect_rotate);
  * them when doing a rotatation and its inverse.
  * That is, if you do ::
  *
- *     drm_rotate(&r, width, height, rotation);
- *     drm_rotate_inv(&r, width, height, rotation);
+ *     DRM_MODE_PROP_ROTATE(&r, width, height, rotation);
+ *     DRM_MODE_PROP_ROTATE_inv(&r, width, height, rotation);
  *
  * you will always get back the original rectangle.
  */
@@ -384,24 +384,24 @@  void drm_rect_rotate_inv(struct drm_rect *r,
 {
 	struct drm_rect tmp;
 
-	switch (rotation & DRM_ROTATE_MASK) {
-	case DRM_ROTATE_0:
+	switch (rotation & DRM_MODE_PROP_ROTATE_MASK) {
+	case DRM_MODE_PROP_ROTATE_0:
 		break;
-	case DRM_ROTATE_90:
+	case DRM_MODE_PROP_ROTATE_90:
 		tmp = *r;
 		r->x1 = width - tmp.y2;
 		r->x2 = width - tmp.y1;
 		r->y1 = tmp.x1;
 		r->y2 = tmp.x2;
 		break;
-	case DRM_ROTATE_180:
+	case DRM_MODE_PROP_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 DRM_ROTATE_270:
+	case DRM_MODE_PROP_ROTATE_270:
 		tmp = *r;
 		r->x1 = tmp.y1;
 		r->x2 = tmp.y2;
@@ -412,15 +412,15 @@  void drm_rect_rotate_inv(struct drm_rect *r,
 		break;
 	}
 
-	if (rotation & (DRM_REFLECT_X | DRM_REFLECT_Y)) {
+	if (rotation & (DRM_MODE_PROP_REFLECT_X | DRM_MODE_PROP_REFLECT_Y)) {
 		tmp = *r;
 
-		if (rotation & DRM_REFLECT_X) {
+		if (rotation & DRM_MODE_PROP_REFLECT_X) {
 			r->x1 = width - tmp.x2;
 			r->x2 = width - tmp.x1;
 		}
 
-		if (rotation & DRM_REFLECT_Y) {
+		if (rotation & DRM_MODE_PROP_REFLECT_Y) {
 			r->y1 = height - tmp.y2;
 			r->y2 = height - tmp.y1;
 		}
diff --git a/drivers/gpu/drm/nouveau/nv50_display.c b/drivers/gpu/drm/nouveau/nv50_display.c
index a7663249b3ba..082c1012b138 100644
--- a/drivers/gpu/drm/nouveau/nv50_display.c
+++ b/drivers/gpu/drm/nouveau/nv50_display.c
@@ -1033,7 +1033,7 @@  nv50_wndw_reset(struct drm_plane *plane)
 		plane->funcs->atomic_destroy_state(plane, plane->state);
 	plane->state = &asyw->state;
 	plane->state->plane = plane;
-	plane->state->rotation = DRM_ROTATE_0;
+	plane->state->rotation = DRM_MODE_PROP_ROTATE_0;
 }
 
 static void
diff --git a/include/drm/drm_blend.h b/include/drm/drm_blend.h
index 13221cf9b3eb..b59708c1e7a6 100644
--- a/include/drm/drm_blend.h
+++ b/include/drm/drm_blend.h
@@ -25,31 +25,14 @@ 
 
 #include <linux/list.h>
 #include <linux/ctype.h>
+#include <drm/drm_mode.h>
 
 struct drm_device;
 struct drm_atomic_state;
 
-/*
- * Rotation property bits. DRM_ROTATE_<degrees> rotates the image by the
- * 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
- *
- * WARNING: These defines are UABI since they're exposed in the rotation
- * property.
- */
-#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)
-
 static inline bool drm_rotation_90_or_270(unsigned int rotation)
 {
-	return rotation & (DRM_ROTATE_90 | DRM_ROTATE_270);
+	return rotation & (DRM_MODE_PROP_ROTATE_90 | DRM_MODE_PROP_ROTATE_270);
 }
 
 int drm_plane_create_rotation_property(struct drm_plane *plane,
diff --git a/include/uapi/drm/drm_mode.h b/include/uapi/drm/drm_mode.h
index 8c67fc03d53d..787a70ba974c 100644
--- a/include/uapi/drm/drm_mode.h
+++ b/include/uapi/drm/drm_mode.h
@@ -127,6 +127,82 @@  extern "C" {
 #define DRM_MODE_LINK_STATUS_GOOD	0
 #define DRM_MODE_LINK_STATUS_BAD	1
 
+/** DRM_MODE_PROP_ROTATE_0
+ *
+ * Signals that a drm plane has been rotated 0 degrees.
+ *
+ * This define is provided as a convenience, looking up the property id
+ * using the name->prop id lookup is the preferred method.
+ */
+#define DRM_MODE_PROP_ROTATE_0           (1<<0)
+
+/** DRM_MODE_PROP_ROTATE_90
+ *
+ * Signals that a drm plane has been rotated 90 degrees in counter clockwise
+ * direction.
+ *
+ * This define is provided as a convenience, looking up the property id
+ * using the name->prop id lookup is the preferred method.
+ */
+#define DRM_MODE_PROP_ROTATE_90          (1<<1)
+
+/** DRM_MODE_PROP_ROTATE_180
+ *
+ * Signals that a drm plane has been rotated 180 degrees in counter clockwise
+ * direction.
+ *
+ * This define is provided as a convenience, looking up the property id
+ * using the name->prop id lookup is the preferred method.
+ */
+#define DRM_MODE_PROP_ROTATE_180         (1<<2)
+
+/** DRM_MODE_PROP_ROTATE_270
+ *
+ * Signals that a drm plane has been rotated 270 degrees in counter clockwise
+ * direction.
+ *
+ * This define is provided as a convenience, looking up the property id
+ * using the name->prop id lookup is the preferred method.
+ */
+#define DRM_MODE_PROP_ROTATE_270         (1<<3)
+
+
+/** DRM_MODE_PROP_ROTATE_MASK
+ *
+ * Bitmask used to look for drm plane rotations.
+ */
+#define DRM_MODE_PROP_ROTATE_MASK (DRM_MODE_PROP_ROTATE_0  | \
+                                  DRM_MODE_PROP_ROTATE_90  | \
+                                  DRM_MODE_PROP_ROTATE_180 | \
+                                  DRM_MODE_PROP_ROTATE_270)
+
+/** DRM_MODE_PROP_REFLECT_X
+ *
+ * Signals that a drm plane has been reflected in the X axis.
+ *
+ * This define is provided as a convenience, looking up the property id
+ * using the name->prop id lookup is the preferred method.
+ */
+#define DRM_MODE_PROP_REFLECT_X          (1<<4)
+
+/** DRM_MODE_PROP_REFLECT_Y
+ *
+ * Signals that a drm plane has been reflected in the Y axis.
+ *
+ * This define is provided as a convenience, looking up the property id
+ * using the name->prop id lookup is the preferred method.
+ */
+#define DRM_MODE_PROP_REFLECT_Y          (1<<5)
+
+
+/** DRM_MODE_PROP_REFLECT_MASK
+ *
+ * Bitmask used to look for drm plane reflections.
+ */
+#define DRM_MODE_PROP_REFLECT_MASK (DRM_MODE_PROP_REFLECT_X \
+                                   | DRM_MODE_PROP_REFLECT_Y)
+
+
 struct drm_mode_modeinfo {
 	__u32 clock;
 	__u16 hdisplay;