Quantcast
Channel: Raspberry Pi Forums
Viewing all articles
Browse latest Browse all 5763

OpenGLES • Re: Pi4 export EGL image DMA-buf and import as libdrm framebuffer

$
0
0
I was testing that out and I'm stuck and trying to convert the dma-fd into a drm handle using drmPrimeFDToHandle. I get "Input/output error" and dmesg says: "vc4-drm gpu: swiotlb buffer is full (sz: 524288 bytes), total 32768 (slots), used 1796 (slots)". No idea what that means. Code:

Code:

        PFNEGLEXPORTDMABUFIMAGEQUERYMESAPROC eglExportDMABUFImageQueryMESA =            (PFNEGLEXPORTDMABUFIMAGEQUERYMESAPROC)eglGetProcAddress("eglExportDMABUFImageQueryMESA");        PFNEGLEXPORTDMABUFIMAGEMESAPROC eglExportDMABUFImageMESA =            (PFNEGLEXPORTDMABUFIMAGEMESAPROC)eglGetProcAddress("eglExportDMABUFImageMESA");        v("%p %p\n", eglExportDMABUFImageQueryMESA, eglExportDMABUFImageMESA);        EGLImage image = eglCreateImage(display,                                        context,                                        EGL_GL_TEXTURE_2D,                                        (EGLClientBuffer)(uint64_t)img->tex,                                        NULL);        v("%p\n", image);        int dmabuf_fd;        uint32_t handles[4] = {0}, strides[4] = {0}, offsets[4] = {0};        uint64_t modifiers[4] = {0};        uint32_t fourcc;        eglExportDMABUFImageQueryMESA(display,                                      image,                                      &fourcc,                                      NULL,                                      NULL);        v("%c%c%c%c\n",            (fourcc >>  0) & 0xff,            (fourcc >>  8) & 0xff,            (fourcc >> 16) & 0xff,            (fourcc >> 24) & 0xff        );        eglExportDMABUFImageMESA(display,                                 image,                                 &dmabuf_fd,                                 &strides[0],                                 &offsets[0]);        v("%d\n", dmabuf_fd);        v("%d\n", strides[0]);        v("%d\n", offsets[0]);        if (drmPrimeFDToHandle(drm_fd, dmabuf_fd, &handles[0]))            die("cannot import dma-fd %m");
Output:

Code:

0xf6ee09ac 0xf6ee0c400xed802d90XB241876800
So it got the two functions, created the image, correctly identified the fourcc format, create the file descriptor, correctly calculated the stride (I have a 1920 wide texture). But then fail to convert that to a drm handle. Oh well :-)

Statistics: Posted by dividuum — Sat Apr 06, 2024 9:58 am



Viewing all articles
Browse latest Browse all 5763

Trending Articles