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

Commit 469b90ac authored by Marissa Wall's avatar Marissa Wall
Browse files

gralloc: stub out IMapper@4.0::lockYCbCr in C2Allocator

IMapper 4.0 does support lockYCbCr functionality through lock and
BufferMetadata getters. However, we will wait to add the support in
one central gralloc library. For now just stub out the call so
there aren't any compiler errors. Also, bytesPerPixel/bytesPerStride
can be gotten through BufferMetadata getters so they are no longer
supported in lock.

Bug: 141631415
Test: Compiles
Change-Id: I8b8adea765c42d7adac7ba86a3ce7ddd2751e8a0
parent c759fc5a
Loading
Loading
Loading
Loading
+10 −29
Original line number Diff line number Diff line
@@ -605,14 +605,11 @@ c2_status_t C2AllocationGralloc::map(
                          (int32_t)rect.width, (int32_t)rect.height },
                        // TODO: fence
                        hidl_handle(),
                        [&err, &pointer](const auto &maperr, const auto &mapPointer,
                                         int32_t bytesPerPixel, int32_t bytesPerStride) {
                        [&err, &pointer](const auto &maperr, const auto &mapPointer) {
                            err = maperr2error(maperr);
                            if (err == C2_OK) {
                                pointer = mapPointer;
                            }
                            (void)bytesPerPixel;
                            (void)bytesPerStride;
                        }).isOk()) {
                    ALOGE("failed transaction: lock(RGBA_1010102) (@4.0)");
                    return C2_CORRUPTED;
@@ -743,14 +740,11 @@ c2_status_t C2AllocationGralloc::map(
                          (int32_t)rect.width, (int32_t)rect.height },
                        // TODO: fence
                        hidl_handle(),
                        [&err, &pointer](const auto &maperr, const auto &mapPointer,
                                         int32_t bytesPerPixel, int32_t bytesPerStride) {
                        [&err, &pointer](const auto &maperr, const auto &mapPointer) {
                            err = maperr2error(maperr);
                            if (err == C2_OK) {
                                pointer = mapPointer;
                            }
                            (void)bytesPerPixel;
                            (void)bytesPerStride;
                        }).isOk()) {
                    ALOGE("failed transaction: lock(RGBA_8888) (@4.0)");
                    return C2_CORRUPTED;
@@ -875,28 +869,15 @@ c2_status_t C2AllocationGralloc::map(
                    return C2_CORRUPTED;
                }
            } else {
                if (!mMapper4->lockYCbCr(
                        const_cast<native_handle_t *>(mBuffer), grallocUsage,
                        { (int32_t)rect.left, (int32_t)rect.top,
                          (int32_t)rect.width, (int32_t)rect.height },
                        // TODO: fence
                        hidl_handle(),
                        [&err, &ycbcrLayout](const auto &maperr, const auto &mapLayout) {
                            err = maperr2error(maperr);
                            if (err == C2_OK) {
                                ycbcrLayout = YCbCrLayout{
                                        mapLayout.y,
                                        mapLayout.cb,
                                        mapLayout.cr,
                                        mapLayout.yStride,
                                        mapLayout.cStride,
                                        mapLayout.chromaStep};
                            }
                        }).isOk()) {
                // No device currently supports IMapper 4.0 so it is safe to just return an error
                // code here.
                //
                // This will be supported by a combination of lock and BufferMetadata getters.
                // We are going to refactor all the IAllocator/IMapper versioning code into a
                // shared library. We will then add the IMapper 4.0 lockYCbCr support then.
                ALOGE("failed transaction: lockYCbCr (@4.0)");
                return C2_CORRUPTED;
            }
            }
            if (err != C2_OK) {
                ALOGD("lockYCbCr failed: %d", err);
                return err;