Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

"Failed to find any valid GLX configs" error on x11 #35

Open
chris-montero opened this issue Oct 14, 2024 · 14 comments
Open

"Failed to find any valid GLX configs" error on x11 #35

chris-montero opened this issue Oct 14, 2024 · 14 comments
Labels
bug Something isn't working help wanted Extra attention is needed incompatibility

Comments

@chris-montero
Copy link

chris-montero commented Oct 14, 2024

  • I am on void linux
  • I have the proprietary nvidia 550.120_3 drivers.
  • All the lines in my /var/log/Xorg.0.log file that contain the word "GLX" are the following:
[ 21901.936] (II) NVIDIA GLX Module  550.120  Fri Sep 13 10:02:06 UTC 2024
[ 21902.286] (II) Initializing extension GLX
[ 21902.286] (II) Initializing extension GLX
[ 21902.286] (II) Indirect GLX disabled.
[ 21902.286] (II) GLX: Another vendor is already registered for screen 0
[ 21902.286] (II) Initializing extension NV-GLX
  • No similar error happens when using GLFW.
  • The code that I'm using is this:
package testbed

import "core:fmt"
import "core:log"
//import glfw "vendor:glfw"
import rgfw "external/RGFW-Odin/RGFW"
import mem "core:mem"

drawRect :: proc(win : ^rgfw.window, r : rgfw.rect, color: ^[3]u8) {
    for x := r.x; x < (r.x + r.w); x += 1 {
        for y := r.y; y < (r.y + r.h); y += 1 {
            //index := y * (4 * screenSize.w) + x * 4;
            index := y * (4 * 800) + x * 4; // TODO: DONT HARDCODE THE WIDTH
            
            mem.copy(&win.buffer[index], &color[0], 3 * size_of(u8));
        }
    }
}

icon := []u8{0xFF, 0x00, 0x00, 0xFF, 0xFF, 0x00, 0x00, 0xFF, 0xFF, 0x00, 0x00, 0xFF, 0xFF, 0x00, 0x00, 0x00, 0xFF, 0xFF, 0x00, 0xFF, 0xFF, 0xFF, 0x00, 0xFF, 0xFF, 0x00, 0x00, 0xFF, 0xFF, 0x00, 0x00, 0xFF, 0xFF, 0x00, 0x00, 0xFF};

Program :: struct {
    window : ^rgfw.window,
    is_running : bool,
}

init_program :: proc(program : ^Program) {
    program.window = rgfw.createWindow("Colo teroritta", { 400, 400, 800, 800 }, .CENTER)
    rgfw.window_makeCurrent(program.window)

    //gl.load_up_to(3, 3, rgfw.gl_set_proc_address)

    rgfw.window_setCPURender(program.window, 1)
    rgfw.window_setGPURender(program.window, 0)

    screen_size := rgfw.getScreenSize()
    fmt.println(screen_size)

    if program.window == nil {
        log.panic("RGFW failed to create the main window")
    }

    //rgfw.window_swapInterval(program.window, 1)
    rgfw.window_setIcon(program.window, raw_data(icon), {3, 3}, 4)

    program.is_running = true
}

teardown_program :: proc(program : ^Program) {
    program.is_running = false
    rgfw.window_close(program.window)
}

main :: proc() {
    program := Program{}
    init_program(&program)
    defer teardown_program(&program)

    for !rgfw.window_shouldClose(program.window) {

        // handle events
        for rgfw.window_checkEvent(program.window) != nil {
            if program.window.event.type == .quit {
                break
            }
        }

        do_drawing(&program)
    }

}

do_drawing :: proc(program : ^Program) {

    color1 : [3]u8 = {0, 0, 255}
    drawRect(program.window, {0, 0, program.window.r.w, program.window.r.h}, &color1)

    color2 : [3]u8 = {255, 0, 0}
    drawRect(program.window, {200, 200, 200, 200}, &color2)

    rgfw.window_swapBuffers(program.window)
}
@ColleagueRiley
Copy link
Owner

@chris-montero Do you mind testing the RGFW c examples? This will let me know if it's a problem with the Odin binding (which is not up-to-date) or if it's a problem with RGFW itself.

@chris-montero
Copy link
Author

@ColleagueRiley I did so, and some of them work fine with the C examples.

These examples fail, along with their error messages:

  • examples/buffer/
X Error of failed request:  BadMatch (invalid parameter attributes)
  Major opcode of failed request:  152 (GLX)
  Minor opcode of failed request:  5 (X_GLXMakeCurrent)
  Serial number of failed request:  48
  Current serial number in output stream:  48
  • examples/events/
X Error of failed request:  BadMatch (invalid parameter attributes)
  Major opcode of failed request:  152 (GLX)
  Minor opcode of failed request:  5 (X_GLXMakeCurrent)
  Serial number of failed request:  47
  Current serial number in output stream:  47
  • examples/gl33/
X Error of failed request:  BadValue (integer parameter out of range for operation)
  Major opcode of failed request:  12 (X_ConfigureWindow)
  Value in failed request:  0x0
  Serial number of failed request:  41
  Current serial number in output stream:  44
  • examples/vk10/
    zsh: segmentation fault ./vk10

@ColleagueRiley ColleagueRiley transferred this issue from ColleagueRiley/RGFW-Odin Oct 15, 2024
@ColleagueRiley
Copy link
Owner

ColleagueRiley commented Oct 15, 2024

I'm transferring the issue here because I believe the source of the issue is the original code.

Could you tell me more about your GPU? I mostly would like to know what the latest version of OpenGL it supports and if it supports Vulkan.

Also the log is time stamped at Fri Sep 13 10:02:06. So it may not be relevant to this issue.

@chris-montero
Copy link
Author

I have an nvidia gtx 950.

glxinfo | grep "OpenGL version" outputs this:
OpenGL version string: 4.6.0 NVIDIA 550.120
Vulkan is supported. Just yesterday I was trying to set up the vulkan sdk for development, and I ran the provided vkcube executable, which ran without issues.

You're right, the log is old. I'll get a more recent version if you need it.

@ColleagueRiley
Copy link
Owner

@chris-montero I'll look into this issue as soon as I can. At the moment I am a bit busy. I believe the first error is caused by

this line on line 2543

XMatchVisualInfo((Display*) win->src.display, DefaultScreen((Display*) win->src.display), 32, TrueColor, vi); /*!< for RGBA backgrounds*/

@ColleagueRiley
Copy link
Owner

ColleagueRiley commented Oct 20, 2024

@ColleagueRiley I did so, and some of them work fine with the C examples.

These examples fail, along with their error messages:

* examples/buffer/
X Error of failed request:  BadMatch (invalid parameter attributes)
  Major opcode of failed request:  152 (GLX)
  Minor opcode of failed request:  5 (X_GLXMakeCurrent)
  Serial number of failed request:  48
  Current serial number in output stream:  48
* examples/events/
X Error of failed request:  BadMatch (invalid parameter attributes)
  Major opcode of failed request:  152 (GLX)
  Minor opcode of failed request:  5 (X_GLXMakeCurrent)
  Serial number of failed request:  47
  Current serial number in output stream:  47
* examples/gl33/
X Error of failed request:  BadValue (integer parameter out of range for operation)
  Major opcode of failed request:  12 (X_ConfigureWindow)
  Value in failed request:  0x0
  Serial number of failed request:  41
  Current serial number in output stream:  44
* examples/vk10/
  `zsh: segmentation fault  ./vk10`

@chris-montero These first two bugs might be fixed. I'd need to know more about the last two errors to attempt to fix them.

@ColleagueRiley ColleagueRiley added bug Something isn't working help wanted Extra attention is needed incompatibility labels Oct 21, 2024
@chris-montero
Copy link
Author

you are correct, the first two work now. The last two don't. I don't know what kind of information you want from gl33, or how I could provide you with that info.

But about examples/vk10, I think you can look here to see how to set up validation layers and a custom debug messenger and then maybe I can run that and give you some information that way.

@chris-montero
Copy link
Author

Btw I tried running vk10 in gdb, and this is the backtrace:

#0  0x00007ffff65e12e0 in ?? () from /usr/lib/libnvidia-glcore.so.550.120
#1  0x00007ffff65ecb17 in ?? () from /usr/lib/libnvidia-glcore.so.550.120
#2  0x00007ffff651d4c5 in ?? () from /usr/lib/libnvidia-glcore.so.550.120
#3  0x00007ffff7a0cda0 in ?? () from /usr/lib/libGLX_nvidia.so.0
#4  0x00007ffff7d2dd78 in terminator_CreateDevice (physicalDevice=physicalDevice@entry=0x5555556db030, pCreateInfo=pCreateInfo@entry=0x7fffffffd970, pAllocator=pAllocator@entry=0x0,
    pDevice=pDevice@entry=0x7fffffffd928) at /home/chris/software/VulkanSDK/1.3.296.0/source/Vulkan-Loader/loader/loader.c:5975
#5  0x00007ffff7d37e65 in loader_create_device_chain (pd=pd@entry=0x5555556db030, pCreateInfo=pCreateInfo@entry=0x7fffffffdb80, pAllocator=pAllocator@entry=0x0, inst=inst@entry=0x555555592410,
    dev=dev@entry=0x555555704390, callingLayer=callingLayer@entry=0x0, layerNextGDPA=0x0) at /home/chris/software/VulkanSDK/1.3.296.0/source/Vulkan-Loader/loader/loader.c:5070
#6  0x00007ffff7d38aee in loader_layer_create_device (instance=instance@entry=0x0, physicalDevice=physicalDevice@entry=0x5555556daa10, pCreateInfo=pCreateInfo@entry=0x7fffffffdb80,
    pAllocator=pAllocator@entry=0x0, pDevice=pDevice@entry=0x555555566b50 <RGFW_vulkan_info+16>, layerGIPA=layerGIPA@entry=0x0, nextGDPA=0x0)
    at /home/chris/software/VulkanSDK/1.3.296.0/source/Vulkan-Loader/loader/loader.c:4445
#7  0x00007ffff7d3f9c6 in vkCreateDevice (physicalDevice=0x5555556daa10, pCreateInfo=0x7fffffffdb80, pAllocator=0x0, pDevice=0x555555566b50 <RGFW_vulkan_info+16>)
    at /home/chris/software/VulkanSDK/1.3.296.0/source/Vulkan-Loader/loader/trampoline.c:1017
#8  0x000055555555e9f5 in RGFW_deviceInitialization ()
#9  0x000055555555e44f in RGFW_initVulkan ()
#10 0x000055555555f8a1 in main ()

@ColleagueRiley
Copy link
Owner

ColleagueRiley commented Oct 23, 2024

@chris-montero I'll look into the vulkan example later. It's a low priority because it's an issue with an example and not with RGFW. Also for full disclosure, the vulkan example is based on contributed code rather than code I wrote myself.

I'm not sure how to start fixing gl33 issue. But it will require your assistance since the error doesn't occur with my hardware/drivers.

@chris-montero
Copy link
Author

@ColleagueRiley for the gl33 example, if you can give me a patched version of the code that would produce more relevant information for you, I can run it and give you the output.

@ColleagueRiley
Copy link
Owner

ColleagueRiley commented Oct 23, 2024

@chris-montero I'm not entirely sure why that issue is happening. The error is a bit vague. It could mean, for example, that the window is just too large. Would you mind debugging the example and finding where the issue occurs?

@chris-montero
Copy link
Author

@ColleagueRiley I tried to debug it with both gdb and lldb, but I guess that won't do much since it seems to be an x11 error, not a segfault or anything like that. I don't know what else to try. Do you have any suggestions?

@ColleagueRiley
Copy link
Owner

f93c2fd

Should fix your gl33 issue

@chris-montero
Copy link
Author

This fixes the problem. You can keep this issue to keep investigating and find a more robust fix for gl33. or do whatever you want with it i dont really care

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working help wanted Extra attention is needed incompatibility
Projects
None yet
Development

No branches or pull requests

2 participants