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

Commit 100038ab authored by codeworkx's avatar codeworkx
Browse files

softwarerenderer: exynos4: mali alignment

Change-Id: I6bbe13570d3ef6c268f637ccf7be9d6843eed91f
parent 1e5dab5b
Loading
Loading
Loading
Loading
+15 −2
Original line number Original line Diff line number Diff line
@@ -164,12 +164,25 @@ void SoftwareRenderer::render(
        const uint8_t *src_u = (const uint8_t *)data + mWidth * mHeight;
        const uint8_t *src_u = (const uint8_t *)data + mWidth * mHeight;
        const uint8_t *src_v = src_u + (mWidth / 2 * mHeight / 2);
        const uint8_t *src_v = src_u + (mWidth / 2 * mHeight / 2);


        uint8_t *dst_y = (uint8_t *)dst;
#ifdef EXYNOS4210_ENHANCEMENTS
        size_t dst_y_size = buf->stride * buf->height;
        void *pYUVBuf[3];

        CHECK_EQ(0, mapper.unlock(buf->handle));
        CHECK_EQ(0, mapper.lock(
                buf->handle, GRALLOC_USAGE_SW_WRITE_OFTEN | GRALLOC_USAGE_YUV_ADDR, bounds, pYUVBuf));

        size_t dst_c_stride = buf->stride / 2;
        uint8_t *dst_y = (uint8_t *)pYUVBuf[0];
        uint8_t *dst_v = (uint8_t *)pYUVBuf[1];
        uint8_t *dst_u = (uint8_t *)pYUVBuf[2];
#else
        size_t dst_c_stride = ALIGN(buf->stride / 2, 16);
        size_t dst_c_stride = ALIGN(buf->stride / 2, 16);
        size_t dst_y_size = buf->stride * buf->height;
        size_t dst_c_size = dst_c_stride * buf->height / 2;
        size_t dst_c_size = dst_c_stride * buf->height / 2;
        uint8_t *dst_y = (uint8_t *)dst;
        uint8_t *dst_v = dst_y + dst_y_size;
        uint8_t *dst_v = dst_y + dst_y_size;
        uint8_t *dst_u = dst_v + dst_c_size;
        uint8_t *dst_u = dst_v + dst_c_size;
#endif


        for (int y = 0; y < mCropHeight; ++y) {
        for (int y = 0; y < mCropHeight; ++y) {
            memcpy(dst_y, src_y, mCropWidth);
            memcpy(dst_y, src_y, mCropWidth);