Merge lp://qastaging/~compiz-linaro-team/compiz/gles2 into lp://qastaging/compiz/0.9.8

Proposed by Daniel van Vugt
Status: Merged
Approved by: Sam Spilsbury
Approved revision: 3378
Merged at revision: 3320
Proposed branch: lp://qastaging/~compiz-linaro-team/compiz/gles2
Merge into: lp://qastaging/compiz/0.9.8
Diff against target: 16838 lines (+7498/-4718)
104 files modified
cmake/CMakeLists.txt (+2/-0)
cmake/CompizCommon.cmake (+12/-0)
cmake/CompizPlugin.cmake (+14/-10)
cmake/FindCompiz.cmake (+1/-1)
cmake/FindOpenGLES2.cmake (+51/-0)
cmake/base.cmake (+3/-0)
cmake/plugin_extensions/CompizOpenGLFixups.cmake (+22/-0)
include/core/wrapsystem.h (+8/-0)
plugins/CMakeLists.txt (+30/-0)
plugins/animation/CMakeLists.txt (+3/-5)
plugins/animation/include/animation/animation.h (+1/-1)
plugins/animation/include/animation/animeffect.h (+3/-3)
plugins/animation/include/animation/grid.h (+0/-2)
plugins/animation/src/animation.cpp (+85/-27)
plugins/animation/src/grid.cpp (+25/-258)
plugins/animation/src/private.h (+3/-3)
plugins/annotate/src/annotate.cpp (+149/-71)
plugins/blur/CMakeLists.txt (+12/-12)
plugins/clone/src/clone.cpp (+0/-5)
plugins/compiztoolbox/src/compiztoolbox.cpp (+5/-18)
plugins/copytex/src/copytex.cpp (+9/-0)
plugins/cube/include/cube/cube.h (+9/-6)
plugins/cube/src/cube.cpp (+85/-80)
plugins/decor/src/decor.cpp (+29/-27)
plugins/decor/src/decor.h (+2/-2)
plugins/expo/CMakeLists.txt (+4/-8)
plugins/expo/src/expo.cpp (+256/-111)
plugins/expo/src/expo.h (+3/-4)
plugins/ezoom/src/ezoom.cpp (+118/-52)
plugins/grid/src/grid.cpp (+108/-53)
plugins/imgsvg/src/imgsvg.cpp (+9/-6)
plugins/imgsvg/src/imgsvg.h (+2/-1)
plugins/kdecompat/src/kdecompat.cpp (+7/-22)
plugins/mag/src/mag.cpp (+102/-73)
plugins/mag/src/mag.h (+2/-0)
plugins/neg/src/neg.cpp (+33/-106)
plugins/neg/src/neg.h (+3/-6)
plugins/obs/src/obs.cpp (+8/-7)
plugins/obs/src/obs.h (+1/-1)
plugins/opengl/CMakeLists.txt (+14/-4)
plugins/opengl/compiz-opengl.pc.in (+1/-1)
plugins/opengl/include/opengl/doublebuffer.h (+39/-0)
plugins/opengl/include/opengl/fragment.h (+0/-125)
plugins/opengl/include/opengl/framebufferobject.h (+104/-0)
plugins/opengl/include/opengl/matrix.h (+2/-0)
plugins/opengl/include/opengl/opengl.h (+441/-73)
plugins/opengl/include/opengl/program.h (+75/-0)
plugins/opengl/include/opengl/programcache.h (+51/-0)
plugins/opengl/include/opengl/shadercache.h (+100/-0)
plugins/opengl/include/opengl/texture.h (+5/-0)
plugins/opengl/include/opengl/vector.h (+3/-3)
plugins/opengl/include/opengl/vertexbuffer.h (+130/-0)
plugins/opengl/opengl.xml.in (+15/-0)
plugins/opengl/src/doublebuffer/CMakeLists.txt (+31/-0)
plugins/opengl/src/doublebuffer/src/double-buffer.cpp (+76/-0)
plugins/opengl/src/doublebuffer/tests/CMakeLists.txt (+24/-0)
plugins/opengl/src/doublebuffer/tests/test-opengl-double-buffer.cpp (+98/-0)
plugins/opengl/src/fragment.cpp (+0/-1146)
plugins/opengl/src/framebufferobject.cpp (+221/-0)
plugins/opengl/src/matrix.cpp (+54/-0)
plugins/opengl/src/paint.cpp (+472/-443)
plugins/opengl/src/privatefragment.h (+0/-54)
plugins/opengl/src/privates.h (+101/-13)
plugins/opengl/src/privatetexture.h (+32/-0)
plugins/opengl/src/privatevertexbuffer.h (+149/-0)
plugins/opengl/src/program.cpp (+262/-0)
plugins/opengl/src/programcache.cpp (+175/-0)
plugins/opengl/src/screen.cpp (+938/-154)
plugins/opengl/src/shadercache.cpp (+246/-0)
plugins/opengl/src/texture.cpp (+152/-22)
plugins/opengl/src/vector.cpp (+2/-2)
plugins/opengl/src/vertexbuffer.cpp (+634/-0)
plugins/opengl/src/window.cpp (+65/-83)
plugins/resize/src/resize.cpp (+84/-31)
plugins/resizeinfo/src/resizeinfo.cpp (+45/-27)
plugins/resizeinfo/src/resizeinfo.h (+2/-1)
plugins/ring/src/ring.cpp (+19/-37)
plugins/ring/src/ring.h (+1/-1)
plugins/scale/src/scale.cpp (+10/-17)
plugins/scaleaddon/src/scaleaddon.cpp (+51/-21)
plugins/scaleaddon/src/scaleaddon.h (+2/-2)
plugins/scalefilter/src/scalefilter.cpp (+1/-6)
plugins/screenshot/src/screenshot.cpp (+47/-20)
plugins/shift/src/shift.cpp (+95/-98)
plugins/shift/src/shift.h (+1/-1)
plugins/staticswitcher/src/staticswitcher.cpp (+156/-64)
plugins/staticswitcher/src/staticswitcher.h (+5/-3)
plugins/switcher/src/switcher.cpp (+45/-42)
plugins/text/include/text/text.h (+2/-1)
plugins/text/src/text.cpp (+53/-24)
plugins/thumbnail/src/thumbnail.cpp (+301/-118)
plugins/thumbnail/src/thumbnail.h (+3/-1)
plugins/wall/src/wall.cpp (+60/-46)
plugins/wall/src/wall.h (+1/-1)
plugins/water/src/shaders.h (+200/-0)
plugins/water/src/water.cpp (+281/-801)
plugins/water/src/water.h (+33/-63)
plugins/water/water.xml.in (+26/-2)
plugins/wobbly/src/wobbly.cpp (+20/-176)
plugins/wobbly/src/wobbly.h (+0/-1)
plugins/workarounds/src/workarounds.cpp (+14/-0)
plugins/workarounds/src/workarounds.h (+4/-0)
plugins/workspacenames/src/workspacenames.cpp (+4/-8)
plugins/workspacenames/src/workspacenames.h (+1/-1)
To merge this branch: bzr merge lp://qastaging/~compiz-linaro-team/compiz/gles2
Reviewer Review Type Date Requested Status
Daniel van Vugt Approve
Sam Spilsbury Approve
Tim Penhey Pending
Alan Griffiths Pending
jenkins continuous-integration Pending
Review via email: mp+120361@code.qastaging.launchpad.net

This proposal supersedes a proposal from 2012-08-10.

Commit message

This branch contains the code to make compiz work on GLES. This includes
several changes to the compiz API.

* GLVertexBuffer class added for managing vertices, normals, texture
  coordinates, and colors
* GLProgram class added for managing GLSL programs
* GLProgramCache class added for managing per-plugin GLSL programs
  efficiently, uses an LRU cache to avoid recompiling recently used GLSL
  programs all the time
* GLShaderCache class added for managing dynamically created shader source
  code.
* GLFragment class removed as fragment programs are no longer used (replaced
  with GLSL programs)
* EGL context setup added
* EglTexture class added to use EGL_image extension instead of
  GLX_EXT_texture_from_pixmap for GLES

Description of the change

WARNING: The Preview diff is incomplete due to Launchpad limitations. Please click Download diff to get the whole thing.

BUGS: Yes, there a quite a few still but I think they're acceptable now. The full list of known bugs in this branch is: https://bugs.launchpad.net/compiz/+bugs?field.tag=gles
and the bugs it causes in Unity:
https://bugs.launchpad.net/unity/+bugs?field.tag=gles

To post a comment you must log in.
Revision history for this message
Sam Spilsbury (smspillaz) wrote : Posted in a previous version of this proposal
Download full text (17.9 KiB)

The diff is quite large, however it should be possible still to do a code review:

+static bool
+unproject (float winx, float winy, float winz,
+ const GLMatrix &modelview,
+ const GLMatrix &projection,
+ const GLint viewport[4],
+ float *objx, float *objy, float *objz)
+{
+ GLMatrix finalMatrix = projection * modelview;
+ float in[4], out[4];
+
+ if (!finalMatrix.invert ())
+ return false;
+
+ in[0] = winx;
+ in[1] = winy;
+ in[2] = winz;
+ in[3] = 1.0;
+
+ /* Map x and y from window coordinates */
+ in[0] = (in[0] - viewport[0]) / viewport[2];
+ in[1] = (in[1] - viewport[1]) / viewport[3];
+
+ /* Map to range -1 to 1 */
+ in[0] = in[0] * 2 - 1;
+ in[1] = in[1] * 2 - 1;
+ in[2] = in[2] * 2 - 1;
+
+ for (int i = 0; i < 4; i++)
+ {
+ out[i] = in[0] * finalMatrix[i] +
+ in[1] * finalMatrix[4 + i] +
+ in[2] * finalMatrix[8 + i] +
+ in[3] * finalMatrix[12 + i];
+ }
+
+ if (out[3] == 0.0)
+ return false;
+
+ out[0] /= out[3];
+ out[1] /= out[3];
+ out[2] /= out[3];
+
+ *objx = out[0];
+ *objy = out[1];
+ *objz = out[2];
+
+ return true;
+}
+

+static bool
+project (float objx, float objy, float objz,
+ const float modelview[16], const float projection[16],
+ const GLint viewport[4],
+ float *winx, float *winy, float *winz)
+{
+ unsigned int i;
+ float in[4];
+ float out[4];
+
+ in[0] = objx;
+ in[1] = objy;
+ in[2] = objz;
+ in[3] = 1.0;
+
+ for (i = 0; i < 4; i++) {
+ out[i] =
+ in[0] * modelview[i] +
+ in[1] * modelview[4 + i] +
+ in[2] * modelview[8 + i] +
+ in[3] * modelview[12 + i];
+ }
+
+ for (i = 0; i < 4; i++) {
+ in[i] =
+ out[0] * projection[i] +
+ out[1] * projection[4 + i] +
+ out[2] * projection[8 + i] +
+ out[3] * projection[12 + i];
+ }
+
+ if (in[3] == 0.0)
+ return false;
+
+ in[0] /= in[3];
+ in[1] /= in[3];
+ in[2] /= in[3];
+ /* Map x, y and z to range 0-1 */
+ in[0] = in[0] * 0.5 + 0.5;
+ in[1] = in[1] * 0.5 + 0.5;
+ in[2] = in[2] * 0.5 + 0.5;
+
+ /* Map x,y to viewport */
+ in[0] = in[0] * viewport[2] + viewport[0];
+ in[1] = in[1] * viewport[3] + viewport[1];
+
+ *winx = in[0];
+ *winy = in[1];
+ *winz = in[2];
+ return true;
+}

This is re-usable in cube and should be put somewhere. GLMatrix?

=== added file 'cmake/FindOpenGLES2.cmake'
--- cmake/FindOpenGLES2.cmake 1970-01-01 00:00:00 +0000
+++ cmake/FindOpenGLES2.cmake 2012-08-10 08:27:48 +0000
@@ -0,0 +1,51 @@
+# - Try to find OpenGLES
+# Once done this will define
+#
+# OPENGLES2_FOUND - system has OpenGLES
+# OPENGLES2_INCLUDE_DIR - the GLES include directory
+# OPENGLES2_LIBRARY - the GLES library
+# OPENGLES2_LIBRARIES - Link this to use OpenGLES
+#
+
+FIND_PATH(OPENGLES2_INCLUDE_DIR GLES2/gl2.h
+ /usr/openwin/share/include
+ /opt/graphics/OpenGL/include /usr/X11R6/include
+ /usr/include
+)
+
+FIND_LIBRARY(OPENGLES2_LIBRARY
+ NAMES GLESv2
+ PATHS /opt/graphics/OpenGL/lib
+ /usr/openwin/lib
+ /usr/shlib /usr/X11R6/lib
+ /usr/lib
+)
+
+FIND_L...

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

Thanks Sam. Please try to keep your comments a manageable size. Or make each point in a new comment.

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

Initially I thought *project should go in GLMatrix too. However then I cleaned up project() and realized it should not be using GLMatrix. It looks like unproject similarly should not be using GLMatrix. Though *project() should probably live somewhere in the opengl plugin, I agree.

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

Set to work in progress again.

We cannot realistically consider merging this until the incompatibilities with Unity are also fixed:
https://bugs.launchpad.net/unity/+bugs?field.tag=gles

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

> 2. It's ugly, bad design. Member data should not be repeatedly passed as
     a parameter. I know there is a limitation in the current wrapping/
     interface design that makes it impossible to access vertexBuffer as a
     member, but that's no excuse for making the code worse than it already
     was.

Can you clarify this please? It didn't come up in the original review and I'm suprised you've put it as a reason for reverting it now.

While passing member data through function arguments is not great, it at least restricts the scope in which that data can be accessed, which is the correct thing to do.

I can understand reverting it in the meantime because unity is difficult to port with ifdefs, but if you're going to do so please consult with the person who wrote it (who happens to live in the same timezone as you, so its really not an issue to do so) for advice on how to handle it rather than taking the unilateral approach of just reverting code.

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

I was extremely frustrated yesterday and just wanted the code to build. I wasn't feeling like consulting.

Sorry, I thought it did come up in the original review. I was thinking it all along but (as usual) failed to articulate all of my thoughts into words.

It's foreseeable that I will approve the changes again. But not until Unity has been updated to support them first. That would be enclosed in "#if COMPIZ_OPENGL_ABI >= 6", I imagine.

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

> I was extremely frustrated yesterday and just wanted the code to build. I
> wasn't feeling like consulting.
>
> Sorry, I thought it did come up in the original review. I was thinking it all
> along but (as usual) failed to articulate all of my thoughts into words.
>
> It's foreseeable that I will approve the changes again. But not until Unity
> has been updated to support them first. That would be enclosed in "#if
> COMPIZ_OPENGL_ABI >= 6", I imagine.

Okay, thanks. Noted, will re-propose the unrevert of those changes at an appropriate time.

Cheers,

Sam

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

OK, I /think/ the worst of the Unity regressions are now fixed, or at least with fixes proposed:
https://bugs.launchpad.net/unity/+bugs?field.tag=gles

Let's open this for review again. But be aware I may not action some of the optional cleanups (already mentioned) before this branch lands.

Revision history for this message
Omer Akram (om26er) wrote :

Nice work btw, working through all those regression along the way :-)

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

Tested on nouveau, intel and ongoing testing was done on ARM/PowerVR too.

I'm happy enough for this to go in as-is, obviously it isn't yet release quality, however we need to put it in before feature freeze.

Things I would like to see actioned during the rest of the release period.

1. Tests. Tests. Tests
 a. Specifically on the behaviour of GLVertexBuffer, GLFramebufferObject and GLShaderCache
 b. No need for test coverage on areas where the API changed
2. GLVertexBuffer begin/end - that's bad design we need to fix it
3. Need to remove direct access to GLVertexBuffer in GLWindow
4. Sort out the mipmapping story on mesa drivers (add a driver workaround?)
5. project/unproject need to go somewhere common
6. Port/Drop blur
7. Port the rest of mag.
8. compiz-opengl-impl.h
9. Remove spurious ifdefs
10. Remove the options to control rendering features.

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

A couple of new blockers were found/introduced today :(

review: Needs Fixing
Revision history for this message
Daniel van Vugt (vanvugt) wrote :
Revision history for this message
Daniel van Vugt (vanvugt) :
review: Approve
Revision history for this message
Unity Merger (unity-merger) wrote :

The Jenkins job https://jenkins.qa.ubuntu.com/job/automerge-compiz-core/66/console reported an error when processing this lp:~compiz-linaro-team/compiz/gles2 branch.
Not merging it.

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