linux-fbdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jon Smirl <jonsmirl@gmail.com>
To: linux-fbdev-devel@lists.sourceforge.net
Cc: Knut Petersen <Knut_Petersen@t-online.de>, Andrew Morton <akpm@osdl.org>
Subject: Re: Fw: framebuffer blitting performance loss 2.6.12 -> 2.6.13-rc3
Date: Fri, 29 Jul 2005 16:21:24 -0400	[thread overview]
Message-ID: <9e4733910507291321609b4c48@mail.gmail.com> (raw)
In-Reply-To: <Pine.LNX.4.56.0507292041110.17988@pentafluge.infradead.org>

On 7/29/05, James Simmons <jsimmons@infradead.org> wrote:
> 
> > Thank you for your persistence.  I think I know the culprit.  Someone
> > insisted on using memcpy in fb_pad_aligned_buffer().  I have already
> > fixed this before, but apparently, the memcpy was brought back.  Try
> > the attached patch and let me know.
> 
> Yipes, I did that. The memcpy function is suppose to be optimized for the
> platform. See string.h in the include/asm directory. I seen for example
> the Athlon would use the 3DNow instruction set to copy data. Something
> is really wrong with memcpy if moving byte by byte is faster !!!!
> Alot of drivers use memcpy. If memcpy sucks then drivers should be copying
> byte by byte then. The question I have is this the case for non intel
> platforms as well. Could someone run the numbers on other platforms?

memmove/memcpy is faster. memcpy is faster than memmove so use it if
you can. But, there is a lower limit probably around 16 bytes or so
where the loop becomes faster.  So if you know that you will always be
copying small fragments use the loop.  The compiler can't decide
between loop/memcpy for you since it doesn't know the upper limit on
the length, it is forced to use memcpy since you told it so.

For small things it is even better use a structure assignment if
possible. That lets the compiler decide to do a loop or memcpy since
the length is known.

In this case if we could figure out how to give the compiler an upper
bound on the loop it might decide to unroll it and use multiple moves.

> 
> > Tony
> >
> >    fbdev: Replace memcpy with for-loop when preparing bitmap
> >
> >     Do not use memcpy in fb_pad_aligned_buffer. It is suboptimal because only
> >     a few bytes are moved at a time. Replace with a for-loop.
> >
> >     From: Antonino Daplas <adaplas@pol.net>
> >     Signed-off-by: Antonino Daplas <adaplas@pol.net>
> > ---
> >
> >  fbmem.c |    6 ++++--
> >  1 files changed, 4 insertions(+), 2 deletions(-)
> >
> > --- a/drivers/video/fbmem.c
> > +++ b/drivers/video/fbmem.c
> > @@ -80,10 +80,12 @@ EXPORT_SYMBOL(fb_get_color_depth);
> >   */
> >  void fb_pad_aligned_buffer(u8 *dst, u32 d_pitch, u8 *src, u32 s_pitch, u32 height)
> >  {
> > -     int i;
> > +     int i, j;
> >
> >       for (i = height; i--; ) {
> > -             memcpy(dst, src, s_pitch);
> > +             /* s_pitch is a few bytes at the most, memcpy is suboptimal */
> > +             for (j = 0; j < s_pitch; j++)
> > +                     dst[j] = src[j];
> >               src += s_pitch;
> >               dst += d_pitch;
> >       }
> >
> >
> > -------------------------------------------------------
> > SF.Net email is Sponsored by the Better Software Conference & EXPO September
> > 19-22, 2005 * San Francisco, CA * Development Lifecycle Practices
> > Agile & Plan-Driven Development * Managing Projects & Teams * Testing & QA
> > Security * Process Improvement & Measurement * http://www.sqe.com/bsce5sf
> > _______________________________________________
> > Linux-fbdev-devel mailing list
> > Linux-fbdev-devel@lists.sourceforge.net
> > https://lists.sourceforge.net/lists/listinfo/linux-fbdev-devel
> >
> 
> 
> -------------------------------------------------------
> SF.Net email is sponsored by: Discover Easy Linux Migration Strategies
> from IBM. Find simple to follow Roadmaps, straightforward articles,
> informative Webcasts and more! Get everything you need to get up to
> speed, fast. http://ads.osdn.com/?ad_id=7477&alloc_id=16492&op=click
> _______________________________________________
> Linux-fbdev-devel mailing list
> Linux-fbdev-devel@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/linux-fbdev-devel
> 


-- 
Jon Smirl
jonsmirl@gmail.com


-------------------------------------------------------
SF.Net email is sponsored by: Discover Easy Linux Migration Strategies
from IBM. Find simple to follow Roadmaps, straightforward articles,
informative Webcasts and more! Get everything you need to get up to
speed, fast. http://ads.osdn.com/?ad_idt77&alloc_id\x16492&op=click

  reply	other threads:[~2005-07-29 20:21 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-07-15 10:39 Fw: framebuffer blitting performance loss 2.6.12 -> 2.6.13-rc3 Andrew Morton
2005-07-22  3:58 ` Antonino A. Daplas
2005-07-29  7:17   ` Andrew Morton
2005-07-29 14:54     ` Knut Petersen
2005-07-29 15:42       ` Antonino A. Daplas
2005-07-29 19:02         ` Andrew Morton
2005-07-29 19:52           ` James Simmons
2005-07-29 19:59           ` James Simmons
2005-07-29 19:51         ` James Simmons
2005-07-29 20:21           ` Jon Smirl [this message]
2005-07-29 22:45             ` Antonino A. Daplas
2005-08-03 17:29               ` James Simmons
2005-07-29 22:45           ` Luca
2005-07-29 20:10         ` Knut Petersen

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=9e4733910507291321609b4c48@mail.gmail.com \
    --to=jonsmirl@gmail.com \
    --cc=Knut_Petersen@t-online.de \
    --cc=akpm@osdl.org \
    --cc=linux-fbdev-devel@lists.sourceforge.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).