[Mesa-dev] [PATCH 0/7] st/mesa: glReadPixels cache
Nicolai Hähnle
nhaehnle at gmail.com
Wed Jun 15 08:38:29 UTC 2016
Hi,
some applications use successive calls to glReadPixels to read data back.
This typically involves a GPU-based blit for each call for de-tiling or
format conversions (e.g. BGRA -> RGBA). Even when the _mesa_readpixels path
is used, such a blit tends to be hidden behind the transfer operations. The
overhead is rather bad for performance, since we have to wait for GPU idle
each time.
This patch series implements a cache which heuristically does a blit of the
entire framebuffer into a temporary texture once, which is then re-used by
immediately following calls to glReadPixels. The cache remains disabled for
drivers that do not prefer blit based texture transfers, i.e. softpipe/llvmpipe.
Aside from a client's application, this also affects ~1400 piglit tests,
which tend to see speedups of 5-10% with this cache in my tests.
While looking for places that invalidate the cache, I also noticed a few
additional spots where I believe the bitmap cache needs to be flushed. I put
those first in this series.
Please review!
Thanks,
Nicolai
--
src/mesa/state_tracker/st_atom_framebuffer.c | 1 +
src/mesa/state_tracker/st_cb_bitmap.c | 3 +
src/mesa/state_tracker/st_cb_blit.c | 1 +
src/mesa/state_tracker/st_cb_clear.c | 1 +
src/mesa/state_tracker/st_cb_compute.c | 4 +
src/mesa/state_tracker/st_cb_copyimage.c | 4 +
src/mesa/state_tracker/st_cb_drawpixels.c | 2 +
src/mesa/state_tracker/st_cb_drawtex.c | 1 +
src/mesa/state_tracker/st_cb_fbo.h | 2 +
src/mesa/state_tracker/st_cb_readpixels.c | 244 +++++++++++++----
src/mesa/state_tracker/st_cb_texture.c | 12 +
src/mesa/state_tracker/st_context.c | 3 +
src/mesa/state_tracker/st_context.h | 11 +
src/mesa/state_tracker/st_draw.c | 1 +
src/mesa/state_tracker/st_draw_feedback.c | 1 +
src/mesa/state_tracker/st_gen_mipmap.c | 4 +
16 files changed, 237 insertions(+), 58 deletions(-)
More information about the mesa-dev
mailing list