drm/i915: Pass stride to rotate_pages()
authorVille Syrjälä <ville.syrjala@linux.intel.com>
Wed, 20 Jan 2016 19:05:23 +0000 (21:05 +0200)
committerVille Syrjälä <ville.syrjala@linux.intel.com>
Thu, 28 Jan 2016 18:56:14 +0000 (20:56 +0200)
Pass stride in addition to width and height to rotate_pages(). For now
width and stride are the same, but once framebuffer offsets enter the
scene that may no longer be the case.

Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Link: http://patchwork.freedesktop.org/patch/msgid/1453316739-13296-3-git-send-email-ville.syrjala@linux.intel.com
Reviewed-by: Daniel Vetter <daniel.vetter@ffwll.ch>
drivers/gpu/drm/i915/i915_gem_gtt.c

index 5b660ff7fbdea79c835b9083d6c5e02641d7cdeb..b5aac6eb1d6188c7d3c854df387a7508b1ac2fcf 100644 (file)
@@ -3348,6 +3348,7 @@ i915_gem_obj_lookup_or_create_ggtt_vma(struct drm_i915_gem_object *obj,
 static struct scatterlist *
 rotate_pages(const dma_addr_t *in, unsigned int offset,
             unsigned int width, unsigned int height,
+            unsigned int stride,
             struct sg_table *st, struct scatterlist *sg)
 {
        unsigned int column, row;
@@ -3359,7 +3360,7 @@ rotate_pages(const dma_addr_t *in, unsigned int offset,
        }
 
        for (column = 0; column < width; column++) {
-               src_idx = width * (height - 1) + column;
+               src_idx = stride * (height - 1) + column;
                for (row = 0; row < height; row++) {
                        st->nents++;
                        /* We don't need the pages, but need to initialize
@@ -3370,7 +3371,7 @@ rotate_pages(const dma_addr_t *in, unsigned int offset,
                        sg_dma_address(sg) = in[offset + src_idx];
                        sg_dma_len(sg) = PAGE_SIZE;
                        sg = sg_next(sg);
-                       src_idx -= width;
+                       src_idx -= stride;
                }
        }
 
@@ -3423,6 +3424,7 @@ intel_rotate_fb_obj_pages(struct i915_ggtt_view *ggtt_view,
        /* Rotate the pages. */
        sg = rotate_pages(page_addr_list, 0,
                     rot_info->width_pages, rot_info->height_pages,
+                    rot_info->width_pages,
                     st, NULL);
 
        /* Append the UV plane if NV12. */
@@ -3438,6 +3440,7 @@ intel_rotate_fb_obj_pages(struct i915_ggtt_view *ggtt_view,
                rotate_pages(page_addr_list, uv_start_page,
                             rot_info->width_pages_uv,
                             rot_info->height_pages_uv,
+                            rot_info->width_pages_uv,
                             st, sg);
        }