wasabeef/android-gpuimage · critical · RuntimeException

eglGetDisplay failed

Error message

eglGetDisplay failed

What it means

EglHelper.start() called eglGetDisplay(EGL_DEFAULT_DISPLAY) and got back EGL_NO_DISPLAY, so no EGL display connection could be established. This is thrown as RuntimeException because rendering cannot proceed at all without a display handle.

Solutions

  1. Enable hardware GPU acceleration on the emulator or run on a physical device
  2. Restart the app/process if a previous EGL failure poisoned the display state
  3. Log egl.eglGetError() right after eglGetDisplay for the concrete code
  4. Confirm android:hardwareAccelerated and a real GPU render path are available
Defensive patterns

Strategy: try-catch

Validate before calling

EGLDisplay d = egl.eglGetDisplay(EGL10.EGL_DEFAULT_DISPLAY);
if (d == EGL10.EGL_NO_DISPLAY) { Log.e(TAG, "no EGL display, err=" + egl.eglGetError()); }

Try / catch

// catch (RuntimeException e) { show 'GPU unsupported' UI; disable GPU-accelerated path }

Prevention

When it happens

Trigger: egl.eglGetDisplay(EGL10.EGL_DEFAULT_DISPLAY) returns EGL_NO_DISPLAY — typically on devices/emulators with no functioning EGL implementation, or EGL already torn down in the process.

Common situations: Emulators without GPU support and with broken software EGL, headless/odd devices, driver crashes after prior EGL failures in the same process.

Related errors


AI-assisted analysis of wasabeef/android-gpuimage@ceea576ec9 (2026-09-11). Data as JSON: /api/errors/08bbe25ba7a72fa0. Report an issue: GitHub.

Appendix: source

Thrown at library/src/main/java/jp/co/cyberagent/android/gpuimage/GLTextureView.java:913

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

            /*
             * Get to the default display.
             */
            eglDisplay = egl.eglGetDisplay(EGL10.EGL_DEFAULT_DISPLAY);

            if (eglDisplay == EGL10.EGL_NO_DISPLAY) {
                throw new RuntimeException("eglGetDisplay failed");
            }

            /*
             * We can now initialize EGL for that display
             */
            int[] version = new int[2];
            if (!egl.eglInitialize(eglDisplay, version)) {
                throw new RuntimeException("eglInitialize failed");
            }
            GLTextureView view = glTextureViewWeakRef.get();
            if (view == null) {
                eglConfig = null;
                eglContext = null;
            } else {
                eglConfig = view.eglConfigChooser.chooseConfig(egl, eglDisplay);

                /*
                 * Create an EGL context. We want to do this as rarely as we can, because an

View on GitHub (pinned to ceea576ec9)