Fix GraphicsMapperStableCTests#LockUnlockNoCPUUsage
Add CPU usage into buffer descriptions for 2 reasons:
- minigbm doesn't support allocating buffers with usage == 0
- it could happen that the allocation is not cpu-mappable in the fist
place and this woiuld make the test to pass by accident
Cherry-pick'ed from ag/30113001
Bug: b/374004471
Bug: b/384527749
Test: vts -m VtsHalGraphicsMapperStableC_TargetTest
Change-Id: I589e7673236107b92d3d6a2587eab55f81b8520d
Merged-In: I589e7673236107b92d3d6a2587eab55f81b8520d
diff --git a/graphics/mapper/stable-c/vts/VtsHalGraphicsMapperStableC_TargetTest.cpp b/graphics/mapper/stable-c/vts/VtsHalGraphicsMapperStableC_TargetTest.cpp
index 5de5f1c..cfd3173 100644
--- a/graphics/mapper/stable-c/vts/VtsHalGraphicsMapperStableC_TargetTest.cpp
+++ b/graphics/mapper/stable-c/vts/VtsHalGraphicsMapperStableC_TargetTest.cpp
@@ -753,7 +753,7 @@
* Test IMapper::lock and IMapper::unlock with no CPU usage requested.
*/
TEST_P(GraphicsMapperStableCTests, LockUnlockNoCPUUsage) {
- constexpr auto usage = BufferUsage::CPU_READ_NEVER | BufferUsage::CPU_WRITE_NEVER;
+ constexpr auto usage = BufferUsage::CPU_READ_RARELY | BufferUsage::CPU_WRITE_NEVER;
auto buffer = allocate({
.name = {"VTS_TEMP"},
.width = 64,
@@ -771,15 +771,12 @@
auto handle = buffer->import();
uint8_t* data = nullptr;
- EXPECT_EQ(AIMAPPER_ERROR_BAD_VALUE,
- mapper()->v5.lock(*handle, static_cast<int64_t>(info.usage),
- region, -1,(void**)&data))
- << "Locking with 0 access succeeded";
+ EXPECT_EQ(AIMAPPER_ERROR_BAD_VALUE, mapper()->v5.lock(*handle, 0, region, -1, (void**)&data))
+ << "Locking with 0 access succeeded";
int releaseFence = -1;
- EXPECT_EQ(AIMAPPER_ERROR_BAD_BUFFER,
- mapper()->v5.unlock(*handle, &releaseFence))
- << "Unlocking not locked buffer succeeded";
+ EXPECT_EQ(AIMAPPER_ERROR_BAD_BUFFER, mapper()->v5.unlock(*handle, &releaseFence))
+ << "Unlocking not locked buffer succeeded";
if (releaseFence != -1) {
close(releaseFence);
}