aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/gpu/drm/drm_fops.c
diff options
context:
space:
mode:
authorDave Airlie <airlied@redhat.com>2011-11-25 10:21:02 -0500
committerDave Airlie <airlied@redhat.com>2012-03-30 06:52:44 -0400
commit3248877ea1796915419fba7c89315fdbf00cb56a (patch)
tree4fab8743212004bc033e71e02a2e051b64001606 /drivers/gpu/drm/drm_fops.c
parentf52b69f86e27903d6896ed5fa7cd280fec8de532 (diff)
drm: base prime/dma-buf support (v5)
This adds the basic drm dma-buf interface layer, called PRIME. This commit doesn't add any driver support, it is simply and agreed upon starting point so we can work towards merging driver support for the next merge window. Current drivers with work done are nouveau, i915, udl, exynos and omap. The main APIs exposed to userspace allow translating a 32-bit object handle to a file descriptor, and a file descriptor to a 32-bit object handle. The flags value is currently limited to O_CLOEXEC. Acknowledgements: Daniel Vetter: lots of review Rob Clark: cleaned up lots of the internals and did lifetime review. v2: rename some functions after Chris preferred a green shed fix IS_ERR_OR_NULL -> IS_ERR v3: Fix Ville pointed out using buffer + kmalloc v4: add locking as per ickle review v5: allow re-exporting the original dma-buf (Daniel) Reviewed-by: Daniel Vetter <daniel.vetter@ffwll.ch> Reviewed-by: Rob Clark <rob.clark@linaro.org> Reviewed-by: Sumit Semwal <sumit.semwal@linaro.org> Reviewed-by: Inki Dae <inki.dae@samsung.com> Acked-by: Ben Widawsky <benjamin.widawsky@intel.com> Signed-off-by: Dave Airlie <airlied@redhat.com>
Diffstat (limited to 'drivers/gpu/drm/drm_fops.c')
-rw-r--r--drivers/gpu/drm/drm_fops.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/drivers/gpu/drm/drm_fops.c b/drivers/gpu/drm/drm_fops.c
index 7348a3dab250..cdfbf27b2b3c 100644
--- a/drivers/gpu/drm/drm_fops.c
+++ b/drivers/gpu/drm/drm_fops.c
@@ -271,6 +271,9 @@ static int drm_open_helper(struct inode *inode, struct file *filp,
271 if (dev->driver->driver_features & DRIVER_GEM) 271 if (dev->driver->driver_features & DRIVER_GEM)
272 drm_gem_open(dev, priv); 272 drm_gem_open(dev, priv);
273 273
274 if (drm_core_check_feature(dev, DRIVER_PRIME))
275 drm_prime_init_file_private(&priv->prime);
276
274 if (dev->driver->open) { 277 if (dev->driver->open) {
275 ret = dev->driver->open(dev, priv); 278 ret = dev->driver->open(dev, priv);
276 if (ret < 0) 279 if (ret < 0)
@@ -571,6 +574,10 @@ int drm_release(struct inode *inode, struct file *filp)
571 574
572 if (dev->driver->postclose) 575 if (dev->driver->postclose)
573 dev->driver->postclose(dev, file_priv); 576 dev->driver->postclose(dev, file_priv);
577
578 if (drm_core_check_feature(dev, DRIVER_PRIME))
579 drm_prime_destroy_file_private(&file_priv->prime);
580
574 kfree(file_priv); 581 kfree(file_priv);
575 582
576 /* ======================================================== 583 /* ========================================================