summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJoonyoung Shim <jy0922.shim@samsung.com>2015-10-06 19:09:16 +0900
committerJoonyoung Shim <jy0922.shim@samsung.com>2017-02-15 13:37:34 +0900
commit6a43c70b2101c714646ca28f0433dbb94cb641c8 (patch)
tree9fe5f231608d8a56a08ad48a42b12837c237d7d0
parentf34fc8eb0506cd7d2d16ac32f88ac0dd59b51fa3 (diff)
downloadlibdrm-6a43c70b2101c714646ca28f0433dbb94cb641c8.tar.gz
libdrm-6a43c70b2101c714646ca28f0433dbb94cb641c8.tar.bz2
libdrm-6a43c70b2101c714646ca28f0433dbb94cb641c8.zip
exynos: support DRM_IOCTL_EXYNOS_GEM_MAP
The commit d41b7a3a745a("exynos: Don't use DRM_EXYNOS_GEM_{MAP_OFFSET/ MMAP} ioctls") removed it same with the ioctl that this patch adds. The reason that removed DRM_IOCTL_EXYNOS_GEM_MAP_OFFSET was we could use DRM_IOCTL_MODE_MAP_DUMB. Both did exactly same thing. Now exynos-drm driver of linux kernel revives it as DRM_EXYNOS_GEM_MAP because of render node. DRM_IOCTL_MODE_MAP_DUMB isn't permitted in render node, so this patch also supports DRM_IOCTL_EXYNOS_GEM_MAP. Change-Id: Ib548dc8a6bea076375465f64ee2fdd658a90e435 Signed-off-by: Joonyoung Shim <jy0922.shim@samsung.com>
-rw-r--r--exynos/exynos_drm.c4
-rw-r--r--exynos/exynos_drm.h17
-rw-r--r--libkms/exynos.c4
-rw-r--r--tests/ipptest/gem.c4
-rw-r--r--tests/rottest/gem.c4
5 files changed, 24 insertions, 9 deletions
diff --git a/exynos/exynos_drm.c b/exynos/exynos_drm.c
index b961e520..2ca4f0af 100644
--- a/exynos/exynos_drm.c
+++ b/exynos/exynos_drm.c
@@ -286,14 +286,14 @@ void *exynos_bo_map(struct exynos_bo *bo)
{
if (!bo->vaddr) {
struct exynos_device *dev = bo->dev;
- struct drm_mode_map_dumb arg;
+ struct drm_exynos_gem_map arg;
void *map = NULL;
int ret;
memset(&arg, 0, sizeof(arg));
arg.handle = bo->handle;
- ret = drmIoctl(dev->fd, DRM_IOCTL_MODE_MAP_DUMB, &arg);
+ ret = drmIoctl(dev->fd, DRM_IOCTL_EXYNOS_GEM_MAP, &arg);
if (ret) {
fprintf(stderr, "failed to map dumb buffer[%s].\n",
strerror(errno));
diff --git a/exynos/exynos_drm.h b/exynos/exynos_drm.h
index 3e43663e..3b892f9c 100644
--- a/exynos/exynos_drm.h
+++ b/exynos/exynos_drm.h
@@ -47,6 +47,19 @@ struct drm_exynos_gem_create {
};
/**
+ * A structure for getting a fake-offset that can be used with mmap.
+ *
+ * @handle: handle of gem object.
+ * @reserved: just padding to be 64-bit aligned.
+ * @offset: a fake-offset of gem object.
+ */
+struct drm_exynos_gem_map {
+ __u32 handle;
+ __u32 reserved;
+ __u64 offset;
+};
+
+/**
* A structure to gem information.
*
* @handle: a handle to gem object created.
@@ -377,6 +390,7 @@ struct drm_exynos_ipp_cmd_ctrl {
};
#define DRM_EXYNOS_GEM_CREATE 0x00
+#define DRM_EXYNOS_GEM_MAP 0x01
/* Reserved 0x04 ~ 0x05 for exynos specific gem ioctl */
#define DRM_EXYNOS_GEM_GET 0x04
#define DRM_EXYNOS_VIDI_CONNECTION 0x07
@@ -394,7 +408,8 @@ struct drm_exynos_ipp_cmd_ctrl {
#define DRM_IOCTL_EXYNOS_GEM_CREATE DRM_IOWR(DRM_COMMAND_BASE + \
DRM_EXYNOS_GEM_CREATE, struct drm_exynos_gem_create)
-
+#define DRM_IOCTL_EXYNOS_GEM_MAP DRM_IOWR(DRM_COMMAND_BASE + \
+ DRM_EXYNOS_GEM_MAP, struct drm_exynos_gem_map)
#define DRM_IOCTL_EXYNOS_GEM_GET DRM_IOWR(DRM_COMMAND_BASE + \
DRM_EXYNOS_GEM_GET, struct drm_exynos_gem_info)
diff --git a/libkms/exynos.c b/libkms/exynos.c
index 0e97fb51..3d0d6c1f 100644
--- a/libkms/exynos.c
+++ b/libkms/exynos.c
@@ -126,7 +126,7 @@ static int
exynos_bo_map(struct kms_bo *_bo, void **out)
{
struct exynos_bo *bo = (struct exynos_bo *)_bo;
- struct drm_mode_map_dumb arg;
+ struct drm_exynos_gem_map arg;
void *map = NULL;
int ret;
@@ -139,7 +139,7 @@ exynos_bo_map(struct kms_bo *_bo, void **out)
memset(&arg, 0, sizeof(arg));
arg.handle = bo->base.handle;
- ret = drmIoctl(bo->base.kms->fd, DRM_IOCTL_MODE_MAP_DUMB, &arg);
+ ret = drmIoctl(bo->base.kms->fd, DRM_IOCTL_EXYNOS_GEM_MAP, &arg);
if (ret)
return ret;
diff --git a/tests/ipptest/gem.c b/tests/ipptest/gem.c
index 5710d6f2..8aec83b6 100644
--- a/tests/ipptest/gem.c
+++ b/tests/ipptest/gem.c
@@ -58,12 +58,12 @@ int exynos_gem_mmap(int fd, struct exynos_gem_mmap_data *in_mmap)
{
int ret;
void *map;
- struct drm_mode_map_dumb arg;
+ struct drm_exynos_gem_map arg;
memset(&arg, 0, sizeof(arg));
arg.handle = in_mmap->handle;
- ret = ioctl(fd, DRM_IOCTL_MODE_MAP_DUMB, &arg);
+ ret = ioctl(fd, DRM_IOCTL_EXYNOS_GEM_MAP, &arg);
if (ret) {
fprintf(stderr, "failed to map dumb buffer: %s\n",
strerror(errno));
diff --git a/tests/rottest/gem.c b/tests/rottest/gem.c
index 071d8a69..ad38fb89 100644
--- a/tests/rottest/gem.c
+++ b/tests/rottest/gem.c
@@ -58,12 +58,12 @@ int exynos_gem_mmap(int fd, struct exynos_gem_mmap_data *in_mmap)
{
int ret;
void *map;
- struct drm_mode_map_dumb arg;
+ struct drm_exynos_gem_map arg;
memset(&arg, 0, sizeof(arg));
arg.handle = in_mmap->handle;
- ret = ioctl(fd, DRM_IOCTL_MODE_MAP_DUMB, &arg);
+ ret = ioctl(fd, DRM_IOCTL_EXYNOS_GEM_MAP, &arg);
if (ret) {
fprintf(stderr, "failed to map dumb buffer: %s\n",
strerror(errno));