Forums - Error Could not Load from Adreno device driver: eglGetError

4 posts / 0 new
Last post
Error Could not Load from Adreno device driver: eglGetError
Alessandro
Profile picture
Join Date: 6 May 11
Posts: 17
Posted: Tue, 2015-08-04 05:34

Hi,

I'm porting this again, as the first post disappeared .

I'm having the following alert: Could not Load from Adreno device driver: eglGetError

just before a crash. It happens when I call eglChooseConfig with configs = null.

If I set some configs it pass through but crash on eglMakeCurrent()

Same code runs great with ANGLE, PowerVR and Mali emulators.

My dump is the following:

 

#
# A fatal error has been detected by the Java Runtime Environment:
#
#  EXCEPTION_ACCESS_VIOLATION (0xc0000005) at pc=0x0000000000000000, pid=7588, tid=4712
#
# JRE version: Java(TM) SE Runtime Environment (7.0_51-b13) (build 1.7.0_51-b13)
# Java VM: Java HotSpot(TM) 64-Bit Server VM (24.51-b03 mixed mode windows-amd64 compressed oops)
# Problematic frame:
# C  0x0000000000000000
#
# Failed to write core dump. Minidumps are not enabled by default on client versions of Windows
#
# If you would like to submit a bug report, please visit:
#   http://bugreport.sun.com/bugreport/crash.jsp
# The crash happened outside the Java Virtual Machine in native code.
# See problematic frame for where to report the bug.
#

---------------  T H R E A D  ---------------

Current thread (0x000000001151b800):  JavaThread "GLThread 15" [_thread_in_native, id=4712, stack(0x0000000013e20000,0x0000000013f20000)]

siginfo: ExceptionCode=0xc0000005, ExceptionInformation=0x0000000000000008 0x0000000000000000

Registers:
RAX=0x0000ce7731f58fb5, RBX=0x000000018004d020, RCX=0x000000018005f2f8, RDX=0xfffffffffdf0cb30
RSP=0x0000000013f1ebd8, RBP=0x000000018004eb20, RSI=0x000000018005f2f8, RDI=0x0000000000000001
R8 =0x0000000000000000, R9 =0x00000000020f34d0, R10=0x0000000000000200, R11=0x00000000020f34d0
R12=0x0000000011aa77a0, R13=0x0000000000000000, R14=0x0000000013f1ef78, R15=0x000000001151b800
RIP=0x0000000000000000, EFLAGS=0x0000000000010202

Top of Stack: (sp=0x0000000013f1ebd8)
0x0000000013f1ebd8:   000000018000b411 0000000000000000
0x0000000013f1ebe8:   0000000011aa77a0 0000000000000020
0x0000000013f1ebf8:   00000000114c7e10 0000000000000000
0x0000000013f1ec08:   00000000661b8d17 000000001151b800
0x0000000013f1ec18:   0000000013f1ef78 0000000000000000
0x0000000013f1ec28:   0000000011aa77a0 0000000000000008
0x0000000013f1ec38:   0000000011aa77a0 0000000000000001
0x0000000013f1ec48:   00000000661b8d17 0000000000000002
0x0000000013f1ec58:   0000000000000008 0000000000000000
0x0000000013f1ec68:   0000000011aa77a0 0000000000000001
0x0000000013f1ec78:   00000000661b8ddb 0000000000000008
0x0000000013f1ec88:   0000000011aa77a0 0000000000000002
0x0000000013f1ec98:   0000000000000030 000000001151b800
0x0000000013f1eca8:   0000000013f1ef78 0000000000000000
0x0000000013f1ecb8:   00000000661b8ddb 000000018005eef0
0x0000000013f1ecc8:   0000000180001b17 000000001150f4c0

Instructions: (pc=0x0000000000000000)
0xffffffffffffffe0:   


Register to memory mapping:

RAX=0x0000ce7731f58fb5 is an unknown value
RBX=0x000000018004d020 is an unknown value
RCX=0x000000018005f2f8 is an unknown value
RDX=0xfffffffffdf0cb30 is an unknown value
RSP=0x0000000013f1ebd8 is pointing into the stack for thread: 0x000000001151b800
RBP=0x000000018004eb20 is an unknown value
RSI=0x000000018005f2f8 is an unknown value
RDI=0x0000000000000001 is an unknown value
R8 =0x0000000000000000 is an unknown value
R9 =0x00000000020f34d0 is an unknown value
R10=0x0000000000000200 is an unknown value
R11=0x00000000020f34d0 is an unknown value
R12=0x0000000011aa77a0 is an unknown value
R13=0x0000000000000000 is an unknown value
R14=0x0000000013f1ef78 is pointing into the stack for thread: 0x000000001151b800
R15=0x000000001151b800 is a thread


Stack: [0x0000000013e20000,0x0000000013f20000],  sp=0x0000000013f1ebd8,  free space=1018k
Java frames: (J=compiled Java code, j=interpreted, Vv=VM code)
j  gles.internal.EGL14Pipeline.eglMakeCurrent0(JJJJ)Z+0
j  gles.internal.EGL14Pipeline.eglMakeCurrent(Landroid/opengl/EGLDisplay;Landroid/opengl/EGLSurface;Landroid/opengl/EGLSurface;Landroid/opengl/EGLContext;)Z+33
j  android.opengl.EGL14.eglMakeCurrent(Landroid/opengl/EGLDisplay;Landroid/opengl/EGLSurface;Landroid/opengl/EGLSurface;Landroid/opengl/EGLContext;)Z+7
j  gles.internal.EGL10Impl.eglMakeCurrent(Ljavax/microedition/khronos/egl/EGLDisplay;Ljavax/microedition/khronos/egl/EGLSurface;Ljavax/microedition/khronos/egl/EGLSurface;Ljavax/microedition/khronos/egl/EGLContext;)Z+17
j  android.opengl.GLSurfaceView$EglHelper.createSurface()Z+198
j  android.opengl.GLSurfaceView$GLThread.guardedRun()V+981
j  android.opengl.GLSurfaceView$GLThread.run()V+49
v  ~StubRoutines::call_stub

---------------  P R O C E S S  ---------------

Java Threads: ( => current thread )
=>0x000000001151b800 JavaThread "GLThread 15" [_thread_in_native, id=4712, stack(0x0000000013e20000,0x0000000013f20000)]
  0x00000000020e8000 JavaThread "DestroyJavaVM" [_thread_blocked, id=3360, stack(0x00000000021d0000,0x00000000022d0000)]
  0x000000001136b800 JavaThread "AWT-EventQueue-0" [_thread_blocked, id=8136, stack(0x0000000011f50000,0x0000000012050000)]
  0x000000001136a800 JavaThread "AWT-Windows" daemon [_thread_in_native, id=4112, stack(0x0000000011b80000,0x0000000011c80000)]
  0x0000000011369800 JavaThread "AWT-Shutdown" [_thread_blocked, id=8112, stack(0x0000000011970000,0x0000000011a70000)]
  0x0000000011369000 JavaThread "Java2D Disposer" daemon [_thread_blocked, id=5200, stack(0x0000000011780000,0x0000000011880000)]
  0x000000000f493000 JavaThread "Service Thread" daemon [_thread_blocked, id=5708, stack(0x0000000010fd0000,0x00000000110d0000)]
  0x000000000f489000 JavaThread "C2 CompilerThread1" daemon [_thread_blocked, id=5432, stack(0x0000000010dd0000,0x0000000010ed0000)]
  0x000000000f484800 JavaThread "C2 CompilerThread0" daemon [_thread_blocked, id=2816, stack(0x0000000010c50000,0x0000000010d50000)]
  0x000000000f482800 JavaThread "Attach Listener" daemon [_thread_blocked, id=7516, stack(0x00000000109f0000,0x0000000010af0000)]
  0x000000000f47b000 JavaThread "Signal Dispatcher" daemon [_thread_blocked, id=8060, stack(0x0000000010890000,0x0000000010990000)]
  0x000000000f429000 JavaThread "Finalizer" daemon [_thread_blocked, id=4716, stack(0x00000000105e0000,0x00000000106e0000)]
  0x000000000f420000 JavaThread "Reference Handler" daemon [_thread_blocked, id=6196, stack(0x0000000010700000,0x0000000010800000)]

Other Threads:
  0x000000000f418800 VMThread [stack: 0x0000000010430000,0x0000000010530000] [id=7396]
  0x000000000f49c800 WatcherThread [stack: 0x0000000011170000,0x0000000011270000] [id=2848]

VM state:not at safepoint (normal execution)

  • Up0
  • Down0
mhfeldma Moderator
Join Date: 29 Nov 12
Posts: 310
Posted: Tue, 2015-08-04 09:19

Hi..Could you let us know which device and build this EGL crash is occuring on? Can you share details of your EGL calls?  Also do you have a apk available that duplicates the problem?

thanks..

  • Up0
  • Down0
Alessandro
Profile picture
Join Date: 6 May 11
Posts: 17
Posted: Tue, 2015-08-04 12:58

Hi !

Thanks for replay

I'm using Adreno SDK Windows to run ported android.opengl API on PC environment. The crash happens at GLSurfaceView.EglHelper.start()

I'll provide a runnable application for testing. Project is hosted at GitHub https://github.com/AlessandroBorges/madri-gles/wiki

As stated before, same code runs fine with Google's Angle, PowerVR and Mali SDK. I'm using the 64bits version.

Adreno  demos x86 runs fine. 

Where the alert raises:

 /**
         * Initialize EGL for a given configuration spec.
         * @param configSpec
         */
        public void start() {
            if (LOG_EGL) {
                Log.w("EglHelper", "start() tid=" + Thread.currentThread().getId());
            }
            /*
             * Get an EGL instance
             */
            mEgl = (EGL10) EGLContext.getEGL();

            /*
             * Get to the default display.
             */
            mEglDisplay = mEgl.eglGetDisplay(EGL10.EGL_DEFAULT_DISPLAY); <- RAISE ALERT "Could not load from Adreno device driver: eglGetError
            if (mEglDisplay == EGL10.EGL_NO_DISPLAY) {
                throw new RuntimeException("eglGetDisplay failed");
            }

            /*
             * We can now initialize EGL for that display
             */
            int[] version = new int[2];
            if(!mEgl.eglInitialize(mEglDisplay, version)) {
                throw new RuntimeException("eglInitialize failed");
            }
            GLSurfaceView view = mGLSurfaceViewWeakRef.get();
            if (view == null) {
                mEglConfig = null;
                mEglContext = null;
            } else {
                mEglConfig = view.mEGLConfigChooser.chooseConfig(mEgl, mEglDisplay); <- CRASH HERE - SEE chooseConfig( ) code BELOW

                /*
                * Create an EGL context. We want to do this as rarely as we can, because an
                * EGL context is a somewhat heavy object.
                */
                mEglContext = view.mEGLContextFactory.createContext(mEgl, mEglDisplay, mEglConfig); <- FAIL HERE, IF OVERRIDE ABOVE CRASH
            }
            if (mEglContext == null || mEglContext == EGL10.EGL_NO_CONTEXT) {
                mEglContext = null;
                throwEglException("createContext");
            }
            if (LOG_EGL) {
                Log.w("EglHelper", "createContext " + mEglContext + " tid=" + Thread.currentThread().getId());
            }

            mEglSurface = null;
        }

 

Method chooseConfig( )

        public EGLConfig chooseConfig(EGL10 egl, EGLDisplay display) {
            int[] num_config = new int[1];
            if (!egl.eglChooseConfig(display, mConfigSpec, null, 0,  num_config)) {  <- Crash here with config as null. If provided new EGLConfig[2] it runs.
                throw new IllegalArgumentException("eglChooseConfig failed");
            }

            int numConfigs = num_config[0];

            if (numConfigs <= 0) {
                throw new IllegalArgumentException(
                        "No configs match configSpec");
            }

            EGLConfig[] configs = new EGLConfig[numConfigs];
            if (!egl.eglChooseConfig(display, mConfigSpec, configs, numConfigs,
                    num_config)) {
                throw new IllegalArgumentException("eglChooseConfig#2 failed");
            }
            EGLConfig config = chooseConfig(egl, display, configs);
            if (config == null) {
                throw new IllegalArgumentException("No config chosen");
            }
            return config;
        }

My PC specs:

Win7 64, I5 3470, 16GB ram, NVidia GTX 650 TI.B., dual screen 

  • Up0
  • Down0
Alessandro
Profile picture
Join Date: 6 May 11
Posts: 17
Posted: Sun, 2015-08-09 12:25

Hi

Some updates:

I was able to fix some call orders, which avoid crashes but app is unable to create a valid EGLContext.

One issue I note is the first call to eglGetDisplay() return  a non null EGlDisplay, but raises the "Could not load from Adreno device driver: eglGetError" alert. A second call to eglGetDisplay()  always returns EGL_NO_DISPLAY, does not matter if I use EGL_DEFAULT_DISPLAY or a valid native EGLNativeDisplayType , aka, HDC.

Basically, my code do the following :

  1.  call eglGetDisplay;
  2.  call eglBind(EGL_OPENGL_ES_API);
  3.  call eglInitialize()
  4.  call eglConfigChooser()
  5.  call egleglCreateContext()

 

The code after cleaned looks like this:

long native_display = canvas.getHDC();
/*EGLDisplay*/
mEglDisplay = mEgl.eglGetDisplay(native_display); // also works with EGL_DEFAULT_DISPLAY <- Raise alert "Could not load from Adreno device driver: eglGetError"

if (mEglDisplay == EGL10.EGL_NO_DISPLAY) {
     throw new RuntimeException("eglGetDisplay failed");
 }
 
boolean ok = EGL14.eglBindAPI(EGL14.EGL_OPENGL_ES_API); // no error here
if(!ok){
   Log.e(TAG, " Failed at eglBindAPI(EGL_OPENGL_ES_API) ! "); 
}

 int[] version = new int[2];
 if(!mEgl.eglInitialize(mEglDisplay, version)) {    // no error here - see below 
          throw new RuntimeException("eglInitialize failed");
 }
 
 /*EGLConfig*/ 
 mEglConfig = view.mEGLConfigChooser.chooseConfig(mEgl, mEglDisplay); // returns a valid RGBA8888 GL-ES 2 config 
 
 /* EGLContext */
 mEglContext = createContext(mEgl, mEglDisplay, mEglConfig); // <- FAILS ! Returns EGL_NO_CONTEXT
 
 if (mEglContext == null || mEglContext == EGL10.EGL_NO_CONTEXT) {
      mEglContext = null;
      throwEglException("createContext");  // gives EGL error EGL_BAD_ATTRIBUTE
 }  

///////////////////////////////////////

public EGLContext createContext(EGL10 egl, EGLDisplay display, EGLConfig config) {
            int[] attrib_list = {EGL_CONTEXT_CLIENT_VERSION, 2, EGL10.EGL_NONE };
            return egl.eglCreateContext( display, config, EGL10.EGL_NO_CONTEXT,  attrib_list);
 }

 

If I  print all available EGLConfigs, I have the following :

 

EGLConfigInfo id: 2
 Color buffer: 32 bits
 Color: RGBA8888 Depth:16  Stencil:0
 Surface type: Window,
 Sample Buffers: 0 Samples:0
 Renderable type: GLES2, GLES3

EGLConfigInfo id: 0
 Color buffer: 0 bits
 Color:  Depth:0  Stencil:0
 Surface type:
 Sample Buffers: 0 Samples:0
 Renderable type:

The choosed EGLConfig is the following:

EGLConfigInfo id: 2
 Color buffer: 32 bits
 Color: RGBA8888 Depth:16  Stencil:0
 Surface type: Window,
 Sample Buffers: 0 Samples:0
 Renderable type: GLES2, GLES3

 

 But even with above EGLConfig and a valid EGLDisplay, I got  a EGL_NO_CONTEXT and a EGL_BAD_ATTRIBUTE.

 

 

  • Up0
  • Down0
or Register

Opinions expressed in the content posted here are the personal opinions of the original authors, and do not necessarily reflect those of Qualcomm Incorporated or its subsidiaries (“Qualcomm”). The content is provided for informational purposes only and is not meant to be an endorsement or representation by Qualcomm or any other party. This site may also provide links or references to non-Qualcomm sites and resources. Qualcomm makes no representations, warranties, or other commitments whatsoever about any non-Qualcomm sites or third-party resources that may be referenced, accessible from, or linked to this site.