tonarino / just-gl

Run an OpenGL application on Linux, and nothing more.
1 stars 0 forks source link

WIP: Debug failure to call create_buffer_object() on Intel iGPU #1

Open strohel opened 11 months ago

strohel commented 11 months ago

Just some WIP debugging to see if I can get just-gl running on Intel iGPU with i915 driver.

Relates to #4.

Currently I'm getting:

prelude ``` [src/main.rs:89] gpu.get_driver().expect("Failed to get GPU driver info") = Driver { name: "i915", date: "20201103", desc: "Intel Graphics", } [src/main.rs:90] gpu.get_bus_id().expect("Failed to get GPU bus ID") = "" Connectors: eDP-1, Connected=✅ HDMI-A-1, Connected=❌ DP-1, Connected=❌ DP-2, Connected=❌ DP-3, Connected=❌ DP-4, Connected=❌ Using connector: eDP-1 Using mode: Mode { name: "1920x1200", clock: 156100, size: (1920, 1200), hsync: (1936, 1952, 2104), vsync: (1203, 1217, 1236), hskew: 0, vscan: 0, vrefresh: 60, mode_type: PREFERRED | DRIVER } [src/main.rs:125] encoder = Info { handle: encoder::Handle( 235, ), enc_type: TMDS, crtc: Some( crtc::Handle( 80, ), ), pos_crtcs: 15, pos_clones: 1, } [src/main.rs:132] crtc = Info { handle: crtc::Handle( 80, ), position: ( 0, 0, ), mode: Some( Mode { name: "1920x1200", clock: 156100, size: ( 1920, 1200, ), hsync: ( 1936, 1952, 2104, ), vsync: ( 1203, 1217, 1236, ), hskew: 0, vscan: 0, vrefresh: 60, mode_type: PREFERRED | DRIVER, }, ), fb: Some( framebuffer::Handle( 289, ), ), gamma_length: 256, } ```
Is AB24 format supported for SCANOUT | WRITE usage: true
Is AR24 format supported for SCANOUT | WRITE usage: true
Is BG24 format supported for SCANOUT | WRITE usage: false
Is BA24 format supported for SCANOUT | WRITE usage: false
Is BX24 format supported for SCANOUT | WRITE usage: false
Is RG24 format supported for SCANOUT | WRITE usage: false
Is R8A8 format supported for SCANOUT | WRITE usage: false
Is RA24 format supported for SCANOUT | WRITE usage: false
Is RX24 format supported for SCANOUT | WRITE usage: false
Is XB24 format supported for SCANOUT | WRITE usage: true
Is XR24 format supported for SCANOUT | WRITE usage: true
gbm.create_buffer_object(width: 1920, height: 1200, format: AR24, usage: SCANOUT | WRITE)
thread 'main' panicked at src/main.rs:155:90:
called `Result::unwrap()` on an `Err` value: Os { code: 22, kind: InvalidInput, message: "Invalid argument" }

Which puzzles me, because the format and usage combination is claimed to be supported.

mbernat commented 11 months ago

Yeah, I don't think the formats are the issue here, we're probably not initializing something else correctly.

It would be nice to get more debug info from DRM/GBM when something goes wrong. With strace you can see a bit more but I'm afraid we'd have to read kernel code to figure out what goes wrong.

PabloMansanet commented 11 months ago

Just to add another data point, I'm having this exact same issue. Will investigate as well!

PabloMansanet commented 11 months ago

I've looked into this for a bit and I didn't really get anywhere. libgbm is a bit underdocumented, and from the examples I find it looks like we should be able to call gbm_bo_create pretty much exactly as we're doing. I might try an equivalent C example tomorrow.