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

Commit 477ac280 authored by Praveen Chavan's avatar Praveen Chavan Committed by Cherrypicker Worker
Browse files

Codec2: vndk: lock P010 with gralloc4 mapper first

Gralloc4 mapper allows querying buffer layout with detailed
plane information. Use this mapper (if available) for locking
P010 to get the correct stride and alignments

Test: android.media.decoder.cts.ImageReaderDecoderTest
Bug: 237374872

Change-Id: I0146fd69725fc28389a0133a4d39a243a683a6d4
(cherry picked from commit 6380ffff)
Merged-In: I0146fd69725fc28389a0133a4d39a243a683a6d4
parent 4b3c6730
Loading
Loading
Loading
Loading
+8 −0
Original line number Diff line number Diff line
@@ -706,6 +706,14 @@ c2_status_t C2AllocationGralloc::map(
        }

        case static_cast<uint32_t>(PixelFormat4::YCBCR_P010): {
            // In Android T, P010 is relaxed to allow arbitrary stride for the Y and UV planes,
            // try locking with the gralloc4 mapper first.
            c2_status_t status = Gralloc4Mapper_lock(
                    const_cast<native_handle_t*>(mBuffer), grallocUsage, rect, layout, addr);
            if (status == C2_OK) {
                break;
            }

            void *pointer = nullptr;
            status_t err = GraphicBufferMapper::get().lock(
                    const_cast<native_handle_t *>(mBuffer), grallocUsage, rect, &pointer);