[Mesa-dev] [RFC] OES_external_image for i965

Topi Pohjolainen topi.pohjolainen at intel.com
Tue Feb 26 05:18:51 PST 2013

The series adds support for i965 driver to sample YUV420, NV12 and YV12
formatted buffers originating outside the GL-stack. There is only support for
the fragment shaders for now (even though one prepares for vertex shaders also).

In a summary, the relation between a mesa core maintained sampler and i965
hw-surface bookkeeping is extended to support more than one surface per sampler.
Perhaps it would be more sensible to extend the required texture image units in
the core to support multiple units instead. (This would mean splitting a native
buffer into multiple images, one per plane). I thought against this as some
drivers may be capable of handling multiples planes as one logical image. I
don't really have a strong take way or the other. The approach I've taken here
can at least serve as the starting point for agreeing on proper solution.

The second more or less questionable part is the support for creating YUV
buffers. In order to test for YUV sampling one needs a way of providing them
for the EGL stack. Here I chose to augment the dri driver backing gbm as I
couldn't come up with anything better. It may be helpful to take a look at the
corresponding piglit test case and framework support I've written for it.

Finally there is the logic for the fragment shader compiler backend to generate
code for sampling multiple planes instead of just one and to convert the YUV
data into RGB. There used to exist similar logic for rectangle extension and I
have taken quite a lot of ideas from there.

Topi Pohjolainen (13):
  i965: extend FS sampler to surface relation to 1:N
  i965: extend VS sampler to surface relation to 1:N
  intel: support for creating planar external image textures
  i965: support for reserving surfaces for planar textures
  i965: re-compile shader if external texture unit changes
  intel: treat mip-tree as constant when resolving offsets
  i965: refactor sampling engine surface state setup
  i965: support for setting surfaces for planar external
  intel: refactor planar format lookup
  dri: introduce YVU420 (YV12)
  gbm: dri: support for creating YUV formatted buffers
  i965: support for YUV formatted external textures
  i965: enable image external textures

 include/GL/internal/dri_interface.h               |    1 +
 src/gbm/backends/dri/gbm_dri.c                    |    9 +
 src/mesa/drivers/dri/i965/Makefile.sources        |    1 +
 src/mesa/drivers/dri/i965/brw_context.h           |   37 ++-
 src/mesa/drivers/dri/i965/brw_fs.h                |    2 +
 src/mesa/drivers/dri/i965/brw_fs_emit.cpp         |    3 +-
 src/mesa/drivers/dri/i965/brw_fs_ext_texture.cpp  |  274 +++++++++++++++++++++
 src/mesa/drivers/dri/i965/brw_fs_visitor.cpp      |    5 +
 src/mesa/drivers/dri/i965/brw_program.h           |    6 +
 src/mesa/drivers/dri/i965/brw_vs.c                |   30 +++
 src/mesa/drivers/dri/i965/brw_wm.c                |   37 +++
 src/mesa/drivers/dri/i965/brw_wm_surface_state.c  |  141 +++++++----
 src/mesa/drivers/dri/i965/gen7_wm_surface_state.c |  160 +++++++-----
 src/mesa/drivers/dri/intel/intel_extensions.c     |    1 +
 src/mesa/drivers/dri/intel/intel_mipmap_tree.c    |    4 +-
 src/mesa/drivers/dri/intel/intel_mipmap_tree.h    |    2 +-
 src/mesa/drivers/dri/intel/intel_regions.c        |   66 ++++-
 src/mesa/drivers/dri/intel/intel_regions.h        |    8 +-
 src/mesa/drivers/dri/intel/intel_screen.c         |   49 +++-
 src/mesa/drivers/dri/intel/intel_tex_image.c      |   21 ++
 src/mesa/drivers/dri/intel/intel_tex_obj.h        |   37 +++
 21 files changed, 774 insertions(+), 120 deletions(-)
 create mode 100644 src/mesa/drivers/dri/i965/brw_fs_ext_texture.cpp


More information about the mesa-dev mailing list