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

Commit 7733af86 authored by Kalesh Singh's avatar Kalesh Singh Committed by Gerrit Code Review
Browse files

Merge "media codec2: Remove use of hardcoded PAGE_SIZE 4096" into main

parents 141d6b83 8ad767b1
Loading
Loading
Loading
Loading
+2 −1
Original line number Diff line number Diff line
@@ -239,6 +239,7 @@ void Codec2Fuzzer::deInitDecoder() {
}

void Codec2Fuzzer::decodeFrames(const uint8_t* data, size_t size) {
  static const size_t kPageSize = getpagesize();
  std::unique_ptr<BufferSource> bufferSource = std::make_unique<BufferSource>(data, size);
  if (!bufferSource) {
    return;
@@ -270,7 +271,7 @@ void Codec2Fuzzer::decodeFrames(const uint8_t* data, size_t size) {
    work->input.ordinal.timestamp = 0;
    work->input.ordinal.frameIndex = ++numFrames;
    work->input.buffers.clear();
    int32_t alignedSize = C2FUZZER_ALIGN(frameSize, PAGE_SIZE);
    int32_t alignedSize = C2FUZZER_ALIGN(frameSize, kPageSize);

    std::shared_ptr<C2LinearBlock> block;
    status = mLinearPool->fetchLinearBlock(
+2 −1
Original line number Diff line number Diff line
@@ -438,6 +438,7 @@ void decodeNFrames(const std::shared_ptr<android::Codec2Client::Component>& comp
                   std::ifstream& eleStream, android::Vector<FrameInfo>* Info, int offset,
                   int range, bool signalEOS = true) {
    typedef std::unique_lock<std::mutex> ULock;
    static const size_t kPageSize = getpagesize();
    int frameID = offset;
    int maxRetry = 0;
    while (1) {
@@ -479,7 +480,7 @@ void decodeNFrames(const std::shared_ptr<android::Codec2Client::Component>& comp
        ASSERT_EQ(eleStream.gcount(), size);

        work->input.buffers.clear();
        auto alignedSize = ALIGN(size, PAGE_SIZE);
        auto alignedSize = ALIGN(size, kPageSize);
        if (size) {
            std::shared_ptr<C2LinearBlock> block;
            ASSERT_EQ(C2_OK, linearPool->fetchLinearBlock(
+2 −1
Original line number Diff line number Diff line
@@ -179,6 +179,7 @@ public:
    static Impl *Alloc(int ionFd, size_t size, size_t align, unsigned heapMask, unsigned flags, C2Allocator::id_t id);

    c2_status_t map(size_t offset, size_t size, C2MemoryUsage usage, C2Fence *fence, void **addr) {
        static const size_t kPageSize = getpagesize();
        (void)fence; // TODO: wait for fence
        *addr = nullptr;
        if (!mMappings.lock()->empty()) {
@@ -201,7 +202,7 @@ public:
            prot |= PROT_WRITE;
        }

        size_t alignmentBytes = offset % PAGE_SIZE;
        size_t alignmentBytes = offset % kPageSize;
        size_t mapOffset = offset - alignmentBytes;
        size_t mapSize = size + alignmentBytes;
        Mapping map = { nullptr, alignmentBytes, mapSize };
+2 −1
Original line number Diff line number Diff line
@@ -170,6 +170,7 @@ class C2DmaBufAllocation : public C2LinearAllocation {

c2_status_t C2DmaBufAllocation::map(size_t offset, size_t size, C2MemoryUsage usage, C2Fence* fence,
                                    void** addr) {
    static const size_t kPageSize = getpagesize();
    (void)fence;  // TODO: wait for fence
    *addr = nullptr;
    if (!mMappings.lock()->empty()) {
@@ -192,7 +193,7 @@ c2_status_t C2DmaBufAllocation::map(size_t offset, size_t size, C2MemoryUsage us
        prot |= PROT_WRITE;
    }

    size_t alignmentBytes = offset % PAGE_SIZE;
    size_t alignmentBytes = offset % kPageSize;
    size_t mapOffset = offset - alignmentBytes;
    size_t mapSize = size + alignmentBytes;
    Mapping map = {nullptr, alignmentBytes, mapSize};