Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

more support to EGL extension EGL_EXT_image_dma_buf_import #925

Open
HR1025 opened this issue Jul 12, 2024 · 1 comment
Open

more support to EGL extension EGL_EXT_image_dma_buf_import #925

HR1025 opened this issue Jul 12, 2024 · 1 comment

Comments

@HR1025
Copy link

HR1025 commented Jul 12, 2024

This issue is a further discussion to #785.

I want to trace and replay using the EGL_EXT_image_dma_buf_import.

Trace

I found that apitrace converts glEGLImageTargetTexture2DOES into a fake glTexImage2D.In most cases, this is not a problem.
But when I bind GL_TEXTURE_EXTERNAL_OES to FBO, it will result in incomplete FBO.

Sample code as fllows:

glActiveTexture(GL_TEXTURE1)
glGenTextures(1, p_texture_id)
glBindTexture(GL_TEXTURE_EXTERNAL_OES, *p_texture_id)
glTexParameteri(GL_TEXTURE_EXTERNAL_OES, GL_TEXTURE_MAG_FILTER, GL_NEAREST)
glTexParameteri(GL_TEXTURE_EXTERNAL_OES, GL_TEXTURE_MIN_FILTER, GL_NEAREST)
glEGLImageTargetTexture2DOES(GL_TEXTURE_EXTERNAL_OES, img)
glGenFramebuffers(1, p_fbo_id)
glBindFramebuffer(GL_FRAMEBUFFER, *p_fbo_id)
glFramebufferTexture2D(GL_FRAMEBUFFER,GL_COLOR_ATTACHMENT0, GL_TEXTURE_EXTERNAL_OES, *p_texture_id, 0)
glCheckFramebufferStatus(GL_FRAMEBUFFER)

glCheckFramebufferStatus will not return GL_FRAMEBUFFER_COMPLETE.

So Could we remove this behavior or have better solution:
image

Replay

I think replay is achievable because we can obtain the image data through mmap using fd.
There are roughly three ways to create fd using EGL_DMA_BUF_PLANE0_FD_EXT:

  • DRM
  • ION
  • DMA HEAP

We can create DMA buf fd ourselves through thoses method during replay with saved image data.

@jrfonseca
Copy link
Member

I'm not familiar enough with EGL_EXT_image_dma_buf_import extension to provide guidance how to proceed.

I think replay is achievable because we can obtain the image data through mmap using fd.

The fd might not be around when replaying.

We can create DMA buf fd ourselves through thoses method during replay with saved image data.

For sure, we need some way to make the texture and FBO complete. But I'm not sure creating an actual dma_buf is a must.

Also saving the image data is pointless: the source image is likely changing, so what's saved will depend on the time it's recorded.

IMHO, it would be better to just figure out why the FBO is incomplete, and emit fake calls when recording to close that gap.

I don't have time to look into this, but I accept PRs that fix your use case provided that they don't break anything on other platforms.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants