Bug 1895018

Summary: OpenGL application doesn't run properly on X11/Wayland
Product: [Fedora] Fedora Reporter: malkovjohnny
Component: glfwAssignee: Till Hofmann <thofmann>
Status: CLOSED ERRATA QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: medium Docs Contact:
Priority: unspecified    
Version: 33CC: airlied, ajax, bioinfornatics, bolek, negativo17, thofmann
Target Milestone: ---Keywords: Reopened
Target Release: ---   
Hardware: x86_64   
OS: Linux   
Whiteboard:
Fixed In Version: glfw-3.3.2-8.fc33 Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2020-11-11 01:20:30 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description malkovjohnny 2020-11-05 15:08:53 UTC
Description of problem:
In new F33 release OpenGL application stop work properly: doesn't run at all. Worked fine in F32 and previous kernel.

How reproducible:
Run test application
g++ -std=c++17 -Wall -lGL -lGLEW -lglfw xxx.cxx -o xxx

Actual results:
Application doesn't run

Expected results:
Fix bug

Additional info:
kernel:
5.8.17-300.fc33.x86_64

APU:
09:00.0 VGA compatible controller: Advanced Micro Devices, Inc. [AMD/ATI] Raven Ridge [Radeon Vega Series / Radeon Vega Mobile Series] (rev c8) (prog-if 00 [VGA controller])
	Subsystem: Gigabyte Technology Co., Ltd Radeon RX Vega 11
	Flags: bus master, fast devsel, latency 0, IRQ 51
	Memory at e0000000 (64-bit, prefetchable) [size=256M]
	Memory at f0000000 (64-bit, prefetchable) [size=2M]
	I/O ports at e000 [size=256]
	Memory at fe600000 (32-bit, non-prefetchable) [size=512K]
	Expansion ROM at 000c0000 [virtual] [disabled] [size=128K]
	Capabilities: <access denied>
	Kernel driver in use: amdgpu
	Kernel modules: amdgpu

When session X11:
XDG_SESSION_TYPE=x11
XDG_CURRENT_DESKTOP=GNOME-Classic:GNOME
XDG_SESSION_CLASS=user

got error:
(65544) Wayland: Failed to connect to display
fail init glfw


When session wayland:
XDG_SESSION_TYPE=wayland
XDG_CURRENT_DESKTOP=GNOME
XDG_SESSION_CLASS=user

got error:
(65544) Wayland: Focusing a window requires user interaction
4.6 (Compatibility Profile) Mesa 20.2.1
4.60
glewInit failed: Unknown error

if comment lines 35:39, window appears without titlebar

Test application:

#include <iostream>

#include <GL/glew.h>
#include <GLFW/glfw3.h>

static void error_call(int error, const char* description)
{
  std::cout << "(" << error << ") ";
  std::cout << description << "\n";
}

int main(void)
{
  glfwSetErrorCallback(error_call);
  
  if(glfwInit() == GLFW_FALSE)
  {
    std::cout << "fail init glfw\n";
    exit(EXIT_FAILURE);
  }

  GLFWwindow* window = glfwCreateWindow(800, 800, "Hello World", NULL, NULL);
  if(window == NULL)
  {
    glfwTerminate();
    std::cout << "fail init window\n";
    exit(EXIT_FAILURE);
  }
  
  glfwMakeContextCurrent(window);
  
  std::cout << glGetString(GL_VERSION) << "\n";
  std::cout << glGetString(GL_SHADING_LANGUAGE_VERSION) << "\n";

  if(GLenum error = glewInit(); error != GLEW_OK)
  {
    std::cout << "glewInit failed: " << glewGetErrorString(error) << "\n";
    exit(EXIT_FAILURE);
  }
  
  while(!glfwWindowShouldClose(window))
  {
    glClearColor(0.5f, 0.5f, 0.5f, 1.0f);
    glClear(GL_COLOR_BUFFER_BIT);

    glColor3f(0.9f, 0.0f, 0.0f);
    glBegin(GL_QUADS);
        glVertex2f(-0.5f, +0.5f);
        glVertex2f(-0.5f, -0.5f);
        glVertex2f(+0.5f, -0.5f);
        glVertex2f(+0.5f, +0.5f);
    glEnd();

    glfwSwapBuffers(window);
    glfwPollEvents();
  }

  glfwTerminate();
  return 0;
}

Comment 1 Boleslaw Ciesielski 2020-11-08 22:40:18 UTC
X11 support in glfw got broken as a result of the fix for https://bugzilla.redhat.com/show_bug.cgi?id=1890798 which was recently pushed to stable. Downgrading to previous build glfw-3.3.2-6.fc33 restores X11 support.

Comment 2 malkovjohnny 2020-11-09 13:09:50 UTC
I have managed to test newest version 3.3-324-g0ef149c8 of glfw from github. It doesn't have a bug!

Comment 3 Fedora Update System 2020-11-09 23:11:58 UTC
FEDORA-2020-7b530d24b8 has been submitted as an update to Fedora 33. https://bodhi.fedoraproject.org/updates/FEDORA-2020-7b530d24b8

Comment 4 Boleslaw Ciesielski 2020-11-10 00:34:07 UTC
glfw-3.3.2-8.fc33 works for me

Comment 5 Fedora Update System 2020-11-10 02:21:30 UTC
FEDORA-2020-7b530d24b8 has been pushed to the Fedora 33 testing repository.
In short time you'll be able to install the update with the following command:
`sudo dnf upgrade --enablerepo=updates-testing --advisory=FEDORA-2020-7b530d24b8`
You can provide feedback for this update here: https://bodhi.fedoraproject.org/updates/FEDORA-2020-7b530d24b8

See also https://fedoraproject.org/wiki/QA:Updates_Testing for more information on how to test updates.

Comment 6 Till Hofmann 2020-11-10 08:22:08 UTC
Thanks for the feedback! Can you please give karma in bodhi (also negative karma if the bug is not fixed)? This will allow us to push this to stable more quickly.

Comment 7 malkovjohnny 2020-11-10 13:48:26 UTC
glfw-3.3.2-8.fc33 fixes a bug.

Comment 8 Till Hofmann 2020-11-10 18:15:38 UTC
Please don't close this before it has reached stable, thanks!

Comment 9 malkovjohnny 2020-11-10 21:18:09 UTC
Sorry, i am not proficient in bugzilla :)

Comment 10 Fedora Update System 2020-11-11 01:20:30 UTC
FEDORA-2020-7b530d24b8 has been pushed to the Fedora 33 stable repository.
If problem still persists, please make note of it in this bug report.

Comment 11 Boleslaw Ciesielski 2021-05-30 16:29:24 UTC
This is broken again in Fedora 34. It looks like glfw is compiled with Wayland support only and running an app in X11 session results in

Wayland: Failed to connect to display