| Summary: | SDL_GetNumDisplayModes fails to enumerate supported resolutions under Wayland backend | ||
|---|---|---|---|
| Product: | SDL | Reporter: | sebby2k <shopper2k> |
| Component: | video | Assignee: | Gabriel Jacobo <gabomdq> |
| Status: | ASSIGNED --- | QA Contact: | Sam Lantinga <slouken> |
| Severity: | normal | ||
| Priority: | P2 | ||
| Version: | HG 2.1 | ||
| Hardware: | x86_64 | ||
| OS: | Linux | ||
= Description When enumerating supported display modes using SDL_GetNumDisplayModes/SDL_GetDisplayMode under Wayland backend, only the current desktop display resolution is listed. X11 backend properly lists all supported resolutions. = Environment Fedora 25 running Gnome Wayland session. Name : gnome-shell Arch : x86_64 Epoch : 0 Version : 3.22.2 Release : 2.fc25 Name : SDL2 Arch : x86_64 Epoch : 0 Version : 2.0.5 Release : 2.fc25 = Output X11 Backend Output: Mode 2560 1440 0x16161804 60 Mode 1920 1200 0x16161804 60 Mode 1920 1080 0x16161804 60 Mode 1920 1080 0x16161804 50 Can't connect to display Mode 1920 1080 0x16161804 30 Mode 1920 1080 0x16161804 25 Mode 1680 1050 0x16161804 60 Mode 1440 900 0x16161804 60 Mode 1280 1024 0x16161804 75 Mode 1280 1024 0x16161804 60 Mode 1280 720 0x16161804 60 Mode 1280 720 0x16161804 50 Mode 1152 864 0x16161804 75 Mode 1024 768 0x16161804 75 Mode 1024 768 0x16161804 60 Mode 800 600 0x16161804 75 Mode 800 600 0x16161804 60 Mode 720 576 0x16161804 50 Mode 720 480 0x16161804 60 Mode 720 400 0x16161804 70 Mode 640 480 0x16161804 75 Mode 640 480 0x16161804 60 Wayland Backend Output: Mode 2560 1440 0000000000 59 = Test Driver #include <stdio.h> #include <SDL2/SDL.h> void dump_disp_mode(SDL_DisplayMode &mode) { printf("Mode %d %d %#010x %d\n", mode.w, mode.h, mode.format, mode.refresh_rate); } int test_sdl() { int ret; ret = SDL_InitSubSystem(SDL_INIT_VIDEO); if (ret < 0) { fprintf(stderr, "Failed to init SDL video: %s\n", SDL_GetError()); return 1; } SDL_DisplayMode mode; ret = SDL_GetDesktopDisplayMode(0, &mode); if (ret < 0) { fprintf(stderr, "Failed to get desktop display mode: %s\n", SDL_GetError()); return 1; } dump_disp_mode(mode); int modes_num = SDL_GetNumDisplayModes(0); for (int i = 0; i < modes_num; i++) { ret = SDL_GetDisplayMode(0, i, &mode); if (ret < 0) { fprintf(stderr, "Failed to get display mode: %s\n", SDL_GetError()); return 1; } dump_disp_mode(mode); } SDL_QuitSubSystem(SDL_INIT_VIDEO); } int main(int argc, char **argv) { test_sdl(); return 0; }