Note: This is a public test instance of Red Hat Bugzilla. The data contained within is a snapshot of the live data so any changes you make will not be reflected in the production Bugzilla. Email is disabled so feel free to test any aspect of the site that you want. File any problems you find or give feedback at bugzilla.redhat.com.
Bug 1390233 - SDL2 is broken on Wayland when using SDL_VIDEODRIVER=wayland
Summary: SDL2 is broken on Wayland when using SDL_VIDEODRIVER=wayland
Keywords:
Status: CLOSED NOTABUG
Alias: None
Product: Fedora
Classification: Fedora
Component: SDL2
Version: 25
Hardware: Unspecified
OS: Unspecified
unspecified
unspecified
Target Milestone: ---
Assignee: Igor Gnatenko
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
Depends On:
Blocks: WaylandRelated
TreeView+ depends on / blocked
 
Reported: 2016-10-31 14:34 UTC by sebby2k
Modified: 2016-12-12 17:26 UTC (History)
2 users (show)

Fixed In Version:
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed: 2016-12-12 15:42:44 UTC
Type: Bug
Embargoed:


Attachments (Terms of Use)

Description sebby2k 2016-10-31 14:34:11 UTC
Description of problem:

SDL2 wayland backend used to work in F24. After upgrading to F25, SDL2 is unable to use wayland backend.

Version-Release number of selected component (if applicable):

Fedora 25 with latest packages as of 10/31/2016.

Installed Packages
Name        : SDL2
Arch        : x86_64
Epoch       : 0
Version     : 2.0.5
Release     : 2.fc25

How reproducible:

install SDL2 build of ioquake3

http://ioquake3.org/files/jenkins/latest/gcc/no_options/release-linux-x86_64.zip

Steps to Reproduce:

1. run SDL_VIDEODRIVER=wayland ./ioquake3.x86_64

Actual results:

Game fails on video initalization with error message:

SDL_Init( SDL_INIT_VIDEO ) FAILED (wayland not available)

Expected results:

Game starts successfully 

Additional info:

$ ldd ioquake3.x86_64 

	linux-vdso.so.1 (0x00007fffa18b3000)
	libSDL2-2.0.so.0 => /lib64/libSDL2-2.0.so.0 (0x00007f7923308000)
	librt.so.1 => /lib64/librt.so.1 (0x00007f7923100000)
	libm.so.6 => /lib64/libm.so.6 (0x00007f7922df7000)
	libc.so.6 => /lib64/libc.so.6 (0x00007f7922a31000)
	libdl.so.2 => /lib64/libdl.so.2 (0x00007f792282d000)
	libpthread.so.0 => /lib64/libpthread.so.0 (0x00007f792260d000)
	/lib64/ld-linux-x86-64.so.2 (0x000056116f974000)

ioq3 crashlog.txt
=================

ioq3 1.36_GIT_10f33b8-2016-10-27 linux-x86_64 Oct 27 2016
Have SSE support
----- FS_Startup -----
We are looking in the current search path:
/home/user/.q3a/baseq3
./baseq3
./baseq3/pak8.pk3 (9 files)
./baseq3/pak7.pk3 (4 files)
./baseq3/pak6.pk3 (64 files)
./baseq3/pak5.pk3 (7 files)
./baseq3/pak4.pk3 (272 files)
./baseq3/pak3.pk3 (4 files)
./baseq3/pak2.pk3 (148 files)
./baseq3/pak1.pk3 (26 files)
./baseq3/pak0.pk3 (3539 files)

----------------------
4073 files in pk3 files
execing default.cfg
execing q3config.cfg
execing autoexec.cfg
Hunk_Clear: reset the hunk ok
----- Client Initialization -----
----- Initializing Renderer ----
Trying to load "renderer_opengl2_x86_64.so" from "."...
-------------------------------
QKEY found.
----- Client Initialization Complete -----
----- R_Init -----
SDL_Init( SDL_INIT_VIDEO ) FAILED (wayland not available)
SDL_Init( SDL_INIT_VIDEO ) FAILED (wayland not available)
Setting r_mode -1 failed, falling back on r_mode 3
SDL_Init( SDL_INIT_VIDEO ) FAILED (wayland not available)
----- Client Shutdown (Client fatal crashed: GLimp_Init() - could not load OpenGL subsystem) -----
RE_Shutdown( 1 )
Hunk_Clear: reset the hunk ok
-----------------------
GLimp_Init() - could not load OpenGL subsystem

Comment 1 sebby2k 2016-11-01 14:12:43 UTC
This also happens with other SDL2 packages in F25 repo.

> sudo dnf install cdogs-sdl
> SDL_VIDEODRIVER=wayland cdogs-sdl

C-Dogs SDL v0.6.2
Original Code Copyright Ronny Wester 1995
Game Data Copyright Ronny Wester 1995
SDL Port by Jeremy Chin, Lucas Martin-King and Cong Xu, Copyright 2003-2016

INFO  [MAIN ] [files.c:622] SetupConfigDir(): Creating config dir /home/sebby/.config/cdogs-sdl/... 
INFO  [MAIN ] [files.c:627] SetupConfigDir(): Config dir already exists.
INFO  [MAIN ] [cdogs.c:260] main(): Command line (1 args): cdogs-sdl
ERROR [MAIN ] [cdogs.c:381] main(): Could not initialise SDL: wayland not available

Comment 2 sebby2k 2016-11-25 16:21:55 UTC
Any update on this?

Comment 3 sebby2k 2016-12-12 04:47:32 UTC
I compiled a local version of SDL2 2.0.5 using the following deps and configuration:

sudo dnf install libX11-devel libXcursor-devel libXext-devel libXxf86vm-devel libXi-devel libXinerama-devel libXrandr-devel libXrender-devel libXScrnSaver-devel libusb-devel libxkbcommon-devel alsa-lib-devel audiofile-devel dbus-devel mesa-libEGL-devel mesa-libGL-devel mesa-libGLES-devel mesa-libwayland-egl-devel pulseaudio-libs-devel systemd-devel wayland-devel wayland-protocols-devel

> hg clone https://hg.libsdl.org/SDL SDL
> cd SDL
> mkdir build
> cd build
> ../configure
> make -j

Using my local version, SDL wayland backend works properly. It seems the source RPM spec doesn't resolve all dependencies properly, specifically one or more of the following:

wayland-devel wayland-protocols-devel mesa-libwayland-egl-devel

Comment 4 sebby2k 2016-12-12 05:24:16 UTC
Interestingly, I had removed the local build of SDL2 and reinstalled offical SDL2-2.0.5-2.fc25.x86_64.rpm and can no longer repro the issue. Not sure what has changed, but since I can no longer reproduce it, its no longer a bug.

Comment 5 sebby2k 2016-12-12 05:40:16 UTC
I had mistakenly used SDL_BACKEND=wayland env variable instead of SDL_VIDEODRIVER=wayland cdogs-sdl in my last two comments.  

This is still an open issue. 

> SDL_VIDEODRIVER=wayland cdogs-sdl
C-Dogs SDL v0.6.2
Original Code Copyright Ronny Wester 1995
Game Data Copyright Ronny Wester 1995
SDL Port by Jeremy Chin, Lucas Martin-King and Cong Xu, Copyright 2003-2016

INFO  [MAIN ] [files.c:622] SetupConfigDir(): Creating config dir /home/sebby/.config/cdogs-sdl/... 
INFO  [MAIN ] [files.c:627] SetupConfigDir(): Config dir already exists.
INFO  [MAIN ] [cdogs.c:260] main(): Command line (1 args): cdogs-sdl
ERROR [MAIN ] [cdogs.c:381] main(): Could not initialise SDL: wayland not available
Segmentation fault (core dumped)

Comment 6 sebby2k 2016-12-12 06:25:19 UTC
I traced the error to the following function:

src/video/wayland/SDL_waylandvideo.c: Wayland_Available 
- calls WAYLAND_wl_display_connect which returns null.

Hope that helps.

Comment 7 sebby2k 2016-12-12 15:42:44 UTC
I did more troubleshooting and tried running this simple program to test wayland connection.

#include <stdio.h>
#include <wayland-client.h>

int main(int argc, char **argv) {
  struct wl_display *display = NULL;

  display = wl_display_connect("wayland-0");
  if (display == NULL) {
    fprintf(stderr, "Can't connect to display\n");
    return 1;
  }
  printf("connected to display\n");

  wl_display_disconnect(display);
  printf("disconnected from display\n");

  return 0;
}

The call to wl_display_connect also failed in this case. 

Oddly enough, the loginctl reports that I'm using X11 session even though I explicitly select GNOME session (not GNOME on X.org) on the login screen.

> loginctl show-session 3 -p Type
Type=x11

Therefore, this no longer appears to be SDL2 related issue.

Comment 8 sebby2k 2016-12-12 17:26:53 UTC
The problem with Gnome failing to start Wayland session is reported by another user here:

https://bugzilla.redhat.com/show_bug.cgi?id=1403512

My hw configuration also comes with Intel integrated and Radeon discrete graphics in my laptop. With the workaround radeon.modeset=0 in grub configuration, Wayland session start successfully and so do SDL2 based apps.


Note You need to log in before you can comment on or make changes to this bug.