summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 9b893e4)
raw | patch | inline | side by side (parent: 9b893e4)
author | Rob Clark <rob@ti.com> | |
Wed, 11 Apr 2012 14:51:36 +0000 (09:51 -0500) | ||
committer | Rob Clark <rob@ti.com> | |
Wed, 11 Apr 2012 14:51:36 +0000 (09:51 -0500) |
Signed-off-by: Rob Clark <rob@ti.com>
omap/omap_drm.c | patch | blob | history | |
omap/omap_drmif.h | patch | blob | history |
diff --git a/omap/omap_drm.c b/omap/omap_drm.c
index 96e18717697e6f1410310b48dd9018e5ba4ae1f1..336da115ae1a9d70210130f8f126df180600fbe6 100644 (file)
--- a/omap/omap_drm.c
+++ b/omap/omap_drm.c
#include <linux/stddef.h>
#include <errno.h>
#include <sys/mman.h>
+#include <fcntl.h>
#include <xf86drm.h>
uint32_t handle;
uint32_t name; /* flink global handle (DRI2 name) */
uint64_t offset; /* offset to mmap() */
+ int fd; /* dmabuf handle */
};
struct omap_device * omap_device_new(int fd)
return bo->handle;
}
+int omap_bo_dmabuf(struct omap_bo *bo)
+{
+ if (!bo->fd) {
+ struct drm_prime_handle req = {
+ .handle = bo->handle,
+ .flags = DRM_CLOEXEC,
+ };
+ int ret;
+
+ ret = drmIoctl(bo->dev->fd, DRM_IOCTL_PRIME_HANDLE_TO_FD, &req);
+ if (ret) {
+ return ret;
+ }
+
+ bo->fd = req.fd;
+ }
+ return bo->fd;
+}
+
uint32_t omap_bo_size(struct omap_bo *bo)
{
if (!bo->size) {
diff --git a/omap/omap_drmif.h b/omap/omap_drmif.h
index eb75a80ac64fc9b83a53c7d8f8c48caecf262d89..1e03eee14127d4a3c51686bdf2b3bd67ffcfdb4d 100644 (file)
--- a/omap/omap_drmif.h
+++ b/omap/omap_drmif.h
void omap_bo_del(struct omap_bo *bo);
int omap_bo_get_name(struct omap_bo *bo, uint32_t *name);
uint32_t omap_bo_handle(struct omap_bo *bo);
+int omap_bo_dmabuf(struct omap_bo *bo);
uint32_t omap_bo_size(struct omap_bo *bo);
void * omap_bo_map(struct omap_bo *bo);
int omap_bo_cpu_prep(struct omap_bo *bo, enum omap_gem_op op);