Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 36e72808 authored by Alina Kalyakina's avatar Alina Kalyakina Committed by Jason Macnak
Browse files

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
parent 1d8a6368
Loading
Loading
Loading
Loading
+5 −8
Original line number Diff line number Diff line
@@ -753,7 +753,7 @@ TEST_P(GraphicsMapperStableCTests, LockUnlockBasic) {
 * 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,14 +771,11 @@ TEST_P(GraphicsMapperStableCTests, LockUnlockNoCPUUsage) {
    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))
    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))
    EXPECT_EQ(AIMAPPER_ERROR_BAD_BUFFER, mapper()->v5.unlock(*handle, &releaseFence))
            << "Unlocking not locked buffer succeeded";
    if (releaseFence != -1) {
        close(releaseFence);