aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/gpu/drm
diff options
context:
space:
mode:
authorRob Clark <robdclark@gmail.com>2015-05-21 11:58:30 -0400
committerDave Airlie <airlied@redhat.com>2015-05-26 02:17:06 -0400
commit990ed2720717173bbdea4cfb2bad37cc7aa91495 (patch)
tree0add81b1d7abf482ada496a34bc21651b9c047ea /drivers/gpu/drm
parentba155e2d21f6bf05de86a78dbe5bfd8757604a65 (diff)
drm/vgem: drop DRIVER_PRIME (v2)
For actual sharing of buffers with other drivers (ie. actual hardware) we'll need to pimp things out a bit better to deal w/ caching, multiple memory domains, etc. See thread: http://lists.freedesktop.org/archives/dri-devel/2015-May/083160.html But for the llvmpipe use-case this isn't a problem. Nor do we really need prime/dri3 (dri2 is sufficient). So until the other issues are sorted lets remove DRIVER_PRIME. v2: also drop the dead code [airlied: Okay I'm convinced this API could have a lot of use cases that are really really bad, yes the upload use case is valid however that isn't the only use case enabled, and if we allow all the other use cases, people will start to (ab)use them, and then they'll be ABI and my life will get worse, so disable PRIME for now] Acked-by: Thomas Hellstrom <thellstrom@vmware.com> Acked-by: Daniel Vetter <daniel.vetter@ffwll.ch> Signed-off-by: Rob Clark <robdclark@gmail.com> Signed-off-by: Dave Airlie <airlied@redhat.com>
Diffstat (limited to 'drivers/gpu/drm')
-rw-r--r--drivers/gpu/drm/vgem/Makefile2
-rw-r--r--drivers/gpu/drm/vgem/vgem_dma_buf.c94
-rw-r--r--drivers/gpu/drm/vgem/vgem_drv.c11
-rw-r--r--drivers/gpu/drm/vgem/vgem_drv.h11
4 files changed, 2 insertions, 116 deletions
diff --git a/drivers/gpu/drm/vgem/Makefile b/drivers/gpu/drm/vgem/Makefile
index 1055cb79096c..3f4c7b842028 100644
--- a/drivers/gpu/drm/vgem/Makefile
+++ b/drivers/gpu/drm/vgem/Makefile
@@ -1,4 +1,4 @@
1ccflags-y := -Iinclude/drm 1ccflags-y := -Iinclude/drm
2vgem-y := vgem_drv.o vgem_dma_buf.o 2vgem-y := vgem_drv.o
3 3
4obj-$(CONFIG_DRM_VGEM) += vgem.o 4obj-$(CONFIG_DRM_VGEM) += vgem.o
diff --git a/drivers/gpu/drm/vgem/vgem_dma_buf.c b/drivers/gpu/drm/vgem/vgem_dma_buf.c
deleted file mode 100644
index 0254438ad1a6..000000000000
--- a/drivers/gpu/drm/vgem/vgem_dma_buf.c
+++ /dev/null
@@ -1,94 +0,0 @@
1/*
2 * Copyright © 2012 Intel Corporation
3 * Copyright © 2014 The Chromium OS Authors
4 *
5 * Permission is hereby granted, free of charge, to any person obtaining a
6 * copy of this software and associated documentation files (the "Software"),
7 * to deal in the Software without restriction, including without limitation
8 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
9 * and/or sell copies of the Software, and to permit persons to whom the
10 * Software is furnished to do so, subject to the following conditions:
11 *
12 * The above copyright notice and this permission notice (including the next
13 * paragraph) shall be included in all copies or substantial portions of the
14 * Software.
15 *
16 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
19 * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
21 * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
22 * IN THE SOFTWARE.
23 *
24 * Authors:
25 * Ben Widawsky <ben@bwidawsk.net>
26 *
27 */
28
29#include <linux/dma-buf.h>
30#include "vgem_drv.h"
31
32struct sg_table *vgem_gem_prime_get_sg_table(struct drm_gem_object *gobj)
33{
34 struct drm_vgem_gem_object *obj = to_vgem_bo(gobj);
35 BUG_ON(obj->pages == NULL);
36
37 return drm_prime_pages_to_sg(obj->pages, obj->base.size / PAGE_SIZE);
38}
39
40int vgem_gem_prime_pin(struct drm_gem_object *gobj)
41{
42 struct drm_vgem_gem_object *obj = to_vgem_bo(gobj);
43 return vgem_gem_get_pages(obj);
44}
45
46void vgem_gem_prime_unpin(struct drm_gem_object *gobj)
47{
48 struct drm_vgem_gem_object *obj = to_vgem_bo(gobj);
49 vgem_gem_put_pages(obj);
50}
51
52void *vgem_gem_prime_vmap(struct drm_gem_object *gobj)
53{
54 struct drm_vgem_gem_object *obj = to_vgem_bo(gobj);
55 BUG_ON(obj->pages == NULL);
56
57 return vmap(obj->pages, obj->base.size / PAGE_SIZE, 0, PAGE_KERNEL);
58}
59
60void vgem_gem_prime_vunmap(struct drm_gem_object *obj, void *vaddr)
61{
62 vunmap(vaddr);
63}
64
65struct drm_gem_object *vgem_gem_prime_import(struct drm_device *dev,
66 struct dma_buf *dma_buf)
67{
68 struct drm_vgem_gem_object *obj = NULL;
69 int ret;
70
71 obj = kzalloc(sizeof(*obj), GFP_KERNEL);
72 if (obj == NULL) {
73 ret = -ENOMEM;
74 goto fail;
75 }
76
77 ret = drm_gem_object_init(dev, &obj->base, dma_buf->size);
78 if (ret) {
79 ret = -ENOMEM;
80 goto fail_free;
81 }
82
83 get_dma_buf(dma_buf);
84
85 obj->base.dma_buf = dma_buf;
86 obj->use_dma_buf = true;
87
88 return &obj->base;
89
90fail_free:
91 kfree(obj);
92fail:
93 return ERR_PTR(ret);
94}
diff --git a/drivers/gpu/drm/vgem/vgem_drv.c b/drivers/gpu/drm/vgem/vgem_drv.c
index cb3b43525b2d..7a207ca547be 100644
--- a/drivers/gpu/drm/vgem/vgem_drv.c
+++ b/drivers/gpu/drm/vgem/vgem_drv.c
@@ -302,22 +302,13 @@ static const struct file_operations vgem_driver_fops = {
302}; 302};
303 303
304static struct drm_driver vgem_driver = { 304static struct drm_driver vgem_driver = {
305 .driver_features = DRIVER_GEM | DRIVER_PRIME, 305 .driver_features = DRIVER_GEM,
306 .gem_free_object = vgem_gem_free_object, 306 .gem_free_object = vgem_gem_free_object,
307 .gem_vm_ops = &vgem_gem_vm_ops, 307 .gem_vm_ops = &vgem_gem_vm_ops,
308 .ioctls = vgem_ioctls, 308 .ioctls = vgem_ioctls,
309 .fops = &vgem_driver_fops, 309 .fops = &vgem_driver_fops,
310 .dumb_create = vgem_gem_dumb_create, 310 .dumb_create = vgem_gem_dumb_create,
311 .dumb_map_offset = vgem_gem_dumb_map, 311 .dumb_map_offset = vgem_gem_dumb_map,
312 .prime_handle_to_fd = drm_gem_prime_handle_to_fd,
313 .prime_fd_to_handle = drm_gem_prime_fd_to_handle,
314 .gem_prime_export = drm_gem_prime_export,
315 .gem_prime_import = vgem_gem_prime_import,
316 .gem_prime_pin = vgem_gem_prime_pin,
317 .gem_prime_unpin = vgem_gem_prime_unpin,
318 .gem_prime_get_sg_table = vgem_gem_prime_get_sg_table,
319 .gem_prime_vmap = vgem_gem_prime_vmap,
320 .gem_prime_vunmap = vgem_gem_prime_vunmap,
321 .name = DRIVER_NAME, 312 .name = DRIVER_NAME,
322 .desc = DRIVER_DESC, 313 .desc = DRIVER_DESC,
323 .date = DRIVER_DATE, 314 .date = DRIVER_DATE,
diff --git a/drivers/gpu/drm/vgem/vgem_drv.h b/drivers/gpu/drm/vgem/vgem_drv.h
index 57ab4d8f41f9..e9f92f7ee275 100644
--- a/drivers/gpu/drm/vgem/vgem_drv.h
+++ b/drivers/gpu/drm/vgem/vgem_drv.h
@@ -43,15 +43,4 @@ struct drm_vgem_gem_object {
43extern void vgem_gem_put_pages(struct drm_vgem_gem_object *obj); 43extern void vgem_gem_put_pages(struct drm_vgem_gem_object *obj);
44extern int vgem_gem_get_pages(struct drm_vgem_gem_object *obj); 44extern int vgem_gem_get_pages(struct drm_vgem_gem_object *obj);
45 45
46/* vgem_dma_buf.c */
47extern struct sg_table *vgem_gem_prime_get_sg_table(
48 struct drm_gem_object *gobj);
49extern int vgem_gem_prime_pin(struct drm_gem_object *gobj);
50extern void vgem_gem_prime_unpin(struct drm_gem_object *gobj);
51extern void *vgem_gem_prime_vmap(struct drm_gem_object *gobj);
52extern void vgem_gem_prime_vunmap(struct drm_gem_object *obj, void *vaddr);
53extern struct drm_gem_object *vgem_gem_prime_import(struct drm_device *dev,
54 struct dma_buf *dma_buf);
55
56
57#endif 46#endif