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

Modernize Mesa library #3414

Merged
merged 16 commits into from
Oct 14, 2023
Merged

Modernize Mesa library #3414

merged 16 commits into from
Oct 14, 2023

Conversation

gzotti
Copy link
Member

@gzotti gzotti commented Sep 16, 2023

Retry of #3409

Description

This is intended to fix problems around outdated Mesa V11 libraries which come with Qt.
It provides OpenGL 4.5 CoreProfile and would allow to run advanced features (OpenGL3.3) on really old systems,
or in some circumstances where Stellarium needs to run in a VM without GPU.

A first way is replacing the default opengl32sw.dll by another build of Mesa 20 from https://fdossena.com/?p=mesa/index.frag

Further, if users prefer, prepare program for user upgrade with current Mesa3D builds, and add instructions to SUG.

This also finally removes the deprecated "safe mode" CLI switch.

Fixes #2803

Screenshots (if appropriate):

Type of change

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)
  • This change requires a documentation update
  • Housekeeping

How Has This Been Tested?

Test Configuration:

  • Operating system: Windows 11
  • Graphics Card: Geforce 3070Ti (but this explicitly runs on CPU!)
  • CPU: Intel Core i7-12700.

Checklist:

  • My code follows the code style of this project.
  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation (header file)
  • I have updated the respective chapter in the Stellarium User Guide
  • My changes generate no new warnings
  • I have added tests that prove my fix is effective or that my feature works
  • New and existing unit tests pass locally with my changes
  • Any dependent changes have been merged and published in downstream modules

@gzotti gzotti added importance: medium A bit annoying, minor miscalculation, but no crash infrastructure Infrastructure related issues qt Issues, related to Qt framework mesa Issues, related to MESA labels Sep 16, 2023
@gzotti gzotti added this to the 23.4 milestone Sep 16, 2023
@gzotti gzotti requested review from alex-w and 10110111 September 16, 2023 01:17
@github-actions
Copy link

Great PR! Please pay attention to the following items before merging:

Files matching src/**/*.cpp:

  • Are possibly unused includes removed?

Files matching guide/**:

  • Did you remember to update screenshots to match new updates?
  • Did you remember to grammar check in changed part of documentation?

This is an automatically generated QA checklist based on modified files.

@alex-w
Copy link
Member

alex-w commented Sep 16, 2023

I see no changes in .appveyor.yml file

Rendering the graphics without hardware acceleration is of course much slower than accelerated graphics, but it's surely better than nothing.

Qt's default Mesa library (Mesa 11) provides support for OpenGL~3.0 only. This prevents users of Qt5-based versions from applying dithering.
On Qt6, also the \program{ShowMySky} skylight model (see section~\ref{sec:skylight:ShowMySky}) is then not available.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ShowMySky doesn't depend on Qt version.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ShowMySky is now available on Qt6 builds only, right?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No, Qt version doesn't make any difference.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

BTW, dithering also doesn't depend on Qt version.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

OK. I remember we had discussed removing SMS from Qt5 builds as those are intended for incapable systems only. Good!

Does dithering depend on the availability of OpenGL3.3 or not? If it does, then users of Qt5/Mesa11(OpenGL3.0) cannot apply dithering. This was written in light of SMS not available, so the only OpenGL issue to mention would have been missing dithering.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The only factor that affects availability of high graphics mode is support for OpenGL 3.3. After all the discussions I decided to not take Qt version into account, because it wouldn't simplify anything.

High graphics mode currently defines whether we have dithering and ShowMySky.

The \program{Mesa3D} project \footnote{\url{https://www.mesa3d.org/}} meanwhile (2023) provides at least OpenGL~4.5.
If you wish to use more ``up to date'' precompiled binaries and have Administrator privileges on your Windows system, \newFeature{23.3}
you can replace this library using the following steps to install inofficial builds\footnote{\url{https://github.com/pal1000/mesa-dist-win/}}.
Note however that after this upgrade, the program runs with considerably ($\approx$35\%?) lower framerate.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Didn't you say this improves frame rate rather than degrades?

Copy link
Member Author

@gzotti gzotti Sep 16, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This branch should

  1. replace Qt's Mesa 11 by fdossena's Mesa 20. Unconditionally.
  2. For "purists" who don't like taking Mesa DLLs from other sources than github, describe a path to move to a "more official" Mesa build, which however runs considerably slower. Just like giving instructions to run nouveau drivers for OS purists.

(2) is done. The next steps will hopefully bring the Mesa20 DLL to where it belongs.

Copy link
Contributor

@10110111 10110111 Sep 16, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

(2) makes zero sense, because pal1000's builds are not more official than fdossena's ones. Both provide instructions to reproduce the builds, so you can make your own binaries if you want. And GitHub is not an authority for Mesa in any way, since Mesa has long moved to GitLab@FreeDekstop.

You must decide whether this is really beneficial in your situation. The libraries don't provide and additional graphics features that Stellarium make use of.

\begin{itemize}
\item Download the latest ``release-msvc'' package as you need from \url{https://github.com/pal1000/mesa-dist-win/releases} and unpack it somewhere.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The instructions seem out of date, referring to the previous source of packages.

@gzotti
Copy link
Member Author

gzotti commented Sep 16, 2023

I see no changes in .appveyor.yml file

Yes, nothing done yet. Where do I put the new Mesa libraries in stellarium-data before I start? I am not familiar with the Github "release" thing. In case you can "unrelease" something, you can BTW remove the Mesa23 stuff.

@alex-w
Copy link
Member

alex-w commented Sep 18, 2023

Yes, nothing done yet. Where do I put the new Mesa libraries in stellarium-data before I start? I am not familiar with the Github "release" thing. In case you can "unrelease" something, you can BTW remove the Mesa23 stuff.

Just follow link https://github.com/Stellarium/stellarium-data/releases/new and put the text and data

@alex-w
Copy link
Member

alex-w commented Sep 30, 2023

@gzotti do you really want to replace dll for Qt6-based packages?

@gzotti
Copy link
Member Author

gzotti commented Sep 30, 2023

Yes, I see >8fps for this Mesa20, vs. 6fps for Qt6's Mesa11.2.
I have not tested the program thoroughly, so far. Not sure if something breaks now.

@alex-w
Copy link
Member

alex-w commented Oct 2, 2023

Ok, it’s look complete now

@gzotti
Copy link
Member Author

gzotti commented Oct 2, 2023

OK, Must test if Qt5 works with all 3 options now...

@alex-w
Copy link
Member

alex-w commented Oct 4, 2023

OK, Must test if Qt5 works with all 3 options now...

Works for Qt6, but not for Qt5 builds :(

@github-actions github-actions bot added the has conflicts The pull request has conflicts label Oct 5, 2023
@github-actions

This comment was marked as resolved.

@github-actions

This comment was marked as resolved.

@github-actions github-actions bot removed the has conflicts The pull request has conflicts label Oct 5, 2023
@gzotti
Copy link
Member Author

gzotti commented Oct 9, 2023

Qt6 solution: finished.

Qt5 solutions:
x64:
Do you now exclude the OpenGL libraries from Qt5.6 entirely? We still need libEGL.dll and libGLESv2.dll from there. Only the opengl32sw.dll is replaced by the newer one.

log_Qt5-x64-ANGLE.txt

log_Qt5-x64-ANGLEdx11.txt

log_Qt5-x64_ANGLE_qt5.6EGLstuff.txt

log_Qt5-x64-ANGLEdx11_qt5.5EGLstuff.txt [sorry, misspelled, 5.6...]

x32: tomorrow (download limit exceeded...)

@10110111

This comment was marked as resolved.

@gzotti

This comment was marked as resolved.

@gzotti
Copy link
Member Author

gzotti commented Oct 10, 2023

Trying Qt5-32bit-Mesa. Crash on startup. Saw memory problems loading higher star catalogs. Now reset to default and disabled all plugins. Still, logfile:

Creating GUI ...
Loading style file: :/graphicGui/normalStyle.css
Creating scene FBO with size 3440x1440
Initializing planets GL shaders...
C:\stellarium\src\core\StelApp.cpp:915: OpenGL error: 1285 (GL_OUT_OF_MEMORY)

App remains alive now, but shows nothing. I have not installed a 32-bit build for some time now. Does it work regularly?
This is the Mesa build. Is there some envvar to tweak Mesa's OpenGL memory?

@gzotti gzotti marked this pull request as ready for review October 14, 2023 01:04
@github-actions github-actions bot requested a review from 10110111 October 14, 2023 01:05
Copy link
Member

@alex-w alex-w left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this PR can be merged and we should publish a snapshot for testing on various users hardware

@github-actions github-actions bot added the has conflicts The pull request has conflicts label Oct 14, 2023
@github-actions
Copy link

This pull request has conflicts, please resolve those before we can evaluate the pull request.

@github-actions
Copy link

Conflicts have been resolved. A maintainer will review the pull request shortly.

@github-actions github-actions bot removed the has conflicts The pull request has conflicts label Oct 14, 2023
@gzotti gzotti merged commit 1850c07 into master Oct 14, 2023
17 checks passed
@gzotti gzotti deleted the modernize-mesa branch October 14, 2023 17:08
@alex-w alex-w added the state: published The fix has been published for testing in weekly binary package label Oct 23, 2023
@github-actions
Copy link

Hello @gzotti!

Please check the fresh version (development snapshot) of Stellarium:
https://github.com/Stellarium/stellarium-data/releases/tag/weekly-snapshot

@alex-w alex-w removed the state: published The fix has been published for testing in weekly binary package label Dec 23, 2023
Copy link

Hello @gzotti!

Please check the latest stable version of Stellarium:
https://github.com/Stellarium/stellarium/releases/latest

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
importance: medium A bit annoying, minor miscalculation, but no crash infrastructure Infrastructure related issues mesa Issues, related to MESA qt Issues, related to Qt framework
Development

Successfully merging this pull request may close these issues.

stellarium-1.1.1-qt6-win64.exe show only blank / black screen
3 participants