Merge "Remove redundant dependencies"
diff --git a/automotive/evs/1.0/vts/functional/Android.bp b/automotive/evs/1.0/vts/functional/Android.bp
index 22ceff3..e86e9bc 100644
--- a/automotive/evs/1.0/vts/functional/Android.bp
+++ b/automotive/evs/1.0/vts/functional/Android.bp
@@ -19,7 +19,8 @@
srcs: [
"VtsEvsV1_0TargetTest.cpp",
- "FrameHandler.cpp"
+ "FrameHandler.cpp",
+ "FormatConvert.cpp"
],
defaults: [
diff --git a/automotive/evs/1.0/vts/functional/FormatConvert.cpp b/automotive/evs/1.0/vts/functional/FormatConvert.cpp
new file mode 100644
index 0000000..e5cc8ee
--- /dev/null
+++ b/automotive/evs/1.0/vts/functional/FormatConvert.cpp
@@ -0,0 +1,173 @@
+/*
+ * Copyright (C) 2017 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#define LOG_TAG "VtsHalEvsTest"
+
+#include "FormatConvert.h"
+
+#include <algorithm> // std::min
+
+
+// Round up to the nearest multiple of the given alignment value
+template<unsigned alignment>
+int align(int value) {
+ static_assert((alignment && !(alignment & (alignment - 1))),
+ "alignment must be a power of 2");
+
+ unsigned mask = alignment - 1;
+ return (value + mask) & ~mask;
+}
+
+
+// Limit the given value to the provided range. :)
+static inline float clamp(float v, float min, float max) {
+ if (v < min) return min;
+ if (v > max) return max;
+ return v;
+}
+
+
+static uint32_t yuvToRgbx(const unsigned char Y, const unsigned char Uin, const unsigned char Vin) {
+ // Don't use this if you want to see the best performance. :)
+ // Better to do this in a pixel shader if we really have to, but on actual
+ // embedded hardware we expect to be able to texture directly from the YUV data
+ float U = Uin - 128.0f;
+ float V = Vin - 128.0f;
+
+ float Rf = Y + 1.140f*V;
+ float Gf = Y - 0.395f*U - 0.581f*V;
+ float Bf = Y + 2.032f*U;
+ unsigned char R = (unsigned char)clamp(Rf, 0.0f, 255.0f);
+ unsigned char G = (unsigned char)clamp(Gf, 0.0f, 255.0f);
+ unsigned char B = (unsigned char)clamp(Bf, 0.0f, 255.0f);
+
+ return (R ) |
+ (G << 8) |
+ (B << 16) |
+ 0xFF000000; // Fill the alpha channel with ones
+}
+
+
+void copyNV21toRGB32(unsigned width, unsigned height,
+ uint8_t* src,
+ uint32_t* dst, unsigned dstStridePixels)
+{
+ // The NV21 format provides a Y array of 8bit values, followed by a 1/2 x 1/2 interleaved
+ // U/V array. It assumes an even width and height for the overall image, and a horizontal
+ // stride that is an even multiple of 16 bytes for both the Y and UV arrays.
+ unsigned strideLum = align<16>(width);
+ unsigned sizeY = strideLum * height;
+ unsigned strideColor = strideLum; // 1/2 the samples, but two interleaved channels
+ unsigned offsetUV = sizeY;
+
+ uint8_t* srcY = src;
+ uint8_t* srcUV = src+offsetUV;
+
+ for (unsigned r = 0; r < height; r++) {
+ // Note that we're walking the same UV row twice for even/odd luminance rows
+ uint8_t* rowY = srcY + r*strideLum;
+ uint8_t* rowUV = srcUV + (r/2 * strideColor);
+
+ uint32_t* rowDest = dst + r*dstStridePixels;
+
+ for (unsigned c = 0; c < width; c++) {
+ unsigned uCol = (c & ~1); // uCol is always even and repeats 1:2 with Y values
+ unsigned vCol = uCol | 1; // vCol is always odd
+ rowDest[c] = yuvToRgbx(rowY[c], rowUV[uCol], rowUV[vCol]);
+ }
+ }
+}
+
+
+void copyYV12toRGB32(unsigned width, unsigned height,
+ uint8_t* src,
+ uint32_t* dst, unsigned dstStridePixels)
+{
+ // The YV12 format provides a Y array of 8bit values, followed by a 1/2 x 1/2 U array, followed
+ // by another 1/2 x 1/2 V array. It assumes an even width and height for the overall image,
+ // and a horizontal stride that is an even multiple of 16 bytes for each of the Y, U,
+ // and V arrays.
+ unsigned strideLum = align<16>(width);
+ unsigned sizeY = strideLum * height;
+ unsigned strideColor = align<16>(strideLum/2);
+ unsigned sizeColor = strideColor * height/2;
+ unsigned offsetU = sizeY;
+ unsigned offsetV = sizeY + sizeColor;
+
+ uint8_t* srcY = src;
+ uint8_t* srcU = src+offsetU;
+ uint8_t* srcV = src+offsetV;
+
+ for (unsigned r = 0; r < height; r++) {
+ // Note that we're walking the same U and V rows twice for even/odd luminance rows
+ uint8_t* rowY = srcY + r*strideLum;
+ uint8_t* rowU = srcU + (r/2 * strideColor);
+ uint8_t* rowV = srcV + (r/2 * strideColor);
+
+ uint32_t* rowDest = dst + r*dstStridePixels;
+
+ for (unsigned c = 0; c < width; c++) {
+ rowDest[c] = yuvToRgbx(rowY[c], rowU[c], rowV[c]);
+ }
+ }
+}
+
+
+void copyYUYVtoRGB32(unsigned width, unsigned height,
+ uint8_t* src, unsigned srcStridePixels,
+ uint32_t* dst, unsigned dstStridePixels)
+{
+ uint32_t* srcWords = (uint32_t*)src;
+
+ const int srcRowPadding32 = srcStridePixels/2 - width/2; // 2 bytes per pixel, 4 bytes per word
+ const int dstRowPadding32 = dstStridePixels - width; // 4 bytes per pixel, 4 bytes per word
+
+ for (unsigned r = 0; r < height; r++) {
+ for (unsigned c = 0; c < width/2; c++) {
+ // Note: we're walking two pixels at a time here (even/odd)
+ uint32_t srcPixel = *srcWords++;
+
+ uint8_t Y1 = (srcPixel) & 0xFF;
+ uint8_t U = (srcPixel >> 8) & 0xFF;
+ uint8_t Y2 = (srcPixel >> 16) & 0xFF;
+ uint8_t V = (srcPixel >> 24) & 0xFF;
+
+ // On the RGB output, we're writing one pixel at a time
+ *(dst+0) = yuvToRgbx(Y1, U, V);
+ *(dst+1) = yuvToRgbx(Y2, U, V);
+ dst += 2;
+ }
+
+ // Skip over any extra data or end of row alignment padding
+ srcWords += srcRowPadding32;
+ dst += dstRowPadding32;
+ }
+}
+
+
+void copyMatchedInterleavedFormats(unsigned width, unsigned height,
+ void* src, unsigned srcStridePixels,
+ void* dst, unsigned dstStridePixels,
+ unsigned pixelSize) {
+ for (unsigned row = 0; row < height; row++) {
+ // Copy the entire row of pixel data
+ memcpy(dst, src, width * pixelSize);
+
+ // Advance to the next row (keeping in mind that stride here is in units of pixels)
+ src = (uint8_t*)src + srcStridePixels * pixelSize;
+ dst = (uint8_t*)dst + dstStridePixels * pixelSize;
+ }
+}
diff --git a/automotive/evs/1.0/vts/functional/FormatConvert.h b/automotive/evs/1.0/vts/functional/FormatConvert.h
new file mode 100644
index 0000000..3ff1eec
--- /dev/null
+++ b/automotive/evs/1.0/vts/functional/FormatConvert.h
@@ -0,0 +1,60 @@
+/*
+ * Copyright (C) 2017 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef EVS_VTS_FORMATCONVERT_H
+#define EVS_VTS_FORMATCONVERT_H
+
+#include <queue>
+#include <stdint.h>
+
+
+// Given an image buffer in NV21 format (HAL_PIXEL_FORMAT_YCRCB_420_SP), output 32bit RGBx values.
+// The NV21 format provides a Y array of 8bit values, followed by a 1/2 x 1/2 interleaved
+// U/V array. It assumes an even width and height for the overall image, and a horizontal
+// stride that is an even multiple of 16 bytes for both the Y and UV arrays.
+void copyNV21toRGB32(unsigned width, unsigned height,
+ uint8_t* src,
+ uint32_t* dst, unsigned dstStridePixels);
+
+
+// Given an image buffer in YV12 format (HAL_PIXEL_FORMAT_YV12), output 32bit RGBx values.
+// The YV12 format provides a Y array of 8bit values, followed by a 1/2 x 1/2 U array, followed
+// by another 1/2 x 1/2 V array. It assumes an even width and height for the overall image,
+// and a horizontal stride that is an even multiple of 16 bytes for each of the Y, U,
+// and V arrays.
+void copyYV12toRGB32(unsigned width, unsigned height,
+ uint8_t* src,
+ uint32_t* dst, unsigned dstStridePixels);
+
+
+// Given an image buffer in YUYV format (HAL_PIXEL_FORMAT_YCBCR_422_I), output 32bit RGBx values.
+// The NV21 format provides a Y array of 8bit values, followed by a 1/2 x 1/2 interleaved
+// U/V array. It assumes an even width and height for the overall image, and a horizontal
+// stride that is an even multiple of 16 bytes for both the Y and UV arrays.
+void copyYUYVtoRGB32(unsigned width, unsigned height,
+ uint8_t* src, unsigned srcStrideBytes,
+ uint32_t* dst, unsigned dstStrideBytes);
+
+
+// Given an simple rectangular image buffer with an integer number of bytes per pixel,
+// copy the pixel values into a new rectangular buffer (potentially with a different stride).
+// This is typically used to copy RGBx data into an RGBx output buffer.
+void copyMatchedInterleavedFormats(unsigned width, unsigned height,
+ void* src, unsigned srcStridePixels,
+ void* dst, unsigned dstStridePixels,
+ unsigned pixelSize);
+
+#endif // EVS_VTS_FORMATCONVERT_H
diff --git a/automotive/evs/1.0/vts/functional/FrameHandler.cpp b/automotive/evs/1.0/vts/functional/FrameHandler.cpp
index 58c2f26..a69f72b 100644
--- a/automotive/evs/1.0/vts/functional/FrameHandler.cpp
+++ b/automotive/evs/1.0/vts/functional/FrameHandler.cpp
@@ -17,6 +17,7 @@
#define LOG_TAG "VtsHalEvsTest"
#include "FrameHandler.h"
+#include "FormatConvert.h"
#include <stdio.h>
#include <string.h>
@@ -25,14 +26,6 @@
#include <cutils/native_handle.h>
#include <ui/GraphicBuffer.h>
-#include <algorithm> // std::min
-
-
-// For the moment, we're assuming that the underlying EVS driver we're working with
-// is providing 4 byte RGBx data. This is fine for loopback testing, although
-// real hardware is expected to provide YUV data -- most likly formatted as YV12
-static const unsigned kBytesPerPixel = 4; // assuming 4 byte RGBx pixels
-
FrameHandler::FrameHandler(android::sp <IEvsCamera> pCamera, CameraDesc cameraInfo,
android::sp <IEvsDisplay> pDisplay,
@@ -58,14 +51,18 @@
bool FrameHandler::startStream() {
+ // Tell the camera to start streaming
+ Return<EvsResult> result = mCamera->startVideoStream(this);
+ if (result != EvsResult::OK) {
+ return false;
+ }
+
// Mark ourselves as running
mLock.lock();
mRunning = true;
mLock.unlock();
- // Tell the camera to start streaming
- Return<EvsResult> result = mCamera->startVideoStream(this);
- return (result == EvsResult::OK);
+ return true;
}
@@ -82,7 +79,9 @@
// Wait until the stream has actually stopped
std::unique_lock<std::mutex> lock(mLock);
- mSignal.wait(lock, [this](){ return !mRunning; });
+ if (mRunning) {
+ mSignal.wait(lock, [this]() { return !mRunning; });
+ }
}
@@ -179,13 +178,13 @@
switch (mReturnMode) {
case eAutoReturn:
- // Send the camera buffer back now that we're done with it
+ // Send the camera buffer back now that the client has seen it
ALOGD("Calling doneWithFrame");
// TODO: Why is it that we get a HIDL crash if we pass back the cloned buffer?
mCamera->doneWithFrame(bufferArg);
break;
case eNoAutoReturn:
- // Hang onto the buffer handle for now -- we'll return it explicitly later
+ // Hang onto the buffer handle for now -- the client will return it explicitly later
mHeldBuffers.push(bufferArg);
}
@@ -228,25 +227,41 @@
srcBuffer.width, srcBuffer.height, srcBuffer.format, 1, srcBuffer.usage,
srcBuffer.stride);
- // Lock our source buffer for reading
- unsigned char* srcPixels = nullptr;
+ // Lock our source buffer for reading (current expectation are for this to be NV21 format)
+ uint8_t* srcPixels = nullptr;
src->lock(GRALLOC_USAGE_SW_READ_OFTEN, (void**)&srcPixels);
- // Lock our target buffer for writing
- unsigned char* tgtPixels = nullptr;
+ // Lock our target buffer for writing (should be RGBA8888 format)
+ uint32_t* tgtPixels = nullptr;
tgt->lock(GRALLOC_USAGE_SW_WRITE_OFTEN, (void**)&tgtPixels);
if (srcPixels && tgtPixels) {
- for (unsigned row = 0; row < height; row++) {
- // Copy the entire row of pixel data
- memcpy(tgtPixels, srcPixels, width * kBytesPerPixel);
-
- // Advance to the next row (keeping in mind that stride here is in units of pixels)
- tgtPixels += tgtBuffer.stride * kBytesPerPixel;
- srcPixels += srcBuffer.stride * kBytesPerPixel;
+ if (tgtBuffer.format != HAL_PIXEL_FORMAT_RGBA_8888) {
+ // We always expect 32 bit RGB for the display output for now. Is there a need for 565?
+ ALOGE("Diplay buffer is always expected to be 32bit RGBA");
+ success = false;
+ } else {
+ if (srcBuffer.format == HAL_PIXEL_FORMAT_YCRCB_420_SP) { // 420SP == NV21
+ copyNV21toRGB32(width, height,
+ srcPixels,
+ tgtPixels, tgtBuffer.stride);
+ } else if (srcBuffer.format == HAL_PIXEL_FORMAT_YV12) { // YUV_420P == YV12
+ copyYV12toRGB32(width, height,
+ srcPixels,
+ tgtPixels, tgtBuffer.stride);
+ } else if (srcBuffer.format == HAL_PIXEL_FORMAT_YCBCR_422_I) { // YUYV
+ copyYUYVtoRGB32(width, height,
+ srcPixels, srcBuffer.stride,
+ tgtPixels, tgtBuffer.stride);
+ } else if (srcBuffer.format == tgtBuffer.format) { // 32bit RGBA
+ copyMatchedInterleavedFormats(width, height,
+ srcPixels, srcBuffer.stride,
+ tgtPixels, tgtBuffer.stride,
+ tgtBuffer.pixelSize);
+ }
}
} else {
- ALOGE("Failed to copy buffer contents");
+ ALOGE("Failed to lock buffer contents for contents transfer");
success = false;
}
diff --git a/automotive/evs/1.0/vts/functional/VtsEvsV1_0TargetTest.cpp b/automotive/evs/1.0/vts/functional/VtsEvsV1_0TargetTest.cpp
index 50b6581..2e80afe 100644
--- a/automotive/evs/1.0/vts/functional/VtsEvsV1_0TargetTest.cpp
+++ b/automotive/evs/1.0/vts/functional/VtsEvsV1_0TargetTest.cpp
@@ -107,6 +107,8 @@
* call to closeCamera. Then repeats the test to ensure all cameras can be reopened.
*/
TEST_F(EvsHidlTest, CameraOpenClean) {
+ ALOGI("Starting CameraOpenClean test");
+
// Get the camera list
loadCameraList();
@@ -137,6 +139,8 @@
* the system to be tolerant of shutdown/restart race conditions.
*/
TEST_F(EvsHidlTest, CameraOpenAggressive) {
+ ALOGI("Starting CameraOpenAggressive test");
+
// Get the camera list
loadCameraList();
@@ -183,6 +187,8 @@
* Test both clean shut down and "aggressive open" device stealing behavior.
*/
TEST_F(EvsHidlTest, DisplayOpen) {
+ ALOGI("Starting DisplayOpen test");
+
// Request exclusive access to the EVS display, then let it go
{
sp<IEvsDisplay> pDisplay = pEnumerator->openDisplay();
@@ -229,6 +235,8 @@
* object itself or the owning enumerator.
*/
TEST_F(EvsHidlTest, DisplayStates) {
+ ALOGI("Starting DisplayStates test");
+
// Ensure the display starts in the expected state
EXPECT_EQ((DisplayState)pEnumerator->getDisplayState(), DisplayState::NOT_OPEN);
@@ -270,15 +278,14 @@
}
// TODO: This hack shouldn't be necessary. b/36122635
-// NOTE: Calling flushCommand here did not avoid the race. Going back to sleep... :(
-// android::hardware::IPCThreadState::self()->flushCommands();
sleep(1);
// Now that the display pointer has gone out of scope, causing the IEvsDisplay interface
// object to be destroyed, we should be back to the "not open" state.
// NOTE: If we want this to pass without the sleep above, we'd have to add the
// (now recommended) closeDisplay() call instead of relying on the smarter pointer
- // going out of scope.
+ // going out of scope. I've not done that because I want to verify that the deletion
+ // of the object does actually clean up (eventually).
EXPECT_EQ((DisplayState)pEnumerator->getDisplayState(), DisplayState::NOT_OPEN);
}
@@ -288,6 +295,8 @@
* Measure and qualify the stream start up time and streaming frame rate of each reported camera
*/
TEST_F(EvsHidlTest, CameraStreamPerformance) {
+ ALOGI("Starting CameraStreamPerformance test");
+
// Get the camera list
loadCameraList();
@@ -304,7 +313,7 @@
// Start the camera's video stream
nsecs_t start = systemTime(SYSTEM_TIME_MONOTONIC);
bool startResult = frameHandler->startStream();
- EXPECT_EQ(startResult, true);
+ ASSERT_TRUE(startResult);
// Ensure the first frame arrived within the expected time
frameHandler->waitForFrameCount(1);
@@ -344,6 +353,8 @@
* than one frame time. The camera must cleanly skip frames until the client is ready again.
*/
TEST_F(EvsHidlTest, CameraStreamBuffering) {
+ ALOGI("Starting CameraStreamBuffering test");
+
// Arbitrary constant (should be > 1 and less than crazy)
static const unsigned int kBuffersToHold = 6;
@@ -372,14 +383,14 @@
// Start the camera's video stream
bool startResult = frameHandler->startStream();
- EXPECT_TRUE(startResult);
+ ASSERT_TRUE(startResult);
// Check that the video stream stalls once we've gotten exactly the number of buffers
// we requested since we told the frameHandler not to return them.
- sleep(1); // 1 second would be enough for at least 5 frames to be delivered worst case
+ sleep(2); // 1 second should be enough for at least 5 frames to be delivered worst case
unsigned framesReceived = 0;
frameHandler->getFramesCounters(&framesReceived, nullptr);
- EXPECT_EQ(kBuffersToHold, framesReceived);
+ ASSERT_EQ(kBuffersToHold, framesReceived) << "Stream didn't stall at expected buffer limit";
// Give back one buffer
@@ -390,7 +401,7 @@
// filled since we require 10fps minimum -- but give a 10% allowance just in case.
usleep(110 * kMillisecondsToMicroseconds);
frameHandler->getFramesCounters(&framesReceived, nullptr);
- EXPECT_EQ(kBuffersToHold+1, framesReceived);
+ EXPECT_EQ(kBuffersToHold+1, framesReceived) << "Stream should've resumed";
// Even when the camera pointer goes out of scope, the FrameHandler object will
// keep the stream alive unless we tell it to shutdown.
@@ -411,6 +422,8 @@
* which a human could observe to see the operation of the system on the physical display.
*/
TEST_F(EvsHidlTest, CameraToDisplayRoundTrip) {
+ ALOGI("Starting CameraToDisplayRoundTrip test");
+
// Get the camera list
loadCameraList();
@@ -434,7 +447,7 @@
// Start the camera's video stream
bool startResult = frameHandler->startStream();
- EXPECT_EQ(startResult, true);
+ ASSERT_TRUE(startResult);
// Wait a while to let the data flow
static const int kSecondsToWait = 5;
diff --git a/automotive/vehicle/2.0/default/Android.mk b/automotive/vehicle/2.0/default/Android.mk
index ee6d134..c63899d 100644
--- a/automotive/vehicle/2.0/default/Android.mk
+++ b/automotive/vehicle/2.0/default/Android.mk
@@ -123,6 +123,9 @@
tests/VehicleObjectPool_test.cpp \
tests/VehiclePropConfigIndex_test.cpp \
+LOCAL_HEADER_LIBRARIES := \
+ libbase_headers
+
LOCAL_SHARED_LIBRARIES := \
libhidlbase \
libhidltransport \
diff --git a/automotive/vehicle/2.0/default/impl/vhal_v2_0/EmulatedVehicleHal.cpp b/automotive/vehicle/2.0/default/impl/vhal_v2_0/EmulatedVehicleHal.cpp
index ea40cc5..fe34a3f 100644
--- a/automotive/vehicle/2.0/default/impl/vhal_v2_0/EmulatedVehicleHal.cpp
+++ b/automotive/vehicle/2.0/default/impl/vhal_v2_0/EmulatedVehicleHal.cpp
@@ -13,9 +13,10 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-
#define LOG_TAG "DefaultVehicleHal_v2_0"
+
#include <android/log.h>
+#include <android-base/macros.h>
#include "EmulatedVehicleHal.h"
diff --git a/automotive/vehicle/2.0/default/tests/VehicleHalManager_test.cpp b/automotive/vehicle/2.0/default/tests/VehicleHalManager_test.cpp
index 04335b5..4864d5d 100644
--- a/automotive/vehicle/2.0/default/tests/VehicleHalManager_test.cpp
+++ b/automotive/vehicle/2.0/default/tests/VehicleHalManager_test.cpp
@@ -17,6 +17,7 @@
#include <unordered_map>
#include <iostream>
+#include <android-base/macros.h>
#include <utils/SystemClock.h>
#include <gtest/gtest.h>
diff --git a/compatibility_matrix.xml b/compatibility_matrix.xml
new file mode 100644
index 0000000..cd3904e
--- /dev/null
+++ b/compatibility_matrix.xml
@@ -0,0 +1,34 @@
+<compatibility-matrix version="1.0" type="framework">
+ <hal format="hidl" optional="true">
+ <name>android.hardware.bluetooth</name>
+ <version>1.0</version>
+ </hal>
+ <hal format="hidl" optional="true">
+ <name>android.hardware.boot</name>
+ <version>1.0</version>
+ </hal>
+ <hal format="hidl" optional="true">
+ <name>android.hardware.configstore</name>
+ <version>1.0</version>
+ </hal>
+ <hal format="hidl" optional="true">
+ <name>android.hardware.ir</name>
+ <version>1.0</version>
+ </hal>
+ <hal format="hidl" optional="true">
+ <name>android.hardware.nfc</name>
+ <version>1.0</version>
+ </hal>
+ <hal format="hidl" optional="true">
+ <name>android.hardware.radio</name>
+ <version>1.0</version>
+ </hal>
+ <hal format="hidl" optional="true">
+ <name>android.hardware.renderscript</name>
+ <version>1.0</version>
+ </hal>
+ <hal format="hidl" optional="true">
+ <name>android.hardware.wifi</name>
+ <version>1.0</version>
+ </hal>
+</compatibility-matrix>
diff --git a/graphics/composer/2.1/default/ComposerClient.cpp b/graphics/composer/2.1/default/ComposerClient.cpp
index 87e4d3b..ce4e17f 100644
--- a/graphics/composer/2.1/default/ComposerClient.cpp
+++ b/graphics/composer/2.1/default/ComposerClient.cpp
@@ -655,18 +655,24 @@
auto fence = readFence();
auto dataspace = readSigned();
auto damage = readRegion((length - 4) / 4);
+ bool closeFence = true;
auto err = lookupBuffer(BufferCache::CLIENT_TARGETS,
slot, useCache, clientTarget, &clientTarget);
if (err == Error::NONE) {
err = mHal.setClientTarget(mDisplay, clientTarget, fence,
dataspace, damage);
-
- updateBuffer(BufferCache::CLIENT_TARGETS, slot, useCache,
- clientTarget);
+ auto updateBufErr = updateBuffer(BufferCache::CLIENT_TARGETS, slot,
+ useCache, clientTarget);
+ if (err == Error::NONE) {
+ closeFence = false;
+ err = updateBufErr;
+ }
+ }
+ if (closeFence) {
+ close(fence);
}
if (err != Error::NONE) {
- close(fence);
mWriter.setError(getCommandLoc(), err);
}
@@ -683,17 +689,23 @@
auto slot = read();
auto outputBuffer = readHandle(&useCache);
auto fence = readFence();
+ bool closeFence = true;
auto err = lookupBuffer(BufferCache::OUTPUT_BUFFERS,
slot, useCache, outputBuffer, &outputBuffer);
if (err == Error::NONE) {
err = mHal.setOutputBuffer(mDisplay, outputBuffer, fence);
-
- updateBuffer(BufferCache::OUTPUT_BUFFERS,
- slot, useCache, outputBuffer);
+ auto updateBufErr = updateBuffer(BufferCache::OUTPUT_BUFFERS,
+ slot, useCache, outputBuffer);
+ if (err == Error::NONE) {
+ closeFence = false;
+ err = updateBufErr;
+ }
+ }
+ if (closeFence) {
+ close(fence);
}
if (err != Error::NONE) {
- close(fence);
mWriter.setError(getCommandLoc(), err);
}
@@ -786,17 +798,23 @@
auto slot = read();
auto buffer = readHandle(&useCache);
auto fence = readFence();
+ bool closeFence = true;
auto err = lookupBuffer(BufferCache::LAYER_BUFFERS,
slot, useCache, buffer, &buffer);
if (err == Error::NONE) {
err = mHal.setLayerBuffer(mDisplay, mLayer, buffer, fence);
-
- updateBuffer(BufferCache::LAYER_BUFFERS,
- slot, useCache, buffer);
+ auto updateBufErr = updateBuffer(BufferCache::LAYER_BUFFERS, slot,
+ useCache, buffer);
+ if (err == Error::NONE) {
+ closeFence = false;
+ err = updateBufErr;
+ }
+ }
+ if (closeFence) {
+ close(fence);
}
if (err != Error::NONE) {
- close(fence);
mWriter.setError(getCommandLoc(), err);
}
@@ -915,8 +933,10 @@
auto err = lookupLayerSidebandStream(stream, &stream);
if (err == Error::NONE) {
err = mHal.setLayerSidebandStream(mDisplay, mLayer, stream);
-
- updateLayerSidebandStream(stream);
+ auto updateErr = updateLayerSidebandStream(stream);
+ if (err == Error::NONE) {
+ err = updateErr;
+ }
}
if (err != Error::NONE) {
mWriter.setError(getCommandLoc(), err);
@@ -1097,21 +1117,24 @@
return Error::NONE;
}
-void ComposerClient::CommandReader::updateBuffer(BufferCache cache,
+Error ComposerClient::CommandReader::updateBuffer(BufferCache cache,
uint32_t slot, bool useCache, buffer_handle_t handle)
{
// handle was looked up from cache
if (useCache) {
- return;
+ return Error::NONE;
}
std::lock_guard<std::mutex> lock(mClient.mDisplayDataMutex);
BufferCacheEntry* entry = nullptr;
- lookupBufferCacheEntryLocked(cache, slot, &entry);
- LOG_FATAL_IF(!entry, "failed to find the cache entry to update");
+ Error error = lookupBufferCacheEntryLocked(cache, slot, &entry);
+ if (error != Error::NONE) {
+ return error;
+ }
*entry = handle;
+ return Error::NONE;
}
} // namespace implementation
diff --git a/graphics/composer/2.1/default/ComposerClient.h b/graphics/composer/2.1/default/ComposerClient.h
index c973351..3d10f80 100644
--- a/graphics/composer/2.1/default/ComposerClient.h
+++ b/graphics/composer/2.1/default/ComposerClient.h
@@ -173,7 +173,7 @@
Error lookupBuffer(BufferCache cache, uint32_t slot,
bool useCache, buffer_handle_t handle,
buffer_handle_t* outHandle);
- void updateBuffer(BufferCache cache, uint32_t slot,
+ Error updateBuffer(BufferCache cache, uint32_t slot,
bool useCache, buffer_handle_t handle);
Error lookupLayerSidebandStream(buffer_handle_t handle,
@@ -182,9 +182,9 @@
return lookupBuffer(BufferCache::LAYER_SIDEBAND_STREAMS,
0, false, handle, outHandle);
}
- void updateLayerSidebandStream(buffer_handle_t handle)
+ Error updateLayerSidebandStream(buffer_handle_t handle)
{
- updateBuffer(BufferCache::LAYER_SIDEBAND_STREAMS,
+ return updateBuffer(BufferCache::LAYER_SIDEBAND_STREAMS,
0, false, handle);
}
diff --git a/keymaster/3.0/default/Android.mk b/keymaster/3.0/default/Android.mk
index 9df5bf8..2dbb200 100644
--- a/keymaster/3.0/default/Android.mk
+++ b/keymaster/3.0/default/Android.mk
@@ -11,7 +11,8 @@
liblog \
libsoftkeymasterdevice \
libcrypto \
- libkeymaster1 \
+ libkeymaster_portable \
+ libkeymaster \
libhidlbase \
libhidltransport \
libutils \