Bug 208523

Summary: [GTK][WPE] Building with -DENABLE_ACCELERATED_2D_CANVAS=ON fails
Product: WebKit Reporter: Que Quotion <quequotion>
Component: WebKitGTKAssignee: Adrian Perez <aperez>
Status: RESOLVED DUPLICATE    
Severity: Normal CC: aperez, bugs-noreply, mcatanzaro, steve
Priority: P2    
Version: Other   
Hardware: Unspecified   
OS: Unspecified   
Attachments:
Description Flags
log of build failure
none
Enable use of EGL/OpenGL(core 4.2) for GTK/WPE builds none

Description Que Quotion 2020-03-03 11:00:50 PST
Created attachment 392299 [details]
log of build failure

I've been trying to build epiphany 3.35.92 (latest unstable release as of this posting) and to test out webkit's "Accelerated 2D Canvas". epiphany gives the minimum required version of "webkit2gtk-4.0" as "2.27.4", so that is the version I have been attempting to build (in order to use it to build epiphany).

Since I'm using Archlinux, prerequisite to enabling the accelerated 2d canvas was building a custom cairo with the cairo-gl backend enabled, which I have done using cairo 1.17.2+17+g52a7c79fd

I had successfully built webkit2gtk 2.27.3 against the same cairo previously, to build epiphany 3.35.3; at that time it was not necessary to explicitly enable the accelerated 2d canvas feature at build time: webkit detected the presence of cairo and the cairo-gl module, and enabled it automatically.

When building 2.27.4 against the same cairo package, I noticed at first that the 2d accelerated canvas is _not_ automatically enabled; nor does configure attempt to find the cairo-gl module.

Specifying -DENABLE__ACCELERATED_2D_CANVAS=ON at build time to explicitly enable the feature seems to work, but then build fails around 76~77%.

See attached output for log of build failure.
Comment 1 Adrian Perez 2020-03-04 02:21:46 PST
(In reply to Que Quotion from comment #0)
> Created attachment 392299 [details]
> log of build failure
> 
> I've been trying to build epiphany 3.35.92 (latest unstable release as of
> this posting) and to test out webkit's "Accelerated 2D Canvas". epiphany
> gives the minimum required version of "webkit2gtk-4.0" as "2.27.4", so that
> is the version I have been attempting to build (in order to use it to build
> epiphany).

I have just checked an “trunk” also has trouble building with the option
enabled. There are also a couple of build issues with non-unified builds.
All in all it looks like none of us working on WebKit has tried doing a
build with ENABLE_ACCELERATED_2D_CANVAS=ON, but it should work even if it
is not the default — I'll take a stab at unbreaking it.

> Since I'm using Archlinux, prerequisite to enabling the accelerated 2d
> canvas was building a custom cairo with the cairo-gl backend enabled, which
> I have done using cairo 1.17.2+17+g52a7c79fd

I use Arch Linux myself, so thanks for pointing out that the Cairo package
does not have GL support enabled, this has saved me some time trying to
figure out why the WebKit build would fail configuration :]

> I had successfully built webkit2gtk 2.27.3 against the same cairo
> previously, to build epiphany 3.35.3; at that time it was not necessary to
> explicitly enable the accelerated 2d canvas feature at build time: webkit
> detected the presence of cairo and the cairo-gl module, and enabled it
> automatically.
> 
> When building 2.27.4 against the same cairo package, I noticed at first that
> the 2d accelerated canvas is _not_ automatically enabled; nor does configure
> attempt to find the cairo-gl module.

Dunno what might have changed… Anyway, in general we prefer to avoid
automatically detecting which features to enable depending on what is
installed at build time: specifying them explicitly is more robust also
for packagers so I will *not* be trying to bring autodetection back.
 
> Specifying -DENABLE_ACCELERATED_2D_CANVAS=ON at build time to explicitly
> enable the feature seems to work, but then build fails around 76~77%.
> 
> See attached output for log of build failure.

Thanks for the detailed bug report!
Comment 2 Steven Newbury 2020-03-21 02:39:24 PDT
Created attachment 394163 [details]
Enable use of EGL/OpenGL(core 4.2) for GTK/WPE builds

I've made a patch which enables this to work by using OpenGL4 instead of GLES2 with EGL.
My intention was to get WebGL2 working, but I didn't manage to successfully debug it.
Comment 3 Steven Newbury 2020-03-21 02:41:54 PDT
Requires -DWL_EGL_PLATFORM=1 -DUSE_OPENGL=1 -DHAVE_OPENGL_4=1 -DUSE_OPENGL_ES=0 to be set.
Comment 4 Steven Newbury 2020-03-21 07:48:52 PDT
about:gpu

Version Information
WebKit version
WebKitGTK 2.28.0 (tarball)
Operating system
Linux 5.6.0-rc6-00016-g8cf00335c050 #18 SMP PREEMPT Thu Mar 19 08:38:16 GMT 2020 x86_64
Desktop
GNOME
Cairo version
1.16.0 (build) 1.16.0 (runtime)
GStreamer version
1.16.2 (build) GStreamer 1.16.2 (runtime)
GTK version
3.24.14 (build) 3.24.14 (runtime)
WPE version
1.4.0 (using fdo backend 1.4.0)
Display Information
Type
Wayland
Screen geometry
0,0 1920x1080
Screen work area
0,0 1920x1080
Depth
32
Bits per color component
8
DPI
96.00
Hardware Acceleration Information
Policy
always
WebGL enabled
Yes
API
OpenGL
Native interface
EGL
GL_RENDERER
Mesa DRI Intel(R) HD Graphics 4000 (IVB GT2)
GL_VENDOR
Intel Open Source Technology Center
GL_VERSION
4.2 (Core Profile) Mesa 20.1.0-devel (git-d60375cbc2)
GL_SHADING_LANGUAGE_VERSION
4.20
GL_EXTENSIONS
GL_3DFX_texture_compression_FXT1 GL_AMD_conservative_depth GL_AMD_draw_buffers_blend GL_AMD_multi_draw_indirect GL_AMD_seamless_cubemap_per_texture GL_AMD_shader_trinary_minmax GL_AMD_texture_texture4 GL_AMD_vertex_shader_layer GL_AMD_vertex_shader_viewport_index GL_ANGLE_texture_compression_dxt3 GL_ANGLE_texture_compression_dxt5 GL_APPLE_object_purgeable GL_ARB_ES2_compatibility GL_ARB_ES3_compatibility GL_ARB_arrays_of_arrays GL_ARB_base_instance GL_ARB_blend_func_extended GL_ARB_buffer_storage GL_ARB_clear_buffer_object GL_ARB_clear_texture GL_ARB_clip_control GL_ARB_compressed_texture_pixel_storage GL_ARB_compute_shader GL_ARB_conditional_render_inverted GL_ARB_conservative_depth GL_ARB_copy_buffer GL_ARB_copy_image GL_ARB_cull_distance GL_ARB_debug_output GL_ARB_depth_buffer_float GL_ARB_depth_clamp GL_ARB_derivative_control GL_ARB_direct_state_access GL_ARB_draw_buffers GL_ARB_draw_buffers_blend GL_ARB_draw_elements_base_vertex GL_ARB_draw_indirect GL_ARB_draw_instanced GL_ARB_enhanced_layouts GL_ARB_explicit_attrib_location GL_ARB_explicit_uniform_location GL_ARB_fragment_coord_conventions GL_ARB_fragment_layer_viewport GL_ARB_fragment_shader GL_ARB_framebuffer_no_attachments GL_ARB_framebuffer_object GL_ARB_framebuffer_sRGB GL_ARB_get_program_binary GL_ARB_get_texture_sub_image GL_ARB_gl_spirv GL_ARB_gpu_shader5 GL_ARB_gpu_shader_fp64 GL_ARB_half_float_pixel GL_ARB_half_float_vertex GL_ARB_indirect_parameters GL_ARB_instanced_arrays GL_ARB_internalformat_query GL_ARB_internalformat_query2 GL_ARB_invalidate_subdata GL_ARB_map_buffer_alignment GL_ARB_map_buffer_range GL_ARB_multi_bind GL_ARB_multi_draw_indirect GL_ARB_occlusion_query2 GL_ARB_parallel_shader_compile GL_ARB_pipeline_statistics_query GL_ARB_pixel_buffer_object GL_ARB_point_sprite GL_ARB_polygon_offset_clamp GL_ARB_program_interface_query GL_ARB_provoking_vertex GL_ARB_robustness GL_ARB_sample_shading GL_ARB_sampler_objects GL_ARB_seamless_cube_map GL_ARB_seamless_cubemap_per_texture GL_ARB_separate_shader_objects GL_ARB_shader_atomic_counter_ops GL_ARB_shader_atomic_counters GL_ARB_shader_bit_encoding GL_ARB_shader_clock GL_ARB_shader_draw_parameters GL_ARB_shader_group_vote GL_ARB_shader_image_load_store GL_ARB_shader_image_size GL_ARB_shader_objects GL_ARB_shader_precision GL_ARB_shader_storage_buffer_object GL_ARB_shader_subroutine GL_ARB_shader_texture_image_samples GL_ARB_shader_texture_lod GL_ARB_shader_viewport_layer_array GL_ARB_shading_language_420pack GL_ARB_shading_language_include GL_ARB_shading_language_packing GL_ARB_spirv_extensions GL_ARB_sync GL_ARB_tessellation_shader GL_ARB_texture_barrier GL_ARB_texture_buffer_object GL_ARB_texture_buffer_object_rgb32 GL_ARB_texture_buffer_range GL_ARB_texture_compression_bptc GL_ARB_texture_compression_rgtc GL_ARB_texture_cube_map_array GL_ARB_texture_filter_anisotropic GL_ARB_texture_float GL_ARB_texture_gather GL_ARB_texture_mirror_clamp_to_edge GL_ARB_texture_multisample GL_ARB_texture_non_power_of_two GL_ARB_texture_query_levels GL_ARB_texture_query_lod GL_ARB_texture_rectangle GL_ARB_texture_rg GL_ARB_texture_rgb10_a2ui GL_ARB_texture_storage GL_ARB_texture_storage_multisample GL_ARB_texture_swizzle GL_ARB_texture_view GL_ARB_timer_query GL_ARB_transform_feedback2 GL_ARB_transform_feedback3 GL_ARB_transform_feedback_instanced GL_ARB_transform_feedback_overflow_query GL_ARB_uniform_buffer_object GL_ARB_vertex_array_bgra GL_ARB_vertex_array_object GL_ARB_vertex_attrib_64bit GL_ARB_vertex_attrib_binding GL_ARB_vertex_buffer_object GL_ARB_vertex_shader GL_ARB_vertex_type_10f_11f_11f_rev GL_ARB_vertex_type_2_10_10_10_rev GL_ARB_viewport_array GL_ATI_blend_equation_separate GL_ATI_texture_float GL_EXT_EGL_image_storage GL_EXT_EGL_sync GL_EXT_abgr GL_EXT_blend_equation_separate GL_EXT_demote_to_helper_invocation GL_EXT_draw_buffers2 GL_EXT_draw_instanced GL_EXT_framebuffer_blit GL_EXT_framebuffer_multisample GL_EXT_framebuffer_multisample_blit_scaled GL_EXT_framebuffer_object GL_EXT_framebuffer_sRGB GL_EXT_packed_depth_stencil GL_EXT_packed_float GL_EXT_pixel_buffer_object GL_EXT_polygon_offset_clamp GL_EXT_provoking_vertex GL_EXT_shader_framebuffer_fetch_non_coherent GL_EXT_shader_integer_mix GL_EXT_shader_samples_identical GL_EXT_texture_array GL_EXT_texture_compression_dxt1 GL_EXT_texture_compression_rgtc GL_EXT_texture_compression_s3tc GL_EXT_texture_filter_anisotropic GL_EXT_texture_integer GL_EXT_texture_sRGB GL_EXT_texture_sRGB_R8 GL_EXT_texture_sRGB_decode GL_EXT_texture_shadow_lod GL_EXT_texture_shared_exponent GL_EXT_texture_snorm GL_EXT_texture_swizzle GL_EXT_timer_query GL_EXT_transform_feedback GL_EXT_vertex_array_bgra GL_EXT_vertex_attrib_64bit GL_IBM_multimode_draw_arrays GL_INTEL_blackhole_render GL_INTEL_performance_query GL_KHR_blend_equation_advanced GL_KHR_context_flush_control GL_KHR_debug GL_KHR_no_error GL_KHR_parallel_shader_compile GL_KHR_robustness GL_MESA_pack_invert GL_MESA_shader_integer_functions GL_MESA_texture_signed_rgba GL_NV_compute_shader_derivatives GL_NV_conditional_render GL_NV_depth_clamp GL_NV_packed_depth_stencil GL_NV_texture_barrier GL_OES_EGL_image GL_S3_s3tc
EGL_VERSION
1.4
EGL_VENDOR
Mesa Project
EGL_EXTENSIONS
EGL_EXT_client_extensions EGL_EXT_device_base EGL_EXT_device_enumeration EGL_EXT_device_query EGL_EXT_platform_base EGL_KHR_client_get_all_proc_addresses EGL_KHR_debug EGL_EXT_platform_wayland EGL_EXT_platform_x11 EGL_MESA_platform_gbm EGL_MESA_platform_surfaceless EGL_EXT_platform_device EGL_ANDROID_blob_cache EGL_ANDROID_native_fence_sync EGL_EXT_buffer_age EGL_EXT_create_context_robustness EGL_EXT_image_dma_buf_import EGL_EXT_image_dma_buf_import_modifiers EGL_EXT_swap_buffers_with_damage EGL_KHR_config_attribs EGL_KHR_create_context EGL_KHR_create_context_no_error EGL_KHR_fence_sync EGL_KHR_get_all_proc_addresses EGL_KHR_gl_colorspace EGL_KHR_gl_renderbuffer_image EGL_KHR_gl_texture_2D_image EGL_KHR_gl_texture_3D_image EGL_KHR_gl_texture_cubemap_image EGL_KHR_image_base EGL_KHR_no_config_context EGL_KHR_reusable_sync EGL_KHR_surfaceless_context EGL_KHR_swap_buffers_with_damage EGL_EXT_pixel_format_float EGL_KHR_wait_sync EGL_MESA_configless_context EGL_MESA_drm_image EGL_MESA_image_dma_buf_export EGL_MESA_query_driver EGL_WL_bind_wayland_display EGL_WL_create_wayland_buffer_from_image
Comment 5 Michael Catanzaro 2020-10-13 07:29:24 PDT
This build option is removed in bug #217603, so probably better to not use it.
Comment 6 Adrian Perez 2020-10-13 07:53:17 PDT
(In reply to Michael Catanzaro from comment #5)
> This build option is removed in bug #217603, so probably better to not use
> it.

For the record, we fixed the build in bug #217384 and backported the fix
to the 2.30.x branch. The rationale is that 2.30.0 and 2.30.1 are already
published with the option available, so it's desirable to have a fix for
the release branch (2.30.2 will include it) — so at the moment it's possible
to build both trunk and the 2.30.x branch with the option.

While fixing things, we discussed a bit about the future for this option,
and decided that it could be a good idea to remove it: it's never built
nor tested by default, therefore it tends to break and bitrot; and while
in some cases it gives marginal rendering performance improvements, in
many situations it makes things worse. The latter is why it's not enabled
by default.
Comment 7 Adrian Perez 2020-10-13 07:53:37 PDT

*** This bug has been marked as a duplicate of bug 217603 ***
Comment 8 Adrian Perez 2020-10-13 07:53:56 PDT

*** This bug has been marked as a duplicate of bug 217384 ***
Comment 9 Michael Catanzaro 2020-10-13 08:07:29 PDT
(In reply to Adrian Perez from comment #6)
> For the record, we fixed the build in bug #217384 and backported the fix
> to the 2.30.x branch.

Hm, there's also bug #216602 (which I didn't close, maybe should?).
Comment 10 Adrian Perez 2020-10-13 12:24:02 PDT
(In reply to Michael Catanzaro from comment #9)
> (In reply to Adrian Perez from comment #6)
> > For the record, we fixed the build in bug #217384 and backported the fix
> > to the 2.30.x branch.
> 
> Hm, there's also bug #216602 (which I didn't close, maybe should?).

I closed it as well, thanks for pointing me to it; somehow I managed
to miss it back when it was filed 😓️