aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDamien Lespiau <damien.lespiau@intel.com>2015-02-27 06:15:21 -0500
committerDaniel Vetter <daniel.vetter@ffwll.ch>2015-02-27 12:10:55 -0500
commit40f4628391755b5406c46e55262b9a0bd4d5d4a7 (patch)
treed2ea5dcf4deeaf84217087b23cb5732c3f55a96d
parent1327b9a1d5da9e6018088c8ba04f89ec8ca1ec81 (diff)
drm/i915/skl: Adjust get_plane_config() to support Yb/Yf tiling
v2: Rebased for addfb2 interface and consolidated a bit. (Tvrtko Ursulin) v3: Rebased for fb modifier changes. (Tvrtko Ursulin) v4: Use intel_fb_stride_alignment instead of open coding. (Damien Lespiau) Signed-off-by: Damien Lespiau <damien.lespiau@intel.com> Signed-off-by: Tvrtko Ursulin <tvrtko.ursulin@intel.com> Reviewed-by: Tvrtko Ursulin <tvrtko.ursulin@intel.com> Reviewed-by: Damien Lespiau <damien.lespiau@intel.com> Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
-rw-r--r--drivers/gpu/drm/i915/intel_display.c40
1 files changed, 23 insertions, 17 deletions
diff --git a/drivers/gpu/drm/i915/intel_display.c b/drivers/gpu/drm/i915/intel_display.c
index 164d54689efe..e245bf6b8419 100644
--- a/drivers/gpu/drm/i915/intel_display.c
+++ b/drivers/gpu/drm/i915/intel_display.c
@@ -7740,7 +7740,7 @@ skylake_get_initial_plane_config(struct intel_crtc *crtc,
7740{ 7740{
7741 struct drm_device *dev = crtc->base.dev; 7741 struct drm_device *dev = crtc->base.dev;
7742 struct drm_i915_private *dev_priv = dev->dev_private; 7742 struct drm_i915_private *dev_priv = dev->dev_private;
7743 u32 val, base, offset, stride_mult; 7743 u32 val, base, offset, stride_mult, tiling;
7744 int pipe = crtc->pipe; 7744 int pipe = crtc->pipe;
7745 int fourcc, pixel_format; 7745 int fourcc, pixel_format;
7746 int aligned_height; 7746 int aligned_height;
@@ -7759,11 +7759,6 @@ skylake_get_initial_plane_config(struct intel_crtc *crtc,
7759 if (!(val & PLANE_CTL_ENABLE)) 7759 if (!(val & PLANE_CTL_ENABLE))
7760 goto error; 7760 goto error;
7761 7761
7762 if (val & PLANE_CTL_TILED_MASK) {
7763 plane_config->tiling = I915_TILING_X;
7764 fb->modifier[0] = I915_FORMAT_MOD_X_TILED;
7765 }
7766
7767 pixel_format = val & PLANE_CTL_FORMAT_MASK; 7762 pixel_format = val & PLANE_CTL_FORMAT_MASK;
7768 fourcc = skl_format_to_fourcc(pixel_format, 7763 fourcc = skl_format_to_fourcc(pixel_format,
7769 val & PLANE_CTL_ORDER_RGBX, 7764 val & PLANE_CTL_ORDER_RGBX,
@@ -7771,6 +7766,26 @@ skylake_get_initial_plane_config(struct intel_crtc *crtc,
7771 fb->pixel_format = fourcc; 7766 fb->pixel_format = fourcc;
7772 fb->bits_per_pixel = drm_format_plane_cpp(fourcc, 0) * 8; 7767 fb->bits_per_pixel = drm_format_plane_cpp(fourcc, 0) * 8;
7773 7768
7769 tiling = val & PLANE_CTL_TILED_MASK;
7770 switch (tiling) {
7771 case PLANE_CTL_TILED_LINEAR:
7772 fb->modifier[0] = DRM_FORMAT_MOD_NONE;
7773 break;
7774 case PLANE_CTL_TILED_X:
7775 plane_config->tiling = I915_TILING_X;
7776 fb->modifier[0] = I915_FORMAT_MOD_X_TILED;
7777 break;
7778 case PLANE_CTL_TILED_Y:
7779 fb->modifier[0] = I915_FORMAT_MOD_Y_TILED;
7780 break;
7781 case PLANE_CTL_TILED_YF:
7782 fb->modifier[0] = I915_FORMAT_MOD_Yf_TILED;
7783 break;
7784 default:
7785 MISSING_CASE(tiling);
7786 goto error;
7787 }
7788
7774 base = I915_READ(PLANE_SURF(pipe, 0)) & 0xfffff000; 7789 base = I915_READ(PLANE_SURF(pipe, 0)) & 0xfffff000;
7775 plane_config->base = base; 7790 plane_config->base = base;
7776 7791
@@ -7781,17 +7796,8 @@ skylake_get_initial_plane_config(struct intel_crtc *crtc,
7781 fb->width = ((val >> 0) & 0x1fff) + 1; 7796 fb->width = ((val >> 0) & 0x1fff) + 1;
7782 7797
7783 val = I915_READ(PLANE_STRIDE(pipe, 0)); 7798 val = I915_READ(PLANE_STRIDE(pipe, 0));
7784 switch (plane_config->tiling) { 7799 stride_mult = intel_fb_stride_alignment(dev, fb->modifier[0],
7785 case I915_TILING_NONE: 7800 fb->pixel_format);
7786 stride_mult = 64;
7787 break;
7788 case I915_TILING_X:
7789 stride_mult = 512;
7790 break;
7791 default:
7792 MISSING_CASE(plane_config->tiling);
7793 goto error;
7794 }
7795 fb->pitches[0] = (val & 0x3ff) * stride_mult; 7801 fb->pitches[0] = (val & 0x3ff) * stride_mult;
7796 7802
7797 aligned_height = intel_fb_align_height(dev, fb->height, 7803 aligned_height = intel_fb_align_height(dev, fb->height,