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

Commit df50b6d3 authored by Sungtak Lee's avatar Sungtak Lee Committed by Automerger Merge Worker
Browse files

Merge changes from topic "reland-64bit-omx" into main am: f67a94c5

parents dd3a6202 f67a94c5
Loading
Loading
Loading
Loading
+3 −4
Original line number Diff line number Diff line
@@ -1850,8 +1850,8 @@ c2_status_t Codec2Client::Component::setOutputSurface(
    uint64_t consumerUsage = kDefaultConsumerUsage;
    {
        if (surface) {
            int usage = 0;
            status_t err = surface->query(NATIVE_WINDOW_CONSUMER_USAGE_BITS, &usage);
            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));
@@ -1864,8 +1864,7 @@ c2_status_t Codec2Client::Component::setOutputSurface(
                // they do not exist inside of C2 scope. Any buffer usage shall be communicated
                // through the sideband channel.

                // do an unsigned conversion as bit-31 may be 1
                consumerUsage = (uint32_t)usage | kDefaultConsumerUsage;
                consumerUsage = usage | kDefaultConsumerUsage;
            }
        }

+1 −1
Original line number Diff line number Diff line
@@ -145,7 +145,7 @@ struct InputSurfaceConnection::Impl : public ComponentWrapper {
        //         C2AndroidMemoryUsage(C2MemoryUsage(usage.value)).
        //         asGrallocUsage();

        uint32_t grallocUsage =
        uint64_t grallocUsage =
                mSinkName.compare(0, 11, "c2.android.") == 0 ?
                GRALLOC_USAGE_SW_READ_OFTEN :
                GRALLOC_USAGE_HW_VIDEO_ENCODER;
+13 −0
Original line number Diff line number Diff line
@@ -230,6 +230,12 @@ status_t C2OMXNode::getParameter(OMX_INDEXTYPE index, void *params, size_t size)
            err = OK;
            break;
        }
        case OMX_IndexParamConsumerUsageBits64: {
            OMX_U64 *usage = (OMX_U64 *)params;
            *usage = mUsage;
            err = OK;
            break;
        }
        case OMX_IndexParamPortDefinition: {
            if (size < sizeof(OMX_PARAM_PORTDEFINITIONTYPE)) {
                return BAD_VALUE;
@@ -293,6 +299,13 @@ status_t C2OMXNode::setParameter(OMX_INDEXTYPE index, const void *params, size_t
            }
            mUsage = *((OMX_U32 *)params);
            return OK;

        case OMX_IndexParamConsumerUsageBits64:
            if (size != sizeof(OMX_U64)) {
                return BAD_VALUE;
            }
            mUsage = *((OMX_U64 *)params);
            return OK;
    }
    return ERROR_UNSUPPORTED;
}
+12 −5
Original line number Diff line number Diff line
@@ -206,12 +206,19 @@ public:
        mNode = new C2OMXNode(comp);
        mOmxNode = new hardware::media::omx::V1_0::utils::TWOmxNode(mNode);
        mNode->setFrameSize(mWidth, mHeight);

        // Usage is queried during configure(), so setting it beforehand.
        // 64 bit set parameter is existing only in C2OMXNode.
        OMX_U64 usage64 = mConfig.mUsage;
        status_t res = mNode->setParameter(
                (OMX_INDEXTYPE)OMX_IndexParamConsumerUsageBits64,
                &usage64, sizeof(usage64));

        if (res != OK) {
            OMX_U32 usage = mConfig.mUsage & 0xFFFFFFFF;
            (void)mNode->setParameter(
                    (OMX_INDEXTYPE)OMX_IndexParamConsumerUsageBits,
                    &usage, sizeof(usage));
        }

        return GetStatus(mSource->configure(
                mOmxNode, static_cast<hardware::graphics::common::V1_0::Dataspace>(mDataSpace)));
+21 −6
Original line number Diff line number Diff line
@@ -606,8 +606,16 @@ inline void wrapAs(AnwBuffer* t, GraphicBuffer const& l) {
    t->attr.height = l.getHeight();
    t->attr.stride = l.getStride();
    t->attr.format = static_cast<PixelFormat>(l.getPixelFormat());
    t->attr.layerCount = l.getLayerCount();
    t->attr.usage = l.getUsage();
    // HACK
    // anwBuffer.layerCount 8 bytes : GraphicBuffer::layerCount 4 bytes
    // anwBuffer.usage      4 bytes : GraphicBuffer::usage      8 bytes
    // We would like to retain high part of usage with high part of layerCount
    uint64_t usage = l.getUsage();
    uint32_t usageHigh = (usage >> 32);
    uint32_t usageLow = (0xFFFFFFFF & usage);
    uint32_t layerLow = l.getLayerCount();
    t->attr.layerCount = ((uint64_t(usageHigh) << 32) | layerLow);
    t->attr.usage = usageLow;
    t->attr.id = l.getId();
    t->attr.generationNumber = l.getGenerationNumber();
    t->nativeHandle = hidl_handle(l.handle);
@@ -637,30 +645,37 @@ inline bool convertTo(GraphicBuffer* l, AnwBuffer const& t) {
        }
    }

    size_t const numInts = 12 + (handle ? handle->numInts : 0);
    size_t const numInts = 13 + (handle ? handle->numInts : 0);
    int32_t* ints = new int32_t[numInts];

    size_t numFds = static_cast<size_t>(handle ? handle->numFds : 0);
    int* fds = new int[numFds];

    ints[0] = 'GBFR';
    ints[0] = 'GB01';
    ints[1] = static_cast<int32_t>(t.attr.width);
    ints[2] = static_cast<int32_t>(t.attr.height);
    ints[3] = static_cast<int32_t>(t.attr.stride);
    ints[4] = static_cast<int32_t>(t.attr.format);
    ints[5] = static_cast<int32_t>(t.attr.layerCount);
    // HACK
    // anwBuffer.layerCount 8 bytes : GraphicBuffer::layerCount 4 bytes
    // anwBuffer.usage      4 bytes : GraphicBuffer::usage      8 bytes
    // We would like to retain high part of usage with high part of layerCount
    uint32_t layer = (0xFFFFFFFF & t.attr.layerCount);
    uint32_t usageHigh = (t.attr.layerCount >> 32);
    ints[5] = layer;
    ints[6] = static_cast<int32_t>(t.attr.usage);
    ints[7] = static_cast<int32_t>(t.attr.id >> 32);
    ints[8] = static_cast<int32_t>(t.attr.id & 0xFFFFFFFF);
    ints[9] = static_cast<int32_t>(t.attr.generationNumber);
    ints[10] = 0;
    ints[11] = 0;
    ints[12] = usageHigh;
    if (handle) {
        ints[10] = static_cast<int32_t>(handle->numFds);
        ints[11] = static_cast<int32_t>(handle->numInts);
        int* intsStart = handle->data + handle->numFds;
        std::copy(handle->data, intsStart, fds);
        std::copy(intsStart, intsStart + handle->numInts, &ints[12]);
        std::copy(intsStart, intsStart + handle->numInts, &ints[13]);
    }

    void const* constBuffer = static_cast<void const*>(ints);
Loading