GTK, GDK, 1280x1024 Resolution Failed to Get Window

I get the following error from GTK when trying to get the screen resolution of my 1280x1024 panel:

(manager3:920): Gdk-CRITICAL **: 10:26:10.835: gdk_monitor_get_workarea: assertion 'GDK_IS_MONITOR (monitor)' failed
Gdk-Message: 10:26:11.019: Error 71 (Protocol error) dispatching to Wayland display.

I can see the mode is available using modetest, they also align to:

/sys/class/drm/card1-HDMI-A-1/modes


id	encoder	status		name		size (mm)	modes	encoders
148	147	connected	HDMI-A-1       	360x240		23	147
  modes:
	index name refresh (Hz) hdisp hss hse htot vdisp vss vse vtot
  #0 1280x1024 60.02 1280 1328 1440 1688 1024 1025 1028 1066 108000 flags: phsync, pvsync; type: preferred, driver
  #1 1920x1080 60.00 1920 2008 2052 2200 1080 1084 1089 1125 148500 flags: phsync, pvsync; type: driver
  #2 1920x1080 59.94 1920 2008 2052 2200 1080 1084 1089 1125 148352 flags: phsync, pvsync; type: driver
  #3 1920x1080 50.00 1920 2448 2492 2640 1080 1084 1089 1125 148500 flags: phsync, pvsync; type: driver
  #4 1280x1024 75.02 1280 1296 1440 1688 1024 1025 1028 1066 135000 flags: phsync, pvsync; type: driver
  #5 1360x768 60.02 1360 1424 1536 1792 768 771 777 795 85500 flags: phsync, pvsync; type: driver
  #6 1280x720 60.00 1280 1390 1430 1650 720 725 730 750 74250 flags: phsync, pvsync; type: driver
  #7 1280x720 59.94 1280 1390 1430 1650 720 725 730 750 74176 flags: phsync, pvsync; type: driver
  #8 1280x720 50.00 1280 1720 1760 1980 720 725 730 750 74250 flags: phsync, pvsync; type: driver
  #9 1024x768 75.03 1024 1040 1136 1312 768 769 772 800 78750 flags: phsync, pvsync; type: driver
  #10 1024x768 70.07 1024 1048 1184 1328 768 771 777 806 75000 flags: nhsync, nvsync; type: driver
  #11 1024x768 60.00 1024 1048 1184 1344 768 771 777 806 65000 flags: nhsync, nvsync; type: driver
  #12 800x600 75.00 800 816 896 1056 600 601 604 625 49500 flags: phsync, pvsync; type: driver
  #13 800x600 72.19 800 856 976 1040 600 637 643 666 50000 flags: phsync, pvsync; type: driver
  #14 800x600 60.32 800 840 968 1056 600 601 605 628 40000 flags: phsync, pvsync; type: driver
  #15 720x576 50.00 720 732 796 864 576 581 586 625 27000 flags: nhsync, nvsync; type: driver
  #16 720x480 60.00 720 736 798 858 480 489 495 525 27027 flags: nhsync, nvsync; type: driver
  #17 720x480 59.94 720 736 798 858 480 489 495 525 27000 flags: nhsync, nvsync; type: driver
  #18 640x480 75.00 640 656 720 840 480 481 484 500 31500 flags: nhsync, nvsync; type: driver
  #19 640x480 72.81 640 664 704 832 480 489 492 520 31500 flags: nhsync, nvsync; type: driver
  #20 640x480 60.00 640 656 752 800 480 490 492 525 25200 flags: nhsync, nvsync; type: driver
  #21 640x480 59.94 640 656 752 800 480 490 492 525 25175 flags: nhsync, nvsync; type: driver
  #22 720x400 70.08 720 738 846 900 400 412 414 449 28320 flags: nhsync, pvsync; type: driver

I’ve tried a few weston output settings, the GDK error doesn’t occur when setting the display to 1920x1080, however this doesn’t give me the right resolution I need, and is a scaled resolution for the panel.

root@apalis-imx8-14903975:~# cat /etc/xdg/weston/weston.ini 
[core]
#gbm-format=argb8888
idle-time=0
#use-g2d=1
xwayland=true
repaint-window=16
#enable-overlay-view=1
modules=screen-share.so

[shell]
size=1280x1024
panel-position=none
#background-color=0xff000000
background-image=/home/root/ArtworkWallpaperP.png

[libinput]
enable_tap=true
touchscreen_calibrator=true
calibration_helper=/usr/bin/toradex-save-touchscreen-calibration

[output]
name=HDMI-A-1
mode=1280x1024
#mode=preffered
#transform=rotate-90
#mode=current

#[output]
#name=HDMI-A-2
#mode=off
#	WIDTHxHEIGHT    Resolution size width and height in pixels
#	off             Disables the output
#	preferred       Uses the preferred mode
#	current         Uses the current crt controller mode
#transform=rotate-90

[screen-share]
command=/usr/bin/weston --backend=rdp-backend.so --shell=fullscreen-shell.so --no-clients-resize --rdp-tls-cert=/etc/freerdp/keys/server.crt --rdp-tls-key=/etc/freerdp/keys/server.key

I can set the resolution for the panel and launch another non-gtk application at the correct resolution (1280x1024), however the GTK application that launches this application fails.

To be clear, the resolution of this panel is 1280x1024, and I get no errors setting weston.ini to 1920x1080, however this gives me the wrong aspect for the panel.

Are there any other settings in weston.ini I should be using in order to aquire the correct settings for GTK to be able to obtain the display?

Thank you,
William

I am also launching the GTK application using the following:

#!/bin/sh

if test -z "$XDG_RUNTIME_DIR"; then
    export XDG_RUNTIME_DIR=/run/user/`id -u`
    if ! test -d "$XDG_RUNTIME_DIR"; then
        mkdir --parents $XDG_RUNTIME_DIR
        chmod 0700 $XDG_RUNTIME_DIR
    fi
fi

# wait for weston
while [ ! -e  $XDG_RUNTIME_DIR/wayland-0 ] ; do sleep 0.1; done


export XDG_RUNTIME_DIR=/run/user/0
export DISPLAY=:0.0

/home/root/player/manager3 >/dev/null

This is form the linux-multimedia-referenceimage-6.6.0 yocto build.

Hello @DHWill,

When you get this error, does the application fail to start?

Could you also send me more information about the hardware being used?
The output of tdx-info should contain most of the relevant information.

Best Regards,
Bruno

Hi Bruno,
Thank you for your reply, yes the application fails to start (It is ran through a service on boot).

The strange thing is I dont get this error when running the same application on a different resolution display.

Here is a copy of tdx-info:

root@apalis-imx8-14903975:~# tdx-info

Software summary
------------------------------------------------------------
Bootloader:               U-Boot
Kernel version:           5.15.129-6.6.0-devel+git.c6f626a5642c #1 SMP PREEMPT Sun Dec 24 15:44:39 UTC 2023
Kernel command line:      root=PARTUUID=0765100d-02 ro rootwait console=tty1 console=ttyLP1,115200 consoleblank=0 earlycon
Distro name:              NAME="TDX Wayland with XWayland"
Distro version:           VERSION_ID=6.6.0-devel-20240215173048-build.0
Distro variant:           -
Hostname:                 apalis-imx8-14903975
------------------------------------------------------------

Hardware info
------------------------------------------------------------
HW model:                 Toradex Apalis iMX8QM V1.1 on Apalis Evaluation Board
Toradex version:          0067 V1.1A
Serial number:            14904066
Processor arch:           aarch64

Hello @DHWill,

Thanks for the clarification.

I will try to reproduce the issue and update this thread once I have more information.

Best Regards,
Bruno

Thank you very much, its an odd one.

Hello @DHWill,

Unfortunately, I have not been able to reproduce your issue.
While I don’t have a 1280x1024 display to test here, I have displays with 1024x600 and 1920x1080 resolutions. Both support a scaled mode of 1280x1024.
I tried to reproduce the issue both in native and 1280x1024 scaled modes using a simple GTK3 application.
The issue was not observed.

Can you confirm which version of GTK you are using?


What I think may be the problem is the startup order. It is odd that the issue only occurs when you set the display to the correct resolution, but this may cause a delay on the Weston initialization.

Does the issue also occurs when you manually run the application after Weston is properly started?

If the issue does not occur, then setting up a dependency in the service that starts your application may be a solution.
A good example is the default application on the reference multimedia image, its service file is available here.

Best Regards,
Bruno