summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDerek Foreman <derekf@osg.samsung.com>2017-03-21 14:21:14 -0500
committerDerek Foreman <derekf@osg.samsung.com>2017-03-21 14:21:14 -0500
commitfc0e6e256685a785ec17e680164433ddaedd4763 (patch)
tree6a059ef9410fc96bb439c65c2aaebc6d4a2e8692
parent76b5749ea00b1009a5a9621b76604e4883e0e6e2 (diff)
downloadefl-fc0e6e256685a785ec17e680164433ddaedd4763.tar.gz
ecore_drm2: Use library function instead of ioctl for addfb2
Minor clean up.
-rw-r--r--src/lib/ecore_drm2/ecore_drm2.c2
-rw-r--r--src/lib/ecore_drm2/ecore_drm2_fb.c24
-rw-r--r--src/lib/ecore_drm2/ecore_drm2_private.h1
3 files changed, 9 insertions, 18 deletions
diff --git a/src/lib/ecore_drm2/ecore_drm2.c b/src/lib/ecore_drm2/ecore_drm2.c
index 491ed47e54..e8c4d5b578 100644
--- a/src/lib/ecore_drm2/ecore_drm2.c
+++ b/src/lib/ecore_drm2/ecore_drm2.c
@@ -41,6 +41,7 @@ void (*sym_drmModeFreePlaneResources)(drmModePlaneResPtr ptr) = NULL;
void *(*sym_drmModeGetPlane)(int fd, uint32_t plane_id) = NULL;
void (*sym_drmModeFreePlane)(drmModePlanePtr ptr) = NULL;
int (*sym_drmModeAddFB)(int fd, uint32_t width, uint32_t height, uint8_t depth, uint8_t bpp, uint32_t pitch, uint32_t bo_handle, uint32_t *buf_id) = NULL;
+int (*sym_drmModeAddFB2)(int fd, uint32_t width, uint32_t height, uint32_t pixel_format, uint32_t bo_handles[4], uint32_t pitches[4], uint32_t offsets[4], uint32_t *buf_id, uint32_t flags) = NULL;
int (*sym_drmModeRmFB)(int fd, uint32_t bufferId) = NULL;
int (*sym_drmModePageFlip)(int fd, uint32_t crtc_id, uint32_t fb_id, uint32_t flags, void *user_data) = NULL;
int (*sym_drmModeDirtyFB)(int fd, uint32_t bufferId, drmModeClipPtr clips, uint32_t num_clips) = NULL;
@@ -117,6 +118,7 @@ _ecore_drm2_link(void)
SYM(drm_lib, drmModeGetPlane);
SYM(drm_lib, drmModeFreePlane);
SYM(drm_lib, drmModeAddFB);
+ SYM(drm_lib, drmModeAddFB2);
SYM(drm_lib, drmModeRmFB);
SYM(drm_lib, drmModePageFlip);
SYM(drm_lib, drmModeDirtyFB);
diff --git a/src/lib/ecore_drm2/ecore_drm2_fb.c b/src/lib/ecore_drm2/ecore_drm2_fb.c
index fe27508554..ef618875d7 100644
--- a/src/lib/ecore_drm2/ecore_drm2_fb.c
+++ b/src/lib/ecore_drm2/ecore_drm2_fb.c
@@ -3,30 +3,18 @@
static Eina_Bool
_fb2_create(Ecore_Drm2_Fb *fb)
{
- drm_mode_fb_cmd2 cmd;
uint32_t hdls[4] = { 0 }, pitches[4] = { 0 }, offsets[4] = { 0 };
- uint64_t modifiers[4] = { 0 };
+ int r;
hdls[0] = fb->hdl;
pitches[0] = fb->stride;
offsets[0] = 0;
- modifiers[0] = 0;
-
- memset(&cmd, 0, sizeof(drm_mode_fb_cmd2));
- cmd.fb_id = 0;
- cmd.width = fb->w;
- cmd.height = fb->h;
- cmd.pixel_format = fb->format;
- cmd.flags = 0;
- memcpy(cmd.handles, hdls, 4 * sizeof(hdls[0]));
- memcpy(cmd.pitches, pitches, 4 * sizeof(pitches[0]));
- memcpy(cmd.offsets, offsets, 4 * sizeof(offsets[0]));
- memcpy(cmd.modifier, modifiers, 4 * sizeof(modifiers[0]));
-
- if (sym_drmIoctl(fb->fd, DRM_IOCTL_MODE_ADDFB2, &cmd))
- return EINA_FALSE;
- fb->id = cmd.fb_id;
+ r = sym_drmModeAddFB2(fb->fd, fb->w, fb->h, fb->format, hdls,
+ pitches, offsets, &fb->id, 0);
+
+ if (r)
+ return EINA_FALSE;
return EINA_TRUE;
}
diff --git a/src/lib/ecore_drm2/ecore_drm2_private.h b/src/lib/ecore_drm2/ecore_drm2_private.h
index 966311bf46..bb3fea8a32 100644
--- a/src/lib/ecore_drm2/ecore_drm2_private.h
+++ b/src/lib/ecore_drm2/ecore_drm2_private.h
@@ -833,6 +833,7 @@ extern void (*sym_drmModeFreePlaneResources)(drmModePlaneResPtr ptr);
extern void *(*sym_drmModeGetPlane)(int fd, uint32_t plane_id);
extern void (*sym_drmModeFreePlane)(drmModePlanePtr ptr);
extern int (*sym_drmModeAddFB)(int fd, uint32_t width, uint32_t height, uint8_t depth, uint8_t bpp, uint32_t pitch, uint32_t bo_handle, uint32_t *buf_id);
+extern int (*sym_drmModeAddFB2)(int fd, uint32_t width, uint32_t height, uint32_t pixel_format, uint32_t bo_handles[4], uint32_t pitches[4], uint32_t offsets[4], uint32_t *buf_id, uint32_t flags);
extern int (*sym_drmModeRmFB)(int fd, uint32_t bufferId);
extern int (*sym_drmModePageFlip)(int fd, uint32_t crtc_id, uint32_t fb_id, uint32_t flags, void *user_data);
extern int (*sym_drmModeDirtyFB)(int fd, uint32_t bufferId, drmModeClipPtr clips, uint32_t num_clips);