[Mesa-dev] [PATCH 04/17] intel: Make a wrapper for intelEmitCopyBlit using miptrees.

Chad Versace chad.versace at linux.intel.com
Tue May 28 13:54:16 PDT 2013


On 05/24/2013 01:56 PM, Eric Anholt wrote:
> I had previously asserted that it was hard to write a useful, simpler
> blit function, but I think this might be it.
>
> This has the side effect of extending the 32k pitch check to a few more
> places that were missing it.
> ---
>   src/mesa/drivers/dri/intel/intel_blit.c        | 91 ++++++++++++++++++++++++++
>   src/mesa/drivers/dri/intel/intel_blit.h        | 10 +++
>   src/mesa/drivers/dri/intel/intel_mipmap_tree.c | 15 ++---
>   src/mesa/drivers/dri/intel/intel_pixel_copy.c  | 42 +++---------
>   src/mesa/drivers/dri/intel/intel_tex_copy.c    | 80 ++++------------------
>   5 files changed, 127 insertions(+), 111 deletions(-)
>
> diff --git a/src/mesa/drivers/dri/intel/intel_blit.c b/src/mesa/drivers/dri/intel/intel_blit.c
> index f9cba85..007f900 100644
> --- a/src/mesa/drivers/dri/intel/intel_blit.c
> +++ b/src/mesa/drivers/dri/intel/intel_blit.c
> @@ -85,6 +85,97 @@ br13_for_cpp(int cpp)
>      }
>   }
>
> +/**
> + * Implements a rectangular block transfer (blit) of pixels between two
> + * miptrees.
> + *
> + * Our blitter can operate on 1, 2, or 4-byte-per-pixel data, with generous,
> + * but limited, pitches and sizes allowed.
> + *
> + * The src/dst coordinates are relative to the given level/slice of the
> + * miptree.
> + *
> + * If @src_flip or @dst_flip is set, then the rectangle within that miptree
> + * will be inverted (including scanline order) when copying.  This is common
> + * in GL when copying between window system and user-created
> + * renderbuffers/textures.
> + */
> +bool
> +intel_miptree_blit(struct intel_context *intel,
> +                   struct intel_mipmap_tree *src_mt,
> +                   int src_level, int src_slice,
> +                   uint32_t src_x, uint32_t src_y, bool src_flip,
> +                   struct intel_mipmap_tree *dst_mt,
> +                   int dst_level, int dst_slice,
> +                   uint32_t dst_x, uint32_t dst_y, bool dst_flip,
> +                   uint32_t width, uint32_t height,
> +                   GLenum logicop)
> +{
> +   /* We don't assert on format because we may blit from ARGB8888 to XRGB8888,
> +    * for example.
> +    */
> +   assert(src_mt->cpp == dst_mt->cpp);
> +
> +   /* According to the Ivy Bridge PRM, Vol1 Part4, section 1.2.1.2 (Graphics
> +    * Data Size Limitations):
> +    *
> +    *    The BLT engine is capable of transferring very large quantities of
> +    *    graphics data. Any graphics data read from and written to the
> +    *    destination is permitted to represent a number of pixels that
> +    *    occupies up to 65,536 scan lines and up to 32,768 bytes per scan line
> +    *    at the destination. The maximum number of pixels that may be
> +    *    represented per scan line’s worth of graphics data depends on the
> +    *    color depth.
> +    *
> +    * Furthermore, intel_miptree_blit (which is called below) uses a signed
                       ^^^^^^^^^^^^^^^^^^
I think you meant intelEmitCopyBlit.

> +    * 16-bit integer to represent buffer pitch, so it can only handle buffer
> +    * pitches < 32k.
> +    *
> +    * As a result of these two limitations, we can only use the blitter to do
> +    * this copy when the region's pitch is less than 32k.
> +    */

[snip]



More information about the mesa-dev mailing list