[Mesa-dev] [RFC] intel: cache regions + offset

Gwenole Beauchesne gb.devel at gmail.com
Fri Apr 20 09:39:02 PDT 2012


This patch series makes it possible to cache regions + an offset. This
is ugly but here is my use case: I have a single bo representing a YUV
surface but I want to expose each plane as an EGLImage. i.e. for an
NV12 surface, I would like to get two EGLImages, one for the Y component,
and another other for UV components.

In practise, the ultimate use case is to share VA surfaces with GL
stacks and let the user render them with specific GLSL code +
postprocessing kernels like noise reduction, sharpening, etc.
Likewise, this is useful to implement YUV DRM buffers in Wayland.

The variable "regions" array in the hash entry is awful. We could make
a static array 3 or 4 regions at most, for each plane. This means that
an EGL_DRM_BUFFER_OFFSET_MESA extension with arbitrary offsets cannot
be implemented. Not a big loss since I don't really care of that but
rather, the EGL_WAYLAND_BUFFER extension is to be extended with an extra
"plane" attribute. Likewise for the EGL_VA_SURFACE_BUFFER extension.

IMHO, a dedicated region is needed per plane, for the same buffer
name. This is because the described layout could be different for each
plane. e.g. different format to be used, different stride, width and
height, etc.  Besides, the current intel_region_alloc_for_handle()
implementation will fail if a difference is found. So, this extra
level of hashing can be useful to solve this issue.

Does someone have a better model to achieve the depicted goals?

Gwenole Beauchesne (3):
  intel: add and handle offset field in regions.
  intel: rework regions hash.
  intel: allow region hash with offset specification.

 src/mesa/drivers/dri/i965/brw_wm_surface_state.c  |    1 +
 src/mesa/drivers/dri/i965/gen7_wm_surface_state.c |    1 +
 src/mesa/drivers/dri/intel/intel_regions.c        |  155 ++++++++++++++++++++-
 src/mesa/drivers/dri/intel/intel_regions.h        |    9 ++
 src/mesa/drivers/dri/intel/intel_screen.c         |   13 +--
 5 files changed, 163 insertions(+), 16 deletions(-)


More information about the mesa-dev mailing list