summaryrefslogtreecommitdiff
path: root/src/lib/ecore_drm2
diff options
context:
space:
mode:
authorDerek Foreman <derekf@osg.samsung.com>2017-03-21 15:44:46 -0500
committerChris Michael <cp.michael@samsung.com>2017-04-18 07:55:10 -0400
commit61f40d58f7e87b2c937884cae4e2fd59f9a60882 (patch)
tree21bc3643a29b41c240ea0d127ba2efca45d6e3d8 /src/lib/ecore_drm2
parentf0fc86516dc571f5ddcf6727e879326a45324fd8 (diff)
ecore_drm2: Add ecore_drm2_fb_dmabuf_import
Imports a set of dmabuf buffers as a single Ecore_Drm2_Fb
Diffstat (limited to 'src/lib/ecore_drm2')
-rw-r--r--src/lib/ecore_drm2/Ecore_Drm2.h21
-rw-r--r--src/lib/ecore_drm2/ecore_drm2.c2
-rw-r--r--src/lib/ecore_drm2/ecore_drm2_fb.c26
-rw-r--r--src/lib/ecore_drm2/ecore_drm2_private.h1
4 files changed, 50 insertions, 0 deletions
diff --git a/src/lib/ecore_drm2/Ecore_Drm2.h b/src/lib/ecore_drm2/Ecore_Drm2.h
index 87d7b40..8a10104 100644
--- a/src/lib/ecore_drm2/Ecore_Drm2.h
+++ b/src/lib/ecore_drm2/Ecore_Drm2.h
@@ -964,6 +964,27 @@ EAPI void ecore_drm2_output_release_handler_set(Ecore_Drm2_Output *output, Ecore
964 */ 964 */
965EAPI void *ecore_drm2_fb_bo_get(Ecore_Drm2_Fb *fb); 965EAPI void *ecore_drm2_fb_bo_get(Ecore_Drm2_Fb *fb);
966 966
967/**
968 * Import a dmabuf object as a Framebuffer
969 *
970 * @param fd
971 * @param width
972 * @param height
973 * @param depth
974 * @param bpp
975 * @param format
976 * @param stride
977 * @param dmabuf_fd
978 * @param dmabuf_fd_count
979 *
980 * @return A newly created framebuffer object, or NULL on failure
981 *
982 * @ingroup Ecore_Drm2_Fb_Group
983 * @since 1.20
984 *
985 */
986EAPI Ecore_Drm2_Fb *ecore_drm2_fb_dmabuf_import(int fd, int width, int height, int depth, int bpp, unsigned int format, unsigned int strides[4], int dmabuf_fd[4], int dmabuf_fd_count);
987
967# endif 988# endif
968 989
969#endif 990#endif
diff --git a/src/lib/ecore_drm2/ecore_drm2.c b/src/lib/ecore_drm2/ecore_drm2.c
index d3de6f3..7eec270 100644
--- a/src/lib/ecore_drm2/ecore_drm2.c
+++ b/src/lib/ecore_drm2/ecore_drm2.c
@@ -46,6 +46,7 @@ int (*sym_drmModeRmFB)(int fd, uint32_t bufferId) = NULL;
46int (*sym_drmModePageFlip)(int fd, uint32_t crtc_id, uint32_t fb_id, uint32_t flags, void *user_data) = NULL; 46int (*sym_drmModePageFlip)(int fd, uint32_t crtc_id, uint32_t fb_id, uint32_t flags, void *user_data) = NULL;
47int (*sym_drmModeDirtyFB)(int fd, uint32_t bufferId, drmModeClipPtr clips, uint32_t num_clips) = NULL; 47int (*sym_drmModeDirtyFB)(int fd, uint32_t bufferId, drmModeClipPtr clips, uint32_t num_clips) = NULL;
48int (*sym_drmModeCrtcSetGamma)(int fd, uint32_t crtc_id, uint32_t size, uint16_t *red, uint16_t *green, uint16_t *blue) = NULL; 48int (*sym_drmModeCrtcSetGamma)(int fd, uint32_t crtc_id, uint32_t size, uint16_t *red, uint16_t *green, uint16_t *blue) = NULL;
49int (*sym_drmPrimeFDToHandle)(int fd, int prime_fd, uint32_t *handle) = NULL;
49 50
50EAPI int ECORE_DRM2_EVENT_OUTPUT_CHANGED = -1; 51EAPI int ECORE_DRM2_EVENT_OUTPUT_CHANGED = -1;
51EAPI int ECORE_DRM2_EVENT_ACTIVATE = -1; 52EAPI int ECORE_DRM2_EVENT_ACTIVATE = -1;
@@ -123,6 +124,7 @@ _ecore_drm2_link(void)
123 SYM(drm_lib, drmModePageFlip); 124 SYM(drm_lib, drmModePageFlip);
124 SYM(drm_lib, drmModeDirtyFB); 125 SYM(drm_lib, drmModeDirtyFB);
125 SYM(drm_lib, drmModeCrtcSetGamma); 126 SYM(drm_lib, drmModeCrtcSetGamma);
127 SYM(drm_lib, drmPrimeFDToHandle);
126 128
127 if (fail) 129 if (fail)
128 { 130 {
diff --git a/src/lib/ecore_drm2/ecore_drm2_fb.c b/src/lib/ecore_drm2/ecore_drm2_fb.c
index 090c998..be75760 100644
--- a/src/lib/ecore_drm2/ecore_drm2_fb.c
+++ b/src/lib/ecore_drm2/ecore_drm2_fb.c
@@ -522,3 +522,29 @@ ecore_drm2_fb_bo_get(Ecore_Drm2_Fb *fb)
522 EINA_SAFETY_ON_NULL_RETURN_VAL(fb, NULL); 522 EINA_SAFETY_ON_NULL_RETURN_VAL(fb, NULL);
523 return fb->gbm_bo; 523 return fb->gbm_bo;
524} 524}
525
526EAPI Ecore_Drm2_Fb *
527ecore_drm2_fb_dmabuf_import(int fd, int width, int height, int depth, int bpp, unsigned int format, unsigned int strides[4], int dmabuf_fd[4], int dmabuf_fd_count)
528{
529 int i;
530 Ecore_Drm2_Fb *fb;
531
532 fb = calloc(1, sizeof(Ecore_Drm2_Fb));
533 if (!fb) return NULL;
534
535 for (i = 0; i < dmabuf_fd_count; i++)
536 if (sym_drmPrimeFDToHandle(fd, dmabuf_fd[i], &fb->handles[i])) goto fail;
537
538 fb->fd = fd;
539 fb->w = width;
540 fb->h = height;
541 fb->bpp = bpp;
542 fb->depth = depth;
543 fb->format = format;
544 memcpy(&fb->strides, strides, sizeof(fb->strides));
545 if (_fb2_create(fb)) return fb;
546
547fail:
548 free(fb);
549 return NULL;
550}
diff --git a/src/lib/ecore_drm2/ecore_drm2_private.h b/src/lib/ecore_drm2/ecore_drm2_private.h
index 2f89a3d..a9423df 100644
--- a/src/lib/ecore_drm2/ecore_drm2_private.h
+++ b/src/lib/ecore_drm2/ecore_drm2_private.h
@@ -836,5 +836,6 @@ extern int (*sym_drmModeRmFB)(int fd, uint32_t bufferId);
836extern int (*sym_drmModePageFlip)(int fd, uint32_t crtc_id, uint32_t fb_id, uint32_t flags, void *user_data); 836extern int (*sym_drmModePageFlip)(int fd, uint32_t crtc_id, uint32_t fb_id, uint32_t flags, void *user_data);
837extern int (*sym_drmModeDirtyFB)(int fd, uint32_t bufferId, drmModeClipPtr clips, uint32_t num_clips); 837extern int (*sym_drmModeDirtyFB)(int fd, uint32_t bufferId, drmModeClipPtr clips, uint32_t num_clips);
838extern int (*sym_drmModeCrtcSetGamma)(int fd, uint32_t crtc_id, uint32_t size, uint16_t *red, uint16_t *green, uint16_t *blue); 838extern int (*sym_drmModeCrtcSetGamma)(int fd, uint32_t crtc_id, uint32_t size, uint16_t *red, uint16_t *green, uint16_t *blue);
839extern int (*sym_drmPrimeFDToHandle)(int fd, int prime_fd, uint32_t *handle);
839 840
840#endif 841#endif