Commit 3bb6a442 authored by Niranjana Vishwanathapura's avatar Niranjana Vishwanathapura Committed by Tvrtko Ursulin

drm/i915: Rename ggtt_view as gtt_view

So far, different views (normal, partial, rotated and remapped)
into the same object are only supported for GGTT mappings.
But with the upcoming VM_BIND feature, PPGTT will also use the
partial view mapping. Hence rename ggtt_view to more generic
gtt_view.
Signed-off-by: default avatarNiranjana Vishwanathapura <niranjana.vishwanathapura@intel.com>
Acked-by: default avatarTvrtko Ursulin <tvrtko.ursulin@intel.com>
Reviewed-by: default avatarTvrtko Ursulin <tvrtko.ursulin@intel.com>
Signed-off-by: default avatarTvrtko Ursulin <tvrtko.ursulin@intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20220901183854.3446-1-niranjana.vishwanathapura@intel.com
parent 65332a5b
...@@ -672,7 +672,7 @@ bool intel_plane_uses_fence(const struct intel_plane_state *plane_state) ...@@ -672,7 +672,7 @@ bool intel_plane_uses_fence(const struct intel_plane_state *plane_state)
return DISPLAY_VER(dev_priv) < 4 || return DISPLAY_VER(dev_priv) < 4 ||
(plane->fbc && (plane->fbc &&
plane_state->view.gtt.type == I915_GGTT_VIEW_NORMAL); plane_state->view.gtt.type == I915_GTT_VIEW_NORMAL);
} }
/* /*
......
...@@ -45,7 +45,7 @@ struct drm_modeset_acquire_ctx; ...@@ -45,7 +45,7 @@ struct drm_modeset_acquire_ctx;
struct drm_plane; struct drm_plane;
struct drm_plane_state; struct drm_plane_state;
struct i915_address_space; struct i915_address_space;
struct i915_ggtt_view; struct i915_gtt_view;
struct intel_atomic_state; struct intel_atomic_state;
struct intel_crtc; struct intel_crtc;
struct intel_crtc_state; struct intel_crtc_state;
......
...@@ -104,7 +104,7 @@ struct intel_fb_view { ...@@ -104,7 +104,7 @@ struct intel_fb_view {
* In the normal view the FB object's backing store sg list is used * In the normal view the FB object's backing store sg list is used
* directly and hence the remap information here is not used. * directly and hence the remap information here is not used.
*/ */
struct i915_ggtt_view gtt; struct i915_gtt_view gtt;
/* /*
* The GTT view (gtt.type) specific information for each FB color * The GTT view (gtt.type) specific information for each FB color
......
...@@ -1394,7 +1394,7 @@ static u32 calc_plane_remap_info(const struct intel_framebuffer *fb, int color_p ...@@ -1394,7 +1394,7 @@ static u32 calc_plane_remap_info(const struct intel_framebuffer *fb, int color_p
plane_view_height_tiles(fb, color_plane, dims, y)); plane_view_height_tiles(fb, color_plane, dims, y));
} }
if (view->gtt.type == I915_GGTT_VIEW_ROTATED) { if (view->gtt.type == I915_GTT_VIEW_ROTATED) {
drm_WARN_ON(&i915->drm, remap_info->linear); drm_WARN_ON(&i915->drm, remap_info->linear);
check_array_bounds(i915, view->gtt.rotated.plane, color_plane); check_array_bounds(i915, view->gtt.rotated.plane, color_plane);
...@@ -1419,7 +1419,7 @@ static u32 calc_plane_remap_info(const struct intel_framebuffer *fb, int color_p ...@@ -1419,7 +1419,7 @@ static u32 calc_plane_remap_info(const struct intel_framebuffer *fb, int color_p
/* rotate the tile dimensions to match the GTT view */ /* rotate the tile dimensions to match the GTT view */
swap(tile_width, tile_height); swap(tile_width, tile_height);
} else { } else {
drm_WARN_ON(&i915->drm, view->gtt.type != I915_GGTT_VIEW_REMAPPED); drm_WARN_ON(&i915->drm, view->gtt.type != I915_GTT_VIEW_REMAPPED);
check_array_bounds(i915, view->gtt.remapped.plane, color_plane); check_array_bounds(i915, view->gtt.remapped.plane, color_plane);
...@@ -1502,12 +1502,12 @@ calc_plane_normal_size(const struct intel_framebuffer *fb, int color_plane, ...@@ -1502,12 +1502,12 @@ calc_plane_normal_size(const struct intel_framebuffer *fb, int color_plane,
} }
static void intel_fb_view_init(struct drm_i915_private *i915, struct intel_fb_view *view, static void intel_fb_view_init(struct drm_i915_private *i915, struct intel_fb_view *view,
enum i915_ggtt_view_type view_type) enum i915_gtt_view_type view_type)
{ {
memset(view, 0, sizeof(*view)); memset(view, 0, sizeof(*view));
view->gtt.type = view_type; view->gtt.type = view_type;
if (view_type == I915_GGTT_VIEW_REMAPPED && IS_ALDERLAKE_P(i915)) if (view_type == I915_GTT_VIEW_REMAPPED && IS_ALDERLAKE_P(i915))
view->gtt.remapped.plane_alignment = SZ_2M / PAGE_SIZE; view->gtt.remapped.plane_alignment = SZ_2M / PAGE_SIZE;
} }
...@@ -1529,16 +1529,16 @@ int intel_fill_fb_info(struct drm_i915_private *i915, struct intel_framebuffer * ...@@ -1529,16 +1529,16 @@ int intel_fill_fb_info(struct drm_i915_private *i915, struct intel_framebuffer *
int i, num_planes = fb->base.format->num_planes; int i, num_planes = fb->base.format->num_planes;
unsigned int tile_size = intel_tile_size(i915); unsigned int tile_size = intel_tile_size(i915);
intel_fb_view_init(i915, &fb->normal_view, I915_GGTT_VIEW_NORMAL); intel_fb_view_init(i915, &fb->normal_view, I915_GTT_VIEW_NORMAL);
drm_WARN_ON(&i915->drm, drm_WARN_ON(&i915->drm,
intel_fb_supports_90_270_rotation(fb) && intel_fb_supports_90_270_rotation(fb) &&
intel_fb_needs_pot_stride_remap(fb)); intel_fb_needs_pot_stride_remap(fb));
if (intel_fb_supports_90_270_rotation(fb)) if (intel_fb_supports_90_270_rotation(fb))
intel_fb_view_init(i915, &fb->rotated_view, I915_GGTT_VIEW_ROTATED); intel_fb_view_init(i915, &fb->rotated_view, I915_GTT_VIEW_ROTATED);
if (intel_fb_needs_pot_stride_remap(fb)) if (intel_fb_needs_pot_stride_remap(fb))
intel_fb_view_init(i915, &fb->remapped_view, I915_GGTT_VIEW_REMAPPED); intel_fb_view_init(i915, &fb->remapped_view, I915_GTT_VIEW_REMAPPED);
for (i = 0; i < num_planes; i++) { for (i = 0; i < num_planes; i++) {
struct fb_plane_view_dims view_dims; struct fb_plane_view_dims view_dims;
...@@ -1619,8 +1619,8 @@ static void intel_plane_remap_gtt(struct intel_plane_state *plane_state) ...@@ -1619,8 +1619,8 @@ static void intel_plane_remap_gtt(struct intel_plane_state *plane_state)
u32 gtt_offset = 0; u32 gtt_offset = 0;
intel_fb_view_init(i915, &plane_state->view, intel_fb_view_init(i915, &plane_state->view,
drm_rotation_90_or_270(rotation) ? I915_GGTT_VIEW_ROTATED : drm_rotation_90_or_270(rotation) ? I915_GTT_VIEW_ROTATED :
I915_GGTT_VIEW_REMAPPED); I915_GTT_VIEW_REMAPPED);
src_x = plane_state->uapi.src.x1 >> 16; src_x = plane_state->uapi.src.x1 >> 16;
src_y = plane_state->uapi.src.y1 >> 16; src_y = plane_state->uapi.src.y1 >> 16;
......
...@@ -18,7 +18,7 @@ ...@@ -18,7 +18,7 @@
static struct i915_vma * static struct i915_vma *
intel_pin_fb_obj_dpt(struct drm_framebuffer *fb, intel_pin_fb_obj_dpt(struct drm_framebuffer *fb,
const struct i915_ggtt_view *view, const struct i915_gtt_view *view,
bool uses_fence, bool uses_fence,
unsigned long *out_flags, unsigned long *out_flags,
struct i915_address_space *vm) struct i915_address_space *vm)
...@@ -79,7 +79,7 @@ intel_pin_fb_obj_dpt(struct drm_framebuffer *fb, ...@@ -79,7 +79,7 @@ intel_pin_fb_obj_dpt(struct drm_framebuffer *fb,
struct i915_vma * struct i915_vma *
intel_pin_and_fence_fb_obj(struct drm_framebuffer *fb, intel_pin_and_fence_fb_obj(struct drm_framebuffer *fb,
bool phys_cursor, bool phys_cursor,
const struct i915_ggtt_view *view, const struct i915_gtt_view *view,
bool uses_fence, bool uses_fence,
unsigned long *out_flags) unsigned long *out_flags)
{ {
......
...@@ -11,12 +11,12 @@ ...@@ -11,12 +11,12 @@
struct drm_framebuffer; struct drm_framebuffer;
struct i915_vma; struct i915_vma;
struct intel_plane_state; struct intel_plane_state;
struct i915_ggtt_view; struct i915_gtt_view;
struct i915_vma * struct i915_vma *
intel_pin_and_fence_fb_obj(struct drm_framebuffer *fb, intel_pin_and_fence_fb_obj(struct drm_framebuffer *fb,
bool phys_cursor, bool phys_cursor,
const struct i915_ggtt_view *view, const struct i915_gtt_view *view,
bool uses_fence, bool uses_fence,
unsigned long *out_flags); unsigned long *out_flags);
......
...@@ -198,8 +198,8 @@ static int intelfb_create(struct drm_fb_helper *helper, ...@@ -198,8 +198,8 @@ static int intelfb_create(struct drm_fb_helper *helper,
struct drm_i915_private *dev_priv = to_i915(dev); struct drm_i915_private *dev_priv = to_i915(dev);
struct pci_dev *pdev = to_pci_dev(dev_priv->drm.dev); struct pci_dev *pdev = to_pci_dev(dev_priv->drm.dev);
struct i915_ggtt *ggtt = to_gt(dev_priv)->ggtt; struct i915_ggtt *ggtt = to_gt(dev_priv)->ggtt;
const struct i915_ggtt_view view = { const struct i915_gtt_view view = {
.type = I915_GGTT_VIEW_NORMAL, .type = I915_GTT_VIEW_NORMAL,
}; };
intel_wakeref_t wakeref; intel_wakeref_t wakeref;
struct fb_info *info; struct fb_info *info;
......
...@@ -397,7 +397,7 @@ struct i915_vma * ...@@ -397,7 +397,7 @@ struct i915_vma *
i915_gem_object_pin_to_display_plane(struct drm_i915_gem_object *obj, i915_gem_object_pin_to_display_plane(struct drm_i915_gem_object *obj,
struct i915_gem_ww_ctx *ww, struct i915_gem_ww_ctx *ww,
u32 alignment, u32 alignment,
const struct i915_ggtt_view *view, const struct i915_gtt_view *view,
unsigned int flags) unsigned int flags)
{ {
struct drm_i915_private *i915 = to_i915(obj->base.dev); struct drm_i915_private *i915 = to_i915(obj->base.dev);
...@@ -434,7 +434,7 @@ i915_gem_object_pin_to_display_plane(struct drm_i915_gem_object *obj, ...@@ -434,7 +434,7 @@ i915_gem_object_pin_to_display_plane(struct drm_i915_gem_object *obj,
*/ */
vma = ERR_PTR(-ENOSPC); vma = ERR_PTR(-ENOSPC);
if ((flags & PIN_MAPPABLE) == 0 && if ((flags & PIN_MAPPABLE) == 0 &&
(!view || view->type == I915_GGTT_VIEW_NORMAL)) (!view || view->type == I915_GTT_VIEW_NORMAL))
vma = i915_gem_object_ggtt_pin_ww(obj, ww, view, 0, alignment, vma = i915_gem_object_ggtt_pin_ww(obj, ww, view, 0, alignment,
flags | PIN_MAPPABLE | flags | PIN_MAPPABLE |
PIN_NONBLOCK); PIN_NONBLOCK);
......
...@@ -194,17 +194,17 @@ int i915_gem_mmap_gtt_version(void) ...@@ -194,17 +194,17 @@ int i915_gem_mmap_gtt_version(void)
return 4; return 4;
} }
static inline struct i915_ggtt_view static inline struct i915_gtt_view
compute_partial_view(const struct drm_i915_gem_object *obj, compute_partial_view(const struct drm_i915_gem_object *obj,
pgoff_t page_offset, pgoff_t page_offset,
unsigned int chunk) unsigned int chunk)
{ {
struct i915_ggtt_view view; struct i915_gtt_view view;
if (i915_gem_object_is_tiled(obj)) if (i915_gem_object_is_tiled(obj))
chunk = roundup(chunk, tile_row_pages(obj) ?: 1); chunk = roundup(chunk, tile_row_pages(obj) ?: 1);
view.type = I915_GGTT_VIEW_PARTIAL; view.type = I915_GTT_VIEW_PARTIAL;
view.partial.offset = rounddown(page_offset, chunk); view.partial.offset = rounddown(page_offset, chunk);
view.partial.size = view.partial.size =
min_t(unsigned int, chunk, min_t(unsigned int, chunk,
...@@ -212,7 +212,7 @@ compute_partial_view(const struct drm_i915_gem_object *obj, ...@@ -212,7 +212,7 @@ compute_partial_view(const struct drm_i915_gem_object *obj,
/* If the partial covers the entire object, just create a normal VMA. */ /* If the partial covers the entire object, just create a normal VMA. */
if (chunk >= obj->base.size >> PAGE_SHIFT) if (chunk >= obj->base.size >> PAGE_SHIFT)
view.type = I915_GGTT_VIEW_NORMAL; view.type = I915_GTT_VIEW_NORMAL;
return view; return view;
} }
...@@ -341,12 +341,12 @@ static vm_fault_t vm_fault_gtt(struct vm_fault *vmf) ...@@ -341,12 +341,12 @@ static vm_fault_t vm_fault_gtt(struct vm_fault *vmf)
PIN_NOEVICT); PIN_NOEVICT);
if (IS_ERR(vma) && vma != ERR_PTR(-EDEADLK)) { if (IS_ERR(vma) && vma != ERR_PTR(-EDEADLK)) {
/* Use a partial view if it is bigger than available space */ /* Use a partial view if it is bigger than available space */
struct i915_ggtt_view view = struct i915_gtt_view view =
compute_partial_view(obj, page_offset, MIN_CHUNK_PAGES); compute_partial_view(obj, page_offset, MIN_CHUNK_PAGES);
unsigned int flags; unsigned int flags;
flags = PIN_MAPPABLE | PIN_NOSEARCH; flags = PIN_MAPPABLE | PIN_NOSEARCH;
if (view.type == I915_GGTT_VIEW_NORMAL) if (view.type == I915_GTT_VIEW_NORMAL)
flags |= PIN_NONBLOCK; /* avoid warnings for pinned */ flags |= PIN_NONBLOCK; /* avoid warnings for pinned */
/* /*
...@@ -357,7 +357,7 @@ static vm_fault_t vm_fault_gtt(struct vm_fault *vmf) ...@@ -357,7 +357,7 @@ static vm_fault_t vm_fault_gtt(struct vm_fault *vmf)
vma = i915_gem_object_ggtt_pin_ww(obj, &ww, &view, 0, 0, flags); vma = i915_gem_object_ggtt_pin_ww(obj, &ww, &view, 0, 0, flags);
if (IS_ERR(vma) && vma != ERR_PTR(-EDEADLK)) { if (IS_ERR(vma) && vma != ERR_PTR(-EDEADLK)) {
flags = PIN_MAPPABLE; flags = PIN_MAPPABLE;
view.type = I915_GGTT_VIEW_PARTIAL; view.type = I915_GTT_VIEW_PARTIAL;
vma = i915_gem_object_ggtt_pin_ww(obj, &ww, &view, 0, 0, flags); vma = i915_gem_object_ggtt_pin_ww(obj, &ww, &view, 0, 0, flags);
} }
...@@ -394,7 +394,7 @@ static vm_fault_t vm_fault_gtt(struct vm_fault *vmf) ...@@ -394,7 +394,7 @@ static vm_fault_t vm_fault_gtt(struct vm_fault *vmf)
/* Finally, remap it using the new GTT offset */ /* Finally, remap it using the new GTT offset */
ret = remap_io_mapping(area, ret = remap_io_mapping(area,
area->vm_start + (vma->ggtt_view.partial.offset << PAGE_SHIFT), area->vm_start + (vma->gtt_view.partial.offset << PAGE_SHIFT),
(ggtt->gmadr.start + vma->node.start) >> PAGE_SHIFT, (ggtt->gmadr.start + vma->node.start) >> PAGE_SHIFT,
min_t(u64, vma->size, area->vm_end - area->vm_start), min_t(u64, vma->size, area->vm_end - area->vm_start),
&ggtt->iomap); &ggtt->iomap);
......
...@@ -543,7 +543,7 @@ struct i915_vma * __must_check ...@@ -543,7 +543,7 @@ struct i915_vma * __must_check
i915_gem_object_pin_to_display_plane(struct drm_i915_gem_object *obj, i915_gem_object_pin_to_display_plane(struct drm_i915_gem_object *obj,
struct i915_gem_ww_ctx *ww, struct i915_gem_ww_ctx *ww,
u32 alignment, u32 alignment,
const struct i915_ggtt_view *view, const struct i915_gtt_view *view,
unsigned int flags); unsigned int flags);
void i915_gem_object_make_unshrinkable(struct drm_i915_gem_object *obj); void i915_gem_object_make_unshrinkable(struct drm_i915_gem_object *obj);
......
...@@ -93,7 +93,7 @@ static int check_partial_mapping(struct drm_i915_gem_object *obj, ...@@ -93,7 +93,7 @@ static int check_partial_mapping(struct drm_i915_gem_object *obj,
{ {
const unsigned long npages = obj->base.size / PAGE_SIZE; const unsigned long npages = obj->base.size / PAGE_SIZE;
struct drm_i915_private *i915 = to_i915(obj->base.dev); struct drm_i915_private *i915 = to_i915(obj->base.dev);
struct i915_ggtt_view view; struct i915_gtt_view view;
struct i915_vma *vma; struct i915_vma *vma;
unsigned long page; unsigned long page;
u32 __iomem *io; u32 __iomem *io;
...@@ -210,7 +210,7 @@ static int check_partial_mappings(struct drm_i915_gem_object *obj, ...@@ -210,7 +210,7 @@ static int check_partial_mappings(struct drm_i915_gem_object *obj,
} }
for_each_prime_number_from(page, 1, npages) { for_each_prime_number_from(page, 1, npages) {
struct i915_ggtt_view view = struct i915_gtt_view view =
compute_partial_view(obj, page, MIN_CHUNK_PAGES); compute_partial_view(obj, page, MIN_CHUNK_PAGES);
u32 __iomem *io; u32 __iomem *io;
struct page *p; struct page *p;
......
...@@ -776,7 +776,7 @@ static void revoke_mmaps(struct intel_gt *gt) ...@@ -776,7 +776,7 @@ static void revoke_mmaps(struct intel_gt *gt)
continue; continue;
node = &vma->mmo->vma_node; node = &vma->mmo->vma_node;
vma_offset = vma->ggtt_view.partial.offset << PAGE_SHIFT; vma_offset = vma->gtt_view.partial.offset << PAGE_SHIFT;
unmap_mapping_range(gt->i915->drm.anon_inode->i_mapping, unmap_mapping_range(gt->i915->drm.anon_inode->i_mapping,
drm_vma_node_offset_addr(node) + vma_offset, drm_vma_node_offset_addr(node) + vma_offset,
......
...@@ -188,47 +188,47 @@ i915_debugfs_describe_obj(struct seq_file *m, struct drm_i915_gem_object *obj) ...@@ -188,47 +188,47 @@ i915_debugfs_describe_obj(struct seq_file *m, struct drm_i915_gem_object *obj)
stringify_page_sizes(vma->resource->page_sizes_gtt, stringify_page_sizes(vma->resource->page_sizes_gtt,
NULL, 0)); NULL, 0));
if (i915_vma_is_ggtt(vma) || i915_vma_is_dpt(vma)) { if (i915_vma_is_ggtt(vma) || i915_vma_is_dpt(vma)) {
switch (vma->ggtt_view.type) { switch (vma->gtt_view.type) {
case I915_GGTT_VIEW_NORMAL: case I915_GTT_VIEW_NORMAL:
seq_puts(m, ", normal"); seq_puts(m, ", normal");
break; break;
case I915_GGTT_VIEW_PARTIAL: case I915_GTT_VIEW_PARTIAL:
seq_printf(m, ", partial [%08llx+%x]", seq_printf(m, ", partial [%08llx+%x]",
vma->ggtt_view.partial.offset << PAGE_SHIFT, vma->gtt_view.partial.offset << PAGE_SHIFT,
vma->ggtt_view.partial.size << PAGE_SHIFT); vma->gtt_view.partial.size << PAGE_SHIFT);
break; break;
case I915_GGTT_VIEW_ROTATED: case I915_GTT_VIEW_ROTATED:
seq_printf(m, ", rotated [(%ux%u, src_stride=%u, dst_stride=%u, offset=%u), (%ux%u, src_stride=%u, dst_stride=%u, offset=%u)]", seq_printf(m, ", rotated [(%ux%u, src_stride=%u, dst_stride=%u, offset=%u), (%ux%u, src_stride=%u, dst_stride=%u, offset=%u)]",
vma->ggtt_view.rotated.plane[0].width, vma->gtt_view.rotated.plane[0].width,
vma->ggtt_view.rotated.plane[0].height, vma->gtt_view.rotated.plane[0].height,
vma->ggtt_view.rotated.plane[0].src_stride, vma->gtt_view.rotated.plane[0].src_stride,
vma->ggtt_view.rotated.plane[0].dst_stride, vma->gtt_view.rotated.plane[0].dst_stride,
vma->ggtt_view.rotated.plane[0].offset, vma->gtt_view.rotated.plane[0].offset,
vma->ggtt_view.rotated.plane[1].width, vma->gtt_view.rotated.plane[1].width,
vma->ggtt_view.rotated.plane[1].height, vma->gtt_view.rotated.plane[1].height,
vma->ggtt_view.rotated.plane[1].src_stride, vma->gtt_view.rotated.plane[1].src_stride,
vma->ggtt_view.rotated.plane[1].dst_stride, vma->gtt_view.rotated.plane[1].dst_stride,
vma->ggtt_view.rotated.plane[1].offset); vma->gtt_view.rotated.plane[1].offset);
break; break;
case I915_GGTT_VIEW_REMAPPED: case I915_GTT_VIEW_REMAPPED:
seq_printf(m, ", remapped [(%ux%u, src_stride=%u, dst_stride=%u, offset=%u), (%ux%u, src_stride=%u, dst_stride=%u, offset=%u)]", seq_printf(m, ", remapped [(%ux%u, src_stride=%u, dst_stride=%u, offset=%u), (%ux%u, src_stride=%u, dst_stride=%u, offset=%u)]",
vma->ggtt_view.remapped.plane[0].width, vma->gtt_view.remapped.plane[0].width,
vma->ggtt_view.remapped.plane[0].height, vma->gtt_view.remapped.plane[0].height,
vma->ggtt_view.remapped.plane[0].src_stride, vma->gtt_view.remapped.plane[0].src_stride,
vma->ggtt_view.remapped.plane[0].dst_stride, vma->gtt_view.remapped.plane[0].dst_stride,
vma->ggtt_view.remapped.plane[0].offset, vma->gtt_view.remapped.plane[0].offset,
vma->ggtt_view.remapped.plane[1].width, vma->gtt_view.remapped.plane[1].width,
vma->ggtt_view.remapped.plane[1].height, vma->gtt_view.remapped.plane[1].height,
vma->ggtt_view.remapped.plane[1].src_stride, vma->gtt_view.remapped.plane[1].src_stride,
vma->ggtt_view.remapped.plane[1].dst_stride, vma->gtt_view.remapped.plane[1].dst_stride,
vma->ggtt_view.remapped.plane[1].offset); vma->gtt_view.remapped.plane[1].offset);
break; break;
default: default:
MISSING_CASE(vma->ggtt_view.type); MISSING_CASE(vma->gtt_view.type);
break; break;
} }
} }
......
...@@ -1468,12 +1468,12 @@ static inline void i915_gem_drain_workqueue(struct drm_i915_private *i915) ...@@ -1468,12 +1468,12 @@ static inline void i915_gem_drain_workqueue(struct drm_i915_private *i915)
struct i915_vma * __must_check struct i915_vma * __must_check
i915_gem_object_ggtt_pin_ww(struct drm_i915_gem_object *obj, i915_gem_object_ggtt_pin_ww(struct drm_i915_gem_object *obj,
struct i915_gem_ww_ctx *ww, struct i915_gem_ww_ctx *ww,
const struct i915_ggtt_view *view, const struct i915_gtt_view *view,
u64 size, u64 alignment, u64 flags); u64 size, u64 alignment, u64 flags);
struct i915_vma * __must_check struct i915_vma * __must_check
i915_gem_object_ggtt_pin(struct drm_i915_gem_object *obj, i915_gem_object_ggtt_pin(struct drm_i915_gem_object *obj,
const struct i915_ggtt_view *view, const struct i915_gtt_view *view,
u64 size, u64 alignment, u64 flags); u64 size, u64 alignment, u64 flags);
int i915_gem_object_unbind(struct drm_i915_gem_object *obj, int i915_gem_object_unbind(struct drm_i915_gem_object *obj,
......
...@@ -885,7 +885,7 @@ static void discard_ggtt_vma(struct i915_vma *vma) ...@@ -885,7 +885,7 @@ static void discard_ggtt_vma(struct i915_vma *vma)
struct i915_vma * struct i915_vma *
i915_gem_object_ggtt_pin_ww(struct drm_i915_gem_object *obj, i915_gem_object_ggtt_pin_ww(struct drm_i915_gem_object *obj,
struct i915_gem_ww_ctx *ww, struct i915_gem_ww_ctx *ww,
const struct i915_ggtt_view *view, const struct i915_gtt_view *view,
u64 size, u64 alignment, u64 flags) u64 size, u64 alignment, u64 flags)
{ {
struct drm_i915_private *i915 = to_i915(obj->base.dev); struct drm_i915_private *i915 = to_i915(obj->base.dev);
...@@ -896,7 +896,7 @@ i915_gem_object_ggtt_pin_ww(struct drm_i915_gem_object *obj, ...@@ -896,7 +896,7 @@ i915_gem_object_ggtt_pin_ww(struct drm_i915_gem_object *obj,
GEM_WARN_ON(!ww); GEM_WARN_ON(!ww);
if (flags & PIN_MAPPABLE && if (flags & PIN_MAPPABLE &&
(!view || view->type == I915_GGTT_VIEW_NORMAL)) { (!view || view->type == I915_GTT_VIEW_NORMAL)) {
/* /*
* If the required space is larger than the available * If the required space is larger than the available
* aperture, we will not able to find a slot for the * aperture, we will not able to find a slot for the
...@@ -987,7 +987,7 @@ i915_gem_object_ggtt_pin_ww(struct drm_i915_gem_object *obj, ...@@ -987,7 +987,7 @@ i915_gem_object_ggtt_pin_ww(struct drm_i915_gem_object *obj,
struct i915_vma * __must_check struct i915_vma * __must_check
i915_gem_object_ggtt_pin(struct drm_i915_gem_object *obj, i915_gem_object_ggtt_pin(struct drm_i915_gem_object *obj,
const struct i915_ggtt_view *view, const struct i915_gtt_view *view,
u64 size, u64 alignment, u64 flags) u64 size, u64 alignment, u64 flags)
{ {
struct i915_gem_ww_ctx ww; struct i915_gem_ww_ctx ww;
......
...@@ -109,7 +109,7 @@ static void __i915_vma_retire(struct i915_active *ref) ...@@ -109,7 +109,7 @@ static void __i915_vma_retire(struct i915_active *ref)
static struct i915_vma * static struct i915_vma *
vma_create(struct drm_i915_gem_object *obj, vma_create(struct drm_i915_gem_object *obj,
struct i915_address_space *vm, struct i915_address_space *vm,
const struct i915_ggtt_view *view) const struct i915_gtt_view *view)
{ {
struct i915_vma *pos = ERR_PTR(-E2BIG); struct i915_vma *pos = ERR_PTR(-E2BIG);
struct i915_vma *vma; struct i915_vma *vma;
...@@ -141,9 +141,9 @@ vma_create(struct drm_i915_gem_object *obj, ...@@ -141,9 +141,9 @@ vma_create(struct drm_i915_gem_object *obj,
INIT_LIST_HEAD(&vma->obj_link); INIT_LIST_HEAD(&vma->obj_link);
RB_CLEAR_NODE(&vma->obj_node); RB_CLEAR_NODE(&vma->obj_node);
if (view && view->type != I915_GGTT_VIEW_NORMAL) { if (view && view->type != I915_GTT_VIEW_NORMAL) {
vma->ggtt_view = *view; vma->gtt_view = *view;
if (view->type == I915_GGTT_VIEW_PARTIAL) { if (view->type == I915_GTT_VIEW_PARTIAL) {
GEM_BUG_ON(range_overflows_t(u64, GEM_BUG_ON(range_overflows_t(u64,
view->partial.offset, view->partial.offset,
view->partial.size, view->partial.size,
...@@ -151,10 +151,10 @@ vma_create(struct drm_i915_gem_object *obj, ...@@ -151,10 +151,10 @@ vma_create(struct drm_i915_gem_object *obj,
vma->size = view->partial.size; vma->size = view->partial.size;
vma->size <<= PAGE_SHIFT; vma->size <<= PAGE_SHIFT;
GEM_BUG_ON(vma->size > obj->base.size); GEM_BUG_ON(vma->size > obj->base.size);
} else if (view->type == I915_GGTT_VIEW_ROTATED) { } else if (view->type == I915_GTT_VIEW_ROTATED) {
vma->size = intel_rotation_info_size(&view->rotated); vma->size = intel_rotation_info_size(&view->rotated);
vma->size <<= PAGE_SHIFT; vma->size <<= PAGE_SHIFT;
} else if (view->type == I915_GGTT_VIEW_REMAPPED) { } else if (view->type == I915_GTT_VIEW_REMAPPED) {
vma->size = intel_remapped_info_size(&view->remapped); vma->size = intel_remapped_info_size(&view->remapped);
vma->size <<= PAGE_SHIFT; vma->size <<= PAGE_SHIFT;
} }
...@@ -248,7 +248,7 @@ vma_create(struct drm_i915_gem_object *obj, ...@@ -248,7 +248,7 @@ vma_create(struct drm_i915_gem_object *obj,
static struct i915_vma * static struct i915_vma *
i915_vma_lookup(struct drm_i915_gem_object *obj, i915_vma_lookup(struct drm_i915_gem_object *obj,
struct i915_address_space *vm, struct i915_address_space *vm,
const struct i915_ggtt_view *view) const struct i915_gtt_view *view)
{ {
struct rb_node *rb; struct rb_node *rb;
...@@ -286,7 +286,7 @@ i915_vma_lookup(struct drm_i915_gem_object *obj, ...@@ -286,7 +286,7 @@ i915_vma_lookup(struct drm_i915_gem_object *obj,
struct i915_vma * struct i915_vma *
i915_vma_instance(struct drm_i915_gem_object *obj, i915_vma_instance(struct drm_i915_gem_object *obj,
struct i915_address_space *vm, struct i915_address_space *vm,
const struct i915_ggtt_view *view) const struct i915_gtt_view *view)
{ {
struct i915_vma *vma; struct i915_vma *vma;
...@@ -1203,7 +1203,7 @@ intel_remap_pages(struct intel_remapped_info *rem_info, ...@@ -1203,7 +1203,7 @@ intel_remap_pages(struct intel_remapped_info *rem_info,
} }
static noinline struct sg_table * static noinline struct sg_table *
intel_partial_pages(const struct i915_ggtt_view *view, intel_partial_pages(const struct i915_gtt_view *view,
struct drm_i915_gem_object *obj) struct drm_i915_gem_object *obj)
{ {
struct sg_table *st; struct sg_table *st;
...@@ -1247,33 +1247,33 @@ __i915_vma_get_pages(struct i915_vma *vma) ...@@ -1247,33 +1247,33 @@ __i915_vma_get_pages(struct i915_vma *vma)
*/ */
GEM_BUG_ON(!i915_gem_object_has_pinned_pages(vma->obj)); GEM_BUG_ON(!i915_gem_object_has_pinned_pages(vma->obj));
switch (vma->ggtt_view.type) { switch (vma->gtt_view.type) {
default: default:
GEM_BUG_ON(vma->ggtt_view.type); GEM_BUG_ON(vma->gtt_view.type);
fallthrough; fallthrough;
case I915_GGTT_VIEW_NORMAL: case I915_GTT_VIEW_NORMAL:
pages = vma->obj->mm.pages; pages = vma->obj->mm.pages;
break; break;
case I915_GGTT_VIEW_ROTATED: case I915_GTT_VIEW_ROTATED:
pages = pages =
intel_rotate_pages(&vma->ggtt_view.rotated, vma->obj); intel_rotate_pages(&vma->gtt_view.rotated, vma->obj);
break; break;
case I915_GGTT_VIEW_REMAPPED: case I915_GTT_VIEW_REMAPPED:
pages = pages =
intel_remap_pages(&vma->ggtt_view.remapped, vma->obj); intel_remap_pages(&vma->gtt_view.remapped, vma->obj);
break; break;
case I915_GGTT_VIEW_PARTIAL: case I915_GTT_VIEW_PARTIAL:
pages = intel_partial_pages(&vma->ggtt_view, vma->obj); pages = intel_partial_pages(&vma->gtt_view, vma->obj);
break; break;
} }
if (IS_ERR(pages)) { if (IS_ERR(pages)) {
drm_err(&vma->vm->i915->drm, drm_err(&vma->vm->i915->drm,
"Failed to get pages for VMA view type %u (%ld)!\n", "Failed to get pages for VMA view type %u (%ld)!\n",
vma->ggtt_view.type, PTR_ERR(pages)); vma->gtt_view.type, PTR_ERR(pages));
return PTR_ERR(pages); return PTR_ERR(pages);
} }
...@@ -1806,7 +1806,7 @@ void i915_vma_revoke_mmap(struct i915_vma *vma) ...@@ -1806,7 +1806,7 @@ void i915_vma_revoke_mmap(struct i915_vma *vma)
GEM_BUG_ON(!vma->obj->userfault_count); GEM_BUG_ON(!vma->obj->userfault_count);
node = &vma->mmo->vma_node; node = &vma->mmo->vma_node;
vma_offset = vma->ggtt_view.partial.offset << PAGE_SHIFT; vma_offset = vma->gtt_view.partial.offset << PAGE_SHIFT;
unmap_mapping_range(vma->vm->i915->drm.anon_inode->i_mapping, unmap_mapping_range(vma->vm->i915->drm.anon_inode->i_mapping,
drm_vma_node_offset_addr(node) + vma_offset, drm_vma_node_offset_addr(node) + vma_offset,
vma->size, vma->size,
......
...@@ -43,7 +43,7 @@ ...@@ -43,7 +43,7 @@
struct i915_vma * struct i915_vma *
i915_vma_instance(struct drm_i915_gem_object *obj, i915_vma_instance(struct drm_i915_gem_object *obj,
struct i915_address_space *vm, struct i915_address_space *vm,
const struct i915_ggtt_view *view); const struct i915_gtt_view *view);
void i915_vma_unpin_and_release(struct i915_vma **p_vma, unsigned int flags); void i915_vma_unpin_and_release(struct i915_vma **p_vma, unsigned int flags);
#define I915_VMA_RELEASE_MAP BIT(0) #define I915_VMA_RELEASE_MAP BIT(0)
...@@ -160,7 +160,7 @@ static inline void i915_vma_put(struct i915_vma *vma) ...@@ -160,7 +160,7 @@ static inline void i915_vma_put(struct i915_vma *vma)
static inline long static inline long
i915_vma_compare(struct i915_vma *vma, i915_vma_compare(struct i915_vma *vma,
struct i915_address_space *vm, struct i915_address_space *vm,
const struct i915_ggtt_view *view) const struct i915_gtt_view *view)
{ {
ptrdiff_t cmp; ptrdiff_t cmp;
...@@ -170,8 +170,8 @@ i915_vma_compare(struct i915_vma *vma, ...@@ -170,8 +170,8 @@ i915_vma_compare(struct i915_vma *vma,
if (cmp) if (cmp)
return cmp; return cmp;
BUILD_BUG_ON(I915_GGTT_VIEW_NORMAL != 0); BUILD_BUG_ON(I915_GTT_VIEW_NORMAL != 0);
cmp = vma->ggtt_view.type; cmp = vma->gtt_view.type;
if (!view) if (!view)
return cmp; return cmp;
...@@ -181,7 +181,7 @@ i915_vma_compare(struct i915_vma *vma, ...@@ -181,7 +181,7 @@ i915_vma_compare(struct i915_vma *vma,
assert_i915_gem_gtt_types(); assert_i915_gem_gtt_types();
/* ggtt_view.type also encodes its size so that we both distinguish /* gtt_view.type also encodes its size so that we both distinguish
* different views using it as a "type" and also use a compact (no * different views using it as a "type" and also use a compact (no
* accessing of uninitialised padding bytes) memcmp without storing * accessing of uninitialised padding bytes) memcmp without storing
* an extra parameter or adding more code. * an extra parameter or adding more code.
...@@ -191,14 +191,14 @@ i915_vma_compare(struct i915_vma *vma, ...@@ -191,14 +191,14 @@ i915_vma_compare(struct i915_vma *vma,
* we assert above that all branches have the same address, and that * we assert above that all branches have the same address, and that
* each branch has a unique type/size. * each branch has a unique type/size.
*/ */
BUILD_BUG_ON(I915_GGTT_VIEW_NORMAL >= I915_GGTT_VIEW_PARTIAL); BUILD_BUG_ON(I915_GTT_VIEW_NORMAL >= I915_GTT_VIEW_PARTIAL);
BUILD_BUG_ON(I915_GGTT_VIEW_PARTIAL >= I915_GGTT_VIEW_ROTATED); BUILD_BUG_ON(I915_GTT_VIEW_PARTIAL >= I915_GTT_VIEW_ROTATED);
BUILD_BUG_ON(I915_GGTT_VIEW_ROTATED >= I915_GGTT_VIEW_REMAPPED); BUILD_BUG_ON(I915_GTT_VIEW_ROTATED >= I915_GTT_VIEW_REMAPPED);
BUILD_BUG_ON(offsetof(typeof(*view), rotated) != BUILD_BUG_ON(offsetof(typeof(*view), rotated) !=
offsetof(typeof(*view), partial)); offsetof(typeof(*view), partial));
BUILD_BUG_ON(offsetof(typeof(*view), rotated) != BUILD_BUG_ON(offsetof(typeof(*view), rotated) !=
offsetof(typeof(*view), remapped)); offsetof(typeof(*view), remapped));
return memcmp(&vma->ggtt_view.partial, &view->partial, view->type); return memcmp(&vma->gtt_view.partial, &view->partial, view->type);
} }
struct i915_vma_work *i915_vma_work(void); struct i915_vma_work *i915_vma_work(void);
......
...@@ -67,30 +67,30 @@ enum i915_cache_level; ...@@ -67,30 +67,30 @@ enum i915_cache_level;
* Implementation and usage * Implementation and usage
* *
* GGTT views are implemented using VMAs and are distinguished via enum * GGTT views are implemented using VMAs and are distinguished via enum
* i915_ggtt_view_type and struct i915_ggtt_view. * i915_gtt_view_type and struct i915_gtt_view.
* *
* A new flavour of core GEM functions which work with GGTT bound objects were * A new flavour of core GEM functions which work with GGTT bound objects were
* added with the _ggtt_ infix, and sometimes with _view postfix to avoid * added with the _ggtt_ infix, and sometimes with _view postfix to avoid
* renaming in large amounts of code. They take the struct i915_ggtt_view * renaming in large amounts of code. They take the struct i915_gtt_view
* parameter encapsulating all metadata required to implement a view. * parameter encapsulating all metadata required to implement a view.
* *
* As a helper for callers which are only interested in the normal view, * As a helper for callers which are only interested in the normal view,
* globally const i915_ggtt_view_normal singleton instance exists. All old core * globally const i915_gtt_view_normal singleton instance exists. All old core
* GEM API functions, the ones not taking the view parameter, are operating on, * GEM API functions, the ones not taking the view parameter, are operating on,
* or with the normal GGTT view. * or with the normal GGTT view.
* *
* Code wanting to add or use a new GGTT view needs to: * Code wanting to add or use a new GGTT view needs to:
* *
* 1. Add a new enum with a suitable name. * 1. Add a new enum with a suitable name.
* 2. Extend the metadata in the i915_ggtt_view structure if required. * 2. Extend the metadata in the i915_gtt_view structure if required.
* 3. Add support to i915_get_vma_pages(). * 3. Add support to i915_get_vma_pages().
* *
* New views are required to build a scatter-gather table from within the * New views are required to build a scatter-gather table from within the
* i915_get_vma_pages function. This table is stored in the vma.ggtt_view and * i915_get_vma_pages function. This table is stored in the vma.gtt_view and
* exists for the lifetime of an VMA. * exists for the lifetime of an VMA.
* *
* Core API is designed to have copy semantics which means that passed in * Core API is designed to have copy semantics which means that passed in
* struct i915_ggtt_view does not need to be persistent (left around after * struct i915_gtt_view does not need to be persistent (left around after
* calling the core API functions). * calling the core API functions).
* *
*/ */
...@@ -130,11 +130,11 @@ struct intel_partial_info { ...@@ -130,11 +130,11 @@ struct intel_partial_info {
unsigned int size; unsigned int size;
} __packed; } __packed;
enum i915_ggtt_view_type { enum i915_gtt_view_type {
I915_GGTT_VIEW_NORMAL = 0, I915_GTT_VIEW_NORMAL = 0,
I915_GGTT_VIEW_ROTATED = sizeof(struct intel_rotation_info), I915_GTT_VIEW_ROTATED = sizeof(struct intel_rotation_info),
I915_GGTT_VIEW_PARTIAL = sizeof(struct intel_partial_info), I915_GTT_VIEW_PARTIAL = sizeof(struct intel_partial_info),
I915_GGTT_VIEW_REMAPPED = sizeof(struct intel_remapped_info), I915_GTT_VIEW_REMAPPED = sizeof(struct intel_remapped_info),
}; };
static inline void assert_i915_gem_gtt_types(void) static inline void assert_i915_gem_gtt_types(void)
...@@ -152,18 +152,18 @@ static inline void assert_i915_gem_gtt_types(void) ...@@ -152,18 +152,18 @@ static inline void assert_i915_gem_gtt_types(void)
/* As we encode the size of each branch inside the union into its type, /* As we encode the size of each branch inside the union into its type,
* we have to be careful that each branch has a unique size. * we have to be careful that each branch has a unique size.
*/ */
switch ((enum i915_ggtt_view_type)0) { switch ((enum i915_gtt_view_type)0) {
case I915_GGTT_VIEW_NORMAL: case I915_GTT_VIEW_NORMAL:
case I915_GGTT_VIEW_PARTIAL: case I915_GTT_VIEW_PARTIAL:
case I915_GGTT_VIEW_ROTATED: case I915_GTT_VIEW_ROTATED:
case I915_GGTT_VIEW_REMAPPED: case I915_GTT_VIEW_REMAPPED:
/* gcc complains if these are identical cases */ /* gcc complains if these are identical cases */
break; break;
} }
} }
struct i915_ggtt_view { struct i915_gtt_view {
enum i915_ggtt_view_type type; enum i915_gtt_view_type type;
union { union {
/* Members need to contain no holes/padding */ /* Members need to contain no holes/padding */
struct intel_partial_info partial; struct intel_partial_info partial;
...@@ -280,11 +280,11 @@ struct i915_vma { ...@@ -280,11 +280,11 @@ struct i915_vma {
/** /**
* Support different GGTT views into the same object. * Support different GGTT views into the same object.
* This means there can be multiple VMA mappings per object and per VM. * This means there can be multiple VMA mappings per object and per VM.
* i915_ggtt_view_type is used to distinguish between those entries. * i915_gtt_view_type is used to distinguish between those entries.
* The default one of zero (I915_GGTT_VIEW_NORMAL) is default and also * The default one of zero (I915_GTT_VIEW_NORMAL) is default and also
* assumed in GEM functions which take no ggtt view parameter. * assumed in GEM functions which take no ggtt view parameter.
*/ */
struct i915_ggtt_view ggtt_view; struct i915_gtt_view gtt_view;
/** This object's place on the active/inactive lists */ /** This object's place on the active/inactive lists */
struct list_head vm_link; struct list_head vm_link;
......
...@@ -51,9 +51,9 @@ static bool assert_vma(struct i915_vma *vma, ...@@ -51,9 +51,9 @@ static bool assert_vma(struct i915_vma *vma,
ok = false; ok = false;
} }
if (vma->ggtt_view.type != I915_GGTT_VIEW_NORMAL) { if (vma->gtt_view.type != I915_GTT_VIEW_NORMAL) {
pr_err("VMA created with wrong type [%d]\n", pr_err("VMA created with wrong type [%d]\n",
vma->ggtt_view.type); vma->gtt_view.type);
ok = false; ok = false;
} }
...@@ -63,7 +63,7 @@ static bool assert_vma(struct i915_vma *vma, ...@@ -63,7 +63,7 @@ static bool assert_vma(struct i915_vma *vma,
static struct i915_vma * static struct i915_vma *
checked_vma_instance(struct drm_i915_gem_object *obj, checked_vma_instance(struct drm_i915_gem_object *obj,
struct i915_address_space *vm, struct i915_address_space *vm,
const struct i915_ggtt_view *view) const struct i915_gtt_view *view)
{ {
struct i915_vma *vma; struct i915_vma *vma;
bool ok = true; bool ok = true;
...@@ -91,7 +91,7 @@ checked_vma_instance(struct drm_i915_gem_object *obj, ...@@ -91,7 +91,7 @@ checked_vma_instance(struct drm_i915_gem_object *obj,
} }
if (i915_vma_compare(vma, vma->vm, if (i915_vma_compare(vma, vma->vm,
i915_vma_is_ggtt(vma) ? &vma->ggtt_view : NULL)) { i915_vma_is_ggtt(vma) ? &vma->gtt_view : NULL)) {
pr_err("i915_vma_compare failed with itself\n"); pr_err("i915_vma_compare failed with itself\n");
return ERR_PTR(-EINVAL); return ERR_PTR(-EINVAL);
} }
...@@ -530,12 +530,12 @@ assert_remapped(struct drm_i915_gem_object *obj, ...@@ -530,12 +530,12 @@ assert_remapped(struct drm_i915_gem_object *obj,
return sg; return sg;
} }
static unsigned int remapped_size(enum i915_ggtt_view_type view_type, static unsigned int remapped_size(enum i915_gtt_view_type view_type,
const struct intel_remapped_plane_info *a, const struct intel_remapped_plane_info *a,
const struct intel_remapped_plane_info *b) const struct intel_remapped_plane_info *b)
{ {
if (view_type == I915_GGTT_VIEW_ROTATED) if (view_type == I915_GTT_VIEW_ROTATED)
return a->dst_stride * a->width + b->dst_stride * b->width; return a->dst_stride * a->width + b->dst_stride * b->width;
else else
return a->dst_stride * a->height + b->dst_stride * b->height; return a->dst_stride * a->height + b->dst_stride * b->height;
...@@ -569,9 +569,9 @@ static int igt_vma_rotate_remap(void *arg) ...@@ -569,9 +569,9 @@ static int igt_vma_rotate_remap(void *arg)
{ } { }
}, *a, *b; }, *a, *b;
enum i915_ggtt_view_type types[] = { enum i915_gtt_view_type types[] = {
I915_GGTT_VIEW_ROTATED, I915_GTT_VIEW_ROTATED,
I915_GGTT_VIEW_REMAPPED, I915_GTT_VIEW_REMAPPED,
0, 0,
}, *t; }, *t;
const unsigned int max_pages = 64; const unsigned int max_pages = 64;
...@@ -588,7 +588,7 @@ static int igt_vma_rotate_remap(void *arg) ...@@ -588,7 +588,7 @@ static int igt_vma_rotate_remap(void *arg)
for (t = types; *t; t++) { for (t = types; *t; t++) {
for (a = planes; a->width; a++) { for (a = planes; a->width; a++) {
for (b = planes + ARRAY_SIZE(planes); b-- != planes; ) { for (b = planes + ARRAY_SIZE(planes); b-- != planes; ) {
struct i915_ggtt_view view = { struct i915_gtt_view view = {
.type = *t, .type = *t,
.remapped.plane[0] = *a, .remapped.plane[0] = *a,
.remapped.plane[1] = *b, .remapped.plane[1] = *b,
...@@ -602,11 +602,11 @@ static int igt_vma_rotate_remap(void *arg) ...@@ -602,11 +602,11 @@ static int igt_vma_rotate_remap(void *arg)
max_offset = max_pages - max_offset; max_offset = max_pages - max_offset;
if (!plane_info[0].dst_stride) if (!plane_info[0].dst_stride)
plane_info[0].dst_stride = view.type == I915_GGTT_VIEW_ROTATED ? plane_info[0].dst_stride = view.type == I915_GTT_VIEW_ROTATED ?
plane_info[0].height : plane_info[0].height :
plane_info[0].width; plane_info[0].width;
if (!plane_info[1].dst_stride) if (!plane_info[1].dst_stride)
plane_info[1].dst_stride = view.type == I915_GGTT_VIEW_ROTATED ? plane_info[1].dst_stride = view.type == I915_GTT_VIEW_ROTATED ?
plane_info[1].height : plane_info[1].height :
plane_info[1].width; plane_info[1].width;
...@@ -630,7 +630,7 @@ static int igt_vma_rotate_remap(void *arg) ...@@ -630,7 +630,7 @@ static int igt_vma_rotate_remap(void *arg)
expected_pages = remapped_size(view.type, &plane_info[0], &plane_info[1]); expected_pages = remapped_size(view.type, &plane_info[0], &plane_info[1]);
if (view.type == I915_GGTT_VIEW_ROTATED && if (view.type == I915_GTT_VIEW_ROTATED &&
vma->size != expected_pages * PAGE_SIZE) { vma->size != expected_pages * PAGE_SIZE) {
pr_err("VMA is wrong size, expected %lu, found %llu\n", pr_err("VMA is wrong size, expected %lu, found %llu\n",
PAGE_SIZE * expected_pages, vma->size); PAGE_SIZE * expected_pages, vma->size);
...@@ -638,7 +638,7 @@ static int igt_vma_rotate_remap(void *arg) ...@@ -638,7 +638,7 @@ static int igt_vma_rotate_remap(void *arg)
goto out_object; goto out_object;
} }
if (view.type == I915_GGTT_VIEW_REMAPPED && if (view.type == I915_GTT_VIEW_REMAPPED &&
vma->size > expected_pages * PAGE_SIZE) { vma->size > expected_pages * PAGE_SIZE) {
pr_err("VMA is wrong size, expected %lu, found %llu\n", pr_err("VMA is wrong size, expected %lu, found %llu\n",
PAGE_SIZE * expected_pages, vma->size); PAGE_SIZE * expected_pages, vma->size);
...@@ -668,13 +668,13 @@ static int igt_vma_rotate_remap(void *arg) ...@@ -668,13 +668,13 @@ static int igt_vma_rotate_remap(void *arg)
sg = vma->pages->sgl; sg = vma->pages->sgl;
for (n = 0; n < ARRAY_SIZE(view.rotated.plane); n++) { for (n = 0; n < ARRAY_SIZE(view.rotated.plane); n++) {
if (view.type == I915_GGTT_VIEW_ROTATED) if (view.type == I915_GTT_VIEW_ROTATED)
sg = assert_rotated(obj, &view.rotated, n, sg); sg = assert_rotated(obj, &view.rotated, n, sg);
else else
sg = assert_remapped(obj, &view.remapped, n, sg); sg = assert_remapped(obj, &view.remapped, n, sg);
if (IS_ERR(sg)) { if (IS_ERR(sg)) {
pr_err("Inconsistent %s VMA pages for plane %d: [(%d, %d, %d, %d, %d), (%d, %d, %d, %d, %d)]\n", pr_err("Inconsistent %s VMA pages for plane %d: [(%d, %d, %d, %d, %d), (%d, %d, %d, %d, %d)]\n",
view.type == I915_GGTT_VIEW_ROTATED ? view.type == I915_GTT_VIEW_ROTATED ?
"rotated" : "remapped", n, "rotated" : "remapped", n,
plane_info[0].width, plane_info[0].width,
plane_info[0].height, plane_info[0].height,
...@@ -741,7 +741,7 @@ static bool assert_partial(struct drm_i915_gem_object *obj, ...@@ -741,7 +741,7 @@ static bool assert_partial(struct drm_i915_gem_object *obj,
} }
static bool assert_pin(struct i915_vma *vma, static bool assert_pin(struct i915_vma *vma,
struct i915_ggtt_view *view, struct i915_gtt_view *view,
u64 size, u64 size,
const char *name) const char *name)
{ {
...@@ -759,8 +759,8 @@ static bool assert_pin(struct i915_vma *vma, ...@@ -759,8 +759,8 @@ static bool assert_pin(struct i915_vma *vma,
ok = false; ok = false;
} }
if (view && view->type != I915_GGTT_VIEW_NORMAL) { if (view && view->type != I915_GTT_VIEW_NORMAL) {
if (memcmp(&vma->ggtt_view, view, sizeof(*view))) { if (memcmp(&vma->gtt_view, view, sizeof(*view))) {
pr_err("(%s) VMA mismatch upon creation!\n", pr_err("(%s) VMA mismatch upon creation!\n",
name); name);
ok = false; ok = false;
...@@ -772,9 +772,9 @@ static bool assert_pin(struct i915_vma *vma, ...@@ -772,9 +772,9 @@ static bool assert_pin(struct i915_vma *vma,
ok = false; ok = false;
} }
} else { } else {
if (vma->ggtt_view.type != I915_GGTT_VIEW_NORMAL) { if (vma->gtt_view.type != I915_GTT_VIEW_NORMAL) {
pr_err("Not the normal ggtt view! Found %d\n", pr_err("Not the normal ggtt view! Found %d\n",
vma->ggtt_view.type); vma->gtt_view.type);
ok = false; ok = false;
} }
...@@ -818,14 +818,14 @@ static int igt_vma_partial(void *arg) ...@@ -818,14 +818,14 @@ static int igt_vma_partial(void *arg)
nvma = 0; nvma = 0;
for_each_prime_number_from(sz, 1, npages) { for_each_prime_number_from(sz, 1, npages) {
for_each_prime_number_from(offset, 0, npages - sz) { for_each_prime_number_from(offset, 0, npages - sz) {
struct i915_ggtt_view view; struct i915_gtt_view view;
view.type = I915_GGTT_VIEW_PARTIAL; view.type = I915_GTT_VIEW_PARTIAL;
view.partial.offset = offset; view.partial.offset = offset;
view.partial.size = sz; view.partial.size = sz;
if (sz == npages) if (sz == npages)
view.type = I915_GGTT_VIEW_NORMAL; view.type = I915_GTT_VIEW_NORMAL;
vma = checked_vma_instance(obj, vm, &view); vma = checked_vma_instance(obj, vm, &view);
if (IS_ERR(vma)) { if (IS_ERR(vma)) {
...@@ -976,9 +976,9 @@ static int igt_vma_remapped_gtt(void *arg) ...@@ -976,9 +976,9 @@ static int igt_vma_remapped_gtt(void *arg)
{ } { }
}, *p; }, *p;
enum i915_ggtt_view_type types[] = { enum i915_gtt_view_type types[] = {
I915_GGTT_VIEW_ROTATED, I915_GTT_VIEW_ROTATED,
I915_GGTT_VIEW_REMAPPED, I915_GTT_VIEW_REMAPPED,
0, 0,
}, *t; }, *t;
struct drm_i915_gem_object *obj; struct drm_i915_gem_object *obj;
...@@ -996,7 +996,7 @@ static int igt_vma_remapped_gtt(void *arg) ...@@ -996,7 +996,7 @@ static int igt_vma_remapped_gtt(void *arg)
for (t = types; *t; t++) { for (t = types; *t; t++) {
for (p = planes; p->width; p++) { for (p = planes; p->width; p++) {
struct i915_ggtt_view view = { struct i915_gtt_view view = {
.type = *t, .type = *t,
.rotated.plane[0] = *p, .rotated.plane[0] = *p,
}; };
...@@ -1012,7 +1012,7 @@ static int igt_vma_remapped_gtt(void *arg) ...@@ -1012,7 +1012,7 @@ static int igt_vma_remapped_gtt(void *arg)
goto out; goto out;
if (!plane_info[0].dst_stride) if (!plane_info[0].dst_stride)
plane_info[0].dst_stride = *t == I915_GGTT_VIEW_ROTATED ? plane_info[0].dst_stride = *t == I915_GTT_VIEW_ROTATED ?
p->height : p->width; p->height : p->width;
vma = i915_gem_object_ggtt_pin(obj, &view, 0, 0, PIN_MAPPABLE); vma = i915_gem_object_ggtt_pin(obj, &view, 0, 0, PIN_MAPPABLE);
...@@ -1021,7 +1021,7 @@ static int igt_vma_remapped_gtt(void *arg) ...@@ -1021,7 +1021,7 @@ static int igt_vma_remapped_gtt(void *arg)
goto out; goto out;
} }
GEM_BUG_ON(vma->ggtt_view.type != *t); GEM_BUG_ON(vma->gtt_view.type != *t);
map = i915_vma_pin_iomap(vma); map = i915_vma_pin_iomap(vma);
i915_vma_unpin(vma); i915_vma_unpin(vma);
...@@ -1035,7 +1035,7 @@ static int igt_vma_remapped_gtt(void *arg) ...@@ -1035,7 +1035,7 @@ static int igt_vma_remapped_gtt(void *arg)
unsigned int offset; unsigned int offset;
u32 val = y << 16 | x; u32 val = y << 16 | x;
if (*t == I915_GGTT_VIEW_ROTATED) if (*t == I915_GTT_VIEW_ROTATED)
offset = (x * plane_info[0].dst_stride + y) * PAGE_SIZE; offset = (x * plane_info[0].dst_stride + y) * PAGE_SIZE;
else else
offset = (y * plane_info[0].dst_stride + x) * PAGE_SIZE; offset = (y * plane_info[0].dst_stride + x) * PAGE_SIZE;
...@@ -1052,7 +1052,7 @@ static int igt_vma_remapped_gtt(void *arg) ...@@ -1052,7 +1052,7 @@ static int igt_vma_remapped_gtt(void *arg)
goto out; goto out;
} }
GEM_BUG_ON(vma->ggtt_view.type != I915_GGTT_VIEW_NORMAL); GEM_BUG_ON(vma->gtt_view.type != I915_GTT_VIEW_NORMAL);
map = i915_vma_pin_iomap(vma); map = i915_vma_pin_iomap(vma);
i915_vma_unpin(vma); i915_vma_unpin(vma);
...@@ -1067,7 +1067,7 @@ static int igt_vma_remapped_gtt(void *arg) ...@@ -1067,7 +1067,7 @@ static int igt_vma_remapped_gtt(void *arg)
u32 exp = y << 16 | x; u32 exp = y << 16 | x;
u32 val; u32 val;
if (*t == I915_GGTT_VIEW_ROTATED) if (*t == I915_GTT_VIEW_ROTATED)
src_idx = rotated_index(&view.rotated, 0, x, y); src_idx = rotated_index(&view.rotated, 0, x, y);
else else
src_idx = remapped_index(&view.remapped, 0, x, y); src_idx = remapped_index(&view.remapped, 0, x, y);
...@@ -1076,7 +1076,7 @@ static int igt_vma_remapped_gtt(void *arg) ...@@ -1076,7 +1076,7 @@ static int igt_vma_remapped_gtt(void *arg)
val = ioread32(&map[offset / sizeof(*map)]); val = ioread32(&map[offset / sizeof(*map)]);
if (val != exp) { if (val != exp) {
pr_err("%s VMA write test failed, expected 0x%x, found 0x%x\n", pr_err("%s VMA write test failed, expected 0x%x, found 0x%x\n",
*t == I915_GGTT_VIEW_ROTATED ? "Rotated" : "Remapped", *t == I915_GTT_VIEW_ROTATED ? "Rotated" : "Remapped",
exp, val); exp, val);
i915_vma_unpin_iomap(vma); i915_vma_unpin_iomap(vma);
err = -EINVAL; err = -EINVAL;
......
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