[Mesa-dev] [PATCH v2 4/4] i965: Implemente a tiled fast-path for glReadPixels and glGetTexImage

Matt Turner mattst88 at gmail.com
Mon Jan 5 15:47:33 PST 2015


On Mon, Jan 5, 2015 at 3:27 PM, Jason Ekstrand <jason at jlekstrand.net> wrote:
> From: Sisinty Sasmita Patra <sisinty.patra at intel.com>
>
> Added intel_readpixels_tiled_mempcpy and intel_gettexsubimage_tiled_mempcpy
> functions. These are the fast paths for glReadPixels and glGetTexImage.
>
> On chrome, using the RoboHornet 2D Canvas toDataURL test, this patch cuts
> amount of time spent in glReadPixels by more than half and reduces the time
> of the entire test by 10%.
>
> v2: Jason Ekstrand <jason.ekstrand at intel.com>
>    - Refactor to make the functions look more like the old
>      intel_tex_subimage_tiled_memcpy
>    - Don't export the readpixels_tiled_memcpy function
>    - Fix some pointer arithmatic bugs in partial image downloads (using
>      ReadPixels with a non-zero x or y offset)
>    - Fix a bug when ReadPixels is performed on an FBO wrapping a texture
>      miplevel other than zero.
>
> v3: Jason Ekstrand <jason.ekstrand at intel.com>
>    - Better documentation fot the *_tiled_memcpy functions
>    - Add target restrictions for renderbuffers wrapping textures
> ---
>  src/mesa/drivers/dri/i965/intel_pixel_read.c | 142 ++++++++++++++++++++++++++-
>  src/mesa/drivers/dri/i965/intel_tex.h        |   9 ++
>  src/mesa/drivers/dri/i965/intel_tex_image.c  | 139 +++++++++++++++++++++++++-
>  3 files changed, 287 insertions(+), 3 deletions(-)
>
> diff --git a/src/mesa/drivers/dri/i965/intel_pixel_read.c b/src/mesa/drivers/dri/i965/intel_pixel_read.c
> index beb3152..5aa06c2 100644
> --- a/src/mesa/drivers/dri/i965/intel_pixel_read.c
> +++ b/src/mesa/drivers/dri/i965/intel_pixel_read.c
> @@ -38,14 +38,16 @@
>
>  #include "brw_context.h"
>  #include "intel_screen.h"
> +#include "intel_batchbuffer.h"
>  #include "intel_blit.h"
>  #include "intel_buffers.h"
>  #include "intel_fbo.h"
>  #include "intel_mipmap_tree.h"
>  #include "intel_pixel.h"
>  #include "intel_buffer_objects.h"
> +#include "intel_tiled_memcpy.h"
>
> -#define FILE_DEBUG_FLAG DEBUG_PIXEL
> +#define FILE_DEBUG_FLAG DEBUG_TEXTURE
>
>  /* For many applications, the new ability to pull the source buffers
>   * back out of the GTT and then do the packing/conversion operations
> @@ -161,17 +163,155 @@ do_blit_readpixels(struct gl_context * ctx,
>     return true;
>  }
>
> +/**
> + * \brief A fast path for glReadPixels
> + *
> + * This fast path is taken when the source format is BGRA, RGBA,
> + * A or L and when the texture memory is X- or Y-tiled.  It downloads
> + * the source data by directly mapping the memory without a GTT fence.
> + * This then needs to be de-tiled on the CPU before presenting the data to
> + * the user in the linear fasion.
> + *
> + * This is a performance win over the conventional texture download path.
> + * In the conventional texture download path, the texture is either mapped
> + * through the GTT or copied to a linear buffer with the blitter before
> + * handing off to a software path.  This allows us to avoid round-tripping
> + * throug the GPU (in the case where we would be blitting) and do only a

typo: through. (occurs in the comment later as well)


More information about the mesa-dev mailing list