diff options
author | Joonyoung Shim <jy0922.shim@samsung.com> | 2015-10-06 19:09:16 +0900 |
---|---|---|
committer | Joonyoung Shim <jy0922.shim@samsung.com> | 2015-10-06 19:23:15 +0900 |
commit | 6e97f25af63a9511ddd3b195a0b844671b8d1a5d (patch) | |
tree | acf85ce4831c819b1737acfc58cf603358f46305 | |
parent | 90a031be9db6f2bb9836d2ef81e71fdea459c6b6 (diff) | |
download | libdrm-6e97f25af63a9511ddd3b195a0b844671b8d1a5d.tar.gz libdrm-6e97f25af63a9511ddd3b195a0b844671b8d1a5d.tar.bz2 libdrm-6e97f25af63a9511ddd3b195a0b844671b8d1a5d.zip |
exynos: support DRM_IOCTL_EXYNOS_GEM_MAPsubmit/tizen/20151103.025922accepted/tizen/wearable/20151103.224656accepted/tizen/tv/20151103.224645accepted/tizen/mobile/20151103.224637
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.c | 4 | ||||
-rw-r--r-- | exynos/exynos_drm.h | 17 | ||||
-rw-r--r-- | libkms/exynos.c | 4 | ||||
-rw-r--r-- | tests/ipptest/gem.c | 4 | ||||
-rw-r--r-- | tests/rottest/gem.c | 4 |
5 files changed, 24 insertions, 9 deletions
diff --git a/exynos/exynos_drm.c b/exynos/exynos_drm.c index c5dd9489..ee504b90 100644 --- a/exynos/exynos_drm.c +++ b/exynos/exynos_drm.c @@ -283,14 +283,14 @@ drm_public 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 77c87d5d..f403a672 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 0x03 ~ 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 11234825..408fa6d6 100644 --- a/libkms/exynos.c +++ b/libkms/exynos.c @@ -125,7 +125,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; @@ -138,7 +138,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)); |