egl emulator: fixes for covegl conformance test

Support for eglChooseConfig with configs==NULL.
Also added small change to query EGL_LARGEST_PBUFFER attrib of surfaces.
Fixed error print in QemuPipeStream::readFully.

Those changes make sure that covegl completes & passes on the emulator with Translator
on linux in the backend.

Change-Id: I892917ec102ae85d56a16a7cb321e8c12e7083f1
This commit is contained in:
Stas Gurtovoy
2011-07-11 13:53:36 +03:00
committed by David 'Digit' Turner
parent 5dd421c56b
commit 201584b1d4
4 changed files with 12 additions and 7 deletions

View File

@@ -268,14 +268,14 @@ int FBConfig::chooseConfig(FrameBuffer *fb, EGLint * attribs, uint32_t * configs
// //
uint32_t nVerifiedCfgs = 0; uint32_t nVerifiedCfgs = 0;
for (int matchedIdx=0; matchedIdx<nConfigs; matchedIdx++) { for (int matchedIdx=0; matchedIdx<nConfigs; matchedIdx++) {
if ((configs_size > 0) && (nVerifiedCfgs >= configs_size)) break; //We have enouhgt configs if ((configs != NULL) && (configs_size > 0) && (nVerifiedCfgs >= configs_size)) break; //We have enouhgt configs
int sCfgId; int sCfgId;
s_egl.eglGetConfigAttrib(dpy, matchedConfigs[matchedIdx], EGL_CONFIG_ID, &sCfgId); s_egl.eglGetConfigAttrib(dpy, matchedConfigs[matchedIdx], EGL_CONFIG_ID, &sCfgId);
for (int fbIdx=0; fbIdx<s_numConfigs; fbIdx++) { for (int fbIdx=0; fbIdx<s_numConfigs; fbIdx++) {
int dCfgId = s_fbConfigs[fbIdx]->m_attribValues[4]; //CONFIG_ID int dCfgId = s_fbConfigs[fbIdx]->m_attribValues[4]; //CONFIG_ID
if (sCfgId == dCfgId) { if (sCfgId == dCfgId) {
//This config matches the requested attributes and filtered into fbConfigs, so we're happy with it //This config matches the requested attributes and filtered into fbConfigs, so we're happy with it
if (nVerifiedCfgs < configs_size) { if (configs && nVerifiedCfgs < configs_size) {
configs[nVerifiedCfgs] = fbIdx; configs[nVerifiedCfgs] = fbIdx;
} }
nVerifiedCfgs++; nVerifiedCfgs++;

View File

@@ -117,7 +117,7 @@ const unsigned char *QemuPipeStream::readFully(void *buf, size_t len)
//DBG(">> QemuPipeStream::readFully %d\n", len); //DBG(">> QemuPipeStream::readFully %d\n", len);
if (!valid()) return NULL; if (!valid()) return NULL;
if (!buf) { if (!buf) {
ERR("QemuPipeStream::readFully failed, buf=NULL, len %d", len); if (len>0) ERR("QemuPipeStream::readFully failed, buf=NULL, len %d", len);
return NULL; // do not allow NULL buf in that implementation return NULL; // do not allow NULL buf in that implementation
} }
size_t res = len; size_t res = len;

View File

@@ -808,6 +808,11 @@ EGLBoolean eglQuerySurface(EGLDisplay dpy, EGLSurface eglSurface, EGLint attribu
case EGL_SWAP_BEHAVIOR: case EGL_SWAP_BEHAVIOR:
*value = surface->getSwapBehavior(); *value = surface->getSwapBehavior();
break; break;
case EGL_LARGEST_PBUFFER:
// not modified for a window or pixmap surface
// and we ignore it when creating a PBuffer surface (default is EGL_FALSE)
if (surface->getSurfaceType() & EGL_PBUFFER_BIT) *value = EGL_FALSE;
break;
//TODO: complete other attributes //TODO: complete other attributes
default: default:
LOGE("eglQuerySurface %x EGL_BAD_ATTRIBUTE", attribute); LOGE("eglQuerySurface %x EGL_BAD_ATTRIBUTE", attribute);
@@ -987,9 +992,8 @@ EGLBoolean eglMakeCurrent(EGLDisplay dpy, EGLSurface draw, EGLSurface read, EGLC
// //
EGLThreadInfo *tInfo = getEGLThreadInfo(); EGLThreadInfo *tInfo = getEGLThreadInfo();
if (tInfo->currentContext == context && if (tInfo->currentContext == context &&
context && (context == NULL ||
context->draw == draw && (context && context->draw == draw && context->read == read))) {
context->read == read) {
return EGL_TRUE; return EGL_TRUE;
} }

View File

@@ -28,6 +28,7 @@ rcChooseConfig
dir attribs in dir attribs in
len attribs attribs_size len attribs attribs_size
dir configs out dir configs out
var_flag configs nullAllowed
len configs configs_size*sizeof(uint32_t) len configs configs_size*sizeof(uint32_t)
rcReadColorBuffer rcReadColorBuffer