Merge "VirtioGpuPipeStream: improve performance"
diff --git a/system/GLESv2_enc/GL2Encoder.cpp b/system/GLESv2_enc/GL2Encoder.cpp
index 783812c..cc009a9 100755
--- a/system/GLESv2_enc/GL2Encoder.cpp
+++ b/system/GLESv2_enc/GL2Encoder.cpp
@@ -1743,8 +1743,22 @@
// Track original sources---they may be translated in the backend
std::vector<std::string> orig_sources;
- for (int i = 0; i < count; i++) {
- orig_sources.push_back(std::string((const char*)(string[i])));
+ if (length) {
+ for (int i = 0; i < count; i++) {
+ // Each element in the length array may contain the length of the corresponding
+ // string (the null character is not counted as part of the string length) or a
+ // value less than 0 to indicate that the string is null terminated.
+ if (length[i] >= 0) {
+ orig_sources.push_back(std::string((const char*)(string[i]),
+ (const char*)(string[i]) + length[i]));
+ } else {
+ orig_sources.push_back(std::string((const char*)(string[i])));
+ }
+ }
+ } else {
+ for (int i = 0; i < count; i++) {
+ orig_sources.push_back(std::string((const char*)(string[i])));
+ }
}
shaderData->sources = orig_sources;
diff --git a/system/cbmanager/hidl.cpp b/system/cbmanager/hidl.cpp
index 764ae73..f506ef9 100644
--- a/system/cbmanager/hidl.cpp
+++ b/system/cbmanager/hidl.cpp
@@ -40,8 +40,8 @@
sp<IAllocator2ns::IAllocator> allocator)
: mMapper(mapper), mAllocator(allocator) {}
- const cb_handle_t* allocateBuffer(int width, int height,
- PixelFormat format, BufferUsageBits usage) {
+ cb_handle_t* allocateBuffer(int width, int height,
+ PixelFormat format, BufferUsageBits usage) {
using IMapper2ns::Error;
using IMapper2ns::BufferDescriptor;
@@ -77,7 +77,7 @@
RETURN_ERROR(nullptr);
}
- const cb_handle_t *buf = nullptr;
+ cb_handle_t *buf = nullptr;
mMapper->importBuffer(raw_handle, [&](const Error &_error,
void *_buf) {
hidl_err = _error;
diff --git a/system/include/cbmanager.h b/system/include/cbmanager.h
index 29eeab7..0ac9bdd 100644
--- a/system/include/cbmanager.h
+++ b/system/include/cbmanager.h
@@ -34,14 +34,14 @@
class CbManagerImpl {
public:
virtual ~CbManagerImpl() {}
- virtual const cb_handle_t* allocateBuffer(int width,
- int height,
- PixelFormat format,
- BufferUsageBits usage) = 0;
+ virtual cb_handle_t* allocateBuffer(int width,
+ int height,
+ PixelFormat format,
+ BufferUsageBits usage) = 0;
virtual void freeBuffer(const cb_handle_t* h) = 0;
};
- const cb_handle_t* allocateBuffer(int width, int height, PixelFormat format, BufferUsageBits usage) {
+ cb_handle_t* allocateBuffer(int width, int height, PixelFormat format, BufferUsageBits usage) {
return mImpl->allocateBuffer(width, height, format, usage);
}