Skip to content

Commit 6b228af

Browse files
Jamie GennisAndroid (Google) Code Review
authored andcommitted
Merge "EGL: add the ANDROID suffix to the blob cache ext" into ics-mr1
2 parents ff95f65 + b792846 commit 6b228af

File tree

5 files changed

+59
-57
lines changed

5 files changed

+59
-57
lines changed

opengl/include/EGL/eglext.h

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -261,14 +261,14 @@ typedef EGLuint64NV (EGLAPIENTRYP PFNEGLGETSYSTEMTIMENVPROC)(void);
261261
*/
262262
#ifndef EGL_ANDROID_blob_cache
263263
#define EGL_ANDROID_blob_cache 1
264-
typedef khronos_ssize_t EGLsizei;
265-
typedef void (*EGLSetBlobFunc) (const void* key, EGLsizei keySize, const void* value, EGLsizei valueSize);
266-
typedef EGLsizei (*EGLGetBlobFunc) (const void* key, EGLsizei keySize, void* value, EGLsizei valueSize);
264+
typedef khronos_ssize_t EGLsizeiANDROID;
265+
typedef void (*EGLSetBlobFuncANDROID) (const void* key, EGLsizeiANDROID keySize, const void* value, EGLsizeiANDROID valueSize);
266+
typedef EGLsizeiANDROID (*EGLGetBlobFuncANDROID) (const void* key, EGLsizeiANDROID keySize, void* value, EGLsizeiANDROID valueSize);
267267
#ifdef EGL_EGLEXT_PROTOTYPES
268-
EGLAPI void EGLAPIENTRY eglSetBlobCacheFuncs(EGLDisplay dpy, EGLSetBlobFunc set, EGLGetBlobFunc get);
268+
EGLAPI void EGLAPIENTRY eglSetBlobCacheFuncsANDROID(EGLDisplay dpy, EGLSetBlobFuncANDROID set, EGLGetBlobFuncANDROID get);
269269
#endif /* EGL_EGLEXT_PROTOTYPES */
270-
typedef void (EGLAPIENTRYP PFNEGLSETBLOBCACHEFUNCSPROC) (EGLDisplay dpy,
271-
EGLSetBlobFunc set, EGLGetBlobFunc get);
270+
typedef void (EGLAPIENTRYP PFNEGLSETBLOBCACHEFUNCSANDROIDPROC) (EGLDisplay dpy,
271+
EGLSetBlobFuncANDROID set, EGLGetBlobFuncANDROID get);
272272
#endif
273273

274274
#ifdef __cplusplus

opengl/libs/EGL/eglApi.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -860,7 +860,7 @@ __eglMustCastToProperFunctionPointerType eglGetProcAddress(const char *procname)
860860

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

opengl/libs/EGL/egl_cache.cpp

Lines changed: 21 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -46,13 +46,13 @@ namespace android {
4646
//
4747
// Callback functions passed to EGL.
4848
//
49-
static void setBlob(const void* key, EGLsizei keySize, const void* value,
50-
EGLsizei valueSize) {
49+
static void setBlob(const void* key, EGLsizeiANDROID keySize,
50+
const void* value, EGLsizeiANDROID valueSize) {
5151
egl_cache_t::get()->setBlob(key, keySize, value, valueSize);
5252
}
5353

54-
static EGLsizei getBlob(const void* key, EGLsizei keySize, void* value,
55-
EGLsizei valueSize) {
54+
static EGLsizeiANDROID getBlob(const void* key, EGLsizeiANDROID keySize,
55+
void* value, EGLsizeiANDROID valueSize) {
5656
return egl_cache_t::get()->getBlob(key, keySize, value, valueSize);
5757
}
5858

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

100-
eglSetBlobCacheFuncs(display->disp[i].dpy, android::setBlob,
101-
android::getBlob);
101+
eglSetBlobCacheFuncsANDROID(display->disp[i].dpy,
102+
android::setBlob, android::getBlob);
102103
EGLint err = cnx->egl.eglGetError();
103104
if (err != EGL_SUCCESS) {
104-
LOGE("eglSetBlobCacheFuncs resulted in an error: %#x",
105-
err);
105+
LOGE("eglSetBlobCacheFuncsANDROID resulted in an error: "
106+
"%#x", err);
106107
}
107108
}
108109
}
@@ -119,8 +120,8 @@ void egl_cache_t::terminate() {
119120
mInitialized = false;
120121
}
121122

122-
void egl_cache_t::setBlob(const void* key, EGLsizei keySize, const void* value,
123-
EGLsizei valueSize) {
123+
void egl_cache_t::setBlob(const void* key, EGLsizeiANDROID keySize,
124+
const void* value, EGLsizeiANDROID valueSize) {
124125
Mutex::Autolock lock(mMutex);
125126

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

161-
EGLsizei egl_cache_t::getBlob(const void* key, EGLsizei keySize, void* value,
162-
EGLsizei valueSize) {
162+
EGLsizeiANDROID egl_cache_t::getBlob(const void* key, EGLsizeiANDROID keySize,
163+
void* value, EGLsizeiANDROID valueSize) {
163164
Mutex::Autolock lock(mMutex);
164165

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

326-
status_t err = mBlobCache->unflatten(buf + headerSize, cacheSize, NULL, 0);
327+
status_t err = mBlobCache->unflatten(buf + headerSize, cacheSize, NULL,
328+
0);
327329
if (err != OK) {
328330
LOGE("error reading cache contents: %s (%d)", strerror(-err),
329331
-err);

opengl/libs/EGL/egl_cache.h

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -52,14 +52,14 @@ class EGLAPI egl_cache_t {
5252
// setBlob attempts to insert a new key/value blob pair into the cache.
5353
// This will be called by the hardware vendor's EGL implementation via the
5454
// EGL_ANDROID_blob_cache extension.
55-
void setBlob(const void* key, EGLsizei keySize, const void* value,
56-
EGLsizei valueSize);
55+
void setBlob(const void* key, EGLsizeiANDROID keySize, const void* value,
56+
EGLsizeiANDROID valueSize);
5757

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

6464
// setCacheFilename sets the name of the file that should be used to store
6565
// cache contents from one program invocation to another.

opengl/specs/EGL_ANDROID_blob_cache.txt

Lines changed: 27 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -63,33 +63,33 @@ Overview
6363
New Types
6464

6565
/*
66-
* EGLsizei is a signed integer type for representing the size of a memory
67-
* buffer.
66+
* EGLsizeiANDROID is a signed integer type for representing the size of a
67+
* memory buffer.
6868
*/
6969
#include <khrplatform.h>
70-
typedef khronos_ssize_t EGLsizei;
70+
typedef khronos_ssize_t EGLsizeiANDROID;
7171

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

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

8888
New Procedures and Functions
8989

90-
void eglSetBlobCacheFuncs(EGLDisplay dpy,
91-
EGLSetBlobFunc set,
92-
EGLGetBlobFunc get);
90+
void eglSetBlobCacheFuncsANDROID(EGLDisplay dpy,
91+
EGLSetBlobFunc set,
92+
EGLGetBlobFunc get);
9393

9494
New Tokens
9595

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

110-
void eglSetBlobCacheFuncs(EGLDisplay dpy,
111-
EGLSetBlobFunc set, EGLGetBlobFunc get);
110+
void eglSetBlobCacheFuncsANDROID(EGLDisplay dpy,
111+
EGLSetBlobFuncANDROID set, EGLGetBlobFuncANDROID get);
112112

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

121121
Cache functions may only be specified once during the lifetime of an
122122
EGLDisplay. The <set> and <get> functions may be called at any time and
123-
from any thread from the time at which eglSetBlobCacheFuncs is called until
124-
the time that the last resource associated with <dpy> is deleted and <dpy>
125-
itself is terminated. Concurrent calls to these functions from different
126-
threads is also allowed.
127-
128-
If eglSetBlobCacheFuncs generates an error then all client APIs must behave
129-
as though eglSetBlobCacheFuncs was not called for the display <dpy>. If
130-
<set> or <get> is NULL then an EGL_BAD_PARAMETER error is generated. If a
131-
successful eglSetBlobCacheFuncs call was already made for <dpy> and the
132-
display has not since been terminated then an EGL_BAD_PARAMETER error is
133-
generated.
123+
from any thread from the time at which eglSetBlobCacheFuncsANDROID is
124+
called until the time that the last resource associated with <dpy> is
125+
deleted and <dpy> itself is terminated. Concurrent calls to these
126+
functions from different threads is also allowed.
127+
128+
If eglSetBlobCacheFuncsANDROID generates an error then all client APIs must
129+
behave as though eglSetBlobCacheFuncsANDROID was not called for the display
130+
<dpy>. If <set> or <get> is NULL then an EGL_BAD_PARAMETER error is
131+
generated. If a successful eglSetBlobCacheFuncsANDROID call was already
132+
made for <dpy> and the display has not since been terminated then an
133+
EGL_BAD_PARAMETER error is generated.
134134

135135
3.9.1 Cache Operations
136136

137137
To insert a new binary value into the cache and associate it with a given
138138
key, a client API implementation can call the application-provided callback
139139
function
140140

141-
void (*set) (const void* key, EGLsizei keySize, const void* value,
142-
EGLsizei valueSize)
141+
void (*set) (const void* key, EGLsizeiANDROID keySize,
142+
const void* value, EGLsizeiANDROID valueSize)
143143

144144
<key> and <value> are pointers to the beginning of the key and value,
145145
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)
157157
client API implementation can call the application-provided callback
158158
function
159159

160-
EGLsizei (*get) (const void* key, EGLsizei keySize, void* value,
161-
EGLsizei valueSize)
160+
EGLsizeiANDROID (*get) (const void* key, EGLsizeiANDROID keySize,
161+
void* value, EGLsizeiANDROID valueSize)
162162

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

0 commit comments

Comments
 (0)