Commit 804beb4b authored by Tvrtko Ursulin's avatar Tvrtko Ursulin Committed by Daniel Vetter

drm/i915: Support appending to the rotated pages mapping

By providing a start offset into the source array of pages, and returning the
end position in the scatter-gather table, we will be able to append the UV
plane to the rotated mapping in later patches.

v2: Rebase.
Signed-off-by: default avatarTvrtko Ursulin <tvrtko.ursulin@intel.com>
Reviewed-by: default avatarJoonas Lahtinen <joonas.lahtinen@linux.intel.com>
Signed-off-by: default avatarDaniel Vetter <daniel.vetter@ffwll.ch>
parent fe47ea0c
...@@ -3244,15 +3244,18 @@ i915_gem_obj_lookup_or_create_ggtt_vma(struct drm_i915_gem_object *obj, ...@@ -3244,15 +3244,18 @@ i915_gem_obj_lookup_or_create_ggtt_vma(struct drm_i915_gem_object *obj,
} }
static void static struct scatterlist *
rotate_pages(dma_addr_t *in, unsigned int width, unsigned int height, rotate_pages(dma_addr_t *in, unsigned int offset,
struct sg_table *st) unsigned int width, unsigned int height,
struct sg_table *st, struct scatterlist *sg)
{ {
unsigned int column, row; unsigned int column, row;
unsigned int src_idx; unsigned int src_idx;
struct scatterlist *sg = st->sgl;
st->nents = 0; if (!sg) {
st->nents = 0;
sg = st->sgl;
}
for (column = 0; column < width; column++) { for (column = 0; column < width; column++) {
src_idx = width * (height - 1) + column; src_idx = width * (height - 1) + column;
...@@ -3263,12 +3266,14 @@ rotate_pages(dma_addr_t *in, unsigned int width, unsigned int height, ...@@ -3263,12 +3266,14 @@ rotate_pages(dma_addr_t *in, unsigned int width, unsigned int height,
* The only thing we need are DMA addresses. * The only thing we need are DMA addresses.
*/ */
sg_set_page(sg, NULL, PAGE_SIZE, 0); sg_set_page(sg, NULL, PAGE_SIZE, 0);
sg_dma_address(sg) = in[src_idx]; sg_dma_address(sg) = in[offset + src_idx];
sg_dma_len(sg) = PAGE_SIZE; sg_dma_len(sg) = PAGE_SIZE;
sg = sg_next(sg); sg = sg_next(sg);
src_idx -= width; src_idx -= width;
} }
} }
return sg;
} }
static struct sg_table * static struct sg_table *
...@@ -3306,9 +3311,9 @@ intel_rotate_fb_obj_pages(struct i915_ggtt_view *ggtt_view, ...@@ -3306,9 +3311,9 @@ intel_rotate_fb_obj_pages(struct i915_ggtt_view *ggtt_view,
} }
/* Rotate the pages. */ /* Rotate the pages. */
rotate_pages(page_addr_list, rotate_pages(page_addr_list, 0,
rot_info->width_pages, rot_info->height_pages, rot_info->width_pages, rot_info->height_pages,
st); st, NULL);
DRM_DEBUG_KMS( DRM_DEBUG_KMS(
"Created rotated page mapping for object size %zu (pitch=%u, height=%u, pixel_format=0x%x, %ux%u tiles, %u pages).\n", "Created rotated page mapping for object size %zu (pitch=%u, height=%u, pixel_format=0x%x, %ux%u tiles, %u pages).\n",
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment