Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 29f40ea8 authored by Steve Kondik's avatar Steve Kondik
Browse files

libui: Use old method of selecting EGL config if needed

Change-Id: I4765579cd109510eebaad44efda08749c4c50e02
parent f5be439e
Loading
Loading
Loading
Loading
+4 −0
Original line number Diff line number Diff line
@@ -44,6 +44,10 @@ else ifeq ($(TARGET_BOOTLOADER_BOARD_NAME),vision)
	LOCAL_CFLAGS += -DVISION_KEYPAD
endif

ifeq ($(BOARD_NO_RGBX_8888),true)
	LOCAL_CFLAGS += -DNO_RGBX_8888
endif

include $(BUILD_SHARED_LIBRARY)


+28 −2
Original line number Diff line number Diff line
@@ -63,6 +63,14 @@ status_t EGLUtils::selectConfigForPixelFormat(
    if (!attrs)
        return BAD_VALUE;

#ifdef NO_RGBX_8888
    int err;
    PixelFormatInfo fbFormatInfo;
    if ((err = getPixelFormatInfo(PixelFormat(format), &fbFormatInfo)) < 0) {
        return err;
    }
#endif

    if (outConfig == NULL)
        return BAD_VALUE;

@@ -76,13 +84,31 @@ status_t EGLUtils::selectConfigForPixelFormat(
        return BAD_VALUE;
    }

#ifdef NO_RGBX_8888
    const int fbSzA = fbFormatInfo.getSize(PixelFormatInfo::INDEX_ALPHA);
    const int fbSzR = fbFormatInfo.getSize(PixelFormatInfo::INDEX_RED);
    const int fbSzG = fbFormatInfo.getSize(PixelFormatInfo::INDEX_GREEN);
    const int fbSzB = fbFormatInfo.getSize(PixelFormatInfo::INDEX_BLUE);
#endif

    int i;
    EGLConfig config = NULL;
    for (i=0 ; i<n ; i++) {
#ifdef NO_RGBX_8888
        EGLint r,g,b,a;
        EGLConfig curr = configs[i];
        eglGetConfigAttrib(dpy, curr, EGL_RED_SIZE,   &r);
        eglGetConfigAttrib(dpy, curr, EGL_GREEN_SIZE, &g);
        eglGetConfigAttrib(dpy, curr, EGL_BLUE_SIZE,  &b);
        eglGetConfigAttrib(dpy, curr, EGL_ALPHA_SIZE, &a);
        if (fbSzA == a && fbSzR == r && fbSzG == g && fbSzB  == b) {
            config = curr;
#else
        EGLint nativeVisualId = 0;
        eglGetConfigAttrib(dpy, configs[i], EGL_NATIVE_VISUAL_ID, &nativeVisualId);
        if (nativeVisualId>0 && format == nativeVisualId) {
            config = configs[i];
#endif
            break;
        }
    }