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

Commit c42fcf05 authored by Jamie Gennis's avatar Jamie Gennis
Browse files

EGL: add the ANDROID suffix to the blob cache ext

This change adds the ANDROID suffix to the all the types and functions
defined by the EGL_ANDROID_blob_cache extension.

Change-Id: I087875b96d9a7053efb9c8d5614f9f765eed799d
parent 8e540328
Loading
Loading
Loading
Loading
+6 −6
Original line number Original line Diff line number Diff line
@@ -261,14 +261,14 @@ typedef EGLuint64NV (EGLAPIENTRYP PFNEGLGETSYSTEMTIMENVPROC)(void);
 */
 */
#ifndef EGL_ANDROID_blob_cache
#ifndef EGL_ANDROID_blob_cache
#define EGL_ANDROID_blob_cache 1
#define EGL_ANDROID_blob_cache 1
typedef khronos_ssize_t EGLsizei;
typedef khronos_ssize_t EGLsizeiANDROID;
typedef void (*EGLSetBlobFunc) (const void* key, EGLsizei keySize, const void* value, EGLsizei valueSize);
typedef void (*EGLSetBlobFuncANDROID) (const void* key, EGLsizeiANDROID keySize, const void* value, EGLsizeiANDROID valueSize);
typedef EGLsizei (*EGLGetBlobFunc) (const void* key, EGLsizei keySize, void* value, EGLsizei valueSize);
typedef EGLsizeiANDROID (*EGLGetBlobFuncANDROID) (const void* key, EGLsizeiANDROID keySize, void* value, EGLsizeiANDROID valueSize);
#ifdef EGL_EGLEXT_PROTOTYPES
#ifdef EGL_EGLEXT_PROTOTYPES
EGLAPI void EGLAPIENTRY eglSetBlobCacheFuncs(EGLDisplay dpy, EGLSetBlobFunc set, EGLGetBlobFunc get);
EGLAPI void EGLAPIENTRY eglSetBlobCacheFuncsANDROID(EGLDisplay dpy, EGLSetBlobFuncANDROID set, EGLGetBlobFuncANDROID get);
#endif /* EGL_EGLEXT_PROTOTYPES */
#endif /* EGL_EGLEXT_PROTOTYPES */
typedef void (EGLAPIENTRYP PFNEGLSETBLOBCACHEFUNCSPROC) (EGLDisplay dpy,
typedef void (EGLAPIENTRYP PFNEGLSETBLOBCACHEFUNCSANDROIDPROC) (EGLDisplay dpy,
        EGLSetBlobFunc set, EGLGetBlobFunc get);
        EGLSetBlobFuncANDROID set, EGLGetBlobFuncANDROID get);
#endif
#endif


#ifdef __cplusplus
#ifdef __cplusplus
+1 −1
Original line number Original line Diff line number Diff line
@@ -860,7 +860,7 @@ __eglMustCastToProperFunctionPointerType eglGetProcAddress(const char *procname)


    // The EGL_ANDROID_blob_cache extension should not be exposed to
    // The EGL_ANDROID_blob_cache extension should not be exposed to
    // applications.  It is used internally by the Android EGL layer.
    // applications.  It is used internally by the Android EGL layer.
    if (!strcmp(procname, "eglSetBlobCacheFuncs")) {
    if (!strcmp(procname, "eglSetBlobCacheFuncsANDROID")) {
        return NULL;
        return NULL;
    }
    }


+21 −19
Original line number Original line Diff line number Diff line
@@ -46,13 +46,13 @@ namespace android {
//
//
// Callback functions passed to EGL.
// Callback functions passed to EGL.
//
//
static void setBlob(const void* key, EGLsizei keySize, const void* value,
static void setBlob(const void* key, EGLsizeiANDROID keySize,
        EGLsizei valueSize) {
        const void* value, EGLsizeiANDROID valueSize) {
    egl_cache_t::get()->setBlob(key, keySize, value, valueSize);
    egl_cache_t::get()->setBlob(key, keySize, value, valueSize);
}
}


static EGLsizei getBlob(const void* key, EGLsizei keySize, void* value,
static EGLsizeiANDROID getBlob(const void* key, EGLsizeiANDROID keySize,
        EGLsizei valueSize) {
        void* value, EGLsizeiANDROID valueSize) {
    return egl_cache_t::get()->getBlob(key, keySize, value, valueSize);
    return egl_cache_t::get()->getBlob(key, keySize, value, valueSize);
}
}


@@ -87,22 +87,23 @@ void egl_cache_t::initialize(egl_display_t *display) {
                    !strcmp(" " BC_EXT_STR, exts + extsLen - (bcExtLen+1));
                    !strcmp(" " BC_EXT_STR, exts + extsLen - (bcExtLen+1));
            bool inMiddle = strstr(" " BC_EXT_STR " ", exts);
            bool inMiddle = strstr(" " BC_EXT_STR " ", exts);
            if (equal || atStart || atEnd || inMiddle) {
            if (equal || atStart || atEnd || inMiddle) {
                PFNEGLSETBLOBCACHEFUNCSPROC eglSetBlobCacheFuncs;
                PFNEGLSETBLOBCACHEFUNCSANDROIDPROC eglSetBlobCacheFuncsANDROID;
                eglSetBlobCacheFuncs =
                eglSetBlobCacheFuncsANDROID =
                        reinterpret_cast<PFNEGLSETBLOBCACHEFUNCSPROC>(
                        reinterpret_cast<PFNEGLSETBLOBCACHEFUNCSANDROIDPROC>(
                            cnx->egl.eglGetProcAddress("eglSetBlobCacheFuncs"));
                            cnx->egl.eglGetProcAddress(
                if (eglSetBlobCacheFuncs == NULL) {
                                    "eglSetBlobCacheFuncsANDROID"));
                if (eglSetBlobCacheFuncsANDROID == NULL) {
                    LOGE("EGL_ANDROID_blob_cache advertised by display %d, "
                    LOGE("EGL_ANDROID_blob_cache advertised by display %d, "
                            "but unable to get eglSetBlobCacheFuncs", i);
                            "but unable to get eglSetBlobCacheFuncsANDROID", i);
                    continue;
                    continue;
                }
                }


                eglSetBlobCacheFuncs(display->disp[i].dpy, android::setBlob,
                eglSetBlobCacheFuncsANDROID(display->disp[i].dpy,
                        android::getBlob);
                        android::setBlob, android::getBlob);
                EGLint err = cnx->egl.eglGetError();
                EGLint err = cnx->egl.eglGetError();
                if (err != EGL_SUCCESS) {
                if (err != EGL_SUCCESS) {
                    LOGE("eglSetBlobCacheFuncs resulted in an error: %#x",
                    LOGE("eglSetBlobCacheFuncsANDROID resulted in an error: "
                            err);
                            "%#x", err);
                }
                }
            }
            }
        }
        }
@@ -119,8 +120,8 @@ void egl_cache_t::terminate() {
    mInitialized = false;
    mInitialized = false;
}
}


void egl_cache_t::setBlob(const void* key, EGLsizei keySize, const void* value,
void egl_cache_t::setBlob(const void* key, EGLsizeiANDROID keySize,
        EGLsizei valueSize) {
        const void* value, EGLsizeiANDROID valueSize) {
    Mutex::Autolock lock(mMutex);
    Mutex::Autolock lock(mMutex);


    if (keySize < 0 || valueSize < 0) {
    if (keySize < 0 || valueSize < 0) {
@@ -158,8 +159,8 @@ void egl_cache_t::setBlob(const void* key, EGLsizei keySize, const void* value,
    }
    }
}
}


EGLsizei egl_cache_t::getBlob(const void* key, EGLsizei keySize, void* value,
EGLsizeiANDROID egl_cache_t::getBlob(const void* key, EGLsizeiANDROID keySize,
        EGLsizei valueSize) {
        void* value, EGLsizeiANDROID valueSize) {
    Mutex::Autolock lock(mMutex);
    Mutex::Autolock lock(mMutex);


    if (keySize < 0 || valueSize < 0) {
    if (keySize < 0 || valueSize < 0) {
@@ -323,7 +324,8 @@ void egl_cache_t::loadBlobCacheLocked() {
            return;
            return;
        }
        }


        status_t err = mBlobCache->unflatten(buf + headerSize, cacheSize, NULL, 0);
        status_t err = mBlobCache->unflatten(buf + headerSize, cacheSize, NULL,
                0);
        if (err != OK) {
        if (err != OK) {
            LOGE("error reading cache contents: %s (%d)", strerror(-err),
            LOGE("error reading cache contents: %s (%d)", strerror(-err),
                    -err);
                    -err);
+4 −4
Original line number Original line Diff line number Diff line
@@ -52,14 +52,14 @@ public:
    // setBlob attempts to insert a new key/value blob pair into the cache.
    // setBlob attempts to insert a new key/value blob pair into the cache.
    // This will be called by the hardware vendor's EGL implementation via the
    // This will be called by the hardware vendor's EGL implementation via the
    // EGL_ANDROID_blob_cache extension.
    // EGL_ANDROID_blob_cache extension.
    void setBlob(const void* key, EGLsizei keySize, const void* value,
    void setBlob(const void* key, EGLsizeiANDROID keySize, const void* value,
        EGLsizei valueSize);
        EGLsizeiANDROID valueSize);


    // getBlob attempts to retrieve the value blob associated with a given key
    // getBlob attempts to retrieve the value blob associated with a given key
    // blob from cache.  This will be called by the hardware vendor's EGL
    // blob from cache.  This will be called by the hardware vendor's EGL
    // implementation via the EGL_ANDROID_blob_cache extension.
    // implementation via the EGL_ANDROID_blob_cache extension.
    EGLsizei getBlob(const void* key, EGLsizei keySize, void* value,
    EGLsizeiANDROID getBlob(const void* key, EGLsizeiANDROID keySize,
        EGLsizei valueSize);
        void* value, EGLsizeiANDROID valueSize);


    // setCacheFilename sets the name of the file that should be used to store
    // setCacheFilename sets the name of the file that should be used to store
    // cache contents from one program invocation to another.
    // cache contents from one program invocation to another.
+27 −27
Original line number Original line Diff line number Diff line
@@ -63,31 +63,31 @@ Overview
New Types
New Types


    /*
    /*
     * EGLsizei is a signed integer type for representing the size of a memory
     * EGLsizeiANDROID is a signed integer type for representing the size of a
     * buffer.
     * memory buffer.
     */
     */
    #include <khrplatform.h>
    #include <khrplatform.h>
    typedef khronos_ssize_t EGLsizei;
    typedef khronos_ssize_t EGLsizeiANDROID;


    /*
    /*
     * EGLSetBlobFunc is a pointer to an application-provided function that a
     * EGLSetBlobFunc is a pointer to an application-provided function that a
     * client API implementation may use to insert a key/value pair into the
     * client API implementation may use to insert a key/value pair into the
     * cache.
     * cache.
     */
     */
    typedef void (*EGLSetBlobFunc) (const void* key, EGLsizei keySize,
    typedef void (*EGLSetBlobFuncANDROID) (const void* key,
        const void* value, EGLsizei valueSize)
        EGLsizeiANDROID keySize, const void* value, EGLsizeiANDROID valueSize)


    /*
    /*
     * EGLGetBlobFunc is a pointer to an application-provided function that a
     * EGLGetBlobFunc is a pointer to an application-provided function that a
     * client API implementation may use to retrieve a cached value from the
     * client API implementation may use to retrieve a cached value from the
     * cache.
     * cache.
     */
     */
    typedef EGLsizei (*EGLGetBlobFunc) (const void* key, EGLsizei keySize,
    typedef EGLsizeiANDROID (*EGLGetBlobFuncANDROID) (const void* key,
        void* value, EGLsizei valueSize)
        EGLsizeiANDROID keySize, void* value, EGLsizeiANDROID valueSize)


New Procedures and Functions
New Procedures and Functions


    void eglSetBlobCacheFuncs(EGLDisplay dpy,
    void eglSetBlobCacheFuncsANDROID(EGLDisplay dpy,
                                     EGLSetBlobFunc set,
                                     EGLSetBlobFunc set,
                                     EGLGetBlobFunc get);
                                     EGLGetBlobFunc get);


@@ -107,8 +107,8 @@ Changes to Chapter 3 of the EGL 1.4 Specification (EGL Functions and Errors)
    function pointers through which the client APIs can request data be cached
    function pointers through which the client APIs can request data be cached
    and retrieved.  The command
    and retrieved.  The command


        void eglSetBlobCacheFuncs(EGLDisplay dpy,
        void eglSetBlobCacheFuncsANDROID(EGLDisplay dpy,
            EGLSetBlobFunc set, EGLGetBlobFunc get);
            EGLSetBlobFuncANDROID set, EGLGetBlobFuncANDROID get);


    sets the callback function pointers that client APIs associated with
    sets the callback function pointers that client APIs associated with
    display <dpy> can use to interact with caching functionality provided by
    display <dpy> can use to interact with caching functionality provided by
@@ -120,17 +120,17 @@ Changes to Chapter 3 of the EGL 1.4 Specification (EGL Functions and Errors)


    Cache functions may only be specified once during the lifetime of an
    Cache functions may only be specified once during the lifetime of an
    EGLDisplay.  The <set> and <get> functions may be called at any time and
    EGLDisplay.  The <set> and <get> functions may be called at any time and
    from any thread from the time at which eglSetBlobCacheFuncs is called until
    from any thread from the time at which eglSetBlobCacheFuncsANDROID is
    the time that the last resource associated with <dpy> is deleted and <dpy>
    called until the time that the last resource associated with <dpy> is
    itself is terminated.  Concurrent calls to these functions from different
    deleted and <dpy> itself is terminated.  Concurrent calls to these
    threads is also allowed.
    functions from different threads is also allowed.


    If eglSetBlobCacheFuncs generates an error then all client APIs must behave
    If eglSetBlobCacheFuncsANDROID generates an error then all client APIs must
    as though eglSetBlobCacheFuncs was not called for the display <dpy>.  If
    behave as though eglSetBlobCacheFuncsANDROID was not called for the display
    <set> or <get> is NULL then an EGL_BAD_PARAMETER error is generated.  If a
    <dpy>.  If <set> or <get> is NULL then an EGL_BAD_PARAMETER error is
    successful eglSetBlobCacheFuncs call was already made for <dpy> and the
    generated.  If a successful eglSetBlobCacheFuncsANDROID call was already
    display has not since been terminated then an EGL_BAD_PARAMETER error is
    made for <dpy> and the display has not since been terminated then an
    generated.
    EGL_BAD_PARAMETER error is generated.


    3.9.1 Cache Operations
    3.9.1 Cache Operations


@@ -138,8 +138,8 @@ Changes to Chapter 3 of the EGL 1.4 Specification (EGL Functions and Errors)
    key, a client API implementation can call the application-provided callback
    key, a client API implementation can call the application-provided callback
    function
    function


        void (*set) (const void* key, EGLsizei keySize, const void* value,
        void (*set) (const void* key, EGLsizeiANDROID keySize,
            EGLsizei valueSize)
            const void* value, EGLsizeiANDROID valueSize)


    <key> and <value> are pointers to the beginning of the key and value,
    <key> and <value> are pointers to the beginning of the key and value,
    respectively, that are to be inserted.  <keySize> and <valueSize> specify
    respectively, that are to be inserted.  <keySize> and <valueSize> specify
@@ -157,8 +157,8 @@ Changes to Chapter 3 of the EGL 1.4 Specification (EGL Functions and Errors)
    client API implementation can call the application-provided callback
    client API implementation can call the application-provided callback
    function
    function


        EGLsizei (*get) (const void* key, EGLsizei keySize, void* value,
        EGLsizeiANDROID (*get) (const void* key, EGLsizeiANDROID keySize,
            EGLsizei valueSize)
            void* value, EGLsizeiANDROID valueSize)


    <key> is a pointer to the beginning of the key.  <keySize> specifies the
    <key> is a pointer to the beginning of the key.  <keySize> specifies the
    size in bytes of the binary key pointed to by <key>.  If the cache contains
    size in bytes of the binary key pointed to by <key>.  If the cache contains