Re: [AD] Using memmove in blit()? |
[ Thread Index |
Date Index
| More lists.liballeg.org/allegro-developers Archives
]
On 2006-03-09, Evert Glebbeek <eglebbk@xxxxxxxxxx> wrote:
> On Monday 30 January 2006 23:49, Evert Glebbeek wrote:
> > On Sunday 22 January 2006 21:03, George Foot wrote:
> > > On the ARM architecture (GP2X), memcpy is about a million times faster
> > > than Allegro's normal blit (ok, maybe only about 2 times faster...).
> > > This is for screen-to-screen blitting, which is just a normal linear
> > > bitmap but in uncached memory, and accessed through mmapping.
> >
> > It seems that on the Mac, the memcpy version is also noticably faster
> > [http://www.allegro.cc/forums/thread/562923#target]. So as far as I can
> > see that brings the score to `some systems benefit a lot' and `some
> > systems don't care at all.'
> > Anyone opposed to applying (a cleaned up version of) the patch?
>
> Apparently no one objected, but I'm reattaching the patch anyway before I
> apply it.
>
> Serge Semashko: please check how ths patch fares on your Nokia. Does it
> offer a speed increase there too?
>
> Evert
> Index: src/c/cblit.h
> ===================================================================
> --- src/c/cblit.h (revision 5662)
> +++ src/c/cblit.h (working copy)
> @@ -45,6 +45,8 @@
>
>
>
> +#define USE_MEMMOVE
> +
Would this be better off at the top of the file?
> /* _linear_blit:
> * Normal forward blitting for linear bitmaps.
> */
> @@ -60,6 +62,7 @@
> PIXEL_PTR s = OFFSET_PIXEL_PTR(bmp_read_line(src, sy + y), sx);
> PIXEL_PTR d = OFFSET_PIXEL_PTR(bmp_write_line(dst, dy + y), dx);
>
> + #ifndef USE_MEMMOVE
> for (x = w - 1; x >= 0; INC_PIXEL_PTR(s), INC_PIXEL_PTR(d), x--) {
> unsigned long c;
>
> @@ -69,6 +72,9 @@
> bmp_select(dst);
> PUT_PIXEL(d, c);
> }
> + #else
> + memmove(d, s, w * sizeof *s);
> + #endif
> }
Please either unindent the #-lines or indent the code further one step.
>
> bmp_unwrite_line(src);
> @@ -77,6 +83,8 @@
>
>
>
> +#undef USE_MEMMOVE
> +
> /* _linear_blit_backward:
> * Reverse blitting routine, for overlapping linear bitmaps.
> */
Why is the #undef there?
Peter