WelcomeWelcome | FAQFAQ | DownloadsDownloads | WikiWiki

Author Topic: gtk4 extension on armv7l (RaspberryPi)  (Read 1008 times)

Offline yvs

  • Jr. Member
  • **
  • Posts: 54
gtk4 extension on armv7l (RaspberryPi)
« on: July 07, 2024, 07:54:03 PM »
Hi everyone,

trying to compile gtk4 app on RaspberryPi3B+ (armv7l) got these complains from pkg-config:
Quote
% pkg-config --cflags gtk4

Package xcursor was not found in the pkg-config search path.
Perhaps you should add the directory containing `xcursor.pc'
to the PKG_CONFIG_PATH environment variable
Package 'xcursor', required by 'gtk4', not found

Package xcomposite was not found in the pkg-config search path.
Perhaps you should add the directory containing `xcomposite.pc'
to the PKG_CONFIG_PATH environment variable
Package 'xcomposite', required by 'gtk4', not found

Package xinerama was not found in the pkg-config search path.
Perhaps you should add the directory containing `xinerama.pc'
to the PKG_CONFIG_PATH environment variable
Package 'xinerama', required by 'gtk4', not found

After added 'libXcursor-dev libXcomposite-dev libXinerama-dev' to gtk4-dev dependencies
building started and quickly finished because of GTK_MAJOR_VERSION is less than 4. It became a bit confusing.
Then toggling off GTK4 version checking I got (despite that gtk3.98.2 is almost gtk4) there's still too mush difference in API, too many functions need to be replaced or rewritten in gtk3 style to get it works, not sure if gtk3.98 should be named gtk4 (after trying to adapt gtk4 code to gtk3.98.2 api).

Has anyone tried to build a bit more compat gtk4 extension for armv7l? (to not spend time on it if that's unlikely to build successfully)
« Last Edit: July 07, 2024, 08:10:08 PM by yvs »

Offline Rich

  • Administrator
  • Hero Member
  • *****
  • Posts: 11468
Re: gtk4 extension on armv7l (RaspberryPi)
« Reply #1 on: July 07, 2024, 09:56:02 PM »
Hi yvs
Unfortunately, when some packages change major versions (i.e. 3.x.x to 4.x.x) it
causes breakage elsewhere.

... (despite that gtk3.98.2 is almost gtk4) ...
I think version numbering can continue to go up like this:
Code: [Select]
gtk3.98.2
gtk3.99.0
gtk3.100.0
 ...
gtk3.150.0
 ...
gtk3.200.0
 ...
gtk3.500.0

Quote
... not sure if gtk3.98 should be named gtk4 ...
GTK version numbers are used to document changes. You can't just arbitrarily
rename GTK like that.

Maybe try finding a slightly older version of the app that depends on an
older version of GTK.

It's also possible there was some kind of packaging error. I unpacked
gtk4-dev.tcz and the  pkgconfig/gtk4.pc  file contained the following:
Code: [Select]
----- Snip -----
gtk_binary_version=4.0.0
gtk_host=arm-linux

Name: GTK
Description: GTK Graphical UI Library
Version: 3.98.2
 ----- Snip -----
I don't know enough about it to say one way or the other, but
based on what I see in the x86_64 versions of gtk3-dev and
gtk4-dev, I'd expect the  UI Library Version  number should be
greater than or equal to the  gtk_binary_version  number.

Maybe Juanito can provide more insight.

Offline Juanito

  • Administrator
  • Hero Member
  • *****
  • Posts: 14724
Re: gtk4 extension on armv7l (RaspberryPi)
« Reply #2 on: July 08, 2024, 02:48:50 AM »
As you’ve discovered, the gtk4 extension is a very early version, updating it to something more recent would probably involve updating some of its dependencies as well.

I can take a look, but it wouldn’t be before a week or so.

Offline yvs

  • Jr. Member
  • **
  • Posts: 54
Re: gtk4 extension on armv7l (RaspberryPi)
« Reply #3 on: July 09, 2024, 02:15:05 PM »
@Rich
> Maybe try finding a slightly older version of the app that depends on an older version of GTK.
>
  Gtk is a bit oversophisticated, gtk2/3/4 could be considered as toolkits with different concepts and distinct API, so that an app for gtk2 or gtk3 it's rather different one.  If I got it correctly gtk3.9x is a transit version (already not gtk3 but not gtk4 yet), suppose that it's easier to build needed libs than adapt to transit versions.

@Juanito
> updating it to something more recent would probably involve updating some of its dependencies as well.
>
  On purpose of test on RPI3B+ I've locally built gtk4.12.5 (last one that's not overvulkanised and still with default GL renderer) completed with cairo and pango update too, it works (at least with a couple apps that I tried to build and run).

Offline Juanito

  • Administrator
  • Hero Member
  • *****
  • Posts: 14724
Re: gtk4 extension on armv7l (RaspberryPi)
« Reply #4 on: August 16, 2024, 06:56:49 AM »
gtk4 updated on piCore-15.x

gtk4 is at the limit of slowness on an RPi3 as gtk4-widget-factory shows.

Offline yvs

  • Jr. Member
  • **
  • Posts: 54
Re: gtk4 extension on armv7l (RaspberryPi)
« Reply #5 on: August 16, 2024, 08:29:48 AM »
gtk4 updated on piCore-15.x
there's still an older pango/cairo:
Code: [Select]
% uname -a     
Linux box 6.6.34-piCore-v7 #18 SMP Wed Jun 19 12:59:04 EDT 2024 armv7l GNU/Linux
% gtk4-widget-factory
gtk4-widget-factory: symbol lookup error: /usr/local/lib/libgtk-4.so.1: undefined symbol: pango_layout_line_get_length
% pkg-config --libs gtk4     
Package 'gtk4' requires 'pango >= 1.50.0' but version of pango is 1.44.7

Quote
gtk4 is at the limit of slowness on an RPi3 as gtk4-widget-factory shows.
if I got it correctly it's gtk4.14.4. Earlier trying to run software with gtk4.12.5 (last prewayland oriented version) cairo rendering worked more or less okay (probably cairo rendering still works with 4.12 in the same way as with gtk3).
btw GTK4 is limited with minimal GL version 3, so that 3D is only with llvm rendering and no chance for Broadcom GL2.x, and not sure even GTK3 can work with GL2.x properly

Offline yvs

  • Jr. Member
  • **
  • Posts: 54
Re: gtk4 extension on armv7l (RaspberryPi)
« Reply #6 on: August 16, 2024, 09:01:51 AM »
Code: [Select]
gtk4-widget-factory: symbol lookup error: /usr/local/lib/libgtk-4.so.1: undefined symbol: pango_layout_line_get_length
Package 'gtk4' requires 'pango >= 1.50.0' but version of pango is 1.44.7
sorry, it was my fault (thought that dependencies are updated automatically)

After update of all tcz in gtk4 dep, there's no complains on pango version, just
Code: [Select]
libcups.so.2: cannot open shared object file: No such file or directory
Failed to load module: /usr/local/lib/gtk-4.0/4.0.0/printbackends/libprintbackend-cups.so
libgstplayer-1.0.so.0: cannot open shared object file: No such file or directory
Failed to load module: /usr/local/lib/gtk-4.0/4.0.0/media/libmedia-gstreamer.so
Gsk-Message: 12:53:03.693: Failed to realize renderer of type 'GskNglRenderer' for surface 'GdkX11Toplevel': OpenGL ES 3.0 is not supported by this renderer.
then loading `tce -wil gst-plugins-bad libcups` there's only
Code: [Select]
Gsk-Message: 12:57:46.392: Failed to realize renderer of type 'GskNglRenderer' for surface 'GdkX11Toplevel': OpenGL ES 3.0 is not supported by this renderer.
but it works

with unloaded broadcom GL driver, it starts with next complains
Code: [Select]
libEGL warning: DRI2: failed to authenticate
MESA: error: ZINK: failed to load libvulkan.so.1
libEGL warning: egl: failed to create dri2 screen
and looks much slower

i.e. apps (including gtk4 ones) work better anyway with loaded Broadcom driver (even it's not supported by gtk4 itself)
« Last Edit: August 16, 2024, 09:24:19 AM by yvs »

Offline yvs

  • Jr. Member
  • **
  • Posts: 54
Re: gtk4 extension on armv7l (RaspberryPi)
« Reply #7 on: August 16, 2024, 09:48:57 AM »
and completing gtk4.14 tests:
to get rid of Failed to realize renderer of type 'GskNglRenderer' for ...
there's export GSK_RENDERER=gl or =opengl or =cairo (to not use ngl/vulkans renderers and to work like in 4.12 and previous ones)

Offline Juanito

  • Administrator
  • Hero Member
  • *****
  • Posts: 14724
Re: gtk4 extension on armv7l (RaspberryPi)
« Reply #8 on: August 16, 2024, 12:03:25 PM »
I’m not sure what you mean by ‘broadcom driver’, but I’ve been unable to get xorg 3d acceleration working with piCore-15.x on an RPi3 - it worked fine on piCore-14.x

Mesa has been updated to include the zink driver and mesa-vulkan-rpi4 contains the vulkan driver for RPi4. I haven’t tried vulkan with gtk4 and piCore-15.x on an RPi4 yet, but it worked with piCore64 the last time I tried.

I’ve found RPi3 and to an extent RPi4 work better with wayland than x and gtk4 works with both.

Offline yvs

  • Jr. Member
  • **
  • Posts: 54
Re: gtk4 extension on armv7l (RaspberryPi)
« Reply #9 on: August 16, 2024, 12:34:50 PM »
I’m not sure what you mean by ‘broadcom driver’,
I mean this one (Broadcom2835 VideoCore4)
Code: [Select]
% inxi -Ga
Graphics:
  Device-1: bcm2835-vc4 driver: vc4_drm v: N/A bus-ID: N/A chip-ID: brcm:soc
    class-ID: gpu
  Device-2: bcm2835-hdmi driver: N/A bus-ID: N/A chip-ID: brcm:soc
    class-ID: hdmi
  Display: server: X.org driver: X: loaded: modesetting unloaded: fbdev
    dri: vc4
    gpu: vc4-drm,vc4_crtc,vc4_dpi,vc4_dsi,vc4_firmware_kms,vc4_hdmi,vc4_hvs,vc4_txp,vc4_v3d,vc4_vec
    display-ID: :0.0 screens: 1
  Screen-1: 0 s-res: 800x480 s-size: <missing: xdpyinfo>
  Monitor-1: DSI-1 res: 800x480 hz: 60 size: N/A modes: FIXED_MODE
  API: OpenGL v: 2.1 vendor: broadcom mesa v: 24.1.4 glx-v: 1.4 es-v: 2.0
    direct-render: yes renderer: VC4 V3D 2.1 device-ID: 14e4:ffffffff
    memory: 898.4 MiB unified: yes

Quote
but I’ve been unable to get xorg 3d acceleration working with piCore-15.x on an RPi3 - it worked fine on piCore-14.x

Xorg works there with VC4 too. There's 3D acceleration with piCore15 on RPI3B+:
Code: [Select]
% glxgears
Running synchronized to the vertical refresh.  The framerate should be
approximately the same as the monitor refresh rate.
303 frames in 5.0 seconds = 60.514 FPS
301 frames in 5.0 seconds = 60.056 FPS
301 frames in 5.0 seconds = 60.048 FPS
301 frames in 5.0 seconds = 60.051 FPS
301 frames in 5.0 seconds = 60.053 FPS
301 frames in 5.0 seconds = 60.052 FPS
301 frames in 5.0 seconds = 60.052 FPS
...

Quote
Mesa has been updated to include the zink driver and mesa-vulkan-rpi4 contains the vulkan driver for RPi4. I haven’t tried vulkan with gtk4 and piCore-15.x on an RPi4 yet, but it worked with piCore64 the last time I tried.

I’ve found RPi3 and to an extent RPi4 work better with wayland than x and gtk4 works with both.
Frankly there's doubts that a vulkan driver even exists for RPI3, so that supposedly glx rendering (Xorg with VC4) works much faster than any software rendering with wayland on rpi3
« Last Edit: August 16, 2024, 12:38:10 PM by yvs »

Offline Juanito

  • Administrator
  • Hero Member
  • *****
  • Posts: 14724
Re: gtk4 extension on armv7l (RaspberryPi)
« Reply #10 on: August 16, 2024, 12:57:35 PM »
Xorg works there with VC4 too

I just get a blank, but backlit, screen - if I ssh into the RPi3 there are no errors in Xorg.0.log.

What do you have in config.txt for Xorg-3d?

Offline yvs

  • Jr. Member
  • **
  • Posts: 54
Re: gtk4 extension on armv7l (RaspberryPi)
« Reply #11 on: August 16, 2024, 01:17:32 PM »
Xorg works there with VC4 too

I just get a blank, but backlit, screen - if I ssh into the RPi3 there are no errors in Xorg.0.log.

What do you have in config.txt for Xorg-3d?

vc4-fkms-v3d

p.s. it was already discussed some time ago
https://forum.tinycorelinux.net/index.php/topic,27066.msg174556.html#msg174556

Online Paul_123

  • Administrator
  • Hero Member
  • *****
  • Posts: 1197
Re: gtk4 extension on armv7l (RaspberryPi)
« Reply #12 on: August 16, 2024, 05:16:57 PM »
Juanito,

Hard to say what "depreciated means".   Obviously the overlay is still there, but we don't know what's going on in firmware.

Offline Juanito

  • Administrator
  • Hero Member
  • *****
  • Posts: 14724
Re: gtk4 extension on armv7l (RaspberryPi)
« Reply #13 on: August 17, 2024, 05:58:54 AM »
To continue the troubleshooting, I installed piCore-15.x on an RPi4, which comes up 32-bit with a 64-bit kernel.

Using vc4-kms-v3d

Xorg-3d works without problems on the RPi4:
Code: [Select]
glxinfo | grep Acc
    Accelerated: yes

inxi -b
System:
  Host: boxrpi4_32 Kernel: 6.6.34-piCore-v8 arch: aarch64 bits: 64
  Desktop: FLWM v: N/A Distro: piCore 15.0
Machine:
  Type: ARM System: Raspberry Pi 4 Model B Rev 1.2 details: N/A rev: c03112
    serial: 100000002f7ed527
CPU:
  Info: quad core Model N/A [MCP] speed (MHz): avg: 1000 min/max: 600/1500
Graphics:
  Device-1: bcm2711-hdmi0 driver: vc4_hdmi v: N/A
  Device-2: bcm2711-hdmi1 driver: vc4_hdmi v: N/A
  Device-3: bcm2711-vc5 driver: vc4_drm v: N/A
  Display: server: X.org driver: X: loaded: modesetting dri: vc4
    gpu: vc4-drm,vc4_crtc,vc4_dpi,vc4_dsi,vc4_firmware_kms,vc4_hdmi,vc4_hvs,vc4_txp,vc4_v3d,vc4_vec
    resolution: <missing: xdpyinfo/xrandr> resolution: 3840x2160
  API: OpenGL v: 3.1 vendor: broadcom mesa v: 24.1.4 renderer: V3D 4.2.14
..and gtk4-widget-factory is noticeably quicker.

After modifying the symlink in /usr/local/share/vulkan/icd.d from broadcom_icd.armv7l.json to broadcom_icd.armv8.json, vulkan works:
Code: [Select]
vulkaninfo
...
=================                                       
Presentable Surfaces:                                               
=====================                                                 
GPU id : 0 (V3D 4.2.14):                                             
        Surface types: count = 2                                     
                VK_KHR_xcb_surface                                   
                VK_KHR_xlib_surface
...
Device Properties and Extensions:                                   
=================================                     
GPU0:                                         
VkPhysicalDeviceProperties:                                                     
---------------------------                                         
        apiVersion     = 4202774 (1.2.278)                           
        driverVersion  = 100667396 (0x6001004)                       
        vendorID       = 0x14e4                                     
        deviceID       = 0xbe485fd3                                 
        deviceType     = PHYSICAL_DEVICE_TYPE_INTEGRATED_GPU         
        deviceName     = V3D 4.2.14

I couldn't test gtk4 with vulkan because:
Code: [Select]
GSK_RENDERER=help gtk4-widget-factory
...
  vulkan - Disabled during GTK build
I'll have to check what happened there.

Offline Juanito

  • Administrator
  • Hero Member
  • *****
  • Posts: 14724
Re: gtk4 extension on armv7l (RaspberryPi)
« Reply #14 on: August 17, 2024, 06:09:08 AM »
wayland/weston is also working with the gpu:
Code: [Select]
XDG_RUNTIME_DIR=/run/user/1001 weston-launch -- --log=log
grep -i gpu log
GPU id : 0 (V3D 4.2.14):
..
GPU0:
        deviceType     = PHYSICAL_DEVICE_TYPE_INTEGRATED_GPU