Bug 1357 - Support Mesa 18.2.2 (java.lang.InternalError: profile[1]: GL3bc -> profileImpl GL4bc not mapped)
Summary: Support Mesa 18.2.2 (java.lang.InternalError: profile[1]: GL3bc -> profileImp...
Status: RESOLVED FIXED
Alias: None
Product: Jogl
Classification: JogAmp
Component: opengl (show other bugs)
Version: 2.4.0
Hardware: pc_x86_64 linux
: P1 critical
Assignee: Sven Gothel
URL:
Depends on:
Blocks:
 
Reported: 2017-10-10 17:16 CEST by gst0098
Modified: 2019-03-29 16:15 CET (History)
3 users (show)

See Also:
Type: DEFECT
SCM Refs:
96cdafe8a32b74fed853110d593521b49448e60d e6298fa34539fc5bb636fe10e0d4f083719dee64
Workaround: ---


Attachments
Source code to reproduce the bug and log file obtained with: -Dnewt.debug=all -Dnativewindow.debug=all -Djogl.debug=all (12.44 KB, application/x-compressed-tar)
2017-10-10 17:16 CEST, gst0098
Details
Patched version of GLContextImpl (53.79 KB, application/x-java)
2018-02-20 12:00 CET, Julien Gouesse
Details
Patched version of GLContextImpl (126.51 KB, text/x-java)
2019-03-24 20:54 CET, Julien Gouesse
Details
Diff of GLContextImpl (4.22 KB, text/plain)
2019-03-24 20:55 CET, Julien Gouesse
Details

Note You need to log in before you can comment on or make changes to this bug.
Description gst0098 2017-10-10 17:16:33 CEST
Created attachment 798 [details]
Source code to reproduce the bug and log file obtained with: -Dnewt.debug=all -Dnativewindow.debug=all -Djogl.debug=all

With AMD RX590 or RX480 running the program thorws the exception:

Exception in thread "AWT-EventQueue-0" java.lang.InternalError: XXX0 profile[1]: GL3bc -> profileImpl GL4bc !!! not mapped

With recent mesa the naming convention has been changed and now AMD cards are named "AMD" instead of the former name "Gallium". This cause the bug.

Giuseppe
Comment 1 Julien Gouesse 2017-10-11 13:46:02 CEST
It seems to occur with Mesa 17.2.1 but not with earlier versions.
Comment 2 Julien Gouesse 2017-10-11 13:53:45 CEST
Please can you run glxinfo?
https://dri.freedesktop.org/wiki/glxinfo/

I'll compare with the result on my machine using an older version of Mesa.
Comment 3 Julien Gouesse 2017-10-11 14:01:31 CEST
Oops, I occurred with Mesa 17.2.0 too but not with Mesa 17.1.5:
http://forum.jogamp.org/Mesa-17-2-0-renderer-driver-name-change-error-causes-GLProfile-not-mapped-initialization-error-td4038176.html

Gallium 0.4 on AMD HAWAII (DRM 3.15.0 / 4.12.12-1-ARCH, LLVM 4.0.1) -> AMD Radeon R9 200 Series (AMD HAWAII / DRM 3.15.0 / 4.12.12-1-ARCH, LLVM 4.0.1)
Comment 4 Julien Gouesse 2017-10-11 14:05:52 CEST
Using GL_VERSION might help as it should contain:
3.1 (3.1 Mesa 17.2.1)

or something like this:

3.3 (Core Profile) Mesa 17.2.1
Comment 5 Julien Gouesse 2017-10-11 14:13:56 CEST
I suggest this change:
final boolean isDriverMesa = glRenderer.contains(MesaSP) || glRenderer.contains("Gallium ");

-> 

final boolean isDriverMesa = glRenderer.contains(MesaSP) || glRenderer.contains("Gallium ") || glVersion.contains(MesaSP);

It won't break non Mesa AMD drivers :) Guiseppe's second suggestion seems to be viable.
Comment 6 gst0098 2017-10-11 14:56:25 CEST
I'm out of office today and tomorrow, if needed I can give the output of glxinfo on friday morning.
I'll try the fix suggested by Julien and report back result on my environment, I think it will work.
Comment 7 Julien Gouesse 2017-10-11 15:25:19 CEST
(In reply to gst0098 from comment #6)
> I'm out of office today and tomorrow, if needed I can give the output of
> glxinfo on friday morning.
> I'll try the fix suggested by Julien and report back result on my
> environment, I think it will work.

There's no hurry. Thank you. Feel free to make a pull request (only with this tiny change) against my repository if it works as expected.
Comment 8 gst0098 2017-10-13 09:42:50 CEST
Hello,
I tested the patch proposed by Julien and Zeno and it works.

Julien, how can I pull a request against your repo ?

I did the patch on the repo that I cloned with the command: 
git clone --recurse-submodules git://jogamp.org/srv/scm/jogl.git jogl

Giuseppe
Comment 9 Julien Gouesse 2017-10-13 10:52:09 CEST
(In reply to gst0098 from comment #8)
> Hello,
> I tested the patch proposed by Julien and Zeno and it works.
> 
> Julien, how can I pull a request against your repo ?
> 
> I did the patch on the repo that I cloned with the command: 
> git clone --recurse-submodules git://jogamp.org/srv/scm/jogl.git jogl
> 
> Giuseppe

Maybe it would be easier for you just to post here the git diff. I'll credit the change to Zeno and you.
Comment 10 gst0098 2017-10-13 11:54:44 CEST
Here it is:

diff --git a/src/jogl/classes/jogamp/opengl/GLContextImpl.java b/src/jogl/classes/jogamp/opengl/GLContextImpl.java
index 31a8e489e..c5b3ea8ac 100644
--- a/src/jogl/classes/jogamp/opengl/GLContextImpl.java
+++ b/src/jogl/classes/jogamp/opengl/GLContextImpl.java
@@ -2133,8 +2133,7 @@ public abstract class GLContextImpl extends GLContext {
     final boolean isES = 0 != ( ctp & GLContext.CTX_PROFILE_ES );
     final boolean isX11 = NativeWindowFactory.TYPE_X11 == NativeWindowFactory.getNativeWindowType(true);
     final boolean isWindows = Platform.getOSType() == Platform.OSType.WINDOWS;
-    final boolean isDriverMesa = glRenderer.contains(MesaSP) || glRenderer.contains("Gallium ");
-
+    final boolean isDriverMesa = glRenderer.contains(MesaSP) || glRenderer.contains("Gallium ") || glVersion.contains(MesaSP);
     final boolean isDriverATICatalyst;
     final boolean isDriverNVIDIAGeForce;
     final boolean isDriverIntel;

Thank you,
Giuseppe
Comment 11 Julien Gouesse 2018-02-20 12:00:06 CET
Created attachment 799 [details]
Patched version of GLContextImpl

I've just patched GLContextImpl with JByteMod available at https://grax.info
Comment 12 Andy Skinner 2018-04-27 14:34:40 CEST
Is this being put into JOGL?  It appears from comments that you have a fix, but maybe it has only been put into a patched version of the source file?

thanks
Comment 13 Julien Gouesse 2018-04-27 14:50:26 CEST
(In reply to Andy Skinner from comment #12)
> Is this being put into JOGL?  It appears from comments that you have a fix,
> but maybe it has only been put into a patched version of the source file?
> 
> thanks

http://forum.jogamp.org/how-can-I-build-jogl-2-3-3-and-when-is-it-due-for-release-tp4038662p4038675.html
Comment 14 Julien Gouesse 2018-12-22 01:05:44 CET
The suggested patch causes a regression on AMD Mullins and AMD Cedar whereas it's required for AMD POLARIS (10, 11, ...). I suggest this change:
final boolean isDriverMesa = glRenderer.contains(MesaSP) || glRenderer.contains("Gallium ") || (glVersion.contains(MesaSP) && glRenderer.contains("POLARIS"));
Comment 15 Julien Gouesse 2019-03-21 09:51:43 CET
Rather do this:
final boolean isDriverMesa = glRenderer.contains(MesaSP) || glRenderer.contains("Gallium ") || (glVersion.contains(MesaSP) && glRenderer.contains("POLARIS"));

as I suggested here:
https://github.com/sgothel/jogl/pull/105#issuecomment-449527037
Comment 16 Julien Gouesse 2019-03-24 20:54:12 CET
Created attachment 802 [details]
Patched version of GLContextImpl

Takes into account neilcsmith-net's remark on Mesa 18.2.2.
Comment 17 Julien Gouesse 2019-03-24 20:55:05 CET
Created attachment 803 [details]
Diff of GLContextImpl
Comment 18 Sven Gothel 2019-03-25 15:33:01 CET
Merged pull request #105 from serebit/patch-1 96cdafe8a32b74fed853110d593521b49448e60d

and committed Julien's patch attachment 803 [details] as e6298fa34539fc5bb636fe10e0d4f083719dee64

"Bug 1357 Related: GLRendererQuirks NoSetSwapIntervalPostRetarget and NoDoubleBufferedPBuffer no more required for Mesa >= 18.2.2"