[Mesa-dev] [PATCH 0/2] Speedup mesa glReadPixels

Martin Andersson g02maran at gmail.com
Sun Mar 10 15:05:02 PDT 2013


My motivation for trying to improve the speed of glReadPixels was the
screenshooter in weston. It took about 2.3 seconds to take a 1920x1200 
screenshot on my machine (Intel Core i7 with AMD 6950).

The first issue was that because the type was GL_UNSIGNED_BYTE it was
hitting the slow path. After looking in other parts of mesa it seemed to
me that GL_UNSIGNED_BYTE could be treated in the same way as
GL_UNSIGNED_INT_8_8_8_8_REV (I could very well be wrong though). That
is the first patch.

But even after hitting the fast path it was quite slow, it now took 0.8
seconds to take a screenshot. Then I found an earlier revision of that
fast memcpy code and that got the time down to 0.2 seconds. The second
patch is a slightly modifed version of that code.

I tried to run some piglit test to verify the code, but i could not
complete a run without lockups, without my patches, of course. I tried 
all.tests, quick.tests and r600.tests. The sanity.tests worked but it 
does not hit the fast path.

Martin Andersson (2):
  mesa: Add GL_UNSIGNED_BYTE fast-path to fast_read_rgba_pixels_memcpy
  mesa: Speedup the xrgb -> argb special case in
    fast_read_rgba_pixels_memcpy

 src/mesa/main/readpix.c | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

-- 
1.8.1.5



More information about the mesa-dev mailing list