Merge lp:~smspillaz/unity/unity.fix_1080947.2 into lp:unity

Proposed by Sam Spilsbury
Status: Superseded
Proposed branch: lp:~smspillaz/unity/unity.fix_1080947.2
Merge into: lp:unity
Diff against target: 682 lines (+305/-138)
5 files modified
launcher/MockLauncherIcon.h (+2/-0)
launcher/XdndCollectionWindowImp.cpp (+4/-0)
plugins/unityshell/src/unityshell.cpp (+270/-136)
plugins/unityshell/src/unityshell.h (+25/-2)
unity-shared/OverlayWindowButtons.cpp (+4/-0)
To merge this branch: bzr merge lp:~smspillaz/unity/unity.fix_1080947.2
Reviewer Review Type Date Requested Status
PS Jenkins bot (community) continuous-integration Needs Fixing
Alfred E. Neumayer Pending
Esokrates testing Pending
Sam Spilsbury Pending
Andrea Azzarone Pending
Review via email: mp+163474@code.launchpad.net

This proposal supersedes a proposal from 2013-03-22.

This proposal has been superseded by a proposal from 2013-05-26.

Commit message

Don't re-present all of our windows on every frame. Only do that if damage intersects it.

Use the new APIs exposed by compiz and nux to intelligently determine which windows need to be presented per-frame and only register damage for those windows. This fixes two things:

1. BaseWindows being redrawn from scratch every time damage was registered over them. That was incorrect and should only be done in the case of background blurs.
2. BaseWindows being drawn to the screen on every frame, regardless of whether or not they needed to be. Now they will only be drawn if some damage intersects beneath them. Note that unity will expand the damage region to accomadate the base window since nux does not support geometry clipping. So if there is a partial intersection of the launcher for example, the area of the screen which contains the launcher will be re-painted (but the launcher itself won't be redrawn, just its texture)

(LP: #1080947)

Description of the change

Don't re-present all of our windows on every frame. Only do that if damage intersects it.

Use the new APIs exposed by compiz and nux to intelligently determine which windows need to be presented per-frame and only register damage for those windows. This fixes two things:

1. BaseWindows being redrawn from scratch every time damage was registered over them. That was incorrect and should only be done in the case of background blurs.
2. BaseWindows being drawn to the screen on every frame, regardless of whether or not they needed to be. Now they will only be drawn if some damage intersects beneath them. Note that unity will expand the damage region to accomadate the base window since nux does not support geometry clipping. So if there is a partial intersection of the launcher for example, the area of the screen which contains the launcher will be re-painted (but the launcher itself won't be redrawn, just its texture).

This also uses the framebuffer blitting API from compiz to quickly copy the non-blurred regions of the screen back to the backbuffer.

(LP: #1080947)

This branch depends on two others:

1. https://code.launchpad.net/~smspillaz/nux/nux.fix_1091589/+merge/147543 (WindowThread::PresentWindowsIntersectingGeometryOnThisFrame, WindowThread::ForeignFrameCutoff, WindowThread::ForeignFrameEnded)
2. https://code.launchpad.net/~compiz-team/compiz/compiz.fix_1024304/+merge/147540 (composite::Frameroster)

Update: test results here: http://www.ucc.asn.au/~smspillaz/phoronix-test-suite/composite.xml

I was careful to modify phoronix-test-suite to run tests in windowed mode only, and those were the only three tests I was able to get to run in windowed mode. Of particular interest was the fact that the unigine demos had a 5x performance improvement, probably because the driver was spending less time filling redundant pixels from the compositor. In other areas we had a roughly 5FPS boost.

Compiz framerate graph:

http://www.ucc.asn.au/~smspillaz/compiz-perf-graph.png

You'll see that especially on the last test, it drops off quite a bit on the non buffer_age case, and is generally speaking lower across the board.

To post a comment you must log in.
Revision history for this message
Andrea Azzarone (azzar1) wrote : Posted in a previous version of this proposal

Ok it builds here. But I get two main regressions here:
#. Dragging launcher icons creates artifacts on the screen
#. Unity crash dragging files (e.g. nautilus files).

Can you reproduce there?

Revision history for this message
Andrea Azzarone (azzar1) wrote : Posted in a previous version of this proposal

*crashes

Revision history for this message
Sam Spilsbury (smspillaz) wrote : Posted in a previous version of this proposal

Hey Andrea, thanks for testing. I'll look into those two as soon as possible.

I suspect the latter was a crash that existed upstream already, or at least, it happened in an area of the code I didn't touch.

Revision history for this message
Sam Spilsbury (smspillaz) wrote : Posted in a previous version of this proposal

Hey Again,

So the trails issue was really because nux wasn't keeping track of both the old and new geometries when posting the damage region. I've fixed it to do that now, so you should pull from the nux branch.

Worryingly - trying to drag any launcher icon on nvidia results in the paint loop simply ceasing to work. We still paint everything and call glXSwapBuffers, but nothing ends up on-screen. Not sure why it does that - can someone double check with trunk on an nvidia machine?

As for the crash - I can't reproduce that. Can you grab a stracktrace?

Revision history for this message
Andrea Azzarone (azzar1) wrote : Posted in a previous version of this proposal

8 - ShowWindow(true);
9 + // We are not calling ShowWindow () as this window
10 + // isn't really visible

Reverting this change seems to fix the issue. Btw the dnd issue with launcher icons is gone! :)

Revision history for this message
Sam Spilsbury (smspillaz) wrote : Posted in a previous version of this proposal

Hmm. Okay. I'll have a brief look into that, the input window needs to be
"hidden" otherwise it gets damaged on every from (eg fullscreen damage)
On 26/03/2013 3:13 AM, "Andrea Azzarone" <email address hidden> wrote:

> 8 - ShowWindow(true);
> 9 + // We are not calling ShowWindow () as this window
> 10 + // isn't really visible
>
> Reverting this change seems to fix the issue. Btw the dnd issue with
> launcher icons is gone! :)
> --
>
> https://code.launchpad.net/~smspillaz/unity/unity.fix_1080947.2/+merge/154847
> You are the owner of lp:~smspillaz/unity/unity.fix_1080947.2.
>

Revision history for this message
Andrea Azzarone (azzar1) wrote : Posted in a previous version of this proposal

> Hmm. Okay. I'll have a brief look into that, the input window needs to be
> "hidden" otherwise it gets damaged on every from (eg fullscreen damage)

What about:

ShowWindow(true);
ShowWindow(false);

just to force the creation of the X window?

> On 26/03/2013 3:13 AM, "Andrea Azzarone" <email address hidden> wrote:
>
> > 8 - ShowWindow(true);
> > 9 + // We are not calling ShowWindow () as this window
> > 10 + // isn't really visible
> >
> > Reverting this change seems to fix the issue. Btw the dnd issue with
> > launcher icons is gone! :)
> > --
> >
> >
> https://code.launchpad.net/~smspillaz/unity/unity.fix_1080947.2/+merge/154847
> > You are the owner of lp:~smspillaz/unity/unity.fix_1080947.2.
> >

Revision history for this message
Sam Spilsbury (smspillaz) wrote : Posted in a previous version of this proposal

On Tue, Mar 26, 2013 at 8:08 AM, Andrea Azzarone <email address hidden> wrote:
>> Hmm. Okay. I'll have a brief look into that, the input window needs to be
>> "hidden" otherwise it gets damaged on every from (eg fullscreen damage)
>
> What about:
>
> ShowWindow(true);
> ShowWindow(false);
>
> just to force the creation of the X window?

That could work - does the X window need to be mapped ?

>
>> On 26/03/2013 3:13 AM, "Andrea Azzarone" <email address hidden> wrote:
>>
>> > 8 - ShowWindow(true);
>> > 9 + // We are not calling ShowWindow () as this window
>> > 10 + // isn't really visible
>> >
>> > Reverting this change seems to fix the issue. Btw the dnd issue with
>> > launcher icons is gone! :)
>> > --
>> >
>> >
>> https://code.launchpad.net/~smspillaz/unity/unity.fix_1080947.2/+merge/154847
>> > You are the owner of lp:~smspillaz/unity/unity.fix_1080947.2.
>> >
> --
> https://code.launchpad.net/~smspillaz/unity/unity.fix_1080947.2/+merge/154847
> You are the owner of lp:~smspillaz/unity/unity.fix_1080947.2.

--
Sam Spilsbury

Revision history for this message
Andrea Azzarone (azzar1) wrote : Posted in a previous version of this proposal

59 + //directly_drawable_fbo_.reset (cgl::createBlittableFramebufferObjectWithFallback(*screen,
60 + // gScreen));

Remove these lines please if you don't need them ;)

83 + for (CompOutput &output : screen->outputDevs())
84 + {
85 + FillShadowRectForOutput(panelShadow, &output);
86 + cScreen->damageRegion(CompRegion(panelShadow));
87 + }

What about CompOutput const&? You will need to make this change too: from

 +void UnityScreen::FillShadowRectForOutput(CompRect &shadowRect,
113 + CompOutput *output)

to

CompOutput const& output.

+ nux::Geometry geometry(bw->GetAbsoluteGeometry());

Just do: nux::Geometry const& geometry = bw->...

100 +void UnityScreen::OnViewShown(nux::BaseWindow *bw)
101 +{
102 +}

Do we really need it?

Revision history for this message
Sam Spilsbury (smspillaz) wrote : Posted in a previous version of this proposal

Agree on all points. I was going to keep the commented out code as I'd like
to push through the new framebuffer object api, keeping then there would
just ease some of the later porting work but I can remove then if need be.
On 26/03/2013 9:06 AM, "Andrea Azzarone" <email address hidden> wrote:

> 59 + //directly_drawable_fbo_.reset
> (cgl::createBlittableFramebufferObjectWithFallback(*screen,
> 60 + //
> gScreen));
>
> Remove these lines please if you don't need them ;)
>
> 83 + for (CompOutput &output : screen->outputDevs())
> 84 + {
> 85 + FillShadowRectForOutput(panelShadow, &output);
> 86 + cScreen->damageRegion(CompRegion(panelShadow));
> 87 + }
>
> What about CompOutput const&? You will need to make this change too: from
>
> +void UnityScreen::FillShadowRectForOutput(CompRect &shadowRect,
> 113 + CompOutput *output)
>
> to
>
> CompOutput const& output.
>
> + nux::Geometry geometry(bw->GetAbsoluteGeometry());
>
> Just do: nux::Geometry const& geometry = bw->...
>
> 100 +void UnityScreen::OnViewShown(nux::BaseWindow *bw)
> 101 +{
> 102 +}
>
> Do we really need it?
>
>
>
>
> --
>
> https://code.launchpad.net/~smspillaz/unity/unity.fix_1080947.2/+merge/154847
> You are the owner of lp:~smspillaz/unity/unity.fix_1080947.2.
>

Revision history for this message
Sam Spilsbury (smspillaz) wrote : Posted in a previous version of this proposal

Okay, all updated as requested.

Revision history for this message
Andrea Azzarone (azzar1) wrote : Posted in a previous version of this proposal

> Okay, all updated as requested.

I'll try again tomorrow.

Revision history for this message
Andrea Azzarone (azzar1) wrote : Posted in a previous version of this proposal

Looks good now. Please remove this line too:

164 + printf ("rebind!\n");

Any progress on "jerky" dash (during the scrolling)?

Revision history for this message
Sam Spilsbury (smspillaz) wrote : Posted in a previous version of this proposal

So there are two reasons why dash scrolling could be slow:

1) Maybe glCopyTexSubImage2D really is faster than bind -> paint -> unbind -> paint
2) The extra rebinds we have to do as a result of not having the new fbo api available are slowing us down.

For now I'll see if we can just move back to using CopyTexSubImage2D

Revision history for this message
Sam Spilsbury (smspillaz) wrote : Posted in a previous version of this proposal

Okay, I've gone back to the old glCopyTexSubImage2D method. I suspect that's faster anyways and it works on both nouveau and nvidia. We can easily speed it up by doing partial copies of the backbuffer, but that's work for another branch.

Revision history for this message
Andrea Azzarone (azzar1) wrote : Posted in a previous version of this proposal

/home/andrea/unity/source/unity/plugins/unityshell/src/unityshell.cpp:1461:7: error: ‘back_buffer_age_’ was not declared in this scope

Revision history for this message
Sam Spilsbury (smspillaz) wrote : Posted in a previous version of this proposal

Ah, sorry about that, must have missed a file in the commit -.-

Why do we not have CI runs on lp:unity?

On Fri, Mar 29, 2013 at 4:52 AM, Andrea Azzarone <email address hidden> wrote:
> /home/andrea/unity/source/unity/plugins/unityshell/src/unityshell.cpp:1461:7: error: ‘back_buffer_age_’ was not declared in this scope
>
> --
> https://code.launchpad.net/~smspillaz/unity/unity.fix_1080947.2/+merge/154847
> You are the owner of lp:~smspillaz/unity/unity.fix_1080947.2.

--
Sam Spilsbury

Revision history for this message
Sam Spilsbury (smspillaz) wrote : Posted in a previous version of this proposal

Okay, should be all fixed.

Revision history for this message
Andrea Azzarone (azzar1) wrote : Posted in a previous version of this proposal

Builds now but the dash is still slow. How can I help you debugging it?

Revision history for this message
Sam Spilsbury (smspillaz) wrote : Posted in a previous version of this proposal

Hmm. That's odd. Is it actually slower compared to trunk? There nothing in
this code which will cause it to paint more.
On 29/03/2013 5:25 PM, "Andrea Azzarone" <email address hidden> wrote:

> Builds now but the dash is still slow. How can I help you debugging it?
> --
>
> https://code.launchpad.net/~smspillaz/unity/unity.fix_1080947.2/+merge/154847
> You are the owner of lp:~smspillaz/unity/unity.fix_1080947.2.
>

Revision history for this message
Alfred E. Neumayer (beidl) wrote : Posted in a previous version of this proposal

Performance wise, it feels a better with games in windowed mode, but what I've noticed:
1) Scrolling through the dash per touchpad appears to be a tiny bit choppier than previously (Intel HD 4000).

2) Also, when switching from the window spread/scale to the dash, everything outside the dash blur is animating quite smoothly, but the blur seems to update its content properly only near the end of the spread animation.
It could well be a problem with the dash/lenses doing IO and blocking the blur redraw until IO is done.
OR it's always been this way and i just did not notice it because the dash used to fade in slower.
Visually the dash appears to fade in instantly, but the blur has to catch up.

Revision history for this message
Sam Spilsbury (smspillaz) wrote : Posted in a previous version of this proposal

Hey Alfred

On Sat, Mar 30, 2013 at 9:52 AM, Alfred Neumayer <email address hidden> wrote:
> Performance wise, it feels a better with games in windowed mode, but what I've noticed:
> 1) Scrolling through the dash per touchpad appears to be a tiny bit choppier than previously (Intel HD 4000).
>

So I'm not sure about this. What it might be worth doing is checking
to see if you still get this choppiness with the blurs turned off. I
did some work yesterday to make sure we're not updating the blur on
unity-only damages, however there could be a case where they are being
updated where they should not be.

> 2) Also, when switching from the window spread/scale to the dash, everything outside the dash blur is animating quite smoothly, but the blur seems to update its content properly only near the end of the spread animation.

Right, there is code inside the dash to only update blurs when we were
not updating the dash content already. If there is a spinner or
something running we won't update them. So it will be out of sync a
little bit. That code has always been there.
> --
> https://code.launchpad.net/~smspillaz/unity/unity.fix_1080947.2/+merge/154847
> You are the owner of lp:~smspillaz/unity/unity.fix_1080947.2.

--
Sam Spilsbury

Revision history for this message
Alfred E. Neumayer (beidl) wrote : Posted in a previous version of this proposal

> So I'm not sure about this. What it might be worth doing is checking
> to see if you still get this choppiness with the blurs turned off. I
> did some work yesterday to make sure we're not updating the blur on
> unity-only damages, however there could be a case where they are being
> updated where they should not be.

Tested with blur turned off and scrolling behaviour is back to normal.
I mean it's really not a deal breaker but it's still a noticable difference, at least for me.

>
> > 2) Also, when switching from the window spread/scale to the dash, everything
> outside the dash blur is animating quite smoothly, but the blur seems to
> update its content properly only near the end of the spread animation.
>
> Right, there is code inside the dash to only update blurs when we were
> not updating the dash content already. If there is a spinner or
> something running we won't update them. So it will be out of sync a
> little bit. That code has always been there.

Makes sense.

Revision history for this message
Sam Spilsbury (smspillaz) wrote : Posted in a previous version of this proposal

On Sat, Mar 30, 2013 at 10:13 AM, Alfred Neumayer <email address hidden> wrote:
>> So I'm not sure about this. What it might be worth doing is checking
>> to see if you still get this choppiness with the blurs turned off. I
>> did some work yesterday to make sure we're not updating the blur on
>> unity-only damages, however there could be a case where they are being
>> updated where they should not be.
>
> Tested with blur turned off and scrolling behaviour is back to normal.
> I mean it's really not a deal breaker but it's still a noticable difference, at least for me.

Andrea - this could be those QueueDraw calls within the ScrollView
acting up. I didn't catch blur updates happening just on scrolling
alone, but that could be a cause. Could you check if the blurs are
updating in this case?

--
Sam Spilsbury

Revision history for this message
Andrea Azzarone (azzar1) wrote : Posted in a previous version of this proposal

> On Sat, Mar 30, 2013 at 10:13 AM, Alfred Neumayer <email address hidden> wrote:
> >> So I'm not sure about this. What it might be worth doing is checking
> >> to see if you still get this choppiness with the blurs turned off. I
> >> did some work yesterday to make sure we're not updating the blur on
> >> unity-only damages, however there could be a case where they are being
> >> updated where they should not be.
> >
> > Tested with blur turned off and scrolling behaviour is back to normal.
> > I mean it's really not a deal breaker but it's still a noticable difference,
> at least for me.
>
> Andrea - this could be those QueueDraw calls within the ScrollView
> acting up. I didn't catch blur updates happening just on scrolling
> alone, but that could be a cause. Could you check if the blurs are
> updating in this case?
>
> --
> Sam Spilsbury

Nope, I think he's testing my PPA that does not have the fix for the dash scroll issue. :)

Revision history for this message
Sam Spilsbury (smspillaz) wrote : Posted in a previous version of this proposal

On Sat, Mar 30, 2013 at 5:07 PM, Andrea Azzarone <email address hidden> wrote:
>> On Sat, Mar 30, 2013 at 10:13 AM, Alfred Neumayer <email address hidden> wrote:
>> >> So I'm not sure about this. What it might be worth doing is checking
>> >> to see if you still get this choppiness with the blurs turned off. I
>> >> did some work yesterday to make sure we're not updating the blur on
>> >> unity-only damages, however there could be a case where they are being
>> >> updated where they should not be.
>> >
>> > Tested with blur turned off and scrolling behaviour is back to normal.
>> > I mean it's really not a deal breaker but it's still a noticable difference,
>> at least for me.
>>
>> Andrea - this could be those QueueDraw calls within the ScrollView
>> acting up. I didn't catch blur updates happening just on scrolling
>> alone, but that could be a cause. Could you check if the blurs are
>> updating in this case?

Ah okay.

In any case, I've been doing some work to reduce the amount of pixels
we need to copy around every time the blurs are updated, would it make
sense to have that work in here too? Its somewhat unrelated but
probably useful.

>>
>> --
>> Sam Spilsbury
>
> Nope, I think he's testing my PPA that does not have the fix for the dash scroll issue. :)
> --
> https://code.launchpad.net/~smspillaz/unity/unity.fix_1080947.2/+merge/154847
> You are the owner of lp:~smspillaz/unity/unity.fix_1080947.2.

--
Sam Spilsbury

Revision history for this message
Andrea Azzarone (azzar1) wrote : Posted in a previous version of this proposal

Ok the PPA should be fine now. Alfred, can you check? Thanks!

@Sam, how many lines of code?

Revision history for this message
Sam Spilsbury (smspillaz) wrote : Posted in a previous version of this proposal

On Sat, Mar 30, 2013 at 6:03 PM, Andrea Azzarone <email address hidden> wrote:
> Ok the PPA should be fine now. Alfred, can you check? Thanks!
>
> @Sam, how many lines of code?

Dunno, still working on it, could be fairly substantial.

I might just split it out.

> --
> https://code.launchpad.net/~smspillaz/unity/unity.fix_1080947.2/+merge/154847
> You are the owner of lp:~smspillaz/unity/unity.fix_1080947.2.

--
Sam Spilsbury

Revision history for this message
Alfred E. Neumayer (beidl) wrote : Posted in a previous version of this proposal

Yup, I should have told you guys that I'm using the PPA. Don't have enough time for compiling it from scratch atm.
And yes, updated the packages and scrolling is niiiice.

Revision history for this message
Andrea Azzarone (azzar1) wrote : Posted in a previous version of this proposal

@Alfred, nice! :) Can I ask you what graphic card are you using?

Revision history for this message
Andrea Azzarone (azzar1) : Posted in a previous version of this proposal
review: Approve
Revision history for this message
Sam Spilsbury (smspillaz) wrote : Posted in a previous version of this proposal

Cool.

We'll need to make sure to merge the other ones in order, otherwise
things will break.

On Sat, Mar 30, 2013 at 8:25 PM, Andrea Azzarone <email address hidden> wrote:
> Review: Approve
>
>
> --
> https://code.launchpad.net/~smspillaz/unity/unity.fix_1080947.2/+merge/154847
> You are the owner of lp:~smspillaz/unity/unity.fix_1080947.2.

--
Sam Spilsbury

Revision history for this message
MC Return (mc-return) wrote : Posted in a previous version of this proposal

> review: Approve

Hurra \o/

> @Alfred, nice! :) Can I ask you what graphic card are you using?

I think he mentioned Intel HD 4000 above ^^

Revision history for this message
Sam Spilsbury (smspillaz) wrote : Posted in a previous version of this proposal

I've put the partial back-buffer-copy work into this branch: https://code.launchpad.net/~smspillaz/unity/unity.fix_1080947.3/+merge/156260

If you want me to merge it back into this one, just say so.

Revision history for this message
Alfred E. Neumayer (beidl) wrote : Posted in a previous version of this proposal

> > review: Approve
>
> Hurra \o/
>
> > @Alfred, nice! :) Can I ask you what graphic card are you using?
>
> I think he mentioned Intel HD 4000 above ^^

Intel HD 4000 as well as NVidia 640M LE through Bumblebee (those PRIME helper merges in one of the latest kernel revisions leave me wondering if we're going to see some nice Optimus action soon...)
Also, approve before it's too late :)

review: Approve
Revision history for this message
Andrea Azzarone (azzar1) wrote : Posted in a previous version of this proposal

Due to the imminent release we're going to merge this branch as soon as after the release.

Revision history for this message
MC Return (mc-return) wrote : Posted in a previous version of this proposal

> Due to the imminent release we're going to merge this branch as soon as after
> the release.

Andrea, will Compiz still be the default window manager for Unity in 13.10 ?

Revision history for this message
Sam Spilsbury (smspillaz) wrote : Posted in a previous version of this proposal

On Wed, Apr 3, 2013 at 7:36 PM, Andrea Azzarone <email address hidden> wrote:
> Due to the imminent release we're going to merge this branch as soon as after the release.

Hmm, by release do you mean beta freeze, the current unity release or 13.04?

> --
> https://code.launchpad.net/~smspillaz/unity/unity.fix_1080947.2/+merge/154847
> You are the owner of lp:~smspillaz/unity/unity.fix_1080947.2.

--
Sam Spilsbury

Revision history for this message
Sam Spilsbury (smspillaz) wrote : Posted in a previous version of this proposal

Okay, by "release" Andrea meant 13.04.

That's a real shame, considering that we had plenty of chances to get
this in before feature freeze. It was ready for review in December,
and resources were only allocated to doing so in March after feature
freeze.

I think product-strategy and distro need to have a serious talk about
how they handle these things, because the status of whether or not it
was actually going in has changed about 4 times now. I sense that the
communication lines have broken down somewhere, and the policy that is
being applied is not transparent at all.

If compiz and unity-legacy will not be the default shell in 13.10,
then this has resulted in a huge waste of a contributors time.

On Wed, Apr 3, 2013 at 8:20 PM, Sam Spilsbury <email address hidden> wrote:
> On Wed, Apr 3, 2013 at 7:36 PM, Andrea Azzarone <email address hidden> wrote:
>> Due to the imminent release we're going to merge this branch as soon as after the release.
>
> Hmm, by release do you mean beta freeze, the current unity release or 13.04?
>
>> --
>> https://code.launchpad.net/~smspillaz/unity/unity.fix_1080947.2/+merge/154847
>> You are the owner of lp:~smspillaz/unity/unity.fix_1080947.2.
>
>
>
> --
> Sam Spilsbury
>
> --
> https://code.launchpad.net/~smspillaz/unity/unity.fix_1080947.2/+merge/154847
> You are the owner of lp:~smspillaz/unity/unity.fix_1080947.2.

--
Sam Spilsbury

Revision history for this message
Andrea Azzarone (azzar1) wrote : Posted in a previous version of this proposal

> > Due to the imminent release we're going to merge this branch as soon as
> after
> > the release.
>
> Andrea, will Compiz still be the default window manager for Unity in 13.10 ?

We are not sure of the Unity Next state for 13.10.

Revision history for this message
Alfred E. Neumayer (beidl) wrote : Posted in a previous version of this proposal

> Okay, by "release" Andrea meant 13.04.
>
> That's a real shame, considering that we had plenty of chances to get
> this in before feature freeze. It was ready for review in December,
> and resources were only allocated to doing so in March after feature
> freeze.
>
> I think product-strategy and distro need to have a serious talk about
> how they handle these things, because the status of whether or not it
> was actually going in has changed about 4 times now. I sense that the
> communication lines have broken down somewhere, and the policy that is
> being applied is not transparent at all.
>
> If compiz and unity-legacy will not be the default shell in 13.10,
> then this has resulted in a huge waste of a contributors time.
>
> On Wed, Apr 3, 2013 at 8:20 PM, Sam Spilsbury <email address hidden> wrote:
> > On Wed, Apr 3, 2013 at 7:36 PM, Andrea Azzarone <email address hidden> wrote:
> >> Due to the imminent release we're going to merge this branch as soon as
> after the release.
> >
> > Hmm, by release do you mean beta freeze, the current unity release or 13.04?
> >
> >> --
> >>
> https://code.launchpad.net/~smspillaz/unity/unity.fix_1080947.2/+merge/154847
> >> You are the owner of lp:~smspillaz/unity/unity.fix_1080947.2.
> >
> >
> >
> > --
> > Sam Spilsbury
> >
> > --
> >
> https://code.launchpad.net/~smspillaz/unity/unity.fix_1080947.2/+merge/154847
> > You are the owner of lp:~smspillaz/unity/unity.fix_1080947.2.
>
>
>
> --
> Sam Spilsbury

I couldn't agree more.
In the meantime, some really questionable changes have been made, literally days ago, which cause trouble in usability, and nobody even cares to look at my bug report.
Something is going wrong here.

Revision history for this message
Andrea Azzarone (azzar1) wrote : Posted in a previous version of this proposal

> > Okay, by "release" Andrea meant 13.04.
> >
> > That's a real shame, considering that we had plenty of chances to get
> > this in before feature freeze. It was ready for review in December,
> > and resources were only allocated to doing so in March after feature
> > freeze.
> >
> > I think product-strategy and distro need to have a serious talk about
> > how they handle these things, because the status of whether or not it
> > was actually going in has changed about 4 times now. I sense that the
> > communication lines have broken down somewhere, and the policy that is
> > being applied is not transparent at all.
> >
> > If compiz and unity-legacy will not be the default shell in 13.10,
> > then this has resulted in a huge waste of a contributors time.
> >
> > On Wed, Apr 3, 2013 at 8:20 PM, Sam Spilsbury <email address hidden> wrote:
> > > On Wed, Apr 3, 2013 at 7:36 PM, Andrea Azzarone <email address hidden>
> wrote:
> > >> Due to the imminent release we're going to merge this branch as soon as
> > after the release.
> > >
> > > Hmm, by release do you mean beta freeze, the current unity release or
> 13.04?
> > >
> > >> --
> > >>
> >
> https://code.launchpad.net/~smspillaz/unity/unity.fix_1080947.2/+merge/154847
> > >> You are the owner of lp:~smspillaz/unity/unity.fix_1080947.2.
> > >
> > >
> > >
> > > --
> > > Sam Spilsbury
> > >
> > > --
> > >
> >
> https://code.launchpad.net/~smspillaz/unity/unity.fix_1080947.2/+merge/154847
> > > You are the owner of lp:~smspillaz/unity/unity.fix_1080947.2.
> >
> >
> >
> > --
> > Sam Spilsbury
>
> I couldn't agree more.
> In the meantime, some really questionable changes have been made, literally
> days ago, which cause trouble in usability, and nobody even cares to look at
> my bug report.
> Something is going wrong here.

What changes? Link to bug report?

Revision history for this message
Alfred E. Neumayer (beidl) wrote : Posted in a previous version of this proposal

> > > Okay, by "release" Andrea meant 13.04.
> > >
> > > That's a real shame, considering that we had plenty of chances to get
> > > this in before feature freeze. It was ready for review in December,
> > > and resources were only allocated to doing so in March after feature
> > > freeze.
> > >
> > > I think product-strategy and distro need to have a serious talk about
> > > how they handle these things, because the status of whether or not it
> > > was actually going in has changed about 4 times now. I sense that the
> > > communication lines have broken down somewhere, and the policy that is
> > > being applied is not transparent at all.
> > >
> > > If compiz and unity-legacy will not be the default shell in 13.10,
> > > then this has resulted in a huge waste of a contributors time.
> > >
> > > On Wed, Apr 3, 2013 at 8:20 PM, Sam Spilsbury <email address hidden> wrote:
> > > > On Wed, Apr 3, 2013 at 7:36 PM, Andrea Azzarone <email address hidden>
> > wrote:
> > > >> Due to the imminent release we're going to merge this branch as soon as
> > > after the release.
> > > >
> > > > Hmm, by release do you mean beta freeze, the current unity release or
> > 13.04?
> > > >
> > > >> --
> > > >>
> > >
> >
> https://code.launchpad.net/~smspillaz/unity/unity.fix_1080947.2/+merge/154847
> > > >> You are the owner of lp:~smspillaz/unity/unity.fix_1080947.2.
> > > >
> > > >
> > > >
> > > > --
> > > > Sam Spilsbury
> > > >
> > > > --
> > > >
> > >
> >
> https://code.launchpad.net/~smspillaz/unity/unity.fix_1080947.2/+merge/154847
> > > > You are the owner of lp:~smspillaz/unity/unity.fix_1080947.2.
> > >
> > >
> > >
> > > --
> > > Sam Spilsbury
> >
> > I couldn't agree more.
> > In the meantime, some really questionable changes have been made, literally
> > days ago, which cause trouble in usability, and nobody even cares to look at
> > my bug report.
> > Something is going wrong here.
>
> What changes? Link to bug report?

Link to the bug report: https://bugs.launchpad.net/unity/+bug/1163041
The change was specific to the Unity plugin itself, but my point is,
there is this half-done (even though it's a good start) feature that got merged in,
but then these much needed performance improvements get postponed.
It's little confusing to me, a passionate user and promoter of Ubuntu.
(I wished I had enough time digging into C++ and compositors to little more to help out, but I'm just a stupid managed code developer ^^)
But as i can see, Andrea already took care of that bug. :)

Revision history for this message
MC Return (mc-return) wrote : Posted in a previous version of this proposal

> Okay, by "release" Andrea meant 13.04.
>
> That's a real shame, considering that we had plenty of chances to get
> this in before feature freeze. It was ready for review in December,
> and resources were only allocated to doing so in March after feature
> freeze.
>
Something is definitely wrong if MPs of core components do not get looked
at, tested and reviewed in time.
This just tells the contributor: Go away, we have enough work to do without
you - do not try to fix bugs, you are just creating more work for us.

But maybe this is exactly the message someone wants to get across ?

> I think product-strategy and distro need to have a serious talk about
> how they handle these things, because the status of whether or not it
> was actually going in has changed about 4 times now. I sense that the
> communication lines have broken down somewhere, and the policy that is
> being applied is not transparent at all.
>
Well that is definitely true also, but has been that way for some time:
Take a look at Compiz product strategy. First, main priority was to get it
compatible to GLES in 12.10, no matter how finished this port is and no
matter how much core functionality and plugins get broken by that.

Now main priority seems to be to deprecate X/Compiz and replace it with
Mir/Unity-QML, which is another thing that can only come with a ton of
regressions attached and the desktop will be severely hurt with this
move - but hey - we get a cellphone system for the desktop instead ;(

The problem seems to be that people making technical decisions do not
seem to have any idea about the technology they try to decide on...

But I guess all other big companies must be crazy to make different
systems for cell phones and desktop PCs...

> If compiz and unity-legacy will not be the default shell in 13.10,
> then this has resulted in a huge waste of a contributors time.
>
One contributor's time ?

Revision history for this message
Sam Spilsbury (smspillaz) wrote : Posted in a previous version of this proposal

Oops, I didn't mean to turn this into a debate.

The conversation needs to be had between product-strategy and distro
as to how they are going to handle communication better, but this is a
very specific topic.

On Thu, Apr 4, 2013 at 12:44 PM, MC Return <email address hidden> wrote:
>> Okay, by "release" Andrea meant 13.04.
>>
>> That's a real shame, considering that we had plenty of chances to get
>> this in before feature freeze. It was ready for review in December,
>> and resources were only allocated to doing so in March after feature
>> freeze.
>>
> Something is definitely wrong if MPs of core components do not get looked
> at, tested and reviewed in time.
> This just tells the contributor: Go away, we have enough work to do without
> you - do not try to fix bugs, you are just creating more work for us.
>
> But maybe this is exactly the message someone wants to get across ?
>
>> I think product-strategy and distro need to have a serious talk about
>> how they handle these things, because the status of whether or not it
>> was actually going in has changed about 4 times now. I sense that the
>> communication lines have broken down somewhere, and the policy that is
>> being applied is not transparent at all.
>>
> Well that is definitely true also, but has been that way for some time:
> Take a look at Compiz product strategy. First, main priority was to get it
> compatible to GLES in 12.10, no matter how finished this port is and no
> matter how much core functionality and plugins get broken by that.
>
> Now main priority seems to be to deprecate X/Compiz and replace it with
> Mir/Unity-QML, which is another thing that can only come with a ton of
> regressions attached and the desktop will be severely hurt with this
> move - but hey - we get a cellphone system for the desktop instead ;(
>
> The problem seems to be that people making technical decisions do not
> seem to have any idea about the technology they try to decide on...
>
> But I guess all other big companies must be crazy to make different
> systems for cell phones and desktop PCs...
>
>> If compiz and unity-legacy will not be the default shell in 13.10,
>> then this has resulted in a huge waste of a contributors time.
>>
> One contributor's time ?
>
> --
> https://code.launchpad.net/~smspillaz/unity/unity.fix_1080947.2/+merge/154847
> You are the owner of lp:~smspillaz/unity/unity.fix_1080947.2.

--
Sam Spilsbury

Revision history for this message
Esokrates (esokrarkose) wrote : Posted in a previous version of this proposal

This problem only happens using this branch together with the compiz branch and nvidia drivers (all tested versions):
Logging in one of the tty’s (e.g.: Ctrl + Alt + F1) run a command so that the screen gets filled up (for example find) and switch back (e.g. Ctrl + Alt + F7) then the panel and launcher look like this:
http://ubuntuone.com/3hlErb4cEnRwFSB57EuBLo
http://ubuntuone.com/08yoXGBdaeVwlwGEZWZy3t
(Sometimes it is not even necessary to log in or run a command)

review: Approve (testing)
Revision history for this message
Sam Spilsbury (smspillaz) wrote : Posted in a previous version of this proposal

> This problem only happens using this branch together with the compiz branch
> and nvidia drivers (all tested versions):
> Logging in one of the tty’s (e.g.: Ctrl + Alt + F1) run a command so that the
> screen gets filled up (for example find) and switch back (e.g. Ctrl + Alt +
> F7) then the panel and launcher look like this:
> http://ubuntuone.com/3hlErb4cEnRwFSB57EuBLo
> http://ubuntuone.com/08yoXGBdaeVwlwGEZWZy3t
> (Sometimes it is not even necessary to log in or run a command)

Hi,

The nvidia drivers are known to trash framebuffer objects upon VT switches. Sometimes we run into this condition, sometimes we don't. There's not much we can do about it.

Revision history for this message
Sam Spilsbury (smspillaz) wrote : Posted in a previous version of this proposal

Okay, so I've talked to Didier about this and we've come up with a small plan of action. We'll need to give this a week solid of QA at the beginning of the S cycle and then make sure that we don't have any AP regressions. That'll happen in about two weeks.

Revision history for this message
MC Return (mc-return) wrote : Posted in a previous version of this proposal

> Okay, so I've talked to Didier about this and we've come up with a small plan
> of action. We'll need to give this a week solid of QA at the beginning of the
> S cycle and then make sure that we don't have any AP regressions. That'll
> happen in about two weeks.

\o/

Revision history for this message
PS Jenkins bot (ps-jenkins) wrote : Posted in a previous version of this proposal
review: Needs Fixing (continuous-integration)
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote : Posted in a previous version of this proposal
review: Needs Fixing (continuous-integration)
Revision history for this message
Marco Trevisan (Treviño) (3v1n0) wrote : Posted in a previous version of this proposal

> This problem only happens using this branch together with the compiz branch
> and nvidia drivers (all tested versions):
> Logging in one of the tty’s (e.g.: Ctrl + Alt + F1) run a command so that the
> screen gets filled up (for example find) and switch back (e.g. Ctrl + Alt +
> F7) then the panel and launcher look like this:
> http://ubuntuone.com/3hlErb4cEnRwFSB57EuBLo
> http://ubuntuone.com/08yoXGBdaeVwlwGEZWZy3t
> (Sometimes it is not even necessary to log in or run a command)

Mh, this is something we need to fix or workaround this in any way, or we'll get a regression for bug #915265, and we don't want that at all! :/

Revision history for this message
PS Jenkins bot (ps-jenkins) wrote : Posted in a previous version of this proposal
review: Needs Fixing (continuous-integration)
Revision history for this message
Sam Spilsbury (smspillaz) wrote : Posted in a previous version of this proposal

Is there a udev event that happens on VT switching?

On Mon, Apr 15, 2013 at 9:10 PM, Marco Trevisan (Treviño)
<mail@3v1n0.net> wrote:
>> This problem only happens using this branch together with the compiz branch
>> and nvidia drivers (all tested versions):
>> Logging in one of the tty’s (e.g.: Ctrl + Alt + F1) run a command so that the
>> screen gets filled up (for example find) and switch back (e.g. Ctrl + Alt +
>> F7) then the panel and launcher look like this:
>> http://ubuntuone.com/3hlErb4cEnRwFSB57EuBLo
>> http://ubuntuone.com/08yoXGBdaeVwlwGEZWZy3t
>> (Sometimes it is not even necessary to log in or run a command)
>
> Mh, this is something we need to fix or workaround this in any way, or we'll get a regression for bug #915265, and we don't want that at all! :/
> --
> https://code.launchpad.net/~smspillaz/unity/unity.fix_1080947.2/+merge/154847
> You are the owner of lp:~smspillaz/unity/unity.fix_1080947.2.

--
Sam Spilsbury

Revision history for this message
Sam Spilsbury (smspillaz) wrote : Posted in a previous version of this proposal

Actually, nevermind. I can see why this would happen.

We'll just need to QueueDraw () everything on a VT switch - we used to
QueueDraw () a little overzealously before which would effectively
mask the presence of this problem. Easy enough to do, I'll see if I
can do it tonight.

On Mon, Apr 15, 2013 at 10:30 PM, Sam Spilsbury <email address hidden> wrote:
> Is there a udev event that happens on VT switching?
>
> On Mon, Apr 15, 2013 at 9:10 PM, Marco Trevisan (Treviño)
> <mail@3v1n0.net> wrote:
>>> This problem only happens using this branch together with the compiz branch
>>> and nvidia drivers (all tested versions):
>>> Logging in one of the tty’s (e.g.: Ctrl + Alt + F1) run a command so that the
>>> screen gets filled up (for example find) and switch back (e.g. Ctrl + Alt +
>>> F7) then the panel and launcher look like this:
>>> http://ubuntuone.com/3hlErb4cEnRwFSB57EuBLo
>>> http://ubuntuone.com/08yoXGBdaeVwlwGEZWZy3t
>>> (Sometimes it is not even necessary to log in or run a command)
>>
>> Mh, this is something we need to fix or workaround this in any way, or we'll get a regression for bug #915265, and we don't want that at all! :/
>> --
>> https://code.launchpad.net/~smspillaz/unity/unity.fix_1080947.2/+merge/154847
>> You are the owner of lp:~smspillaz/unity/unity.fix_1080947.2.
>
>
>
> --
> Sam Spilsbury

--
Sam Spilsbury

Revision history for this message
Sam Spilsbury (smspillaz) wrote : Posted in a previous version of this proposal

I've noticed that there's a slight race condition that can happen where override redirect windows don't seem to get added to past damage buffers.

Also I think there is a little bit of scope to get some of this code into unit tests, so its worth trying.

review: Needs Fixing
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Needs Fixing (continuous-integration)
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Needs Fixing (continuous-integration)
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Needs Fixing (continuous-integration)
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Needs Fixing (continuous-integration)
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Needs Fixing (continuous-integration)
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Needs Fixing (continuous-integration)

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'launcher/MockLauncherIcon.h'
--- launcher/MockLauncherIcon.h 2013-05-17 16:02:09 +0000
+++ launcher/MockLauncherIcon.h 2013-05-20 16:09:26 +0000
@@ -365,6 +365,8 @@
365 g_error_free(error);365 g_error_free(error);
366 }366 }
367367
368 gtk_icon_info_free(info);
369
368 return result;370 return result;
369 }371 }
370372
371373
=== modified file 'launcher/XdndCollectionWindowImp.cpp'
--- launcher/XdndCollectionWindowImp.cpp 2013-04-11 05:15:36 +0000
+++ launcher/XdndCollectionWindowImp.cpp 2013-05-20 16:09:26 +0000
@@ -38,6 +38,10 @@
38 auto uscreen = UScreen::GetDefault();38 auto uscreen = UScreen::GetDefault();
39 SetGeometry(uscreen->GetScreenGeometry());39 SetGeometry(uscreen->GetScreenGeometry());
4040
41 // We are not calling ShowWindow () as this window
42 // isn't really visible
43 PushToBack();
44
41 if (nux::GetWindowThread()->IsEmbeddedWindow())45 if (nux::GetWindowThread()->IsEmbeddedWindow())
42 {46 {
43 // Hack to create the X Window as soon as possible.47 // Hack to create the X Window as soon as possible.
4448
=== modified file 'plugins/unityshell/src/unityshell.cpp'
--- plugins/unityshell/src/unityshell.cpp 2013-05-10 05:16:07 +0000
+++ plugins/unityshell/src/unityshell.cpp 2013-05-20 16:09:26 +0000
@@ -79,6 +79,8 @@
79/* Set up vtable symbols */79/* Set up vtable symbols */
80COMPIZ_PLUGIN_20090315(unityshell, unity::UnityPluginVTable);80COMPIZ_PLUGIN_20090315(unityshell, unity::UnityPluginVTable);
8181
82namespace cgl = compiz::opengl;
83
82namespace unity84namespace unity
83{85{
84using namespace launcher;86using namespace launcher;
@@ -140,6 +142,7 @@
140 , allowWindowPaint(false)142 , allowWindowPaint(false)
141 , _key_nav_mode_requested(false)143 , _key_nav_mode_requested(false)
142 , _last_output(nullptr)144 , _last_output(nullptr)
145 , force_draw_countdown_ (0)
143 , grab_index_ (0)146 , grab_index_ (0)
144 , painting_tray_ (false)147 , painting_tray_ (false)
145 , last_scroll_event_(0)148 , last_scroll_event_(0)
@@ -149,6 +152,9 @@
149 , scale_just_activated_(false)152 , scale_just_activated_(false)
150 , big_tick_(0)153 , big_tick_(0)
151 , screen_introspection_(screen)154 , screen_introspection_(screen)
155 , ignore_redraw_request_(false)
156 , dirty_helpers_on_this_frame_(false)
157 , back_buffer_age_(0)
152{158{
153 Timer timer;159 Timer timer;
154#ifndef USE_GLES160#ifndef USE_GLES
@@ -403,6 +409,11 @@
403 XSelectInput(display, GDK_ROOT_WINDOW(), PropertyChangeMask);409 XSelectInput(display, GDK_ROOT_WINDOW(), PropertyChangeMask);
404 LOG_INFO(logger) << "UnityScreen constructed: " << timer.ElapsedSeconds() << "s";410 LOG_INFO(logger) << "UnityScreen constructed: " << timer.ElapsedSeconds() << "s";
405411
412 UScreen::GetDefault()->resuming.connect([this]() {
413 /* Force paint 10 frames on resume */
414 this->force_draw_countdown_ += 10;
415 });
416
406 panel::Style::Instance().changed.connect(sigc::mem_fun(this, &UnityScreen::OnPanelStyleChanged));417 panel::Style::Instance().changed.connect(sigc::mem_fun(this, &UnityScreen::OnPanelStyleChanged));
407418
408 minimize_speed_controller_.DurationChanged.connect(419 minimize_speed_controller_.DurationChanged.connect(
@@ -412,8 +423,13 @@
412 WindowManager& wm = WindowManager::Default();423 WindowManager& wm = WindowManager::Default();
413 wm.initiate_spread.connect(sigc::mem_fun(this, &UnityScreen::OnInitiateSpread));424 wm.initiate_spread.connect(sigc::mem_fun(this, &UnityScreen::OnInitiateSpread));
414 wm.terminate_spread.connect(sigc::mem_fun(this, &UnityScreen::OnTerminateSpread));425 wm.terminate_spread.connect(sigc::mem_fun(this, &UnityScreen::OnTerminateSpread));
426 wm.initiate_expo.connect(sigc::mem_fun(this, &UnityScreen::DamagePanelShadow));
427 wm.terminate_expo.connect(sigc::mem_fun(this, &UnityScreen::DamagePanelShadow));
415428
416 AddChild(&screen_introspection_);429 AddChild(&screen_introspection_);
430
431 /* Track whole damage on the very first frame */
432 cScreen->damageScreen();
417 }433 }
418}434}
419435
@@ -488,6 +504,27 @@
488 UnityWindow::CleanupSharedTextures();504 UnityWindow::CleanupSharedTextures();
489}505}
490506
507void UnityScreen::DamagePanelShadow()
508{
509 CompRect panelShadow;
510
511 for (CompOutput const& output : screen->outputDevs())
512 {
513 FillShadowRectForOutput(panelShadow, output);
514 cScreen->damageRegion(CompRegion(panelShadow));
515 }
516}
517
518void UnityScreen::OnViewHidden(nux::BaseWindow *bw)
519{
520 /* Count this as regular damage */
521 nux::Geometry geometry(bw->GetAbsoluteGeometry());
522 cScreen->damageRegion(CompRegion (geometry.x,
523 geometry.y,
524 geometry.width,
525 geometry.height));
526}
527
491void UnityScreen::EnsureSuperKeybindings()528void UnityScreen::EnsureSuperKeybindings()
492{529{
493 for (auto action : _shortcut_actions)530 for (auto action : _shortcut_actions)
@@ -579,6 +616,20 @@
579 panel_shadow_matrix_ = matrix;616 panel_shadow_matrix_ = matrix;
580}617}
581618
619void UnityScreen::FillShadowRectForOutput(CompRect &shadowRect,
620 CompOutput const &output)
621{
622 if (_shadow_texture.empty ())
623 return;
624
625 float panel_h = static_cast<float>(panel_style_.panel_height);
626 float shadowX = output.x();
627 float shadowY = output.y() + panel_h;
628 float shadowWidth = output.width();
629 float shadowHeight = _shadow_texture[0]->height();
630 shadowRect.setGeometry(shadowX, shadowY, shadowWidth, shadowHeight);
631}
632
582void UnityScreen::paintPanelShadow(CompRegion const& clip)633void UnityScreen::paintPanelShadow(CompRegion const& clip)
583{634{
584 // You have no shadow texture. But how?635 // You have no shadow texture. But how?
@@ -606,11 +657,8 @@
606 return;657 return;
607 }658 }
608659
609 int shadowX = output->x();660 CompRect shadowRect;
610 int shadowY = output->y() + panel_style_.panel_height;661 FillShadowRectForOutput(shadowRect, *output);
611 int shadowWidth = output->width();
612 int shadowHeight = _shadow_texture[0]->height();
613 CompRect shadowRect(shadowX, shadowY, shadowWidth, shadowHeight);
614662
615 CompRegion redraw(clip);663 CompRegion redraw(clip);
616 redraw &= shadowRect;664 redraw &= shadowRect;
@@ -650,10 +698,10 @@
650 float y2 = r.y2();698 float y2 = r.y2();
651699
652 // Texture coordinates of the above rectangle:700 // Texture coordinates of the above rectangle:
653 float tx1 = (x1 - shadowX) / shadowWidth;701 float tx1 = (x1 - shadowRect.x()) / shadowRect.width();
654 float ty1 = (y1 - shadowY) / shadowHeight;702 float ty1 = (y1 - shadowRect.y()) / shadowRect.height();
655 float tx2 = (x2 - shadowX) / shadowWidth;703 float tx2 = (x2 - shadowRect.x()) / shadowRect.width();
656 float ty2 = (y2 - shadowY) / shadowHeight;704 float ty2 = (y2 - shadowRect.y()) / shadowRect.height();
657705
658 vertexData = {706 vertexData = {
659 x1, y1, 0,707 x1, y1, 0,
@@ -717,25 +765,37 @@
717765
718 DrawPanelUnderDash();766 DrawPanelUnderDash();
719767
720 if (BackgroundEffectHelper::HasDirtyHelpers())768 /* Bind the currently bound draw framebuffer to the read framebuffer binding.
769 * The reason being that we want to use the results of nux images being
770 * drawn to this framebuffer in glCopyTexSubImage2D operations */
771 GLint current_draw_binding, old_read_binding;
772#ifndef USE_GLES
773 glGetIntegerv(GL_READ_FRAMEBUFFER_BINDING_EXT, &old_read_binding);
774 glGetIntegerv(GL_DRAW_FRAMEBUFFER_BINDING_EXT, &current_draw_binding);
775 if (old_read_binding != current_draw_binding)
776 (*GL::bindFramebuffer) (GL_READ_FRAMEBUFFER_BINDING_EXT, current_draw_binding);
777#endif
778
779 /* If we have dirty helpers re-copy the backbuffer
780 * into a texture
781 *
782 * TODO: Make this faster by only copying the bits we
783 * need as opposed to the whole readbuffer */
784 if (dirty_helpers_on_this_frame_)
721 {785 {
722 auto gpu_device = nux::GetGraphicsDisplay()->GetGpuDevice();786 auto gpu_device = nux::GetGraphicsDisplay()->GetGpuDevice();
723 auto graphics_engine = nux::GetGraphicsDisplay()->GetGraphicsEngine();787 auto graphics_engine = nux::GetGraphicsDisplay()->GetGraphicsEngine();
724788 gpu_device->backup_texture0_ =
725 nux::ObjectPtr<nux::IOpenGLTexture2D> bg_texture =789 graphics_engine->CreateTextureFromBackBuffer(0, 0, screen->width(), screen->height());
726 graphics_engine->CreateTextureFromBackBuffer(0, 0,790 back_buffer_age_ = 0;
727 screen->width(),
728 screen->height());
729 gpu_device->backup_texture0_ = bg_texture;
730 }791 }
731792
732 nux::Geometry outputGeo(output->x (), output->y (), output->width (), output->height ());793 nux::Geometry outputGeo(output->x (), output->y (), output->width (), output->height ());
733 BackgroundEffectHelper::monitor_rect_.Set(0, 0, screen->width(), screen->height());794 BackgroundEffectHelper::monitor_rect_.Set(0, 0, screen->width(), screen->height());
734795
735 GLint fboID;796 wt->GetWindowCompositor().SetReferenceFramebuffer(current_draw_binding,
736 // Nux renders to the referenceFramebuffer when it's embedded.797 old_read_binding,
737 glGetIntegerv(GL_FRAMEBUFFER_BINDING, &fboID);798 outputGeo);
738 wt->GetWindowCompositor().SetReferenceFramebuffer(fboID, outputGeo);
739799
740 nuxPrologue();800 nuxPrologue();
741 wt->RenderInterfaceFromForeignCmd (&outputGeo);801 wt->RenderInterfaceFromForeignCmd (&outputGeo);
@@ -1223,6 +1283,7 @@
1223 doShellRepaint = force ||1283 doShellRepaint = force ||
1224 ( !region.isEmpty() &&1284 ( !region.isEmpty() &&
1225 ( !wt->GetDrawList().empty() ||1285 ( !wt->GetDrawList().empty() ||
1286 !wt->GetPresentationListGeometries().empty() ||
1226 (mask & PAINT_SCREEN_FULL_MASK)1287 (mask & PAINT_SCREEN_FULL_MASK)
1227 )1288 )
1228 );1289 );
@@ -1258,10 +1319,143 @@
1258 unsigned int mask)1319 unsigned int mask)
1259{1320{
1260 allowWindowPaint = false;1321 allowWindowPaint = false;
1322
1323 /* PAINT_SCREEN_FULL_MASK means that we are ignoring the damage
1324 * region and redrawing the whole screen, so we should make all
1325 * nux windows be added to the presentation list that intersect
1326 * this output.
1327 *
1328 * However, damaging nux has a side effect of notifying compiz
1329 * through onRedrawRequested that we need to queue another frame.
1330 * In most cases that would be desirable, and in the case where
1331 * we did that in damageCutoff, it would not be a problem as compiz
1332 * does not queue up new frames for damage that can be processed
1333 * on the current frame. However, we're now past damage cutoff, but
1334 * a change in circumstances has required that we redraw all the nux
1335 * windows on this frame. As such, we need to ensure that damagePending
1336 * is not called as a result of queuing windows for redraw, as that
1337 * would effectively result in a damage feedback loop in plugins that
1338 * require screen transformations (eg, new frame -> plugin redraws full
1339 * screen -> we reach this point and request another redraw implicitly)
1340 */
1341 if (mask & PAINT_SCREEN_FULL_MASK)
1342 {
1343 ignore_redraw_request_ = true;
1344 compizDamageNux(CompRegionRef(output->region()));
1345 ignore_redraw_request_ = false;
1346
1347 /* Fetch all the presentation list geometries - this will have the side
1348 * effect of clearing any built-up damage state */
1349 std::vector<nux::Geometry> dirty = wt->GetPresentationListGeometries();
1350 }
1351
1261 gScreen->glPaintTransformedOutput(attrib, transform, region, output, mask);1352 gScreen->glPaintTransformedOutput(attrib, transform, region, output, mask);
1262 paintPanelShadow(region);1353 paintPanelShadow(region);
1263}1354}
12641355
1356void UnityScreen::updateBlurDamage()
1357{
1358 /* If there are enabled helpers, we want to apply damage
1359 * based on how old our tracking fbo is since we may need
1360 * to redraw some of the blur regions if there has been
1361 * damage since we last bound it
1362 *
1363 * XXX: Unfortunately there's a nasty feedback loop here, and not
1364 * a whole lot we can do about it. If part of the damage from any frame
1365 * intersects a nux window, we have to mark the entire region that the
1366 * nux window covers as damaged, because nux does not have any concept
1367 * of geometry clipping. That damage will feed back to us on the next frame.
1368 */
1369 if (BackgroundEffectHelper::HasEnabledHelpers())
1370 {
1371 cScreen->applyDamageForFrameAge (back_buffer_age_);
1372
1373 /*
1374 * Prioritise user interaction over active blur updates. So the general
1375 * slowness of the active blur doesn't affect the UI interaction performance.
1376 *
1377 * Also, BackgroundEffectHelper::ProcessDamage() is causing a feedback loop
1378 * while the dash is open. Calling it results in the NEXT frame (and the
1379 * current one?) to get some damage. This GetDrawList().empty() check avoids
1380 * that feedback loop and allows us to idle correctly.
1381 *
1382 * We are doing damage processing for the blurs here, as this represents
1383 * the most up to date compiz damage under the nux windows.
1384 */
1385 if (wt->GetDrawList().empty())
1386 {
1387 CompRect::vector const& rects(buffered_compiz_damage_this_frame_.rects());
1388 for (CompRect const& r : rects)
1389 {
1390 nux::Geometry geo(r.x(), r.y(), r.width(), r.height());
1391 BackgroundEffectHelper::ProcessDamage(geo);
1392 }
1393 }
1394 }
1395}
1396
1397void UnityScreen::damageCutoff()
1398{
1399 if (force_draw_countdown_)
1400 {
1401 typedef nux::WindowCompositor::WeakBaseWindowPtr WeakBaseWindowPtr;
1402
1403 /* We have to force-redraw the whole scene because
1404 * if a bug in the nvidia driver that causes framebuffers
1405 * to be trashed on resume for a few swaps */
1406 wt->GetWindowCompositor ()
1407 .OnAllBaseWindows ([](WeakBaseWindowPtr const &w) {
1408 w->QueueDraw ();
1409 });
1410
1411 force_draw_countdown_--;
1412 }
1413
1414 /* At this point we want to take all of the compiz damage
1415 * for this frame and use it to determine which blur regions
1416 * need to be redrawn. We don't want to do this any later because
1417 * the nux damage is logically on top of the blurs and doesn't
1418 * affect them */
1419 updateBlurDamage();
1420
1421 /* Determine nux region damage last */
1422 cScreen->damageCutoff();
1423
1424 CompRegion damage_buffer, last_damage_buffer;
1425
1426 do
1427 {
1428 last_damage_buffer = damage_buffer;
1429
1430 /* First apply any damage accumulated to nux to see
1431 * what windows need to be redrawn there */
1432 compizDamageNux(buffered_compiz_damage_this_frame_);
1433
1434 /* Apply the redraw regions to compiz so that we can
1435 * draw this frame with that region included */
1436 determineNuxDamage(damage_buffer);
1437
1438 /* We want to track the nux damage here as we will use it to
1439 * determine if we need to present other nux windows too */
1440 cScreen->damageRegion(damage_buffer);
1441
1442 /* If we had to put more damage into the damage buffer then
1443 * damage compiz with it and keep going */
1444 } while (last_damage_buffer != damage_buffer);
1445
1446 /* Clear damage buffer */
1447 buffered_compiz_damage_last_frame_ = buffered_compiz_damage_this_frame_;
1448 buffered_compiz_damage_this_frame_ = CompRegion();
1449
1450 /* Tell nux that any damaged windows should be redrawn on the next
1451 * frame and not this one */
1452 wt->ForeignFrameCutoff();
1453
1454 /* We need to track this per-frame to figure out whether or not
1455 * to bind the contents fbo on each monitor pass */
1456 dirty_helpers_on_this_frame_ = BackgroundEffectHelper::HasDirtyHelpers();
1457}
1458
1265void UnityScreen::preparePaint(int ms)1459void UnityScreen::preparePaint(int ms)
1266{1460{
1267 cScreen->preparePaint(ms);1461 cScreen->preparePaint(ms);
@@ -1275,8 +1469,6 @@
1275 didShellRepaint = false;1469 didShellRepaint = false;
1276 panelShadowPainted = CompRegion();1470 panelShadowPainted = CompRegion();
1277 firstWindowAboveShell = NULL;1471 firstWindowAboveShell = NULL;
1278
1279 compizDamageNux(cScreen->currentDamage());
1280}1472}
12811473
1282void UnityScreen::donePaint()1474void UnityScreen::donePaint()
@@ -1290,11 +1482,22 @@
1290 * I think this is a Nux bug. ClearDrawList should ideally also mark all1482 * I think this is a Nux bug. ClearDrawList should ideally also mark all
1291 * the queued views as draw_cmd_queued_=false.1483 * the queued views as draw_cmd_queued_=false.
1292 */1484 */
1485
1486 /* To prevent any potential overflow problems, we are assuming here
1487 * that compiz caps the maximum number of frames tracked at 10, so
1488 * don't increment the age any more than 11 */
1489 if (back_buffer_age_ < 11)
1490 ++back_buffer_age_;
1491
1293 if (didShellRepaint)1492 if (didShellRepaint)
1294 wt->ClearDrawList();1493 wt->ClearDrawList();
12951494
1495 /* Tell nux that a new frame is now beginning and any damaged windows should
1496 * now be painted on this frame */
1497 wt->ForeignFrameEnded();
1498
1296 if (animation_controller_->HasRunningAnimations())1499 if (animation_controller_->HasRunningAnimations())
1297 nuxDamageCompiz();1500 onRedrawRequested();
12981501
1299 std::list <ShowdesktopHandlerWindowInterface *> remove_windows;1502 std::list <ShowdesktopHandlerWindowInterface *> remove_windows;
13001503
@@ -1318,124 +1521,50 @@
13181521
1319void UnityScreen::compizDamageNux(CompRegion const& damage)1522void UnityScreen::compizDamageNux(CompRegion const& damage)
1320{1523{
1321 if (!launcher_controller_)1524 /* Ask nux to present anything in our damage region
1322 return;1525 *
13231526 * Note: This is using a new nux API, to "present" windows
1324 /*1527 * to the screen, as opposed to drawing them. The difference is
1325 * Prioritise user interaction over active blur updates. So the general1528 * important. The former will just draw the window backing texture
1326 * slowness of the active blur doesn't affect the UI interaction performance.1529 * directly to the screen, the latter will re-draw the entire window.
1327 *1530 *
1328 * Also, BackgroundEffectHelper::ProcessDamage() is causing a feedback loop1531 * The former is a lot faster, do not use QueueDraw unless the contents
1329 * while the dash is open. Calling it results in the NEXT frame (and the1532 * of the window need to be re-drawn.
1330 * current one?) to get some damage. This GetDrawList().empty() check avoids
1331 * that feedback loop and allows us to idle correctly.
1332 */1533 */
1333 if (wt->GetDrawList().empty() && BackgroundEffectHelper::HasDamageableHelpers())1534 CompRect::vector rects (damage.rects());
1334 {1535 for (const CompRect &r : rects)
1335 CompRect::vector const& rects(damage.rects());1536 {
1336 for (CompRect const& r : rects)1537 nux::Geometry g (r.x(), r.y(), r.width(), r.height());
1337 {1538 wt->PresentWindowsIntersectingGeometryOnThisFrame(g);
1338 nux::Geometry geo(r.x(), r.y(), r.width(), r.height());
1339 BackgroundEffectHelper::ProcessDamage(geo);
1340 }
1341 }
1342
1343 auto const& launchers = launcher_controller_->launchers();
1344 for (auto const& launcher : launchers)
1345 {
1346 if (!launcher->Hidden())
1347 {
1348 nux::Geometry const& geo = launcher->GetAbsoluteGeometry();
1349 CompRegion launcher_region(geo.x, geo.y, geo.width, geo.height);
1350
1351 if (damage.intersects(launcher_region))
1352 launcher->QueueDraw();
1353
1354 nux::ObjectPtr<nux::View> const& tooltip = launcher->GetActiveTooltip();
1355
1356 if (tooltip)
1357 {
1358 nux::Geometry const& g = tooltip->GetAbsoluteGeometry();
1359 CompRegion tip_region(g.x, g.y, g.width, g.height);
1360
1361 if (damage.intersects(tip_region))
1362 tooltip->QueueDraw();
1363 }
1364
1365 nux::ObjectPtr<LauncherDragWindow> const& dragged_icon = launcher->GetDraggedIcon();
1366
1367 if (dragged_icon)
1368 {
1369 nux::Geometry const& g = dragged_icon->GetAbsoluteGeometry();
1370 CompRegion icon_region(g.x, g.y, g.width, g.height);
1371
1372 if (damage.intersects(icon_region))
1373 dragged_icon->QueueDraw();
1374 }
1375 }
1376 }
1377
1378 std::vector<nux::View*> const& panels(panel_controller_->GetPanelViews());
1379 for (nux::View* view : panels)
1380 {
1381 nux::Geometry const& geo = view->GetAbsoluteGeometry();
1382
1383 CompRegion panel_region(geo.x, geo.y, geo.width, geo.height);
1384
1385 if (damage.intersects(panel_region))
1386 view->QueueDraw();
1387 }
1388
1389 QuicklistManager* qm = QuicklistManager::Default();
1390 if (qm)
1391 {
1392 auto const& view = qm->Current();
1393
1394 if (view)
1395 {
1396 nux::Geometry const& geo = view->GetAbsoluteGeometry();
1397 CompRegion quicklist_region(geo.x, geo.y, geo.width, geo.height);
1398
1399 if (damage.intersects(quicklist_region))
1400 view->QueueDraw();
1401 }
1402 }
1403
1404 if (switcher_controller_ && switcher_controller_->Visible())
1405 {
1406 auto const& view = switcher_controller_->GetView();
1407
1408 if (G_LIKELY(view))
1409 {
1410 nux::Geometry const& geo = view->GetAbsoluteGeometry();
1411 CompRegion switcher_region(geo.x, geo.y, geo.width, geo.height);
1412
1413 if (damage.intersects(switcher_region))
1414 view->QueueDraw();
1415 }
1416 }1539 }
1417}1540}
14181541
1419/* Grab changed nux regions and add damage rects for them */1542/* Grab changed nux regions and add damage rects for them */
1420void UnityScreen::nuxDamageCompiz()1543void UnityScreen::determineNuxDamage(CompRegion &nux_damage)
1421{1544{
1422 /*1545 /* Fetch all the dirty geometry from nux and aggregate it */
1423 * If Nux is going to redraw anything then we have to tell Compiz to1546 std::vector<nux::Geometry> dirty = wt->GetPresentationListGeometries();
1424 * redraw everything. This is because Nux has a bad habit (bug??) of drawing1547
1425 * more than just the regions of its DrawList. (LP: #1036519)1548 for (auto const& geo : dirty)
1426 *1549 nux_damage += CompRegion(geo.x, geo.y, geo.width, geo.height);
1427 * Forunately, this does not happen on most frames. Only when the Unity1550
1428 * Shell needs to redraw something.1551 /* Special case, we need to redraw the panel shadow on panel updates */
1429 *1552 for (auto const& panel_geo : panel_controller_->GetGeometries())
1430 * TODO: Try to figure out why redrawing the panel makes the launcher also
1431 * redraw even though the launcher's geometry is not in DrawList, and
1432 * stop it. Then maybe we can revert back to the old code below #else.
1433 */
1434 if (!wt->GetDrawList().empty() || animation_controller_->HasRunningAnimations())
1435 {1553 {
1436 cScreen->damageRegionSetEnabled(this, false);1554 CompRect panel_rect (panel_geo.x,
1437 cScreen->damageScreen();1555 panel_geo.y,
1438 cScreen->damageRegionSetEnabled(this, true);1556 panel_geo.width,
1557 panel_geo.height);
1558
1559 if (nux_damage.intersects(panel_rect))
1560 {
1561 foreach (CompOutput const& o, screen->outputDevs())
1562 {
1563 CompRect shadowRect;
1564 FillShadowRectForOutput(shadowRect, o);
1565 nux_damage += shadowRect;
1566 }
1567 }
1439 }1568 }
1440}1569}
14411570
@@ -1675,7 +1804,7 @@
16751804
1676void UnityScreen::damageRegion(const CompRegion &region)1805void UnityScreen::damageRegion(const CompRegion &region)
1677{1806{
1678 compizDamageNux(region);1807 buffered_compiz_damage_this_frame_ += region;
1679 cScreen->damageRegion(region);1808 cScreen->damageRegion(region);
1680}1809}
16811810
@@ -2965,11 +3094,14 @@
2965 nux::ColorLayer background(nux::color::Transparent);3094 nux::ColorLayer background(nux::color::Transparent);
2966 static_cast<nux::WindowThread*>(thread)->SetWindowBackgroundPaintLayer(&background);3095 static_cast<nux::WindowThread*>(thread)->SetWindowBackgroundPaintLayer(&background);
2967 LOG_INFO(logger) << "UnityScreen::initUnity: " << timer.ElapsedSeconds() << "s";3096 LOG_INFO(logger) << "UnityScreen::initUnity: " << timer.ElapsedSeconds() << "s";
3097
3098 nux::GetWindowCompositor().sigHiddenViewWindow.connect (sigc::mem_fun(self, &UnityScreen::OnViewHidden));
2968}3099}
29693100
2970void UnityScreen::onRedrawRequested()3101void UnityScreen::onRedrawRequested()
2971{3102{
2972 nuxDamageCompiz();3103 if (!ignore_redraw_request_)
3104 cScreen->damagePending();
2973}3105}
29743106
2975/* Handle option changes and plug that into nux windows */3107/* Handle option changes and plug that into nux windows */
@@ -3159,6 +3291,8 @@
3159 << " h=" << primary_monitor_().height;3291 << " h=" << primary_monitor_().height;
31603292
3161 needsRelayout = false;3293 needsRelayout = false;
3294
3295 DamagePanelShadow ();
3162}3296}
31633297
3164/* Handle changes in the number of workspaces by showing the switcher3298/* Handle changes in the number of workspaces by showing the switcher
31653299
=== modified file 'plugins/unityshell/src/unityshell.h'
--- plugins/unityshell/src/unityshell.h 2013-04-11 05:53:30 +0000
+++ plugins/unityshell/src/unityshell.h 2013-05-20 16:09:26 +0000
@@ -97,9 +97,11 @@
9797
98 /* nux draw wrapper */98 /* nux draw wrapper */
99 void paintDisplay();99 void paintDisplay();
100 void paintPanelShadow(const CompRegion& clip);100 void paintPanelShadow(CompRegion const& clip);
101 void setPanelShadowMatrix(const GLMatrix& matrix);101 void setPanelShadowMatrix(const GLMatrix& matrix);
102102
103 void updateBlurDamage();
104 void damageCutoff();
103 void preparePaint (int ms);105 void preparePaint (int ms);
104 void paintFboForOutput (CompOutput *output);106 void paintFboForOutput (CompOutput *output);
105 void donePaint ();107 void donePaint ();
@@ -215,7 +217,7 @@
215 void initLauncher();217 void initLauncher();
216218
217 void compizDamageNux(CompRegion const& region);219 void compizDamageNux(CompRegion const& region);
218 void nuxDamageCompiz();220 void determineNuxDamage(CompRegion &nux_damage);
219221
220 void onRedrawRequested();222 void onRedrawRequested();
221 void Relayout();223 void Relayout();
@@ -237,6 +239,12 @@
237 void OnInitiateSpread();239 void OnInitiateSpread();
238 void OnTerminateSpread();240 void OnTerminateSpread();
239241
242 void DamagePanelShadow();
243
244 void OnViewHidden(nux::BaseWindow *bw);
245
246 void RestoreWindow(GVariant* data);
247
240 bool SaveInputThenFocus(const guint xid);248 bool SaveInputThenFocus(const guint xid);
241249
242 void OnPanelStyleChanged();250 void OnPanelStyleChanged();
@@ -245,6 +253,8 @@
245253
246 void DrawPanelUnderDash();254 void DrawPanelUnderDash();
247255
256 void FillShadowRectForOutput(CompRect &shadowRect,
257 CompOutput const &output);
248 unsigned CompizModifiersToNux(unsigned input) const;258 unsigned CompizModifiersToNux(unsigned input) const;
249 unsigned XModifiersToNux(unsigned input) const;259 unsigned XModifiersToNux(unsigned input) const;
250260
@@ -304,6 +314,12 @@
304 bool _key_nav_mode_requested;314 bool _key_nav_mode_requested;
305 CompOutput* _last_output;315 CompOutput* _last_output;
306316
317 /* a small count-down work-a-around
318 * to force full redraws of the shell
319 * a certain number of frames after a
320 * suspend / resume cycle */
321 unsigned int force_draw_countdown_;
322
307 CompRegion panelShadowPainted;323 CompRegion panelShadowPainted;
308 CompRegion nuxRegion;324 CompRegion nuxRegion;
309 CompRegion fullscreenRegion;325 CompRegion fullscreenRegion;
@@ -341,6 +357,13 @@
341 UBusManager ubus_manager_;357 UBusManager ubus_manager_;
342 glib::SourceManager sources_;358 glib::SourceManager sources_;
343359
360 CompRegion buffered_compiz_damage_this_frame_;
361 CompRegion buffered_compiz_damage_last_frame_;
362 bool ignore_redraw_request_;
363 bool dirty_helpers_on_this_frame_;
364
365 unsigned int back_buffer_age_;
366
344 friend class UnityWindow;367 friend class UnityWindow;
345};368};
346369
347370
=== modified file 'unity-shared/OverlayWindowButtons.cpp'
--- unity-shared/OverlayWindowButtons.cpp 2013-04-22 19:09:26 +0000
+++ unity-shared/OverlayWindowButtons.cpp 2013-05-20 16:09:26 +0000
@@ -43,6 +43,10 @@
43 AddChild(window_buttons_.GetPointer());43 AddChild(window_buttons_.GetPointer());
44 UpdateGeometry();44 UpdateGeometry();
45 SetBackgroundColor(nux::color::Transparent);45 SetBackgroundColor(nux::color::Transparent);
46
47 window_buttons_->queue_draw.connect([&] (nux::Layout* /*layout*/) {
48 QueueDraw();
49 });
46}50}
4751
48void OverlayWindowButtons::UpdateGeometry()52void OverlayWindowButtons::UpdateGeometry()