After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 694988 - Avoid unnecessary full stage redraws
Avoid unnecessary full stage redraws
Status: RESOLVED FIXED
Product: gnome-shell
Classification: Core
Component: general
unspecified
Other Linux
: Normal normal
: ---
Assigned To: gnome-shell-maint
gnome-shell-maint
Depends on:
Blocks:
 
 
Reported: 2013-03-02 12:30 UTC by drago01
Modified: 2013-03-04 23:03 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
meta-window-group: Report a paint volume (1.23 KB, patch)
2013-03-02 12:32 UTC, drago01
committed Details | Review
meta-background-group: Report a paint volume (1.44 KB, patch)
2013-03-02 12:32 UTC, drago01
committed Details | Review
compositor: Don't connect to the stage's paint signal (1.62 KB, patch)
2013-03-02 12:32 UTC, drago01
committed Details | Review
shell-global: Don't connect to the stage's paint signal (2.24 KB, patch)
2013-03-02 12:33 UTC, drago01
committed Details | Review
st-icon: Don't cause a redraw by replacing the icon with itself (3.59 KB, patch)
2013-03-02 13:07 UTC, drago01
reviewed Details | Review
st-icon: Don't cause a redraw by replacing the icon with itself (1.86 KB, patch)
2013-03-02 20:52 UTC, drago01
committed Details | Review

Description drago01 2013-03-02 12:30:35 UTC
The patches I am going to attach here fix:

Clutter-Message: [           +7514]:[CLIPPING]:./clutter-actor.c:16927: Bail from get_paint_volume (<unnamed>[<MetaWindowGroup>:0x2154080]): Actor failed to report a volume
Clutter-Message: [           +7526]:[CLIPPING]:./clutter-actor.c:3388: Bail from update_last_paint_volume (<unnamed>[<MetaWindowGroup>:0x2154080]): Actor failed to report a paint volume
Clutter-Message: [           +7546]:[CLIPPING]:./clutter-actor.c:3340: Bail from cull_actor without culling (<unnamed>[Clutter-Message: [            +262]:[CLIPPING]:./cogl/clutter-stage-cogl.c:533: Stage clip pushed: x=0, y=0, width=1920, height=1080




Clutter-Message: [            +319]:[CLIPPING]:./clutter-stage.c:661: Setting stage clip too: x=0,000000, y=0,000000, width=1920,000000, height=1080,000000
Clutter-Message: [            +346]:[CLIPPING]:./clutter-actor.c:16916: Bail from get_paint_volume (<unnamed>[<ClutterStage>:0x20ec4a0]): Actor has "paint" signal handlers
Clutter-Message: [            +368]:[CLIPPING]:./clutter-actor.c:3388: Bail from update_last_paint_volume (<unnamed>[<ClutterStage>:0x20ec4a0]): Actor failed to report a paint volume
Clutter-Message: [            +385]:[CLIPPING]:./clutter-actor.c:3340: Bail from cull_actor without culling (<unnamed>[<ClutterStage>:0x20ec4a0]): ->last_paint_volume_valid == FALSE
Clutter-Message: [     12889683294]:[CLIPPING]:./clutter-stage.c:4032: stage_queue_actor_redraw (actor=<unnamed>[<MetaBackgroundGroup>:0x28eee40], clip=(nil)): 
Clutter-Message: [            +114]:[CLIPPING]:./clutter-stage.c:4032: stage_queue_actor_redraw (actor=<unnamed>[<MetaBackgroundGroup>:0x28eeaf0], clip=(nil)): 
Clutter-Message: [            +193]:[CLIPPING]:./clutter-actor.c:16876: Bail from get_paint_volume (<unnamed>[<MetaBackgroundGroup>:0x28eeaf0]): Actor needs allocation
Clutter-Message: [            +235]:[CLIPPING]:./cogl/clutter-stage-cogl.c:492: Reusing back buffer - repairing region: x=0, y=0, width=1920, height=1080

<MetaWindowGroup>:0x2154080]): ->last_paint_volume_valid == FALSE
Clutter-Message: [           +8031]:[CLIPPING]:./clutter-actor.c:16927: Bail from get_paint_volume (<unnamed>[<MetaWindowGroup>:0x21543a0]): Actor failed to report a volume
Clutter-Message: [           +8048]:[CLIPPING]:./clutter-actor.c:3388: Bail from update_last_paint_volume (<unnamed>[<MetaWindowGroup>:0x21543a0]): Actor failed to report a paint volume


Clutter-Message: [          +85305]:[CLIPPING]:./clutter-stage.c:661: Setting stage clip too: x=0,000000, y=0,000000, width=1920,000000, height=1080,000000
Clutter-Message: [          +85331]:[CLIPPING]:./clutter-actor.c:16916: Bail from get_paint_volume (<unnamed>[<ClutterStage>:0x128b4a0]): Actor has "paint" signal handlers
Clutter-Message: [          +85342]:[CLIPPING]:./clutter-actor.c:3388: Bail from update_last_paint_volume (<unnamed>[<ClutterStage>:0x128b4a0]): Actor failed to report a paint volume
Clutter-Message: [          +85356]:[CLIPPING]:./clutter-actor.c:3340: Bail from cull_actor without culling (<unnamed>[<ClutterStage>:0x128b4a0]): ->last_paint_volume_valid == FALSE
p>:0x21543a0]): ->last_paint_volume_valid == FALSE
Comment 1 drago01 2013-03-02 12:32:07 UTC
Created attachment 237784 [details] [review]
meta-window-group: Report a paint volume

We never paint outside of the allocation so we can simply use
clutter_paint_volume_set_from_allocation.
Comment 2 drago01 2013-03-02 12:32:11 UTC
Created attachment 237785 [details] [review]
meta-background-group: Report a paint volume

We never paint outside of the allocation so we can simply use
clutter_paint_volume_set_from_allocation.
Comment 3 drago01 2013-03-02 12:32:16 UTC
Created attachment 237786 [details] [review]
compositor: Don't connect to the stage's paint signal

Doing so causes useless full stage redraws and breaks culling
as clutter cannot know how the signal handler affects painting.

So use clutter_threads_add_repaint_func_full with the
CLUTTER_REPAINT_FLAGS_POST_PAINT flag instead.
Comment 4 drago01 2013-03-02 12:33:06 UTC
Created attachment 237787 [details] [review]
shell-global: Don't connect to the stage's paint signal

Doing so causes useless full stage redraws and breaks culling
as clutter cannot know how the signal handler affects painting.

So use clutter_threads_add_repaint_func_full instead.
Comment 5 drago01 2013-03-02 13:07:19 UTC
Created attachment 237789 [details] [review]
st-icon: Don't cause a redraw by replacing the icon with itself

Check if the two icons match before setting a new icon, if they do don't
do anything.


---

Owen posted this one on IRC a few days ago ... worth adding to the
"kill redraws" patches.
Comment 6 Giovanni Campagna 2013-03-02 13:29:41 UTC
Review of attachment 237789 [details] [review]:

I'd rather you use g_icon_equal() instead, and to avoid having a different behaviors for icon_name (which is the semi-deprecated interface) and gicon with a GThemedIcon
Also, the power part should be unnecessary, once you do that in StIcon.
Comment 7 Giovanni Campagna 2013-03-02 13:32:05 UTC
Review of attachment 237784 [details] [review]:

Are we sure that we never paint outside the allocation (including during workspace switching effects)?
Also, why isn't clutter doing the right thing by default here?
Comment 8 Giovanni Campagna 2013-03-02 13:33:02 UTC
Review of attachment 237785 [details] [review]:

Same here: are we sure we *never* paint outside the allocation? What about the blur effect in MetaBackground?
Comment 9 drago01 2013-03-02 13:36:53 UTC
(In reply to comment #8)
> Review of attachment 237785 [details] [review]:
> 
> Same here: are we sure we *never* paint outside the allocation? What about the
> blur effect in MetaBackground?

Yes look at meta_background_paint_content.
Comment 10 drago01 2013-03-02 13:40:00 UTC
(In reply to comment #7)
> Review of attachment 237784 [details] [review]:
> 
> Are we sure that we never paint outside the allocation (including during
> workspace switching effects)?

Yes I cannot think of any case where we would paint outside of the allocation (the workspace switching effect reparents the windows away from us so this does not really matter).

> Also, why isn't clutter doing the right thing by default here?

Clutter cannot assume that we don't draw outside of our allocation, that would be kind of an API break.
Comment 11 Giovanni Campagna 2013-03-02 13:40:13 UTC
Review of attachment 237786 [details] [review]:

Ok
Comment 12 Giovanni Campagna 2013-03-02 13:40:40 UTC
Review of attachment 237787 [details] [review]:

Ok
Comment 13 drago01 2013-03-02 13:42:37 UTC
Comment on attachment 237786 [details] [review]
compositor: Don't connect to the stage's paint signal

Attachment 237786 [details] pushed as 4f2bb58 - compositor: Don't connect to the stage's paint signal
Comment 14 drago01 2013-03-02 13:43:28 UTC
Comment on attachment 237787 [details] [review]
shell-global: Don't connect to the stage's paint signal

Attachment 237787 [details] pushed as 071a4e5 - shell-global: Don't connect to the stage's paint signal
Comment 15 drago01 2013-03-02 13:44:11 UTC
(In reply to comment #6)
> Review of attachment 237789 [details] [review]:
> 
> I'd rather you use g_icon_equal() instead, and to avoid having a different
> behaviors for icon_name (which is the semi-deprecated interface) and gicon with
> a GThemedIcon
> Also, the power part should be unnecessary, once you do that in StIcon.

Yeah that makes sense .. all I did was just adding a commit message other then "stuff" and attach it here.
Comment 16 Giovanni Campagna 2013-03-02 13:48:38 UTC
(In reply to comment #10)
> (In reply to comment #7)
> > Review of attachment 237784 [details] [review] [details]:
> > 
> > Are we sure that we never paint outside the allocation (including during
> > workspace switching effects)?
> 
> Yes I cannot think of any case where we would paint outside of the allocation
> (the workspace switching effect reparents the windows away from us so this does
> not really matter).

No it doesn't: it reparents window actors inside groups, but then the groups are added to the window_group (windowManager.js:573)

> > Also, why isn't clutter doing the right thing by default here?
> 
> Clutter cannot assume that we don't draw outside of our allocation, that would
> be kind of an API break.

But Clutter implements the default paint volume function by unioning the paint volume of all children, which should give the right result here.
(I understand it is slower, because of software transforms, so I'm ok with the shortcut, if we are sure that we never paint outside)

(In reply to comment #9)
> (In reply to comment #8)
> > Review of attachment 237785 [details] [review] [details]:
> > 
> > Same here: are we sure we *never* paint outside the allocation? What about the
> > blur effect in MetaBackground?
> 
> Yes look at meta_background_paint_content.

Uh, you're right.
Comment 17 drago01 2013-03-02 14:14:30 UTC
(In reply to comment #16)
> (In reply to comment #10)
> > (In reply to comment #7)
> > > Review of attachment 237784 [details] [review] [details] [details]:
> > > 
> > > Are we sure that we never paint outside the allocation (including during
> > > workspace switching effects)?
> > 
> > Yes I cannot think of any case where we would paint outside of the allocation
> > (the workspace switching effect reparents the windows away from us so this does
> > not really matter).
> 
> No it doesn't: it reparents window actors inside groups, but then the groups
> are added to the window_group (windowManager.js:573)

Hmm indeed.

> > > Also, why isn't clutter doing the right thing by default here?
> > 
> > Clutter cannot assume that we don't draw outside of our allocation, that would
> > be kind of an API break.
> 
> But Clutter implements the default paint volume function by unioning the paint
> volume of all children, which should give the right result here.

It doesn't it fails to report a paint volume in a lot of cases with:

Clutter-Message: [           +7514]:[CLIPPING]:./clutter-actor.c:16927: Bail
from get_paint_volume (<unnamed>[<MetaWindowGroup>:0x2154080]): Actor failed to
report a volume

Which was the reason for the patch.

> (I understand it is slower, because of software transforms, so I'm ok with the
> shortcut, if we are sure that we never paint outside)

Being slower is not the only issue though, breaking culling / clipped redraws is .. if we can't take the shortcut we need to go and figure out what causes us to get no paint volume.
Comment 18 drago01 2013-03-02 14:29:45 UTC
(In reply to comment #16)
> (In reply to comment #9)
> > (In reply to comment #8)
> > > Review of attachment 237785 [details] [review] [details] [details]:
> > > 
> > > Same here: are we sure we *never* paint outside the allocation? What about the
> > > blur effect in MetaBackground?
> > 
> > Yes look at meta_background_paint_content.
> 
> Uh, you're right.

Does this mean that this one is ACN ?
Comment 19 drago01 2013-03-02 14:30:23 UTC
(In reply to comment #18)
> (In reply to comment #16)
> > (In reply to comment #9)
> > > (In reply to comment #8)
> > > > Review of attachment 237785 [details] [review] [details] [details] [details]:
> > > > 
> > > > Same here: are we sure we *never* paint outside the allocation? What about the
> > > > blur effect in MetaBackground?
> > > 
> > > Yes look at meta_background_paint_content.
> > 
> > Uh, you're right.
> 
> Does this mean that this one is ACN ?

Err didn't saw that you set it acn ignore that.
Comment 20 drago01 2013-03-02 14:31:38 UTC
Comment on attachment 237785 [details] [review]
meta-background-group: Report a paint volume

Attachment 237785 [details] pushed as e426900 - meta-background-group: Report a paint volume
Comment 21 drago01 2013-03-02 20:52:27 UTC
Created attachment 237851 [details] [review]
st-icon: Don't cause a redraw by replacing the icon with itself

Check if the two icons match before setting a new icon, if they
do don't do anything.

Based on patch from Owen Taylor <otaylor@fishsoup.net>
Comment 22 Jasper St. Pierre (not reading bugmail) 2013-03-02 23:18:45 UTC
(In reply to comment #16)
> But Clutter implements the default paint volume function by unioning the paint
> volume of all children, which should give the right result here.
> (I understand it is slower, because of software transforms, so I'm ok with the
> shortcut, if we are sure that we never paint outside)

Are you looking at the same code I am?

http://git.gnome.org/browse/clutter/tree/clutter/clutter-actor.c#n5961

If there's a custom paint function, it returns FALSE, which means that the paint volume may not be correct, and we bail early and queue a full-stage redraw.
Comment 23 drago01 2013-03-02 23:22:52 UTC
(In reply to comment #22)
> (In reply to comment #16)
> > But Clutter implements the default paint volume function by unioning the paint
> > volume of all children, which should give the right result here.
> > (I understand it is slower, because of software transforms, so I'm ok with the
> > shortcut, if we are sure that we never paint outside)
> 
> Are you looking at the same code I am?
> 
> http://git.gnome.org/browse/clutter/tree/clutter/clutter-actor.c#n5961
> 
> If there's a custom paint function, it returns FALSE, which means that the
> paint volume may not be correct, and we bail early and queue a full-stage
> redraw.

Oh ... this explains why it keeps returning FALSE so we have to provide a custom get_paint_volume anyway.
Comment 24 Jasper St. Pierre (not reading bugmail) 2013-03-02 23:27:00 UTC
(In reply to comment #16)
> No it doesn't: it reparents window actors inside groups, but then the groups
> are added to the window_group (windowManager.js:573)

This seems to be correct -- it will paint outside its allocation. But the allocation should be the full stage size (it seems we query the children right now and compute a maximum size, but this is an easy cleanup), in which case it won't matter.
Comment 25 drago01 2013-03-03 09:20:14 UTC
(In reply to comment #24)
> (In reply to comment #16)
> > No it doesn't: it reparents window actors inside groups, but then the groups
> > are added to the window_group (windowManager.js:573)
> 
> This seems to be correct -- it will paint outside its allocation. But the
> allocation should be the full stage size (it seems we query the children right
> now and compute a maximum size, but this is an easy cleanup), in which case it
> won't matter.

Yeah that makes sense. Run that patch for a day now and have not noticed any wrong drawing.
Comment 26 drago01 2013-03-03 10:47:07 UTC
Comment on attachment 237784 [details] [review]
meta-window-group: Report a paint volume

Attachment 237784 [details] pushed as c996dde - meta-window-group: Report a paint volume
Comment 27 Giovanni Campagna 2013-03-04 23:02:01 UTC
Review of attachment 237851 [details] [review]:

Yes
Comment 28 drago01 2013-03-04 23:03:46 UTC
Attachment 237851 [details] pushed as a6b49fe - st-icon: Don't cause a redraw by replacing the icon with itself