diff options
-rw-r--r-- | drivers/dma-buf/dma-buf.c | 22 | ||||
-rw-r--r-- | drivers/gpu/drm/armada/armada_gem.c | 2 | ||||
-rw-r--r-- | drivers/gpu/drm/drm_prime.c | 8 | ||||
-rw-r--r-- | drivers/gpu/drm/exynos/exynos_drm_dmabuf.c | 2 | ||||
-rw-r--r-- | drivers/gpu/drm/i915/i915_gem_dmabuf.c | 3 | ||||
-rw-r--r-- | drivers/gpu/drm/nouveau/nouveau_drm.c | 1 | ||||
-rw-r--r-- | drivers/gpu/drm/nouveau/nouveau_gem.h | 1 | ||||
-rw-r--r-- | drivers/gpu/drm/nouveau/nouveau_prime.c | 7 | ||||
-rw-r--r-- | drivers/gpu/drm/omapdrm/omap_gem_dmabuf.c | 2 | ||||
-rw-r--r-- | drivers/gpu/drm/radeon/radeon_drv.c | 2 | ||||
-rw-r--r-- | drivers/gpu/drm/radeon/radeon_prime.c | 8 | ||||
-rw-r--r-- | drivers/gpu/drm/tegra/gem.c | 2 | ||||
-rw-r--r-- | drivers/gpu/drm/ttm/ttm_object.c | 2 | ||||
-rw-r--r-- | drivers/media/v4l2-core/videobuf2-dma-contig.c | 2 | ||||
-rw-r--r-- | drivers/staging/android/ion/ion.c | 3 | ||||
-rw-r--r-- | include/drm/drmP.h | 3 | ||||
-rw-r--r-- | include/linux/dma-buf.h | 9 |
17 files changed, 65 insertions, 14 deletions
diff --git a/drivers/dma-buf/dma-buf.c b/drivers/dma-buf/dma-buf.c index 840c7fa80983..cd40ca22911f 100644 --- a/drivers/dma-buf/dma-buf.c +++ b/drivers/dma-buf/dma-buf.c | |||
@@ -25,10 +25,12 @@ | |||
25 | #include <linux/fs.h> | 25 | #include <linux/fs.h> |
26 | #include <linux/slab.h> | 26 | #include <linux/slab.h> |
27 | #include <linux/dma-buf.h> | 27 | #include <linux/dma-buf.h> |
28 | #include <linux/fence.h> | ||
28 | #include <linux/anon_inodes.h> | 29 | #include <linux/anon_inodes.h> |
29 | #include <linux/export.h> | 30 | #include <linux/export.h> |
30 | #include <linux/debugfs.h> | 31 | #include <linux/debugfs.h> |
31 | #include <linux/seq_file.h> | 32 | #include <linux/seq_file.h> |
33 | #include <linux/reservation.h> | ||
32 | 34 | ||
33 | static inline int is_dma_buf_file(struct file *); | 35 | static inline int is_dma_buf_file(struct file *); |
34 | 36 | ||
@@ -56,6 +58,9 @@ static int dma_buf_release(struct inode *inode, struct file *file) | |||
56 | list_del(&dmabuf->list_node); | 58 | list_del(&dmabuf->list_node); |
57 | mutex_unlock(&db_list.lock); | 59 | mutex_unlock(&db_list.lock); |
58 | 60 | ||
61 | if (dmabuf->resv == (struct reservation_object *)&dmabuf[1]) | ||
62 | reservation_object_fini(dmabuf->resv); | ||
63 | |||
59 | kfree(dmabuf); | 64 | kfree(dmabuf); |
60 | return 0; | 65 | return 0; |
61 | } | 66 | } |
@@ -128,6 +133,7 @@ static inline int is_dma_buf_file(struct file *file) | |||
128 | * @size: [in] Size of the buffer | 133 | * @size: [in] Size of the buffer |
129 | * @flags: [in] mode flags for the file. | 134 | * @flags: [in] mode flags for the file. |
130 | * @exp_name: [in] name of the exporting module - useful for debugging. | 135 | * @exp_name: [in] name of the exporting module - useful for debugging. |
136 | * @resv: [in] reservation-object, NULL to allocate default one. | ||
131 | * | 137 | * |
132 | * Returns, on success, a newly created dma_buf object, which wraps the | 138 | * Returns, on success, a newly created dma_buf object, which wraps the |
133 | * supplied private data and operations for dma_buf_ops. On either missing | 139 | * supplied private data and operations for dma_buf_ops. On either missing |
@@ -135,10 +141,17 @@ static inline int is_dma_buf_file(struct file *file) | |||
135 | * | 141 | * |
136 | */ | 142 | */ |
137 | struct dma_buf *dma_buf_export_named(void *priv, const struct dma_buf_ops *ops, | 143 | struct dma_buf *dma_buf_export_named(void *priv, const struct dma_buf_ops *ops, |
138 | size_t size, int flags, const char *exp_name) | 144 | size_t size, int flags, const char *exp_name, |
145 | struct reservation_object *resv) | ||
139 | { | 146 | { |
140 | struct dma_buf *dmabuf; | 147 | struct dma_buf *dmabuf; |
141 | struct file *file; | 148 | struct file *file; |
149 | size_t alloc_size = sizeof(struct dma_buf); | ||
150 | if (!resv) | ||
151 | alloc_size += sizeof(struct reservation_object); | ||
152 | else | ||
153 | /* prevent &dma_buf[1] == dma_buf->resv */ | ||
154 | alloc_size += 1; | ||
142 | 155 | ||
143 | if (WARN_ON(!priv || !ops | 156 | if (WARN_ON(!priv || !ops |
144 | || !ops->map_dma_buf | 157 | || !ops->map_dma_buf |
@@ -150,7 +163,7 @@ struct dma_buf *dma_buf_export_named(void *priv, const struct dma_buf_ops *ops, | |||
150 | return ERR_PTR(-EINVAL); | 163 | return ERR_PTR(-EINVAL); |
151 | } | 164 | } |
152 | 165 | ||
153 | dmabuf = kzalloc(sizeof(struct dma_buf), GFP_KERNEL); | 166 | dmabuf = kzalloc(alloc_size, GFP_KERNEL); |
154 | if (dmabuf == NULL) | 167 | if (dmabuf == NULL) |
155 | return ERR_PTR(-ENOMEM); | 168 | return ERR_PTR(-ENOMEM); |
156 | 169 | ||
@@ -158,6 +171,11 @@ struct dma_buf *dma_buf_export_named(void *priv, const struct dma_buf_ops *ops, | |||
158 | dmabuf->ops = ops; | 171 | dmabuf->ops = ops; |
159 | dmabuf->size = size; | 172 | dmabuf->size = size; |
160 | dmabuf->exp_name = exp_name; | 173 | dmabuf->exp_name = exp_name; |
174 | if (!resv) { | ||
175 | resv = (struct reservation_object *)&dmabuf[1]; | ||
176 | reservation_object_init(resv); | ||
177 | } | ||
178 | dmabuf->resv = resv; | ||
161 | 179 | ||
162 | file = anon_inode_getfile("dmabuf", &dma_buf_fops, dmabuf, flags); | 180 | file = anon_inode_getfile("dmabuf", &dma_buf_fops, dmabuf, flags); |
163 | if (IS_ERR(file)) { | 181 | if (IS_ERR(file)) { |
diff --git a/drivers/gpu/drm/armada/armada_gem.c b/drivers/gpu/drm/armada/armada_gem.c index bb9b642d8485..7496f55611a5 100644 --- a/drivers/gpu/drm/armada/armada_gem.c +++ b/drivers/gpu/drm/armada/armada_gem.c | |||
@@ -539,7 +539,7 @@ armada_gem_prime_export(struct drm_device *dev, struct drm_gem_object *obj, | |||
539 | int flags) | 539 | int flags) |
540 | { | 540 | { |
541 | return dma_buf_export(obj, &armada_gem_prime_dmabuf_ops, obj->size, | 541 | return dma_buf_export(obj, &armada_gem_prime_dmabuf_ops, obj->size, |
542 | O_RDWR); | 542 | O_RDWR, NULL); |
543 | } | 543 | } |
544 | 544 | ||
545 | struct drm_gem_object * | 545 | struct drm_gem_object * |
diff --git a/drivers/gpu/drm/drm_prime.c b/drivers/gpu/drm/drm_prime.c index 304ca8cacbc4..99d578bad17e 100644 --- a/drivers/gpu/drm/drm_prime.c +++ b/drivers/gpu/drm/drm_prime.c | |||
@@ -336,7 +336,13 @@ static const struct dma_buf_ops drm_gem_prime_dmabuf_ops = { | |||
336 | struct dma_buf *drm_gem_prime_export(struct drm_device *dev, | 336 | struct dma_buf *drm_gem_prime_export(struct drm_device *dev, |
337 | struct drm_gem_object *obj, int flags) | 337 | struct drm_gem_object *obj, int flags) |
338 | { | 338 | { |
339 | return dma_buf_export(obj, &drm_gem_prime_dmabuf_ops, obj->size, flags); | 339 | struct reservation_object *robj = NULL; |
340 | |||
341 | if (dev->driver->gem_prime_res_obj) | ||
342 | robj = dev->driver->gem_prime_res_obj(obj); | ||
343 | |||
344 | return dma_buf_export(obj, &drm_gem_prime_dmabuf_ops, obj->size, | ||
345 | flags, robj); | ||
340 | } | 346 | } |
341 | EXPORT_SYMBOL(drm_gem_prime_export); | 347 | EXPORT_SYMBOL(drm_gem_prime_export); |
342 | 348 | ||
diff --git a/drivers/gpu/drm/exynos/exynos_drm_dmabuf.c b/drivers/gpu/drm/exynos/exynos_drm_dmabuf.c index 2a3ad24276f8..60192ed544f0 100644 --- a/drivers/gpu/drm/exynos/exynos_drm_dmabuf.c +++ b/drivers/gpu/drm/exynos/exynos_drm_dmabuf.c | |||
@@ -187,7 +187,7 @@ struct dma_buf *exynos_dmabuf_prime_export(struct drm_device *drm_dev, | |||
187 | struct exynos_drm_gem_obj *exynos_gem_obj = to_exynos_gem_obj(obj); | 187 | struct exynos_drm_gem_obj *exynos_gem_obj = to_exynos_gem_obj(obj); |
188 | 188 | ||
189 | return dma_buf_export(obj, &exynos_dmabuf_ops, | 189 | return dma_buf_export(obj, &exynos_dmabuf_ops, |
190 | exynos_gem_obj->base.size, flags); | 190 | exynos_gem_obj->base.size, flags, NULL); |
191 | } | 191 | } |
192 | 192 | ||
193 | struct drm_gem_object *exynos_dmabuf_prime_import(struct drm_device *drm_dev, | 193 | struct drm_gem_object *exynos_dmabuf_prime_import(struct drm_device *drm_dev, |
diff --git a/drivers/gpu/drm/i915/i915_gem_dmabuf.c b/drivers/gpu/drm/i915/i915_gem_dmabuf.c index 580aa42443ed..82a1f4b57778 100644 --- a/drivers/gpu/drm/i915/i915_gem_dmabuf.c +++ b/drivers/gpu/drm/i915/i915_gem_dmabuf.c | |||
@@ -237,7 +237,8 @@ struct dma_buf *i915_gem_prime_export(struct drm_device *dev, | |||
237 | return ERR_PTR(ret); | 237 | return ERR_PTR(ret); |
238 | } | 238 | } |
239 | 239 | ||
240 | return dma_buf_export(gem_obj, &i915_dmabuf_ops, gem_obj->size, flags); | 240 | return dma_buf_export(gem_obj, &i915_dmabuf_ops, gem_obj->size, flags, |
241 | NULL); | ||
241 | } | 242 | } |
242 | 243 | ||
243 | static int i915_gem_object_get_pages_dmabuf(struct drm_i915_gem_object *obj) | 244 | static int i915_gem_object_get_pages_dmabuf(struct drm_i915_gem_object *obj) |
diff --git a/drivers/gpu/drm/nouveau/nouveau_drm.c b/drivers/gpu/drm/nouveau/nouveau_drm.c index ddd83756b9a2..e8ae68a9aaf1 100644 --- a/drivers/gpu/drm/nouveau/nouveau_drm.c +++ b/drivers/gpu/drm/nouveau/nouveau_drm.c | |||
@@ -844,6 +844,7 @@ driver = { | |||
844 | .gem_prime_export = drm_gem_prime_export, | 844 | .gem_prime_export = drm_gem_prime_export, |
845 | .gem_prime_import = drm_gem_prime_import, | 845 | .gem_prime_import = drm_gem_prime_import, |
846 | .gem_prime_pin = nouveau_gem_prime_pin, | 846 | .gem_prime_pin = nouveau_gem_prime_pin, |
847 | .gem_prime_res_obj = nouveau_gem_prime_res_obj, | ||
847 | .gem_prime_unpin = nouveau_gem_prime_unpin, | 848 | .gem_prime_unpin = nouveau_gem_prime_unpin, |
848 | .gem_prime_get_sg_table = nouveau_gem_prime_get_sg_table, | 849 | .gem_prime_get_sg_table = nouveau_gem_prime_get_sg_table, |
849 | .gem_prime_import_sg_table = nouveau_gem_prime_import_sg_table, | 850 | .gem_prime_import_sg_table = nouveau_gem_prime_import_sg_table, |
diff --git a/drivers/gpu/drm/nouveau/nouveau_gem.h b/drivers/gpu/drm/nouveau/nouveau_gem.h index 7caca057bc38..ddab762d81fe 100644 --- a/drivers/gpu/drm/nouveau/nouveau_gem.h +++ b/drivers/gpu/drm/nouveau/nouveau_gem.h | |||
@@ -35,6 +35,7 @@ extern int nouveau_gem_ioctl_info(struct drm_device *, void *, | |||
35 | struct drm_file *); | 35 | struct drm_file *); |
36 | 36 | ||
37 | extern int nouveau_gem_prime_pin(struct drm_gem_object *); | 37 | extern int nouveau_gem_prime_pin(struct drm_gem_object *); |
38 | struct reservation_object *nouveau_gem_prime_res_obj(struct drm_gem_object *); | ||
38 | extern void nouveau_gem_prime_unpin(struct drm_gem_object *); | 39 | extern void nouveau_gem_prime_unpin(struct drm_gem_object *); |
39 | extern struct sg_table *nouveau_gem_prime_get_sg_table(struct drm_gem_object *); | 40 | extern struct sg_table *nouveau_gem_prime_get_sg_table(struct drm_gem_object *); |
40 | extern struct drm_gem_object *nouveau_gem_prime_import_sg_table( | 41 | extern struct drm_gem_object *nouveau_gem_prime_import_sg_table( |
diff --git a/drivers/gpu/drm/nouveau/nouveau_prime.c b/drivers/gpu/drm/nouveau/nouveau_prime.c index 51a2cb102b44..1f51008e4d26 100644 --- a/drivers/gpu/drm/nouveau/nouveau_prime.c +++ b/drivers/gpu/drm/nouveau/nouveau_prime.c | |||
@@ -102,3 +102,10 @@ void nouveau_gem_prime_unpin(struct drm_gem_object *obj) | |||
102 | 102 | ||
103 | nouveau_bo_unpin(nvbo); | 103 | nouveau_bo_unpin(nvbo); |
104 | } | 104 | } |
105 | |||
106 | struct reservation_object *nouveau_gem_prime_res_obj(struct drm_gem_object *obj) | ||
107 | { | ||
108 | struct nouveau_bo *nvbo = nouveau_gem_object(obj); | ||
109 | |||
110 | return nvbo->bo.resv; | ||
111 | } | ||
diff --git a/drivers/gpu/drm/omapdrm/omap_gem_dmabuf.c b/drivers/gpu/drm/omapdrm/omap_gem_dmabuf.c index 4fcca8d42796..a2dbfb1737b4 100644 --- a/drivers/gpu/drm/omapdrm/omap_gem_dmabuf.c +++ b/drivers/gpu/drm/omapdrm/omap_gem_dmabuf.c | |||
@@ -171,7 +171,7 @@ static struct dma_buf_ops omap_dmabuf_ops = { | |||
171 | struct dma_buf *omap_gem_prime_export(struct drm_device *dev, | 171 | struct dma_buf *omap_gem_prime_export(struct drm_device *dev, |
172 | struct drm_gem_object *obj, int flags) | 172 | struct drm_gem_object *obj, int flags) |
173 | { | 173 | { |
174 | return dma_buf_export(obj, &omap_dmabuf_ops, obj->size, flags); | 174 | return dma_buf_export(obj, &omap_dmabuf_ops, obj->size, flags, NULL); |
175 | } | 175 | } |
176 | 176 | ||
177 | struct drm_gem_object *omap_gem_prime_import(struct drm_device *dev, | 177 | struct drm_gem_object *omap_gem_prime_import(struct drm_device *dev, |
diff --git a/drivers/gpu/drm/radeon/radeon_drv.c b/drivers/gpu/drm/radeon/radeon_drv.c index cb1421369e3a..5fa62a113db6 100644 --- a/drivers/gpu/drm/radeon/radeon_drv.c +++ b/drivers/gpu/drm/radeon/radeon_drv.c | |||
@@ -132,6 +132,7 @@ struct drm_gem_object *radeon_gem_prime_import_sg_table(struct drm_device *dev, | |||
132 | struct sg_table *sg); | 132 | struct sg_table *sg); |
133 | int radeon_gem_prime_pin(struct drm_gem_object *obj); | 133 | int radeon_gem_prime_pin(struct drm_gem_object *obj); |
134 | void radeon_gem_prime_unpin(struct drm_gem_object *obj); | 134 | void radeon_gem_prime_unpin(struct drm_gem_object *obj); |
135 | struct reservation_object *radeon_gem_prime_res_obj(struct drm_gem_object *); | ||
135 | void *radeon_gem_prime_vmap(struct drm_gem_object *obj); | 136 | void *radeon_gem_prime_vmap(struct drm_gem_object *obj); |
136 | void radeon_gem_prime_vunmap(struct drm_gem_object *obj, void *vaddr); | 137 | void radeon_gem_prime_vunmap(struct drm_gem_object *obj, void *vaddr); |
137 | extern long radeon_kms_compat_ioctl(struct file *filp, unsigned int cmd, | 138 | extern long radeon_kms_compat_ioctl(struct file *filp, unsigned int cmd, |
@@ -566,6 +567,7 @@ static struct drm_driver kms_driver = { | |||
566 | .gem_prime_import = drm_gem_prime_import, | 567 | .gem_prime_import = drm_gem_prime_import, |
567 | .gem_prime_pin = radeon_gem_prime_pin, | 568 | .gem_prime_pin = radeon_gem_prime_pin, |
568 | .gem_prime_unpin = radeon_gem_prime_unpin, | 569 | .gem_prime_unpin = radeon_gem_prime_unpin, |
570 | .gem_prime_res_obj = radeon_gem_prime_res_obj, | ||
569 | .gem_prime_get_sg_table = radeon_gem_prime_get_sg_table, | 571 | .gem_prime_get_sg_table = radeon_gem_prime_get_sg_table, |
570 | .gem_prime_import_sg_table = radeon_gem_prime_import_sg_table, | 572 | .gem_prime_import_sg_table = radeon_gem_prime_import_sg_table, |
571 | .gem_prime_vmap = radeon_gem_prime_vmap, | 573 | .gem_prime_vmap = radeon_gem_prime_vmap, |
diff --git a/drivers/gpu/drm/radeon/radeon_prime.c b/drivers/gpu/drm/radeon/radeon_prime.c index 20074560fc25..28d71070c389 100644 --- a/drivers/gpu/drm/radeon/radeon_prime.c +++ b/drivers/gpu/drm/radeon/radeon_prime.c | |||
@@ -103,3 +103,11 @@ void radeon_gem_prime_unpin(struct drm_gem_object *obj) | |||
103 | radeon_bo_unpin(bo); | 103 | radeon_bo_unpin(bo); |
104 | radeon_bo_unreserve(bo); | 104 | radeon_bo_unreserve(bo); |
105 | } | 105 | } |
106 | |||
107 | |||
108 | struct reservation_object *radeon_gem_prime_res_obj(struct drm_gem_object *obj) | ||
109 | { | ||
110 | struct radeon_bo *bo = gem_to_radeon_bo(obj); | ||
111 | |||
112 | return bo->tbo.resv; | ||
113 | } | ||
diff --git a/drivers/gpu/drm/tegra/gem.c b/drivers/gpu/drm/tegra/gem.c index aa85b7b26f10..78cc8143760a 100644 --- a/drivers/gpu/drm/tegra/gem.c +++ b/drivers/gpu/drm/tegra/gem.c | |||
@@ -420,7 +420,7 @@ struct dma_buf *tegra_gem_prime_export(struct drm_device *drm, | |||
420 | int flags) | 420 | int flags) |
421 | { | 421 | { |
422 | return dma_buf_export(gem, &tegra_gem_prime_dmabuf_ops, gem->size, | 422 | return dma_buf_export(gem, &tegra_gem_prime_dmabuf_ops, gem->size, |
423 | flags); | 423 | flags, NULL); |
424 | } | 424 | } |
425 | 425 | ||
426 | struct drm_gem_object *tegra_gem_prime_import(struct drm_device *drm, | 426 | struct drm_gem_object *tegra_gem_prime_import(struct drm_device *drm, |
diff --git a/drivers/gpu/drm/ttm/ttm_object.c b/drivers/gpu/drm/ttm/ttm_object.c index d2a053352789..12c87110db3a 100644 --- a/drivers/gpu/drm/ttm/ttm_object.c +++ b/drivers/gpu/drm/ttm/ttm_object.c | |||
@@ -695,7 +695,7 @@ int ttm_prime_handle_to_fd(struct ttm_object_file *tfile, | |||
695 | } | 695 | } |
696 | 696 | ||
697 | dma_buf = dma_buf_export(prime, &tdev->ops, | 697 | dma_buf = dma_buf_export(prime, &tdev->ops, |
698 | prime->size, flags); | 698 | prime->size, flags, NULL); |
699 | if (IS_ERR(dma_buf)) { | 699 | if (IS_ERR(dma_buf)) { |
700 | ret = PTR_ERR(dma_buf); | 700 | ret = PTR_ERR(dma_buf); |
701 | ttm_mem_global_free(tdev->mem_glob, | 701 | ttm_mem_global_free(tdev->mem_glob, |
diff --git a/drivers/media/v4l2-core/videobuf2-dma-contig.c b/drivers/media/v4l2-core/videobuf2-dma-contig.c index 880be0782dd9..c4e4dfa8123a 100644 --- a/drivers/media/v4l2-core/videobuf2-dma-contig.c +++ b/drivers/media/v4l2-core/videobuf2-dma-contig.c | |||
@@ -404,7 +404,7 @@ static struct dma_buf *vb2_dc_get_dmabuf(void *buf_priv, unsigned long flags) | |||
404 | if (WARN_ON(!buf->sgt_base)) | 404 | if (WARN_ON(!buf->sgt_base)) |
405 | return NULL; | 405 | return NULL; |
406 | 406 | ||
407 | dbuf = dma_buf_export(buf, &vb2_dc_dmabuf_ops, buf->size, flags); | 407 | dbuf = dma_buf_export(buf, &vb2_dc_dmabuf_ops, buf->size, flags, NULL); |
408 | if (IS_ERR(dbuf)) | 408 | if (IS_ERR(dbuf)) |
409 | return NULL; | 409 | return NULL; |
410 | 410 | ||
diff --git a/drivers/staging/android/ion/ion.c b/drivers/staging/android/ion/ion.c index 389b8f67a2ec..270360912b2c 100644 --- a/drivers/staging/android/ion/ion.c +++ b/drivers/staging/android/ion/ion.c | |||
@@ -1120,7 +1120,8 @@ struct dma_buf *ion_share_dma_buf(struct ion_client *client, | |||
1120 | ion_buffer_get(buffer); | 1120 | ion_buffer_get(buffer); |
1121 | mutex_unlock(&client->lock); | 1121 | mutex_unlock(&client->lock); |
1122 | 1122 | ||
1123 | dmabuf = dma_buf_export(buffer, &dma_buf_ops, buffer->size, O_RDWR); | 1123 | dmabuf = dma_buf_export(buffer, &dma_buf_ops, buffer->size, O_RDWR, |
1124 | NULL); | ||
1124 | if (IS_ERR(dmabuf)) { | 1125 | if (IS_ERR(dmabuf)) { |
1125 | ion_buffer_put(buffer); | 1126 | ion_buffer_put(buffer); |
1126 | return dmabuf; | 1127 | return dmabuf; |
diff --git a/include/drm/drmP.h b/include/drm/drmP.h index 8af71a8e2c00..e41f17ea1f13 100644 --- a/include/drm/drmP.h +++ b/include/drm/drmP.h | |||
@@ -83,6 +83,7 @@ struct drm_device; | |||
83 | 83 | ||
84 | struct device_node; | 84 | struct device_node; |
85 | struct videomode; | 85 | struct videomode; |
86 | struct reservation_object; | ||
86 | 87 | ||
87 | #include <drm/drm_os_linux.h> | 88 | #include <drm/drm_os_linux.h> |
88 | #include <drm/drm_hashtab.h> | 89 | #include <drm/drm_hashtab.h> |
@@ -923,6 +924,8 @@ struct drm_driver { | |||
923 | /* low-level interface used by drm_gem_prime_{import,export} */ | 924 | /* low-level interface used by drm_gem_prime_{import,export} */ |
924 | int (*gem_prime_pin)(struct drm_gem_object *obj); | 925 | int (*gem_prime_pin)(struct drm_gem_object *obj); |
925 | void (*gem_prime_unpin)(struct drm_gem_object *obj); | 926 | void (*gem_prime_unpin)(struct drm_gem_object *obj); |
927 | struct reservation_object * (*gem_prime_res_obj)( | ||
928 | struct drm_gem_object *obj); | ||
926 | struct sg_table *(*gem_prime_get_sg_table)(struct drm_gem_object *obj); | 929 | struct sg_table *(*gem_prime_get_sg_table)(struct drm_gem_object *obj); |
927 | struct drm_gem_object *(*gem_prime_import_sg_table)( | 930 | struct drm_gem_object *(*gem_prime_import_sg_table)( |
928 | struct drm_device *dev, size_t size, | 931 | struct drm_device *dev, size_t size, |
diff --git a/include/linux/dma-buf.h b/include/linux/dma-buf.h index f886985a28b2..fd7def2e0ae2 100644 --- a/include/linux/dma-buf.h +++ b/include/linux/dma-buf.h | |||
@@ -115,6 +115,7 @@ struct dma_buf_ops { | |||
115 | * @exp_name: name of the exporter; useful for debugging. | 115 | * @exp_name: name of the exporter; useful for debugging. |
116 | * @list_node: node for dma_buf accounting and debugging. | 116 | * @list_node: node for dma_buf accounting and debugging. |
117 | * @priv: exporter specific private data for this buffer object. | 117 | * @priv: exporter specific private data for this buffer object. |
118 | * @resv: reservation object linked to this dma-buf | ||
118 | */ | 119 | */ |
119 | struct dma_buf { | 120 | struct dma_buf { |
120 | size_t size; | 121 | size_t size; |
@@ -128,6 +129,7 @@ struct dma_buf { | |||
128 | const char *exp_name; | 129 | const char *exp_name; |
129 | struct list_head list_node; | 130 | struct list_head list_node; |
130 | void *priv; | 131 | void *priv; |
132 | struct reservation_object *resv; | ||
131 | }; | 133 | }; |
132 | 134 | ||
133 | /** | 135 | /** |
@@ -168,10 +170,11 @@ void dma_buf_detach(struct dma_buf *dmabuf, | |||
168 | struct dma_buf_attachment *dmabuf_attach); | 170 | struct dma_buf_attachment *dmabuf_attach); |
169 | 171 | ||
170 | struct dma_buf *dma_buf_export_named(void *priv, const struct dma_buf_ops *ops, | 172 | struct dma_buf *dma_buf_export_named(void *priv, const struct dma_buf_ops *ops, |
171 | size_t size, int flags, const char *); | 173 | size_t size, int flags, const char *, |
174 | struct reservation_object *); | ||
172 | 175 | ||
173 | #define dma_buf_export(priv, ops, size, flags) \ | 176 | #define dma_buf_export(priv, ops, size, flags, resv) \ |
174 | dma_buf_export_named(priv, ops, size, flags, KBUILD_MODNAME) | 177 | dma_buf_export_named(priv, ops, size, flags, KBUILD_MODNAME, resv) |
175 | 178 | ||
176 | int dma_buf_fd(struct dma_buf *dmabuf, int flags); | 179 | int dma_buf_fd(struct dma_buf *dmabuf, int flags); |
177 | struct dma_buf *dma_buf_get(int fd); | 180 | struct dma_buf *dma_buf_get(int fd); |