Part Number:AM5728
eglCreateImageKHR(disp_wl->egl.dpy, EGL_NO_CONTEXT,EGL_NATIVE_PIXMAP_KHR, disp_wl->gbm.bo,&attrib_list);
bind fbo.
rendering ...
memcpy data from dmabuf is slow.
https://e2e.ti.com/support/processors/f/791/t/491377
"This has been taken care in PSDK 3.2 using CMEM buffers. The CMEM driver already had support for cached buffers and now they are enhanced to support dambuf export feature. So for scenarios where CPU need to access buffers, we recommend those buffers to be allocated using CMEM and then exported to the drivers with which they need to be shared. Example can be found in dual camera demo example source code in PSDK."
using cmem alloc buffer, export as dmabuf.
gbm_bo_import the dmabuf return error:
PVR:(Error): [ 7919-> 7921] < gbm_pvr_bo_create_common():217|ERROR> condition [ bo_attrs->opt.import_dmabuf.stride != 0] failed [0, ]
ERROR:create_texture:1440: gbm_bo_import failed
ti-processor-sdk-linux-am57xx-evm-05.02.00.10
code:
case FOURCC('A','R','2','4'):
buf->nbo = 1;
#if 0
buf->bo[0] = alloc_bo(disp, 32, buf->width, buf->height,
&bo_handles[0], &buf->pitches[0]);
#else
//Allocate buffer from CMEM and get the buffer descriptor
buf->fd[0] = alloc_cmem_buffer(buf->width*buf->height*32, 1, &buf->cmem_buf);
if(buf->fd[0] < 0){
free_cmem_buffer(buf->cmem_buf);
printf(" Cannot export CMEM buffer\n");
return NULL;
}
/* Get the omap bo from the fd allocted using CMEM */
buf->bo[0] = omap_bo_from_dmabuf(disp->dev, buf->fd[0]);
bo_handles[0] = omap_bo_handle(buf->bo[0]);
#endif
int dfd = buf->fd[0];
struct gbm_import_fd_data gbm_dmabuf = {
.fd = dfd,
.width = buf->width,
.height = buf->height,
.stride = buf->pitches[0],
.format = GBM_FORMAT_ARGB8888
};
disp_wl->gbm.bo = gbm_bo_import(disp_wl->gbm.dev, GBM_BO_IMPORT_FD, &gbm_dmabuf,
GBM_BO_USE_RENDERING|GBM_BO_USE_SCANOUT);
if(!disp_wl->gbm.bo){
ERROR("gbm_bo_import failed\n");
return -1;
}
EGLint attrib_list = EGL_NONE;
buf_wl->egl_img = disp_wl->egl.eglCreateImageKHR(
disp_wl->egl.dpy,
EGL_NO_CONTEXT,
EGL_NATIVE_PIXMAP_KHR,
disp_wl->gbm.bo,
&attrib_list);