From: Tvrtko Ursulin <tvrtko.ursulin@xxxxxxxxx> It will be used twice with support for planar NV12. Signed-off-by: Tvrtko Ursulin <tvrtko.ursulin@xxxxxxxxx> --- drivers/gpu/drm/i915/i915_gem_gtt.c | 27 ++++++++++++++++++++------- 1 file changed, 20 insertions(+), 7 deletions(-) diff --git a/drivers/gpu/drm/i915/i915_gem_gtt.c b/drivers/gpu/drm/i915/i915_gem_gtt.c index f5709d4..65c9d36 100644 --- a/drivers/gpu/drm/i915/i915_gem_gtt.c +++ b/drivers/gpu/drm/i915/i915_gem_gtt.c @@ -2680,6 +2680,24 @@ rotate_pages(dma_addr_t *in, unsigned int width, unsigned int height, } } +static unsigned long +intel_calc_tiled_geometry(struct drm_device *dev, + struct intel_rotation_info *rot_info, + unsigned int *width_pages, + unsigned int *height_pages, + unsigned int plane) +{ + unsigned int tile_height, tile_pitch; + + tile_height = intel_tile_height(dev, rot_info->pixel_format, + rot_info->fb_modifier, plane); + tile_pitch = PAGE_SIZE / tile_height; + *width_pages = DIV_ROUND_UP(rot_info->pitch, tile_pitch); + *height_pages = DIV_ROUND_UP(rot_info->height, tile_height); + + return (*width_pages) * (*height_pages); +} + static struct sg_table * intel_rotate_fb_obj_pages(struct i915_ggtt_view *ggtt_view, struct drm_i915_gem_object *obj) @@ -2691,19 +2709,14 @@ intel_rotate_fb_obj_pages(struct i915_ggtt_view *ggtt_view, unsigned long i; dma_addr_t *page_addr_list; struct sg_table *st; - unsigned int tile_pitch, tile_height; unsigned int width_pages, height_pages; int ret = -ENOMEM; pages = obj->base.size / PAGE_SIZE; /* Calculate tiling geometry. */ - tile_height = intel_tile_height(dev, rot_info->pixel_format, - rot_info->fb_modifier, 0); - tile_pitch = PAGE_SIZE / tile_height; - width_pages = DIV_ROUND_UP(rot_info->pitch, tile_pitch); - height_pages = DIV_ROUND_UP(rot_info->height, tile_height); - rot_pages = width_pages * height_pages; + rot_pages = intel_calc_tiled_geometry(dev, rot_info, + &width_pages, &height_pages, 0); /* Allocate a temporary list of source pages for random access. */ page_addr_list = drm_malloc_ab(pages, sizeof(dma_addr_t)); -- 2.4.0 _______________________________________________ Intel-gfx mailing list Intel-gfx@xxxxxxxxxxxxxxxxxxxxx http://lists.freedesktop.org/mailman/listinfo/intel-gfx