-
Notifications
You must be signed in to change notification settings - Fork 109
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
Egl dust off2 #531
base: master
Are you sure you want to change the base?
Egl dust off2 #531
Conversation
…d HAVE_EGL is not defined. Broke GLX.
I have now tested this, and can confirm it makes FreeCAD run on Wayland. As far as I can tell, this fixes... |
However, if one tries to create a rectangle in FreeCAD Sketcher, SIGSEGV happen. Vertices and distance constraints work fine, but arcs, rectangles and lines causes a crash. @luzpaz, @katepavlu, @euphi or @ramast can you try to compile for this branch on Wayland(!) and see if you get the same issues?
Coin error in SoGroup::removeChild(): tried to remove non-existent child 0x561a5d7621f0 (Annotation)
|
I can't compile on my setup at this time. Maybe some of these folks can ? |
I tried latest 1.0 branch of freecad on kde neon (more or less ubuntu 22.04). I have to set env-variable COIN_GL_NO_CURRENT_CONTEXT_CHECK to avoid triggering of an assert but apart from that it seems to work, creating rectangles, lines, arcs does work. |
@rmu75 just to clarify: it works using sketcher having compiled FreeCAD with this Coin branch? And you are sure you chose EGL build when compiling coin, using build flag? |
I compiled against benj5378:eglDustOff2 branch. Pretty sure it is using native wayland as the font rendering and dpi scaling looks completely different vom my XWayland setup. And the log is spammed with "(qt.qpa.wayland) Wayland does not support QWindow::requestActivate()" messages which don't appear when using XWayland. Rotation and panning is very smooth, but zooming is stuttering and causes spikes in CPU usage and immediate spin up of cpu cooler. |
Sometimes a warning |
I will re-check if it is really using EGL and not some kind of software rendering. Seems I was overly enthusiastic and didn't compile with COIN_BUILD_EGL enabled... will re-check. |
So I rebuilt libcoin with COIN_BUILD_EGL enabled, ldd confirms that FreeCAD imports libEGL.so next to libOpenGL and libGLX, but nonetheless I suspect it is using software rendering. |
So after rebuilding FreeCAD situation is more or less unchanged, it seems to work as usual when started with QT_QPA_PLATFORM=xcb. With QT_QPA_PLATFORM=wayland zooming is a bit sluggish and CPU usage seems to be higher but everything including sketcher seems to work. How can I check if it is really using EGL? |
@rmu75, if you used the |
Perhaps you can find a GPU monitoring tool that will show whether your process is software rendering or not? |
running with EGL_LOG_LEVEL=debug spews out a bunch of debug info like
so at least EGL seems to be initialized. Not sure how to proceed, out of time for today. |
running with LIBGL_ALWAYS_SOFTWARE is a big difference (nothing is smooth any more) so I'm pretty sure that without that it is actually using the GPU. |
AFAIU without COIN_BUILD_EGL this doesn't link to libEGL. But even then EGL is loaded dynamically if needed (via egl glue code?). |
I opened up a project for tracking Wayland and OpenGL ES support. It should be public now. |
I managed to compile libcoin and FreeCAD with
Before the crash I also get some warnings:
With
It's strange that libEGL is using the i915 driver because I have a discrete NVIDIA card that it's supposed to use not the integrated GPU.
Please note that the system packages
|
There is a very thorough investigation of the issue here (I think it's the same) FreeCAD/FreeCAD#16316. I don't think it's Wayland related though. Can you please |
bump |
Me and @hyarion have been considered what might be needed to maintain Coin for future use in FreeCAD. This includes EGL support and reaction to OpenGL currently being outphased in the industry. Might be on hold until FreeCAD community have taken a decision on whether Coin should be used forward on. I have no experience with Coin or EGL. I could read tons of docs on how to support EGL, but currently looking for people with experience in the area to help out. For example with seg faults arising, that I have no idea to why is happening (having zero Coin experience at all). |
At FreeCAD we currently have no plan to migrate out of coin. There have been several discussions among developers about it, and while coin is not actively being worked on, it's a fantastic library, many developers love it, it is simple to use, suits perfectly the needs of FreeCAD, and is extensible enough so it should provide the few things we feel are missing in FreeCAD (shadows, ambient occlusion, "filled" sections, etc) Also, a big question if we thought of replacing it (which would be very extensive work), would be: replacing it with what, and there is no clear or easy answer to that question. For me the conclusion to those discussions was that FreeCAD developers clearly want to stick with coin, and, if needed (basically: if maintenance or packaging become a problem, or if coin maintainers would want that), we would I think be ready to carry its maintenance ourselves. |
Just to give some insight the discussion between me and @benj5378 that benj referred to. The only real issue we identified with coin is that it seems to be quite tightly coupled with OpenGL (in compatible mode). I can't see into the future but it seems like the industry is moving away from OpenGL towards a more fragmented space with vulcan, dx and metal. OpenGL is already deprecated by on apple devices, though still available (https://developer.apple.com/documentation/apple-silicon/porting-your-macos-apps-to-apple-silicon) In order to use coin on a future platform, where OpenGL is not available, it might be needed to look over the backend. Maybe switching over to vulcan or a low lever library like bgfx would be necessary. Another issue to keep in mind is that freecad is using some features like line stipple more frequently, and these will soon require workaround as they are not well supported on various platforms (apples OpenGL driver causes quite ugly stipples when they are used with a line width. Some older mesa libraries are failing completely). If there would be a plan to swap OpenGL to something else, then it would be better for freecad if that is done before more features which ties it closer to OpenGL is implemented. I agree that both coin has served us well and that there's currently no need to use anything else in freecad. Changing from coin to another engine does not look like a good option, but improving coin if needed, does. |
I looked at MGL on Apple M3 laptop to see if that technology could be used as a wrapper on metal for bringing Coin OpenGL to the new Apple machines. The MGL open source is very poorly supported and I was unable to bring up the test suite on it. So I'm not recommending that approach without an investment in fixing it/MGL. It would be interesting to see if the low-level, OpenGL-based rendering interface for Coin could be made abstract and generic enough to support different 3D rendering pipelines. It may be a pipe dream, though, and take a considerable amount of work with lots of limitations for each platform. |
Great to see this discussion. I have been working ocasionally on this task, started from the EGL PR and been trying to convert Coin3D to work with modern OpenGL. Incidentally I started with a separate branch for a bgfx-based renderer, like you suggested, but eventually switched back to just porting the existing renderer to modern OpenGL, with the eventual to get FreeCAD to run on the web with WebGL. I haven't worked on it in a bit, but I think I had some basic geometry rendering with shaders on the web with Emscripten-based setup, as well as compatibility profile feature gating. Would be glad to clean it up and share it if someone would like check it out and/or help move things along. |
Exactly that was the motivation a few years ago when I started to move Coin over to Github and spent a large amount of time to get the build process running with GitHub Actions. To me Coin seemed to good to let it die. I have used it a very long time in a physics simulation software for visualisation.
I coudn't answer that either and spent some time with Qt3D, but Coin feels to me more like batteries included. It's easy to quickly get something up and running.
As for now packaging is not a problem. Releasing is simply adding first time contributors to the THANKS file, adding ChangeLog file, bumping the version number and tagging the release. Everything else runs fully automated on Github and AppVeyor. And, most linux distributions and vcpkg include a ready to install package for Coin, simage, SoQt and Quarter. As FreeCAD is one of the largest software packages using Coin, please drop a issue or a note when a new minor or major release is planned and some fixes need to be released. |
The purpose of this PR is to clean up #471, add b49b8b4, rebase, and trigger CI in a non-draft PR.