[Mesa-dev] [v2] EXT_image_dma_buf_import for intel
Topi Pohjolainen
topi.pohjolainen at intel.com
Mon Apr 29 04:07:54 PDT 2013
The set introduces new target for 'eglCreateImageKHR()' allowing one
to create EGL images out of externally allocated buffers. Especially
one can combine up to three separate buffers into one single logical
entity. Low level native buffers may not support planar formats and
hence EGL layer will instead combine native buffers each representing
a single plane into one planar image.
Until now an image in intel dri backend consisted of a single region.
Here this is extended to accomodate YUV formats having each component
in its own plane, but intended only for images that are to be bound
as textures later on.
As such the images are not much of use, but combined with the logic
(OES_external_image) allowing one to create textures out of these
images, one can start directly sampling the underlying buffers.
Extra attention should be paid to the native buffer referencing -
I chose to follow the current way where the egl driver simply tells
the native buffer management that there is another user of the
buffer. The extension itself says that:
"3. Does ownership of the file descriptor pass to the EGL library?
ANSWER: If eglCreateImageKHR is successful, EGL assumes ownership
of the file descriptors and is responsible for closing them."
In case of gem originated buffers the native reference counting
already takes care of the lifecycle of the buffer objects. I wonder
if the intention here is to have something more specific.
And unfortunately I didn't dare touching gallium side of things.
v2:
- added support for treating buffers having packed format
separately from the planar (that require special care)
intel: allow packed prime buffers to be treated normally
- tried to address all Eric's comments:
intel: refactor planar format lookup
intel: prepare for dri images having more than plane
- added missing check for explicit "no context"
egl: definitions for EXT_image_dma_buf_import
Topi Pohjolainen (10):
intel: allow packed prime buffers to be treated normally
intel: do not create renderbuffers out of planar images
intel: replace single region with a vector of regions
intel: refactor planar format lookup
intel: set dri image dimensions even when creating out of primes
intel: prepare for dri images having more than plane
dri: propagate extra dma_buf import attributes to the drivers
egl: definitions for EXT_image_dma_buf_import
egl: dri2: support for creating images out of dma buffers
intel: enable EXT_image_dma_buf_import
include/EGL/eglext.h | 33 ++++
include/GL/internal/dri_interface.h | 23 +++
src/egl/drivers/dri2/egl_dri2.c | 239 ++++++++++++++++++++++++++
src/egl/main/eglapi.c | 7 +-
src/egl/main/egldisplay.h | 1 +
src/egl/main/eglimage.c | 76 ++++++++
src/egl/main/eglimage.h | 15 ++
src/mesa/drivers/dri/intel/intel_extensions.c | 1 +
src/mesa/drivers/dri/intel/intel_fbo.c | 10 +-
src/mesa/drivers/dri/intel/intel_regions.h | 14 +-
src/mesa/drivers/dri/intel/intel_screen.c | 192 ++++++++++++++-------
src/mesa/drivers/dri/intel/intel_tex_image.c | 2 +-
src/mesa/main/extensions.c | 1 +
src/mesa/main/mtypes.h | 1 +
14 files changed, 544 insertions(+), 71 deletions(-)
--
1.8.1.2
More information about the mesa-dev
mailing list