b47f9f92d6
Fixes a build failure with msm. This change was supposed to be part of commit49a3f51dfe
("drm/gem: Use struct dma_buf_map in GEM vmap ops and convert GEM backends"), but msm was forgotten. Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de> Reviewed-by: Daniel Vetter <daniel.vetter@ffwll.ch> Fixes:49a3f51dfe
("drm/gem: Use struct dma_buf_map in GEM vmap ops and convert GEM backends") Cc: Thomas Zimmermann <tzimmermann@suse.de> Cc: Christian König <christian.koenig@amd.com> Cc: David Airlie <airlied@linux.ie> Cc: Daniel Vetter <daniel@ffwll.ch> Cc: Maarten Lankhorst <maarten.lankhorst@linux.intel.com> Cc: Maxime Ripard <mripard@kernel.org> Cc: Dave Airlie <airlied@redhat.com> Cc: Lucas Stach <l.stach@pengutronix.de> Cc: Russell King <linux+etnaviv@armlinux.org.uk> Cc: Christian Gmeiner <christian.gmeiner@gmail.com> Cc: Qiang Yu <yuq825@gmail.com> Cc: Ben Skeggs <bskeggs@redhat.com> Cc: Rob Herring <robh@kernel.org> Cc: Tomeu Vizoso <tomeu.vizoso@collabora.com> Cc: Steven Price <steven.price@arm.com> Cc: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com> Cc: Gerd Hoffmann <kraxel@redhat.com> Cc: Alex Deucher <alexander.deucher@amd.com> Cc: "Christian König" <christian.koenig@amd.com> Cc: Sandy Huang <hjc@rock-chips.com> Cc: "Heiko Stübner" <heiko@sntech.de> Cc: Hans de Goede <hdegoede@redhat.com> Cc: Sean Paul <sean@poorly.run> Cc: Eric Anholt <eric@anholt.net> Cc: Rodrigo Siqueira <rodrigosiqueiramelo@gmail.com> Cc: Melissa Wen <melissa.srw@gmail.com> Cc: Haneen Mohammed <hamohammed.sa@gmail.com> Cc: Oleksandr Andrushchenko <oleksandr_andrushchenko@epam.com> Cc: Sumit Semwal <sumit.semwal@linaro.org> Cc: Emil Velikov <emil.velikov@collabora.com> Cc: Luben Tuikov <luben.tuikov@amd.com> Cc: Marek Szyprowski <m.szyprowski@samsung.com> Cc: Arunpravin <apaneers@amd.com> Cc: Huang Rui <ray.huang@amd.com> Cc: Madhav Chauhan <madhav.chauhan@amd.com> Cc: Jason Gunthorpe <jgg@ziepe.ca> Cc: Sam Ravnborg <sam@ravnborg.org> Cc: Chris Wilson <chris@chris-wilson.co.uk> Cc: Qinglang Miao <miaoqinglang@huawei.com> Cc: dri-devel@lists.freedesktop.org Cc: etnaviv@lists.freedesktop.org Cc: lima@lists.freedesktop.org Cc: nouveau@lists.freedesktop.org Cc: virtualization@lists.linux-foundation.org Cc: spice-devel@lists.freedesktop.org Cc: amd-gfx@lists.freedesktop.org Cc: linux-arm-kernel@lists.infradead.org Cc: linux-rockchip@lists.infradead.org Cc: xen-devel@lists.xenproject.org Link: https://patchwork.freedesktop.org/patch/msgid/20201109103242.19544-2-tzimmermann@suse.de
71 lines
1.5 KiB
C
71 lines
1.5 KiB
C
// SPDX-License-Identifier: GPL-2.0-only
|
|
/*
|
|
* Copyright (C) 2013 Red Hat
|
|
* Author: Rob Clark <robdclark@gmail.com>
|
|
*/
|
|
|
|
#include <linux/dma-buf.h>
|
|
|
|
#include <drm/drm_prime.h>
|
|
|
|
#include "msm_drv.h"
|
|
#include "msm_gem.h"
|
|
|
|
struct sg_table *msm_gem_prime_get_sg_table(struct drm_gem_object *obj)
|
|
{
|
|
struct msm_gem_object *msm_obj = to_msm_bo(obj);
|
|
int npages = obj->size >> PAGE_SHIFT;
|
|
|
|
if (WARN_ON(!msm_obj->pages)) /* should have already pinned! */
|
|
return NULL;
|
|
|
|
return drm_prime_pages_to_sg(obj->dev, msm_obj->pages, npages);
|
|
}
|
|
|
|
int msm_gem_prime_vmap(struct drm_gem_object *obj, struct dma_buf_map *map)
|
|
{
|
|
void *vaddr;
|
|
|
|
vaddr = msm_gem_get_vaddr(obj);
|
|
if (IS_ERR(vaddr))
|
|
return PTR_ERR(vaddr);
|
|
dma_buf_map_set_vaddr(map, vaddr);
|
|
|
|
return 0;
|
|
}
|
|
|
|
void msm_gem_prime_vunmap(struct drm_gem_object *obj, struct dma_buf_map *map)
|
|
{
|
|
msm_gem_put_vaddr(obj);
|
|
}
|
|
|
|
int msm_gem_prime_mmap(struct drm_gem_object *obj, struct vm_area_struct *vma)
|
|
{
|
|
int ret;
|
|
|
|
ret = drm_gem_mmap_obj(obj, obj->size, vma);
|
|
if (ret < 0)
|
|
return ret;
|
|
|
|
return msm_gem_mmap_obj(vma->vm_private_data, vma);
|
|
}
|
|
|
|
struct drm_gem_object *msm_gem_prime_import_sg_table(struct drm_device *dev,
|
|
struct dma_buf_attachment *attach, struct sg_table *sg)
|
|
{
|
|
return msm_gem_import(dev, attach->dmabuf, sg);
|
|
}
|
|
|
|
int msm_gem_prime_pin(struct drm_gem_object *obj)
|
|
{
|
|
if (!obj->import_attach)
|
|
msm_gem_get_pages(obj);
|
|
return 0;
|
|
}
|
|
|
|
void msm_gem_prime_unpin(struct drm_gem_object *obj)
|
|
{
|
|
if (!obj->import_attach)
|
|
msm_gem_put_pages(obj);
|
|
}
|