Bug 83665 - [TexmapGL] Reduce the number of glTexSubImage2D calls
Summary: [TexmapGL] Reduce the number of glTexSubImage2D calls
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: WebCore Misc. (show other bugs)
Version: 528+ (Nightly build)
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Igor Trindade Oliveira
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2012-04-10 23:18 PDT by Igor Trindade Oliveira
Modified: 2012-06-16 09:16 PDT (History)
3 users (show)

See Also:


Attachments
Patch (2.80 KB, patch)
2012-04-10 23:24 PDT, Igor Trindade Oliveira
no flags Details | Formatted Diff | Diff
Patch (2.78 KB, patch)
2012-04-11 10:41 PDT, Igor Trindade Oliveira
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Igor Trindade Oliveira 2012-04-10 23:18:05 PDT
When the OpenGLES driver does not support GL_EXT_unpack_subimage, BitmapTextureGL::updateContents is transfering the pixels row by row, sometimes calling glTexSubImage2D more than 40 times. This approach is ok for almost all drivers, however for some low end drivers can be a problem.
Comment 1 Igor Trindade Oliveira 2012-04-10 23:24:24 PDT
Created attachment 136630 [details]
Patch

Proposed patch.
Comment 2 Noam Rosenthal 2012-04-11 05:07:06 PDT
Comment on attachment 136630 [details]
Patch

Any idea if this is actually faster?
Comment 3 Igor Trindade Oliveira 2012-04-11 10:41:13 PDT
Created attachment 136695 [details]
Patch

Proposed patch v2.
Comment 4 Igor Trindade Oliveira 2012-04-11 10:47:07 PDT
i did some tests using callgrind and it shows improvements. But it also depends of the graphics driver, in mali drivers i believe the memory is shared between the cpu and gpu so the old code can be fast.

(In reply to comment #2)
> (From update of attachment 136630 [details])
> Any idea if this is actually faster?
Comment 5 Noam Rosenthal 2012-04-11 11:02:37 PDT
Comment on attachment 136695 [details]
Patch

This still feels a bit like a micro-optimization that might have different results on different graphics drivers... 
I'd rather come back to this after we know the pros/cons better.
Comment 6 Dongseong Hwang 2012-06-15 22:24:47 PDT
I think less glTexSubImage2D call is better, although I have no clue to convince you.

http://origin-developer.nvidia.com/docs/IO/8230/BatchBatchBatch.pdf?q=docs/IO/8230/BatchBatchBatch.pdf
It is be widely known that less drawing call, better performance.

So, I think the fact may apply glTexSubImage2D, also, because glTexSubImage2D causes data transfer from cpu to gpu like drawing call.
Comment 7 Noam Rosenthal 2012-06-16 06:57:55 PDT
Comment on attachment 136695 [details]
Patch

OK, I think you have some merit.
Comment 8 WebKit Review Bot 2012-06-16 09:16:36 PDT
Comment on attachment 136695 [details]
Patch

Clearing flags on attachment: 136695

Committed r120527: <http://trac.webkit.org/changeset/120527>
Comment 9 WebKit Review Bot 2012-06-16 09:16:40 PDT
All reviewed patches have been landed.  Closing bug.