waffle-gl / waffle

A C library for selecting an OpenGL API and window system at runtime
https://waffle.freedesktop.org
BSD 2-Clause "Simplified" License
35 stars 16 forks source link

Mesa change breaks Waffle #40

Closed gurchetansingh closed 7 years ago

gurchetansingh commented 8 years ago

I am running the following version of Waffle with ChromeOS: https://chromium.googlesource.com/chromiumos/overlays/chromiumos-overlay/+/master/media-libs/waffle With this recent Mesa change, the following wflinfo command returns an error: localhost ~ # wflinfo -p null -a gles2 Waffle error: 0x2 WAFFLE_ERROR_UNKNOWN: eglChooseConfig found no matching configs

The error can be traced back to this line: const EGLint surface_type = EGL_PBUFFER_BIT; The command works fine if we change that line to: const EGLint surface_type = EGL_PBUFFER_BIT | EGL_WINDOW_BIT; However, since there are no windows with the surfaceless platform, the first method is correct. Before that change, Mesa used to advertise the the window bit only. I am not sure if this error is specific to ChromeOS's version of Waffle, though.

evelikov commented 8 years ago

The "NULL" platform hasn't landed in waffle. It would be great if @fjhenigman and @Sonicadvance1 could join forces and unify the implementations.

Sonicadvance1 commented 8 years ago

bweh?

gurchetansingh commented 8 years ago

BTW a hack for the issue described above can be found here :

https://chromium-review.googlesource.com/#/c/358936/

evelikov commented 8 years ago

@Sonicadvance1 got confused between surfaceless(null) and headless. Fwiw I'm all for having both (and even on-screen GBM, which would share a lot with surfaceless), while not a huge fan of the "github way". That's why I've noticed your PR way after it was closed.

fjhenigman commented 8 years ago

@evelikov : I'll try to land null platform while someone still cares. (: Now that I know you're also interested in on-screen GBM, I'll try to take that into account. @Sonicadvance1 : what are you working on in your fork?

Sonicadvance1 commented 8 years ago

I generated an EGL backend that rendered purely in to a pbuffer, which could have been easily extended to support surfaceless rendering(Which I was using locally).

linyaa-kiwi commented 8 years ago

The submitted fix (setting EGL_SURFACE_TYPE = EGL_PBUFFER_BIT) can break platforms that don't support pbuffers. If a platform doesn't support pbuffers, then eglChooseConfig would return no configs.

I think the correct fix is either to (a) leave EGL_SURFACE_TYPE unset so it acquires the driver's default value or (b) set it with a value dependent on the wcore_platform.

I plan on testing (a) and (b) today.

linyaa-kiwi commented 8 years ago

Confirmed that solution (a) does not work. It doesn't work because the EGL spec defines the default value of EGL_SURFACE_TYPE to be EGL_WINDOW_BIT, and Mesa's libEGL conforms to the spec there.

I'll proceed with writing code for solution (b).

linyaa-kiwi commented 8 years ago

I pushed a commit to master that lays some groundwork for this. https://github.com/waffle-gl/waffle/commit/6ee826cb9c9ee98276153d97ea4dae36e96b82e0

Also, see my fixes branch which is based on Chrome OS's Waffle and uses the above commit: https://github.com/chadversary/waffle/tree/wip/cros-fix-egl-surface-type-mask

evelikov commented 8 years ago

@gurchetansingh I believe everything mentioned here is addressed in master:

evelikov commented 7 years ago

I'd take the silence as an agreement that things are working fine. Feel free to reopen ;-)