[Mesa-dev] [PATCH 1/3] util: add a simple memcpy path for copying buffers in util_resource_copy_region

Marek Olšák maraeo at gmail.com
Thu Apr 21 09:21:54 PDT 2011


Do we actually allow overlapping copies in Gallium? I thought we don't.

Marek

On Thu, Apr 21, 2011 at 6:00 PM, Ferry Huberts <mailings at hupie.com> wrote:

>
>
> On 04/21/2011 01:11 PM, Marek Olšák wrote:
> > ---
> >  src/gallium/auxiliary/util/u_surface.c |   22 +++++++++++++---------
> >  1 files changed, 13 insertions(+), 9 deletions(-)
> >
> > diff --git a/src/gallium/auxiliary/util/u_surface.c
> b/src/gallium/auxiliary/util/u_surface.c
> > index 9caf76c..43a0266 100644
> > --- a/src/gallium/auxiliary/util/u_surface.c
> > +++ b/src/gallium/auxiliary/util/u_surface.c
> > @@ -188,15 +188,19 @@ util_resource_copy_region(struct pipe_context
> *pipe,
> >     assert(dst_map);
> >
> >     if (src_map && dst_map) {
> > -      util_copy_rect(dst_map,
> > -                     dst_format,
> > -                     dst_trans->stride,
> > -                     0, 0,
> > -                     w, h,
> > -                     src_map,
> > -                     src_trans->stride,
> > -                     0,
> > -                     0);
> > +      if (dst->target == PIPE_BUFFER && src->target == PIPE_BUFFER) {
> > +         memcpy(dst_map, src_map, w);
>
> this will not work if dst_map and src_map overlap...
> if you're sure that they never overlap: ok, else maybe use memmove?
>
>
> grtz
>
> --
> Ferry Huberts
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freedesktop.org/archives/mesa-dev/attachments/20110421/52bc26ef/attachment.htm>


More information about the mesa-dev mailing list