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

Commit eff512f1 authored by Android Build Coastguard Worker's avatar Android Build Coastguard Worker
Browse files

Snap for 12265118 from 84677267 to 24Q4-release

Change-Id: I787b0a306e01d2a6176f358177a17d8352043e9c
parents 3f502da0 84677267
Loading
Loading
Loading
Loading
+4 −1
Original line number Diff line number Diff line
@@ -900,7 +900,10 @@ void GraphicsTracker::commitRender(const std::shared_ptr<BufferCache> &cache,
        cache->unblockSlot(buffer->mSlot);
        if (oldBuffer) {
            // migrated, register the new buffer to the cache.
            cache->mBuffers.emplace(buffer->mSlot, buffer);
            auto ret = cache->mBuffers.emplace(buffer->mSlot, buffer);
            if (!ret.second) {
                ret.first->second = buffer;
            }
        }
    }
    mDeallocating.erase(origBid);
+45 −34
Original line number Diff line number Diff line
@@ -2391,7 +2391,12 @@ c2_status_t Codec2Client::Component::setOutputSurface(
                       "GraphicBufferAllocator was not created.";
            return C2_CORRUPTED;
        }
        // Note: Consumer usage is set ahead of the HAL allocator(gba) being set.
        // This is same as HIDL.
        uint64_t consumerUsage = configConsumerUsage(surface);
        bool ret = gba->configure(surface, generation, maxDequeueCount);
        ALOGD("setOutputSurface -- generation=%u consumer usage=%#llx",
              generation, (long long)consumerUsage);
        return ret ? C2_OK : C2_CORRUPTED;
    }
    uint64_t bqId = 0;
@@ -2419,39 +2424,7 @@ c2_status_t Codec2Client::Component::setOutputSurface(
                                      mHidlBase1_2 ? &syncObj : nullptr);
    }

    // set consumer bits
    // TODO: should this get incorporated into setOutputSurface method so that consumer bits
    // can be set atomically?
    uint64_t consumerUsage = kDefaultConsumerUsage;
    {
        if (surface) {
            uint64_t usage = 0;
            status_t err = surface->getConsumerUsage(&usage);
            if (err != NO_ERROR) {
                ALOGD("setOutputSurface -- failed to get consumer usage bits (%d/%s). ignoring",
                        err, asString(err));
            } else {
                // Note: we are adding the default usage because components must support
                // producing output frames that can be displayed an all output surfaces.

                // TODO: do not set usage for tunneled scenario. It is unclear if consumer usage
                // is meaningful in a tunneled scenario; on one hand output buffers exist, but
                // they do not exist inside of C2 scope. Any buffer usage shall be communicated
                // through the sideband channel.

                consumerUsage = usage | kDefaultConsumerUsage;
            }
        }

        C2StreamUsageTuning::output outputUsage{
                0u, C2AndroidMemoryUsage::FromGrallocUsage(consumerUsage).expected};
        std::vector<std::unique_ptr<C2SettingResult>> failures;
        c2_status_t err = config({&outputUsage}, C2_MAY_BLOCK, &failures);
        if (err != C2_OK) {
            ALOGD("setOutputSurface -- failed to set consumer usage (%d/%s)",
                    err, asString(err));
        }
    }
    uint64_t consumerUsage = configConsumerUsage(surface);
    ALOGD("setOutputSurface -- generation=%u consumer usage=%#llx%s",
          generation, (long long)consumerUsage, syncObj ? " sync" : "");

@@ -2495,6 +2468,44 @@ status_t Codec2Client::Component::queueToOutputSurface(
    return mOutputBufferQueue->outputBuffer(block, input, output);
}

uint64_t Codec2Client::Component::configConsumerUsage(
        const sp<IGraphicBufferProducer>& surface) {
    // set consumer bits
    // TODO: should this get incorporated into setOutputSurface method so that consumer bits
    // can be set atomically?
    uint64_t consumerUsage = kDefaultConsumerUsage;
    {
        if (surface) {
            uint64_t usage = 0;
            status_t err = surface->getConsumerUsage(&usage);
            if (err != NO_ERROR) {
                ALOGD("setOutputSurface -- failed to get consumer usage bits (%d/%s). ignoring",
                        err, asString(err));
            } else {
                // Note: we are adding the default usage because components must support
                // producing output frames that can be displayed an all output surfaces.

                // TODO: do not set usage for tunneled scenario. It is unclear if consumer usage
                // is meaningful in a tunneled scenario; on one hand output buffers exist, but
                // they do not exist inside of C2 scope. Any buffer usage shall be communicated
                // through the sideband channel.

                consumerUsage = usage | kDefaultConsumerUsage;
            }
        }

        C2StreamUsageTuning::output outputUsage{
                0u, C2AndroidMemoryUsage::FromGrallocUsage(consumerUsage).expected};
        std::vector<std::unique_ptr<C2SettingResult>> failures;
        c2_status_t err = config({&outputUsage}, C2_MAY_BLOCK, &failures);
        if (err != C2_OK) {
            ALOGD("setOutputSurface -- failed to set consumer usage (%d/%s)",
                    err, asString(err));
        }
    }
    return consumerUsage;
}

void Codec2Client::Component::pollForRenderedFrames(FrameEventHistoryDelta* delta) {
    if (mAidlBase) {
        // TODO b/311348680
+3 −0
Original line number Diff line number Diff line
@@ -467,6 +467,9 @@ struct Codec2Client::Component : public Codec2Client::Configurable {
            const QueueBufferInput& input,
            QueueBufferOutput* output);

    // configure consumer usage.
    uint64_t configConsumerUsage(const sp<IGraphicBufferProducer>& surface);

    // Retrieve frame event history from the output surface.
    void pollForRenderedFrames(FrameEventHistoryDelta* delta);

+1 −476

File changed.

Preview size limit exceeded, changes collapsed.

+0 −22
Original line number Diff line number Diff line
@@ -44,28 +44,6 @@ struct SharedBuffer;
}  // namespace drm
}  // namespace hardware

/**
 * Copies a graphic view into a media image.
 *
 * \param imgBase base of MediaImage
 * \param img MediaImage data
 * \param view graphic view
 *
 * \return OK on success
 */
status_t ImageCopy(uint8_t *imgBase, const MediaImage2 *img, const C2GraphicView &view);

/**
 * Copies a media image into a graphic view.
 *
 * \param view graphic view
 * \param imgBase base of MediaImage
 * \param img MediaImage data
 *
 * \return OK on success
 */
status_t ImageCopy(C2GraphicView &view, const uint8_t *imgBase, const MediaImage2 *img);

class Codec2Buffer : public MediaCodecBuffer {
public:
    using MediaCodecBuffer::MediaCodecBuffer;
Loading