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

Commit a7a9a70c authored by Jeykumar Sankaran's avatar Jeykumar Sankaran Committed by Giulio Cervera
Browse files

libs/rs: Fix parameter swap in rsAllocation

This change swaps index and size parameter in rsAllocation calls as
Google's comment suggests
parent 29d4d938
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -567,7 +567,7 @@ nAllocationElementData1D(JNIEnv *_env, jobject _this, RsContext con, jint alloc,
    jint len = _env->GetArrayLength(data);
    LOG_API("nAllocationElementData1D, con(%p), alloc(%p), offset(%i), comp(%i), len(%i), sizeBytes(%i)", con, (RsAllocation)alloc, offset, compIdx, len, sizeBytes);
    jbyte *ptr = _env->GetByteArrayElements(data, NULL);
    rsAllocation1DElementData(con, (RsAllocation)alloc, offset, lod, ptr, compIdx, sizeBytes);
    rsAllocation1DElementData(con, (RsAllocation)alloc, offset, lod, ptr, sizeBytes, compIdx);
    _env->ReleaseByteArrayElements(data, ptr, JNI_ABORT);
}

+2 −2
Original line number Diff line number Diff line
@@ -494,7 +494,7 @@ void rsdAllocationData3D_alloc(const android::renderscript::Context *rsc,

void rsdAllocationElementData1D(const Context *rsc, const Allocation *alloc,
                                uint32_t x,
                                const void *data, uint32_t cIdx, uint32_t sizeBytes) {
                                const void *data, uint32_t sizeBytes, uint32_t cIdx) {
    DrvAllocation *drv = (DrvAllocation *)alloc->mHal.drv;

    uint32_t eSize = alloc->mHal.state.elementSizeBytes;
@@ -515,7 +515,7 @@ void rsdAllocationElementData1D(const Context *rsc, const Allocation *alloc,

void rsdAllocationElementData2D(const Context *rsc, const Allocation *alloc,
                                uint32_t x, uint32_t y,
                                const void *data, uint32_t cIdx, uint32_t sizeBytes) {
                                const void *data, uint32_t sizeBytes, uint32_t cIdx) {
    DrvAllocation *drv = (DrvAllocation *)alloc->mHal.drv;

    uint32_t eSize = alloc->mHal.state.elementSizeBytes;
+4 −4
Original line number Diff line number Diff line
@@ -130,7 +130,7 @@ void Allocation::elementData(Context *rsc, uint32_t x, const void *data,
        return;
    }

    rsc->mHal.funcs.allocation.elementData1D(rsc, this, x, data, cIdx, sizeBytes);
    rsc->mHal.funcs.allocation.elementData1D(rsc, this, x, data, sizeBytes, cIdx);
    sendDirty(rsc);
}

@@ -164,7 +164,7 @@ void Allocation::elementData(Context *rsc, uint32_t x, uint32_t y,
        return;
    }

    rsc->mHal.funcs.allocation.elementData2D(rsc, this, x, y, data, cIdx, sizeBytes);
    rsc->mHal.funcs.allocation.elementData2D(rsc, this, x, y, data, sizeBytes, cIdx);
    sendDirty(rsc);
}

@@ -429,13 +429,13 @@ void rsi_Allocation1DData(Context *rsc, RsAllocation va, uint32_t xoff, uint32_t
}

void rsi_Allocation2DElementData(Context *rsc, RsAllocation va, uint32_t x, uint32_t y, uint32_t lod, RsAllocationCubemapFace face,
                                 const void *data, size_t eoff, uint32_t sizeBytes) { // TODO: this seems wrong, eoff and sizeBytes may be swapped
                                 const void *data, uint32_t sizeBytes, size_t eoff) {
    Allocation *a = static_cast<Allocation *>(va);
    a->elementData(rsc, x, y, data, eoff, sizeBytes);
}

void rsi_Allocation1DElementData(Context *rsc, RsAllocation va, uint32_t x, uint32_t lod,
                                 const void *data, size_t eoff, uint32_t sizeBytes) { // TODO: this seems wrong, eoff and sizeBytes may be swapped
                                 const void *data, uint32_t sizeBytes, size_t eoff) {
    Allocation *a = static_cast<Allocation *>(va);
    a->elementData(rsc, x, data, eoff, sizeBytes);
}