devilhorns pushed a commit to branch master.

http://git.enlightenment.org/core/efl.git/commit/?id=45e173d186cd3db210e974bfb82d7ffa52245026

commit 45e173d186cd3db210e974bfb82d7ffa52245026
Author: Derek Foreman <der...@osg.samsung.com>
Date:   Tue Mar 21 14:21:14 2017 -0500

    ecore_drm2: Use library function instead of ioctl for addfb2
    
    Minor clean up.
---
 src/lib/ecore_drm2/ecore_drm2.c         |  2 ++
 src/lib/ecore_drm2/ecore_drm2_fb.c      | 24 ++++++------------------
 src/lib/ecore_drm2/ecore_drm2_private.h |  1 +
 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 b60641e..d3de6f3 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 fe27508..ef61887 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 0ddc80a..ea0ab19 100644
--- a/src/lib/ecore_drm2/ecore_drm2_private.h
+++ b/src/lib/ecore_drm2/ecore_drm2_private.h
@@ -831,6 +831,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);

-- 


Reply via email to