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

Commit 749c63db authored by Jack Palevich's avatar Jack Palevich Committed by The Android Open Source Project
Browse files

Automated import from //branches/master/...@142578,142578

parent 7c143aab
Loading
Loading
Loading
Loading
+18 −6
Original line number Diff line number Diff line
@@ -1056,7 +1056,11 @@ EGLBoolean eglChooseConfig( EGLDisplay dpy, const EGLint *attrib_list,
    if (egl_display_t::is_valid(dpy) == EGL_FALSE)
        return setError(EGL_BAD_DISPLAY, EGL_FALSE);
    
    if (ggl_unlikely(configs==0 || attrib_list==0)) {
    if (ggl_unlikely(num_config==0)) {
        return setError(EGL_BAD_PARAMETER, EGL_FALSE);
    }

    if (ggl_unlikely(attrib_list==0)) {
        *num_config = 0;
        return EGL_TRUE;
    }
@@ -1102,6 +1106,7 @@ EGLBoolean eglChooseConfig( EGLDisplay dpy, const EGLint *attrib_list,
    // return the configurations found
    int n=0;
    if (possibleMatch) {
        if (configs) {
            for (int i=0 ; config_size && i<numConfigs ; i++) {
                if (possibleMatch & (1<<i)) {
                    *configs++ = (EGLConfig)i;
@@ -1109,6 +1114,13 @@ EGLBoolean eglChooseConfig( EGLDisplay dpy, const EGLint *attrib_list,
                    n++;
                }
            }
        } else {
            for (int i=0 ; i<numConfigs ; i++) {
                if (possibleMatch & (1<<i)) {
                    n++;
                }
            }
        }
    }
    *num_config = n;
     return EGL_TRUE;
+20 −15
Original line number Diff line number Diff line
@@ -725,9 +725,8 @@ EGLBoolean eglChooseConfig( EGLDisplay dpy, const EGLint *attrib_list,
    egl_display_t const * const dp = get_display(dpy);
    if (!dp) return setError(EGL_BAD_DISPLAY, EGL_FALSE);

    if (configs == 0) {
        *num_config = 0;
        return EGL_TRUE;
    if (num_config==0) {
        return setError(EGL_BAD_PARAMETER, EGL_FALSE);
    }

    EGLint n;
@@ -784,7 +783,9 @@ EGLBoolean eglChooseConfig( EGLDisplay dpy, const EGLint *attrib_list,
            if (res && n>0) {
                // n has to be 0 or 1, by construction, and we already know
                // which config it will return (since there can be only one).
                if (configs) {
                    configs[0] = MAKE_CONFIG(i, index);
                }
                *num_config = 1;
            }
        }
@@ -798,19 +799,23 @@ EGLBoolean eglChooseConfig( EGLDisplay dpy, const EGLint *attrib_list,
        if (cnx->dso) {
            if (cnx->hooks->egl.eglChooseConfig(
                    dp->dpys[i], attrib_list, configs, config_size, &n)) {
                if (configs) {
                    // now we need to convert these client EGLConfig to our
                    // internal EGLConfig format. This is done in O(n log n).
                    for (int j=0 ; j<n ; j++) {
                        int index = binarySearch<EGLConfig>(
                                dp->configs[i], 0, dp->numConfigs[i]-1, configs[j]);
                        if (index >= 0) {
                            if (configs) {
                                configs[j] = MAKE_CONFIG(i, index);
                            }
                        } else {
                            return setError(EGL_BAD_CONFIG, EGL_FALSE);
                        }
                    }
                    configs += n;
                    config_size -= n;
                }
                *num_config += n;
                res = EGL_TRUE;
            }