aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJoonas Lahtinen <joonas.lahtinen@linux.intel.com>2015-10-01 03:00:58 -0400
committerDaniel Vetter <daniel.vetter@ffwll.ch>2015-10-05 09:32:51 -0400
commit14152c8d30bbe5155d0438feb0a1931aee0e5bce (patch)
tree95413eb6b55273473746f8d65a8c93720c75eaad
parent6220907089cc3eb4ab2fa7073bbf617b019666c5 (diff)
drm: Use DRM_ROTATE_MASK and DRM_REFLECT_MASK
Avoid magic numbers and use the introduced defines. Cc: Ville Syrjälä <ville.syrjala@linux.intel.com> Signed-off-by: Joonas Lahtinen <joonas.lahtinen@linux.intel.com> Reviewed-by: Ville Syrjälä <ville.syrjala@linux.intel.com> Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
-rw-r--r--drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_plane.c2
-rw-r--r--drivers/gpu/drm/drm_crtc.c3
-rw-r--r--drivers/gpu/drm/drm_rect.c4
-rw-r--r--drivers/gpu/drm/omapdrm/omap_fb.c4
-rw-r--r--drivers/gpu/drm/omapdrm/omap_plane.c2
5 files changed, 8 insertions, 7 deletions
diff --git a/drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_plane.c b/drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_plane.c
index 36fda86b3518..d0299aed517e 100644
--- a/drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_plane.c
+++ b/drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_plane.c
@@ -633,7 +633,7 @@ static int atmel_hlcdc_plane_atomic_check(struct drm_plane *p,
633 if (!state->bpp[i]) 633 if (!state->bpp[i])
634 return -EINVAL; 634 return -EINVAL;
635 635
636 switch (state->base.rotation & 0xf) { 636 switch (state->base.rotation & DRM_ROTATE_MASK) {
637 case BIT(DRM_ROTATE_90): 637 case BIT(DRM_ROTATE_90):
638 offset = ((y_offset + state->src_y + patched_src_w - 1) / 638 offset = ((y_offset + state->src_y + patched_src_w - 1) /
639 ydiv) * fb->pitches[i]; 639 ydiv) * fb->pitches[i];
diff --git a/drivers/gpu/drm/drm_crtc.c b/drivers/gpu/drm/drm_crtc.c
index e600a5fb2b60..e7c842289568 100644
--- a/drivers/gpu/drm/drm_crtc.c
+++ b/drivers/gpu/drm/drm_crtc.c
@@ -5629,7 +5629,8 @@ unsigned int drm_rotation_simplify(unsigned int rotation,
5629{ 5629{
5630 if (rotation & ~supported_rotations) { 5630 if (rotation & ~supported_rotations) {
5631 rotation ^= BIT(DRM_REFLECT_X) | BIT(DRM_REFLECT_Y); 5631 rotation ^= BIT(DRM_REFLECT_X) | BIT(DRM_REFLECT_Y);
5632 rotation = (rotation & ~0xf) | BIT((ffs(rotation & 0xf) + 1) % 4); 5632 rotation = (rotation & DRM_REFLECT_MASK) |
5633 BIT((ffs(rotation & DRM_ROTATE_MASK) + 1) % 4);
5633 } 5634 }
5634 5635
5635 return rotation; 5636 return rotation;
diff --git a/drivers/gpu/drm/drm_rect.c b/drivers/gpu/drm/drm_rect.c
index 631f5afd451c..531ac4cc9756 100644
--- a/drivers/gpu/drm/drm_rect.c
+++ b/drivers/gpu/drm/drm_rect.c
@@ -330,7 +330,7 @@ void drm_rect_rotate(struct drm_rect *r,
330 } 330 }
331 } 331 }
332 332
333 switch (rotation & 0xf) { 333 switch (rotation & DRM_ROTATE_MASK) {
334 case BIT(DRM_ROTATE_0): 334 case BIT(DRM_ROTATE_0):
335 break; 335 break;
336 case BIT(DRM_ROTATE_90): 336 case BIT(DRM_ROTATE_90):
@@ -390,7 +390,7 @@ void drm_rect_rotate_inv(struct drm_rect *r,
390{ 390{
391 struct drm_rect tmp; 391 struct drm_rect tmp;
392 392
393 switch (rotation & 0xf) { 393 switch (rotation & DRM_ROTATE_MASK) {
394 case BIT(DRM_ROTATE_0): 394 case BIT(DRM_ROTATE_0):
395 break; 395 break;
396 case BIT(DRM_ROTATE_90): 396 case BIT(DRM_ROTATE_90):
diff --git a/drivers/gpu/drm/omapdrm/omap_fb.c b/drivers/gpu/drm/omapdrm/omap_fb.c
index 51b1219af87f..636a1f921569 100644
--- a/drivers/gpu/drm/omapdrm/omap_fb.c
+++ b/drivers/gpu/drm/omapdrm/omap_fb.c
@@ -171,7 +171,7 @@ void omap_framebuffer_update_scanout(struct drm_framebuffer *fb,
171 uint32_t w = win->src_w; 171 uint32_t w = win->src_w;
172 uint32_t h = win->src_h; 172 uint32_t h = win->src_h;
173 173
174 switch (win->rotation & 0xf) { 174 switch (win->rotation & DRM_ROTATE_MASK) {
175 default: 175 default:
176 dev_err(fb->dev->dev, "invalid rotation: %02x", 176 dev_err(fb->dev->dev, "invalid rotation: %02x",
177 (uint32_t)win->rotation); 177 (uint32_t)win->rotation);
@@ -209,7 +209,7 @@ void omap_framebuffer_update_scanout(struct drm_framebuffer *fb,
209 info->rotation_type = OMAP_DSS_ROT_TILER; 209 info->rotation_type = OMAP_DSS_ROT_TILER;
210 info->screen_width = omap_gem_tiled_stride(plane->bo, orient); 210 info->screen_width = omap_gem_tiled_stride(plane->bo, orient);
211 } else { 211 } else {
212 switch (win->rotation & 0xf) { 212 switch (win->rotation & DRM_ROTATE_MASK) {
213 case 0: 213 case 0:
214 case BIT(DRM_ROTATE_0): 214 case BIT(DRM_ROTATE_0):
215 /* OK */ 215 /* OK */
diff --git a/drivers/gpu/drm/omapdrm/omap_plane.c b/drivers/gpu/drm/omapdrm/omap_plane.c
index 09e363bb55f2..3054bda72688 100644
--- a/drivers/gpu/drm/omapdrm/omap_plane.c
+++ b/drivers/gpu/drm/omapdrm/omap_plane.c
@@ -108,7 +108,7 @@ static void omap_plane_atomic_update(struct drm_plane *plane,
108 win.src_x = state->src_x >> 16; 108 win.src_x = state->src_x >> 16;
109 win.src_y = state->src_y >> 16; 109 win.src_y = state->src_y >> 16;
110 110
111 switch (state->rotation & 0xf) { 111 switch (state->rotation & DRM_ROTATE_MASK) {
112 case BIT(DRM_ROTATE_90): 112 case BIT(DRM_ROTATE_90):
113 case BIT(DRM_ROTATE_270): 113 case BIT(DRM_ROTATE_270):
114 win.src_w = state->src_h >> 16; 114 win.src_w = state->src_h >> 16;