aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/gpu/drm
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/gpu/drm')
-rw-r--r--drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_plane.c4
-rw-r--r--drivers/gpu/drm/drm_atomic_helper.c2
-rw-r--r--drivers/gpu/drm/drm_crtc.c3
-rw-r--r--drivers/gpu/drm/i915/intel_atomic_plane.c3
-rw-r--r--drivers/gpu/drm/i915/intel_display.c16
-rw-r--r--drivers/gpu/drm/i915/intel_drv.h6
-rw-r--r--drivers/gpu/drm/i915/intel_fbc.c2
-rw-r--r--drivers/gpu/drm/i915/intel_pm.c12
-rw-r--r--drivers/gpu/drm/omapdrm/omap_plane.c8
9 files changed, 23 insertions, 33 deletions
diff --git a/drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_plane.c b/drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_plane.c
index 9d4c030672f0..b380179d4013 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,
393 393
394 if ((state->base.fb->pixel_format == DRM_FORMAT_YUV422 || 394 if ((state->base.fb->pixel_format == DRM_FORMAT_YUV422 ||
395 state->base.fb->pixel_format == DRM_FORMAT_NV61) && 395 state->base.fb->pixel_format == DRM_FORMAT_NV61) &&
396 (state->base.rotation & (DRM_ROTATE_90 | DRM_ROTATE_270))) 396 drm_rotation_90_or_270(state->base.rotation))
397 cfg |= ATMEL_HLCDC_YUV422ROT; 397 cfg |= ATMEL_HLCDC_YUV422ROT;
398 398
399 atmel_hlcdc_layer_update_cfg(&plane->layer, 399 atmel_hlcdc_layer_update_cfg(&plane->layer,
@@ -628,7 +628,7 @@ static int atmel_hlcdc_plane_atomic_check(struct drm_plane *p,
628 /* 628 /*
629 * Swap width and size in case of 90 or 270 degrees rotation 629 * Swap width and size in case of 90 or 270 degrees rotation
630 */ 630 */
631 if (state->base.rotation & (DRM_ROTATE_90 | DRM_ROTATE_270)) { 631 if (drm_rotation_90_or_270(state->base.rotation)) {
632 tmp = state->crtc_w; 632 tmp = state->crtc_w;
633 state->crtc_w = state->crtc_h; 633 state->crtc_w = state->crtc_h;
634 state->crtc_h = tmp; 634 state->crtc_h = tmp;
diff --git a/drivers/gpu/drm/drm_atomic_helper.c b/drivers/gpu/drm/drm_atomic_helper.c
index 07b432f43b98..f9362760bfb2 100644
--- a/drivers/gpu/drm/drm_atomic_helper.c
+++ b/drivers/gpu/drm/drm_atomic_helper.c
@@ -2399,7 +2399,7 @@ int __drm_atomic_helper_set_config(struct drm_mode_set *set,
2399 primary_state->crtc_h = vdisplay; 2399 primary_state->crtc_h = vdisplay;
2400 primary_state->src_x = set->x << 16; 2400 primary_state->src_x = set->x << 16;
2401 primary_state->src_y = set->y << 16; 2401 primary_state->src_y = set->y << 16;
2402 if (primary_state->rotation & (DRM_ROTATE_90 | DRM_ROTATE_270)) { 2402 if (drm_rotation_90_or_270(primary_state->rotation)) {
2403 primary_state->src_w = vdisplay << 16; 2403 primary_state->src_w = vdisplay << 16;
2404 primary_state->src_h = hdisplay << 16; 2404 primary_state->src_h = hdisplay << 16;
2405 } else { 2405 } else {
diff --git a/drivers/gpu/drm/drm_crtc.c b/drivers/gpu/drm/drm_crtc.c
index 60403bf7a4ff..13441e21117c 100644
--- a/drivers/gpu/drm/drm_crtc.c
+++ b/drivers/gpu/drm/drm_crtc.c
@@ -727,8 +727,7 @@ int drm_crtc_check_viewport(const struct drm_crtc *crtc,
727 drm_crtc_get_hv_timing(mode, &hdisplay, &vdisplay); 727 drm_crtc_get_hv_timing(mode, &hdisplay, &vdisplay);
728 728
729 if (crtc->state && 729 if (crtc->state &&
730 crtc->primary->state->rotation & (DRM_ROTATE_90 | 730 drm_rotation_90_or_270(crtc->primary->state->rotation))
731 DRM_ROTATE_270))
732 swap(hdisplay, vdisplay); 731 swap(hdisplay, vdisplay);
733 732
734 return drm_framebuffer_check_src_coords(x << 16, y << 16, 733 return drm_framebuffer_check_src_coords(x << 16, y << 16,
diff --git a/drivers/gpu/drm/i915/intel_atomic_plane.c b/drivers/gpu/drm/i915/intel_atomic_plane.c
index b82de3072d4f..c762ae549a1c 100644
--- a/drivers/gpu/drm/i915/intel_atomic_plane.c
+++ b/drivers/gpu/drm/i915/intel_atomic_plane.c
@@ -142,8 +142,9 @@ static int intel_plane_atomic_check(struct drm_plane *plane,
142 intel_state->clip.y2 = 142 intel_state->clip.y2 =
143 crtc_state->base.enable ? crtc_state->pipe_src_h : 0; 143 crtc_state->base.enable ? crtc_state->pipe_src_h : 0;
144 144
145 if (state->fb && intel_rotation_90_or_270(state->rotation)) { 145 if (state->fb && drm_rotation_90_or_270(state->rotation)) {
146 char *format_name; 146 char *format_name;
147
147 if (!(state->fb->modifier[0] == I915_FORMAT_MOD_Y_TILED || 148 if (!(state->fb->modifier[0] == I915_FORMAT_MOD_Y_TILED ||
148 state->fb->modifier[0] == I915_FORMAT_MOD_Yf_TILED)) { 149 state->fb->modifier[0] == I915_FORMAT_MOD_Yf_TILED)) {
149 DRM_DEBUG_KMS("Y/Yf tiling required for 90/270!\n"); 150 DRM_DEBUG_KMS("Y/Yf tiling required for 90/270!\n");
diff --git a/drivers/gpu/drm/i915/intel_display.c b/drivers/gpu/drm/i915/intel_display.c
index e11896cd2015..af18e2cce34b 100644
--- a/drivers/gpu/drm/i915/intel_display.c
+++ b/drivers/gpu/drm/i915/intel_display.c
@@ -2139,7 +2139,7 @@ intel_fill_fb_ggtt_view(struct i915_ggtt_view *view,
2139 const struct drm_framebuffer *fb, 2139 const struct drm_framebuffer *fb,
2140 unsigned int rotation) 2140 unsigned int rotation)
2141{ 2141{
2142 if (intel_rotation_90_or_270(rotation)) { 2142 if (drm_rotation_90_or_270(rotation)) {
2143 *view = i915_ggtt_view_rotated; 2143 *view = i915_ggtt_view_rotated;
2144 view->params.rotated = to_intel_framebuffer(fb)->rot_info; 2144 view->params.rotated = to_intel_framebuffer(fb)->rot_info;
2145 } else { 2145 } else {
@@ -2260,7 +2260,7 @@ void intel_unpin_fb_obj(struct drm_framebuffer *fb, unsigned int rotation)
2260static int intel_fb_pitch(const struct drm_framebuffer *fb, int plane, 2260static int intel_fb_pitch(const struct drm_framebuffer *fb, int plane,
2261 unsigned int rotation) 2261 unsigned int rotation)
2262{ 2262{
2263 if (intel_rotation_90_or_270(rotation)) 2263 if (drm_rotation_90_or_270(rotation))
2264 return to_intel_framebuffer(fb)->rotated[plane].pitch; 2264 return to_intel_framebuffer(fb)->rotated[plane].pitch;
2265 else 2265 else
2266 return fb->pitches[plane]; 2266 return fb->pitches[plane];
@@ -2296,7 +2296,7 @@ void intel_add_fb_offsets(int *x, int *y,
2296 const struct intel_framebuffer *intel_fb = to_intel_framebuffer(state->base.fb); 2296 const struct intel_framebuffer *intel_fb = to_intel_framebuffer(state->base.fb);
2297 unsigned int rotation = state->base.rotation; 2297 unsigned int rotation = state->base.rotation;
2298 2298
2299 if (intel_rotation_90_or_270(rotation)) { 2299 if (drm_rotation_90_or_270(rotation)) {
2300 *x += intel_fb->rotated[plane].x; 2300 *x += intel_fb->rotated[plane].x;
2301 *y += intel_fb->rotated[plane].y; 2301 *y += intel_fb->rotated[plane].y;
2302 } else { 2302 } else {
@@ -2360,7 +2360,7 @@ static u32 intel_adjust_tile_offset(int *x, int *y,
2360 intel_tile_dims(dev_priv, &tile_width, &tile_height, 2360 intel_tile_dims(dev_priv, &tile_width, &tile_height,
2361 fb->modifier[plane], cpp); 2361 fb->modifier[plane], cpp);
2362 2362
2363 if (intel_rotation_90_or_270(rotation)) { 2363 if (drm_rotation_90_or_270(rotation)) {
2364 pitch_tiles = pitch / tile_height; 2364 pitch_tiles = pitch / tile_height;
2365 swap(tile_width, tile_height); 2365 swap(tile_width, tile_height);
2366 } else { 2366 } else {
@@ -2416,7 +2416,7 @@ static u32 _intel_compute_tile_offset(const struct drm_i915_private *dev_priv,
2416 intel_tile_dims(dev_priv, &tile_width, &tile_height, 2416 intel_tile_dims(dev_priv, &tile_width, &tile_height,
2417 fb_modifier, cpp); 2417 fb_modifier, cpp);
2418 2418
2419 if (intel_rotation_90_or_270(rotation)) { 2419 if (drm_rotation_90_or_270(rotation)) {
2420 pitch_tiles = pitch / tile_height; 2420 pitch_tiles = pitch / tile_height;
2421 swap(tile_width, tile_height); 2421 swap(tile_width, tile_height);
2422 } else { 2422 } else {
@@ -2976,7 +2976,7 @@ int skl_check_plane_surface(struct intel_plane_state *plane_state)
2976 int ret; 2976 int ret;
2977 2977
2978 /* Rotate src coordinates to match rotated GTT view */ 2978 /* Rotate src coordinates to match rotated GTT view */
2979 if (intel_rotation_90_or_270(rotation)) 2979 if (drm_rotation_90_or_270(rotation))
2980 drm_rect_rotate(&plane_state->base.src, 2980 drm_rect_rotate(&plane_state->base.src,
2981 fb->width, fb->height, DRM_ROTATE_270); 2981 fb->width, fb->height, DRM_ROTATE_270);
2982 2982
@@ -3276,7 +3276,7 @@ u32 skl_plane_stride(const struct drm_framebuffer *fb, int plane,
3276 * The stride is either expressed as a multiple of 64 bytes chunks for 3276 * The stride is either expressed as a multiple of 64 bytes chunks for
3277 * linear buffers or in number of tiles for tiled buffers. 3277 * linear buffers or in number of tiles for tiled buffers.
3278 */ 3278 */
3279 if (intel_rotation_90_or_270(rotation)) { 3279 if (drm_rotation_90_or_270(rotation)) {
3280 int cpp = drm_format_plane_cpp(fb->pixel_format, plane); 3280 int cpp = drm_format_plane_cpp(fb->pixel_format, plane);
3281 3281
3282 stride /= intel_tile_height(dev_priv, fb->modifier[0], cpp); 3282 stride /= intel_tile_height(dev_priv, fb->modifier[0], cpp);
@@ -4666,7 +4666,7 @@ skl_update_scaler(struct intel_crtc_state *crtc_state, bool force_detach,
4666 to_intel_crtc(crtc_state->base.crtc); 4666 to_intel_crtc(crtc_state->base.crtc);
4667 int need_scaling; 4667 int need_scaling;
4668 4668
4669 need_scaling = intel_rotation_90_or_270(rotation) ? 4669 need_scaling = drm_rotation_90_or_270(rotation) ?
4670 (src_h != dst_w || src_w != dst_h): 4670 (src_h != dst_w || src_w != dst_h):
4671 (src_w != dst_w || src_h != dst_h); 4671 (src_w != dst_w || src_h != dst_h);
4672 4672
diff --git a/drivers/gpu/drm/i915/intel_drv.h b/drivers/gpu/drm/i915/intel_drv.h
index 8fd16adf069b..c6ae525fe1f5 100644
--- a/drivers/gpu/drm/i915/intel_drv.h
+++ b/drivers/gpu/drm/i915/intel_drv.h
@@ -1284,12 +1284,6 @@ int intel_plane_atomic_calc_changes(struct drm_crtc_state *crtc_state,
1284unsigned int intel_tile_height(const struct drm_i915_private *dev_priv, 1284unsigned int intel_tile_height(const struct drm_i915_private *dev_priv,
1285 uint64_t fb_modifier, unsigned int cpp); 1285 uint64_t fb_modifier, unsigned int cpp);
1286 1286
1287static inline bool
1288intel_rotation_90_or_270(unsigned int rotation)
1289{
1290 return rotation & (DRM_ROTATE_90 | DRM_ROTATE_270);
1291}
1292
1293void intel_create_rotation_property(struct drm_device *dev, 1287void intel_create_rotation_property(struct drm_device *dev,
1294 struct intel_plane *plane); 1288 struct intel_plane *plane);
1295 1289
diff --git a/drivers/gpu/drm/i915/intel_fbc.c b/drivers/gpu/drm/i915/intel_fbc.c
index faa67624e1ed..afc040be1172 100644
--- a/drivers/gpu/drm/i915/intel_fbc.c
+++ b/drivers/gpu/drm/i915/intel_fbc.c
@@ -84,7 +84,7 @@ static void intel_fbc_get_plane_source_size(struct intel_fbc_state_cache *cache,
84{ 84{
85 int w, h; 85 int w, h;
86 86
87 if (intel_rotation_90_or_270(cache->plane.rotation)) { 87 if (drm_rotation_90_or_270(cache->plane.rotation)) {
88 w = cache->plane.src_h; 88 w = cache->plane.src_h;
89 h = cache->plane.src_w; 89 h = cache->plane.src_w;
90 } else { 90 } else {
diff --git a/drivers/gpu/drm/i915/intel_pm.c b/drivers/gpu/drm/i915/intel_pm.c
index 2df06b703e3d..1472400ddce3 100644
--- a/drivers/gpu/drm/i915/intel_pm.c
+++ b/drivers/gpu/drm/i915/intel_pm.c
@@ -3151,7 +3151,7 @@ skl_plane_downscale_amount(const struct intel_plane_state *pstate)
3151 src_h = drm_rect_height(&pstate->base.src); 3151 src_h = drm_rect_height(&pstate->base.src);
3152 dst_w = drm_rect_width(&pstate->base.dst); 3152 dst_w = drm_rect_width(&pstate->base.dst);
3153 dst_h = drm_rect_height(&pstate->base.dst); 3153 dst_h = drm_rect_height(&pstate->base.dst);
3154 if (intel_rotation_90_or_270(pstate->base.rotation)) 3154 if (drm_rotation_90_or_270(pstate->base.rotation))
3155 swap(dst_w, dst_h); 3155 swap(dst_w, dst_h);
3156 3156
3157 downscale_h = max(src_h / dst_h, (uint32_t)DRM_PLANE_HELPER_NO_SCALING); 3157 downscale_h = max(src_h / dst_h, (uint32_t)DRM_PLANE_HELPER_NO_SCALING);
@@ -3182,7 +3182,7 @@ skl_plane_relative_data_rate(const struct intel_crtc_state *cstate,
3182 width = drm_rect_width(&intel_pstate->base.src) >> 16; 3182 width = drm_rect_width(&intel_pstate->base.src) >> 16;
3183 height = drm_rect_height(&intel_pstate->base.src) >> 16; 3183 height = drm_rect_height(&intel_pstate->base.src) >> 16;
3184 3184
3185 if (intel_rotation_90_or_270(pstate->rotation)) 3185 if (drm_rotation_90_or_270(pstate->rotation))
3186 swap(width, height); 3186 swap(width, height);
3187 3187
3188 /* for planar format */ 3188 /* for planar format */
@@ -3282,7 +3282,7 @@ skl_ddb_min_alloc(const struct drm_plane_state *pstate,
3282 src_w = drm_rect_width(&intel_pstate->base.src) >> 16; 3282 src_w = drm_rect_width(&intel_pstate->base.src) >> 16;
3283 src_h = drm_rect_height(&intel_pstate->base.src) >> 16; 3283 src_h = drm_rect_height(&intel_pstate->base.src) >> 16;
3284 3284
3285 if (intel_rotation_90_or_270(pstate->rotation)) 3285 if (drm_rotation_90_or_270(pstate->rotation))
3286 swap(src_w, src_h); 3286 swap(src_w, src_h);
3287 3287
3288 /* Halve UV plane width and height for NV12 */ 3288 /* Halve UV plane width and height for NV12 */
@@ -3296,7 +3296,7 @@ skl_ddb_min_alloc(const struct drm_plane_state *pstate,
3296 else 3296 else
3297 plane_bpp = drm_format_plane_cpp(fb->pixel_format, 0); 3297 plane_bpp = drm_format_plane_cpp(fb->pixel_format, 0);
3298 3298
3299 if (intel_rotation_90_or_270(pstate->rotation)) { 3299 if (drm_rotation_90_or_270(pstate->rotation)) {
3300 switch (plane_bpp) { 3300 switch (plane_bpp) {
3301 case 1: 3301 case 1:
3302 min_scanlines = 32; 3302 min_scanlines = 32;
@@ -3554,7 +3554,7 @@ static int skl_compute_plane_wm(const struct drm_i915_private *dev_priv,
3554 width = drm_rect_width(&intel_pstate->base.src) >> 16; 3554 width = drm_rect_width(&intel_pstate->base.src) >> 16;
3555 height = drm_rect_height(&intel_pstate->base.src) >> 16; 3555 height = drm_rect_height(&intel_pstate->base.src) >> 16;
3556 3556
3557 if (intel_rotation_90_or_270(pstate->rotation)) 3557 if (drm_rotation_90_or_270(pstate->rotation))
3558 swap(width, height); 3558 swap(width, height);
3559 3559
3560 cpp = drm_format_plane_cpp(fb->pixel_format, 0); 3560 cpp = drm_format_plane_cpp(fb->pixel_format, 0);
@@ -3575,7 +3575,7 @@ static int skl_compute_plane_wm(const struct drm_i915_private *dev_priv,
3575 fb->modifier[0] == I915_FORMAT_MOD_Yf_TILED) { 3575 fb->modifier[0] == I915_FORMAT_MOD_Yf_TILED) {
3576 uint32_t min_scanlines = 4; 3576 uint32_t min_scanlines = 4;
3577 uint32_t y_tile_minimum; 3577 uint32_t y_tile_minimum;
3578 if (intel_rotation_90_or_270(pstate->rotation)) { 3578 if (drm_rotation_90_or_270(pstate->rotation)) {
3579 int cpp = (fb->pixel_format == DRM_FORMAT_NV12) ? 3579 int cpp = (fb->pixel_format == DRM_FORMAT_NV12) ?
3580 drm_format_plane_cpp(fb->pixel_format, 1) : 3580 drm_format_plane_cpp(fb->pixel_format, 1) :
3581 drm_format_plane_cpp(fb->pixel_format, 0); 3581 drm_format_plane_cpp(fb->pixel_format, 0);
diff --git a/drivers/gpu/drm/omapdrm/omap_plane.c b/drivers/gpu/drm/omapdrm/omap_plane.c
index 66ac8c40db26..1549e8393056 100644
--- a/drivers/gpu/drm/omapdrm/omap_plane.c
+++ b/drivers/gpu/drm/omapdrm/omap_plane.c
@@ -108,16 +108,12 @@ 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 & DRM_ROTATE_MASK) { 111 if (drm_rotation_90_or_270(state->rotation)) {
112 case DRM_ROTATE_90:
113 case DRM_ROTATE_270:
114 win.src_w = state->src_h >> 16; 112 win.src_w = state->src_h >> 16;
115 win.src_h = state->src_w >> 16; 113 win.src_h = state->src_w >> 16;
116 break; 114 } else {
117 default:
118 win.src_w = state->src_w >> 16; 115 win.src_w = state->src_w >> 16;
119 win.src_h = state->src_h >> 16; 116 win.src_h = state->src_h >> 16;
120 break;
121 } 117 }
122 118
123 /* update scanout: */ 119 /* update scanout: */