Merge lp:~vanvugt/unity/fix-1043260-6.0 into lp:unity/6.0

Proposed by Daniel van Vugt
Status: Merged
Approved by: Andrea Azzarone
Approved revision: no longer in the source branch.
Merged at revision: 2742
Proposed branch: lp:~vanvugt/unity/fix-1043260-6.0
Merge into: lp:unity/6.0
Diff against target: 24 lines (+9/-5)
1 file modified
plugins/unityshell/src/unityshell.cpp (+9/-5)
To merge this branch: bzr merge lp:~vanvugt/unity/fix-1043260-6.0
Reviewer Review Type Date Requested Status
Andrea Azzarone (community) Approve
Compiz Maintainers Pending
Review via email: mp+126656@code.launchpad.net

This proposal supersedes a proposal from 2012-09-19.

Commit message

Don't keep re-blurring parts of the shell we've already painted, because
that will creep in and look like a shadow on the edge of the blur region.
(LP: #1043260)

This happens when the same texture (the FBO texture) is both the source and
the destination for the three blur operations (launcher, panel, then dash).
My quick fix is to take a copy of the FBO texture at the start of the frame
(before any shell is painted), rather than reading from the same texture
(FBO) that we're writing to.

This also fixes LP: #1039999, because we are no longer assuming the backbuffer
is an FBO. Instead we let Nux decide and take the right steps to read the
real backbuffer, whatever that is.

Description of the change

See commit message.

To post a comment you must log in.
Revision history for this message
Daniel van Vugt (vanvugt) wrote : Posted in a previous version of this proposal

Warning:
This fix will slow down active blur a little.

If we desperately want to maintain performance then I suggest either:
  (a) Don't approve it and let the bugs slip into quantal b2; or
  (b) Ask a Nux/Unity expert to look at unity-shared/BackgroundEffectHelper.cpp and rewrite it to only do one blur (used by all geos) per frame.

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

Hmm, is this correct?

16 + nux::ObjectPtr<nux::IOpenGLTexture2D> bg_texture =
17 + graphics_engine->CreateTextureFromBackBuffer(0, 0,
18 + screen->width(),
19 + screen->height());

I thought that nux will only read from the bound framebuffer object if nux actually knew about its existence. In this case, the compiz fbo is bound, but nux doesn't know about it, so it will read from the real backbuffer instead (which is not what you want).

I did just recently add a method to WindowCompositor to handle this case - see WindowCompositor::RestoreMainFramebuffer. You can probably use that in combination with SetReferenceFramebuffer, eg, RestoreMainFramebuffer -> SetReferenceFramebuffer -> CreateTextureFromBackbuffer.

A less roundabout way of doing that would be to have a GLFramebufferObject that unity *owns* and then we bind that and paint the compiz one into it. Then pass that one as the device texture. Once the blit framebuffer code is landed, we can use that on the unity side too.

Revision history for this message
Daniel van Vugt (vanvugt) wrote : Posted in a previous version of this proposal

Sam,

I tried using your new Nux code to implement this and could not get it to make any difference. Care to prototype?

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

Works here.

review: Approve
Revision history for this message
Unity Merger (unity-merger) wrote : Posted in a previous version of this proposal

Attempt to merge into lp:unity/6.0 failed due to conflicts:

text conflict in tests/autopilot/unity/tests/launcher/test_icon_behavior.py
text conflict in tests/gmockvolume.c

Revision history for this message
Daniel van Vugt (vanvugt) wrote : Posted in a previous version of this proposal

The conflicts aren't real. That's just because lp:unity/6.0 got overwritten with the contents of lp:unity not long after this proposal. Now fixing...

Revision history for this message
Daniel van Vugt (vanvugt) wrote : Posted in a previous version of this proposal

Damn. Now there are unwanted changes from other peoples' work :(

Revision history for this message
Daniel van Vugt (vanvugt) : Posted in a previous version of this proposal
review: Needs Fixing
Revision history for this message
Andrea Azzarone (azzar1) :
review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'plugins/unityshell/src/unityshell.cpp'
2--- plugins/unityshell/src/unityshell.cpp 2012-09-24 19:39:00 +0000
3+++ plugins/unityshell/src/unityshell.cpp 2012-09-27 10:40:26 +0000
4@@ -682,11 +682,15 @@
5
6 auto gpu_device = nux::GetGraphicsDisplay()->GetGpuDevice();
7
8- nux::ObjectPtr<nux::IOpenGLTexture2D> device_texture =
9- gpu_device->CreateTexture2DFromID(gScreen->fbo ()->tex ()->name (),
10- screen->width(), screen->height(), 1, nux::BITFMT_R8G8B8A8);
11-
12- gpu_device->backup_texture0_ = device_texture;
13+ if (BackgroundEffectHelper::HasDirtyHelpers())
14+ {
15+ auto graphics_engine = nux::GetGraphicsDisplay()->GetGraphicsEngine();
16+ nux::ObjectPtr<nux::IOpenGLTexture2D> bg_texture =
17+ graphics_engine->CreateTextureFromBackBuffer(0, 0,
18+ screen->width(),
19+ screen->height());
20+ gpu_device->backup_texture0_ = bg_texture;
21+ }
22
23 nux::Geometry geo(0, 0, screen->width (), screen->height ());
24 nux::Geometry outputGeo(output->x (), output->y (), output->width (), output->height ());

Subscribers

People subscribed via source and target branches