[Mesa-dev] [PATCH 2/4] i965: Refactor tiled memcpy functions and move them into their own file
Jason Ekstrand
jason at jlekstrand.net
Mon Jan 5 16:12:12 PST 2015
On Mon, Jan 5, 2015 at 2:38 PM, Chad Versace <chad.versace at intel.com> wrote:
> On 01/03/2015 11:54 AM, Jason Ekstrand wrote:
> > From: Sisinty Sasmita Patra <sisinty.patra at intel.com>
> >
> > This commit refactors the tiled_memcpy code in intel_tex_subimage.c and
> > moves it into its own file intel_tiled_memcpy files. Also, xtile_copy
> and
> > ytile_copy are renamed to linear_to_xtiled and linear_to_ytiled
> > respectively. The *_faster functions are similarly renamed.
> >
> > There was also a bit of logic to select between the the libc provided
> > memcpy function and our custom memcpy that does an RGBA -> BGRA swizzle.
> > This was moved into an intel_get_memcpy function so that rgba8_copy can
> > live (and be inlined) in intel_tiled_memcpy.c.
> >
> > v2: Jason Ekstrand <jason.ekstrand at intel.com>
> > - Better commit message
> > - Fix up the copyright on the intel_tiled_memcpy files
> > - Various whitespace fixes
> > - Moved a bunch of stuff that did not need to be exposed from
> > intel_tiled_memcpy.h to intel_tiled_memcpy.c
> > - Added proper documentation for intel_get_memcpy
> > - Incorperated the ptrdiff_t tweaks from commit 225a09790
> >
> > Signed-off-by: Jason Ekstrand <jason.ekstrand at intel.com>
> > ---
> > src/mesa/drivers/dri/i965/Makefile.sources | 2 +
> > src/mesa/drivers/dri/i965/intel_tex_subimage.c | 394
> +---------------------
> > src/mesa/drivers/dri/i965/intel_tiled_memcpy.c | 439
> +++++++++++++++++++++++++
> > src/mesa/drivers/dri/i965/intel_tiled_memcpy.h | 63 ++++
> > 4 files changed, 506 insertions(+), 392 deletions(-)
> > create mode 100644 src/mesa/drivers/dri/i965/intel_tiled_memcpy.c
> > create mode 100644 src/mesa/drivers/dri/i965/intel_tiled_memcpy.h
>
>
> > +/**
> > + * Copy texture data from linear to X tile layout, faster.
> > + *
> > + * Same as \ref xtile_copy but faster, because it passes constant
> parameters
> ^^^^^^^^^^
> Function name needs updating.
>
> > + * for common cases, allowing the compiler to inline code optimized for
> those
> > + * cases.
> > + *
> > + * \copydoc tile_copy_fn
> > + */
> > +static FLATTEN void
> > +linear_to_xtiled_faster(uint32_t x0, uint32_t x1, uint32_t x2, uint32_t
> x3,
> > + uint32_t y0, uint32_t y1,
> > + char *dst, const char *src,
> > + uint32_t src_pitch,
> > + uint32_t swizzle_bit,
> > + mem_copy_fn mem_copy)
>
>
>
> > +/**
> > + * Copy texture data from linear to Y tile layout, faster.
> > + *
> > + * Same as \ref ytile_copy but faster, because it passes constant
> parameters
> ^^^^^^^^^^
> Again, function name needs updating.
>
Will do.
>
> > + * for common cases, allowing the compiler to inline code optimized for
> those
> > + * cases.
> > + *
> > + * \copydoc tile_copy_fn
> > + */
> > +static FLATTEN void
> > +linear_to_ytiled_faster(uint32_t x0, uint32_t x1, uint32_t x2, uint32_t
> x3,
> > + uint32_t y0, uint32_t y1,
> > + char *dst, const char *src,
> > + uint32_t src_pitch,
> > + uint32_t swizzle_bit,
> > + mem_copy_fn mem_copy)
>
>
> > diff --git a/src/mesa/drivers/dri/i965/intel_tiled_memcpy.h
> b/src/mesa/drivers/dri/i965/intel_tiled_memcpy.h
>
>
> > +/* Tile dimensions. Width and span are in bytes, height is in pixels
> (i.e.
> > + * unitless). A "span" is the most number of bytes we can copy from
> linear
> > + * to tiled without needing to calculate a new destination address.
> > + */
> > +static const uint32_t xtile_width = 512;
> > +static const uint32_t xtile_height = 8;
> > +static const uint32_t xtile_span = 64;
> > +static const uint32_t ytile_width = 128;
> > +static const uint32_t ytile_height = 32;
> > +static const uint32_t ytile_span = 16;
>
> These constants should be moved to .c file if possible. Are they in the
> header for a reason I don't see?
>
>
Nope
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freedesktop.org/archives/mesa-dev/attachments/20150105/86f9b336/attachment.html>
More information about the mesa-dev
mailing list