[PATCH 6/8] drm/vmwgfx: Inline ttm_bo_mmap() into vmwgfx driver
Zack Rusin
zackr at vmware.com
Wed Apr 7 16:52:13 UTC 2021
On 4/6/21 5:09 AM, Thomas Zimmermann wrote:
> The vmwgfx driver is the only remaining user of ttm_bo_mmap(). Inline
> the code. The internal helper ttm_bo_vm_lookup() is now also part of
> vmwgfx as vmw_bo_vm_lookup().
>
> Signed-off-by: Thomas Zimmermann <tzimmermann at suse.de>
> ---
> drivers/gpu/drm/vmwgfx/vmwgfx_ttm_glue.c | 54 ++++++++++++++++++++++--
> 1 file changed, 51 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/gpu/drm/vmwgfx/vmwgfx_ttm_glue.c b/drivers/gpu/drm/vmwgfx/vmwgfx_ttm_glue.c
> index cb9975889e2f..3eaad00668f2 100644
> --- a/drivers/gpu/drm/vmwgfx/vmwgfx_ttm_glue.c
> +++ b/drivers/gpu/drm/vmwgfx/vmwgfx_ttm_glue.c
> @@ -27,6 +27,30 @@
>
> #include "vmwgfx_drv.h"
>
> +static struct ttm_buffer_object *vmw_bo_vm_lookup(struct ttm_device *bdev,
> + unsigned long offset,
> + unsigned long pages)
> +{
> + struct drm_vma_offset_node *node;
> + struct ttm_buffer_object *bo = NULL;
> +
> + drm_vma_offset_lock_lookup(bdev->vma_manager);
> +
> + node = drm_vma_offset_lookup_locked(bdev->vma_manager, offset, pages);
> + if (likely(node)) {
> + bo = container_of(node, struct ttm_buffer_object,
> + base.vma_node);
> + bo = ttm_bo_get_unless_zero(bo);
> + }
> +
> + drm_vma_offset_unlock_lookup(bdev->vma_manager);
> +
> + if (!bo)
> + pr_err("Could not find buffer object to map\n");
It's not a big deal and I know it's been in the original, but since
you're already in there if you could change this to DRM_ERR that'd be
great. Either way:
Reviewed-by: Zack Rusin <zackr at vmware.com>
z
More information about the dri-devel
mailing list