Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 72525b3f authored by David Herrmann's avatar David Herrmann Committed by Dave Airlie
Browse files

drm/ttm: convert to unified vma offset manager



Use the new vma-manager infrastructure. This doesn't change any
implementation details as the vma-offset-manager is nearly copied 1-to-1
from TTM.

The vm_lock is moved into the offset manager so we can drop it from TTM.
During lookup, we use the vma locking helpers to take a reference to the
found object.
In all other scenarios, locking stays the same as before. We always
guarantee that drm_vma_offset_remove() is called only during destruction.
Hence, helpers like drm_vma_node_offset_addr() are always safe as long as
the node has a valid offset.

This also drops the addr_space_offset member as it is a copy of vm_start
in vma_node objects. Use the accessor functions instead.

v4:
 - remove vm_lock
 - use drm_vma_offset_lock_lookup() to protect lookup (instead of vm_lock)

Cc: Dave Airlie <airlied@redhat.com>
Cc: Ben Skeggs <bskeggs@redhat.com>
Cc: Maarten Lankhorst <maarten.lankhorst@canonical.com>
Cc: Martin Peres <martin.peres@labri.fr>
Cc: Alex Deucher <alexander.deucher@amd.com>
Cc: Thomas Hellstrom <thellstrom@vmware.com>
Signed-off-by: default avatarDavid Herrmann <dh.herrmann@gmail.com>
Reviewed-by: default avatarDaniel Vetter <daniel.vetter@ffwll.ch>
Signed-off-by: default avatarDave Airlie <airlied@gmail.com>
parent 0de23977
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -487,7 +487,7 @@ void ast_gem_free_object(struct drm_gem_object *obj)

static inline u64 ast_bo_mmap_offset(struct ast_bo *bo)
{
	return bo->bo.addr_space_offset;
	return drm_vma_node_offset_addr(&bo->bo.vma_node);
}
int
ast_dumb_mmap_offset(struct drm_file *file,
+1 −1
Original line number Diff line number Diff line
@@ -294,7 +294,7 @@ void cirrus_gem_free_object(struct drm_gem_object *obj)

static inline u64 cirrus_bo_mmap_offset(struct cirrus_bo *bo)
{
	return bo->bo.addr_space_offset;
	return drm_vma_node_offset_addr(&bo->bo.vma_node);
}

int
+1 −1
Original line number Diff line number Diff line
@@ -349,7 +349,7 @@ void mgag200_gem_free_object(struct drm_gem_object *obj)

static inline u64 mgag200_bo_mmap_offset(struct mgag200_bo *bo)
{
	return bo->bo.addr_space_offset;
	return drm_vma_node_offset_addr(&bo->bo.vma_node);
}

int
+1 −1
Original line number Diff line number Diff line
@@ -697,7 +697,7 @@ nouveau_display_dumb_map_offset(struct drm_file *file_priv,
	gem = drm_gem_object_lookup(dev, file_priv, handle);
	if (gem) {
		struct nouveau_bo *bo = gem->driver_private;
		*poffset = bo->bo.addr_space_offset;
		*poffset = drm_vma_node_offset_addr(&bo->bo.vma_node);
		drm_gem_object_unreference_unlocked(gem);
		return 0;
	}
+1 −1
Original line number Diff line number Diff line
@@ -226,7 +226,7 @@ nouveau_gem_info(struct drm_file *file_priv, struct drm_gem_object *gem,
	}

	rep->size = nvbo->bo.mem.num_pages << PAGE_SHIFT;
	rep->map_handle = nvbo->bo.addr_space_offset;
	rep->map_handle = drm_vma_node_offset_addr(&nvbo->bo.vma_node);
	rep->tile_mode = nvbo->tile_mode;
	rep->tile_flags = nvbo->tile_flags;
	return 0;
Loading