Obtain dmabuf fd for EGLImage

206 Views Asked by At

I have testing code of logic

[producer code]

EGLImage image = eglCreateImage(egl->dpy, egl->ctx, EGL_GL_TEXTURE_2D,
            (EGLClientBuffer)(uint64_t)gl->texture, NULL);
    assert_and_log(image != EGL_NO_IMAGE, "");

    ret = eglExportDMABUFImageQueryMESA(egl->dpy, image, NULL, NULL, NULL);
    if (ret == EGL_FALSE) {
        log_error_egl("eglExportDMABUFImageQueryMESA");
        abort();
    }

    int dmabuf_fd;
    ret = eglExportDMABUFImageMESA(egl->dpy, image, &dmabuf_fd, &strides[0], &offsets[0]);

[consumer code]

    EGLAttrib const attribs[] = {
        EGL_WIDTH, width,
        EGL_HEIGHT, height,
        EGL_DMA_BUF_PLANE0_FD_EXT, dmabuf_fd,
        EGL_DMA_BUF_PLANE0_OFFSET_EXT, offsets[0],
        EGL_DMA_BUF_PLANE0_PITCH_EXT, strides[0],
        EGL_LINUX_DRM_FOURCC_EXT, drm_format,
        EGL_NONE,
    };
    EGLImage image = eglCreateImage(egl->dpy, EGL_NO_CONTEXT,
            EGL_LINUX_DMA_BUF_EXT, NULL, attribs);

The call fails on eglCreateImage - leaving message from driver: "Failed to get v3d handle for dmabuf 8"

Does it have to do something with improper dma driver configuration? If not then what might it be?

  • I check variable values and call errors - EGLImage creation is first issue call
  • dmabuf_fd is obtained through unix sockets
  • Using MESA drivers on raspberry pi4, Ubuntu 22 Desktop version
0

There are 0 best solutions below