summaryrefslogtreecommitdiff
path: root/v4l2-mfc-example
diff options
context:
space:
mode:
authorMateusz Krawczuk <m.krawczuk@samsung.com>2015-04-07 16:02:56 +0200
committerKamil Debski <k.debski@samsung.com>2015-04-30 15:37:03 +0200
commit8361c5567d6e51f6771fe9b7cd75e6b41afb2b2d (patch)
treed35f33ef1435ffe03efe85e1f30f4bdc437b89f8 /v4l2-mfc-example
parentf0bb7d285f4349e0a1a048a6aa3db82ec80cccb4 (diff)
exynos: remove DRM_EXYNOS_GEM_{MAP_OFFSET/MMAP} ioctls
Signed-off-by: Mateusz Krawczuk <m.krawczuk@samsung.com> Signed-off-by: Kamil Debski <k.debski@samsung.com>
Diffstat (limited to 'v4l2-mfc-example')
-rw-r--r--v4l2-mfc-example/common.h2
-rw-r--r--v4l2-mfc-example/drm.c18
2 files changed, 12 insertions, 8 deletions
diff --git a/v4l2-mfc-example/common.h b/v4l2-mfc-example/common.h
index 1fc3243..3b3e5a3 100644
--- a/v4l2-mfc-example/common.h
+++ b/v4l2-mfc-example/common.h
@@ -121,7 +121,7 @@ struct instance {
unsigned int crtc_id;
#ifdef DRM
struct drm_exynos_gem_create gem[MAX_BUFS];
- struct drm_exynos_gem_mmap mmap[MAX_BUFS];
+ struct drm_mode_map_dumb mmap[MAX_BUFS];
drmModeRes *resources;
#endif
char enabled;
diff --git a/v4l2-mfc-example/drm.c b/v4l2-mfc-example/drm.c
index d53a0b4..b60b439 100644
--- a/v4l2-mfc-example/drm.c
+++ b/v4l2-mfc-example/drm.c
@@ -47,6 +47,9 @@ int drm_open(struct instance *i, char *name)
unsigned int fb_id;
int ret;
int n;
+ struct drm_mode_map_dumb arg;
+ void *map = NULL;
+
i->drm.fd =drmOpen(name, NULL);
if (i->drm.fd < 0) {
@@ -87,22 +90,23 @@ int drm_open(struct instance *i, char *name)
return -1;
}
} else {
- i->drm.mmap[n].handle = i->drm.gem[n].handle;
- i->drm.mmap[n].size = i->drm.gem[n].size;
- ret = ioctl(i->drm.fd, DRM_IOCTL_EXYNOS_GEM_MMAP, &i->drm.mmap[n]);
+ memset(&arg, 0, sizeof(&arg));
+ arg.handle = i->drm.gem[n].handle;
+ ret = ioctl(i->drm.fd, DRM_IOCTL_MODE_MAP_DUMB, &arg);
if (ret < 0) {
ioctl(i->drm.fd, DRM_IOCTL_GEM_CLOSE, &args);
err("Failed to mmap gem");
return -1;
}
- i->drm.p[n] = (char *)(unsigned int)i->drm.mmap[n].mapped;
- i->fimc.p[n] = (char *)(unsigned int)i->drm.mmap[n].mapped;
+ i->drm.mmap[n].offset = arg.offset;
+ i->drm.p[n] = (char *)(unsigned int)map;
+ i->fimc.p[n] = (char *)(unsigned int)map;
+ map = mmap(0, i->drm.gem[n].size, PROT_READ | PROT_WRITE, MAP_SHARED,i->drm.fd, i->drm.mmap[n].offset);
}
ret = drmModeAddFB(i->drm.fd, i->drm.width, i->drm.height, 32,
32, 4 * i->drm.width, i->drm.gem[n].handle, &fb_id);
if (ret) {
- munmap((void *)(unsigned long)i->drm.mmap[n].mapped,
- i->drm.gem[n].size);
+ munmap((void *)(unsigned long)map,i->drm.gem[n].size);
ioctl(i->drm.fd, DRM_IOCTL_GEM_CLOSE, &args);
err("Failed to add fb");
return -1;