summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTomasz Figa <tfiga@chromium.org>2015-05-08 17:13:45 +0900
committerDaniel Vetter <daniel.vetter@ffwll.ch>2015-05-12 11:02:50 +0200
commit98515035d09fe943539c1967bbae06398f4375f5 (patch)
tree6f35551441bfdb6f9922424bd894baa0e11281c9
parent6bcacf51d050d412e5c302e0dd5e582212c5f7be (diff)
downloadop-kernel-dev-98515035d09fe943539c1967bbae06398f4375f5.zip
op-kernel-dev-98515035d09fe943539c1967bbae06398f4375f5.tar.gz
drm/prime: Allow internal imports without import_sg_table
Currently drm_gem_prime_import() checks if gem_prime_import_sg_table() is implemented in DRM driver ops. However it is not necessary for internal imports (i.e. dma_buf->ops == &drm_gem_prime_dmabuf_ops and obj->dev == dev), which only increment reference count on respective GEM objects. This patch makes the helper check this condition only in case of external imports fo rwhich importing sg table is indeed needed. Signed-off-by: Tomasz Figa <tfiga@chromium.org> Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
-rw-r--r--drivers/gpu/drm/drm_prime.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/drivers/gpu/drm/drm_prime.c b/drivers/gpu/drm/drm_prime.c
index 7fec191..162dd29 100644
--- a/drivers/gpu/drm/drm_prime.c
+++ b/drivers/gpu/drm/drm_prime.c
@@ -502,9 +502,6 @@ struct drm_gem_object *drm_gem_prime_import(struct drm_device *dev,
struct drm_gem_object *obj;
int ret;
- if (!dev->driver->gem_prime_import_sg_table)
- return ERR_PTR(-EINVAL);
-
if (dma_buf->ops == &drm_gem_prime_dmabuf_ops) {
obj = dma_buf->priv;
if (obj->dev == dev) {
@@ -517,6 +514,9 @@ struct drm_gem_object *drm_gem_prime_import(struct drm_device *dev,
}
}
+ if (!dev->driver->gem_prime_import_sg_table)
+ return ERR_PTR(-EINVAL);
+
attach = dma_buf_attach(dma_buf, dev->dev);
if (IS_ERR(attach))
return ERR_CAST(attach);
OpenPOWER on IntegriCloud