aboutsummaryrefslogtreecommitdiffstats
path: root/libkms
diff options
context:
space:
mode:
authorHyungwon Hwang2015-01-16 16:57:33 -0600
committerRob Clark2015-02-02 13:45:39 -0600
commitd41b7a3a745a32dff6edeb31962da4e24f870a1d (patch)
tree39617cb3d8e3a48543880f974e72deb524c5a0d2 /libkms
parent28ee135a37e10b9a6cd62d67df0332e38ee0b85c (diff)
downloadexternal-libdrm-d41b7a3a745a32dff6edeb31962da4e24f870a1d.tar.gz
external-libdrm-d41b7a3a745a32dff6edeb31962da4e24f870a1d.tar.xz
external-libdrm-d41b7a3a745a32dff6edeb31962da4e24f870a1d.zip
exynos: Don't use DRM_EXYNOS_GEM_{MAP_OFFSET/MMAP} ioctls
The ioctl DRM_EXYNOS_GEM_MAP_OFFSET and DRM_EXYNOS_GEM_MMAP are removed from the linux kernel. This patch modifies libdrm and libkms to use drm generic ioctls instead of the removed ioctls. v2: The original patch was erroneous. In case the MODE_MAP_DUMB ioctl failed it would return the retvalue as a void-pointer. Users of libdrm would then happily use that ptr, eventually leading to a segfault. Change this to return NULL in that case and also restore the previous behaviour of logging to stderr. The other error was that 'bo->vaddr' was never filled with the mapped buffer address. Hence exynos_bo_map still returned NULL even if the buffer mapping succeeded. Signed-off-by: Hyungwon Hwang <human.hwang@samsung.com> Signed-off-by: Inki Dae <inki.dae@samsung.com> Signed-off-by: Tobias Jakobi <tjakobi@math.uni-bielefeld.de> Signed-off-by: Rob Clark <robclark@freedesktop.org>
Diffstat (limited to 'libkms')
-rw-r--r--libkms/exynos.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/libkms/exynos.c b/libkms/exynos.c
index 92e329cd..11234825 100644
--- a/libkms/exynos.c
+++ b/libkms/exynos.c
@@ -25,6 +25,7 @@
25#include <sys/ioctl.h> 25#include <sys/ioctl.h>
26#include "xf86drm.h" 26#include "xf86drm.h"
27 27
28#include "libdrm.h"
28#include "exynos_drm.h" 29#include "exynos_drm.h"
29 30
30struct exynos_bo 31struct exynos_bo
@@ -124,7 +125,7 @@ static int
124exynos_bo_map(struct kms_bo *_bo, void **out) 125exynos_bo_map(struct kms_bo *_bo, void **out)
125{ 126{
126 struct exynos_bo *bo = (struct exynos_bo *)_bo; 127 struct exynos_bo *bo = (struct exynos_bo *)_bo;
127 struct drm_exynos_gem_map_off arg; 128 struct drm_mode_map_dumb arg;
128 void *map = NULL; 129 void *map = NULL;
129 int ret; 130 int ret;
130 131
@@ -137,11 +138,11 @@ exynos_bo_map(struct kms_bo *_bo, void **out)
137 memset(&arg, 0, sizeof(arg)); 138 memset(&arg, 0, sizeof(arg));
138 arg.handle = bo->base.handle; 139 arg.handle = bo->base.handle;
139 140
140 ret = drmCommandWriteRead(bo->base.kms->fd, DRM_EXYNOS_GEM_MAP_OFFSET, &arg, sizeof(arg)); 141 ret = drmIoctl(bo->base.kms->fd, DRM_IOCTL_MODE_MAP_DUMB, &arg);
141 if (ret) 142 if (ret)
142 return ret; 143 return ret;
143 144
144 map = mmap(0, bo->base.size, PROT_READ | PROT_WRITE, MAP_SHARED, bo->base.kms->fd, arg.offset); 145 map = drm_mmap(0, bo->base.size, PROT_READ | PROT_WRITE, MAP_SHARED, bo->base.kms->fd, arg.offset);
145 if (map == MAP_FAILED) 146 if (map == MAP_FAILED)
146 return -errno; 147 return -errno;
147 148