emulator opengl: guest/host rendering syncronization.
Added a return value for rcFlushWindowColorBuffer and rcUpdateColorBuffer in order to make those calls to block with a round-trip to the host. This is to make sure that the color buffer is up-to-date before the flinger use it for rendering. Also added a call to the native windows's lock function after EGL is attached and bound to render on the window. This call was missed before. This syncronization can be optimized by removing the round-trip and insert sync primitive to the stream at every draw command that reads from a color buffer to make the sync happen on the host before rendering the color buffer and remove the need for the guest to wait for that update. Change-Id: I1c2d8bc407b69663e992a68d5aa755f19bbe0ec3
This commit is contained in:
committed by
Guy Zadickario
parent
4ef1f3474e
commit
0536060b40
@@ -224,13 +224,14 @@ static void rcDestroyColorBuffer(uint32_t colorbuffer)
|
|||||||
fb->DestroyColorBuffer( colorbuffer );
|
fb->DestroyColorBuffer( colorbuffer );
|
||||||
}
|
}
|
||||||
|
|
||||||
static void rcFlushWindowColorBuffer(uint32_t windowSurface)
|
static int rcFlushWindowColorBuffer(uint32_t windowSurface)
|
||||||
{
|
{
|
||||||
FrameBuffer *fb = FrameBuffer::getFB();
|
FrameBuffer *fb = FrameBuffer::getFB();
|
||||||
if (!fb) {
|
if (!fb) {
|
||||||
return;
|
return -1;
|
||||||
}
|
}
|
||||||
fb->flushWindowSurfaceColorBuffer(windowSurface);
|
fb->flushWindowSurfaceColorBuffer(windowSurface);
|
||||||
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void rcSetWindowColorBuffer(uint32_t windowSurface,
|
static void rcSetWindowColorBuffer(uint32_t windowSurface,
|
||||||
@@ -296,17 +297,18 @@ static void rcReadColorBuffer(uint32_t colorBuffer,
|
|||||||
// XXX: TBD - should be implemented
|
// XXX: TBD - should be implemented
|
||||||
}
|
}
|
||||||
|
|
||||||
static void rcUpdateColorBuffer(uint32_t colorBuffer,
|
static int rcUpdateColorBuffer(uint32_t colorBuffer,
|
||||||
GLint x, GLint y,
|
GLint x, GLint y,
|
||||||
GLint width, GLint height,
|
GLint width, GLint height,
|
||||||
GLenum format, GLenum type, void* pixels)
|
GLenum format, GLenum type, void* pixels)
|
||||||
{
|
{
|
||||||
FrameBuffer *fb = FrameBuffer::getFB();
|
FrameBuffer *fb = FrameBuffer::getFB();
|
||||||
if (!fb) {
|
if (!fb) {
|
||||||
return;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
fb->updateColorBuffer(colorBuffer, x, y, width, height, format, type, pixels);
|
fb->updateColorBuffer(colorBuffer, x, y, width, height, format, type, pixels);
|
||||||
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
void initRenderControlContext(renderControl_decoder_context_t *dec)
|
void initRenderControlContext(renderControl_decoder_context_t *dec)
|
||||||
|
|||||||
@@ -325,8 +325,12 @@ EGLBoolean egl_window_surface_t::connect()
|
|||||||
if (nativeWindow->dequeueBuffer(nativeWindow, &buffer) != NO_ERROR) {
|
if (nativeWindow->dequeueBuffer(nativeWindow, &buffer) != NO_ERROR) {
|
||||||
setErrorReturn(EGL_BAD_ALLOC, EGL_FALSE);
|
setErrorReturn(EGL_BAD_ALLOC, EGL_FALSE);
|
||||||
}
|
}
|
||||||
|
|
||||||
buffer->common.incRef(&buffer->common);
|
buffer->common.incRef(&buffer->common);
|
||||||
|
|
||||||
|
// lock the buffer
|
||||||
|
nativeWindow->lockBuffer(nativeWindow, buffer);
|
||||||
|
|
||||||
DEFINE_AND_VALIDATE_HOST_CONNECTION(EGL_FALSE);
|
DEFINE_AND_VALIDATE_HOST_CONNECTION(EGL_FALSE);
|
||||||
rcEnc->rcSetWindowColorBuffer(rcEnc, rcSurface, ((cb_handle_t *)(buffer->handle))->hostHandle);
|
rcEnc->rcSetWindowColorBuffer(rcEnc, rcSurface, ((cb_handle_t *)(buffer->handle))->hostHandle);
|
||||||
|
|
||||||
@@ -360,6 +364,9 @@ EGLBoolean egl_window_surface_t::swapBuffers()
|
|||||||
setErrorReturn(EGL_BAD_ALLOC, EGL_FALSE);
|
setErrorReturn(EGL_BAD_ALLOC, EGL_FALSE);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// lock the buffer
|
||||||
|
nativeWindow->lockBuffer(nativeWindow, buffer);
|
||||||
|
|
||||||
rcEnc->rcSetWindowColorBuffer(rcEnc, rcSurface, ((cb_handle_t *)(buffer->handle))->hostHandle);
|
rcEnc->rcSetWindowColorBuffer(rcEnc, rcSurface, ((cb_handle_t *)(buffer->handle))->hostHandle);
|
||||||
|
|
||||||
return EGL_TRUE;
|
return EGL_TRUE;
|
||||||
|
|||||||
@@ -13,11 +13,11 @@ GL_ENTRY(void, rcDestroyWindowSurface, uint32_t windowSurface)
|
|||||||
GL_ENTRY(uint32_t, rcCreateColorBuffer, uint32_t width, uint32_t height, GLenum internalFormat)
|
GL_ENTRY(uint32_t, rcCreateColorBuffer, uint32_t width, uint32_t height, GLenum internalFormat)
|
||||||
GL_ENTRY(void, rcDestroyColorBuffer, uint32_t colorbuffer)
|
GL_ENTRY(void, rcDestroyColorBuffer, uint32_t colorbuffer)
|
||||||
GL_ENTRY(void, rcSetWindowColorBuffer, uint32_t windowSurface, uint32_t colorBuffer)
|
GL_ENTRY(void, rcSetWindowColorBuffer, uint32_t windowSurface, uint32_t colorBuffer)
|
||||||
GL_ENTRY(void, rcFlushWindowColorBuffer, uint32_t windowSurface)
|
GL_ENTRY(int, rcFlushWindowColorBuffer, uint32_t windowSurface)
|
||||||
GL_ENTRY(EGLint, rcMakeCurrent, uint32_t context, uint32_t drawSurf, uint32_t readSurf)
|
GL_ENTRY(EGLint, rcMakeCurrent, uint32_t context, uint32_t drawSurf, uint32_t readSurf)
|
||||||
GL_ENTRY(void, rcFBPost, uint32_t colorBuffer)
|
GL_ENTRY(void, rcFBPost, uint32_t colorBuffer)
|
||||||
GL_ENTRY(void, rcFBSetSwapInterval, EGLint interval)
|
GL_ENTRY(void, rcFBSetSwapInterval, EGLint interval)
|
||||||
GL_ENTRY(void, rcBindTexture, uint32_t colorBuffer)
|
GL_ENTRY(void, rcBindTexture, uint32_t colorBuffer)
|
||||||
GL_ENTRY(EGLint, rcColorBufferCacheFlush, uint32_t colorbuffer, EGLint postCount,int forRead)
|
GL_ENTRY(EGLint, rcColorBufferCacheFlush, uint32_t colorbuffer, EGLint postCount,int forRead)
|
||||||
GL_ENTRY(void, rcReadColorBuffer, uint32_t colorbuffer, GLint x, GLint y, GLint width, GLint height, GLenum format, GLenum type, void *pixels)
|
GL_ENTRY(void, rcReadColorBuffer, uint32_t colorbuffer, GLint x, GLint y, GLint width, GLint height, GLenum format, GLenum type, void *pixels)
|
||||||
GL_ENTRY(void, rcUpdateColorBuffer, uint32_t colorbuffer, GLint x, GLint y, GLint width, GLint height, GLenum format, GLenum type, void *pixels)
|
GL_ENTRY(int, rcUpdateColorBuffer, uint32_t colorbuffer, GLint x, GLint y, GLint width, GLint height, GLenum format, GLenum type, void *pixels)
|
||||||
|
|||||||
Reference in New Issue
Block a user