diff options
author | Russell King <rmk_cubox@arm.linux.org.uk> | 2013-06-12 15:48:02 +0100 |
---|---|---|
committer | Russell King <rmk@arm.linux.org.uk> | 2013-09-22 15:19:00 +0100 |
commit | 0f0a44812dc57b9bb37346e344bcf50235fa4d94 (patch) | |
tree | 1f4cb13aef893bafd8d9677d5f38eb9216d03993 /armada_bufmgr.c | |
parent | 7923dea762934a715063465338a4d8e9275034e3 (diff) |
Initial prime support
Add initial prime support for exporting gem objects via dmabuf.
Signed-off-by: Russell King <rmk_cubox@arm.linux.org.uk>
Diffstat (limited to 'armada_bufmgr.c')
-rw-r--r-- | armada_bufmgr.c | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/armada_bufmgr.c b/armada_bufmgr.c index 2364051..6b9e667 100644 --- a/armada_bufmgr.c +++ b/armada_bufmgr.c @@ -3,6 +3,7 @@ #include <stdlib.h> #include <string.h> #include <errno.h> +#include <sys/fcntl.h> #include <sys/mman.h> #include <time.h> @@ -452,6 +453,17 @@ int drm_armada_bo_flink(struct drm_armada_bo *dbo, uint32_t *name) return 0; } +int drm_armada_bo_to_fd(struct drm_armada_bo *dbo, int *prime_fd) +{ + struct armada_bo *bo = to_armada_bo(dbo); + int fd = bo->mgr->fd; + + if (drmPrimeHandleToFD(fd, bo->bo.handle, DRM_CLOEXEC, prime_fd)) + return -1; + + return 0; +} + int drm_armada_bo_map(struct drm_armada_bo *dbo) { struct armada_bo *bo = to_armada_bo(dbo); |