EmuGL: remove broken EGL buffer refcounting
The emulator EGL implementation tried to hold its own reference to
buffers acquired/released with dequeueBuffer/queueBuffer, but was
missing an incRef after dequeueBuffer during swapBuffers.
Since the native window holds a reference to the buffer between
dequeueBuffer and queueBuffer, the EGL reference isn't needed anyway.
Change-Id: I95e4f9f4faf59198f99939cdca6603fe176c56bc
diff --git a/tools/emulator/opengl/system/egl/egl.cpp b/tools/emulator/opengl/system/egl/egl.cpp
index e9bae3a..ddc006c 100644
--- a/tools/emulator/opengl/system/egl/egl.cpp
+++ b/tools/emulator/opengl/system/egl/egl.cpp
@@ -308,8 +308,6 @@
setErrorReturn(EGL_BAD_ALLOC, EGL_FALSE);
}
- buffer->common.incRef(&buffer->common);
-
// lock the buffer
nativeWindow->lockBuffer(nativeWindow, buffer);
@@ -323,7 +321,6 @@
{
if (buffer) {
nativeWindow->queueBuffer(nativeWindow, buffer);
- buffer->common.decRef(&buffer->common);
buffer = 0;
}
}
@@ -338,16 +335,9 @@
rcEnc->rcFlushWindowColorBuffer(rcEnc, rcSurface);
- android_native_buffer_t* prevBuf = buffer;
//post the back buffer
nativeWindow->queueBuffer(nativeWindow, buffer);
- buffer->common.incRef(&buffer->common);
-
- if (prevBuf) {
- prevBuf->common.decRef(&prevBuf->common);
- }
-
// dequeue a new buffer
if (nativeWindow->dequeueBuffer(nativeWindow, &buffer)) {
setErrorReturn(EGL_BAD_ALLOC, EGL_FALSE);