aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTreehugger Robot <treehugger-gerrit@google.com>2020-09-16 18:02:09 +0000
committerGerrit Code Review <noreply-gerritcodereview@google.com>2020-09-16 18:02:09 +0000
commit6fa7750a681140e2616b30bc17db35360cf61c76 (patch)
tree29b443caa48949105a53e886ff412b2bf98f54f9
parent12e203b59677e690d99284114c5cd746ea634bea (diff)
parent58621b9cf5e14a5b647385939ed65330f3d69330 (diff)
downloaddevice_generic_goldfish-opengl-6fa7750a681140e2616b30bc17db35360cf61c76.tar.gz
device_generic_goldfish-opengl-6fa7750a681140e2616b30bc17db35360cf61c76.tar.bz2
device_generic_goldfish-opengl-6fa7750a681140e2616b30bc17db35360cf61c76.zip
Merge "renderControl_enc: (2/3) Pass mapping size to rcMapGpaToBufferHandle()."
-rw-r--r--system/renderControl_enc/renderControl_client_context.cpp1
-rw-r--r--system/renderControl_enc/renderControl_client_context.h1
-rw-r--r--system/renderControl_enc/renderControl_client_proc.h1
-rw-r--r--system/renderControl_enc/renderControl_enc.cpp44
-rw-r--r--system/renderControl_enc/renderControl_entry.cpp7
-rw-r--r--system/renderControl_enc/renderControl_ftable.h1
-rw-r--r--system/renderControl_enc/renderControl_opcodes.h3
7 files changed, 57 insertions, 1 deletions
diff --git a/system/renderControl_enc/renderControl_client_context.cpp b/system/renderControl_enc/renderControl_client_context.cpp
index ded019b8..5b1f14ee 100644
--- a/system/renderControl_enc/renderControl_client_context.cpp
+++ b/system/renderControl_enc/renderControl_client_context.cpp
@@ -64,6 +64,7 @@ int renderControl_client_context_t::initDispatchByName(void *(*getProc)(const ch
rcSetColorBufferVulkanMode2 = (rcSetColorBufferVulkanMode2_client_proc_t) getProc("rcSetColorBufferVulkanMode2", userData);
rcMapGpaToBufferHandle = (rcMapGpaToBufferHandle_client_proc_t) getProc("rcMapGpaToBufferHandle", userData);
rcCreateBuffer2 = (rcCreateBuffer2_client_proc_t) getProc("rcCreateBuffer2", userData);
+ rcMapGpaToBufferHandle2 = (rcMapGpaToBufferHandle2_client_proc_t) getProc("rcMapGpaToBufferHandle2", userData);
return 0;
}
diff --git a/system/renderControl_enc/renderControl_client_context.h b/system/renderControl_enc/renderControl_client_context.h
index 54749dfd..2032a324 100644
--- a/system/renderControl_enc/renderControl_client_context.h
+++ b/system/renderControl_enc/renderControl_client_context.h
@@ -64,6 +64,7 @@ struct renderControl_client_context_t {
rcSetColorBufferVulkanMode2_client_proc_t rcSetColorBufferVulkanMode2;
rcMapGpaToBufferHandle_client_proc_t rcMapGpaToBufferHandle;
rcCreateBuffer2_client_proc_t rcCreateBuffer2;
+ rcMapGpaToBufferHandle2_client_proc_t rcMapGpaToBufferHandle2;
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 9f8f39c9..c0b9a7fd 100644
--- a/system/renderControl_enc/renderControl_client_proc.h
+++ b/system/renderControl_enc/renderControl_client_proc.h
@@ -66,6 +66,7 @@ typedef void (renderControl_APIENTRY *rcCloseBuffer_client_proc_t) (void * ctx,
typedef GLint (renderControl_APIENTRY *rcSetColorBufferVulkanMode2_client_proc_t) (void * ctx, uint32_t, uint32_t, uint32_t);
typedef int (renderControl_APIENTRY *rcMapGpaToBufferHandle_client_proc_t) (void * ctx, uint32_t, uint64_t);
typedef uint32_t (renderControl_APIENTRY *rcCreateBuffer2_client_proc_t) (void * ctx, uint64_t, uint32_t);
+typedef int (renderControl_APIENTRY *rcMapGpaToBufferHandle2_client_proc_t) (void * ctx, uint32_t, uint64_t, uint64_t);
#endif
diff --git a/system/renderControl_enc/renderControl_enc.cpp b/system/renderControl_enc/renderControl_enc.cpp
index f9994c47..6b2680c2 100644
--- a/system/renderControl_enc/renderControl_enc.cpp
+++ b/system/renderControl_enc/renderControl_enc.cpp
@@ -2145,6 +2145,49 @@ uint32_t rcCreateBuffer2_enc(void *self , uint64_t size, uint32_t memoryProperty
return retval;
}
+int rcMapGpaToBufferHandle2_enc(void *self , uint32_t bufferHandle, uint64_t gpa, uint64_t size)
+{
+ AEMU_SCOPED_TRACE("rcMapGpaToBufferHandle2 encode");
+
+ 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 + 8;
+ const size_t checksumSize = checksumCalculator->checksumByteSize();
+ const size_t totalSize = sizeWithoutChecksum + checksumSize;
+ buf = stream->alloc(totalSize);
+ ptr = buf;
+ int tmp = OP_rcMapGpaToBufferHandle2;memcpy(ptr, &tmp, 4); ptr += 4;
+ memcpy(ptr, &totalSize, 4); ptr += 4;
+
+ memcpy(ptr, &bufferHandle, 4); ptr += 4;
+ memcpy(ptr, &gpa, 8); ptr += 8;
+ memcpy(ptr, &size, 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;
+ unsigned char checksumBuf[ChecksumCalculator::kMaxChecksumSize];
+ if (checksumSize > 0) checksumBufPtr = &checksumBuf[0];
+ stream->readback(checksumBufPtr, checksumSize);
+ if (!checksumCalculator->validate(checksumBufPtr, checksumSize)) {
+ ALOGE("rcMapGpaToBufferHandle2: GL communication error, please report this issue to b.android.com.\n");
+ abort();
+ }
+ }
+ return retval;
+}
+
} // namespace
renderControl_encoder_context_t::renderControl_encoder_context_t(IOStream *stream, ChecksumCalculator *checksumCalculator)
@@ -2206,5 +2249,6 @@ renderControl_encoder_context_t::renderControl_encoder_context_t(IOStream *strea
this->rcSetColorBufferVulkanMode2 = &rcSetColorBufferVulkanMode2_enc;
this->rcMapGpaToBufferHandle = &rcMapGpaToBufferHandle_enc;
this->rcCreateBuffer2 = &rcCreateBuffer2_enc;
+ this->rcMapGpaToBufferHandle2 = &rcMapGpaToBufferHandle2_enc;
}
diff --git a/system/renderControl_enc/renderControl_entry.cpp b/system/renderControl_enc/renderControl_entry.cpp
index 2f30f4c6..0ea37d61 100644
--- a/system/renderControl_enc/renderControl_entry.cpp
+++ b/system/renderControl_enc/renderControl_entry.cpp
@@ -59,6 +59,7 @@ extern "C" {
GLint rcSetColorBufferVulkanMode2(uint32_t colorBuffer, uint32_t mode, uint32_t memoryProperty);
int rcMapGpaToBufferHandle(uint32_t bufferHandle, uint64_t gpa);
uint32_t rcCreateBuffer2(uint64_t size, uint32_t memoryProperty);
+ int rcMapGpaToBufferHandle2(uint32_t bufferHandle, uint64_t gpa, uint64_t size);
};
#ifndef GET_CONTEXT
@@ -391,3 +392,9 @@ uint32_t rcCreateBuffer2(uint64_t size, uint32_t memoryProperty)
return ctx->rcCreateBuffer2(ctx, size, memoryProperty);
}
+int rcMapGpaToBufferHandle2(uint32_t bufferHandle, uint64_t gpa, uint64_t size)
+{
+ GET_CONTEXT;
+ return ctx->rcMapGpaToBufferHandle2(ctx, bufferHandle, gpa, size);
+}
+
diff --git a/system/renderControl_enc/renderControl_ftable.h b/system/renderControl_enc/renderControl_ftable.h
index 3cec1d36..247a0bd1 100644
--- a/system/renderControl_enc/renderControl_ftable.h
+++ b/system/renderControl_enc/renderControl_ftable.h
@@ -62,6 +62,7 @@ static const struct _renderControl_funcs_by_name {
{"rcSetColorBufferVulkanMode2", (void*)rcSetColorBufferVulkanMode2},
{"rcMapGpaToBufferHandle", (void*)rcMapGpaToBufferHandle},
{"rcCreateBuffer2", (void*)rcCreateBuffer2},
+ {"rcMapGpaToBufferHandle2", (void*)rcMapGpaToBufferHandle2},
};
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 a59306d0..16c02141 100644
--- a/system/renderControl_enc/renderControl_opcodes.h
+++ b/system/renderControl_enc/renderControl_opcodes.h
@@ -57,7 +57,8 @@
#define OP_rcSetColorBufferVulkanMode2 10051
#define OP_rcMapGpaToBufferHandle 10052
#define OP_rcCreateBuffer2 10053
-#define OP_last 10054
+#define OP_rcMapGpaToBufferHandle2 10054
+#define OP_last 10055
#endif