Bug 70407 - [TexMap][QT] PageClientQt should skip redundant sync requests during Accelerated Composition.
Summary: [TexMap][QT] PageClientQt should skip redundant sync requests during Accelera...
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: WebKit Qt (show other bugs)
Version: 528+ (Nightly build)
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Nobody
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-10-19 03:16 PDT by Dongseong Hwang
Modified: 2011-11-15 23:09 PST (History)
2 users (show)

See Also:


Attachments
patch (3.11 KB, patch)
2011-10-19 03:18 PDT, Dongseong Hwang
noam: review-
noam: commit-queue-
Details | Formatted Diff | Diff
patch (2.89 KB, patch)
2011-11-15 19:49 PST, Dongseong Hwang
noam: review-
noam: commit-queue-
Details | Formatted Diff | Diff
patch (4.23 KB, patch)
2011-11-15 20:34 PST, Dongseong Hwang
no flags Details | Formatted Diff | Diff
patch (4.96 KB, patch)
2011-11-15 20:51 PST, Dongseong Hwang
noam: review-
noam: commit-queue-
Details | Formatted Diff | Diff
patch (4.60 KB, patch)
2011-11-15 22:02 PST, Dongseong Hwang
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Dongseong Hwang 2011-10-19 03:16:15 PDT
The 'shouldSync' variable already exist, but does not be used properly in PageClientQt.cpp.
Comment 1 Dongseong Hwang 2011-10-19 03:18:10 PDT
Created attachment 111585 [details]
patch
Comment 2 Noam Rosenthal 2011-11-03 13:41:10 PDT
Comment on attachment 111585 [details]
patch

View in context: https://bugs.webkit.org/attachment.cgi?id=111585&action=review

I don't understand the problem, and the patch is either way incorrect.
syncLayers should turn the shoulsSync flag off, as by that point we have already synced. There might be an issue with animations, in that case setting the flag should only occur inside the if loop in line 254.

> Source/WebKit/qt/ChangeLog:8
> +        PageClientQt should receives the sync request after actual TexMap drawing.

This sentence does not make sense in English.
Comment 3 Dongseong Hwang 2011-11-14 16:38:53 PST
The "shouldSync" is not used in current code. I wonder which "shouldSync" affects in code.

I thought you created "shouldSync" for following purpose.
1. WebCore callbacks PageClientQGraphicsWidget::syncLayers() in order to invalidate.
2. Before invalidating WebCore callbacks PageClientQGraphicsWidget::syncLayers() so many times.
3. PageClientQGraphicsWidget should invalidate only one time for all sync requests.

I experienced performance largely increased by this patch in my project based on private SDL port in the following site. In detail, from 3fps to 20fps.
http://www.craftymind.com/factory/guimark2/HTML5GamingTest.html

This site requests more than 600 sync requests before invalidating actually.

I'm sorry for my poor English. English is more difficult than C++ to Asian.
Comment 4 Noam Rosenthal 2011-11-14 16:55:08 PST
> I thought you created "shouldSync" for following purpose.
> 1. WebCore callbacks PageClientQGraphicsWidget::syncLayers() in order to invalidate.
No, it should callback markForSync, which starts a timer that calls syncLayers.
The bug is valid but the solution is incorrect. The problem is that we call syncLayers instead of markForSync.


> I'm sorry for my poor English. English is more difficult than C++ to Asian.
No worries; I'm just trying to make sure people can understand the Changelog. Sorry for sounding judgmental!
Comment 5 Dongseong Hwang 2011-11-14 20:28:26 PST
You're welcome.

I understood "shouldSync" is for makeForSync, but I did not understand yet why there is not something like this code.
if (shouldSync)
    doSomething();

Anyway, I am not sure whether the situation related to 600 sync as I mentioned is bug or not.
If it is bug, is it proper to add PageClientQGraphicsWidget's member variable like shouldSync in order to reduce redundant markForSync calls?
Comment 6 Noam Rosenthal 2011-11-14 20:41:11 PST
(In reply to comment #5)
> You're welcome.
> 
> I understood "shouldSync" is for makeForSync, but I did not understand yet why there is not something like this code.
> if (shouldSync)
>     doSomething();
> 
> Anyway, I am not sure whether the situation related to 600 sync as I mentioned is bug or not.
> If it is bug, is it proper to add PageClientQGraphicsWidget's member variable like shouldSync in order to reduce redundant markForSync calls?

Hmmm... looking at it again some of that logic doesn't make sense, and might be leftovers from a previous iteration.
But if we fix it let's do it right!
Maybe the right fix should be to eliminate shouldSync, and to simply start the timer on markForSync?
Comment 7 Dongseong Hwang 2011-11-14 21:54:48 PST
(In reply to comment #6)
> (In reply to comment #5)
> > You're welcome.
> > 
> > I understood "shouldSync" is for makeForSync, but I did not understand yet why there is not something like this code.
> > if (shouldSync)
> >     doSomething();
> > 
> > Anyway, I am not sure whether the situation related to 600 sync as I mentioned is bug or not.
> > If it is bug, is it proper to add PageClientQGraphicsWidget's member variable like shouldSync in order to reduce redundant markForSync calls?
> 
> Hmmm... looking at it again some of that logic doesn't make sense, and might be leftovers from a previous iteration.
> But if we fix it let's do it right!
> Maybe the right fix should be to eliminate shouldSync, and to simply start the timer on markForSync?

line 302, syncTimer.startOneShot(0);
markForSync already simply starts the timer. What is mean?

I think I did not understand wholly what you said, so I hesitated to response more because it might be small problem or not problem.
You means it is better to resolve this bug because of INVALID?
Comment 8 Noam Rosenthal 2011-11-15 04:28:46 PST
> I think I did not understand wholly what you said, so I hesitated to response more because it might be small problem or not problem.
> You means it is better to resolve this bug because of INVALID?
No. It means that the fix is a lot simpler - return early in markForSync if the syncTimer is already active.
Something like

if (syncTimer.isActive())
    return;

You also might want to stop the timer in ::syncLayers.

The bug is actually that we rely on Timer::startOneShot to do nothing if the timer is already running, but that's not how Timer::startOneShot works.
Comment 9 Dongseong Hwang 2011-11-15 19:49:58 PST
Created attachment 115304 [details]
patch

This patch increased performance in following site that is similar to Falling Leaves.
http://www.dorothybrowser.com/test/joybro/leaves/
When clicking '400 leaves', you can feel less lag.
Comment 10 Noam Rosenthal 2011-11-15 19:57:03 PST
Comment on attachment 115304 [details]
patch

Good patch! Please add a Changelog and I'd be happy to review :)
Comment 11 Dongseong Hwang 2011-11-15 20:34:28 PST
Created attachment 115310 [details]
patch

I made mistake. :)
Comment 12 Dongseong Hwang 2011-11-15 20:51:24 PST
Created attachment 115315 [details]
patch

I think this patch should apply PageClientQWidget, also.
Comment 13 Noam Rosenthal 2011-11-15 21:54:53 PST
Comment on attachment 115315 [details]
patch

View in context: https://bugs.webkit.org/attachment.cgi?id=115315&action=review

Almost there. I allowed myself to help reword the changelog entry, trying to make it more concise and clear.

> Source/WebKit/qt/ChangeLog:12
> +        It relieves the load of calling PageClientQWidget::syncLayers redundantly.
> +        It increases TexMap's performance when PageClientQGraphicsWidget::markForSync is
> +        called many times, especially the time to prepare layers and animations.
> +        The bug is actually that we rely on Timer::startOneShot to do nothing if the
> +        timer is already running, but the Timer fires same times that
> +        Timer::startOneShot was called.

How about "Make sure we only activate the synchronization timer in PageClientQWidget/PageClientQGraphicsWidget if it's not already active, otherwise syncLayers may be called redundantly."
Comment 14 Dongseong Hwang 2011-11-15 22:02:32 PST
Created attachment 115320 [details]
patch

Thank you for Good Changelog.
Comment 15 WebKit Review Bot 2011-11-15 23:09:39 PST
Comment on attachment 115320 [details]
patch

Clearing flags on attachment: 115320

Committed r100410: <http://trac.webkit.org/changeset/100410>
Comment 16 WebKit Review Bot 2011-11-15 23:09:44 PST
All reviewed patches have been landed.  Closing bug.