ecore_drm2: Add ecore_drm2_fb_dmabuf_import
Imports a set of dmabuf buffers as a single Ecore_Drm2_Fb
This commit is contained in:
parent
f0fc86516d
commit
61f40d58f7
|
@ -964,6 +964,27 @@ EAPI void ecore_drm2_output_release_handler_set(Ecore_Drm2_Output *output, Ecore
|
||||||
*/
|
*/
|
||||||
EAPI void *ecore_drm2_fb_bo_get(Ecore_Drm2_Fb *fb);
|
EAPI void *ecore_drm2_fb_bo_get(Ecore_Drm2_Fb *fb);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Import a dmabuf object as a Framebuffer
|
||||||
|
*
|
||||||
|
* @param fd
|
||||||
|
* @param width
|
||||||
|
* @param height
|
||||||
|
* @param depth
|
||||||
|
* @param bpp
|
||||||
|
* @param format
|
||||||
|
* @param stride
|
||||||
|
* @param dmabuf_fd
|
||||||
|
* @param dmabuf_fd_count
|
||||||
|
*
|
||||||
|
* @return A newly created framebuffer object, or NULL on failure
|
||||||
|
*
|
||||||
|
* @ingroup Ecore_Drm2_Fb_Group
|
||||||
|
* @since 1.20
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
EAPI 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);
|
||||||
|
|
||||||
# endif
|
# endif
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -46,6 +46,7 @@ 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;
|
||||||
int (*sym_drmModeCrtcSetGamma)(int fd, uint32_t crtc_id, uint32_t size, uint16_t *red, uint16_t *green, uint16_t *blue) = NULL;
|
int (*sym_drmModeCrtcSetGamma)(int fd, uint32_t crtc_id, uint32_t size, uint16_t *red, uint16_t *green, uint16_t *blue) = NULL;
|
||||||
|
int (*sym_drmPrimeFDToHandle)(int fd, int prime_fd, uint32_t *handle) = NULL;
|
||||||
|
|
||||||
EAPI int ECORE_DRM2_EVENT_OUTPUT_CHANGED = -1;
|
EAPI int ECORE_DRM2_EVENT_OUTPUT_CHANGED = -1;
|
||||||
EAPI int ECORE_DRM2_EVENT_ACTIVATE = -1;
|
EAPI int ECORE_DRM2_EVENT_ACTIVATE = -1;
|
||||||
|
@ -123,6 +124,7 @@ _ecore_drm2_link(void)
|
||||||
SYM(drm_lib, drmModePageFlip);
|
SYM(drm_lib, drmModePageFlip);
|
||||||
SYM(drm_lib, drmModeDirtyFB);
|
SYM(drm_lib, drmModeDirtyFB);
|
||||||
SYM(drm_lib, drmModeCrtcSetGamma);
|
SYM(drm_lib, drmModeCrtcSetGamma);
|
||||||
|
SYM(drm_lib, drmPrimeFDToHandle);
|
||||||
|
|
||||||
if (fail)
|
if (fail)
|
||||||
{
|
{
|
||||||
|
|
|
@ -522,3 +522,29 @@ ecore_drm2_fb_bo_get(Ecore_Drm2_Fb *fb)
|
||||||
EINA_SAFETY_ON_NULL_RETURN_VAL(fb, NULL);
|
EINA_SAFETY_ON_NULL_RETURN_VAL(fb, NULL);
|
||||||
return fb->gbm_bo;
|
return fb->gbm_bo;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
EAPI 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)
|
||||||
|
{
|
||||||
|
int i;
|
||||||
|
Ecore_Drm2_Fb *fb;
|
||||||
|
|
||||||
|
fb = calloc(1, sizeof(Ecore_Drm2_Fb));
|
||||||
|
if (!fb) return NULL;
|
||||||
|
|
||||||
|
for (i = 0; i < dmabuf_fd_count; i++)
|
||||||
|
if (sym_drmPrimeFDToHandle(fd, dmabuf_fd[i], &fb->handles[i])) goto fail;
|
||||||
|
|
||||||
|
fb->fd = fd;
|
||||||
|
fb->w = width;
|
||||||
|
fb->h = height;
|
||||||
|
fb->bpp = bpp;
|
||||||
|
fb->depth = depth;
|
||||||
|
fb->format = format;
|
||||||
|
memcpy(&fb->strides, strides, sizeof(fb->strides));
|
||||||
|
if (_fb2_create(fb)) return fb;
|
||||||
|
|
||||||
|
fail:
|
||||||
|
free(fb);
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
|
@ -836,5 +836,6 @@ 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);
|
||||||
extern int (*sym_drmModeCrtcSetGamma)(int fd, uint32_t crtc_id, uint32_t size, uint16_t *red, uint16_t *green, uint16_t *blue);
|
extern int (*sym_drmModeCrtcSetGamma)(int fd, uint32_t crtc_id, uint32_t size, uint16_t *red, uint16_t *green, uint16_t *blue);
|
||||||
|
extern int (*sym_drmPrimeFDToHandle)(int fd, int prime_fd, uint32_t *handle);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
Loading…
Reference in New Issue