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

[GL] Fix: Intel graphics on linux now overrides the core profile context #526

Merged
merged 2 commits into from
Dec 21, 2017

Conversation

marques-bruno
Copy link
Member

@marques-bruno marques-bruno commented Nov 23, 2017

fixing #238
This fix solves the segfault at startup that intel-powered linux machines experience.
It should be a linux-specific bugfix to my understanding.
If anyone knows a clean way of probing whether or not a "Core profile" context would be created (something better than parsing lspci to see if we're runing an intel GPU...), I'll update this PR accordingly

Anyone to review?


This PR:

  • builds with SUCCESS for all platforms on the CI.
  • does not generate new warnings.
  • does not generate new unit test failures.
  • does not generate new scene test failures.
  • does not break API compatibility.
  • is more than 1 week old (or has fast-merge label).

Reviewers will merge only if all these checks are true.

@marques-bruno marques-bruno added pr: fix Fix a bug pr: status to review To notify reviewers to review this pull-request labels Nov 23, 2017
@marques-bruno marques-bruno self-assigned this Nov 23, 2017
#ifdef __linux__
::setenv("MESA_GL_VERSION_OVERRIDE", "3.0", 1);
#endif // __linux

Copy link
Contributor

Choose a reason for hiding this comment

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

AFAIK, this will be applied even if you have an AMD or Nvidia gpu.
Can we specify when we have to apply it ? Like :
if(glGetString( GL_VENDOR )=="Intel Open Source Technology Center") ::setenv("MESA_GL_VERSION_OVERRIDE", "3.0", 1);
Let me know if it's overkill :)

Copy link
Member Author

Choose a reason for hiding this comment

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

Hi and thanks for your comment!
It would indeed be cleaner to check for Intel's hardware before setting this env variable.
The only issue is that I haven't found (nor looked that much yet..) a way of doing so.
Calling glGetString is, to my knowledge, only possible once the OpenGL context is created (?). Thus I would have to create a dummy gl context, probe the glVendor variable, destroy the dummy context, set the env variable, and then only let Qt create its OpenGL context.
This is quite heavy...
If you guys have an idea how to do this cleanly, I'm all ears :)

Copy link
Contributor

Choose a reason for hiding this comment

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

You are right for the opengl context.
I don't know how to properly do it.
Well, it looks overkill :/

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.. :) Maybe someone else has an idea how to do this in a better way.
I'm setting this PR back to 'to review' until someone finds an acceptable approach to check for the GPU model / vendor

@damienmarchal damienmarchal added pr: status wip Development in the pull-request is still in progress and removed pr: status to review To notify reviewers to review this pull-request labels Nov 29, 2017
@marques-bruno marques-bruno added pr: status to review To notify reviewers to review this pull-request and removed pr: status wip Development in the pull-request is still in progress labels Dec 7, 2017
@guparan guparan added pr: status wip Development in the pull-request is still in progress and removed pr: status to review To notify reviewers to review this pull-request labels Dec 13, 2017
@damienmarchal
Copy link
Contributor

damienmarchal commented Dec 15, 2017

Hello @bruno-marques

After some thinking about that I'm more convinced now that the best approach is to simply display a warning message like that:

if( isIntelraphics() )
{
      msg_error("runSofa") << "Intel drivers have a problem ...with ..... to runSofa you need to set your manually set an environment variable named 'MESA_GL_VERSION_OVERRIDE' with the value '3.0' to fix the problem.";
      exit(-1);
}

…hout MESA_GL_VERSION_OVERRIDE=3.0 on Linux with Intel GC.
@marques-bruno
Copy link
Member Author

Sorry for taking so much time to finish this. I think we could still merge that one with the 17.12, once the checks are passed..? :)

@marques-bruno marques-bruno added pr: status to review To notify reviewers to review this pull-request pr: fast merge Minor change that can be merged without waiting for the 7 review days and removed pr: status wip Development in the pull-request is still in progress labels Dec 20, 2017
@damienmarchal
Copy link
Contributor

I think this one is ready.

@damienmarchal damienmarchal added pr: status ready Approved a pull-request, ready to be squashed and removed pr: status to review To notify reviewers to review this pull-request labels Dec 21, 2017
@guparan guparan merged commit 89734cd into sofa-framework:master Dec 21, 2017
@guparan guparan added this to the v17.12 milestone Jan 10, 2018
@marques-bruno marques-bruno deleted the fix_intel_coreprofile branch September 6, 2018 16:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
pr: fast merge Minor change that can be merged without waiting for the 7 review days pr: fix Fix a bug pr: status ready Approved a pull-request, ready to be squashed
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants