drm: Add DRM_MODE_ROTATE_ and DRM_MODE_REFLECT_ to UAPI
authorRobert Foss <robert.foss@collabora.com>
Fri, 19 May 2017 20:50:17 +0000 (16:50 -0400)
committerDaniel Vetter <daniel.vetter@ffwll.ch>
Mon, 22 May 2017 07:49:48 +0000 (09:49 +0200)
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: Robert Foss <robert.foss@collabora.com>
Reviewed-by: Emil Velikov <emil.velikov@collabora.com>
Reviewed-by: Sinclair Yeh <syeh@vmware.com>
Acked-by: Liviu Dudau <Liviu.Dudau@arm.com>
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Link: http://patchwork.freedesktop.org/patch/msgid/20170519205017.23307-2-robert.foss@collabora.com
25 files changed:
drivers/gpu/drm/arm/malidp_drv.h
drivers/gpu/drm/arm/malidp_planes.c
drivers/gpu/drm/armada/armada_overlay.c
drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_plane.c
drivers/gpu/drm/drm_atomic.c
drivers/gpu/drm/drm_atomic_helper.c
drivers/gpu/drm/drm_blend.c
drivers/gpu/drm/drm_fb_helper.c
drivers/gpu/drm/drm_plane_helper.c
drivers/gpu/drm/drm_rect.c
drivers/gpu/drm/i915/i915_debugfs.c
drivers/gpu/drm/i915/intel_atomic_plane.c
drivers/gpu/drm/i915/intel_display.c
drivers/gpu/drm/i915/intel_fbc.c
drivers/gpu/drm/i915/intel_fbdev.c
drivers/gpu/drm/i915/intel_sprite.c
drivers/gpu/drm/imx/ipuv3-plane.c
drivers/gpu/drm/msm/mdp/mdp5/mdp5_plane.c
drivers/gpu/drm/nouveau/nv50_display.c
drivers/gpu/drm/omapdrm/omap_drv.c
drivers/gpu/drm/omapdrm/omap_fb.c
drivers/gpu/drm/omapdrm/omap_plane.c
drivers/gpu/drm/vmwgfx/vmwgfx_kms.c
include/drm/drm_blend.h
include/uapi/drm/drm_mode.h

index 040311ffcaecc84bf08ef2f64b88f03719bbde5f..2e2033140efc0be4f4557ae3f05c6dafa0a67cf5 100644 (file)
@@ -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__ */
index 814fda23ceade6159fab04455facbbff35ba65e7..063a8d2b0be3c416d3096e77618eea78d4e76749 100644 (file)
@@ -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);
        }
index 424e465ff407e5cc3e131b0f9e08efa94807c2f9..e9a29df4b4438382cd9d6de5c814738649f1c6fb 100644 (file)
@@ -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;
index 29cc10d053ebc3cbd2c60c37d91bb1e5f5f83934..1124200bb280d8f58eb59e5370aa91b7916bb134 100644 (file)
@@ -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;
        }
index cdec19a86af374c93cf028ad13e0e6276aa2665f..e1637011e18ab0bf589238171da88eb8edb6586e 100644 (file)
@@ -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) {
index 6426339427a43a00a818faaa395ab5a385d34e87..636e561486a8f813b806a9ba7ec9e94ad1a6298c 100644 (file)
@@ -3225,7 +3225,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);
index dee67ef6c670177ba5133c3f18b0ef459c872642..db6aeec50b821eb119fc0e0b6d5885a26350c56f 100644 (file)
  * 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_REFLECT_Y:
+ * DRM_MODE_REFLECT_Y:
  *     "reflect-y"
  *
  * Rotation is the specified amount in degrees in counter clockwise direction,
@@ -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_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" },
        };
        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_ROTATE_MASK) == 0);
+       WARN_ON(!is_power_of_2(rotation & DRM_MODE_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_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.
@@ -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_REFLECT_X | DRM_MODE_REFLECT_Y;
+               rotation = (rotation & DRM_MODE_REFLECT_MASK) |
+                          BIT((ffs(rotation & DRM_MODE_ROTATE_MASK) + 1)
+                          % 4);
        }
 
        return rotation;
index 1f178b878e42f01ce667067098cba6b93a6a22e3..574af01d3ce94a1cc266d32e3128ab0d0e96c3d6 100644 (file)
@@ -378,7 +378,7 @@ retry:
                        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);
@@ -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_ROTATE_0);
        }
 
        for (i = 0; i < fb_helper->crtc_count; i++) {
index 2c27f6f5a6689a98a646935be87fbed9cb10d24c..06aee1741e96a78f91e582eda88e4c4bc94b3f13 100644 (file)
@@ -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_ROTATE_0,
                                            DRM_PLANE_HELPER_NO_SCALING,
                                            DRM_PLANE_HELPER_NO_SCALING,
                                            false, false, &visible);
index bc5575960ebce196d3aa12d526557c364e3dabdc..9817c1445ba9ea8f97a1c0fbcfd75851d7f271fd 100644 (file)
@@ -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_REFLECT_X | DRM_MODE_REFLECT_Y)) {
                tmp = *r;
 
-               if (rotation & DRM_REFLECT_X) {
+               if (rotation & DRM_MODE_REFLECT_X) {
                        r->x1 = width - tmp.x2;
                        r->x2 = width - tmp.x1;
                }
 
-               if (rotation & DRM_REFLECT_Y) {
+               if (rotation & DRM_MODE_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_ROTATE_MASK) {
+       case DRM_MODE_ROTATE_0:
                break;
-       case DRM_ROTATE_90:
+       case DRM_MODE_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_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_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_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_ROTATE_MASK) {
+       case DRM_MODE_ROTATE_0:
                break;
-       case DRM_ROTATE_90:
+       case DRM_MODE_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_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_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_REFLECT_X | DRM_MODE_REFLECT_Y)) {
                tmp = *r;
 
-               if (rotation & DRM_REFLECT_X) {
+               if (rotation & DRM_MODE_REFLECT_X) {
                        r->x1 = width - tmp.x2;
                        r->x2 = width - tmp.x1;
                }
 
-               if (rotation & DRM_REFLECT_Y) {
+               if (rotation & DRM_MODE_REFLECT_Y) {
                        r->y1 = height - tmp.y2;
                        r->y2 = height - tmp.y1;
                }
index 07f87985ea0baedb06835d625b55b16f92683ef0..1c66108f433380aca1e1ef8aeb34ea6b57ccfe6b 100644 (file)
@@ -3095,17 +3095,17 @@ static const char *plane_rotation(unsigned int rotation)
 {
        static char buf[48];
        /*
-        * According to doc only one DRM_ROTATE_ is allowed but this
+        * According to doc only one DRM_MODE_ROTATE_ is allowed but this
         * will print them all to visualize if the values are misused
         */
        snprintf(buf, sizeof(buf),
                 "%s%s%s%s%s%s(0x%08x)",
-                (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 & DRM_MODE_ROTATE_0) ? "0 " : "",
+                (rotation & DRM_MODE_ROTATE_90) ? "90 " : "",
+                (rotation & DRM_MODE_ROTATE_180) ? "180 " : "",
+                (rotation & DRM_MODE_ROTATE_270) ? "270 " : "",
+                (rotation & DRM_MODE_REFLECT_X) ? "FLIPX " : "",
+                (rotation & DRM_MODE_REFLECT_Y) ? "FLIPY " : "",
                 rotation);
 
        return buf;
index cfb47293fd53cf93563aa8e159758b8275e30b9e..a40c82c654506a58f4205bd6c0ef5490faf2baeb 100644 (file)
@@ -55,7 +55,7 @@ intel_create_plane_state(struct drm_plane *plane)
                return NULL;
 
        state->base.plane = plane;
-       state->base.rotation = DRM_ROTATE_0;
+       state->base.rotation = DRM_MODE_ROTATE_0;
        state->ckey.flags = I915_SET_COLORKEY_NONE;
 
        return state;
@@ -178,8 +178,8 @@ int intel_plane_atomic_check_with_state(struct intel_crtc_state *crtc_state,
 
        /* CHV ignores the mirror bit when the rotate bit is set :( */
        if (IS_CHERRYVIEW(dev_priv) &&
-           state->rotation & DRM_ROTATE_180 &&
-           state->rotation & DRM_REFLECT_X) {
+           state->rotation & DRM_MODE_ROTATE_180 &&
+           state->rotation & DRM_MODE_REFLECT_X) {
                DRM_DEBUG_KMS("Cannot rotate and reflect at the same time\n");
                return -EINVAL;
        }
index 2f2bb623cf5fbc909b2de34ba946a4194108ca9f..6a037b856d9672310a12f8652d4ed608fd93d59b 100644 (file)
@@ -2468,7 +2468,7 @@ intel_fill_fb_info(struct drm_i915_private *dev_priv,
 
                offset = _intel_compute_tile_offset(dev_priv, &x, &y,
                                                    fb, i, fb->pitches[i],
-                                                   DRM_ROTATE_0, tile_size);
+                                                   DRM_MODE_ROTATE_0, tile_size);
                offset /= tile_size;
 
                if (fb->modifier != DRM_FORMAT_MOD_LINEAR) {
@@ -2503,7 +2503,7 @@ intel_fill_fb_info(struct drm_i915_private *dev_priv,
                        drm_rect_rotate(&r,
                                        rot_info->plane[i].width * tile_width,
                                        rot_info->plane[i].height * tile_height,
-                                       DRM_ROTATE_270);
+                                       DRM_MODE_ROTATE_270);
                        x = r.x1;
                        y = r.y1;
 
@@ -2939,7 +2939,7 @@ int skl_check_plane_surface(struct intel_plane_state *plane_state)
        if (drm_rotation_90_or_270(rotation))
                drm_rect_rotate(&plane_state->base.src,
                                fb->width << 16, fb->height << 16,
-                               DRM_ROTATE_270);
+                               DRM_MODE_ROTATE_270);
 
        /*
         * Handle the AUX surface first since
@@ -3017,10 +3017,10 @@ static u32 i9xx_plane_ctl(const struct intel_crtc_state *crtc_state,
            fb->modifier == I915_FORMAT_MOD_X_TILED)
                dspcntr |= DISPPLANE_TILED;
 
-       if (rotation & DRM_ROTATE_180)
+       if (rotation & DRM_MODE_ROTATE_180)
                dspcntr |= DISPPLANE_ROTATE_180;
 
-       if (rotation & DRM_REFLECT_X)
+       if (rotation & DRM_MODE_REFLECT_X)
                dspcntr |= DISPPLANE_MIRROR;
 
        return dspcntr;
@@ -3048,10 +3048,10 @@ int i9xx_check_plane_surface(struct intel_plane_state *plane_state)
                int src_w = drm_rect_width(&plane_state->base.src) >> 16;
                int src_h = drm_rect_height(&plane_state->base.src) >> 16;
 
-               if (rotation & DRM_ROTATE_180) {
+               if (rotation & DRM_MODE_ROTATE_180) {
                        src_x += src_w - 1;
                        src_y += src_h - 1;
-               } else if (rotation & DRM_REFLECT_X) {
+               } else if (rotation & DRM_MODE_REFLECT_X) {
                        src_x += src_w - 1;
                }
        }
@@ -3271,17 +3271,17 @@ static u32 skl_plane_ctl_tiling(uint64_t fb_modifier)
 static u32 skl_plane_ctl_rotation(unsigned int rotation)
 {
        switch (rotation) {
-       case DRM_ROTATE_0:
+       case DRM_MODE_ROTATE_0:
                break;
        /*
-        * DRM_ROTATE_ is counter clockwise to stay compatible with Xrandr
+        * DRM_MODE_ROTATE_ is counter clockwise to stay compatible with Xrandr
         * while i915 HW rotation is clockwise, thats why this swapping.
         */
-       case DRM_ROTATE_90:
+       case DRM_MODE_ROTATE_90:
                return PLANE_CTL_ROTATE_270;
-       case DRM_ROTATE_180:
+       case DRM_MODE_ROTATE_180:
                return PLANE_CTL_ROTATE_180;
-       case DRM_ROTATE_270:
+       case DRM_MODE_ROTATE_270:
                return PLANE_CTL_ROTATE_90;
        default:
                MISSING_CASE(rotation);
@@ -4671,7 +4671,7 @@ int skl_update_scaler_crtc(struct intel_crtc_state *state)
        const struct drm_display_mode *adjusted_mode = &state->base.adjusted_mode;
 
        return skl_update_scaler(state, !state->base.active, SKL_CRTC_INDEX,
-               &state->scaler_state.scaler_id, DRM_ROTATE_0,
+               &state->scaler_state.scaler_id, DRM_MODE_ROTATE_0,
                state->pipe_src_w, state->pipe_src_h,
                adjusted_mode->crtc_hdisplay, adjusted_mode->crtc_vdisplay);
 }
@@ -9239,7 +9239,7 @@ static u32 i9xx_cursor_ctl(const struct intel_crtc_state *crtc_state,
                return 0;
        }
 
-       if (plane_state->base.rotation & DRM_ROTATE_180)
+       if (plane_state->base.rotation & DRM_MODE_ROTATE_180)
                cntl |= CURSOR_ROTATE_180;
 
        return cntl;
@@ -9300,7 +9300,7 @@ static void intel_crtc_update_cursor(struct drm_crtc *crtc,
 
                /* ILK+ do this automagically */
                if (HAS_GMCH_DISPLAY(dev_priv) &&
-                   plane_state->base.rotation & DRM_ROTATE_180) {
+                   plane_state->base.rotation & DRM_MODE_ROTATE_180) {
                        base += (plane_state->base.crtc_h *
                                 plane_state->base.crtc_w - 1) * 4;
                }
@@ -13607,22 +13607,22 @@ intel_primary_plane_create(struct drm_i915_private *dev_priv, enum pipe pipe)
 
        if (INTEL_GEN(dev_priv) >= 9) {
                supported_rotations =
-                       DRM_ROTATE_0 | DRM_ROTATE_90 |
-                       DRM_ROTATE_180 | DRM_ROTATE_270;
+                       DRM_MODE_ROTATE_0 | DRM_MODE_ROTATE_90 |
+                       DRM_MODE_ROTATE_180 | DRM_MODE_ROTATE_270;
        } else if (IS_CHERRYVIEW(dev_priv) && pipe == PIPE_B) {
                supported_rotations =
-                       DRM_ROTATE_0 | DRM_ROTATE_180 |
-                       DRM_REFLECT_X;
+                       DRM_MODE_ROTATE_0 | DRM_MODE_ROTATE_180 |
+                       DRM_MODE_REFLECT_X;
        } else if (INTEL_GEN(dev_priv) >= 4) {
                supported_rotations =
-                       DRM_ROTATE_0 | DRM_ROTATE_180;
+                       DRM_MODE_ROTATE_0 | DRM_MODE_ROTATE_180;
        } else {
-               supported_rotations = DRM_ROTATE_0;
+               supported_rotations = DRM_MODE_ROTATE_0;
        }
 
        if (INTEL_GEN(dev_priv) >= 4)
                drm_plane_create_rotation_property(&primary->base,
-                                                  DRM_ROTATE_0,
+                                                  DRM_MODE_ROTATE_0,
                                                   supported_rotations);
 
        drm_plane_helper_add(&primary->base, &intel_plane_helper_funcs);
@@ -13777,9 +13777,9 @@ intel_cursor_plane_create(struct drm_i915_private *dev_priv, enum pipe pipe)
 
        if (INTEL_GEN(dev_priv) >= 4)
                drm_plane_create_rotation_property(&cursor->base,
-                                                  DRM_ROTATE_0,
-                                                  DRM_ROTATE_0 |
-                                                  DRM_ROTATE_180);
+                                                  DRM_MODE_ROTATE_0,
+                                                  DRM_MODE_ROTATE_0 |
+                                                  DRM_MODE_ROTATE_180);
 
        if (INTEL_GEN(dev_priv) >= 9)
                state->scaler_id = -1;
index ded2add18b26122d7f6395d0d5532da26dd21f34..db7f8f0a1f36521dbb30dbe1019637230898df60 100644 (file)
@@ -801,7 +801,7 @@ static bool intel_fbc_can_activate(struct intel_crtc *crtc)
                return false;
        }
        if (INTEL_GEN(dev_priv) <= 4 && !IS_G4X(dev_priv) &&
-           cache->plane.rotation != DRM_ROTATE_0) {
+           cache->plane.rotation != DRM_MODE_ROTATE_0) {
                fbc->no_fbc_reason = "rotation unsupported";
                return false;
        }
index 332254a8eebe9823d09e09df4009719b8cf5ee3e..03347c6ae5993a8312c539c3b88fa0381f7a9904 100644 (file)
@@ -211,7 +211,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.
         */
-       vma = intel_pin_and_fence_fb_obj(&ifbdev->fb->base, DRM_ROTATE_0);
+       vma = intel_pin_and_fence_fb_obj(&ifbdev->fb->base, DRM_MODE_ROTATE_0);
        if (IS_ERR(vma)) {
                ret = PTR_ERR(vma);
                goto out_unlock;
index 8c87c717c7cda92c4256cf277828e594f96a0ad1..191e14ddde0c621bc502737a29201106e7fe4063 100644 (file)
@@ -398,10 +398,10 @@ static u32 vlv_sprite_ctl(const struct intel_crtc_state *crtc_state,
        if (fb->modifier == I915_FORMAT_MOD_X_TILED)
                sprctl |= SP_TILED;
 
-       if (rotation & DRM_ROTATE_180)
+       if (rotation & DRM_MODE_ROTATE_180)
                sprctl |= SP_ROTATE_180;
 
-       if (rotation & DRM_REFLECT_X)
+       if (rotation & DRM_MODE_REFLECT_X)
                sprctl |= SP_MIRROR;
 
        if (key->flags & I915_SET_COLORKEY_SOURCE)
@@ -533,7 +533,7 @@ static u32 ivb_sprite_ctl(const struct intel_crtc_state *crtc_state,
        if (fb->modifier == I915_FORMAT_MOD_X_TILED)
                sprctl |= SPRITE_TILED;
 
-       if (rotation & DRM_ROTATE_180)
+       if (rotation & DRM_MODE_ROTATE_180)
                sprctl |= SPRITE_ROTATE_180;
 
        if (key->flags & I915_SET_COLORKEY_DESTINATION)
@@ -674,7 +674,7 @@ static u32 ilk_sprite_ctl(const struct intel_crtc_state *crtc_state,
        if (fb->modifier == I915_FORMAT_MOD_X_TILED)
                dvscntr |= DVS_TILED;
 
-       if (rotation & DRM_ROTATE_180)
+       if (rotation & DRM_MODE_ROTATE_180)
                dvscntr |= DVS_ROTATE_180;
 
        if (key->flags & I915_SET_COLORKEY_DESTINATION)
@@ -1145,15 +1145,15 @@ intel_sprite_plane_create(struct drm_i915_private *dev_priv,
 
        if (INTEL_GEN(dev_priv) >= 9) {
                supported_rotations =
-                       DRM_ROTATE_0 | DRM_ROTATE_90 |
-                       DRM_ROTATE_180 | DRM_ROTATE_270;
+                       DRM_MODE_ROTATE_0 | DRM_MODE_ROTATE_90 |
+                       DRM_MODE_ROTATE_180 | DRM_MODE_ROTATE_270;
        } else if (IS_CHERRYVIEW(dev_priv) && pipe == PIPE_B) {
                supported_rotations =
-                       DRM_ROTATE_0 | DRM_ROTATE_180 |
-                       DRM_REFLECT_X;
+                       DRM_MODE_ROTATE_0 | DRM_MODE_ROTATE_180 |
+                       DRM_MODE_REFLECT_X;
        } else {
                supported_rotations =
-                       DRM_ROTATE_0 | DRM_ROTATE_180;
+                       DRM_MODE_ROTATE_0 | DRM_MODE_ROTATE_180;
        }
 
        intel_plane->pipe = pipe;
@@ -1180,7 +1180,7 @@ intel_sprite_plane_create(struct drm_i915_private *dev_priv,
                goto fail;
 
        drm_plane_create_rotation_property(&intel_plane->base,
-                                          DRM_ROTATE_0,
+                                          DRM_MODE_ROTATE_0,
                                           supported_rotations);
 
        drm_plane_helper_add(&intel_plane->base, &intel_plane_helper_funcs);
index d63e853a030064e3719787b5ba04a1241bedaa28..49546222c6d398540a50025076c952f8444b7c66 100644 (file)
@@ -273,7 +273,7 @@ void ipu_plane_state_reset(struct drm_plane *plane)
 
        if (ipu_state) {
                ipu_state->base.plane = plane;
-               ipu_state->base.rotation = DRM_ROTATE_0;
+               ipu_state->base.rotation = DRM_MODE_ROTATE_0;
        }
 
        plane->state = &ipu_state->base;
index a38c5fe6cc19752a9832618af1a4f146bab4a8df..5e7d9af4cba8b643951a957f3328c7f363bb141c 100644 (file)
@@ -67,11 +67,11 @@ static void mdp5_plane_install_rotation_property(struct drm_device *dev,
                struct drm_plane *plane)
 {
        drm_plane_create_rotation_property(plane,
-                                          DRM_ROTATE_0,
-                                          DRM_ROTATE_0 |
-                                          DRM_ROTATE_180 |
-                                          DRM_REFLECT_X |
-                                          DRM_REFLECT_Y);
+                                          DRM_MODE_ROTATE_0,
+                                          DRM_MODE_ROTATE_0 |
+                                          DRM_MODE_ROTATE_180 |
+                                          DRM_MODE_REFLECT_X |
+                                          DRM_MODE_REFLECT_Y);
 }
 
 /* helper to install properties which are common to planes and crtcs */
@@ -369,14 +369,14 @@ static int mdp5_plane_atomic_check_with_state(struct drm_crtc_state *crtc_state,
                        caps |= MDP_PIPE_CAP_SCALE;
 
                rotation = drm_rotation_simplify(state->rotation,
-                                                DRM_ROTATE_0 |
-                                                DRM_REFLECT_X |
-                                                DRM_REFLECT_Y);
+                                                DRM_MODE_ROTATE_0 |
+                                                DRM_MODE_REFLECT_X |
+                                                DRM_MODE_REFLECT_Y);
 
-               if (rotation & DRM_REFLECT_X)
+               if (rotation & DRM_MODE_REFLECT_X)
                        caps |= MDP_PIPE_CAP_HFLIP;
 
-               if (rotation & DRM_REFLECT_Y)
+               if (rotation & DRM_MODE_REFLECT_Y)
                        caps |= MDP_PIPE_CAP_VFLIP;
 
                if (plane->type == DRM_PLANE_TYPE_CURSOR)
@@ -970,11 +970,11 @@ static int mdp5_plane_mode_set(struct drm_plane *plane,
        DBG("scale config = %x", config);
 
        rotation = drm_rotation_simplify(pstate->rotation,
-                                        DRM_ROTATE_0 |
-                                        DRM_REFLECT_X |
-                                        DRM_REFLECT_Y);
-       hflip = !!(rotation & DRM_REFLECT_X);
-       vflip = !!(rotation & DRM_REFLECT_Y);
+                                        DRM_MODE_ROTATE_0 |
+                                        DRM_MODE_REFLECT_X |
+                                        DRM_MODE_REFLECT_Y);
+       hflip = !!(rotation & DRM_MODE_REFLECT_X);
+       vflip = !!(rotation & DRM_MODE_REFLECT_Y);
 
        spin_lock_irqsave(&mdp5_plane->pipe_lock, flags);
 
index a7663249b3baf2df1c5c75d87d3b32109984ba97..9303daa79aba1f5e844be012294cf2528cca8678 100644 (file)
@@ -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_ROTATE_0;
 }
 
 static void
index e1f47f0b3ccfd3214a93e37cb60400152cd05c64..663e930a7b0f6feaf952c7f742033e41650a41c8 100644 (file)
@@ -577,7 +577,7 @@ static void dev_lastclose(struct drm_device *dev)
 
                drm_object_property_set_value(&crtc->base,
                                              crtc->primary->rotation_property,
-                                             DRM_ROTATE_0);
+                                             DRM_MODE_ROTATE_0);
        }
 
        for (i = 0; i < priv->num_planes; i++) {
@@ -588,7 +588,7 @@ static void dev_lastclose(struct drm_device *dev)
 
                drm_object_property_set_value(&plane->base,
                                              plane->rotation_property,
-                                             DRM_ROTATE_0);
+                                             DRM_MODE_ROTATE_0);
        }
 
        if (priv->fbdev) {
index 29dc677dd4d3e74c5a369d619bfbfe4930108a54..5ca0537bb4271adb052d1d2ddb631efad4e91efd 100644 (file)
@@ -167,30 +167,30 @@ void omap_framebuffer_update_scanout(struct drm_framebuffer *fb,
                uint32_t w = win->src_w;
                uint32_t h = win->src_h;
 
-               switch (win->rotation & DRM_ROTATE_MASK) {
+               switch (win->rotation & DRM_MODE_ROTATE_MASK) {
                default:
                        dev_err(fb->dev->dev, "invalid rotation: %02x",
                                        (uint32_t)win->rotation);
                        /* fallthru to default to no rotation */
                case 0:
-               case DRM_ROTATE_0:
+               case DRM_MODE_ROTATE_0:
                        orient = 0;
                        break;
-               case DRM_ROTATE_90:
+               case DRM_MODE_ROTATE_90:
                        orient = MASK_XY_FLIP | MASK_X_INVERT;
                        break;
-               case DRM_ROTATE_180:
+               case DRM_MODE_ROTATE_180:
                        orient = MASK_X_INVERT | MASK_Y_INVERT;
                        break;
-               case DRM_ROTATE_270:
+               case DRM_MODE_ROTATE_270:
                        orient = MASK_XY_FLIP | MASK_Y_INVERT;
                        break;
                }
 
-               if (win->rotation & DRM_REFLECT_X)
+               if (win->rotation & DRM_MODE_REFLECT_X)
                        orient ^= MASK_X_INVERT;
 
-               if (win->rotation & DRM_REFLECT_Y)
+               if (win->rotation & DRM_MODE_REFLECT_Y)
                        orient ^= MASK_Y_INVERT;
 
                /* adjust x,y offset for flip/invert: */
@@ -205,9 +205,9 @@ void omap_framebuffer_update_scanout(struct drm_framebuffer *fb,
                info->rotation_type = OMAP_DSS_ROT_TILER;
                info->screen_width  = omap_gem_tiled_stride(plane->bo, orient);
        } else {
-               switch (win->rotation & DRM_ROTATE_MASK) {
+               switch (win->rotation & DRM_MODE_ROTATE_MASK) {
                case 0:
-               case DRM_ROTATE_0:
+               case DRM_MODE_ROTATE_0:
                        /* OK */
                        break;
 
index 9168154d749e4206d02e7db5a98058ad70165156..d3d6818c68f82352d76d180554713cedfa9a507f 100644 (file)
@@ -141,7 +141,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 = DRM_ROTATE_0;
+       plane->state->rotation = DRM_MODE_ROTATE_0;
        omap_state->zorder = plane->type == DRM_PLANE_TYPE_PRIMARY
                           ? 0 : omap_plane->id;
 
@@ -177,7 +177,7 @@ static int omap_plane_atomic_check(struct drm_plane *plane,
        if (state->crtc_y + state->crtc_h > crtc_state->adjusted_mode.vdisplay)
                return -EINVAL;
 
-       if (state->rotation != DRM_ROTATE_0 &&
+       if (state->rotation != DRM_MODE_ROTATE_0 &&
            !omap_framebuffer_supports_rotation(state->fb))
                return -EINVAL;
 
@@ -213,15 +213,15 @@ void omap_plane_install_properties(struct drm_plane *plane,
        if (priv->has_dmm) {
                if (!plane->rotation_property)
                        drm_plane_create_rotation_property(plane,
-                                                          DRM_ROTATE_0,
-                                                          DRM_ROTATE_0 | DRM_ROTATE_90 |
-                                                          DRM_ROTATE_180 | DRM_ROTATE_270 |
-                                                          DRM_REFLECT_X | DRM_REFLECT_Y);
+                                                          DRM_MODE_ROTATE_0,
+                                                          DRM_MODE_ROTATE_0 | DRM_MODE_ROTATE_90 |
+                                                          DRM_MODE_ROTATE_180 | DRM_MODE_ROTATE_270 |
+                                                          DRM_MODE_REFLECT_X | DRM_MODE_REFLECT_Y);
 
                /* Attach the rotation property also to the crtc object */
                if (plane->rotation_property && obj != &plane->base)
                        drm_object_attach_property(obj, plane->rotation_property,
-                                                  DRM_ROTATE_0);
+                                                  DRM_MODE_ROTATE_0);
        }
 
        drm_object_attach_property(obj, priv->zorder_prop, 0);
@@ -273,7 +273,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 = DRM_ROTATE_0;
+       omap_state->base.rotation = DRM_MODE_ROTATE_0;
 
        plane->state = &omap_state->base;
        plane->state->plane = plane;
index ef9f3a2a40303290287b5259b7a71d2a8791ddb4..a8876b070168604eecc807399d1f680979ec5737 100644 (file)
@@ -566,7 +566,7 @@ int vmw_du_primary_plane_atomic_check(struct drm_plane *plane,
 
        ret = drm_plane_helper_check_update(plane, state->crtc, new_fb,
                                            &src, &dest, &clip,
-                                           DRM_ROTATE_0,
+                                           DRM_MODE_ROTATE_0,
                                            DRM_PLANE_HELPER_NO_SCALING,
                                            DRM_PLANE_HELPER_NO_SCALING,
                                            false, true, &visible);
@@ -845,7 +845,7 @@ void vmw_du_plane_reset(struct drm_plane *plane)
 
        plane->state = &vps->base;
        plane->state->plane = plane;
-       plane->state->rotation = DRM_ROTATE_0;
+       plane->state->rotation = DRM_MODE_ROTATE_0;
 }
 
 
index bc9e596be4c2ac8c5ff3cc625a1cfb965394520f..17606026590be7bac884303b4af3a8b4c3fa21a6 100644 (file)
 
 #include <linux/list.h>
 #include <linux/ctype.h>
+#include <drm/drm_mode.h>
 
 struct drm_device;
 struct drm_atomic_state;
 struct drm_plane;
 
-/*
- * 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_ROTATE_90 | DRM_MODE_ROTATE_270);
 }
 
 int drm_plane_create_rotation_property(struct drm_plane *plane,
index 8c67fc03d53dd630a8245fd2ae79fae5d5cbaccc..403339f98a925edb15d25974a5ac227216211800 100644 (file)
@@ -75,7 +75,7 @@ extern "C" {
   * (define not exposed to user space).
   */
 #define DRM_MODE_FLAG_3D_MASK                  (0x1f<<14)
-#define  DRM_MODE_FLAG_3D_NONE                 (0<<14)
+#define  DRM_MODE_FLAG_3D_NONE         (0<<14)
 #define  DRM_MODE_FLAG_3D_FRAME_PACKING                (1<<14)
 #define  DRM_MODE_FLAG_3D_FIELD_ALTERNATIVE    (2<<14)
 #define  DRM_MODE_FLAG_3D_LINE_ALTERNATIVE     (3<<14)
@@ -127,6 +127,53 @@ extern "C" {
 #define DRM_MODE_LINK_STATUS_GOOD      0
 #define DRM_MODE_LINK_STATUS_BAD       1
 
+/*
+ * DRM_MODE_ROTATE_<degrees>
+ *
+ * Signals that a drm plane is been rotated <degrees> 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_ROTATE_0       (1<<0)
+#define DRM_MODE_ROTATE_90      (1<<1)
+#define DRM_MODE_ROTATE_180     (1<<2)
+#define DRM_MODE_ROTATE_270     (1<<3)
+
+/*
+ * DRM_MODE_ROTATE_MASK
+ *
+ * Bitmask used to look for drm plane rotations.
+ */
+#define DRM_MODE_ROTATE_MASK (\
+               DRM_MODE_ROTATE_0  | \
+               DRM_MODE_ROTATE_90  | \
+               DRM_MODE_ROTATE_180 | \
+               DRM_MODE_ROTATE_270)
+
+/*
+ * DRM_MODE_REFLECT_<axis>
+ *
+ * Signals that the contents of a drm plane is reflected in the <axis> axis,
+ * in the same way as mirroring.
+ *
+ * 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_REFLECT_X      (1<<4)
+#define DRM_MODE_REFLECT_Y      (1<<5)
+
+/*
+ * DRM_MODE_REFLECT_MASK
+ *
+ * Bitmask used to look for drm plane reflections.
+ */
+#define DRM_MODE_REFLECT_MASK (\
+               DRM_MODE_REFLECT_X | \
+               DRM_MODE_REFLECT_Y)
+
+
 struct drm_mode_modeinfo {
        __u32 clock;
        __u16 hdisplay;