Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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>

authored by

Joonas Lahtinen and committed by
Daniel Vetter
14152c8d 62209070

+8 -7
+1 -1
drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_plane.c
··· 633 633 if (!state->bpp[i]) 634 634 return -EINVAL; 635 635 636 - switch (state->base.rotation & 0xf) { 636 + switch (state->base.rotation & DRM_ROTATE_MASK) { 637 637 case BIT(DRM_ROTATE_90): 638 638 offset = ((y_offset + state->src_y + patched_src_w - 1) / 639 639 ydiv) * fb->pitches[i];
+2 -1
drivers/gpu/drm/drm_crtc.c
··· 5629 5629 { 5630 5630 if (rotation & ~supported_rotations) { 5631 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 5636 return rotation;
+2 -2
drivers/gpu/drm/drm_rect.c
··· 330 330 } 331 331 } 332 332 333 - switch (rotation & 0xf) { 333 + switch (rotation & DRM_ROTATE_MASK) { 334 334 case BIT(DRM_ROTATE_0): 335 335 break; 336 336 case BIT(DRM_ROTATE_90): ··· 390 390 { 391 391 struct drm_rect tmp; 392 392 393 - switch (rotation & 0xf) { 393 + switch (rotation & DRM_ROTATE_MASK) { 394 394 case BIT(DRM_ROTATE_0): 395 395 break; 396 396 case BIT(DRM_ROTATE_90):
+2 -2
drivers/gpu/drm/omapdrm/omap_fb.c
··· 171 171 uint32_t w = win->src_w; 172 172 uint32_t h = win->src_h; 173 173 174 - switch (win->rotation & 0xf) { 174 + switch (win->rotation & DRM_ROTATE_MASK) { 175 175 default: 176 176 dev_err(fb->dev->dev, "invalid rotation: %02x", 177 177 (uint32_t)win->rotation); ··· 209 209 info->rotation_type = OMAP_DSS_ROT_TILER; 210 210 info->screen_width = omap_gem_tiled_stride(plane->bo, orient); 211 211 } else { 212 - switch (win->rotation & 0xf) { 212 + switch (win->rotation & DRM_ROTATE_MASK) { 213 213 case 0: 214 214 case BIT(DRM_ROTATE_0): 215 215 /* OK */
+1 -1
drivers/gpu/drm/omapdrm/omap_plane.c
··· 108 108 win.src_x = state->src_x >> 16; 109 109 win.src_y = state->src_y >> 16; 110 110 111 - switch (state->rotation & 0xf) { 111 + switch (state->rotation & DRM_ROTATE_MASK) { 112 112 case BIT(DRM_ROTATE_90): 113 113 case BIT(DRM_ROTATE_270): 114 114 win.src_w = state->src_h >> 16;