summaryrefslogtreecommitdiff
path: root/drivers
diff options
context:
space:
mode:
authorNoralf Trønnes <noralf@tronnes.org>2018-11-10 17:56:43 +0300
committerNoralf Trønnes <noralf@tronnes.org>2018-11-20 16:54:15 +0300
commitf001488112c43fea6b7558e15f71d64ee7495286 (patch)
tree35bf3c91043118a17d6bdb0e6c492e6a4903bafc /drivers
parentf577f7eac5ad19eb1455acd2ec22aeb5f6a40ba0 (diff)
downloadlinux-f001488112c43fea6b7558e15f71d64ee7495286.tar.xz
drm/driver: Add defaults for .gem_prime_export/import callbacks
The majority of drivers use drm_gem_prime_export() and drm_gem_prime_import() for these callbacks so let's make them the default. Signed-off-by: Noralf Trønnes <noralf@tronnes.org> Acked-by: Daniel Vetter <daniel.vetter@ffwll.ch> Acked-by: Christian König <christian.koenig@amd.com> Link: https://patchwork.freedesktop.org/patch/msgid/20181110145647.17580-2-noralf@tronnes.org
Diffstat (limited to 'drivers')
-rw-r--r--drivers/gpu/drm/drm_prime.c10
1 files changed, 8 insertions, 2 deletions
diff --git a/drivers/gpu/drm/drm_prime.c b/drivers/gpu/drm/drm_prime.c
index 8d54d51a6b6b..ba6c7e02a2ae 100644
--- a/drivers/gpu/drm/drm_prime.c
+++ b/drivers/gpu/drm/drm_prime.c
@@ -529,7 +529,10 @@ static struct dma_buf *export_and_register_object(struct drm_device *dev,
return dmabuf;
}
- dmabuf = dev->driver->gem_prime_export(dev, obj, flags);
+ if (dev->driver->gem_prime_export)
+ dmabuf = dev->driver->gem_prime_export(dev, obj, flags);
+ else
+ dmabuf = drm_gem_prime_export(dev, obj, flags);
if (IS_ERR(dmabuf)) {
/* normally the created dma-buf takes ownership of the ref,
* but if that fails then drop the ref
@@ -762,7 +765,10 @@ int drm_gem_prime_fd_to_handle(struct drm_device *dev,
/* never seen this one, need to import */
mutex_lock(&dev->object_name_lock);
- obj = dev->driver->gem_prime_import(dev, dma_buf);
+ if (dev->driver->gem_prime_import)
+ obj = dev->driver->gem_prime_import(dev, dma_buf);
+ else
+ obj = drm_gem_prime_import(dev, dma_buf);
if (IS_ERR(obj)) {
ret = PTR_ERR(obj);
goto out_unlock;