aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDamien Lespiau <damien.lespiau@intel.com>2015-01-20 07:51:45 -0500
committerDaniel Vetter <daniel.vetter@ffwll.ch>2015-01-27 03:51:01 -0500
commitec2c981e6232ac2039e679d24642b80fbbd2acc6 (patch)
treecd590182407207070ba74e88ffe78125cb117510
parent49af449b457b721ac5c18f537cf7484903f212f8 (diff)
drm/i915: Use a common function for computing the fb height alignment
If we need to change the fb height constraints, it sounds like a good idea to have to do it in one place only. v2: v2: Rebase on top of Ander's "Make intel_crtc->config a pointer" Reviewed-By: Tvrtko Ursulin <tvrtko.ursulin@intel.com> (v1) Signed-off-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.c19
-rw-r--r--drivers/gpu/drm/i915/intel_drv.h2
-rw-r--r--drivers/gpu/drm/i915/intel_fbdev.c3
3 files changed, 15 insertions, 9 deletions
diff --git a/drivers/gpu/drm/i915/intel_display.c b/drivers/gpu/drm/i915/intel_display.c
index 98cd20adac1f..91954ff8ec3e 100644
--- a/drivers/gpu/drm/i915/intel_display.c
+++ b/drivers/gpu/drm/i915/intel_display.c
@@ -2188,11 +2188,12 @@ static bool need_vtd_wa(struct drm_device *dev)
2188 return false; 2188 return false;
2189} 2189}
2190 2190
2191static int intel_align_height(struct drm_device *dev, int height, bool tiled) 2191int
2192intel_fb_align_height(struct drm_device *dev, int height, unsigned int tiling)
2192{ 2193{
2193 int tile_height; 2194 int tile_height;
2194 2195
2195 tile_height = tiled ? (IS_GEN2(dev) ? 16 : 8) : 1; 2196 tile_height = tiling ? (IS_GEN2(dev) ? 16 : 8) : 1;
2196 return ALIGN(height, tile_height); 2197 return ALIGN(height, tile_height);
2197} 2198}
2198 2199
@@ -6590,8 +6591,9 @@ static void i9xx_get_plane_config(struct intel_crtc *crtc,
6590 val = I915_READ(DSPSTRIDE(pipe)); 6591 val = I915_READ(DSPSTRIDE(pipe));
6591 crtc->base.primary->fb->pitches[0] = val & 0xffffffc0; 6592 crtc->base.primary->fb->pitches[0] = val & 0xffffffc0;
6592 6593
6593 aligned_height = intel_align_height(dev, crtc->base.primary->fb->height, 6594 aligned_height = intel_fb_align_height(dev,
6594 plane_config->tiling); 6595 crtc->base.primary->fb->height,
6596 plane_config->tiling);
6595 6597
6596 plane_config->size = PAGE_ALIGN(crtc->base.primary->fb->pitches[0] * 6598 plane_config->size = PAGE_ALIGN(crtc->base.primary->fb->pitches[0] *
6597 aligned_height); 6599 aligned_height);
@@ -7644,8 +7646,9 @@ static void ironlake_get_plane_config(struct intel_crtc *crtc,
7644 val = I915_READ(DSPSTRIDE(pipe)); 7646 val = I915_READ(DSPSTRIDE(pipe));
7645 crtc->base.primary->fb->pitches[0] = val & 0xffffffc0; 7647 crtc->base.primary->fb->pitches[0] = val & 0xffffffc0;
7646 7648
7647 aligned_height = intel_align_height(dev, crtc->base.primary->fb->height, 7649 aligned_height = intel_fb_align_height(dev,
7648 plane_config->tiling); 7650 crtc->base.primary->fb->height,
7651 plane_config->tiling);
7649 7652
7650 plane_config->size = PAGE_ALIGN(crtc->base.primary->fb->pitches[0] * 7653 plane_config->size = PAGE_ALIGN(crtc->base.primary->fb->pitches[0] *
7651 aligned_height); 7654 aligned_height);
@@ -12609,8 +12612,8 @@ static int intel_framebuffer_init(struct drm_device *dev,
12609 if (mode_cmd->offsets[0] != 0) 12612 if (mode_cmd->offsets[0] != 0)
12610 return -EINVAL; 12613 return -EINVAL;
12611 12614
12612 aligned_height = intel_align_height(dev, mode_cmd->height, 12615 aligned_height = intel_fb_align_height(dev, mode_cmd->height,
12613 obj->tiling_mode); 12616 obj->tiling_mode);
12614 /* FIXME drm helper for size checks (especially planar formats)? */ 12617 /* FIXME drm helper for size checks (especially planar formats)? */
12615 if (obj->base.size < aligned_height * mode_cmd->pitches[0]) 12618 if (obj->base.size < aligned_height * mode_cmd->pitches[0])
12616 return -EINVAL; 12619 return -EINVAL;
diff --git a/drivers/gpu/drm/i915/intel_drv.h b/drivers/gpu/drm/i915/intel_drv.h
index 04e2cfcc630b..47a452a5ed17 100644
--- a/drivers/gpu/drm/i915/intel_drv.h
+++ b/drivers/gpu/drm/i915/intel_drv.h
@@ -872,6 +872,8 @@ void intel_frontbuffer_flip(struct drm_device *dev,
872 intel_frontbuffer_flush(dev, frontbuffer_bits); 872 intel_frontbuffer_flush(dev, frontbuffer_bits);
873} 873}
874 874
875int intel_fb_align_height(struct drm_device *dev, int height,
876 unsigned int tiling);
875void intel_fb_obj_flush(struct drm_i915_gem_object *obj, bool retire); 877void intel_fb_obj_flush(struct drm_i915_gem_object *obj, bool retire);
876 878
877 879
diff --git a/drivers/gpu/drm/i915/intel_fbdev.c b/drivers/gpu/drm/i915/intel_fbdev.c
index 6b18821a0eb2..ece702235b38 100644
--- a/drivers/gpu/drm/i915/intel_fbdev.c
+++ b/drivers/gpu/drm/i915/intel_fbdev.c
@@ -593,7 +593,8 @@ static bool intel_fbdev_init_bios(struct drm_device *dev,
593 } 593 }
594 594
595 cur_size = intel_crtc->config->base.adjusted_mode.crtc_vdisplay; 595 cur_size = intel_crtc->config->base.adjusted_mode.crtc_vdisplay;
596 cur_size = ALIGN(cur_size, plane_config->tiling ? (IS_GEN2(dev) ? 16 : 8) : 1); 596 cur_size = intel_fb_align_height(dev, cur_size,
597 plane_config->tiling);
597 cur_size *= fb->base.pitches[0]; 598 cur_size *= fb->base.pitches[0];
598 DRM_DEBUG_KMS("pipe %c area: %dx%d, bpp: %d, size: %d\n", 599 DRM_DEBUG_KMS("pipe %c area: %dx%d, bpp: %d, size: %d\n",
599 pipe_name(intel_crtc->pipe), 600 pipe_name(intel_crtc->pipe),