Buffer transfer and locking workarounds for EVS
These changes get EVS working for 3 frames with validated buffer contents
before HIDL reports a error on the 4th frame when running on Marlin. More
investigation is required to resolve the HIDL issue.
Test: Build and run againsgt evs_test
Change-Id: I5096e74aa897e690900620b77a47f79646b0f040
diff --git a/evs/1.0/default/EvsCamera.cpp b/evs/1.0/default/EvsCamera.cpp
index a539b23..df7e844 100644
--- a/evs/1.0/default/EvsCamera.cpp
+++ b/evs/1.0/default/EvsCamera.cpp
@@ -69,7 +69,8 @@
mHeight = (mDescription.defaultVerResolution) ? mDescription.defaultVerResolution : 480;
mFormat = HAL_PIXEL_FORMAT_RGBA_8888;
- mUsage = GRALLOC_USAGE_HW_TEXTURE | GRALLOC_USAGE_HW_CAMERA_WRITE;
+ mUsage = GRALLOC_USAGE_HW_TEXTURE | GRALLOC_USAGE_HW_CAMERA_WRITE |
+ GRALLOC_USAGE_SW_READ_RARELY | GRALLOC_USAGE_SW_WRITE_RARELY;
}
@@ -440,7 +441,7 @@
}
-void EvsCamera::fillTestFrame(BufferDesc buff) {
+void EvsCamera::fillTestFrame(const BufferDesc& buff) {
// Lock our output buffer for writing
uint32_t *pixels = nullptr;
GraphicBufferMapper &mapper = GraphicBufferMapper::get();
@@ -474,7 +475,8 @@
pixels[col] = expectedPixel;
}
// Point to the next row
- pixels = pixels + (buff.stride / sizeof(*pixels));
+ // NOTE: stride retrieved from gralloc is in units of pixels
+ pixels = pixels + buff.stride;
}
// Release our output buffer