Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Move hit-test commands to be processed after document rendering. #2343

Merged
merged 1 commit into from Jan 26, 2018

Conversation

@staktrace
Copy link
Contributor

staktrace commented Jan 25, 2018

This adds a new field to DocumentOp, which is a "query" that
update_document is meant to run after doing updates to the document.
HitTest commands now just trigger a render (if needed) but defer the
real work into a query. This ensures the hit-test is still run after the
document is rendered, but is more in line with the structure of the
current code, and does a better job of not violating implicit
assumptions about document rendering/publishing.

This fixes bustage from #2333.


This change is Reviewable

@staktrace
Copy link
Contributor Author

staktrace commented Jan 25, 2018

r? @kvark

@mstange
Copy link
Contributor

mstange commented Jan 25, 2018

So this fixes the flickering? Do we know why, other than "some assumptions were violated"?

@staktrace
Copy link
Contributor Author

staktrace commented Jan 25, 2018

It seems to fix the flickering for me. I don't really know which assumptions were being violated, maybe kvark has a better idea?


let mut op = DocumentOps {
queries: vec![DocumentMsg::HitTest(pipeline_id, point, flags, tx)],
..DocumentOps::nop()

This comment has been minimized.

@kvark

kvark Jan 26, 2018

Member

nit: could have render: doc.render_on_hittest

let doc = self.documents.get_mut(&document_id).unwrap();

match message {
DocumentMsg::HitTest(pipeline_id, point, flags, tx) => {

This comment has been minimized.

@kvark

kvark Jan 26, 2018

Member

let's store the fields of this in a tuple instead of matching the enum again

document_id: DocumentId,
message: DocumentMsg,
) {
let doc = self.documents.get_mut(&document_id).unwrap();

This comment has been minimized.

@kvark

kvark Jan 26, 2018

Member

I think we'd end up with cleaner code if we fully inline this function (no need for separate function here)

@kvark
Copy link
Member

kvark commented Jan 26, 2018

It seems to fix the flickering for me. I don't really know which assumptions were being violated, maybe kvark has a better idea?

I have an idea. tiling::Frame, being a product of scene building carries an important field:

    // List of updates that need to be pushed to the
    // gpu resource cache.
    pub gpu_cache_updates: Option<GpuCacheUpdateList>,

Applying these cache updates is basically synchronizing the RB and Renderer with regards to the GPU cache layout. Dropping those means the Renderer gets de-synchronized, and we end up using older/trashy GPU blocks for actual rendering. For some primitives, that results in geometry changes, for others - texture coordinates, properties, etc.

@kvark
Copy link
Member

kvark commented Jan 26, 2018

Let's get this fix in (after a short cleanup), and I'll think about better ways to enforce the synchronization.

@kvark kvark mentioned this pull request Jan 26, 2018
This adds a new field to DocumentOp, which contains "queries" that
update_document is meant to run after doing updates to the document.
HitTest commands now just trigger a render (if needed) but defer the
real work into a query. This ensures the hit-test is still run after the
document is rendered, but is more in line with the structure of the
current code, and does a better job of not violating implicit
assumptions about document rendering/publishing.

This fixes bustage from #2333.
@staktrace staktrace force-pushed the staktrace:hittest branch from 051d8b8 to 85e0547 Jan 26, 2018
@staktrace
Copy link
Contributor Author

staktrace commented Jan 26, 2018

Patch updated per review comments, let me know if I did it right. I wasn't quite sure I understood correctly what you meant when you said to use a tuple instead. Is it just for performance reasons?

@kvark
kvark approved these changes Jan 26, 2018
Copy link
Member

kvark left a comment

Thanks!

@kvark
Copy link
Member

kvark commented Jan 26, 2018

Is it just for performance reasons?

No, just to avoid a redundant match.

@bors-servo r+

@bors-servo
Copy link
Contributor

bors-servo commented Jan 26, 2018

📌 Commit 85e0547 has been approved by kvark

@bors-servo
Copy link
Contributor

bors-servo commented Jan 26, 2018

Testing commit 85e0547 with merge 99bba34...

bors-servo added a commit that referenced this pull request Jan 26, 2018
Move hit-test commands to be processed after document rendering.

This adds a new field to DocumentOp, which is a "query" that
update_document is meant to run after doing updates to the document.
HitTest commands now just trigger a render (if needed) but defer the
real work into a query. This ensures the hit-test is still run after the
document is rendered, but is more in line with the structure of the
current code, and does a better job of not violating implicit
assumptions about document rendering/publishing.

This fixes bustage from #2333.

<!-- 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/2343)
<!-- Reviewable:end -->
@bors-servo
Copy link
Contributor

bors-servo commented Jan 26, 2018

☀️ Test successful - status-appveyor, status-taskcluster, status-travis
Approved by: kvark
Pushing 99bba34 to master...

@bors-servo bors-servo merged commit 85e0547 into servo:master Jan 26, 2018
3 checks passed
3 checks passed
Taskcluster (pull_request) TaskGroup: success
Details
continuous-integration/appveyor/pr AppVeyor build succeeded
Details
homu Test successful
Details
bors-servo added a commit that referenced this pull request Jan 26, 2018
Track GPU cache frame ID

The PR separates frame rendering from GPU cache updates and enforces their order at run time.
It's supposedly also fixing #2333, but in a different (complimentary!) way from #2343.
cc @staktrace

<!-- 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/2344)
<!-- Reviewable:end -->
@staktrace staktrace deleted the staktrace:hittest branch Jan 26, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked issues

Successfully merging this pull request may close these issues.

None yet

4 participants
You can’t perform that action at this time.