Last Comment Bug 915234 - implement gralloc-backed tiles
: implement gralloc-backed tiles
Status: RESOLVED FIXED
:
Product: Core
Classification: Components
Component: Graphics (show other bugs)
: unspecified
: ARM Gonk (Firefox OS)
-- normal (vote)
: mozilla30
Assigned To: Chris Lord [:cwiiis]
:
: Milan Sreckovic [:milan] (PTO through 8/30)
Mentors:
Depends on:
Blocks: b2g-tiling
  Show dependency treegraph
 
Reported: 2013-09-11 09:07 PDT by Brad Lassey [:blassey] (use needinfo?)
Modified: 2014-03-10 05:19 PDT (History)
11 users (show)
See Also:
Crash Signature:
(edit)
QA Whiteboard:
Iteration: ---
Points: ---
Has Regression Range: ---
Has STR: ---


Attachments
[WIP] changes since the last common revision with m-c (167.29 KB, patch)
2014-02-27 05:04 PST, Nicolas Silva [:nical]
no flags Details | Diff | Splinter Review
[WIP] changes since the last common revision with m-c (167.27 KB, patch)
2014-02-27 05:08 PST, Nicolas Silva [:nical]
no flags Details | Diff | Splinter Review
[WIP] changes since the last common revision with m-c (190.97 KB, patch)
2014-03-06 08:37 PST, Nicolas Silva [:nical]
no flags Details | Diff | Splinter Review

Description User image Brad Lassey [:blassey] (use needinfo?) 2013-09-11 09:07:18 PDT

    
Comment 1 User image Chris Lord [:cwiiis] 2014-02-20 07:37:25 PST
I've implemented this on the tiling branch: http://hg.mozilla.org/users/bschouten_mozilla.com/tiling

Initial results are not good - our current Gralloc TextureSource has a very expensive BindTexture implementation (most of the time on a profile is spent in EGLImageTargetTexture2D). This may or may not be helped by state tracking, but it may just be an attribute of gralloc that is has an expensive bind. This would make it a bad choice for using with tiles, in this way at least.

We're experimenting and trying to think of alternatives. Here's a few:

- Don't use Gralloc for tiles and just use the shmem path (that works quite well and seems to perform adequately for our use-case)
- Don't use Gralloc, but use EGLImage to move the texture upload into either another thread, or onto the content process
- Copy from the gralloc texture to another texture (and hopefully this is faster than uploading from shmem, or it'd be pointless)
- Find out why using Gralloc in this way is slow and see if there's anything that can be done, at either application or driver level (we have this kind of relationship, right?)
Comment 2 User image Chris Lord [:cwiiis] 2014-02-20 08:10:42 PST
Here's a profile runnning with full-tilt composition with a tiled layer visible on a buri device: http://people.mozilla.org/~bgirard/cleopatra/#report=df0e68a9c498a953717b6fdec4c1119a9d7ca7d0

This is running on the tree linked to in comment #1.

It'd be great to have some feedback/suggestions from someone who has access to the driver code, so needinfo'ing Diego Wilson.
Comment 3 User image James Willcox (:snorp) (jwillcox@mozilla.com) 2014-02-20 08:22:15 PST
(In reply to Chris Lord [:cwiiis] from comment #1)
> - Don't use Gralloc, but use EGLImage to move the texture upload into either
> another thread, or onto the content process

We were thinking about this way back when the Fennec native rewrite was going on, and I still think it could be a solid idea.
Comment 4 User image James Hicks 2014-02-20 10:45:12 PST
Are your textures 32-byte aligned? If not, that could be the reason for the performance hit.
Comment 5 User image Chris Lord [:cwiiis] 2014-02-20 13:56:49 PST
We deduced the performance hit was due to contention on the texture used to bind the gralloc buffer, and we have a fix :)
Comment 6 User image Nicolas Silva [:nical] 2014-02-27 04:58:56 PST
here is a try push with the current state of the (European) tiling branch https://tbpl.mozilla.org/?tree=Try&rev=d20ab77f8a51
Comment 7 User image Nicolas Silva [:nical] 2014-02-27 05:04:31 PST
Created attachment 8382983 [details] [diff] [review]
[WIP] changes since the last common revision with m-c

To get an idea of what's changed in the branch
Comment 8 User image Nicolas Silva [:nical] 2014-02-27 05:08:23 PST
Created attachment 8382984 [details] [diff] [review]
[WIP] changes since the last common revision with m-c

The previous diff was backward, sorry for the spam.
Comment 9 User image Nicolas Silva [:nical] 2014-02-28 00:40:32 PST
new try push https://tbpl.mozilla.org/?tree=Try&rev=8d4135de9be2
Comment 10 User image Jeff Muizelaar [:jrmuizel] 2014-03-05 10:37:20 PST
new try push https://tbpl.mozilla.org/?tree=Try&rev=01e3a84d93e4
Comment 11 User image Nicolas Silva [:nical] 2014-03-06 08:37:29 PST
Created attachment 8386854 [details] [diff] [review]
[WIP] changes since the last common revision with m-c
Comment 12 User image Chris Lord [:cwiiis] 2014-03-08 17:49:32 PST
https://hg.mozilla.org/mozilla-central/rev/8394fed3332e

Note You need to log in before you can comment on or make changes to this bug.