Merge "Fix dEQP-EGL.functional.negative_api.choose_config"
diff --git a/system/OpenglSystemCommon/HostConnection.cpp b/system/OpenglSystemCommon/HostConnection.cpp
index 2fb1eca..5d25cc7 100644
--- a/system/OpenglSystemCommon/HostConnection.cpp
+++ b/system/OpenglSystemCommon/HostConnection.cpp
@@ -14,12 +14,15 @@
* limitations under the License.
*/
#include "HostConnection.h"
-#include "TcpStream.h"
-#include "QemuPipeStream.h"
-#include "ThreadInfo.h"
-#include <cutils/log.h>
+
#include "GLEncoder.h"
#include "GL2Encoder.h"
+#include "ProcessPipe.h"
+#include "QemuPipeStream.h"
+#include "TcpStream.h"
+#include "ThreadInfo.h"
+
+#include <cutils/log.h>
#define STREAM_BUFFER_SIZE (4*1024*1024)
#define STREAM_PORT_NUM 22468
@@ -149,6 +152,7 @@
m_rcEnc = new ExtendedRCEncoderContext(m_stream, checksumHelper());
setChecksumHelper(m_rcEnc);
queryAndSetSyncImpl(m_rcEnc);
+ processPipeInit(m_rcEnc);
}
return m_rcEnc;
}
diff --git a/system/OpenglSystemCommon/HostConnection.h b/system/OpenglSystemCommon/HostConnection.h
index c058e75..6586647 100644
--- a/system/OpenglSystemCommon/HostConnection.h
+++ b/system/OpenglSystemCommon/HostConnection.h
@@ -23,9 +23,9 @@
#include <string>
class GLEncoder;
-class gl_client_context_t;
+struct gl_client_context_t;
class GL2Encoder;
-class gl2_client_context_t;
+struct gl2_client_context_t;
// SyncImpl determines the presence of host/guest OpenGL fence sync
// capabilities. It corresponds exactly to EGL_ANDROID_native_fence_sync
diff --git a/system/OpenglSystemCommon/ProcessPipe.cpp b/system/OpenglSystemCommon/ProcessPipe.cpp
index 98c078e..e638236 100644
--- a/system/OpenglSystemCommon/ProcessPipe.cpp
+++ b/system/OpenglSystemCommon/ProcessPipe.cpp
@@ -14,6 +14,8 @@
* limitations under the License.
*/
+#include "renderControl_enc.h"
+
#include <cutils/log.h>
#include <pthread.h>
#if PLATFORM_SDK_VERSION > 24
@@ -28,6 +30,7 @@
// It is different from getpid().
static uint64_t sProcUID = 0;
+// processPipeInitOnce is used to generate a process unique ID (puid).
// processPipeInitOnce will only be called at most once per process.
// Use it with pthread_once for thread safety.
// The host associates resources with process unique ID (puid) for memory cleanup.
@@ -71,11 +74,9 @@
}
}
-bool processPipeInit() {
+bool processPipeInit(renderControl_encoder_context_t *rcEnc) {
pthread_once(&sProcPipeOnce, processPipeInitOnce);
- return sProcPipe != 0;
-}
-
-uint64_t getProcUID() {
- return sProcUID;
+ if (!sProcPipe) return false;
+ rcEnc->rcSetPuid(rcEnc, sProcUID);
+ return true;
}
\ No newline at end of file
diff --git a/system/OpenglSystemCommon/ProcessPipe.h b/system/OpenglSystemCommon/ProcessPipe.h
index 56ccd34..66744b1 100644
--- a/system/OpenglSystemCommon/ProcessPipe.h
+++ b/system/OpenglSystemCommon/ProcessPipe.h
@@ -19,28 +19,17 @@
#include <stdint.h>
// The process pipe is used to notify the host about process exits,
-// also append a process unique ID (puid) to all encoder calls which create or
-// release GL resources owned by process. This is for the purpose that the host
-// can clean up process resources when a process is killed. It will fallback
-// to the default path if the host does not support it. Processes are identified
-// by acquiring a per-process 64bit unique ID (puid) from the host.
+// also associate all process-owned host GL resources with a process unique ID
+// (puid). This is for the purpose that the host can clean up process resources
+// when a process is killed. It will fallback to the default path if the host
+// does not support it. Processes are identified by acquiring a per-process
+// 64bit unique ID (puid) from the host.
//
-// Note: you don't need call this function directly. Use it through PUID_CMD.
+// Calling processPipeInit will associate the current render thread with its
+// puid in the host.
+//
+// This is called when creating rcEncoder.
-bool processPipeInit();
+struct renderControl_client_context_t;
-// Return per-process unique ID. This ID is assigned by the host. It is
-// initialized when calling processPipeInit().
-//
-// Note: you don't need to use this function directly
-uint64_t getProcUID();
-
-// Associate PUID (process unique ID) with resource create / release commands
-// See the comments in processPipeInit() for more details
-//
-// Example:
-// uint32_t img = PUID_CMD(rcEnc, rcCreateClientImage, ctxHandle, target, texture);
-//
-#define PUID_CMD(encoder, func, ...) \
- (processPipeInit() ? (encoder)->func##Puid((encoder), __VA_ARGS__, getProcUID()) \
- : (encoder)->func((encoder), __VA_ARGS__))
+extern bool processPipeInit(renderControl_encoder_context_t *rcEnc);
diff --git a/system/egl/egl.cpp b/system/egl/egl.cpp
index 5cc8d17..5744698 100644
--- a/system/egl/egl.cpp
+++ b/system/egl/egl.cpp
@@ -827,9 +827,11 @@
switch (attrib_list[0]) {
case EGL_WIDTH:
w = attrib_list[1];
+ if (w < 0) setErrorReturn(EGL_BAD_PARAMETER, EGL_NO_SURFACE);
break;
case EGL_HEIGHT:
h = attrib_list[1];
+ if (h < 0) setErrorReturn(EGL_BAD_PARAMETER, EGL_NO_SURFACE);
break;
case EGL_TEXTURE_FORMAT:
texFormat = attrib_list[1];
@@ -837,8 +839,14 @@
case EGL_TEXTURE_TARGET:
texTarget = attrib_list[1];
break;
- default:
+ // the followings are not supported
+ case EGL_LARGEST_PBUFFER:
+ case EGL_MIPMAP_TEXTURE:
+ case EGL_VG_ALPHA_FORMAT:
+ case EGL_VG_COLORSPACE:
break;
+ default:
+ setErrorReturn(EGL_BAD_ATTRIBUTE, EGL_NO_SURFACE);
};
attrib_list+=2;
}
@@ -908,19 +916,39 @@
*value = surface->getHeight();
break;
case EGL_TEXTURE_FORMAT:
- *value = surface->getTextureFormat();
+ if (surface->getSurfaceType() & EGL_PBUFFER_BIT) {
+ *value = surface->getTextureFormat();
+ }
break;
case EGL_TEXTURE_TARGET:
- *value = surface->getTextureTarget();
+ if (surface->getSurfaceType() & EGL_PBUFFER_BIT) {
+ *value = surface->getTextureTarget();
+ }
break;
case EGL_SWAP_BEHAVIOR:
- *value = surface->getSwapBehavior();
+ {
+ EGLint surfaceType;
+ ret = s_display.getConfigAttrib(surface->config, EGL_SURFACE_TYPE,
+ &surfaceType);
+ if (ret == EGL_TRUE) {
+ if (surfaceType & EGL_SWAP_BEHAVIOR_PRESERVED_BIT) {
+ *value = EGL_BUFFER_PRESERVED;
+ } else {
+ *value = EGL_BUFFER_DESTROYED;
+ }
+ }
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;
+ case EGL_MIPMAP_TEXTURE:
+ // not modified for a window or pixmap surface
+ // and we ignore it when creating a PBuffer surface (default is 0)
+ if (surface->getSurfaceType() & EGL_PBUFFER_BIT) *value = false;
+ break;
case EGL_MIPMAP_LEVEL:
// not modified for a window or pixmap surface
// and we ignore it when creating a PBuffer surface (default is 0)
@@ -930,6 +958,48 @@
// ignored when creating the surface, return default
*value = EGL_MULTISAMPLE_RESOLVE_DEFAULT;
break;
+ case EGL_HORIZONTAL_RESOLUTION:
+ // pixel/mm * EGL_DISPLAY_SCALING
+ // TODO: get the real resolution from avd config
+ *value = 1 * EGL_DISPLAY_SCALING;
+ break;
+ case EGL_VERTICAL_RESOLUTION:
+ // pixel/mm * EGL_DISPLAY_SCALING
+ // TODO: get the real resolution from avd config
+ *value = 1 * EGL_DISPLAY_SCALING;
+ break;
+ case EGL_PIXEL_ASPECT_RATIO:
+ // w / h * EGL_DISPLAY_SCALING
+ // Please don't ask why * EGL_DISPLAY_SCALING, the document says it
+ *value = 1 * EGL_DISPLAY_SCALING;
+ break;
+ case EGL_RENDER_BUFFER:
+ switch (surface->getSurfaceType()) {
+ case EGL_PBUFFER_BIT:
+ *value = EGL_BACK_BUFFER;
+ break;
+ case EGL_PIXMAP_BIT:
+ *value = EGL_SINGLE_BUFFER;
+ break;
+ case EGL_WINDOW_BIT:
+ // ignored when creating the surface, return default
+ *value = EGL_BACK_BUFFER;
+ break;
+ default:
+ ALOGE("eglQuerySurface %x unknown surface type %x",
+ attribute, surface->getSurfaceType());
+ ret = setErrorFunc(EGL_BAD_ATTRIBUTE, EGL_FALSE);
+ break;
+ }
+ break;
+ case EGL_VG_COLORSPACE:
+ // ignored when creating the surface, return default
+ *value = EGL_VG_COLORSPACE_sRGB;
+ break;
+ case EGL_VG_ALPHA_FORMAT:
+ // ignored when creating the surface, return default
+ *value = EGL_VG_ALPHA_FORMAT_NONPRE;
+ break;
//TODO: complete other attributes
default:
ALOGE("eglQuerySurface %x EGL_BAD_ATTRIBUTE", attribute);
@@ -1019,14 +1089,36 @@
(void)value;
+ egl_surface_t* p_surface( static_cast<egl_surface_t*>(surface) );
switch (attribute) {
case EGL_MIPMAP_LEVEL:
+ return true;
+ break;
case EGL_MULTISAMPLE_RESOLVE:
+ {
+ if (value == EGL_MULTISAMPLE_RESOLVE_BOX) {
+ EGLint surface_type;
+ s_display.getConfigAttrib(p_surface->config, EGL_SURFACE_TYPE, &surface_type);
+ if (0 == (surface_type & EGL_MULTISAMPLE_RESOLVE_BOX_BIT)) {
+ setErrorReturn(EGL_BAD_MATCH, EGL_FALSE);
+ }
+ }
+ return true;
+ break;
+ }
case EGL_SWAP_BEHAVIOR:
+ if (value == EGL_BUFFER_PRESERVED) {
+ EGLint surface_type;
+ s_display.getConfigAttrib(p_surface->config, EGL_SURFACE_TYPE, &surface_type);
+ if (0 == (surface_type & EGL_SWAP_BEHAVIOR_PRESERVED_BIT)) {
+ setErrorReturn(EGL_BAD_MATCH, EGL_FALSE);
+ }
+ }
return true;
break;
default:
ALOGW("%s: attr=0x%x not implemented", __FUNCTION__, attribute);
+ setErrorReturn(EGL_BAD_ATTRIBUTE, EGL_FALSE);
}
return false;
}
@@ -1454,7 +1546,7 @@
uint32_t ctxHandle = (context) ? context->rcContext : 0;
GLuint texture = (GLuint)reinterpret_cast<uintptr_t>(buffer);
- uint32_t img = PUID_CMD(rcEnc, rcCreateClientImage, ctxHandle, target, texture);
+ uint32_t img = rcEnc->rcCreateClientImage(rcEnc, ctxHandle, target, texture);
EGLImage_t *image = new EGLImage_t();
image->dpy = dpy;
image->target = target;
@@ -1493,7 +1585,7 @@
uint32_t host_egl_image = image->host_egl_image;
delete image;
DEFINE_AND_VALIDATE_HOST_CONNECTION(EGL_FALSE);
- return PUID_CMD(rcEnc, rcDestroyClientImage, host_egl_image);
+ return rcEnc->rcDestroyClientImage(rcEnc, host_egl_image);
}
setErrorReturn(EGL_BAD_PARAMETER, EGL_FALSE);
diff --git a/system/gralloc/gralloc.cpp b/system/gralloc/gralloc.cpp
index eccf6dd..9797f5f 100644
--- a/system/gralloc/gralloc.cpp
+++ b/system/gralloc/gralloc.cpp
@@ -371,7 +371,7 @@
__FUNCTION__, frameworkFormat, usage);
DEFINE_HOST_CONNECTION;
if (hostCon && rcEnc) {
- cb->hostHandle = PUID_CMD(rcEnc, rcCreateColorBuffer, w, h, glFormat);
+ cb->hostHandle = rcEnc->rcCreateColorBuffer(rcEnc, w, h, glFormat);
D("Created host ColorBuffer 0x%x\n", cb->hostHandle);
}
@@ -423,7 +423,7 @@
if (cb->hostHandle != 0) {
DEFINE_AND_VALIDATE_HOST_CONNECTION;
D("Closing host ColorBuffer 0x%x\n", cb->hostHandle);
- PUID_CMD(rcEnc, rcCloseColorBuffer, cb->hostHandle);
+ rcEnc->rcCloseColorBuffer(rcEnc, cb->hostHandle);
}
//
@@ -593,7 +593,7 @@
if (cb->hostHandle != 0) {
DEFINE_AND_VALIDATE_HOST_CONNECTION;
D("Opening host ColorBuffer 0x%x\n", cb->hostHandle);
- PUID_CMD(rcEnc, rcOpenColorBuffer2, cb->hostHandle);
+ rcEnc->rcOpenColorBuffer2(rcEnc, cb->hostHandle);
}
//
@@ -630,7 +630,7 @@
if (cb->hostHandle != 0) {
DEFINE_AND_VALIDATE_HOST_CONNECTION;
D("Closing host ColorBuffer 0x%x\n", cb->hostHandle);
- PUID_CMD(rcEnc, rcCloseColorBuffer, cb->hostHandle);
+ rcEnc->rcCloseColorBuffer(rcEnc, cb->hostHandle);
}
//
diff --git a/system/renderControl_enc/renderControl_client_context.cpp b/system/renderControl_enc/renderControl_client_context.cpp
index a41a7e9..a97f305 100644
--- a/system/renderControl_enc/renderControl_client_context.cpp
+++ b/system/renderControl_enc/renderControl_client_context.cpp
@@ -39,15 +39,11 @@
rcCreateClientImage = (rcCreateClientImage_client_proc_t) getProc("rcCreateClientImage", userData);
rcDestroyClientImage = (rcDestroyClientImage_client_proc_t) getProc("rcDestroyClientImage", userData);
rcSelectChecksumHelper = (rcSelectChecksumHelper_client_proc_t) getProc("rcSelectChecksumHelper", userData);
- rcCreateColorBufferPuid = (rcCreateColorBufferPuid_client_proc_t) getProc("rcCreateColorBufferPuid", userData);
- rcOpenColorBuffer2Puid = (rcOpenColorBuffer2Puid_client_proc_t) getProc("rcOpenColorBuffer2Puid", userData);
- rcCloseColorBufferPuid = (rcCloseColorBufferPuid_client_proc_t) getProc("rcCloseColorBufferPuid", userData);
rcCreateSyncKHR = (rcCreateSyncKHR_client_proc_t) getProc("rcCreateSyncKHR", userData);
rcClientWaitSyncKHR = (rcClientWaitSyncKHR_client_proc_t) getProc("rcClientWaitSyncKHR", userData);
rcFlushWindowColorBufferAsync = (rcFlushWindowColorBufferAsync_client_proc_t) getProc("rcFlushWindowColorBufferAsync", userData);
- rcCreateClientImagePuid = (rcCreateClientImagePuid_client_proc_t) getProc("rcCreateClientImagePuid", userData);
- rcDestroyClientImagePuid = (rcDestroyClientImagePuid_client_proc_t) getProc("rcDestroyClientImagePuid", userData);
rcDestroySyncKHR = (rcDestroySyncKHR_client_proc_t) getProc("rcDestroySyncKHR", userData);
+ rcSetPuid = (rcSetPuid_client_proc_t) getProc("rcSetPuid", userData);
return 0;
}
diff --git a/system/renderControl_enc/renderControl_client_context.h b/system/renderControl_enc/renderControl_client_context.h
index df234ce..fa121ea 100644
--- a/system/renderControl_enc/renderControl_client_context.h
+++ b/system/renderControl_enc/renderControl_client_context.h
@@ -39,15 +39,11 @@
rcCreateClientImage_client_proc_t rcCreateClientImage;
rcDestroyClientImage_client_proc_t rcDestroyClientImage;
rcSelectChecksumHelper_client_proc_t rcSelectChecksumHelper;
- rcCreateColorBufferPuid_client_proc_t rcCreateColorBufferPuid;
- rcOpenColorBuffer2Puid_client_proc_t rcOpenColorBuffer2Puid;
- rcCloseColorBufferPuid_client_proc_t rcCloseColorBufferPuid;
rcCreateSyncKHR_client_proc_t rcCreateSyncKHR;
rcClientWaitSyncKHR_client_proc_t rcClientWaitSyncKHR;
rcFlushWindowColorBufferAsync_client_proc_t rcFlushWindowColorBufferAsync;
- rcCreateClientImagePuid_client_proc_t rcCreateClientImagePuid;
- rcDestroyClientImagePuid_client_proc_t rcDestroyClientImagePuid;
rcDestroySyncKHR_client_proc_t rcDestroySyncKHR;
+ rcSetPuid_client_proc_t rcSetPuid;
virtual ~renderControl_client_context_t() {}
typedef renderControl_client_context_t *CONTEXT_ACCESSOR_TYPE(void);
diff --git a/system/renderControl_enc/renderControl_client_proc.h b/system/renderControl_enc/renderControl_client_proc.h
index 47d6755..cfde952 100644
--- a/system/renderControl_enc/renderControl_client_proc.h
+++ b/system/renderControl_enc/renderControl_client_proc.h
@@ -38,15 +38,11 @@
typedef uint32_t (renderControl_APIENTRY *rcCreateClientImage_client_proc_t) (void * ctx, uint32_t, EGLenum, GLuint);
typedef int (renderControl_APIENTRY *rcDestroyClientImage_client_proc_t) (void * ctx, uint32_t);
typedef void (renderControl_APIENTRY *rcSelectChecksumHelper_client_proc_t) (void * ctx, uint32_t, uint32_t);
-typedef uint32_t (renderControl_APIENTRY *rcCreateColorBufferPuid_client_proc_t) (void * ctx, uint32_t, uint32_t, GLenum, uint64_t);
-typedef int (renderControl_APIENTRY *rcOpenColorBuffer2Puid_client_proc_t) (void * ctx, uint32_t, uint64_t);
-typedef void (renderControl_APIENTRY *rcCloseColorBufferPuid_client_proc_t) (void * ctx, uint32_t, uint64_t);
typedef void (renderControl_APIENTRY *rcCreateSyncKHR_client_proc_t) (void * ctx, EGLenum, EGLint*, uint32_t, int, uint64_t*, uint64_t*);
typedef EGLint (renderControl_APIENTRY *rcClientWaitSyncKHR_client_proc_t) (void * ctx, uint64_t, EGLint, uint64_t);
typedef void (renderControl_APIENTRY *rcFlushWindowColorBufferAsync_client_proc_t) (void * ctx, uint32_t);
-typedef uint32_t (renderControl_APIENTRY *rcCreateClientImagePuid_client_proc_t) (void * ctx, uint32_t, EGLenum, GLuint, uint64_t);
-typedef int (renderControl_APIENTRY *rcDestroyClientImagePuid_client_proc_t) (void * ctx, uint32_t, uint64_t);
typedef int (renderControl_APIENTRY *rcDestroySyncKHR_client_proc_t) (void * ctx, uint64_t);
+typedef void (renderControl_APIENTRY *rcSetPuid_client_proc_t) (void * ctx, uint64_t);
#endif
diff --git a/system/renderControl_enc/renderControl_enc.cpp b/system/renderControl_enc/renderControl_enc.cpp
index 8899c11..ddccfcd 100644
--- a/system/renderControl_enc/renderControl_enc.cpp
+++ b/system/renderControl_enc/renderControl_enc.cpp
@@ -1094,117 +1094,6 @@
}
-uint32_t rcCreateColorBufferPuid_enc(void *self , uint32_t width, uint32_t height, GLenum internalFormat, uint64_t puid)
-{
-
- renderControl_encoder_context_t *ctx = (renderControl_encoder_context_t *)self;
- IOStream *stream = ctx->m_stream;
- ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
- bool useChecksum = checksumCalculator->getVersion() > 0;
-
- unsigned char *ptr;
- unsigned char *buf;
- const size_t sizeWithoutChecksum = 8 + 4 + 4 + 4 + 8;
- const size_t checksumSize = checksumCalculator->checksumByteSize();
- const size_t totalSize = sizeWithoutChecksum + checksumSize;
- buf = stream->alloc(totalSize);
- ptr = buf;
- int tmp = OP_rcCreateColorBufferPuid;memcpy(ptr, &tmp, 4); ptr += 4;
- memcpy(ptr, &totalSize, 4); ptr += 4;
-
- memcpy(ptr, &width, 4); ptr += 4;
- memcpy(ptr, &height, 4); ptr += 4;
- memcpy(ptr, &internalFormat, 4); ptr += 4;
- memcpy(ptr, &puid, 8); ptr += 8;
-
- if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
- if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
-
-
- uint32_t retval;
- stream->readback(&retval, 4);
- if (useChecksum) checksumCalculator->addBuffer(&retval, 4);
- if (useChecksum) {
- unsigned char *checksumBufPtr = NULL;
- std::vector<unsigned char> checksumBuf(checksumSize);
- if (checksumSize > 0) checksumBufPtr = &checksumBuf[0];
- stream->readback(checksumBufPtr, checksumSize);
- if (!checksumCalculator->validate(checksumBufPtr, checksumSize)) {
- ALOGE("rcCreateColorBufferPuid: GL communication error, please report this issue to b.android.com.\n");
- abort();
- }
- }
- return retval;
-}
-
-int rcOpenColorBuffer2Puid_enc(void *self , uint32_t colorbuffer, uint64_t puid)
-{
-
- renderControl_encoder_context_t *ctx = (renderControl_encoder_context_t *)self;
- IOStream *stream = ctx->m_stream;
- ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
- bool useChecksum = checksumCalculator->getVersion() > 0;
-
- unsigned char *ptr;
- unsigned char *buf;
- const size_t sizeWithoutChecksum = 8 + 4 + 8;
- const size_t checksumSize = checksumCalculator->checksumByteSize();
- const size_t totalSize = sizeWithoutChecksum + checksumSize;
- buf = stream->alloc(totalSize);
- ptr = buf;
- int tmp = OP_rcOpenColorBuffer2Puid;memcpy(ptr, &tmp, 4); ptr += 4;
- memcpy(ptr, &totalSize, 4); ptr += 4;
-
- memcpy(ptr, &colorbuffer, 4); ptr += 4;
- memcpy(ptr, &puid, 8); ptr += 8;
-
- if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
- if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
-
-
- int retval;
- stream->readback(&retval, 4);
- if (useChecksum) checksumCalculator->addBuffer(&retval, 4);
- if (useChecksum) {
- unsigned char *checksumBufPtr = NULL;
- std::vector<unsigned char> checksumBuf(checksumSize);
- if (checksumSize > 0) checksumBufPtr = &checksumBuf[0];
- stream->readback(checksumBufPtr, checksumSize);
- if (!checksumCalculator->validate(checksumBufPtr, checksumSize)) {
- ALOGE("rcOpenColorBuffer2Puid: GL communication error, please report this issue to b.android.com.\n");
- abort();
- }
- }
- return retval;
-}
-
-void rcCloseColorBufferPuid_enc(void *self , uint32_t colorbuffer, uint64_t puid)
-{
-
- renderControl_encoder_context_t *ctx = (renderControl_encoder_context_t *)self;
- IOStream *stream = ctx->m_stream;
- ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
- bool useChecksum = checksumCalculator->getVersion() > 0;
-
- unsigned char *ptr;
- unsigned char *buf;
- const size_t sizeWithoutChecksum = 8 + 4 + 8;
- const size_t checksumSize = checksumCalculator->checksumByteSize();
- const size_t totalSize = sizeWithoutChecksum + checksumSize;
- buf = stream->alloc(totalSize);
- ptr = buf;
- int tmp = OP_rcCloseColorBufferPuid;memcpy(ptr, &tmp, 4); ptr += 4;
- memcpy(ptr, &totalSize, 4); ptr += 4;
-
- memcpy(ptr, &colorbuffer, 4); ptr += 4;
- memcpy(ptr, &puid, 8); ptr += 8;
-
- if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
- if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
-
- stream->flush();
-}
-
void rcCreateSyncKHR_enc(void *self , EGLenum type, EGLint* attribs, uint32_t num_attribs, int destroy_when_signaled, uint64_t* glsync_out, uint64_t* syncthread_out)
{
@@ -1320,90 +1209,6 @@
}
-uint32_t rcCreateClientImagePuid_enc(void *self , uint32_t context, EGLenum target, GLuint buffer, uint64_t puid)
-{
-
- renderControl_encoder_context_t *ctx = (renderControl_encoder_context_t *)self;
- IOStream *stream = ctx->m_stream;
- ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
- bool useChecksum = checksumCalculator->getVersion() > 0;
-
- unsigned char *ptr;
- unsigned char *buf;
- const size_t sizeWithoutChecksum = 8 + 4 + 4 + 4 + 8;
- const size_t checksumSize = checksumCalculator->checksumByteSize();
- const size_t totalSize = sizeWithoutChecksum + checksumSize;
- buf = stream->alloc(totalSize);
- ptr = buf;
- int tmp = OP_rcCreateClientImagePuid;memcpy(ptr, &tmp, 4); ptr += 4;
- memcpy(ptr, &totalSize, 4); ptr += 4;
-
- memcpy(ptr, &context, 4); ptr += 4;
- memcpy(ptr, &target, 4); ptr += 4;
- memcpy(ptr, &buffer, 4); ptr += 4;
- memcpy(ptr, &puid, 8); ptr += 8;
-
- if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
- if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
-
-
- uint32_t retval;
- stream->readback(&retval, 4);
- if (useChecksum) checksumCalculator->addBuffer(&retval, 4);
- if (useChecksum) {
- unsigned char *checksumBufPtr = NULL;
- std::vector<unsigned char> checksumBuf(checksumSize);
- if (checksumSize > 0) checksumBufPtr = &checksumBuf[0];
- stream->readback(checksumBufPtr, checksumSize);
- if (!checksumCalculator->validate(checksumBufPtr, checksumSize)) {
- ALOGE("rcCreateClientImagePuid: GL communication error, please report this issue to b.android.com.\n");
- abort();
- }
- }
- return retval;
-}
-
-int rcDestroyClientImagePuid_enc(void *self , uint32_t image, uint64_t puid)
-{
-
- renderControl_encoder_context_t *ctx = (renderControl_encoder_context_t *)self;
- IOStream *stream = ctx->m_stream;
- ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
- bool useChecksum = checksumCalculator->getVersion() > 0;
-
- unsigned char *ptr;
- unsigned char *buf;
- const size_t sizeWithoutChecksum = 8 + 4 + 8;
- const size_t checksumSize = checksumCalculator->checksumByteSize();
- const size_t totalSize = sizeWithoutChecksum + checksumSize;
- buf = stream->alloc(totalSize);
- ptr = buf;
- int tmp = OP_rcDestroyClientImagePuid;memcpy(ptr, &tmp, 4); ptr += 4;
- memcpy(ptr, &totalSize, 4); ptr += 4;
-
- memcpy(ptr, &image, 4); ptr += 4;
- memcpy(ptr, &puid, 8); ptr += 8;
-
- if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
- if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
-
-
- int retval;
- stream->readback(&retval, 4);
- if (useChecksum) checksumCalculator->addBuffer(&retval, 4);
- if (useChecksum) {
- unsigned char *checksumBufPtr = NULL;
- std::vector<unsigned char> checksumBuf(checksumSize);
- if (checksumSize > 0) checksumBufPtr = &checksumBuf[0];
- stream->readback(checksumBufPtr, checksumSize);
- if (!checksumCalculator->validate(checksumBufPtr, checksumSize)) {
- ALOGE("rcDestroyClientImagePuid: GL communication error, please report this issue to b.android.com.\n");
- abort();
- }
- }
- return retval;
-}
-
int rcDestroySyncKHR_enc(void *self , uint64_t sync)
{
@@ -1444,6 +1249,31 @@
return retval;
}
+void rcSetPuid_enc(void *self , uint64_t puid)
+{
+
+ renderControl_encoder_context_t *ctx = (renderControl_encoder_context_t *)self;
+ IOStream *stream = ctx->m_stream;
+ ChecksumCalculator *checksumCalculator = ctx->m_checksumCalculator;
+ bool useChecksum = checksumCalculator->getVersion() > 0;
+
+ unsigned char *ptr;
+ unsigned char *buf;
+ const size_t sizeWithoutChecksum = 8 + 8;
+ const size_t checksumSize = checksumCalculator->checksumByteSize();
+ const size_t totalSize = sizeWithoutChecksum + checksumSize;
+ buf = stream->alloc(totalSize);
+ ptr = buf;
+ int tmp = OP_rcSetPuid;memcpy(ptr, &tmp, 4); ptr += 4;
+ memcpy(ptr, &totalSize, 4); ptr += 4;
+
+ memcpy(ptr, &puid, 8); ptr += 8;
+
+ if (useChecksum) checksumCalculator->addBuffer(buf, ptr-buf);
+ if (useChecksum) checksumCalculator->writeChecksum(ptr, checksumSize); ptr += checksumSize;
+
+}
+
} // namespace
renderControl_encoder_context_t::renderControl_encoder_context_t(IOStream *stream, ChecksumCalculator *checksumCalculator)
@@ -1480,14 +1310,10 @@
this->rcCreateClientImage = &rcCreateClientImage_enc;
this->rcDestroyClientImage = &rcDestroyClientImage_enc;
this->rcSelectChecksumHelper = &rcSelectChecksumHelper_enc;
- this->rcCreateColorBufferPuid = &rcCreateColorBufferPuid_enc;
- this->rcOpenColorBuffer2Puid = &rcOpenColorBuffer2Puid_enc;
- this->rcCloseColorBufferPuid = &rcCloseColorBufferPuid_enc;
this->rcCreateSyncKHR = &rcCreateSyncKHR_enc;
this->rcClientWaitSyncKHR = &rcClientWaitSyncKHR_enc;
this->rcFlushWindowColorBufferAsync = &rcFlushWindowColorBufferAsync_enc;
- this->rcCreateClientImagePuid = &rcCreateClientImagePuid_enc;
- this->rcDestroyClientImagePuid = &rcDestroyClientImagePuid_enc;
this->rcDestroySyncKHR = &rcDestroySyncKHR_enc;
+ this->rcSetPuid = &rcSetPuid_enc;
}
diff --git a/system/renderControl_enc/renderControl_entry.cpp b/system/renderControl_enc/renderControl_entry.cpp
index 948703b..8ff4d6a 100644
--- a/system/renderControl_enc/renderControl_entry.cpp
+++ b/system/renderControl_enc/renderControl_entry.cpp
@@ -35,15 +35,11 @@
uint32_t rcCreateClientImage(uint32_t context, EGLenum target, GLuint buffer);
int rcDestroyClientImage(uint32_t image);
void rcSelectChecksumHelper(uint32_t newProtocol, uint32_t reserved);
- uint32_t rcCreateColorBufferPuid(uint32_t width, uint32_t height, GLenum internalFormat, uint64_t puid);
- int rcOpenColorBuffer2Puid(uint32_t colorbuffer, uint64_t puid);
- void rcCloseColorBufferPuid(uint32_t colorbuffer, uint64_t puid);
void rcCreateSyncKHR(EGLenum type, EGLint* attribs, uint32_t num_attribs, int destroy_when_signaled, uint64_t* glsync_out, uint64_t* syncthread_out);
EGLint rcClientWaitSyncKHR(uint64_t sync, EGLint flags, uint64_t timeout);
void rcFlushWindowColorBufferAsync(uint32_t windowSurface);
- uint32_t rcCreateClientImagePuid(uint32_t context, EGLenum target, GLuint buffer, uint64_t puid);
- int rcDestroyClientImagePuid(uint32_t image, uint64_t puid);
int rcDestroySyncKHR(uint64_t sync);
+ void rcSetPuid(uint64_t puid);
};
#endif
@@ -227,24 +223,6 @@
ctx->rcSelectChecksumHelper(ctx, newProtocol, reserved);
}
-uint32_t rcCreateColorBufferPuid(uint32_t width, uint32_t height, GLenum internalFormat, uint64_t puid)
-{
- GET_CONTEXT;
- return ctx->rcCreateColorBufferPuid(ctx, width, height, internalFormat, puid);
-}
-
-int rcOpenColorBuffer2Puid(uint32_t colorbuffer, uint64_t puid)
-{
- GET_CONTEXT;
- return ctx->rcOpenColorBuffer2Puid(ctx, colorbuffer, puid);
-}
-
-void rcCloseColorBufferPuid(uint32_t colorbuffer, uint64_t puid)
-{
- GET_CONTEXT;
- ctx->rcCloseColorBufferPuid(ctx, colorbuffer, puid);
-}
-
void rcCreateSyncKHR(EGLenum type, EGLint* attribs, uint32_t num_attribs, int destroy_when_signaled, uint64_t* glsync_out, uint64_t* syncthread_out)
{
GET_CONTEXT;
@@ -263,21 +241,15 @@
ctx->rcFlushWindowColorBufferAsync(ctx, windowSurface);
}
-uint32_t rcCreateClientImagePuid(uint32_t context, EGLenum target, GLuint buffer, uint64_t puid)
-{
- GET_CONTEXT;
- return ctx->rcCreateClientImagePuid(ctx, context, target, buffer, puid);
-}
-
-int rcDestroyClientImagePuid(uint32_t image, uint64_t puid)
-{
- GET_CONTEXT;
- return ctx->rcDestroyClientImagePuid(ctx, image, puid);
-}
-
int rcDestroySyncKHR(uint64_t sync)
{
GET_CONTEXT;
return ctx->rcDestroySyncKHR(ctx, sync);
}
+void rcSetPuid(uint64_t puid)
+{
+ GET_CONTEXT;
+ ctx->rcSetPuid(ctx, puid);
+}
+
diff --git a/system/renderControl_enc/renderControl_ftable.h b/system/renderControl_enc/renderControl_ftable.h
index ed6e637..eaee76a 100644
--- a/system/renderControl_enc/renderControl_ftable.h
+++ b/system/renderControl_enc/renderControl_ftable.h
@@ -37,15 +37,11 @@
{"rcCreateClientImage", (void*)rcCreateClientImage},
{"rcDestroyClientImage", (void*)rcDestroyClientImage},
{"rcSelectChecksumHelper", (void*)rcSelectChecksumHelper},
- {"rcCreateColorBufferPuid", (void*)rcCreateColorBufferPuid},
- {"rcOpenColorBuffer2Puid", (void*)rcOpenColorBuffer2Puid},
- {"rcCloseColorBufferPuid", (void*)rcCloseColorBufferPuid},
{"rcCreateSyncKHR", (void*)rcCreateSyncKHR},
{"rcClientWaitSyncKHR", (void*)rcClientWaitSyncKHR},
{"rcFlushWindowColorBufferAsync", (void*)rcFlushWindowColorBufferAsync},
- {"rcCreateClientImagePuid", (void*)rcCreateClientImagePuid},
- {"rcDestroyClientImagePuid", (void*)rcDestroyClientImagePuid},
{"rcDestroySyncKHR", (void*)rcDestroySyncKHR},
+ {"rcSetPuid", (void*)rcSetPuid},
};
static const int renderControl_num_funcs = sizeof(renderControl_funcs_by_name) / sizeof(struct _renderControl_funcs_by_name);
diff --git a/system/renderControl_enc/renderControl_opcodes.h b/system/renderControl_enc/renderControl_opcodes.h
index ad6ca13..5112a6a 100644
--- a/system/renderControl_enc/renderControl_opcodes.h
+++ b/system/renderControl_enc/renderControl_opcodes.h
@@ -32,16 +32,12 @@
#define OP_rcCreateClientImage 10026
#define OP_rcDestroyClientImage 10027
#define OP_rcSelectChecksumHelper 10028
-#define OP_rcCreateColorBufferPuid 10029
-#define OP_rcOpenColorBuffer2Puid 10030
-#define OP_rcCloseColorBufferPuid 10031
-#define OP_rcCreateSyncKHR 10032
-#define OP_rcClientWaitSyncKHR 10033
-#define OP_rcFlushWindowColorBufferAsync 10034
-#define OP_rcCreateClientImagePuid 10035
-#define OP_rcDestroyClientImagePuid 10036
-#define OP_rcDestroySyncKHR 10037
-#define OP_last 10038
+#define OP_rcCreateSyncKHR 10029
+#define OP_rcClientWaitSyncKHR 10030
+#define OP_rcFlushWindowColorBufferAsync 10031
+#define OP_rcDestroySyncKHR 10032
+#define OP_rcSetPuid 10033
+#define OP_last 10034
#endif