Merge lp://qastaging/~compiz-team/compiz/compiz.performance_1040478 into lp://qastaging/compiz/0.9.8

Proposed by Sam Spilsbury
Status: Superseded
Proposed branch: lp://qastaging/~compiz-team/compiz/compiz.performance_1040478
Merge into: lp://qastaging/compiz/0.9.8
Diff against target: 1491 lines (+949/-137)
14 files modified
plugins/opengl/CMakeLists.txt (+7/-0)
plugins/opengl/include/opengl/framebufferobject.h (+99/-5)
plugins/opengl/include/opengl/opengl-api.h (+42/-0)
plugins/opengl/include/opengl/opengl.h (+36/-16)
plugins/opengl/src/fbdirectdraw/CMakeLists.txt (+32/-0)
plugins/opengl/src/fbdirectdraw/include/framebuffer-direct-draw.h (+68/-0)
plugins/opengl/src/fbdirectdraw/src/framebuffer-direct-draw.cpp (+115/-0)
plugins/opengl/src/fbdirectdraw/tests/CMakeLists.txt (+24/-0)
plugins/opengl/src/fbdirectdraw/tests/test-opengl-framebuffer-direct-draw.cpp (+277/-0)
plugins/opengl/src/framebufferobject.cpp (+161/-22)
plugins/opengl/src/paint.cpp (+5/-79)
plugins/opengl/src/privates.h (+26/-6)
plugins/opengl/src/screen.cpp (+55/-8)
plugins/water/src/water.cpp (+2/-1)
To merge this branch: bzr merge lp://qastaging/~compiz-team/compiz/compiz.performance_1040478
Reviewer Review Type Date Requested Status
Daniel van Vugt Needs Fixing
jenkins (community) continuous-integration Approve
Review via email: mp+123798@code.qastaging.launchpad.net

Description of the change

Proposing this now so I can get some early feedback.

Implement support for glBlitFramebuffer. On some platforms this may speed up the final composite operation as we skip the fragment processor entirely.

The logic around this code is basically that if glBlitFramebuffer fails, then we don't use it again (the failure case is it not being available), and use the fallback textured draw code.

Tests added for the new module FramebufferDirectDraw.

The API and ABI of GLFramebufferObject were broken too so that we could specify which buffer we actually wanted to bind. Release team has already acked the FFe

To post a comment you must log in.
Revision history for this message
Sam Spilsbury (smspillaz) wrote :

Note: I haven't updated the abi version yet. Will do that tomorrow.

Revision history for this message
jenkins (martin-mrazik+qa) wrote :
review: Approve (continuous-integration)
Revision history for this message
Daniel van Vugt (vanvugt) wrote :

Wow, this is much bigger than it really should be, by a factor of a least 10.

Initial thoughts:

1. Indenting for four levels of namespace is a bit crazy. If you really need four then please merge all of these into a single line:

namespace compiz
{
    namespace opengl
    {
        namespace fb
        {
            namespace impl
            {

2. FramebufferDirectDraw is not a helpful name for a class. That seems to tell me what it does (verb), not what it is (noun). Please try to think of a better name.

review: Needs Fixing
Revision history for this message
Daniel van Vugt (vanvugt) wrote :

BTW, which graphics drivers have been tested so far? I will probably test the rest...

Revision history for this message
Daniel van Vugt (vanvugt) wrote :

3. FIXME needs removing from screen.cpp

        // FIXME: does not work if screen dimensions exceed max texture size
        // We should try to use glBlitFramebuffer instead.
        gScreen->glPaintCompositedOutput (screen->region (), scratchFbo, mask);

Revision history for this message
Sam Spilsbury (smspillaz) wrote :

> Wow, this is much bigger than it really should be, by a factor of a least 10.
>
> Initial thoughts:
>
> 1. Indenting for four levels of namespace is a bit crazy. If you really need
> four then please merge all of these into a single line:
>
> namespace compiz
> {
> namespace opengl
> {
> namespace fb
> {
> namespace impl
> {
>

We can probably remove the "fb" namespace.

My understanding is that compiz::plugin and compiz::plugin::impl was more or less the convention now.

> 2. FramebufferDirectDraw is not a helpful name for a class. That seems to tell
> me what it does (verb), not what it is (noun). Please try to think of a better
> name.

Possible alternatives:

 * RectangleFramebufferPainter
 * DirectFramebufferPainter (yes, I know these are er's)

I don't think its possible to give this class a noun-name as it describes a process. Maybe it could exist better as a function?

I've tested it on nvidia, nouveau and intel.

Revision history for this message
Daniel van Vugt (vanvugt) wrote :

Hmm, how do I know it's working? On my benchmark system I'm seeing zero change in performance :(

Revision history for this message
Daniel van Vugt (vanvugt) wrote :

Yes, if it can be a function then it probably should be.

Revision history for this message
Daniel van Vugt (vanvugt) wrote :

This is over-complicated:

    static const struct FilterToGLFilter filterToGLFilter[] =
    {
        { cglfb::Fast, GL_NEAREST },
        { cglfb::Good, GL_LINEAR }
    };

    if (!mask)
        return;

    GLbitfield glMask = 0;

    for (unsigned int i = 0; i < infoToGLInfoSize; ++i)
    {
        if (mask & infoToGLInfo[i].info)
            glMask |= infoToGLInfo[i].mask;
    }

Should just be:

    GLbitfield glMask =
        (mask & cglfb::Fast ? GL_NEAREST : 0) |
        (mask & cglfb::Good ? GL_LINEAR : 0);

Revision history for this message
Daniel van Vugt (vanvugt) wrote :

* "Platform" is a redundant word and possibly poorly chosen. Not sure. All the code is for one platform or another...

* priv->mMyMemberName is an over-complication. It's obviously a member by virtual of being on the right hand side of "priv->". So they should probably just be priv->myMemberName.

* Please fit your code into 80 columns. If it doesn't fit then that's a good sign that it needs fixing.

Revision history for this message
Daniel van Vugt (vanvugt) wrote :

* GLXFramebuffer::blit should use GL_NEAREST for performance. Not GL_LINEAR.

Revision history for this message
Daniel van Vugt (vanvugt) wrote :

GL::blitFramebuffer is always NULL (!?)

Revision history for this message
Sam Spilsbury (smspillaz) wrote :

On Wed, 12 Sep 2012, Daniel van Vugt wrote:

> * "Platform" is a redundant word and possibly poorly chosen. Not sure. All the code is for one platform or another...
>

Well, the "platform" in this case is either EGL or GLX. What would you
call it?

> * priv->mMyMemberName is an over-complication. It's obviously a member by virtual of being on the right hand side of "priv->". So they should probably just be priv->myMemberName.
>

Likely, I can change that.

> * Please fit your code into 80 columns. If it doesn't fit then that's a good sign that it needs fixing.
>

Clean Code suggests 120 columns for C++. Its not feasible to stick to the
80 line rule for C++ where namespaces are in use and you have descriptive
function names.

Any ideas on what to call the FramebufferDirectDraw class? Or should we
change both that and PlatformFramebuffer to be boost::function objects?

>
> --
> https://code.launchpad.net/~compiz-team/compiz/compiz.performance_1040478/+merge/123798
> Your team Compiz Maintainers is subscribed to branch lp:compiz.
>

Revision history for this message
Daniel van Vugt (vanvugt) wrote :

No wonder there was no change in performance :)

Revision history for this message
Sam Spilsbury (smspillaz) wrote :

On Wed, 12 Sep 2012, Daniel van Vugt wrote:

> * GLXFramebuffer::blit should use GL_NEAREST for performance. Not GL_LINEAR.

Yep, nice catch I got the two confused.

> --
> https://code.launchpad.net/~compiz-team/compiz/compiz.performance_1040478/+merge/123798
> Your team Compiz Maintainers is subscribed to branch lp:compiz.
>

Revision history for this message
Sam Spilsbury (smspillaz) wrote :

On Wed, 12 Sep 2012, Daniel van Vugt wrote:

> GL::blitFramebuffer is always NULL (!?)

No. it isn't.

GL::blitFramebuffer is to null for the initial "not supported" state and
then set to getProcAddress ("glBlitFramebufferEXT") when
GL_EXT_blit_framebuffer is in the opengl extensions.

> --
> https://code.launchpad.net/~compiz-team/compiz/compiz.performance_1040478/+merge/123798
> Your team Compiz Maintainers is subscribed to branch lp:compiz.
>

Revision history for this message
Sam Spilsbury (smspillaz) wrote :

> Hmm, how do I know it's working? On my benchmark system I'm seeing zero change
> in performance :(

Its not a magical performance cure, and really depends on what the implementation is doing.

If fill rate is already maxed out on your platform then it isn't going to help too much. Also if your platform implements it in terms of a texture operation it won't work.

Check if its working by changing one of the co-ordinate values in the glBlitFramebuffer call and you'll get a broken system.

Revision history for this message
Daniel van Vugt (vanvugt) wrote :

It is always NULL. Looks like you haven't pushed all your changes:

grep -r blitFramebuffer *
plugins/opengl/include/opengl/opengl.h: extern GLBlitFramebufferProc blitFramebuffer;
plugins/opengl/src/screen.cpp: GLBlitFramebufferProc blitFramebuffer = NULL;
plugins/opengl/src/screen.cpp: if (!GL::blitFramebuffer)
plugins/opengl/src/screen.cpp: (*GL::blitFramebuffer) (src.x1 (), // sx0

And on that note, it appears GLXFramebuffer::blit is never called for some reason.

Revision history for this message
Daniel van Vugt (vanvugt) wrote :

OK, I have left too many comments now. Please try to address most of them then resubmit without all this history.

Revision history for this message
jenkins (martin-mrazik+qa) wrote :
review: Approve (continuous-integration)
Revision history for this message
Daniel van Vugt (vanvugt) wrote :

I'm going to assume this is still in progress. Please set back to Needs review when ready.

Revision history for this message
Daniel van Vugt (vanvugt) wrote :

Tested r3376. GL::blitFramebuffer is now called and it works. Unfortunately no measurable speed-up on intel.

Please review the other comments, fix and resubmit later...

review: Needs Fixing
Revision history for this message
Daniel van Vugt (vanvugt) wrote :

r3379 has a simple conflict with lp:compiz

Revision history for this message
Daniel van Vugt (vanvugt) wrote :

Test results from r3379:

intel: No difference whatsoever.
radeon: No measurable difference. However expo zoom is slow and stuttery with this branch. Not with trunk.
fglrx: Significantly lower benchmark results, but not visibly different.

So far it looks like this is something we should maybe target for next cycle.

Revision history for this message
Daniel van Vugt (vanvugt) wrote :

Retested at low resolution (1024x768) whereas the above tests were at 1920x1200.

At low-res the results are identical, except:
radeon: expo zoom does not stutter at low res. Only high res.
fglrx: is very erratic and often slower at low res than high res. Maybe ignore fglrx results for now.

3388. By Sam Spilsbury

Merge lp:compiz

3389. By Sam Spilsbury

Merge lp:compiz

3390. By Sam Spilsbury

Merge e lp:compiz

3391. By Sam Spilsbury

Merge lp:compiz

3392. By Sam Spilsbury

Simplify lots of variable names, unindent namespaces

3393. By Sam Spilsbury

Set the stencil and depth attachments in allocate and not bind

3394. By Sam Spilsbury

Refactored large parts of the code, make binding the concern of BindLocation

3395. By Sam Spilsbury

Merge lp:compiz

3396. By Sam Spilsbury

Moved the creation of directly drawable fbo's into a convenience method
so that other plugins can create them

3397. By Sam Spilsbury

Fix compile error on tests

3398. By Sam Spilsbury

We don't need to provide a BindableFramebuffer to access the backbuffer

3399. By Sam Spilsbury

Unbind framebuffers before processing output change

3400. By Sam Spilsbury

Invert y-coords of glBlitFramebuffer operation

3401. By Sam Spilsbury

Reset framebuffer status on reallocation

3402. By Sam Spilsbury

Merge lp:compiz

3403. By Sam Spilsbury

Remove unused variable

3404. By Sam Spilsbury

Merge lp:compiz

3405. By Sam Spilsbury

Merge lp:compiz

3406. By Sam Spilsbury

Merge lp:compiz

3407. By Sam Spilsbury

Remove referenes to configure buffers

3408. By Sam Spilsbury

Revert trunk merge as it was broken

3409. By Sam Spilsbury

Merge lp:compiz

3410. By Sam Spilsbury

Unrevert changes which shouldn't have been reverted

3411. By Sam Spilsbury

Another botched merge

3412. By Sam Spilsbury

Merge lp:compiz

3413. By Sam Spilsbury

Fix merge errors

3414. By Sam Spilsbury

Merge lp:compiz

3415. By Sam Spilsbury

Revert more changes which should not have happened

3416. By Sam Spilsbury

Make the currently bound drawbuffer available to plugins (as they might want
to do a read/draw swap)

3417. By Sam Spilsbury

Merge lp:compiz

3418. By Sam Spilsbury

Merge lp:compiz

3419. By Sam Spilsbury

Unrevert changes reverted by a merge

Unmerged revisions

3419. By Sam Spilsbury

Unrevert changes reverted by a merge

3418. By Sam Spilsbury

Merge lp:compiz

3417. By Sam Spilsbury

Merge lp:compiz

3416. By Sam Spilsbury

Make the currently bound drawbuffer available to plugins (as they might want
to do a read/draw swap)

3415. By Sam Spilsbury

Revert more changes which should not have happened

3414. By Sam Spilsbury

Merge lp:compiz

3413. By Sam Spilsbury

Fix merge errors

3412. By Sam Spilsbury

Merge lp:compiz

3411. By Sam Spilsbury

Another botched merge

3410. By Sam Spilsbury

Unrevert changes which shouldn't have been reverted

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
The diff is not available at this time. You can reload the page or download it.

Subscribers

People subscribed via source and target branches