From mboxrd@z Thu Jan 1 00:00:00 1970 From: Joonas Lahtinen Subject: [PATCH v2] drm: BIT(DRM_ROTATE_?) -> DRM_ROTATE_? Date: Fri, 29 Jul 2016 08:50:05 +0300 Message-ID: <1469771405-17653-1-git-send-email-joonas.lahtinen@linux.intel.com> References: Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: QUOTED-PRINTABLE Return-path: Received: from mga11.intel.com ([192.55.52.93]:39111 "EHLO mga11.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750785AbcG2FuO (ORCPT ); Fri, 29 Jul 2016 01:50:14 -0400 In-Reply-To: Sender: linux-arm-msm-owner@vger.kernel.org List-Id: linux-arm-msm@vger.kernel.org To: Direct Rendering Infrastructure - Development Cc: Joonas Lahtinen , intel-gfx@lists.freedesktop.org, linux-arm-msm@vger.kernel.org, freedreno@lists.freedesktop.org, malidp@foss.arm.com, David Airlie , Daniel Vetter , =?UTF-8?q?Ville=20Syrj=C3=A4l=C3=A4?= , Liviu Dudau , Sean Paul Only property creation uses the rotation as an index, so convert the to figure the index when needed. v2: Use the new defines to build the _MASK defines (Sean) Cc: intel-gfx@lists.freedesktop.org Cc: linux-arm-msm@vger.kernel.org Cc: freedreno@lists.freedesktop.org Cc: malidp@foss.arm.com Cc: David Airlie Cc: Daniel Vetter Cc: Ville Syrj=C3=A4l=C3=A4 Cc: Liviu Dudau Cc: Sean Paul Acked-by: Liviu Dudau Reviewed-by: Ville Syrj=C3=A4l=C3=A4 (v= 1) Signed-off-by: Joonas Lahtinen --- drivers/gpu/drm/arm/malidp_drv.h | 2 +- drivers/gpu/drm/arm/malidp_planes.c | 20 +++++++++--------= - drivers/gpu/drm/armada/armada_overlay.c | 2 +- drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_plane.c | 22 +++++++++--------= -- drivers/gpu/drm/drm_atomic_helper.c | 4 ++-- drivers/gpu/drm/drm_crtc.c | 24 ++++++++++-------= ---- drivers/gpu/drm/drm_fb_helper.c | 4 ++-- drivers/gpu/drm/drm_plane_helper.c | 2 +- drivers/gpu/drm/drm_rect.c | 28 ++++++++++++-----= -------- drivers/gpu/drm/i915/i915_debugfs.c | 12 +++++------ drivers/gpu/drm/i915/intel_atomic_plane.c | 2 +- drivers/gpu/drm/i915/intel_display.c | 28 ++++++++++++-----= -------- drivers/gpu/drm/i915/intel_drv.h | 2 +- drivers/gpu/drm/i915/intel_fbc.c | 2 +- drivers/gpu/drm/i915/intel_fbdev.c | 6 +++--- drivers/gpu/drm/i915/intel_sprite.c | 6 +++--- drivers/gpu/drm/msm/mdp/mdp5/mdp5_plane.c | 10 ++++----- drivers/gpu/drm/omapdrm/omap_drv.c | 6 +++--- drivers/gpu/drm/omapdrm/omap_fb.c | 14 ++++++------- drivers/gpu/drm/omapdrm/omap_plane.c | 10 ++++----- include/drm/drm_crtc.h | 17 ++++++++------- 21 files changed, 112 insertions(+), 111 deletions(-) diff --git a/drivers/gpu/drm/arm/malidp_drv.h b/drivers/gpu/drm/arm/mal= idp_drv.h index 95558fd..271d2fb 100644 --- a/drivers/gpu/drm/arm/malidp_drv.h +++ b/drivers/gpu/drm/arm/malidp_drv.h @@ -49,6 +49,6 @@ void malidp_de_planes_destroy(struct drm_device *drm)= ; int malidp_crtc_init(struct drm_device *drm); =20 /* often used combination of rotational bits */ -#define MALIDP_ROTATED_MASK (BIT(DRM_ROTATE_90) | BIT(DRM_ROTATE_270)) +#define MALIDP_ROTATED_MASK (DRM_ROTATE_90 | DRM_ROTATE_270) =20 #endif /* __MALIDP_DRV_H__ */ diff --git a/drivers/gpu/drm/arm/malidp_planes.c b/drivers/gpu/drm/arm/= malidp_planes.c index 725098d..82c193e 100644 --- a/drivers/gpu/drm/arm/malidp_planes.c +++ b/drivers/gpu/drm/arm/malidp_planes.c @@ -108,7 +108,7 @@ static int malidp_de_plane_check(struct drm_plane *= plane, return -EINVAL; =20 /* packed RGB888 / BGR888 can't be rotated or flipped */ - if (state->rotation !=3D BIT(DRM_ROTATE_0) && + if (state->rotation !=3D DRM_ROTATE_0 && (state->fb->pixel_format =3D=3D DRM_FORMAT_RGB888 || state->fb->pixel_format =3D=3D DRM_FORMAT_BGR888)) return -EINVAL; @@ -188,9 +188,9 @@ static void malidp_de_plane_update(struct drm_plane= *plane, /* setup the rotation and axis flip bits */ if (plane->state->rotation & DRM_ROTATE_MASK) val =3D ilog2(plane->state->rotation & DRM_ROTATE_MASK) << LAYER_ROT= _OFFSET; - if (plane->state->rotation & BIT(DRM_REFLECT_X)) + if (plane->state->rotation & DRM_REFLECT_X) val |=3D LAYER_V_FLIP; - if (plane->state->rotation & BIT(DRM_REFLECT_Y)) + if (plane->state->rotation & DRM_REFLECT_Y) val |=3D LAYER_H_FLIP; =20 /* set the 'enable layer' bit */ @@ -255,12 +255,12 @@ int malidp_de_planes_init(struct drm_device *drm) goto cleanup; =20 if (!drm->mode_config.rotation_property) { - unsigned long flags =3D BIT(DRM_ROTATE_0) | - BIT(DRM_ROTATE_90) | - BIT(DRM_ROTATE_180) | - BIT(DRM_ROTATE_270) | - BIT(DRM_REFLECT_X) | - BIT(DRM_REFLECT_Y); + unsigned long flags =3D DRM_ROTATE_0 | + DRM_ROTATE_90 | + DRM_ROTATE_180 | + DRM_ROTATE_270 | + DRM_REFLECT_X | + DRM_REFLECT_Y; drm->mode_config.rotation_property =3D drm_mode_create_rotation_property(drm, flags); } @@ -268,7 +268,7 @@ int malidp_de_planes_init(struct drm_device *drm) if (drm->mode_config.rotation_property && (id !=3D DE_SMART)) drm_object_attach_property(&plane->base.base, drm->mode_config.rotation_property, - BIT(DRM_ROTATE_0)); + DRM_ROTATE_0); =20 drm_plane_helper_add(&plane->base, &malidp_de_plane_helper_funcs); diff --git a/drivers/gpu/drm/armada/armada_overlay.c b/drivers/gpu/drm/= armada/armada_overlay.c index 1ee707e..152b4e7 100644 --- a/drivers/gpu/drm/armada/armada_overlay.c +++ b/drivers/gpu/drm/armada/armada_overlay.c @@ -121,7 +121,7 @@ armada_ovl_plane_update(struct drm_plane *plane, st= ruct drm_crtc *crtc, int ret; =20 ret =3D drm_plane_helper_check_update(plane, crtc, fb, &src, &dest, &= clip, - BIT(DRM_ROTATE_0), + DRM_ROTATE_0, 0, INT_MAX, true, false, &visible); if (ret) return ret; diff --git a/drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_plane.c b/drivers/= gpu/drm/atmel-hlcdc/atmel_hlcdc_plane.c index 016c191..146809a 100644 --- a/drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_plane.c +++ b/drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_plane.c @@ -393,7 +393,7 @@ static void atmel_hlcdc_plane_update_format(struct = atmel_hlcdc_plane *plane, =20 if ((state->base.fb->pixel_format =3D=3D DRM_FORMAT_YUV422 || state->base.fb->pixel_format =3D=3D DRM_FORMAT_NV61) && - (state->base.rotation & (BIT(DRM_ROTATE_90) | BIT(DRM_ROTATE_270)= ))) + (state->base.rotation & (DRM_ROTATE_90 | DRM_ROTATE_270))) cfg |=3D ATMEL_HLCDC_YUV422ROT; =20 atmel_hlcdc_layer_update_cfg(&plane->layer, @@ -628,7 +628,7 @@ static int atmel_hlcdc_plane_atomic_check(struct dr= m_plane *p, /* * Swap width and size in case of 90 or 270 degrees rotation */ - if (state->base.rotation & (BIT(DRM_ROTATE_90) | BIT(DRM_ROTATE_270))= ) { + if (state->base.rotation & (DRM_ROTATE_90 | DRM_ROTATE_270)) { tmp =3D state->crtc_w; state->crtc_w =3D state->crtc_h; state->crtc_h =3D tmp; @@ -677,7 +677,7 @@ static int atmel_hlcdc_plane_atomic_check(struct dr= m_plane *p, return -EINVAL; =20 switch (state->base.rotation & DRM_ROTATE_MASK) { - case BIT(DRM_ROTATE_90): + case DRM_ROTATE_90: offset =3D ((y_offset + state->src_y + patched_src_w - 1) / ydiv) * fb->pitches[i]; offset +=3D ((x_offset + state->src_x) / xdiv) * @@ -686,7 +686,7 @@ static int atmel_hlcdc_plane_atomic_check(struct dr= m_plane *p, fb->pitches[i]; state->pstride[i] =3D -fb->pitches[i] - state->bpp[i]; break; - case BIT(DRM_ROTATE_180): + case DRM_ROTATE_180: offset =3D ((y_offset + state->src_y + patched_src_h - 1) / ydiv) * fb->pitches[i]; offset +=3D ((x_offset + state->src_x + patched_src_w - 1) / @@ -695,7 +695,7 @@ static int atmel_hlcdc_plane_atomic_check(struct dr= m_plane *p, state->bpp[i]) - fb->pitches[i]; state->pstride[i] =3D -2 * state->bpp[i]; break; - case BIT(DRM_ROTATE_270): + case DRM_ROTATE_270: offset =3D ((y_offset + state->src_y) / ydiv) * fb->pitches[i]; offset +=3D ((x_offset + state->src_x + patched_src_h - 1) / @@ -705,7 +705,7 @@ static int atmel_hlcdc_plane_atomic_check(struct dr= m_plane *p, (2 * state->bpp[i]); state->pstride[i] =3D fb->pitches[i] - state->bpp[i]; break; - case BIT(DRM_ROTATE_0): + case DRM_ROTATE_0: default: offset =3D ((y_offset + state->src_y) / ydiv) * fb->pitches[i]; @@ -905,7 +905,7 @@ static void atmel_hlcdc_plane_init_properties(struc= t atmel_hlcdc_plane *plane, if (desc->layout.xstride && desc->layout.pstride) drm_object_attach_property(&plane->base.base, plane->base.dev->mode_config.rotation_property, - BIT(DRM_ROTATE_0)); + DRM_ROTATE_0); =20 if (desc->layout.csc) { /* @@ -1056,10 +1056,10 @@ atmel_hlcdc_plane_create_properties(struct drm_= device *dev) =20 dev->mode_config.rotation_property =3D drm_mode_create_rotation_property(dev, - BIT(DRM_ROTATE_0) | - BIT(DRM_ROTATE_90) | - BIT(DRM_ROTATE_180) | - BIT(DRM_ROTATE_270)); + DRM_ROTATE_0 | + DRM_ROTATE_90 | + DRM_ROTATE_180 | + DRM_ROTATE_270); if (!dev->mode_config.rotation_property) return ERR_PTR(-ENOMEM); =20 diff --git a/drivers/gpu/drm/drm_atomic_helper.c b/drivers/gpu/drm/drm_= atomic_helper.c index de7fddc..61afd85 100644 --- a/drivers/gpu/drm/drm_atomic_helper.c +++ b/drivers/gpu/drm/drm_atomic_helper.c @@ -2348,7 +2348,7 @@ int __drm_atomic_helper_set_config(struct drm_mod= e_set *set, primary_state->crtc_h =3D vdisplay; primary_state->src_x =3D set->x << 16; primary_state->src_y =3D set->y << 16; - if (primary_state->rotation & (BIT(DRM_ROTATE_90) | BIT(DRM_ROTATE_27= 0))) { + if (primary_state->rotation & (DRM_ROTATE_90 | DRM_ROTATE_270)) { primary_state->src_w =3D vdisplay << 16; primary_state->src_h =3D hdisplay << 16; } else { @@ -3032,7 +3032,7 @@ void drm_atomic_helper_plane_reset(struct drm_pla= ne *plane) =20 if (plane->state) { plane->state->plane =3D plane; - plane->state->rotation =3D BIT(DRM_ROTATE_0); + plane->state->rotation =3D DRM_ROTATE_0; } } EXPORT_SYMBOL(drm_atomic_helper_plane_reset); diff --git a/drivers/gpu/drm/drm_crtc.c b/drivers/gpu/drm/drm_crtc.c index f1d9f05..909a025 100644 --- a/drivers/gpu/drm/drm_crtc.c +++ b/drivers/gpu/drm/drm_crtc.c @@ -2804,8 +2804,8 @@ int drm_crtc_check_viewport(const struct drm_crtc= *crtc, drm_crtc_get_hv_timing(mode, &hdisplay, &vdisplay); =20 if (crtc->state && - crtc->primary->state->rotation & (BIT(DRM_ROTATE_90) | - BIT(DRM_ROTATE_270))) + crtc->primary->state->rotation & (DRM_ROTATE_90 | + DRM_ROTATE_270)) swap(hdisplay, vdisplay); =20 return check_src_coords(x << 16, y << 16, @@ -5646,9 +5646,9 @@ int drm_mode_destroy_dumb_ioctl(struct drm_device= *dev, * Eg. if the hardware supports everything except DRM_REFLECT_X * one could call this function like this: * - * drm_rotation_simplify(rotation, BIT(DRM_ROTATE_0) | - * BIT(DRM_ROTATE_90) | BIT(DRM_ROTATE_180) | - * BIT(DRM_ROTATE_270) | BIT(DRM_REFLECT_Y)); + * drm_rotation_simplify(rotation, DRM_ROTATE_0 | + * DRM_ROTATE_90 | DRM_ROTATE_180 | + * DRM_ROTATE_270 | DRM_REFLECT_Y); * * to eliminate the DRM_ROTATE_X flag. Depending on what kind of * transforms the hardware supports, this function may not @@ -5659,7 +5659,7 @@ unsigned int drm_rotation_simplify(unsigned int r= otation, unsigned int supported_rotations) { if (rotation & ~supported_rotations) { - rotation ^=3D BIT(DRM_REFLECT_X) | BIT(DRM_REFLECT_Y); + rotation ^=3D DRM_REFLECT_X | DRM_REFLECT_Y; rotation =3D (rotation & DRM_REFLECT_MASK) | BIT((ffs(rotation & DRM_ROTATE_MASK) + 1) % 4); } @@ -5788,12 +5788,12 @@ struct drm_property *drm_mode_create_rotation_p= roperty(struct drm_device *dev, unsigned int supported_rotations) { static const struct drm_prop_enum_list props[] =3D { - { DRM_ROTATE_0, "rotate-0" }, - { DRM_ROTATE_90, "rotate-90" }, - { DRM_ROTATE_180, "rotate-180" }, - { DRM_ROTATE_270, "rotate-270" }, - { DRM_REFLECT_X, "reflect-x" }, - { DRM_REFLECT_Y, "reflect-y" }, + { __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" }, }; =20 return drm_property_create_bitmask(dev, 0, "rotation", diff --git a/drivers/gpu/drm/drm_fb_helper.c b/drivers/gpu/drm/drm_fb_h= elper.c index ce54e98..d4896f9 100644 --- a/drivers/gpu/drm/drm_fb_helper.c +++ b/drivers/gpu/drm/drm_fb_helper.c @@ -335,7 +335,7 @@ retry: goto fail; } =20 - plane_state->rotation =3D BIT(DRM_ROTATE_0); + plane_state->rotation =3D DRM_ROTATE_0; =20 plane->old_fb =3D plane->fb; plane_mask |=3D 1 << drm_plane_index(plane); @@ -395,7 +395,7 @@ static int restore_fbdev_mode(struct drm_fb_helper = *fb_helper) if (dev->mode_config.rotation_property) { drm_mode_plane_set_obj_prop(plane, dev->mode_config.rotation_property, - BIT(DRM_ROTATE_0)); + DRM_ROTATE_0); } } =20 diff --git a/drivers/gpu/drm/drm_plane_helper.c b/drivers/gpu/drm/drm_p= lane_helper.c index 16c4a7b..c360e30 100644 --- a/drivers/gpu/drm/drm_plane_helper.c +++ b/drivers/gpu/drm/drm_plane_helper.c @@ -274,7 +274,7 @@ int drm_primary_helper_update(struct drm_plane *pla= ne, struct drm_crtc *crtc, =20 ret =3D drm_plane_helper_check_update(plane, crtc, fb, &src, &dest, &clip, - BIT(DRM_ROTATE_0), + DRM_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 a8e2c86..4063f6e 100644 --- a/drivers/gpu/drm/drm_rect.c +++ b/drivers/gpu/drm/drm_rect.c @@ -317,38 +317,38 @@ void drm_rect_rotate(struct drm_rect *r, { struct drm_rect tmp; =20 - if (rotation & (BIT(DRM_REFLECT_X) | BIT(DRM_REFLECT_Y))) { + if (rotation & (DRM_REFLECT_X | DRM_REFLECT_Y)) { tmp =3D *r; =20 - if (rotation & BIT(DRM_REFLECT_X)) { + if (rotation & DRM_REFLECT_X) { r->x1 =3D width - tmp.x2; r->x2 =3D width - tmp.x1; } =20 - if (rotation & BIT(DRM_REFLECT_Y)) { + if (rotation & DRM_REFLECT_Y) { r->y1 =3D height - tmp.y2; r->y2 =3D height - tmp.y1; } } =20 switch (rotation & DRM_ROTATE_MASK) { - case BIT(DRM_ROTATE_0): + case DRM_ROTATE_0: break; - case BIT(DRM_ROTATE_90): + case DRM_ROTATE_90: tmp =3D *r; r->x1 =3D tmp.y1; r->x2 =3D tmp.y2; r->y1 =3D width - tmp.x2; r->y2 =3D width - tmp.x1; break; - case BIT(DRM_ROTATE_180): + case DRM_ROTATE_180: tmp =3D *r; r->x1 =3D width - tmp.x2; r->x2 =3D width - tmp.x1; r->y1 =3D height - tmp.y2; r->y2 =3D height - tmp.y1; break; - case BIT(DRM_ROTATE_270): + case DRM_ROTATE_270: tmp =3D *r; r->x1 =3D height - tmp.y2; r->x2 =3D height - tmp.y1; @@ -392,23 +392,23 @@ void drm_rect_rotate_inv(struct drm_rect *r, struct drm_rect tmp; =20 switch (rotation & DRM_ROTATE_MASK) { - case BIT(DRM_ROTATE_0): + case DRM_ROTATE_0: break; - case BIT(DRM_ROTATE_90): + case DRM_ROTATE_90: tmp =3D *r; r->x1 =3D width - tmp.y2; r->x2 =3D width - tmp.y1; r->y1 =3D tmp.x1; r->y2 =3D tmp.x2; break; - case BIT(DRM_ROTATE_180): + case DRM_ROTATE_180: tmp =3D *r; r->x1 =3D width - tmp.x2; r->x2 =3D width - tmp.x1; r->y1 =3D height - tmp.y2; r->y2 =3D height - tmp.y1; break; - case BIT(DRM_ROTATE_270): + case DRM_ROTATE_270: tmp =3D *r; r->x1 =3D tmp.y1; r->x2 =3D tmp.y2; @@ -419,15 +419,15 @@ void drm_rect_rotate_inv(struct drm_rect *r, break; } =20 - if (rotation & (BIT(DRM_REFLECT_X) | BIT(DRM_REFLECT_Y))) { + if (rotation & (DRM_REFLECT_X | DRM_REFLECT_Y)) { tmp =3D *r; =20 - if (rotation & BIT(DRM_REFLECT_X)) { + if (rotation & DRM_REFLECT_X) { r->x1 =3D width - tmp.x2; r->x2 =3D width - tmp.x1; } =20 - if (rotation & BIT(DRM_REFLECT_Y)) { + if (rotation & DRM_REFLECT_Y) { r->y1 =3D height - tmp.y2; r->y2 =3D height - tmp.y1; } diff --git a/drivers/gpu/drm/i915/i915_debugfs.c b/drivers/gpu/drm/i915= /i915_debugfs.c index 9aa62c5..815232c 100644 --- a/drivers/gpu/drm/i915/i915_debugfs.c +++ b/drivers/gpu/drm/i915/i915_debugfs.c @@ -3081,12 +3081,12 @@ static const char *plane_rotation(unsigned int = rotation) */ snprintf(buf, sizeof(buf), "%s%s%s%s%s%s(0x%08x)", - (rotation & BIT(DRM_ROTATE_0)) ? "0 " : "", - (rotation & BIT(DRM_ROTATE_90)) ? "90 " : "", - (rotation & BIT(DRM_ROTATE_180)) ? "180 " : "", - (rotation & BIT(DRM_ROTATE_270)) ? "270 " : "", - (rotation & BIT(DRM_REFLECT_X)) ? "FLIPX " : "", - (rotation & BIT(DRM_REFLECT_Y)) ? "FLIPY " : "", + (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); =20 return buf; diff --git a/drivers/gpu/drm/i915/intel_atomic_plane.c b/drivers/gpu/dr= m/i915/intel_atomic_plane.c index 7de7721..7cc9c76 100644 --- a/drivers/gpu/drm/i915/intel_atomic_plane.c +++ b/drivers/gpu/drm/i915/intel_atomic_plane.c @@ -55,7 +55,7 @@ intel_create_plane_state(struct drm_plane *plane) return NULL; =20 state->base.plane =3D plane; - state->base.rotation =3D BIT(DRM_ROTATE_0); + state->base.rotation =3D DRM_ROTATE_0; state->ckey.flags =3D I915_SET_COLORKEY_NONE; =20 return state; diff --git a/drivers/gpu/drm/i915/intel_display.c b/drivers/gpu/drm/i91= 5/intel_display.c index c4c1c85..9275b5d 100644 --- a/drivers/gpu/drm/i915/intel_display.c +++ b/drivers/gpu/drm/i915/intel_display.c @@ -2688,7 +2688,7 @@ static void i9xx_update_primary_plane(struct drm_= plane *primary, intel_crtc->dspaddr_offset =3D linear_offset; } =20 - if (rotation =3D=3D BIT(DRM_ROTATE_180)) { + if (rotation =3D=3D DRM_ROTATE_180) { dspcntr |=3D DISPPLANE_ROTATE_180; =20 x +=3D (crtc_state->pipe_src_w - 1); @@ -2791,7 +2791,7 @@ static void ironlake_update_primary_plane(struct = drm_plane *primary, intel_compute_tile_offset(&x, &y, fb, 0, fb->pitches[0], rotation); linear_offset -=3D intel_crtc->dspaddr_offset; - if (rotation =3D=3D BIT(DRM_ROTATE_180)) { + if (rotation =3D=3D DRM_ROTATE_180) { dspcntr |=3D DISPPLANE_ROTATE_180; =20 if (!IS_HASWELL(dev) && !IS_BROADWELL(dev)) { @@ -2952,17 +2952,17 @@ u32 skl_plane_ctl_tiling(uint64_t fb_modifier) u32 skl_plane_ctl_rotation(unsigned int rotation) { switch (rotation) { - case BIT(DRM_ROTATE_0): + case DRM_ROTATE_0: break; /* * DRM_ROTATE_ is counter clockwise to stay compatible with Xrandr * while i915 HW rotation is clockwise, thats why this swapping. */ - case BIT(DRM_ROTATE_90): + case DRM_ROTATE_90: return PLANE_CTL_ROTATE_270; - case BIT(DRM_ROTATE_180): + case DRM_ROTATE_180: return PLANE_CTL_ROTATE_180; - case BIT(DRM_ROTATE_270): + case DRM_ROTATE_270: return PLANE_CTL_ROTATE_90; default: MISSING_CASE(rotation); @@ -4248,7 +4248,7 @@ int skl_update_scaler_crtc(struct intel_crtc_stat= e *state) intel_crtc->pipe, SKL_CRTC_INDEX); =20 return skl_update_scaler(state, !state->base.active, SKL_CRTC_INDEX, - &state->scaler_state.scaler_id, BIT(DRM_ROTATE_0), + &state->scaler_state.scaler_id, DRM_ROTATE_0, state->pipe_src_w, state->pipe_src_h, adjusted_mode->crtc_hdisplay, adjusted_mode->crtc_vdisplay); } @@ -10255,7 +10255,7 @@ static void i9xx_update_cursor(struct drm_crtc = *crtc, u32 base, if (HAS_DDI(dev)) cntl |=3D CURSOR_PIPE_CSC_ENABLE; =20 - if (plane_state->base.rotation =3D=3D BIT(DRM_ROTATE_180)) + if (plane_state->base.rotation =3D=3D DRM_ROTATE_180) cntl |=3D CURSOR_ROTATE_180; } =20 @@ -10301,7 +10301,7 @@ static void intel_crtc_update_cursor(struct drm= _crtc *crtc, =20 /* ILK+ do this automagically */ if (HAS_GMCH_DISPLAY(dev) && - plane_state->base.rotation =3D=3D BIT(DRM_ROTATE_180)) { + plane_state->base.rotation =3D=3D DRM_ROTATE_180) { base +=3D (plane_state->base.crtc_h * plane_state->base.crtc_w - 1) * 4; } @@ -14296,11 +14296,11 @@ fail: void intel_create_rotation_property(struct drm_device *dev, struct int= el_plane *plane) { if (!dev->mode_config.rotation_property) { - unsigned long flags =3D BIT(DRM_ROTATE_0) | - BIT(DRM_ROTATE_180); + unsigned long flags =3D DRM_ROTATE_0 | + DRM_ROTATE_180; =20 if (INTEL_INFO(dev)->gen >=3D 9) - flags |=3D BIT(DRM_ROTATE_90) | BIT(DRM_ROTATE_270); + flags |=3D DRM_ROTATE_90 | DRM_ROTATE_270; =20 dev->mode_config.rotation_property =3D drm_mode_create_rotation_property(dev, flags); @@ -14443,8 +14443,8 @@ static struct drm_plane *intel_cursor_plane_cre= ate(struct drm_device *dev, if (!dev->mode_config.rotation_property) dev->mode_config.rotation_property =3D drm_mode_create_rotation_property(dev, - BIT(DRM_ROTATE_0) | - BIT(DRM_ROTATE_180)); + DRM_ROTATE_0 | + DRM_ROTATE_180); if (dev->mode_config.rotation_property) drm_object_attach_property(&cursor->base.base, dev->mode_config.rotation_property, diff --git a/drivers/gpu/drm/i915/intel_drv.h b/drivers/gpu/drm/i915/in= tel_drv.h index e74d851..f82dcc5 100644 --- a/drivers/gpu/drm/i915/intel_drv.h +++ b/drivers/gpu/drm/i915/intel_drv.h @@ -1258,7 +1258,7 @@ unsigned int intel_tile_height(const struct drm_i= 915_private *dev_priv, static inline bool intel_rotation_90_or_270(unsigned int rotation) { - return rotation & (BIT(DRM_ROTATE_90) | BIT(DRM_ROTATE_270)); + return rotation & (DRM_ROTATE_90 | DRM_ROTATE_270); } =20 void intel_create_rotation_property(struct drm_device *dev, diff --git a/drivers/gpu/drm/i915/intel_fbc.c b/drivers/gpu/drm/i915/in= tel_fbc.c index 781e2f5..eff26d7 100644 --- a/drivers/gpu/drm/i915/intel_fbc.c +++ b/drivers/gpu/drm/i915/intel_fbc.c @@ -775,7 +775,7 @@ static bool intel_fbc_can_activate(struct intel_crt= c *crtc) return false; } if (INTEL_INFO(dev_priv)->gen <=3D 4 && !IS_G4X(dev_priv) && - cache->plane.rotation !=3D BIT(DRM_ROTATE_0)) { + cache->plane.rotation !=3D DRM_ROTATE_0) { fbc->no_fbc_reason =3D "rotation unsupported"; return false; } diff --git a/drivers/gpu/drm/i915/intel_fbdev.c b/drivers/gpu/drm/i915/= intel_fbdev.c index 6344999..4fee93d 100644 --- a/drivers/gpu/drm/i915/intel_fbdev.c +++ b/drivers/gpu/drm/i915/intel_fbdev.c @@ -223,7 +223,7 @@ static int intelfb_create(struct drm_fb_helper *hel= per, * This also validates that any existing fb inherited from the * BIOS is suitable for own access. */ - ret =3D intel_pin_and_fence_fb_obj(&ifbdev->fb->base, BIT(DRM_ROTATE_= 0)); + ret =3D intel_pin_and_fence_fb_obj(&ifbdev->fb->base, DRM_ROTATE_0); if (ret) goto out_unlock; =20 @@ -289,7 +289,7 @@ static int intelfb_create(struct drm_fb_helper *hel= per, out_destroy_fbi: drm_fb_helper_release_fbi(helper); out_unpin: - intel_unpin_fb_obj(&ifbdev->fb->base, BIT(DRM_ROTATE_0)); + intel_unpin_fb_obj(&ifbdev->fb->base, DRM_ROTATE_0); out_unlock: mutex_unlock(&dev->struct_mutex); return ret; @@ -554,7 +554,7 @@ static void intel_fbdev_destroy(struct intel_fbdev = *ifbdev) =20 if (ifbdev->fb) { mutex_lock(&ifbdev->helper.dev->struct_mutex); - intel_unpin_fb_obj(&ifbdev->fb->base, BIT(DRM_ROTATE_0)); + intel_unpin_fb_obj(&ifbdev->fb->base, DRM_ROTATE_0); mutex_unlock(&ifbdev->helper.dev->struct_mutex); =20 drm_framebuffer_remove(&ifbdev->fb->base); diff --git a/drivers/gpu/drm/i915/intel_sprite.c b/drivers/gpu/drm/i915= /intel_sprite.c index 0de935a..22ae2298 100644 --- a/drivers/gpu/drm/i915/intel_sprite.c +++ b/drivers/gpu/drm/i915/intel_sprite.c @@ -444,7 +444,7 @@ vlv_update_plane(struct drm_plane *dplane, fb->pitches[0], rotation); linear_offset -=3D sprsurf_offset; =20 - if (rotation =3D=3D BIT(DRM_ROTATE_180)) { + if (rotation =3D=3D DRM_ROTATE_180) { sprctl |=3D SP_ROTATE_180; =20 x +=3D src_w; @@ -577,7 +577,7 @@ ivb_update_plane(struct drm_plane *plane, fb->pitches[0], rotation); linear_offset -=3D sprsurf_offset; =20 - if (rotation =3D=3D BIT(DRM_ROTATE_180)) { + if (rotation =3D=3D DRM_ROTATE_180) { sprctl |=3D SPRITE_ROTATE_180; =20 /* HSW and BDW does this automagically in hardware */ @@ -714,7 +714,7 @@ ilk_update_plane(struct drm_plane *plane, fb->pitches[0], rotation); linear_offset -=3D dvssurf_offset; =20 - if (rotation =3D=3D BIT(DRM_ROTATE_180)) { + if (rotation =3D=3D DRM_ROTATE_180) { dvscntr |=3D DVS_ROTATE_180; =20 x +=3D src_w; diff --git a/drivers/gpu/drm/msm/mdp/mdp5/mdp5_plane.c b/drivers/gpu/dr= m/msm/mdp/mdp5/mdp5_plane.c index 432c098..a02a24e 100644 --- a/drivers/gpu/drm/msm/mdp/mdp5/mdp5_plane.c +++ b/drivers/gpu/drm/msm/mdp/mdp5/mdp5_plane.c @@ -78,7 +78,7 @@ static void mdp5_plane_install_rotation_property(stru= ct drm_device *dev, if (!dev->mode_config.rotation_property) dev->mode_config.rotation_property =3D drm_mode_create_rotation_property(dev, - BIT(DRM_REFLECT_X) | BIT(DRM_REFLECT_Y)); + DRM_REFLECT_X | DRM_REFLECT_Y); =20 if (dev->mode_config.rotation_property) drm_object_attach_property(&plane->base, @@ -309,8 +309,8 @@ static int mdp5_plane_atomic_check(struct drm_plane= *plane, return -EINVAL; } =20 - hflip =3D !!(state->rotation & BIT(DRM_REFLECT_X)); - vflip =3D !!(state->rotation & BIT(DRM_REFLECT_Y)); + hflip =3D !!(state->rotation & DRM_REFLECT_X); + vflip =3D !!(state->rotation & DRM_REFLECT_Y); if ((vflip && !(mdp5_plane->caps & MDP_PIPE_CAP_VFLIP)) || (hflip && !(mdp5_plane->caps & MDP_PIPE_CAP_HFLIP))) { dev_err(plane->dev->dev, @@ -743,8 +743,8 @@ static int mdp5_plane_mode_set(struct drm_plane *pl= ane, config |=3D get_scale_config(format, src_h, crtc_h, false); DBG("scale config =3D %x", config); =20 - hflip =3D !!(pstate->rotation & BIT(DRM_REFLECT_X)); - vflip =3D !!(pstate->rotation & BIT(DRM_REFLECT_Y)); + hflip =3D !!(pstate->rotation & DRM_REFLECT_X); + vflip =3D !!(pstate->rotation & DRM_REFLECT_Y); =20 spin_lock_irqsave(&mdp5_plane->pipe_lock, flags); =20 diff --git a/drivers/gpu/drm/omapdrm/omap_drv.c b/drivers/gpu/drm/omapd= rm/omap_drv.c index 26c6134..3dd78f2 100644 --- a/drivers/gpu/drm/omapdrm/omap_drv.c +++ b/drivers/gpu/drm/omapdrm/omap_drv.c @@ -295,9 +295,9 @@ static int omap_modeset_init_properties(struct drm_= device *dev) if (priv->has_dmm) { dev->mode_config.rotation_property =3D drm_mode_create_rotation_property(dev, - BIT(DRM_ROTATE_0) | BIT(DRM_ROTATE_90) | - BIT(DRM_ROTATE_180) | BIT(DRM_ROTATE_270) | - BIT(DRM_REFLECT_X) | BIT(DRM_REFLECT_Y)); + DRM_ROTATE_0 | DRM_ROTATE_90 | + DRM_ROTATE_180 | DRM_ROTATE_270 | + DRM_REFLECT_X | DRM_REFLECT_Y); if (!dev->mode_config.rotation_property) return -ENOMEM; } diff --git a/drivers/gpu/drm/omapdrm/omap_fb.c b/drivers/gpu/drm/omapdr= m/omap_fb.c index 31f5178..5f3337f 100644 --- a/drivers/gpu/drm/omapdrm/omap_fb.c +++ b/drivers/gpu/drm/omapdrm/omap_fb.c @@ -179,24 +179,24 @@ void omap_framebuffer_update_scanout(struct drm_f= ramebuffer *fb, (uint32_t)win->rotation); /* fallthru to default to no rotation */ case 0: - case BIT(DRM_ROTATE_0): + case DRM_ROTATE_0: orient =3D 0; break; - case BIT(DRM_ROTATE_90): + case DRM_ROTATE_90: orient =3D MASK_XY_FLIP | MASK_X_INVERT; break; - case BIT(DRM_ROTATE_180): + case DRM_ROTATE_180: orient =3D MASK_X_INVERT | MASK_Y_INVERT; break; - case BIT(DRM_ROTATE_270): + case DRM_ROTATE_270: orient =3D MASK_XY_FLIP | MASK_Y_INVERT; break; } =20 - if (win->rotation & BIT(DRM_REFLECT_X)) + if (win->rotation & DRM_REFLECT_X) orient ^=3D MASK_X_INVERT; =20 - if (win->rotation & BIT(DRM_REFLECT_Y)) + if (win->rotation & DRM_REFLECT_Y) orient ^=3D MASK_Y_INVERT; =20 /* adjust x,y offset for flip/invert: */ @@ -213,7 +213,7 @@ void omap_framebuffer_update_scanout(struct drm_fra= mebuffer *fb, } else { switch (win->rotation & DRM_ROTATE_MASK) { case 0: - case BIT(DRM_ROTATE_0): + case DRM_ROTATE_0: /* OK */ break; =20 diff --git a/drivers/gpu/drm/omapdrm/omap_plane.c b/drivers/gpu/drm/oma= pdrm/omap_plane.c index 5252ab7..4c7727e 100644 --- a/drivers/gpu/drm/omapdrm/omap_plane.c +++ b/drivers/gpu/drm/omapdrm/omap_plane.c @@ -109,8 +109,8 @@ static void omap_plane_atomic_update(struct drm_pla= ne *plane, win.src_y =3D state->src_y >> 16; =20 switch (state->rotation & DRM_ROTATE_MASK) { - case BIT(DRM_ROTATE_90): - case BIT(DRM_ROTATE_270): + case DRM_ROTATE_90: + case DRM_ROTATE_270: win.src_w =3D state->src_h >> 16; win.src_h =3D state->src_w >> 16; break; @@ -149,7 +149,7 @@ static void omap_plane_atomic_disable(struct drm_pl= ane *plane, struct omap_plane_state *omap_state =3D to_omap_plane_state(plane->st= ate); struct omap_plane *omap_plane =3D to_omap_plane(plane); =20 - plane->state->rotation =3D BIT(DRM_ROTATE_0); + plane->state->rotation =3D DRM_ROTATE_0; omap_state->zorder =3D plane->type =3D=3D DRM_PLANE_TYPE_PRIMARY ? 0 : omap_plane->id; =20 @@ -178,7 +178,7 @@ static int omap_plane_atomic_check(struct drm_plane= *plane, return -EINVAL; =20 if (state->fb) { - if (state->rotation !=3D BIT(DRM_ROTATE_0) && + if (state->rotation !=3D DRM_ROTATE_0 && !omap_framebuffer_supports_rotation(state->fb)) return -EINVAL; } @@ -269,7 +269,7 @@ static void omap_plane_reset(struct drm_plane *plan= e) */ omap_state->zorder =3D plane->type =3D=3D DRM_PLANE_TYPE_PRIMARY ? 0 : omap_plane->id; - omap_state->base.rotation =3D BIT(DRM_ROTATE_0); + omap_state->base.rotation =3D DRM_ROTATE_0; =20 plane->state =3D &omap_state->base; plane->state->plane =3D plane; diff --git a/include/drm/drm_crtc.h b/include/drm/drm_crtc.h index 3edeaf8..448625d 100644 --- a/include/drm/drm_crtc.h +++ b/include/drm/drm_crtc.h @@ -83,14 +83,15 @@ static inline uint64_t I642U64(int64_t val) * specified amount in degrees in counter clockwise direction. DRM_REF= LECT_X and * DRM_REFLECT_Y reflects the image along the specified axis prior to = rotation */ -#define DRM_ROTATE_MASK 0x0f -#define DRM_ROTATE_0 0 -#define DRM_ROTATE_90 1 -#define DRM_ROTATE_180 2 -#define DRM_ROTATE_270 3 -#define DRM_REFLECT_MASK (~DRM_ROTATE_MASK) -#define DRM_REFLECT_X 4 -#define DRM_REFLECT_Y 5 +#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) =20 enum drm_connector_force { DRM_FORCE_UNSPECIFIED, --=20 2.5.5