From d3f454a3d8d608f9efe90987af3f08db89ad6e25 Mon Sep 17 00:00:00 2001 From: Xerxes Rånby Date: Mon, 2 Dec 2019 22:55:27 +0100 Subject: VC4: Broadcom uses libbrcmEGL.so, libbrcmGLESv2.so, libbrcmOpenVG.so and libbrcmWFC.so since 7 Jul 2016 Raspbian integration (two libGLES side-by-side) https://github.com/anholt/mesa/issues/24 --- .../jogamp/opengl/egl/EGLDynamicLibraryBundleInfo.java | 16 +++++++++++++++- .../opengl/egl/EGLES2DynamicLibraryBundleInfo.java | 4 ++-- 2 files changed, 17 insertions(+), 3 deletions(-) diff --git a/src/jogl/classes/jogamp/opengl/egl/EGLDynamicLibraryBundleInfo.java b/src/jogl/classes/jogamp/opengl/egl/EGLDynamicLibraryBundleInfo.java index 1b433cc30..8226c83d0 100644 --- a/src/jogl/classes/jogamp/opengl/egl/EGLDynamicLibraryBundleInfo.java +++ b/src/jogl/classes/jogamp/opengl/egl/EGLDynamicLibraryBundleInfo.java @@ -34,6 +34,8 @@ import java.util.List; import jogamp.common.os.PlatformPropsImpl; import jogamp.opengl.GLDynamicLibraryBundleInfo; +import jogamp.nativewindow.BcmVCArtifacts; + import com.jogamp.common.os.AndroidVersion; import com.jogamp.common.os.Platform; import com.jogamp.opengl.egl.EGL; @@ -97,8 +99,16 @@ public abstract class EGLDynamicLibraryBundleInfo extends GLDynamicLibraryBundle protected final List getEGLLibNamesList() { final List eglLibNames = new ArrayList(); + /** + * Prefer libbrcmEGL.so over libEGL.so.1 for proprietary + * Broadcom graphics when the VC4 DRM Xorg driver isn't present + */ + final boolean bcm_vc_iv_quirk = BcmVCArtifacts.guessVCIVUsed(false); + // this is the default EGL lib name, according to the spec - eglLibNames.add("libEGL.so.1"); + if(!bcm_vc_iv_quirk) { + eglLibNames.add("libEGL.so.1"); + } // try these as well, if spec fails eglLibNames.add("libEGL.so"); @@ -108,6 +118,10 @@ public abstract class EGLDynamicLibraryBundleInfo extends GLDynamicLibraryBundle // where our tool does not add it. eglLibNames.add("libEGL"); + if(bcm_vc_iv_quirk) { + eglLibNames.add("libbrcmEGL.so"); + } + return eglLibNames; } diff --git a/src/jogl/classes/jogamp/opengl/egl/EGLES2DynamicLibraryBundleInfo.java b/src/jogl/classes/jogamp/opengl/egl/EGLES2DynamicLibraryBundleInfo.java index 866e57ad7..45424c7e8 100644 --- a/src/jogl/classes/jogamp/opengl/egl/EGLES2DynamicLibraryBundleInfo.java +++ b/src/jogl/classes/jogamp/opengl/egl/EGLES2DynamicLibraryBundleInfo.java @@ -52,7 +52,7 @@ public final class EGLES2DynamicLibraryBundleInfo extends EGLDynamicLibraryBundl final List libsGL = new ArrayList(); /** - * Prefer libGLESv2.so over libGLESv2.so.2 for proprietary + * Prefer libbrcmGLESv2.so over libGLESv2.so.2 for proprietary * Broadcom graphics when the VC4 DRM Xorg driver isn't present */ final boolean bcm_vc_iv_quirk = BcmVCArtifacts.guessVCIVUsed(false); @@ -82,7 +82,7 @@ public final class EGLES2DynamicLibraryBundleInfo extends EGLDynamicLibraryBundl libsGL.add("GLESv2"); if (bcm_vc_iv_quirk) { - libsGL.add("libGLESv2.so.2"); + libsGL.add("libbrcmGLESv2.so"); } // ES2: Alternative names -- cgit v1.2.3 From 164db661e2688bfbc53fec3357fc6885b14ab893 Mon Sep 17 00:00:00 2001 From: Xerxes Rånby Date: Wed, 4 Dec 2019 00:11:40 +0100 Subject: VC4: Only load Broadcom EGL driver when guessVCIVUsed Broadcom VC IV can be used from both console and from inside X11 When used from inside X11 rendering is done on an DispmanX overlay surface while keeping an X11 nativewindow under as input. When Broadcom VC IV is guessed only the Broadcom DispmanX EGL driver is loaded. Therefore standard TYPE_X11 EGL can not be used. --- .../opengl/egl/EGLDynamicLibraryBundleInfo.java | 20 ++++---- .../opengl/egl/EGLES2DynamicLibraryBundleInfo.java | 56 +++++++++++----------- .../jogamp/nativewindow/NativeWindowFactory.java | 18 +++++-- 3 files changed, 50 insertions(+), 44 deletions(-) diff --git a/src/jogl/classes/jogamp/opengl/egl/EGLDynamicLibraryBundleInfo.java b/src/jogl/classes/jogamp/opengl/egl/EGLDynamicLibraryBundleInfo.java index 8226c83d0..8d993abc4 100644 --- a/src/jogl/classes/jogamp/opengl/egl/EGLDynamicLibraryBundleInfo.java +++ b/src/jogl/classes/jogamp/opengl/egl/EGLDynamicLibraryBundleInfo.java @@ -105,22 +105,20 @@ public abstract class EGLDynamicLibraryBundleInfo extends GLDynamicLibraryBundle */ final boolean bcm_vc_iv_quirk = BcmVCArtifacts.guessVCIVUsed(false); - // this is the default EGL lib name, according to the spec if(!bcm_vc_iv_quirk) { + // this is the default EGL lib name, according to the spec eglLibNames.add("libEGL.so.1"); - } - - // try these as well, if spec fails - eglLibNames.add("libEGL.so"); - eglLibNames.add("EGL"); - // for windows distributions using the 'unlike' lib prefix, - // where our tool does not add it. - eglLibNames.add("libEGL"); + // try these as well, if spec fails + eglLibNames.add("libEGL.so"); + eglLibNames.add("EGL"); - if(bcm_vc_iv_quirk) { + // for windows distributions using the 'unlike' lib prefix, + // where our tool does not add it. + eglLibNames.add("libEGL"); + } else { eglLibNames.add("libbrcmEGL.so"); - } + } return eglLibNames; } diff --git a/src/jogl/classes/jogamp/opengl/egl/EGLES2DynamicLibraryBundleInfo.java b/src/jogl/classes/jogamp/opengl/egl/EGLES2DynamicLibraryBundleInfo.java index 45424c7e8..401b3b6e9 100644 --- a/src/jogl/classes/jogamp/opengl/egl/EGLES2DynamicLibraryBundleInfo.java +++ b/src/jogl/classes/jogamp/opengl/egl/EGLES2DynamicLibraryBundleInfo.java @@ -57,43 +57,41 @@ public final class EGLES2DynamicLibraryBundleInfo extends EGLDynamicLibraryBundl */ final boolean bcm_vc_iv_quirk = BcmVCArtifacts.guessVCIVUsed(false); - // ES3: This is the default lib name, according to the spec - libsGL.add("libGLESv3.so.3"); + if (bcm_vc_iv_quirk) { + libsGL.add("libbrcmGLESv2.so"); + } else { + // ES3: This is the default lib name, according to the spec + libsGL.add("libGLESv3.so.3"); - // ES3: Try these as well, if spec fails - libsGL.add("libGLESv3.so"); - libsGL.add("GLESv3"); + // ES3: Try these as well, if spec fails + libsGL.add("libGLESv3.so"); + libsGL.add("GLESv3"); - // ES3: Alternative names - libsGL.add("GLES30"); + // ES3: Alternative names + libsGL.add("GLES30"); - // ES3: For windows distributions using the 'unlike' lib prefix - // where our tool does not add it. - libsGL.add("libGLESv3"); - libsGL.add("libGLES30"); + // ES3: For windows distributions using the 'unlike' lib prefix + // where our tool does not add it. + libsGL.add("libGLESv3"); + libsGL.add("libGLES30"); - // ES2: This is the default lib name, according to the spec - if (!bcm_vc_iv_quirk) { + // ES2: This is the default lib name, according to the spec libsGL.add("libGLESv2.so.2"); - } - - // ES2: Try these as well, if spec fails - libsGL.add("libGLESv2.so"); - libsGL.add("GLESv2"); - if (bcm_vc_iv_quirk) { - libsGL.add("libbrcmGLESv2.so"); - } + // ES2: Try these as well, if spec fails + libsGL.add("libGLESv2.so"); + libsGL.add("GLESv2"); - // ES2: Alternative names - libsGL.add("GLES20"); - libsGL.add("GLESv2_CM"); + // ES2: Alternative names + libsGL.add("GLES20"); + libsGL.add("GLESv2_CM"); - // ES2: For windows distributions using the 'unlike' lib prefix - // where our tool does not add it. - libsGL.add("libGLESv2"); - libsGL.add("libGLESv2_CM"); - libsGL.add("libGLES20"); + // ES2: For windows distributions using the 'unlike' lib prefix + // where our tool does not add it. + libsGL.add("libGLESv2"); + libsGL.add("libGLESv2_CM"); + libsGL.add("libGLES20"); + } libsList.add(libsGL); } diff --git a/src/nativewindow/classes/com/jogamp/nativewindow/NativeWindowFactory.java b/src/nativewindow/classes/com/jogamp/nativewindow/NativeWindowFactory.java index d4249d404..bedf15c7b 100644 --- a/src/nativewindow/classes/com/jogamp/nativewindow/NativeWindowFactory.java +++ b/src/nativewindow/classes/com/jogamp/nativewindow/NativeWindowFactory.java @@ -174,7 +174,20 @@ public abstract class NativeWindowFactory { guessGBM(true); BcmVCArtifacts.guessVCIVUsed(true); } - + if( BcmVCArtifacts.guessVCIVUsed(false) ) { + /* Broadcom VC IV can be used from + * both console and from inside X11 + * + * When used from inside X11 + * rendering is done on an DispmanX overlay surface + * while keeping an X11 nativewindow under as input. + * + * When Broadcom VC IV is guessed + * only the Broadcom DispmanX EGL driver is loaded. + * Therefore standard TYPE_X11 EGL can not be used. + */ + return TYPE_BCM_VC_IV; + } if( guessX(false) ) { return TYPE_X11; } @@ -185,9 +198,6 @@ public abstract class NativeWindowFactory { if( guessGBM(false) ) { return TYPE_DRM_GBM; } - if( BcmVCArtifacts.guessVCIVUsed(false) ) { - return TYPE_BCM_VC_IV; - } return TYPE_X11; } } -- cgit v1.2.3