summaryrefslogtreecommitdiff
path: root/devices
diff options
context:
space:
mode:
authorJason Macnak <natsu@google.com>2020-04-17 11:46:34 -0700
committerJason Macnak <natsu@google.com>2020-05-13 08:38:21 -0700
commit2bd82aa93f5130af10c86b2588344640e7dcc6f8 (patch)
tree17939f769f9eb8e11a3744aa79fa2121f89f16f4 /devices
parente2a94baf658a9b3e334c824c9d6c5bfa2923bd22 (diff)
downloadcamera-2bd82aa93f5130af10c86b2588344640e7dcc6f8.tar.gz
Lock gralloc buffers with SW_READ/SW_WRITE usage
EmulatedCameraDeviceSessionHwlImpl::ConfigurePipeline will default some buffers to GRALLOC_USAGE_HW_CAMERA_[READ|WRITE]. This worked with existing Cuttlefish gralloc which ignored usage flags and just always mmap'ed with PROT_READ|PROT_WRITE. With upgrading Cuttlefish to Gralloc4 on Minigbm, the lack of SW_READ|SW_WRITE will result in nothing being mmap'ed and a nullptr will be returned from lock. Bug: b/146515640 Test: cts -m CtsCameraTestCases Change-Id: If308dc3037bb57becb7c44f997256ad65330c682
Diffstat (limited to 'devices')
-rw-r--r--devices/EmulatedCamera/hwl/EmulatedRequestProcessor.cpp4
1 files changed, 1 insertions, 3 deletions
diff --git a/devices/EmulatedCamera/hwl/EmulatedRequestProcessor.cpp b/devices/EmulatedCamera/hwl/EmulatedRequestProcessor.cpp
index 7acae76..ae2d7db 100644
--- a/devices/EmulatedCamera/hwl/EmulatedRequestProcessor.cpp
+++ b/devices/EmulatedCamera/hwl/EmulatedRequestProcessor.cpp
@@ -198,9 +198,7 @@ status_t EmulatedRequestProcessor::LockSensorBuffer(
auto width = static_cast<int32_t>(stream.width);
auto height = static_cast<int32_t>(stream.height);
- auto usage = stream.is_input
- ? GRALLOC_USAGE_SW_READ_OFTEN | GRALLOC_USAGE_SW_WRITE_OFTEN
- : stream.producer_usage;
+ auto usage = GRALLOC_USAGE_SW_READ_OFTEN | GRALLOC_USAGE_SW_WRITE_OFTEN;
if (stream.override_format == HAL_PIXEL_FORMAT_YCBCR_420_888) {
IMapper::Rect map_rect = {0, 0, width, height};
auto yuv_layout = importer.lockYCbCr(buffer, usage, map_rect);