Join GitHub today
GitHub is home to over 50 million developers working together to host and review code, manage projects, and build software together.
Sign upHandle text runs that need split batches, and reduce allocations. #1689
Conversation
|
r? @nical |
Previously, both the normal text run and text shadow code assumed that all the glyphs in a single text run were placed in the same texture. This is generally true, but not *always*. In particular, a text run that contains a glyph that fits in the texture cache, and one that is too large for the texture cache would trigger this condition. Now, create a text shadow batch per texture ID. For normal text runs, flush and create a new batch each time a glyph is encountered that belongs to a different source texture. Also, remove an allocation per text run by using a shared buffer to store glyphs as they are fetched for a text run. This is a bit untidy - the caller must provide the fetch buffer since the resource cache is considered immutable at this point (batching may be spread across threads in the future). However, since this is such a hot code path on most pages, it's worth it (typically a 10% CPU time saving on pages I tested). The reftests just need to not crash - the content is identical.
|
With this, do we still need the #1597? |
|
@bors-servo r+ |
|
|
bors-servo
added a commit
that referenced
this pull request
Sep 11, 2017
Handle text runs that need split batches, and reduce allocations. Previously, both the normal text run and text shadow code assumed that all the glyphs in a single text run were placed in the same texture. This is generally true, but not *always*. In particular, a text run that contains a glyph that fits in the texture cache, and one that is too large for the texture cache would trigger this condition. Now, create a text shadow batch per texture ID. For normal text runs, flush and create a new batch each time a glyph is encountered that belongs to a different source texture. Also, remove an allocation per text run by using a shared buffer to store glyphs as they are fetched for a text run. This is a bit untidy - the caller must provide the fetch buffer since the resource cache is considered immutable at this point (batching may be spread across threads in the future). However, since this is such a hot code path on most pages, it's worth it (typically a 10% CPU time saving on pages I tested). The reftests just need to not crash - the content is identical. <!-- Reviewable:start --> --- This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/webrender/1689) <!-- Reviewable:end -->
|
|
|
Yup, we still need #1597 - that solves a different issue. @bors-servo retry |
bors-servo
added a commit
that referenced
this pull request
Sep 11, 2017
Handle text runs that need split batches, and reduce allocations. Previously, both the normal text run and text shadow code assumed that all the glyphs in a single text run were placed in the same texture. This is generally true, but not *always*. In particular, a text run that contains a glyph that fits in the texture cache, and one that is too large for the texture cache would trigger this condition. Now, create a text shadow batch per texture ID. For normal text runs, flush and create a new batch each time a glyph is encountered that belongs to a different source texture. Also, remove an allocation per text run by using a shared buffer to store glyphs as they are fetched for a text run. This is a bit untidy - the caller must provide the fetch buffer since the resource cache is considered immutable at this point (batching may be spread across threads in the future). However, since this is such a hot code path on most pages, it's worth it (typically a 10% CPU time saving on pages I tested). The reftests just need to not crash - the content is identical. <!-- Reviewable:start --> --- This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/webrender/1689) <!-- Reviewable:end -->
|
|
|
@bors-servo retry
|
bors-servo
added a commit
that referenced
this pull request
Sep 12, 2017
Handle text runs that need split batches, and reduce allocations. Previously, both the normal text run and text shadow code assumed that all the glyphs in a single text run were placed in the same texture. This is generally true, but not *always*. In particular, a text run that contains a glyph that fits in the texture cache, and one that is too large for the texture cache would trigger this condition. Now, create a text shadow batch per texture ID. For normal text runs, flush and create a new batch each time a glyph is encountered that belongs to a different source texture. Also, remove an allocation per text run by using a shared buffer to store glyphs as they are fetched for a text run. This is a bit untidy - the caller must provide the fetch buffer since the resource cache is considered immutable at this point (batching may be spread across threads in the future). However, since this is such a hot code path on most pages, it's worth it (typically a 10% CPU time saving on pages I tested). The reftests just need to not crash - the content is identical. <!-- Reviewable:start --> --- This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/webrender/1689) <!-- Reviewable:end -->
|
|
This was referenced Sep 12, 2017
Merged
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
glennw commentedSep 11, 2017
•
edited by larsbergstrom
Previously, both the normal text run and text shadow code assumed
that all the glyphs in a single text run were placed in the same
texture. This is generally true, but not always. In particular,
a text run that contains a glyph that fits in the texture cache, and
one that is too large for the texture cache would trigger this condition.
Now, create a text shadow batch per texture ID. For normal text runs,
flush and create a new batch each time a glyph is encountered that
belongs to a different source texture.
Also, remove an allocation per text run by using a shared buffer
to store glyphs as they are fetched for a text run. This is a bit
untidy - the caller must provide the fetch buffer since the resource
cache is considered immutable at this point (batching may be
spread across threads in the future). However, since this is such
a hot code path on most pages, it's worth it (typically a 10% CPU
time saving on pages I tested).
The reftests just need to not crash - the content is identical.
This change is