Bug 147625 - [GTK] Accelerated 2D Canvas enabled when cairo-gl is not available
Summary: [GTK] Accelerated 2D Canvas enabled when cairo-gl is not available
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: WebKitGTK (show other bugs)
Version: 528+ (Nightly build)
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Nobody
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2015-08-04 03:54 PDT by Mario Sanchez Prada
Modified: 2015-08-04 05:58 PDT (History)
5 users (show)

See Also:


Attachments
Patch proposal (2.57 KB, patch)
2015-08-04 04:28 PDT, Mario Sanchez Prada
mrobinson: review+
Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Mario Sanchez Prada 2015-08-04 03:54:20 PDT
When I tried to build WebKitGTK+ 2.9.5 from the source tarball today, ENABLE_ACCELERATED_2D_CANVAS gets always set to ON despite of cairo-gl not being available in the system, leading to a build error later on, due to the missing header:

  ../../Source/WebCore/platform/graphics/cairo/CairoUtilities.cpp:44:22: fatal error: cairo-gl.h: No such file or directory

I've checked this in a 32-bit Debian system, in my Fedora 22 64 bit system, both with the 2.9.5 tarball and the latest code from SVN trunk, and I can reproduce this problem reliably, either using the build-webkit script or cmake.

See the relevant excerpt for a cmake build:

    $ cmake -DPORT=GTK -DCMAKE_BUILD_TYPE=Release
    -- Found BISON: /usr/bin/bison (found suitable version "2.5", minimum required is "2.3") 
    [...]
    -- Found OPENGLES2: /usr/include  
    -- checking for module 'cairo-gl'
    --   package 'cairo-gl' not found
    -- checking for module 'cairo-glx'
    --   package 'cairo-glx' not found
    -- checking for module 'cairo-egl'
    --   package 'cairo-egl' not found
    -- Found CairoGL: CAIRO_GLX_INCLUDE_DIRS;CAIRO_EGL_INCLUDE_DIRS (Required is at least version "1.10.2") 
    -- checking for module 'gtk+-3.0'
    
    [...]
    
    -- Using platform-specific CMakeLists: /home/mario/work/WebKit/Source/WTF/wtf/PlatformGTK.cmake
    -- Using platform-specific CMakeLists: /home/mario/work/WebKit/Source/JavaScriptCore/PlatformGTK.cmake
    -- Using platform-specific CMakeLists: /home/mario/work/WebKit/Source/JavaScriptCore/shell/PlatformGTK.cmake
    -- Using platform-specific CMakeLists: /home/mario/work/WebKit/Source/WebCore/PlatformGTK.cmake
    -- Using platform-specific CMakeLists: /home/mario/work/WebKit/Source/WebKit2/PlatformGTK.cmake
    -- Using platform-specific CMakeLists: /home/mario/work/WebKit/Source/PlatformGTK.cmake
    -- Found Gettext: /usr/bin/msgmerge (found version "0.19.2") 
    -- Enabled features:
    --  ENABLE_ACCELERATED_2D_CANVAS ............ ON
    --  ENABLE_CREDENTIAL_STORAGE                 ON
    [...]

Sounds like something is wrong with the CMake rules, because as far as I can tell this feature should only be enable if cairo-gl is actually available
Comment 1 Mario Sanchez Prada 2015-08-04 04:28:50 PDT
Created attachment 258170 [details]
Patch proposal

This patch works makes sure at ACCELERATED_2D_CANVAS cairo-gl is available only when cairo-gl is available in the system, setting it to OFF otherwise.

Excerpt of the relevant cmake output when cairo-gl IS available:

    [...]
    -- Found OPENGLES2: /usr/include  
    -- checking for module 'cairo-gl'
    --   found cairo-gl, version 1.14.0
    -- checking for module 'cairo-glx'
    --   found cairo-glx, version 1.14.0
    -- checking for module 'cairo-egl'
    --   found cairo-egl, version 1.14.0
    -- Found CairoGL: /usr/include/cairo;/usr/include/glib-2.0;/usr/lib/i386-linux-gnu/glib-2.0/include;/usr/include/pixman-1;/usr/include/freetype2;/usr/include/libpng12;/usr/include/libdrm;CAIRO_GLX_INCLUDE_DIRS;CAIRO_EGL_INCLUDE_DIRS (Required is at least version "1.10.2") 
    -- checking for module 'gtk+-3.0'
    [...]
    -- Enabled features:
    --  ENABLE_ACCELERATED_2D_CANVAS ............ ON
    --  ENABLE_CREDENTIAL_STORAGE                 ON
    [...]

Excerpt of the relevant cmake output when cairo-gl IS NOT available:

    [...]
    -- Found OPENGLES2: /usr/include  
    -- checking for module 'cairo-gl'
    --   package 'cairo-gl' not found
    -- checking for module 'cairo-glx'
    --   package 'cairo-glx' not found
    -- checking for module 'cairo-egl'
    --   package 'cairo-egl' not found
    -- Could NOT find CairoGL (missing:  CAIROGL_INCLUDE_DIRS CAIROGL_LIBRARIES) (Required is at least version "1.10.2")
    -- checking for module 'gtk+-3.0'
    [...]
    -- Enabled features:
    --  ENABLE_ACCELERATED_2D_CANVAS ............ OFF
    --  ENABLE_CREDENTIAL_STORAGE                 ON
    [...]

Please review, thanks!
Comment 2 Mario Sanchez Prada 2015-08-04 05:18:32 PDT
Btw, it seems that the reason why this was not misbehaving in the 2.8.x releases is because of a typo in FindCairoGL.cmake:

In the stable series, the last call to find_package_handle_standard_args() in that file was passing 'CairoGL' as an argument, therefore always defining CAIROGL_FOUND afterwards. However, CAIRO_GL_FOUND was being checked from OptionsGTK.cmake to set ENABLE_ACCELERATED_2D_CANVAS, effectively causing it to be always OFF, no matter what happened before.

I'll be filing a new bug for the 2.8.x series soon, but I thought I would explain here why this was a problem now and not before, because it confused me too.
Comment 3 Mario Sanchez Prada 2015-08-04 05:29:37 PDT
(In reply to comment #2)
> Btw, it seems that the reason why this was not misbehaving in the 2.8.x
> releases is because of a typo in FindCairoGL.cmake:
> 
> In the stable series, the last call to find_package_handle_standard_args()
> in that file was passing 'CairoGL' as an argument, therefore always defining
> CAIROGL_FOUND afterwards. However, CAIRO_GL_FOUND was being checked from
> OptionsGTK.cmake to set ENABLE_ACCELERATED_2D_CANVAS, effectively causing it
> to be always OFF, no matter what happened before.
> 
> I'll be filing a new bug for the 2.8.x series soon, but I thought I would
> explain here why this was a problem now and not before, because it confused
> me too.

Actually, I won't do that. All we'd have to do is to backport the patch for bug 144846 together with the one here to the stable releases and that would do it.

I'll update trac.webkit.org/wiki/WebKitGTK/2.8.x instead
Comment 4 Mario Sanchez Prada 2015-08-04 05:58:28 PDT
Committed r187854: <http://trac.webkit.org/changeset/187854>