android/source/src/java/org/mozilla/gecko/gfx/GLController.java |    3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

New commits:
commit b2d1bb588852c8d1f410f45b07774335d6b4f6ba
Author:     Michael Weghorn <m.wegh...@posteo.de>
AuthorDate: Thu Nov 9 08:54:08 2023 +0100
Commit:     Christian Lohmaier <lohmaier+libreoff...@googlemail.com>
CommitDate: Thu Nov 16 23:30:08 2023 +0100

    tdf#158125 android: Don't insist on RGB 565 EGL config
    
    As the `eglChooseConfig` doc [1] says:
    
    > eglChooseConfig returns in configs a list of all EGL frame buffer
    > configurations that match the attributes specified
    > [...]
    > Attributes are matched in an attribute-specific manner. Some of the
    > attributes, such as EGL_LEVEL, must match the specified value exactly.
    > Others, such as, EGL_RED_SIZE must meet or exceed the specified minimum
    > values.
    
    The config/attribute list used for Android Viewer specifies
    EGL_RED_SIZE=5, EGL_GREEN_SIZE=6, and EGL_BLUE_SIZE=5 and so
    far, only configs using exactly those bit sizes were accepted,
    causing 1 of the 11 devices used in automated tests in Google Play CI
    crashing with this stack trace:
    
        Exception org.mozilla.gecko.gfx.GLController$GLControllerException: No 
suitable EGL configuration found
          at org.mozilla.gecko.gfx.GLController.chooseConfig 
(GLController.java:219)
          at org.mozilla.gecko.gfx.GLController.initEGL (GLController.java:172)
          at org.mozilla.gecko.gfx.GLController.initEGLContext 
(GLController.java:176)
          at org.mozilla.gecko.gfx.GLController.initGLContext 
(GLController.java:57)
          at org.mozilla.gecko.gfx.RenderControllerThread.doSurfaceCreated 
(RenderControllerThread.java:132)
          at org.mozilla.gecko.gfx.RenderControllerThread.execute 
(RenderControllerThread.java:52)
          at org.mozilla.gecko.gfx.RenderControllerThread.run 
(RenderControllerThread.java:30)
    
    Since only configs fulfilling the minimium specification
    have been returned, I don't see a reason to insist on
    having one that uses exactly the specified amount of bits
    for the individual color components.
    
    I also didn't see any rendering issues in a quick test (also using
    the colorful Calc sheet attachment 188343 from tdf#156182) forcing the
    use of a configuration using EGL_RED_SIZE=8, EGL_GREEN_SIZE=8, and
    EGL_BLUE_SIZE=8 with an x86_64 AVD and on a Fairphone 3+ (arm64)
    using this temporary local change:
    
        diff --git 
a/android/source/src/java/org/mozilla/gecko/gfx/GLController.java 
b/android/source/src/java/org/mozilla/gecko/gfx/GLController.java
        index 45600e9f1e7c..9e7f348e9e72 100644
        --- a/android/source/src/java/org/mozilla/gecko/gfx/GLController.java
        +++ b/android/source/src/java/org/mozilla/gecko/gfx/GLController.java
        @@ -171,7 +171,7 @@ public class GLController {
                     mEGL.eglGetConfigAttrib(mEGLDisplay, config, 
EGL10.EGL_RED_SIZE, red);
                     mEGL.eglGetConfigAttrib(mEGLDisplay, config, 
EGL10.EGL_GREEN_SIZE, green);
                     mEGL.eglGetConfigAttrib(mEGLDisplay, config, 
EGL10.EGL_BLUE_SIZE, blue);
        -            if (red[0] == 5 && green[0] == 6 && blue[0] == 5) {
        +            if (red[0] == 8 && green[0] == 8 && blue[0] == 8) {
                         return config;
                     }
                 }
    
    Therefore, fall back to using another config that fulfils the
    specification.
    (Leave the previously required config as preferred one for now,
    maybe it still has advantages, e.g. might be more efficient due
    to not wasting extra bits for the color components that are
    not needed for the rendering in LibreOffice Viewer. (?))
    
    [1] https://registry.khronos.org/EGL/sdk/docs/man/html/eglChooseConfig.xhtml
    
    Change-Id: I953d292248004bc6f7e9384ceef78c8a88c21e9e
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/159204
    Tested-by: Jenkins
    Reviewed-by: Michael Weghorn <m.wegh...@posteo.de>
    (cherry picked from commit d9a43fa5f94839d79cbd8524ba5c0b1865e6ad52)
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/159042
    Reviewed-by: Michael Stahl <michael.st...@allotropia.de>
    Reviewed-by: Xisco Fauli <xiscofa...@libreoffice.org>
    Tested-by: Christian Lohmaier <lohmaier+libreoff...@googlemail.com>
    Reviewed-by: Christian Lohmaier <lohmaier+libreoff...@googlemail.com>

diff --git a/android/source/src/java/org/mozilla/gecko/gfx/GLController.java 
b/android/source/src/java/org/mozilla/gecko/gfx/GLController.java
index e296f4760f68..3dcfbbdfdbff 100644
--- a/android/source/src/java/org/mozilla/gecko/gfx/GLController.java
+++ b/android/source/src/java/org/mozilla/gecko/gfx/GLController.java
@@ -216,7 +216,8 @@ public class GLController {
             }
         }
 
-        throw new GLControllerException("No suitable EGL configuration found");
+        // if there's no 565 RGB configuration, select another one that 
fulfils the specification
+        return configs[0];
     }
 
     private void createEGLSurface() {

Reply via email to