forked from enlightenment/efl
ecore_drm2: Use library function instead of ioctl for addfb2
Minor clean up.
This commit is contained in:
parent
86d1f2b6cd
commit
45e173d186
|
@ -41,6 +41,7 @@ void (*sym_drmModeFreePlaneResources)(drmModePlaneResPtr ptr) = NULL;
|
||||||
void *(*sym_drmModeGetPlane)(int fd, uint32_t plane_id) = NULL;
|
void *(*sym_drmModeGetPlane)(int fd, uint32_t plane_id) = NULL;
|
||||||
void (*sym_drmModeFreePlane)(drmModePlanePtr ptr) = 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_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_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_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;
|
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, drmModeGetPlane);
|
||||||
SYM(drm_lib, drmModeFreePlane);
|
SYM(drm_lib, drmModeFreePlane);
|
||||||
SYM(drm_lib, drmModeAddFB);
|
SYM(drm_lib, drmModeAddFB);
|
||||||
|
SYM(drm_lib, drmModeAddFB2);
|
||||||
SYM(drm_lib, drmModeRmFB);
|
SYM(drm_lib, drmModeRmFB);
|
||||||
SYM(drm_lib, drmModePageFlip);
|
SYM(drm_lib, drmModePageFlip);
|
||||||
SYM(drm_lib, drmModeDirtyFB);
|
SYM(drm_lib, drmModeDirtyFB);
|
||||||
|
|
|
@ -3,31 +3,19 @@
|
||||||
static Eina_Bool
|
static Eina_Bool
|
||||||
_fb2_create(Ecore_Drm2_Fb *fb)
|
_fb2_create(Ecore_Drm2_Fb *fb)
|
||||||
{
|
{
|
||||||
drm_mode_fb_cmd2 cmd;
|
|
||||||
uint32_t hdls[4] = { 0 }, pitches[4] = { 0 }, offsets[4] = { 0 };
|
uint32_t hdls[4] = { 0 }, pitches[4] = { 0 }, offsets[4] = { 0 };
|
||||||
uint64_t modifiers[4] = { 0 };
|
int r;
|
||||||
|
|
||||||
hdls[0] = fb->hdl;
|
hdls[0] = fb->hdl;
|
||||||
pitches[0] = fb->stride;
|
pitches[0] = fb->stride;
|
||||||
offsets[0] = 0;
|
offsets[0] = 0;
|
||||||
modifiers[0] = 0;
|
|
||||||
|
|
||||||
memset(&cmd, 0, sizeof(drm_mode_fb_cmd2));
|
r = sym_drmModeAddFB2(fb->fd, fb->w, fb->h, fb->format, hdls,
|
||||||
cmd.fb_id = 0;
|
pitches, offsets, &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))
|
if (r)
|
||||||
return EINA_FALSE;
|
return EINA_FALSE;
|
||||||
|
|
||||||
fb->id = cmd.fb_id;
|
|
||||||
|
|
||||||
return EINA_TRUE;
|
return EINA_TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -831,6 +831,7 @@ extern void (*sym_drmModeFreePlaneResources)(drmModePlaneResPtr ptr);
|
||||||
extern void *(*sym_drmModeGetPlane)(int fd, uint32_t plane_id);
|
extern void *(*sym_drmModeGetPlane)(int fd, uint32_t plane_id);
|
||||||
extern void (*sym_drmModeFreePlane)(drmModePlanePtr ptr);
|
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_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_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_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);
|
extern int (*sym_drmModeDirtyFB)(int fd, uint32_t bufferId, drmModeClipPtr clips, uint32_t num_clips);
|
||||||
|
|
Loading…
Reference in New Issue