aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/gpu
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/gpu')
-rw-r--r--drivers/gpu/drm/drm_gem_cma_helper.c7
-rw-r--r--drivers/gpu/drm/drm_prime.c2
-rw-r--r--drivers/gpu/drm/msm/msm_drv.h2
-rw-r--r--drivers/gpu/drm/msm/msm_gem_prime.c5
-rw-r--r--drivers/gpu/drm/nouveau/nouveau_gem.h2
-rw-r--r--drivers/gpu/drm/nouveau/nouveau_prime.c5
-rw-r--r--drivers/gpu/drm/qxl/qxl_drv.h2
-rw-r--r--drivers/gpu/drm/qxl/qxl_prime.c2
-rw-r--r--drivers/gpu/drm/radeon/radeon_drv.c2
-rw-r--r--drivers/gpu/drm/radeon/radeon_prime.c5
10 files changed, 19 insertions, 15 deletions
diff --git a/drivers/gpu/drm/drm_gem_cma_helper.c b/drivers/gpu/drm/drm_gem_cma_helper.c
index e467e67af6e7..0316310e2cc4 100644
--- a/drivers/gpu/drm/drm_gem_cma_helper.c
+++ b/drivers/gpu/drm/drm_gem_cma_helper.c
@@ -316,7 +316,8 @@ out:
316EXPORT_SYMBOL_GPL(drm_gem_cma_prime_get_sg_table); 316EXPORT_SYMBOL_GPL(drm_gem_cma_prime_get_sg_table);
317 317
318struct drm_gem_object * 318struct drm_gem_object *
319drm_gem_cma_prime_import_sg_table(struct drm_device *dev, size_t size, 319drm_gem_cma_prime_import_sg_table(struct drm_device *dev,
320 struct dma_buf_attachment *attach,
320 struct sg_table *sgt) 321 struct sg_table *sgt)
321{ 322{
322 struct drm_gem_cma_object *cma_obj; 323 struct drm_gem_cma_object *cma_obj;
@@ -325,14 +326,14 @@ drm_gem_cma_prime_import_sg_table(struct drm_device *dev, size_t size,
325 return ERR_PTR(-EINVAL); 326 return ERR_PTR(-EINVAL);
326 327
327 /* Create a CMA GEM buffer. */ 328 /* Create a CMA GEM buffer. */
328 cma_obj = __drm_gem_cma_create(dev, size); 329 cma_obj = __drm_gem_cma_create(dev, attach->dmabuf->size);
329 if (IS_ERR(cma_obj)) 330 if (IS_ERR(cma_obj))
330 return ERR_CAST(cma_obj); 331 return ERR_CAST(cma_obj);
331 332
332 cma_obj->paddr = sg_dma_address(sgt->sgl); 333 cma_obj->paddr = sg_dma_address(sgt->sgl);
333 cma_obj->sgt = sgt; 334 cma_obj->sgt = sgt;
334 335
335 DRM_DEBUG_PRIME("dma_addr = %pad, size = %zu\n", &cma_obj->paddr, size); 336 DRM_DEBUG_PRIME("dma_addr = %pad, size = %zu\n", &cma_obj->paddr, attach->dmabuf->size);
336 337
337 return &cma_obj->base; 338 return &cma_obj->base;
338} 339}
diff --git a/drivers/gpu/drm/drm_prime.c b/drivers/gpu/drm/drm_prime.c
index 7826de9da276..78ca30808422 100644
--- a/drivers/gpu/drm/drm_prime.c
+++ b/drivers/gpu/drm/drm_prime.c
@@ -525,7 +525,7 @@ struct drm_gem_object *drm_gem_prime_import(struct drm_device *dev,
525 goto fail_detach; 525 goto fail_detach;
526 } 526 }
527 527
528 obj = dev->driver->gem_prime_import_sg_table(dev, dma_buf->size, sgt); 528 obj = dev->driver->gem_prime_import_sg_table(dev, attach, sgt);
529 if (IS_ERR(obj)) { 529 if (IS_ERR(obj)) {
530 ret = PTR_ERR(obj); 530 ret = PTR_ERR(obj);
531 goto fail_unmap; 531 goto fail_unmap;
diff --git a/drivers/gpu/drm/msm/msm_drv.h b/drivers/gpu/drm/msm/msm_drv.h
index afaafd42dee7..67f9d0a2332c 100644
--- a/drivers/gpu/drm/msm/msm_drv.h
+++ b/drivers/gpu/drm/msm/msm_drv.h
@@ -171,7 +171,7 @@ struct sg_table *msm_gem_prime_get_sg_table(struct drm_gem_object *obj);
171void *msm_gem_prime_vmap(struct drm_gem_object *obj); 171void *msm_gem_prime_vmap(struct drm_gem_object *obj);
172void msm_gem_prime_vunmap(struct drm_gem_object *obj, void *vaddr); 172void msm_gem_prime_vunmap(struct drm_gem_object *obj, void *vaddr);
173struct drm_gem_object *msm_gem_prime_import_sg_table(struct drm_device *dev, 173struct drm_gem_object *msm_gem_prime_import_sg_table(struct drm_device *dev,
174 size_t size, struct sg_table *sg); 174 struct dma_buf_attachment *attach, struct sg_table *sg);
175int msm_gem_prime_pin(struct drm_gem_object *obj); 175int msm_gem_prime_pin(struct drm_gem_object *obj);
176void msm_gem_prime_unpin(struct drm_gem_object *obj); 176void msm_gem_prime_unpin(struct drm_gem_object *obj);
177void *msm_gem_vaddr_locked(struct drm_gem_object *obj); 177void *msm_gem_vaddr_locked(struct drm_gem_object *obj);
diff --git a/drivers/gpu/drm/msm/msm_gem_prime.c b/drivers/gpu/drm/msm/msm_gem_prime.c
index d48f9fc5129b..ad772fe36115 100644
--- a/drivers/gpu/drm/msm/msm_gem_prime.c
+++ b/drivers/gpu/drm/msm/msm_gem_prime.c
@@ -18,6 +18,7 @@
18#include "msm_drv.h" 18#include "msm_drv.h"
19#include "msm_gem.h" 19#include "msm_gem.h"
20 20
21#include <linux/dma-buf.h>
21 22
22struct sg_table *msm_gem_prime_get_sg_table(struct drm_gem_object *obj) 23struct sg_table *msm_gem_prime_get_sg_table(struct drm_gem_object *obj)
23{ 24{
@@ -37,9 +38,9 @@ void msm_gem_prime_vunmap(struct drm_gem_object *obj, void *vaddr)
37} 38}
38 39
39struct drm_gem_object *msm_gem_prime_import_sg_table(struct drm_device *dev, 40struct drm_gem_object *msm_gem_prime_import_sg_table(struct drm_device *dev,
40 size_t size, struct sg_table *sg) 41 struct dma_buf_attachment *attach, struct sg_table *sg)
41{ 42{
42 return msm_gem_import(dev, size, sg); 43 return msm_gem_import(dev, attach->dmabuf->size, sg);
43} 44}
44 45
45int msm_gem_prime_pin(struct drm_gem_object *obj) 46int msm_gem_prime_pin(struct drm_gem_object *obj)
diff --git a/drivers/gpu/drm/nouveau/nouveau_gem.h b/drivers/gpu/drm/nouveau/nouveau_gem.h
index ddab762d81fe..e4049faca780 100644
--- a/drivers/gpu/drm/nouveau/nouveau_gem.h
+++ b/drivers/gpu/drm/nouveau/nouveau_gem.h
@@ -39,7 +39,7 @@ struct reservation_object *nouveau_gem_prime_res_obj(struct drm_gem_object *);
39extern void nouveau_gem_prime_unpin(struct drm_gem_object *); 39extern void nouveau_gem_prime_unpin(struct drm_gem_object *);
40extern struct sg_table *nouveau_gem_prime_get_sg_table(struct drm_gem_object *); 40extern struct sg_table *nouveau_gem_prime_get_sg_table(struct drm_gem_object *);
41extern struct drm_gem_object *nouveau_gem_prime_import_sg_table( 41extern struct drm_gem_object *nouveau_gem_prime_import_sg_table(
42 struct drm_device *, size_t size, struct sg_table *); 42 struct drm_device *, struct dma_buf_attachment *, struct sg_table *);
43extern void *nouveau_gem_prime_vmap(struct drm_gem_object *); 43extern void *nouveau_gem_prime_vmap(struct drm_gem_object *);
44extern void nouveau_gem_prime_vunmap(struct drm_gem_object *, void *); 44extern void nouveau_gem_prime_vunmap(struct drm_gem_object *, void *);
45 45
diff --git a/drivers/gpu/drm/nouveau/nouveau_prime.c b/drivers/gpu/drm/nouveau/nouveau_prime.c
index 1f51008e4d26..2215cdba587d 100644
--- a/drivers/gpu/drm/nouveau/nouveau_prime.c
+++ b/drivers/gpu/drm/nouveau/nouveau_prime.c
@@ -23,6 +23,7 @@
23 */ 23 */
24 24
25#include <drm/drmP.h> 25#include <drm/drmP.h>
26#include <linux/dma-buf.h>
26 27
27#include "nouveau_drm.h" 28#include "nouveau_drm.h"
28#include "nouveau_gem.h" 29#include "nouveau_gem.h"
@@ -56,7 +57,7 @@ void nouveau_gem_prime_vunmap(struct drm_gem_object *obj, void *vaddr)
56} 57}
57 58
58struct drm_gem_object *nouveau_gem_prime_import_sg_table(struct drm_device *dev, 59struct drm_gem_object *nouveau_gem_prime_import_sg_table(struct drm_device *dev,
59 size_t size, 60 struct dma_buf_attachment *attach,
60 struct sg_table *sg) 61 struct sg_table *sg)
61{ 62{
62 struct nouveau_bo *nvbo; 63 struct nouveau_bo *nvbo;
@@ -65,7 +66,7 @@ struct drm_gem_object *nouveau_gem_prime_import_sg_table(struct drm_device *dev,
65 66
66 flags = TTM_PL_FLAG_TT; 67 flags = TTM_PL_FLAG_TT;
67 68
68 ret = nouveau_bo_new(dev, size, 0, flags, 0, 0, 69 ret = nouveau_bo_new(dev, attach->dmabuf->size, 0, flags, 0, 0,
69 sg, &nvbo); 70 sg, &nvbo);
70 if (ret) 71 if (ret)
71 return ERR_PTR(ret); 72 return ERR_PTR(ret);
diff --git a/drivers/gpu/drm/qxl/qxl_drv.h b/drivers/gpu/drm/qxl/qxl_drv.h
index ff0772728eb0..7c6cafe21f5f 100644
--- a/drivers/gpu/drm/qxl/qxl_drv.h
+++ b/drivers/gpu/drm/qxl/qxl_drv.h
@@ -537,7 +537,7 @@ int qxl_gem_prime_pin(struct drm_gem_object *obj);
537void qxl_gem_prime_unpin(struct drm_gem_object *obj); 537void qxl_gem_prime_unpin(struct drm_gem_object *obj);
538struct sg_table *qxl_gem_prime_get_sg_table(struct drm_gem_object *obj); 538struct sg_table *qxl_gem_prime_get_sg_table(struct drm_gem_object *obj);
539struct drm_gem_object *qxl_gem_prime_import_sg_table( 539struct drm_gem_object *qxl_gem_prime_import_sg_table(
540 struct drm_device *dev, size_t size, 540 struct drm_device *dev, struct dma_buf_attachment *attach,
541 struct sg_table *sgt); 541 struct sg_table *sgt);
542void *qxl_gem_prime_vmap(struct drm_gem_object *obj); 542void *qxl_gem_prime_vmap(struct drm_gem_object *obj);
543void qxl_gem_prime_vunmap(struct drm_gem_object *obj, void *vaddr); 543void qxl_gem_prime_vunmap(struct drm_gem_object *obj, void *vaddr);
diff --git a/drivers/gpu/drm/qxl/qxl_prime.c b/drivers/gpu/drm/qxl/qxl_prime.c
index ba0689c728e8..3d031b50a8fd 100644
--- a/drivers/gpu/drm/qxl/qxl_prime.c
+++ b/drivers/gpu/drm/qxl/qxl_prime.c
@@ -46,7 +46,7 @@ struct sg_table *qxl_gem_prime_get_sg_table(struct drm_gem_object *obj)
46} 46}
47 47
48struct drm_gem_object *qxl_gem_prime_import_sg_table( 48struct drm_gem_object *qxl_gem_prime_import_sg_table(
49 struct drm_device *dev, size_t size, 49 struct drm_device *dev, struct dma_buf_attachment *attach,
50 struct sg_table *table) 50 struct sg_table *table)
51{ 51{
52 WARN_ONCE(1, "not implemented"); 52 WARN_ONCE(1, "not implemented");
diff --git a/drivers/gpu/drm/radeon/radeon_drv.c b/drivers/gpu/drm/radeon/radeon_drv.c
index de108427a197..69c6a835bcd5 100644
--- a/drivers/gpu/drm/radeon/radeon_drv.c
+++ b/drivers/gpu/drm/radeon/radeon_drv.c
@@ -135,7 +135,7 @@ int radeon_mode_dumb_create(struct drm_file *file_priv,
135 struct drm_mode_create_dumb *args); 135 struct drm_mode_create_dumb *args);
136struct sg_table *radeon_gem_prime_get_sg_table(struct drm_gem_object *obj); 136struct sg_table *radeon_gem_prime_get_sg_table(struct drm_gem_object *obj);
137struct drm_gem_object *radeon_gem_prime_import_sg_table(struct drm_device *dev, 137struct drm_gem_object *radeon_gem_prime_import_sg_table(struct drm_device *dev,
138 size_t size, 138 struct dma_buf_attachment *,
139 struct sg_table *sg); 139 struct sg_table *sg);
140int radeon_gem_prime_pin(struct drm_gem_object *obj); 140int radeon_gem_prime_pin(struct drm_gem_object *obj);
141void radeon_gem_prime_unpin(struct drm_gem_object *obj); 141void radeon_gem_prime_unpin(struct drm_gem_object *obj);
diff --git a/drivers/gpu/drm/radeon/radeon_prime.c b/drivers/gpu/drm/radeon/radeon_prime.c
index d5414d42e44b..171daf7fc483 100644
--- a/drivers/gpu/drm/radeon/radeon_prime.c
+++ b/drivers/gpu/drm/radeon/radeon_prime.c
@@ -27,6 +27,7 @@
27 27
28#include "radeon.h" 28#include "radeon.h"
29#include <drm/radeon_drm.h> 29#include <drm/radeon_drm.h>
30#include <linux/dma-buf.h>
30 31
31struct sg_table *radeon_gem_prime_get_sg_table(struct drm_gem_object *obj) 32struct sg_table *radeon_gem_prime_get_sg_table(struct drm_gem_object *obj)
32{ 33{
@@ -57,14 +58,14 @@ void radeon_gem_prime_vunmap(struct drm_gem_object *obj, void *vaddr)
57} 58}
58 59
59struct drm_gem_object *radeon_gem_prime_import_sg_table(struct drm_device *dev, 60struct drm_gem_object *radeon_gem_prime_import_sg_table(struct drm_device *dev,
60 size_t size, 61 struct dma_buf_attachment *attach,
61 struct sg_table *sg) 62 struct sg_table *sg)
62{ 63{
63 struct radeon_device *rdev = dev->dev_private; 64 struct radeon_device *rdev = dev->dev_private;
64 struct radeon_bo *bo; 65 struct radeon_bo *bo;
65 int ret; 66 int ret;
66 67
67 ret = radeon_bo_create(rdev, size, PAGE_SIZE, false, 68 ret = radeon_bo_create(rdev, attach->dmabuf->size, PAGE_SIZE, false,
68 RADEON_GEM_DOMAIN_GTT, 0, sg, &bo); 69 RADEON_GEM_DOMAIN_GTT, 0, sg, &bo);
69 if (ret) 70 if (ret)
70 return ERR_PTR(ret); 71 return ERR_PTR(ret);