diff options
author | Ville Syrjälä <ville.syrjala@linux.intel.com> | 2016-11-14 11:53:59 -0500 |
---|---|---|
committer | Ville Syrjälä <ville.syrjala@linux.intel.com> | 2016-11-14 12:58:26 -0500 |
commit | df0cd455e720e4c0a04a85eb8ec4d2dab2e37795 (patch) | |
tree | 97bfd1c4398cd626eb8865a608ba7b82a5903c13 /drivers/gpu/drm/i915 | |
parent | f22aa14352cc6f40fdb81cdb2e4f4f9d75613a37 (diff) |
drm/i915: Clean up rotation DSPCNTR/DVSCNTR/etc. setup
Move the plane control register rotation setup away from the
coordinate munging code. This will result in neater looking
code once we add reflection support for CHV.
v2: Drop the BIT(), drop some usless parens,
Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Reviewed-by: Chris Wilson <chris@chris-wilson.co.uk>
Reviewed-by: Joonas Lahtinen <joonas.lahtinen@linux.intel.com>
Link: http://patchwork.freedesktop.org/patch/msgid/1479142440-25283-3-git-send-email-ville.syrjala@linux.intel.com
Diffstat (limited to 'drivers/gpu/drm/i915')
-rw-r--r-- | drivers/gpu/drm/i915/intel_display.c | 24 | ||||
-rw-r--r-- | drivers/gpu/drm/i915/intel_sprite.c | 26 |
2 files changed, 27 insertions, 23 deletions
diff --git a/drivers/gpu/drm/i915/intel_display.c b/drivers/gpu/drm/i915/intel_display.c index 10dd1ef57c30..ecc7b5b444f6 100644 --- a/drivers/gpu/drm/i915/intel_display.c +++ b/drivers/gpu/drm/i915/intel_display.c | |||
@@ -3075,6 +3075,9 @@ static void i9xx_update_primary_plane(struct drm_plane *primary, | |||
3075 | fb->modifier[0] == I915_FORMAT_MOD_X_TILED) | 3075 | fb->modifier[0] == I915_FORMAT_MOD_X_TILED) |
3076 | dspcntr |= DISPPLANE_TILED; | 3076 | dspcntr |= DISPPLANE_TILED; |
3077 | 3077 | ||
3078 | if (rotation & DRM_ROTATE_180) | ||
3079 | dspcntr |= DISPPLANE_ROTATE_180; | ||
3080 | |||
3078 | if (IS_G4X(dev_priv)) | 3081 | if (IS_G4X(dev_priv)) |
3079 | dspcntr |= DISPPLANE_TRICKLE_FEED_DISABLE; | 3082 | dspcntr |= DISPPLANE_TRICKLE_FEED_DISABLE; |
3080 | 3083 | ||
@@ -3085,10 +3088,8 @@ static void i9xx_update_primary_plane(struct drm_plane *primary, | |||
3085 | intel_compute_tile_offset(&x, &y, plane_state, 0); | 3088 | intel_compute_tile_offset(&x, &y, plane_state, 0); |
3086 | 3089 | ||
3087 | if (rotation & DRM_ROTATE_180) { | 3090 | if (rotation & DRM_ROTATE_180) { |
3088 | dspcntr |= DISPPLANE_ROTATE_180; | 3091 | x += crtc_state->pipe_src_w - 1; |
3089 | 3092 | y += crtc_state->pipe_src_h - 1; | |
3090 | x += (crtc_state->pipe_src_w - 1); | ||
3091 | y += (crtc_state->pipe_src_h - 1); | ||
3092 | } | 3093 | } |
3093 | 3094 | ||
3094 | linear_offset = intel_fb_xy_to_linear(x, y, plane_state, 0); | 3095 | linear_offset = intel_fb_xy_to_linear(x, y, plane_state, 0); |
@@ -3180,6 +3181,9 @@ static void ironlake_update_primary_plane(struct drm_plane *primary, | |||
3180 | if (fb->modifier[0] == I915_FORMAT_MOD_X_TILED) | 3181 | if (fb->modifier[0] == I915_FORMAT_MOD_X_TILED) |
3181 | dspcntr |= DISPPLANE_TILED; | 3182 | dspcntr |= DISPPLANE_TILED; |
3182 | 3183 | ||
3184 | if (rotation & DRM_ROTATE_180) | ||
3185 | dspcntr |= DISPPLANE_ROTATE_180; | ||
3186 | |||
3183 | if (!IS_HASWELL(dev_priv) && !IS_BROADWELL(dev_priv)) | 3187 | if (!IS_HASWELL(dev_priv) && !IS_BROADWELL(dev_priv)) |
3184 | dspcntr |= DISPPLANE_TRICKLE_FEED_DISABLE; | 3188 | dspcntr |= DISPPLANE_TRICKLE_FEED_DISABLE; |
3185 | 3189 | ||
@@ -3188,13 +3192,11 @@ static void ironlake_update_primary_plane(struct drm_plane *primary, | |||
3188 | intel_crtc->dspaddr_offset = | 3192 | intel_crtc->dspaddr_offset = |
3189 | intel_compute_tile_offset(&x, &y, plane_state, 0); | 3193 | intel_compute_tile_offset(&x, &y, plane_state, 0); |
3190 | 3194 | ||
3191 | if (rotation & DRM_ROTATE_180) { | 3195 | /* HSW+ does this automagically in hardware */ |
3192 | dspcntr |= DISPPLANE_ROTATE_180; | 3196 | if (!IS_HASWELL(dev_priv) && !IS_BROADWELL(dev_priv) && |
3193 | 3197 | rotation & DRM_ROTATE_180) { | |
3194 | if (!IS_HASWELL(dev_priv) && !IS_BROADWELL(dev_priv)) { | 3198 | x += crtc_state->pipe_src_w - 1; |
3195 | x += (crtc_state->pipe_src_w - 1); | 3199 | y += crtc_state->pipe_src_h - 1; |
3196 | y += (crtc_state->pipe_src_h - 1); | ||
3197 | } | ||
3198 | } | 3200 | } |
3199 | 3201 | ||
3200 | linear_offset = intel_fb_xy_to_linear(x, y, plane_state, 0); | 3202 | linear_offset = intel_fb_xy_to_linear(x, y, plane_state, 0); |
diff --git a/drivers/gpu/drm/i915/intel_sprite.c b/drivers/gpu/drm/i915/intel_sprite.c index ea85d27af217..7951b70bf792 100644 --- a/drivers/gpu/drm/i915/intel_sprite.c +++ b/drivers/gpu/drm/i915/intel_sprite.c | |||
@@ -427,6 +427,9 @@ vlv_update_plane(struct drm_plane *dplane, | |||
427 | if (fb->modifier[0] == I915_FORMAT_MOD_X_TILED) | 427 | if (fb->modifier[0] == I915_FORMAT_MOD_X_TILED) |
428 | sprctl |= SP_TILED; | 428 | sprctl |= SP_TILED; |
429 | 429 | ||
430 | if (rotation & DRM_ROTATE_180) | ||
431 | sprctl |= SP_ROTATE_180; | ||
432 | |||
430 | /* Sizes are 0 based */ | 433 | /* Sizes are 0 based */ |
431 | src_w--; | 434 | src_w--; |
432 | src_h--; | 435 | src_h--; |
@@ -437,8 +440,6 @@ vlv_update_plane(struct drm_plane *dplane, | |||
437 | sprsurf_offset = intel_compute_tile_offset(&x, &y, plane_state, 0); | 440 | sprsurf_offset = intel_compute_tile_offset(&x, &y, plane_state, 0); |
438 | 441 | ||
439 | if (rotation & DRM_ROTATE_180) { | 442 | if (rotation & DRM_ROTATE_180) { |
440 | sprctl |= SP_ROTATE_180; | ||
441 | |||
442 | x += src_w; | 443 | x += src_w; |
443 | y += src_h; | 444 | y += src_h; |
444 | } | 445 | } |
@@ -546,6 +547,9 @@ ivb_update_plane(struct drm_plane *plane, | |||
546 | if (fb->modifier[0] == I915_FORMAT_MOD_X_TILED) | 547 | if (fb->modifier[0] == I915_FORMAT_MOD_X_TILED) |
547 | sprctl |= SPRITE_TILED; | 548 | sprctl |= SPRITE_TILED; |
548 | 549 | ||
550 | if (rotation & DRM_ROTATE_180) | ||
551 | sprctl |= SPRITE_ROTATE_180; | ||
552 | |||
549 | if (IS_HASWELL(dev_priv) || IS_BROADWELL(dev_priv)) | 553 | if (IS_HASWELL(dev_priv) || IS_BROADWELL(dev_priv)) |
550 | sprctl &= ~SPRITE_TRICKLE_FEED_DISABLE; | 554 | sprctl &= ~SPRITE_TRICKLE_FEED_DISABLE; |
551 | else | 555 | else |
@@ -566,14 +570,11 @@ ivb_update_plane(struct drm_plane *plane, | |||
566 | intel_add_fb_offsets(&x, &y, plane_state, 0); | 570 | intel_add_fb_offsets(&x, &y, plane_state, 0); |
567 | sprsurf_offset = intel_compute_tile_offset(&x, &y, plane_state, 0); | 571 | sprsurf_offset = intel_compute_tile_offset(&x, &y, plane_state, 0); |
568 | 572 | ||
569 | if (rotation & DRM_ROTATE_180) { | 573 | /* HSW+ does this automagically in hardware */ |
570 | sprctl |= SPRITE_ROTATE_180; | 574 | if (!IS_HASWELL(dev_priv) && !IS_BROADWELL(dev_priv) && |
571 | 575 | rotation & DRM_ROTATE_180) { | |
572 | /* HSW and BDW does this automagically in hardware */ | 576 | x += src_w; |
573 | if (!IS_HASWELL(dev_priv) && !IS_BROADWELL(dev_priv)) { | 577 | y += src_h; |
574 | x += src_w; | ||
575 | y += src_h; | ||
576 | } | ||
577 | } | 578 | } |
578 | 579 | ||
579 | linear_offset = intel_fb_xy_to_linear(x, y, plane_state, 0); | 580 | linear_offset = intel_fb_xy_to_linear(x, y, plane_state, 0); |
@@ -684,6 +685,9 @@ ilk_update_plane(struct drm_plane *plane, | |||
684 | if (fb->modifier[0] == I915_FORMAT_MOD_X_TILED) | 685 | if (fb->modifier[0] == I915_FORMAT_MOD_X_TILED) |
685 | dvscntr |= DVS_TILED; | 686 | dvscntr |= DVS_TILED; |
686 | 687 | ||
688 | if (rotation & DRM_ROTATE_180) | ||
689 | dvscntr |= DVS_ROTATE_180; | ||
690 | |||
687 | if (IS_GEN6(dev_priv)) | 691 | if (IS_GEN6(dev_priv)) |
688 | dvscntr |= DVS_TRICKLE_FEED_DISABLE; /* must disable */ | 692 | dvscntr |= DVS_TRICKLE_FEED_DISABLE; /* must disable */ |
689 | 693 | ||
@@ -701,8 +705,6 @@ ilk_update_plane(struct drm_plane *plane, | |||
701 | dvssurf_offset = intel_compute_tile_offset(&x, &y, plane_state, 0); | 705 | dvssurf_offset = intel_compute_tile_offset(&x, &y, plane_state, 0); |
702 | 706 | ||
703 | if (rotation & DRM_ROTATE_180) { | 707 | if (rotation & DRM_ROTATE_180) { |
704 | dvscntr |= DVS_ROTATE_180; | ||
705 | |||
706 | x += src_w; | 708 | x += src_w; |
707 | y += src_h; | 709 | y += src_h; |
708 | } | 710 | } |