Merge "Integrate binder service to vr window manager for controller input."
diff --git a/cmds/dumpstate/utils.cpp b/cmds/dumpstate/utils.cpp
index c6dfa37..0fc2bce 100644
--- a/cmds/dumpstate/utils.cpp
+++ b/cmds/dumpstate/utils.cpp
@@ -711,7 +711,8 @@
}
void send_broadcast(const std::string& action, const std::vector<std::string>& args) {
- std::vector<std::string> am = {"/system/bin/am", "broadcast", "--user", "0", "-a", action};
+ std::vector<std::string> am = {
+ "/system/bin/cmd", "activity", "broadcast", "--user", "0", "-a", action};
am.insert(am.end(), args.begin(), args.end());
diff --git a/include/batteryservice/BatteryService.h b/include/batteryservice/BatteryService.h
index 30d7317..80ab7f3 100644
--- a/include/batteryservice/BatteryService.h
+++ b/include/batteryservice/BatteryService.h
@@ -26,13 +26,15 @@
#include "BatteryServiceConstants.h"
-// must be kept in sync with definitions in BatteryProperty.java
+// must be kept in sync with definitions in
+// frameworks/base/core/java/android/os/BatteryManager.java
enum {
- BATTERY_PROP_CHARGE_COUNTER = 1, // equals BatteryProperty.CHARGE_COUNTER constant
- BATTERY_PROP_CURRENT_NOW = 2, // equals BatteryProperty.CURRENT_NOW constant
- BATTERY_PROP_CURRENT_AVG = 3, // equals BatteryProperty.CURRENT_AVG constant
- BATTERY_PROP_CAPACITY = 4, // equals BatteryProperty.CAPACITY constant
- BATTERY_PROP_ENERGY_COUNTER = 5, // equals BatteryProperty.ENERGY_COUNTER constant
+ BATTERY_PROP_CHARGE_COUNTER = 1, // equals BATTERY_PROPERTY_CHARGE_COUNTER
+ BATTERY_PROP_CURRENT_NOW = 2, // equals BATTERY_PROPERTY_CURRENT_NOW
+ BATTERY_PROP_CURRENT_AVG = 3, // equals BATTERY_PROPERTY_CURRENT_AVERAGE
+ BATTERY_PROP_CAPACITY = 4, // equals BATTERY_PROPERTY_CAPACITY
+ BATTERY_PROP_ENERGY_COUNTER = 5, // equals BATTERY_PROPERTY_ENERGY_COUNTER
+ BATTERY_PROP_BATTERY_STATUS = 6, // equals BATTERY_PROPERTY_BATTERY_STATUS
};
struct BatteryProperties {
diff --git a/include/gui/GraphicBufferAlloc.h b/include/gui/GraphicBufferAlloc.h
index b19a1ac..9e18907 100644
--- a/include/gui/GraphicBufferAlloc.h
+++ b/include/gui/GraphicBufferAlloc.h
@@ -35,8 +35,8 @@
virtual ~GraphicBufferAlloc();
virtual sp<GraphicBuffer> createGraphicBuffer(uint32_t width,
uint32_t height, PixelFormat format, uint32_t layerCount,
- uint32_t usage, std::string requestorName,
- status_t* error) override;
+ uint64_t producerUsage, uint64_t consumerUsage,
+ std::string requestorName, status_t* error) override;
};
diff --git a/include/gui/IGraphicBufferAlloc.h b/include/gui/IGraphicBufferAlloc.h
index 2a7690a..1e578cc 100644
--- a/include/gui/IGraphicBufferAlloc.h
+++ b/include/gui/IGraphicBufferAlloc.h
@@ -38,14 +38,29 @@
/* Create a new GraphicBuffer for the client to use.
*/
virtual sp<GraphicBuffer> createGraphicBuffer(uint32_t w, uint32_t h,
- PixelFormat format, uint32_t layerCount, uint32_t usage,
- std::string requestorName, status_t* error) = 0;
+ PixelFormat format, uint32_t layerCount, uint64_t producerUsage,
+ uint64_t consumerUsage, std::string requestorName,
+ status_t* error) = 0;
sp<GraphicBuffer> createGraphicBuffer(uint32_t w, uint32_t h,
PixelFormat format, uint32_t layerCount, uint32_t usage,
status_t* error) {
- return createGraphicBuffer(w, h, format, layerCount, usage, "<Unknown>",
- error);
+ return createGraphicBuffer(w, h, format, layerCount, usage,
+ usage, "<Unknown>", error);
+ }
+
+ sp<GraphicBuffer> createGraphicBuffer(uint32_t w, uint32_t h,
+ PixelFormat format, uint32_t layerCount, uint32_t usage,
+ std::string requestorName, status_t* error) {
+ return createGraphicBuffer(w, h, format, layerCount, usage,
+ usage, requestorName, error);
+ }
+
+ sp<GraphicBuffer> createGraphicBuffer(uint32_t w, uint32_t h,
+ PixelFormat format, uint32_t layerCount, uint64_t producerUsage,
+ uint64_t consumerUsage, status_t* error) {
+ return createGraphicBuffer(w, h, format, layerCount, producerUsage,
+ consumerUsage, "<Unknown>", error);
}
};
diff --git a/include/ui/Gralloc1.h b/include/ui/Gralloc1.h
index 64dacd7..640e29c 100644
--- a/include/ui/Gralloc1.h
+++ b/include/ui/Gralloc1.h
@@ -88,8 +88,6 @@
std::shared_ptr<Descriptor> createDescriptor();
- gralloc1_error_t getStride(buffer_handle_t buffer, uint32_t* outStride);
-
gralloc1_error_t allocate(
const std::vector<std::shared_ptr<const Descriptor>>& descriptors,
std::vector<buffer_handle_t>* outBuffers);
@@ -102,6 +100,19 @@
gralloc1_error_t release(buffer_handle_t buffer);
+ gralloc1_error_t getDimensions(buffer_handle_t buffer,
+ uint32_t* outWidth, uint32_t* outHeight);
+ gralloc1_error_t getFormat(buffer_handle_t buffer,
+ int32_t* outFormat);
+ gralloc1_error_t getLayerCount(buffer_handle_t buffer,
+ uint32_t* outLayerCount);
+ gralloc1_error_t getProducerUsage(buffer_handle_t buffer,
+ uint64_t* outProducerUsage);
+ gralloc1_error_t getConsumerUsage(buffer_handle_t buffer,
+ uint64_t* outConsumerUsage);
+ gralloc1_error_t getBackingStore(buffer_handle_t buffer,
+ uint64_t* outBackingStore);
+ gralloc1_error_t getStride(buffer_handle_t buffer, uint32_t* outStride);
gralloc1_error_t getNumFlexPlanes(buffer_handle_t buffer,
uint32_t* outNumPlanes);
diff --git a/include/ui/Gralloc1On0Adapter.h b/include/ui/Gralloc1On0Adapter.h
index 2508ce9..fcd2245 100644
--- a/include/ui/Gralloc1On0Adapter.h
+++ b/include/ui/Gralloc1On0Adapter.h
@@ -325,7 +325,7 @@
auto usage = GRALLOC1_CONSUMER_USAGE_NONE;
auto error = callBufferFunction(device, bufferHandle,
&Buffer::getConsumerUsage, &usage);
- if (error != GRALLOC1_ERROR_NONE) {
+ if (error == GRALLOC1_ERROR_NONE) {
*outUsage = static_cast<uint64_t>(usage);
}
return error;
@@ -336,7 +336,7 @@
auto usage = GRALLOC1_PRODUCER_USAGE_NONE;
auto error = callBufferFunction(device, bufferHandle,
&Buffer::getProducerUsage, &usage);
- if (error != GRALLOC1_ERROR_NONE) {
+ if (error == GRALLOC1_ERROR_NONE) {
*outUsage = static_cast<uint64_t>(usage);
}
return error;
diff --git a/include/ui/GrallocMapper.h b/include/ui/GrallocMapper.h
index f533dfb..5a23b68 100644
--- a/include/ui/GrallocMapper.h
+++ b/include/ui/GrallocMapper.h
@@ -45,17 +45,23 @@
Error retain(buffer_handle_t handle) const;
void release(buffer_handle_t handle) const;
+ Error getDimensions(buffer_handle_t handle,
+ uint32_t* outWidth, uint32_t* outHeight) const;
+ Error getFormat(buffer_handle_t handle, int32_t* outFormat) const;
+ Error getLayerCount(buffer_handle_t handle, uint32_t* outLayerCount) const;
+ Error getProducerUsage(buffer_handle_t handle,
+ uint64_t* outProducerUsage) const;
+ Error getConsumerUsage(buffer_handle_t handle,
+ uint64_t* outConsumerUsage) const;
+ Error getBackingStore(buffer_handle_t handle,
+ uint64_t* outBackingStore) const;
Error getStride(buffer_handle_t handle, uint32_t* outStride) const;
- Error lock(buffer_handle_t handle,
- uint64_t producerUsageMask,
- uint64_t consumerUsageMask,
- const IMapper::Rect& accessRegion,
+ Error lock(buffer_handle_t handle, uint64_t producerUsage,
+ uint64_t consumerUsage, const IMapper::Rect& accessRegion,
int acquireFence, void** outData) const;
- Error lock(buffer_handle_t handle,
- uint64_t producerUsageMask,
- uint64_t consumerUsageMask,
- const IMapper::Rect& accessRegion,
+ Error lock(buffer_handle_t handle, uint64_t producerUsage,
+ uint64_t consumerUsage, const IMapper::Rect& accessRegion,
int acquireFence, FlexLayout* outLayout) const;
int unlock(buffer_handle_t handle) const;
diff --git a/include/ui/GraphicBuffer.h b/include/ui/GraphicBuffer.h
index 1bbcee2..54f4cd3 100644
--- a/include/ui/GraphicBuffer.h
+++ b/include/ui/GraphicBuffer.h
@@ -81,6 +81,11 @@
uint32_t inLayerCount, uint32_t inUsage,
std::string requestorName = "<Unknown>");
+ // creates w * h buffer with a layer count using gralloc1
+ GraphicBuffer(uint32_t inWidth, uint32_t inHeight, PixelFormat inFormat,
+ uint32_t inLayerCount, uint64_t inProducerUsage,
+ uint64_t inConsumerUsage, std::string requestorName = "<Unknown>");
+
// create a buffer from an existing handle
GraphicBuffer(uint32_t inWidth, uint32_t inHeight, PixelFormat inFormat,
uint32_t inLayerCount, uint32_t inUsage, uint32_t inStride,
@@ -122,6 +127,8 @@
status_t lockAsync(uint32_t inUsage, void** vaddr, int fenceFd);
status_t lockAsync(uint32_t inUsage, const Rect& rect, void** vaddr,
int fenceFd);
+ status_t lockAsync(uint64_t inProducerUsage, uint64_t inConsumerUsage,
+ const Rect& rect, void** vaddr, int fenceFd);
status_t lockAsyncYCbCr(uint32_t inUsage, android_ycbcr *ycbcr,
int fenceFd);
status_t lockAsyncYCbCr(uint32_t inUsage, const Rect& rect,
@@ -166,7 +173,8 @@
const GraphicBuffer& operator = (const GraphicBuffer& rhs) const;
status_t initSize(uint32_t inWidth, uint32_t inHeight, PixelFormat inFormat,
- uint32_t inLayerCount, uint32_t inUsage, std::string requestorName);
+ uint32_t inLayerCount, uint64_t inProducerUsage,
+ uint64_t inConsumerUsage, std::string requestorName);
void free_handle();
diff --git a/include/ui/GraphicBufferAllocator.h b/include/ui/GraphicBufferAllocator.h
index 16967d4..2ccc44b 100644
--- a/include/ui/GraphicBufferAllocator.h
+++ b/include/ui/GraphicBufferAllocator.h
@@ -65,8 +65,8 @@
static inline GraphicBufferAllocator& get() { return getInstance(); }
status_t allocate(uint32_t w, uint32_t h, PixelFormat format,
- uint32_t layerCount, uint32_t usage, buffer_handle_t* handle,
- uint32_t* stride, uint64_t graphicBufferId,
+ uint32_t layerCount, uint64_t producerUsage, uint64_t consumerUsage,
+ buffer_handle_t* handle, uint32_t* stride, uint64_t graphicBufferId,
std::string requestorName);
status_t free(buffer_handle_t handle);
@@ -81,7 +81,8 @@
uint32_t stride;
PixelFormat format;
uint32_t layerCount;
- uint32_t usage;
+ uint64_t producerUsage;
+ uint64_t consumerUsage;
size_t size;
std::string requestorName;
};
diff --git a/include/ui/GraphicBufferMapper.h b/include/ui/GraphicBufferMapper.h
index b6de1b2..8e93f72 100644
--- a/include/ui/GraphicBufferMapper.h
+++ b/include/ui/GraphicBufferMapper.h
@@ -44,6 +44,25 @@
status_t unregisterBuffer(buffer_handle_t handle);
+ status_t getDimensions(buffer_handle_t handle,
+ uint32_t* outWidth, uint32_t* outHeight) const;
+
+ status_t getFormat(buffer_handle_t handle, int32_t* outFormat) const;
+
+ status_t getLayerCount(buffer_handle_t handle,
+ uint32_t* outLayerCount) const;
+
+ status_t getProducerUsage(buffer_handle_t handle,
+ uint64_t* outProducerUsage) const;
+
+ status_t getConsumerUsage(buffer_handle_t handle,
+ uint64_t* outConsumerUsage) const;
+
+ status_t getBackingStore(buffer_handle_t handle,
+ uint64_t* outBackingStore) const;
+
+ status_t getStride(buffer_handle_t handle, uint32_t* outStride) const;
+
status_t lock(buffer_handle_t handle,
uint32_t usage, const Rect& bounds, void** vaddr);
@@ -55,6 +74,10 @@
status_t lockAsync(buffer_handle_t handle,
uint32_t usage, const Rect& bounds, void** vaddr, int fenceFd);
+ status_t lockAsync(buffer_handle_t handle,
+ uint64_t producerUsage, uint64_t consumerUsage, const Rect& bounds,
+ void** vaddr, int fenceFd);
+
status_t lockAsyncYCbCr(buffer_handle_t handle,
uint32_t usage, const Rect& bounds, android_ycbcr *ycbcr,
int fenceFd);
diff --git a/libs/gui/GraphicBufferAlloc.cpp b/libs/gui/GraphicBufferAlloc.cpp
index 30f5e53..f2d3677 100644
--- a/libs/gui/GraphicBufferAlloc.cpp
+++ b/libs/gui/GraphicBufferAlloc.cpp
@@ -33,9 +33,10 @@
sp<GraphicBuffer> GraphicBufferAlloc::createGraphicBuffer(uint32_t width,
uint32_t height, PixelFormat format, uint32_t layerCount,
- uint32_t usage, std::string requestorName, status_t* error) {
+ uint64_t producerUsage, uint64_t consumerUsage,
+ std::string requestorName, status_t* error) {
sp<GraphicBuffer> graphicBuffer(new GraphicBuffer(
- width, height, format, layerCount, usage,
+ width, height, format, layerCount, producerUsage, consumerUsage,
std::move(requestorName)));
status_t err = graphicBuffer->initCheck();
*error = err;
diff --git a/libs/gui/IGraphicBufferAlloc.cpp b/libs/gui/IGraphicBufferAlloc.cpp
index a3d3b74..21a0dd5 100644
--- a/libs/gui/IGraphicBufferAlloc.cpp
+++ b/libs/gui/IGraphicBufferAlloc.cpp
@@ -46,14 +46,16 @@
virtual sp<GraphicBuffer> createGraphicBuffer(uint32_t width,
uint32_t height, PixelFormat format, uint32_t layerCount,
- uint32_t usage, std::string requestorName, status_t* error) {
+ uint64_t producerUsage, uint64_t consumerUsage,
+ std::string requestorName, status_t* error) {
Parcel data, reply;
data.writeInterfaceToken(IGraphicBufferAlloc::getInterfaceDescriptor());
data.writeUint32(width);
data.writeUint32(height);
data.writeInt32(static_cast<int32_t>(format));
data.writeUint32(layerCount);
- data.writeUint32(usage);
+ data.writeUint64(producerUsage);
+ data.writeUint64(consumerUsage);
if (requestorName.empty()) {
requestorName += "[PID ";
requestorName += std::to_string(getpid());
@@ -108,12 +110,14 @@
uint32_t height = data.readUint32();
PixelFormat format = static_cast<PixelFormat>(data.readInt32());
uint32_t layerCount = data.readUint32();
- uint32_t usage = data.readUint32();
+ uint64_t producerUsage = data.readUint64();
+ uint64_t consumerUsage = data.readUint64();
status_t error = NO_ERROR;
std::string requestorName;
data.readUtf8FromUtf16(&requestorName);
sp<GraphicBuffer> result = createGraphicBuffer(width, height,
- format, layerCount, usage, requestorName, &error);
+ format, layerCount, producerUsage, consumerUsage,
+ requestorName, &error);
reply->writeInt32(error);
if (result != 0) {
reply->write(*result);
diff --git a/libs/ui/Gralloc1.cpp b/libs/ui/Gralloc1.cpp
index 367d1ce..0083f58 100644
--- a/libs/ui/Gralloc1.cpp
+++ b/libs/ui/Gralloc1.cpp
@@ -140,12 +140,6 @@
return descriptor;
}
-gralloc1_error_t Device::getStride(buffer_handle_t buffer, uint32_t* outStride)
-{
- int32_t intError = mFunctions.getStride(mDevice, buffer, outStride);
- return static_cast<gralloc1_error_t>(intError);
-}
-
static inline bool allocationSucceded(gralloc1_error_t error)
{
return error == GRALLOC1_ERROR_NONE || error == GRALLOC1_ERROR_NOT_SHARED;
@@ -225,6 +219,99 @@
return static_cast<gralloc1_error_t>(intError);
}
+gralloc1_error_t Device::getDimensions(buffer_handle_t buffer,
+ uint32_t* outWidth, uint32_t* outHeight)
+{
+ uint32_t width = 0;
+ uint32_t height = 0;
+ int32_t intError = mFunctions.getDimensions(mDevice, buffer, &width,
+ &height);
+ auto error = static_cast<gralloc1_error_t>(intError);
+ if (error == GRALLOC1_ERROR_NONE) {
+ *outWidth = width;
+ *outHeight = height;
+ }
+ return error;
+}
+
+gralloc1_error_t Device::getFormat(buffer_handle_t buffer,
+ int32_t* outFormat)
+{
+ int32_t format = 0;
+ int32_t intError = mFunctions.getFormat(mDevice, buffer, &format);
+ auto error = static_cast<gralloc1_error_t>(intError);
+ if (error == GRALLOC1_ERROR_NONE) {
+ *outFormat = format;
+ }
+ return error;
+}
+
+gralloc1_error_t Device::getLayerCount(buffer_handle_t buffer,
+ uint32_t* outLayerCount)
+{
+ if (hasCapability(GRALLOC1_CAPABILITY_LAYERED_BUFFERS)) {
+ uint32_t layerCount = 0;
+ int32_t intError = mFunctions.getLayerCount(mDevice, buffer,
+ &layerCount);
+ auto error = static_cast<gralloc1_error_t>(intError);
+ if (error == GRALLOC1_ERROR_NONE) {
+ *outLayerCount = layerCount;
+ }
+ return error;
+ } else {
+ // Layered buffers are not supported on this device.
+ return GRALLOC1_ERROR_UNSUPPORTED;
+ }
+}
+
+gralloc1_error_t Device::getProducerUsage(buffer_handle_t buffer,
+ uint64_t* outProducerUsage)
+{
+ uint64_t usage = 0;
+ int32_t intError = mFunctions.getProducerUsage(mDevice, buffer, &usage);
+ auto error = static_cast<gralloc1_error_t>(intError);
+ if (error == GRALLOC1_ERROR_NONE) {
+ *outProducerUsage = usage;
+ }
+ return error;
+}
+
+gralloc1_error_t Device::getConsumerUsage(buffer_handle_t buffer,
+ uint64_t* outConsumerUsage)
+{
+ uint64_t usage = 0;
+ int32_t intError = mFunctions.getConsumerUsage(mDevice, buffer, &usage);
+ auto error = static_cast<gralloc1_error_t>(intError);
+ if (error == GRALLOC1_ERROR_NONE) {
+ *outConsumerUsage = usage;
+ }
+ return error;
+}
+
+gralloc1_error_t Device::getBackingStore(buffer_handle_t buffer,
+ uint64_t* outBackingStore)
+{
+ uint64_t store = 0;
+ int32_t intError = mFunctions.getBackingStore(mDevice, buffer, &store);
+ auto error = static_cast<gralloc1_error_t>(intError);
+ if (error == GRALLOC1_ERROR_NONE) {
+ *outBackingStore = store;
+ }
+ return error;
+}
+
+gralloc1_error_t Device::getStride(buffer_handle_t buffer,
+ uint32_t* outStride)
+{
+ uint32_t stride = 0;
+ int32_t intError = mFunctions.getStride(mDevice, buffer, &stride);
+ auto error = static_cast<gralloc1_error_t>(intError);
+ if (error == GRALLOC1_ERROR_NONE) {
+ *outStride = stride;
+ }
+ return error;
+}
+
gralloc1_error_t Device::getNumFlexPlanes(buffer_handle_t buffer,
uint32_t* outNumPlanes)
{
@@ -244,7 +331,7 @@
const sp<Fence>& acquireFence)
{
ALOGV("Calling lock(%p)", buffer);
- return lockHelper(mFunctions.lock.pfn, buffer, producerUsage,
+ return lockHelper(mFunctions.lock, buffer, producerUsage,
consumerUsage, accessRegion, outData, acquireFence);
}
@@ -256,7 +343,7 @@
const sp<Fence>& acquireFence)
{
ALOGV("Calling lockFlex(%p)", buffer);
- return lockHelper(mFunctions.lockFlex.pfn, buffer, producerUsage,
+ return lockHelper(mFunctions.lockFlex, buffer, producerUsage,
consumerUsage, accessRegion, outData, acquireFence);
}
@@ -268,7 +355,7 @@
const sp<Fence>& acquireFence)
{
ALOGV("Calling lockYCbCr(%p)", buffer);
- return lockHelper(mFunctions.lockYCbCr.pfn, buffer, producerUsage,
+ return lockHelper(mFunctions.lockYCbCr, buffer, producerUsage,
consumerUsage, accessRegion, outData, acquireFence);
}
diff --git a/libs/ui/GrallocMapper.cpp b/libs/ui/GrallocMapper.cpp
index 7ee01ad..b9e9040 100644
--- a/libs/ui/GrallocMapper.cpp
+++ b/libs/ui/GrallocMapper.cpp
@@ -51,6 +51,115 @@
"release(%p) failed with %d", handle, error);
}
+Error Mapper::getDimensions(buffer_handle_t handle,
+ uint32_t* outWidth, uint32_t* outHeight) const
+{
+ Error error = kDefaultError;
+ mMapper->getDimensions(handle,
+ [&](const auto& tmpError, const auto& tmpWidth,
+ const auto& tmpHeight)
+ {
+ error = tmpError;
+ if (error != Error::NONE) {
+ return;
+ }
+
+ *outWidth = tmpWidth;
+ *outHeight = tmpHeight;
+ });
+
+ return error;
+}
+
+Error Mapper::getFormat(buffer_handle_t handle, int32_t* outFormat) const
+{
+ Error error = kDefaultError;
+ mMapper->getFormat(handle,
+ [&](const auto& tmpError, const auto& tmpFormat)
+ {
+ error = tmpError;
+ if (error != Error::NONE) {
+ return;
+ }
+
+ *outFormat = static_cast<int32_t>(tmpFormat);
+ });
+
+ return error;
+}
+
+Error Mapper::getLayerCount(buffer_handle_t handle,
+ uint32_t* outLayerCount) const
+{
+ Error error = kDefaultError;
+ mMapper->getLayerCount(handle,
+ [&](const auto& tmpError, const auto& tmpLayerCount)
+ {
+ error = tmpError;
+ if (error != Error::NONE) {
+ return;
+ }
+
+ *outLayerCount = tmpLayerCount;
+ });
+
+ return error;
+}
+
+Error Mapper::getProducerUsage(buffer_handle_t handle,
+ uint64_t* outProducerUsage) const
+{
+ Error error = kDefaultError;
+ mMapper->getProducerUsageMask(handle,
+ [&](const auto& tmpError, const auto& tmpProducerUsage)
+ {
+ error = tmpError;
+ if (error != Error::NONE) {
+ return;
+ }
+
+ *outProducerUsage = tmpProducerUsage;
+ });
+
+ return error;
+}
+
+Error Mapper::getConsumerUsage(buffer_handle_t handle,
+ uint64_t* outConsumerUsage) const
+{
+ Error error = kDefaultError;
+ mMapper->getConsumerUsageMask(handle,
+ [&](const auto& tmpError, const auto& tmpConsumerUsage)
+ {
+ error = tmpError;
+ if (error != Error::NONE) {
+ return;
+ }
+
+ *outConsumerUsage = tmpConsumerUsage;
+ });
+
+ return error;
+}
+
+Error Mapper::getBackingStore(buffer_handle_t handle,
+ uint64_t* outBackingStore) const
+{
+ Error error = kDefaultError;
+ mMapper->getBackingStore(handle,
+ [&](const auto& tmpError, const auto& tmpStore)
+ {
+ error = tmpError;
+ if (error != Error::NONE) {
+ return;
+ }
+
+ *outBackingStore = tmpStore;
+ });
+
+ return error;
+}
+
Error Mapper::getStride(buffer_handle_t handle, uint32_t* outStride) const
{
Error error = kDefaultError;
@@ -69,8 +178,8 @@
}
Error Mapper::lock(buffer_handle_t handle,
- uint64_t producerUsageMask,
- uint64_t consumerUsageMask,
+ uint64_t producerUsage,
+ uint64_t consumerUsage,
const IMapper::Rect& accessRegion,
int acquireFence, void** outData) const
{
@@ -84,7 +193,7 @@
}
Error error = kDefaultError;
- mMapper->lock(handle, producerUsageMask, consumerUsageMask,
+ mMapper->lock(handle, producerUsage, consumerUsage,
accessRegion, acquireFenceHandle,
[&](const auto& tmpError, const auto& tmpData)
{
@@ -104,8 +213,8 @@
}
Error Mapper::lock(buffer_handle_t handle,
- uint64_t producerUsageMask,
- uint64_t consumerUsageMask,
+ uint64_t producerUsage,
+ uint64_t consumerUsage,
const IMapper::Rect& accessRegion,
int acquireFence, FlexLayout* outLayout) const
{
@@ -119,7 +228,7 @@
}
Error error = kDefaultError;
- mMapper->lockFlex(handle, producerUsageMask, consumerUsageMask,
+ mMapper->lockFlex(handle, producerUsage, consumerUsage,
accessRegion, acquireFenceHandle,
[&](const auto& tmpError, const auto& tmpLayout)
{
diff --git a/libs/ui/GraphicBuffer.cpp b/libs/ui/GraphicBuffer.cpp
index 07164a4..d29bae1 100644
--- a/libs/ui/GraphicBuffer.cpp
+++ b/libs/ui/GraphicBuffer.cpp
@@ -67,13 +67,13 @@
layerCount =
usage = 0;
handle = NULL;
- mInitCheck = initSize(inWidth, inHeight, inFormat, 1, inUsage,
+ mInitCheck = initSize(inWidth, inHeight, inFormat, 1, inUsage, inUsage,
std::move(requestorName));
}
GraphicBuffer::GraphicBuffer(uint32_t inWidth, uint32_t inHeight,
- PixelFormat inFormat, uint32_t inLayerCount, uint32_t inUsage,
- std::string requestorName)
+ PixelFormat inFormat, uint32_t inLayerCount, uint64_t producerUsage,
+ uint64_t consumerUsage, std::string requestorName)
: BASE(), mOwner(ownData), mBufferMapper(GraphicBufferMapper::get()),
mInitCheck(NO_ERROR), mId(getUniqueId()), mGenerationNumber(0)
{
@@ -84,8 +84,8 @@
layerCount =
usage = 0;
handle = NULL;
- mInitCheck = initSize(inWidth, inHeight, inFormat, inLayerCount, inUsage,
- std::move(requestorName));
+ mInitCheck = initSize(inWidth, inHeight, inFormat, inLayerCount,
+ producerUsage, consumerUsage, std::move(requestorName));
}
GraphicBuffer::GraphicBuffer(uint32_t inWidth, uint32_t inHeight,
@@ -177,7 +177,7 @@
allocator.free(handle);
handle = 0;
}
- return initSize(inWidth, inHeight, inFormat, inLayerCount, inUsage,
+ return initSize(inWidth, inHeight, inFormat, inLayerCount, inUsage, inUsage,
"[Reallocation]");
}
@@ -193,19 +193,20 @@
}
status_t GraphicBuffer::initSize(uint32_t inWidth, uint32_t inHeight,
- PixelFormat inFormat, uint32_t inLayerCount, uint32_t inUsage,
- std::string requestorName)
+ PixelFormat inFormat, uint32_t inLayerCount, uint64_t inProducerUsage,
+ uint64_t inConsumerUsage, std::string requestorName)
{
GraphicBufferAllocator& allocator = GraphicBufferAllocator::get();
uint32_t outStride = 0;
status_t err = allocator.allocate(inWidth, inHeight, inFormat, inLayerCount,
- inUsage, &handle, &outStride, mId, std::move(requestorName));
+ inProducerUsage, inConsumerUsage, &handle, &outStride, mId,
+ std::move(requestorName));
if (err == NO_ERROR) {
width = static_cast<int>(inWidth);
height = static_cast<int>(inHeight);
format = inFormat;
layerCount = inLayerCount;
- usage = static_cast<int>(inUsage);
+ usage = static_cast<int>(inProducerUsage | inConsumerUsage);
stride = static_cast<int>(outStride);
}
return err;
@@ -268,6 +269,12 @@
status_t GraphicBuffer::lockAsync(uint32_t inUsage, const Rect& rect,
void** vaddr, int fenceFd)
{
+ return lockAsync(inUsage, inUsage, rect, vaddr, fenceFd);
+}
+
+status_t GraphicBuffer::lockAsync(uint64_t inProducerUsage,
+ uint64_t inConsumerUsage, const Rect& rect, void** vaddr, int fenceFd)
+{
if (rect.left < 0 || rect.right > width ||
rect.top < 0 || rect.bottom > height) {
ALOGE("locking pixels (%d,%d,%d,%d) outside of buffer (w=%d, h=%d)",
@@ -275,8 +282,8 @@
width, height);
return BAD_VALUE;
}
- status_t res = getBufferMapper().lockAsync(handle, inUsage, rect, vaddr,
- fenceFd);
+ status_t res = getBufferMapper().lockAsync(handle, inProducerUsage,
+ inConsumerUsage, rect, vaddr, fenceFd);
return res;
}
diff --git a/libs/ui/GraphicBufferAllocator.cpp b/libs/ui/GraphicBufferAllocator.cpp
index 07ad4c1..b14110e 100644
--- a/libs/ui/GraphicBufferAllocator.cpp
+++ b/libs/ui/GraphicBufferAllocator.cpp
@@ -63,15 +63,19 @@
for (size_t i=0 ; i<c ; i++) {
const alloc_rec_t& rec(list.valueAt(i));
if (rec.size) {
- snprintf(buffer, SIZE, "%10p: %7.2f KiB | %4u (%4u) x %4u | %4u | %8X | 0x%08x | %s\n",
+ snprintf(buffer, SIZE, "%10p: %7.2f KiB | %4u (%4u) x %4u | %4u | %8X | 0x%" PRIx64
+ ", 0x%" PRIx64 " | %s\n",
list.keyAt(i), rec.size/1024.0,
rec.width, rec.stride, rec.height, rec.layerCount, rec.format,
- rec.usage, rec.requestorName.c_str());
+ rec.producerUsage, rec.consumerUsage,
+ rec.requestorName.c_str());
} else {
- snprintf(buffer, SIZE, "%10p: unknown | %4u (%4u) x %4u | %4u | %8X | 0x%08x | %s\n",
+ snprintf(buffer, SIZE, "%10p: unknown | %4u (%4u) x %4u | %4u | %8X | 0x%" PRIx64
+ ", 0x%" PRIx64 " | %s\n",
list.keyAt(i),
rec.width, rec.stride, rec.height, rec.layerCount, rec.format,
- rec.usage, rec.requestorName.c_str());
+ rec.producerUsage, rec.consumerUsage,
+ rec.requestorName.c_str());
}
result.append(buffer);
total += rec.size;
@@ -102,7 +106,8 @@
public:
HalBuffer(const Gralloc2::Allocator* allocator,
uint32_t width, uint32_t height,
- PixelFormat format, uint32_t layerCount, uint32_t usage)
+ PixelFormat format, uint32_t layerCount, uint64_t producerUsage,
+ uint64_t consumerUsage)
: mAllocator(allocator), mBufferValid(false)
{
Gralloc2::IAllocatorClient::BufferDescriptorInfo info = {};
@@ -110,14 +115,16 @@
info.height = height;
info.format = static_cast<Gralloc2::PixelFormat>(format);
info.layerCount = layerCount;
- info.producerUsageMask = usage;
- info.consumerUsageMask = usage;
+ info.producerUsageMask = producerUsage;
+ info.consumerUsageMask = consumerUsage;
Gralloc2::BufferDescriptor descriptor;
auto error = mAllocator->createBufferDescriptor(info, &descriptor);
if (error != Gralloc2::Error::NONE) {
- ALOGE("Failed to create desc (%u x %u) layerCount %u format %d usage %u: %d",
- width, height, layerCount, format, usage, error);
+ ALOGE("Failed to create desc (%u x %u) layerCount %u format %d producerUsage %" PRIx64
+ " consumerUsage %" PRIx64 ": %d",
+ width, height, layerCount, format, producerUsage,
+ consumerUsage, error);
return;
}
@@ -127,8 +134,10 @@
}
if (error != Gralloc2::Error::NONE) {
- ALOGE("Failed to allocate (%u x %u) layerCount %u format %d usage %u: %d",
- width, height, layerCount, format, usage, error);
+ ALOGE("Failed to allocate (%u x %u) layerCount %u format %d producerUsage %" PRIx64
+ " consumerUsage %" PRIx64 ": %d",
+ width, height, layerCount, format, producerUsage,
+ consumerUsage, error);
mAllocator->destroyBufferDescriptor(descriptor);
return;
}
@@ -195,9 +204,9 @@
} // namespace
status_t GraphicBufferAllocator::allocate(uint32_t width, uint32_t height,
- PixelFormat format, uint32_t layerCount, uint32_t usage,
- buffer_handle_t* handle, uint32_t* stride, uint64_t graphicBufferId,
- std::string requestorName)
+ PixelFormat format, uint32_t layerCount, uint64_t producerUsage,
+ uint64_t consumerUsage, buffer_handle_t* handle, uint32_t* stride,
+ uint64_t graphicBufferId, std::string requestorName)
{
ATRACE_CALL();
@@ -210,13 +219,10 @@
if (layerCount < 1)
layerCount = 1;
- // Filter out any usage bits that should not be passed to the gralloc module
- usage &= GRALLOC_USAGE_ALLOC_MASK;
-
gralloc1_error_t error;
if (mAllocator->valid()) {
HalBuffer buffer(mAllocator.get(), width, height, format, layerCount,
- usage);
+ producerUsage, consumerUsage);
if (!buffer.exportHandle(mMapper, handle, stride)) {
return NO_MEMORY;
}
@@ -247,22 +253,26 @@
return BAD_VALUE;
}
error = descriptor->setProducerUsage(
- static_cast<gralloc1_producer_usage_t>(usage));
+ static_cast<gralloc1_producer_usage_t>(producerUsage));
if (error != GRALLOC1_ERROR_NONE) {
- ALOGE("Failed to set producer usage to %u: %d", usage, error);
+ ALOGE("Failed to set producer usage to %" PRIx64 ": %d",
+ producerUsage, error);
return BAD_VALUE;
}
error = descriptor->setConsumerUsage(
- static_cast<gralloc1_consumer_usage_t>(usage));
+ static_cast<gralloc1_consumer_usage_t>(consumerUsage));
if (error != GRALLOC1_ERROR_NONE) {
- ALOGE("Failed to set consumer usage to %u: %d", usage, error);
+ ALOGE("Failed to set consumer usage to %" PRIx64 ": %d",
+ consumerUsage, error);
return BAD_VALUE;
}
error = mDevice->allocate(descriptor, graphicBufferId, handle);
if (error != GRALLOC1_ERROR_NONE) {
- ALOGE("Failed to allocate (%u x %u) layerCount %u format %d usage %u: %d",
- width, height, layerCount, format, usage, error);
+ ALOGE("Failed to allocate (%u x %u) layerCount %u format %d "
+ "producerUsage %" PRIx64 " consumerUsage %" PRIx64 ": %d",
+ width, height, layerCount, format, producerUsage,
+ consumerUsage, error);
return NO_MEMORY;
}
@@ -282,7 +292,8 @@
rec.stride = *stride;
rec.format = format;
rec.layerCount = layerCount;
- rec.usage = usage;
+ rec.producerUsage = producerUsage;
+ rec.consumerUsage = consumerUsage;
rec.size = static_cast<size_t>(height * (*stride) * bpp);
rec.requestorName = std::move(requestorName);
list.add(*handle, rec);
diff --git a/libs/ui/GraphicBufferMapper.cpp b/libs/ui/GraphicBufferMapper.cpp
index 1ff934b..b0ed2df 100644
--- a/libs/ui/GraphicBufferMapper.cpp
+++ b/libs/ui/GraphicBufferMapper.cpp
@@ -117,6 +117,140 @@
return outRect;
}
+
+status_t GraphicBufferMapper::getDimensions(buffer_handle_t handle,
+ uint32_t* outWidth, uint32_t* outHeight) const
+{
+ ATRACE_CALL();
+
+ gralloc1_error_t error;
+ if (mMapper->valid()) {
+ mMapper->getDimensions(handle, outWidth, outHeight);
+ error = GRALLOC1_ERROR_NONE;
+ } else {
+ error = mDevice->getDimensions(handle, outWidth, outHeight);
+ }
+
+ ALOGW_IF(error != GRALLOC1_ERROR_NONE, "getDimensions(%p, ...): failed %d",
+ handle, error);
+
+ return error;
+}
+
+status_t GraphicBufferMapper::getFormat(buffer_handle_t handle,
+ int32_t* outFormat) const
+{
+ ATRACE_CALL();
+
+ gralloc1_error_t error;
+ if (mMapper->valid()) {
+ mMapper->getFormat(handle, outFormat);
+ error = GRALLOC1_ERROR_NONE;
+ } else {
+ error = mDevice->getFormat(handle, outFormat);
+ }
+
+ ALOGW_IF(error != GRALLOC1_ERROR_NONE, "getFormat(%p, ...): failed %d",
+ handle, error);
+
+ return error;
+}
+
+status_t GraphicBufferMapper::getLayerCount(buffer_handle_t handle,
+ uint32_t* outLayerCount) const
+{
+ ATRACE_CALL();
+
+ gralloc1_error_t error;
+ if (mMapper->valid()) {
+ mMapper->getLayerCount(handle, outLayerCount);
+ error = GRALLOC1_ERROR_NONE;
+ } else {
+ error = mDevice->getLayerCount(handle, outLayerCount);
+ }
+
+ ALOGW_IF(error != GRALLOC1_ERROR_NONE, "getLayerCount(%p, ...): failed %d",
+ handle, error);
+
+ return error;
+}
+
+status_t GraphicBufferMapper::getProducerUsage(buffer_handle_t handle,
+ uint64_t* outProducerUsage) const
+{
+ ATRACE_CALL();
+
+ gralloc1_error_t error;
+ if (mMapper->valid()) {
+ mMapper->getProducerUsage(handle, outProducerUsage);
+ error = GRALLOC1_ERROR_NONE;
+ } else {
+ error = mDevice->getProducerUsage(handle, outProducerUsage);
+ }
+
+ ALOGW_IF(error != GRALLOC1_ERROR_NONE,
+ "getProducerUsage(%p, ...): failed %d", handle, error);
+
+ return error;
+}
+
+status_t GraphicBufferMapper::getConsumerUsage(buffer_handle_t handle,
+ uint64_t* outConsumerUsage) const
+{
+ ATRACE_CALL();
+
+ gralloc1_error_t error;
+ if (mMapper->valid()) {
+ mMapper->getConsumerUsage(handle, outConsumerUsage);
+ error = GRALLOC1_ERROR_NONE;
+ } else {
+ error = mDevice->getConsumerUsage(handle, outConsumerUsage);
+ }
+
+ ALOGW_IF(error != GRALLOC1_ERROR_NONE,
+ "getConsumerUsage(%p, ...): failed %d", handle, error);
+
+ return error;
+}
+
+status_t GraphicBufferMapper::getBackingStore(buffer_handle_t handle,
+ uint64_t* outBackingStore) const
+{
+ ATRACE_CALL();
+
+ gralloc1_error_t error;
+ if (mMapper->valid()) {
+ mMapper->getBackingStore(handle, outBackingStore);
+ error = GRALLOC1_ERROR_NONE;
+ } else {
+ error = mDevice->getBackingStore(handle, outBackingStore);
+ }
+
+ ALOGW_IF(error != GRALLOC1_ERROR_NONE,
+ "getBackingStore(%p, ...): failed %d", handle, error);
+
+ return error;
+}
+
+status_t GraphicBufferMapper::getStride(buffer_handle_t handle,
+ uint32_t* outStride) const
+{
+ ATRACE_CALL();
+
+ gralloc1_error_t error;
+ if (mMapper->valid()) {
+ mMapper->getStride(handle, outStride);
+ error = GRALLOC1_ERROR_NONE;
+ } else {
+ error = mDevice->getStride(handle, outStride);
+ }
+
+ ALOGW_IF(error != GRALLOC1_ERROR_NONE, "getStride(%p, ...): failed %d",
+ handle, error);
+
+ return error;
+}
+
status_t GraphicBufferMapper::lock(buffer_handle_t handle, uint32_t usage,
const Rect& bounds, void** vaddr)
{
@@ -143,6 +277,13 @@
status_t GraphicBufferMapper::lockAsync(buffer_handle_t handle,
uint32_t usage, const Rect& bounds, void** vaddr, int fenceFd)
{
+ return lockAsync(handle, usage, usage, bounds, vaddr, fenceFd);
+}
+
+status_t GraphicBufferMapper::lockAsync(buffer_handle_t handle,
+ uint64_t producerUsage, uint64_t consumerUsage, const Rect& bounds,
+ void** vaddr, int fenceFd)
+{
ATRACE_CALL();
gralloc1_rect_t accessRegion = asGralloc1Rect(bounds);
@@ -151,12 +292,13 @@
const Gralloc2::IMapper::Rect& accessRect =
*reinterpret_cast<Gralloc2::IMapper::Rect*>(&accessRegion);
error = static_cast<gralloc1_error_t>(mMapper->lock(
- handle, usage, usage, accessRect, fenceFd, vaddr));
+ handle, producerUsage, consumerUsage, accessRect,
+ fenceFd, vaddr));
} else {
sp<Fence> fence = new Fence(fenceFd);
error = mDevice->lock(handle,
- static_cast<gralloc1_producer_usage_t>(usage),
- static_cast<gralloc1_consumer_usage_t>(usage),
+ static_cast<gralloc1_producer_usage_t>(producerUsage),
+ static_cast<gralloc1_consumer_usage_t>(consumerUsage),
&accessRegion, vaddr, fence);
}
diff --git a/libs/vr/libgvr/Android.mk b/libs/vr/libgvr/Android.mk
index be78605..0daf2ea 100644
--- a/libs/vr/libgvr/Android.mk
+++ b/libs/vr/libgvr/Android.mk
@@ -19,10 +19,9 @@
# Java platform library for the system implementation of the GVR API.
include $(CLEAR_VARS)
-LOCAL_MODULE := gvr_platform
-LOCAL_MODULE_STEM := com.google.vr.gvr.platform
+LOCAL_MODULE := com.google.vr.gvr.platform
LOCAL_REQUIRED_MODULES := libgvr_system_loader libgvr_system
-LOCAL_SRC_FILES := $(call all-subdir-java-files)
+LOCAL_SRC_FILES := $(call all-java-files-under, java)
include $(BUILD_JAVA_LIBRARY)
# Library to perform dlopen on the actual platform library.
diff --git a/libs/vr/libgvr/java/com/google/vr/gvr/platform/Loader.java b/libs/vr/libgvr/java/com/google/vr/gvr/platform/Loader.java
index 5c5cc62..381175c 100644
--- a/libs/vr/libgvr/java/com/google/vr/gvr/platform/Loader.java
+++ b/libs/vr/libgvr/java/com/google/vr/gvr/platform/Loader.java
@@ -1,32 +1,38 @@
package com.google.vr.gvr.platform;
+import android.os.SystemProperties;
+
/**
* Auxiliary class to load the system implementation of the GVR API.
+ * @hide
*/
public class Loader {
- /**
- * Opens a shared library containing the system implementation for the GVR
- * API and returns the handle to it.
- *
- * @return A Long object describing the handle returned by dlopen.
- */
- public static Long loadLibrary() {
- // Note: we cannot safely do caller verifications here, so instead we do
- // them in the service side. This means that private API symbols will be
- // visible to any app adding the appropriate <uses-library> in their
- // manifest, but any requests to such APIs will fail if not done from a
- // trusted package like VrCore.
- //
- // Trusted packages are defined by (package name, signature) pairs in within
- // a system service, and both must match.
+ private static final String VR_MODE_BOOT = "ro.boot.vr";
- // Load a thin JNI library that runs dlopen on request.
- System.loadLibrary("gvr_system_loader");
+ /**
+ * Opens a shared library containing the system implementation for the GVR API and returns the
+ * handle to it.
+ *
+ * @return A Long object describing the handle returned by dlopen.
+ */
+ public static Long loadLibrary() {
+ // Note: caller verifications cannot be safely done here. Any app can find and use this API.
+ // Any sensitive functions must have appropriate checks on the service side.
- // Performs dlopen on the library and returns the handle.
- return nativeLoadLibrary("libgvr_system.so");
- }
+ // Load a thin JNI library that runs dlopen on request.
+ System.loadLibrary("gvr_system_loader");
- private static native long nativeLoadLibrary(String library);
+ // Performs dlopen on the library and returns the handle.
+ return nativeLoadLibrary("libgvr_system.so");
+ }
+
+ /**
+ * Returns true if this device boots directly in VR mode.
+ */
+ public static boolean getVrBoot() {
+ return SystemProperties.getBoolean(VR_MODE_BOOT, false);
+ }
+
+ private static native long nativeLoadLibrary(String library);
}
diff --git a/libs/vr/libvrflinger/display_surface.cpp b/libs/vr/libvrflinger/display_surface.cpp
index e1729f8..7c821bf 100644
--- a/libs/vr/libvrflinger/display_surface.cpp
+++ b/libs/vr/libvrflinger/display_surface.cpp
@@ -381,6 +381,15 @@
ATRACE_NAME("DisplaySurface::OnPostConsumer");
std::lock_guard<std::mutex> autolock(lock_);
+ if (!IsVisible()) {
+ ALOGD_IF(TRACE,
+ "DisplaySurface::OnPostConsumer: Discarding buffer_id=%d on "
+ "invisible surface.",
+ consumer->id());
+ consumer->Discard();
+ return;
+ }
+
if (posted_buffers_.IsFull()) {
ALOGE("Error: posted buffers full, overwriting");
posted_buffers_.PopBack();
diff --git a/opengl/libs/EGL/eglApi.cpp b/opengl/libs/EGL/eglApi.cpp
index 1672397..2782ed7 100644
--- a/opengl/libs/EGL/eglApi.cpp
+++ b/opengl/libs/EGL/eglApi.cpp
@@ -21,7 +21,7 @@
#include <stdlib.h>
#include <string.h>
-#include <hardware/gralloc.h>
+#include <hardware/gralloc1.h>
#include <system/window.h>
#include <EGL/egl.h>
@@ -1833,7 +1833,8 @@
{
clearError();
- int usage = 0;
+ uint64_t producerUsage = 0;
+ uint64_t consumerUsage = 0;
uint32_t width = 0;
uint32_t height = 0;
uint32_t format = 0;
@@ -1866,13 +1867,13 @@
GET_NONNEGATIVE_VALUE(EGL_LAYER_COUNT_ANDROID, layer_count);
case EGL_NATIVE_BUFFER_USAGE_ANDROID:
if (value & EGL_NATIVE_BUFFER_USAGE_PROTECTED_BIT_ANDROID) {
- usage |= GRALLOC_USAGE_PROTECTED;
+ producerUsage |= GRALLOC1_PRODUCER_USAGE_PROTECTED;
}
if (value & EGL_NATIVE_BUFFER_USAGE_RENDERBUFFER_BIT_ANDROID) {
- usage |= GRALLOC_USAGE_HW_RENDER;
+ producerUsage |= GRALLOC1_PRODUCER_USAGE_GPU_RENDER_TARGET;
}
if (value & EGL_NATIVE_BUFFER_USAGE_TEXTURE_BIT_ANDROID) {
- usage |= GRALLOC_USAGE_HW_TEXTURE;
+ consumerUsage |= GRALLOC1_CONSUMER_USAGE_GPU_TEXTURE;
}
break;
default:
@@ -1940,8 +1941,10 @@
CHECK_ERROR_CONDITION("Unable to write format");
err = data.writeUint32(layer_count);
CHECK_ERROR_CONDITION("Unable to write layer count");
- err = data.writeUint32(usage);
- CHECK_ERROR_CONDITION("Unable to write usage");
+ err = data.writeUint64(producerUsage);
+ CHECK_ERROR_CONDITION("Unable to write producer usage");
+ err = data.writeUint64(consumerUsage);
+ CHECK_ERROR_CONDITION("Unable to write consumer usage");
err = data.writeUtf8AsUtf16(
std::string("[eglCreateNativeClientBufferANDROID pid ") +
std::to_string(getpid()) + ']');
@@ -1958,12 +1961,15 @@
err = gBuffer->initCheck();
if (err != NO_ERROR) {
ALOGE("Unable to create native buffer "
- "{ w=%u, h=%u, f=%u, u=%#x, lc=%u}: %#x", width, height, format,
- usage, layer_count, err);
+ "{ w=%u, h=%u, f=%u, pu=%" PRIx64 " cu=%" PRIx64 ", lc=%u} %#x",
+ width, height, format, producerUsage, consumerUsage,
+ layer_count, err);
goto error_condition;
}
- ALOGV("Created new native buffer %p { w=%u, h=%u, f=%u, u=%#x, lc=%u}",
- gBuffer, width, height, format, usage, layer_count);
+ ALOGV("Created new native buffer %p { w=%u, h=%u, f=%u, pu=%" PRIx64
+ " cu=%" PRIx64 ", lc=%u}",
+ gBuffer, width, height, format, producerUsage, consumerUsage,
+ layer_count);
return static_cast<EGLClientBuffer>(gBuffer->getNativeBuffer());
#undef CHECK_ERROR_CONDITION
diff --git a/vulkan/libvulkan/debug_report.cpp b/vulkan/libvulkan/debug_report.cpp
index 0c2f138..40ba1e5 100644
--- a/vulkan/libvulkan/debug_report.cpp
+++ b/vulkan/libvulkan/debug_report.cpp
@@ -46,7 +46,8 @@
Node* prev = &head_;
while (prev && prev->next != node)
prev = prev->next;
- prev->next = node->next;
+ if (prev)
+ prev->next = node->next;
}
allocator.pfnFree(allocator.pUserData, node);