Summary: | LLVMpipe glReadPixels Firefox hits the slow path (WebGL rendering) | ||
---|---|---|---|
Product: | Mesa | Reporter: | Liam Wilson <cosinusoidaly> |
Component: | Mesa core | Assignee: | Brian Paul <brian.e.paul> |
Status: | RESOLVED FIXED | QA Contact: | |
Severity: | normal | ||
Priority: | medium | ||
Version: | 8.0 | ||
Hardware: | x86 (IA32) | ||
OS: | Linux (All) | ||
Whiteboard: | |||
i915 platform: | i915 features: | ||
Attachments: |
do red/blue swizzle in glReadPixels
add another fast path for glReadPixels |
Description
Liam Wilson
2012-04-11 03:51:50 UTC
Created attachment 59889 [details] [review] do red/blue swizzle in glReadPixels Can you try this patch for Mesa/master? If it works I can back port it to the 8.0 branch. (In reply to comment #1) > Created attachment 59889 [details] [review] [review] > do red/blue swizzle in glReadPixels > > Can you try this patch for Mesa/master? If it works I can back port it to the > 8.0 branch. Applied the patch with master. Built with: ./configure --disable-dri --disable-egl --enable-xlib-glx --with-gallium-drivers=swrast This does boost performance when the backing store is MESA_FORMAT_RGBA8888_REV . I found that this is not always the case with Firefox. If you initialise your webgl context with canvas.getContext("experimental-webgl",{alpha: false }) you end up with an MESA_FORMAT_XRGB8888 render buffer. Created attachment 60068 [details] [review] add another fast path for glReadPixels Here's an updated patch that handles the MESA_FORMAT_XRGB888 buffer format. I'm assuming that the format/type params to glReadPixels are still GL_BGRA/GL_UNSIGNED_INT_8_8_8_8_REV. (In reply to comment #3) > Created attachment 60068 [details] [review] [review] > add another fast path for glReadPixels > > Here's an updated patch that handles the MESA_FORMAT_XRGB888 buffer format. > I'm assuming that the format/type params to glReadPixels are still > GL_BGRA/GL_UNSIGNED_INT_8_8_8_8_REV. The patch seems to work if I change if (rb->Format == MESA_FORMAT_XRGB8888_REV ... to if (rb->Format == MESA_FORMAT_XRGB8888 .... Incidentally, couldn't llvmpipe do all this for you? From what I can tell, there are a load of routines generated from lp_tile_soa.py that can do all the conversion for you. I think these conversion routines are used to generate the buffer returned by ctx->Driver.MapRenderbuffer anyway. Or would it be a case of moving the glReadPixels implementaion into Gallium (in the case of llvmpipe)? If so, I'm not sure if I have the skills to do it myself, but I'll have a look around and see what I can do. (In reply to comment #4) > (In reply to comment #3) > > Created attachment 60068 [details] [review] [review] [review] > > add another fast path for glReadPixels > > > > Here's an updated patch that handles the MESA_FORMAT_XRGB888 buffer format. > > I'm assuming that the format/type params to glReadPixels are still > > GL_BGRA/GL_UNSIGNED_INT_8_8_8_8_REV. > > The patch seems to work if I change > > if (rb->Format == MESA_FORMAT_XRGB8888_REV ... > > to > > if (rb->Format == MESA_FORMAT_XRGB8888 .... OK, thanks, I guess I did a bad copy&paste. > Incidentally, couldn't llvmpipe do all this for you? From what I can tell, > there are a load of routines generated from lp_tile_soa.py that can do all the > conversion for you. I think these conversion routines are used to generate the > buffer returned by ctx->Driver.MapRenderbuffer anyway. Or would it be a case of > moving the glReadPixels implementaion into Gallium (in the case of llvmpipe)? > If so, I'm not sure if I have the skills to do it myself, but I'll have a look > around and see what I can do. Doing this change in readpix.c means that all drivers can benefit. Besides, the MapRenderbuffer call has no way of telling the driver that a specific surface format is desired. I'll clean up my patch and post it for review before committing. I think I can back-port this to the 8.0 branch too. Patch committed to mesa with commit a5e95a419e4f6ad93e35a960113d97ae2de27476. This includes a better approach to the swizzling code which in my test was 44% faster than before. Also applied to the 8.0 branch: 49ed43b6de98482c898334a9abfc574720391c9f |
Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.