Closed
Bug 1391159
Opened 7 years ago
Closed 7 years ago
Shader creation of WebRender took long time
Categories
(Core :: Graphics: WebRender, enhancement, P1)
Core
Graphics: WebRender
Tracking
()
RESOLVED
FIXED
mozilla57
Tracking | Status | |
---|---|---|
firefox56 | --- | unaffected |
firefox57 | --- | unaffected |
firefox59 | --- | fixed |
People
(Reporter: sotaro, Assigned: sotaro)
References
Details
(Keywords: stale-bug, Whiteboard: [wr-mvp])
Attachments
(3 files, 14 obsolete files)
2.90 KB,
text/plain
|
Details | |
11.01 KB,
patch
|
nical
:
review+
|
Details | Diff | Splinter Review |
1.63 KB,
patch
|
Details | Diff | Splinter Review |
When WebRender is enabled, some shader creations happened on 2nd rendering. Each shader creation took 50ms - 150ms, then 2nd webrender rendering took about 600ms - 1000ms. The duration of 2nd composition was depended on PC.
Assignee | ||
Updated•7 years ago
|
Blocks: stage-wr-nightly
Assignee | ||
Comment 1•7 years ago
|
||
I used the patch to quickly measure shaders creation time.
Assignee: nobody → sotaro.ikeda.g
Assignee | ||
Updated•7 years ago
|
Assignee: sotaro.ikeda.g → nobody
Assignee | ||
Comment 2•7 years ago
|
||
Measured shaders creation time with attachment 8898127 [details] [diff] [review]. It was measured on Lenovo P50(windows).
Each shader creation took 43 ms - 151 ms and 2nd webrender rendering took 841ms.
Assignee | ||
Comment 3•7 years ago
|
||
The following is an advice by Jeff Gilbert via E-mail.
-------------------------------------------------------------------------
My instinct here is that WR should keep a global shader cache itself.
We do want a shader cache system for WebGL as well, so if we can kill
two birds with one stone here, that would be a plus.
I don't think we should try to embed shader caching in GLContext transparently.
Straw-man:
class ShaderProgramCache
{
map<Hasher::HashT, RefPtr<ProgramBinary>> cache;
struct ProgramBinary : public RefCounted<ProgramBinary> {
GLenum format;
UniqueBuffer bytes;
uint32_t byteLen;
};
void Link(GLContext* gl, GLuint progId, const char* vertSource,
const char* fragSource) {
Hasher hasher;
hasher.digest(gl->mRendererString);
hasher.digest(vertSource);
hasher.digest(fragSource);
const auto hash = hasher.get();
const auto itr = cache.find(hash);
if (itr != cache.end()) {
const auto& bin = itr->second;
gl->fProgramBinary(progId, bin->format, bin->bytes, bin->byteLen);
return;
}
gl->fLinkProgram(progId);
GLenum status = 0;
gl->fGetProgramiv(progId, LOCAL_GL_LINK_STATUS, (GLint*)&status);
if (!status)
return;
RefPtr<ProgramBinary> bin = new ProgramBinary;
gl->fGetProgramiv(progId, LOCAL_GL_PROGRAM_BINARY_LENGTH,
(GLint*)&bin->byteLen);
bin->bytes = malloc(bin->byteLen);
if (!bin->bytes)
return;
gl->fGetProgramBinary(progId, bin->byteLen, nullptr, &bin->format,
bin->bytes.get());
cache.insert({hash, bin});
}
};
Optional requirements:
- Async linking
- Serialize to/from blob/disk
Assignee | ||
Updated•7 years ago
|
Attachment #8898130 -
Attachment description: log - mearured shader creation time → log - mearured shader creation time on Lenovo P50
Assignee | ||
Comment 5•7 years ago
|
||
See Also: → https://github.com/servo/webrender/pull/1588
Assignee | ||
Updated•7 years ago
|
See Also: → https://github.com/servo/webrender/pull/1596
Assignee | ||
Updated•7 years ago
|
See Also: → https://github.com/servo/webrender/pull/1584
Assignee | ||
Updated•7 years ago
|
See Also: → https://github.com/servo/webrender/pull/1585
Assignee | ||
Updated•7 years ago
|
See Also: → https://github.com/servo/webrender/pull/1595
Assignee | ||
Updated•7 years ago
|
See Also: → https://github.com/servo/webrender/pull/1600
Assignee | ||
Updated•7 years ago
|
See Also: → https://github.com/servo/webrender/pull/1625
Assignee | ||
Updated•7 years ago
|
See Also: → https://github.com/servo/webrender/pull/1643
Updated•7 years ago
|
Priority: -- → P3
Updated•7 years ago
|
Status: NEW → ASSIGNED
Priority: P3 → P1
Whiteboard: [wr-mvp]
Target Milestone: --- → mozilla57
Updated•7 years ago
|
status-firefox56:
--- → unaffected
status-firefox57:
--- → unaffected
Keywords: stale-bug
Assignee | ||
Comment 7•7 years ago
|
||
Assignee | ||
Updated•7 years ago
|
See Also: → https://github.com/servo/gleam/pull/132
Assignee | ||
Updated•7 years ago
|
See Also: https://github.com/servo/webrender/pull/1588,
https://github.com/servo/webrender/pull/1596,
https://github.com/servo/webrender/pull/1584,
https://github.com/servo/webrender/pull/1585,
https://github.com/servo/webrender/pull/1595,
https://github.com/servo/webrender/pull/1600,
https://github.com/servo/webrender/pull/1625,
https://github.com/servo/webrender/pull/1643 →
Assignee | ||
Comment 8•7 years ago
|
||
Without glProgramBinary usage, each shader compiling took 60ms - 500ms with ANGLE on P90(Win10).
With glProgramBinary usage, each shader load became 4ms - 10ms with ANGLE on P90(Win10).
Assignee | ||
Comment 9•7 years ago
|
||
Attachment #8925862 -
Attachment is obsolete: true
Assignee | ||
Comment 10•7 years ago
|
||
(In reply to Sotaro Ikeda [:sotaro] from comment #3)
> The following is an advice by Jeff Gilbert via E-mail.
>
> -------------------------------------------------------------------------
>
> I don't think we should try to embed shader caching in GLContext
> transparently.
>
> Optional requirements:
> - Async linking
> - Serialize to/from blob/disk
:jgilbert, can you explain more about "Async linking"? Thanks!
Assignee | ||
Updated•7 years ago
|
Flags: needinfo?(jgilbert)
Assignee | ||
Comment 11•7 years ago
|
||
Attachment #8926184 -
Attachment is obsolete: true
Assignee | ||
Updated•7 years ago
|
Attachment #8927700 -
Attachment description: patch_tmp_binary_10 → wip
Assignee | ||
Comment 12•7 years ago
|
||
Attachment #8927700 -
Attachment is obsolete: true
Assignee | ||
Comment 13•7 years ago
|
||
Attachment #8927747 -
Attachment is obsolete: true
Assignee | ||
Comment 14•7 years ago
|
||
(In reply to Sotaro Ikeda [:sotaro] from comment #3)
>
> Optional requirements:
> - Async linking
> - Serialize to/from blob/disk
Optional requirements is going to be handled in different bugs.
Assignee | ||
Comment 15•7 years ago
|
||
(In reply to Sotaro Ikeda [:sotaro] from comment #14)
> (In reply to Sotaro Ikeda [:sotaro] from comment #3)
> >
> > - Serialize to/from blob/disk
Bug 1418202 is created for it.
Assignee | ||
Comment 16•7 years ago
|
||
Attachment #8928483 -
Attachment is obsolete: true
Assignee | ||
Comment 17•7 years ago
|
||
Assignee | ||
Comment 18•7 years ago
|
||
Attachment #8929358 -
Attachment is obsolete: true
Assignee | ||
Comment 19•7 years ago
|
||
For now, ProgramBinary is necessary for windows. On my linux PC, I did not see performance improvement.
Assignee | ||
Comment 20•7 years ago
|
||
Comment on attachment 8929359 [details] [diff] [review]
patch - handle WebRender ProgramBinary usage
:nical, can you feedback to the patch?
Attachment #8929359 -
Flags: feedback?(nical.bugzilla)
Comment 21•7 years ago
|
||
Comment on attachment 8929359 [details] [diff] [review]
patch - handle WebRender ProgramBinary usage
Review of attachment 8929359 [details] [diff] [review]:
-----------------------------------------------------------------
Looks sane.
Attachment #8929359 -
Flags: feedback?(nical.bugzilla) → feedback+
Assignee | ||
Comment 22•7 years ago
|
||
Attachment #8929353 -
Attachment is obsolete: true
Assignee | ||
Updated•7 years ago
|
See Also: → https://github.com/servo/webrender/pull/2032
Assignee | ||
Updated•7 years ago
|
Attachment #8929359 -
Attachment is obsolete: true
Assignee | ||
Updated•7 years ago
|
See Also: → https://github.com/servo/webrender/pull/2064
Assignee | ||
Comment 23•7 years ago
|
||
Attachment #8930062 -
Attachment is obsolete: true
Assignee | ||
Comment 24•7 years ago
|
||
Assignee | ||
Updated•7 years ago
|
Attachment #8925813 -
Attachment description: patch - Add log to measure shader creation time → temporal patch - Add log to measure shader creation time
Assignee | ||
Updated•7 years ago
|
Attachment #8930367 -
Attachment is obsolete: true
Assignee | ||
Comment 25•7 years ago
|
||
Attachment #8930369 -
Attachment is obsolete: true
Assignee | ||
Comment 26•7 years ago
|
||
Attachment #8931569 -
Attachment is obsolete: true
Assignee | ||
Comment 27•7 years ago
|
||
Attachment #8925813 -
Attachment is obsolete: true
Assignee | ||
Comment 28•7 years ago
|
||
Assignee | ||
Updated•7 years ago
|
Attachment #8931570 -
Attachment description: patch - handle WebRender ProgramBinary usage → patch - Handle WebRender ProgramBinary usage
Assignee | ||
Comment 29•7 years ago
|
||
Assignee | ||
Updated•7 years ago
|
Attachment #8931570 -
Flags: review?(nical.bugzilla)
Comment 30•7 years ago
|
||
Comment on attachment 8931570 [details] [diff] [review]
patch - Handle WebRender ProgramBinary usage
Review of attachment 8931570 [details] [diff] [review]:
-----------------------------------------------------------------
Looks good!
Attachment #8931570 -
Flags: review?(nical.bugzilla) → review+
Comment 31•7 years ago
|
||
Pushed by sikeda@mozilla.com:
https://hg.mozilla.org/integration/mozilla-inbound/rev/7e60ad275b73
Handle WebRender ProgramBinary usage r=nical
Comment 32•7 years ago
|
||
bugherder |
Comment 33•7 years ago
|
||
(In reply to Sotaro Ikeda [:sotaro] from comment #10)
> (In reply to Sotaro Ikeda [:sotaro] from comment #3)
> > The following is an advice by Jeff Gilbert via E-mail.
> >
> > -------------------------------------------------------------------------
> >
> > I don't think we should try to embed shader caching in GLContext
> > transparently.
> >
> > Optional requirements:
> > - Async linking
> > - Serialize to/from blob/disk
>
> :jgilbert, can you explain more about "Async linking"? Thanks!
Async linking is where we call LinkProgram for all programs before querying the LINK_STATUS for any of them. This lets the driver do linking in parallel. I believe ANGLE supports this, or something similar.
Flags: needinfo?(jgilbert)
You need to log in
before you can comment on or make changes to this bug.
Description
•