{"record":{"id":"1739661d2d384950","repo":"google/ExoPlayer","slug":"eglchooseconfig-failed","errorCode":null,"errorMessage":"eglChooseConfig failed.","messagePattern":"eglChooseConfig failed\\.","errorType":"exception","errorClass":"GlException","httpStatus":null,"severity":"error","filePath":"library/common/src/main/java/com/google/android/exoplayer2/util/GlUtil.java","lineNumber":837,"sourceCode":"      }\n      EGL14.eglDestroySurface(eglDisplay, eglSurface);\n      checkEglException(\"Error destroying surface\");\n    }\n\n    @DoNotInline\n    private static EGLConfig getEglConfig(EGLDisplay eglDisplay, int[] attributes)\n        throws GlException {\n      EGLConfig[] eglConfigs = new EGLConfig[1];\n      if (!EGL14.eglChooseConfig(\n          eglDisplay,\n          attributes,\n          /* attrib_listOffset= */ 0,\n          eglConfigs,\n          /* configsOffset= */ 0,\n          /* config_size= */ 1,\n          /* unusedNumConfig */ new int[1],\n          /* num_configOffset= */ 0)) {\n        throw new GlException(\"eglChooseConfig failed.\");\n      }\n      return eglConfigs[0];\n    }\n  }\n}\n","sourceCodeStart":819,"sourceCodeEnd":843,"githubUrl":"https://github.com/google/ExoPlayer/blob/dd430f7053a1a3958deea3ead6a0565150c06bfc/library/common/src/main/java/com/google/android/exoplayer2/util/GlUtil.java#L819-L843","documentation":"Thrown by GlUtil.getEglConfig when EGL14.eglChooseConfig returns false — the EGL implementation itself rejected the attribute list rather than returning zero matching configs (which would surface differently as a null config). The attribute lists in play are GlUtil's presets (EGL_CONFIG_ATTRIBUTES_RGBA_8888, EGL_CONFIG_ATTRIBUTES_RGBA_1010102, or recording-surface variants), so a false return almost always means the device's EGL does not understand one of the attributes, typically the 10-bit/color-space ones on the RGBA_1010102 path.","triggerScenarios":"Running createEglContext/createEglSurface with EGL_CONFIG_ATTRIBUTES_RGBA_1010102 (EGL_COLOR_COMPONENT_TYPE_EXT / 1010102 pixel formats) on devices lacking EXT_color_space / 10-bit EGL config support; using an EGL version-14 API on a display not initialized with eglGetDisplay; or a driver bug where certain attribute combos return false instead of empty.","commonSituations":"HDR (PQ/HLG) effects or 10-bit Transformer export on mid/low-tier devices whose EGL enumerates no 10-bit configs; emulator or VM renderers with partial EGL extensions; OEM EGL bugs on specific Android versions returning false for unsupported attrib lists.","solutions":["Fall back to EGL_CONFIG_ATTRIBUTES_RGBA_8888 (8-bit SDR) when 10-bit config selection fails, and tone-map the content instead","Enumerate configs defensively first: call eglChooseConfig yourself with the desired attributes, and if it fails or yields none, downgrade the attribute list before invoking GlUtil APIs that require a config","Check EGL extension strings (eglQueryString(display, EGL_EXTENSIONS)) for the 10-bit/color-space extensions before choosing the 1010102 path","Report/upgrade: vendor EGL false-return bugs are worked around in newer media3 patches — update the dependency"],"exampleFix":"// before\nEGLContext ctx = GlUtil.createEglContext(null, eglDisplay, 3,\n    GlUtil.EGL_CONFIG_ATTRIBUTES_RGBA_1010102); // eglChooseConfig failed\n// after\nint[] attrs = has10bitEglSupport(eglDisplay)\n    ? GlUtil.EGL_CONFIG_ATTRIBUTES_RGBA_1010102\n    : GlUtil.EGL_CONFIG_ATTRIBUTES_RGBA_8888;\nEGLContext ctx = GlUtil.createEglContext(null, eglDisplay, 3, attrs);","handlingStrategy":"fallback","validationCode":"String exts = EGL14.eglQueryString(eglDisplay, EGL10.EGL_EXTENSIONS);\nboolean has10bit = exts != null && exts.contains(\"EGL_EXT_pixel_format_float\");","typeGuard":null,"tryCatchPattern":"try { ... 1010102 config path ... } catch (GlException e) { /* retry with EGL_CONFIG_ATTRIBUTES_RGBA_8888 and tone-map */ }","preventionTips":["Query EGL extension strings before choosing 10-bit configs","Maintain a per-device capability cache keyed by Build.MODEL to skip known-bad GPUs","Update media3 regularly — device-specific EGL workarounds land frequently"],"tags":["opengl","egl","hdr","device-support","config"],"backgroundTag":null,"analyzedSha":"dd430f7053a1a3958deea3ead6a0565150c06bfc","analyzedAt":"2026-08-14T12:22:02.982Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}