This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

Linux/AM5728: GC320 multisource compositing not supported

Part Number: AM5728


Tool/software: Linux

I need to composite 2 DMABUFs captured from 2 different VIP ports on the AM5728. I am using the ti-gc320-tests git repository and the Vivante GC320 PDF documentation as examples.

So far, I can feed DMABUFs from the VIPs into the GC320 and successfully do things like Pixel Format Conversion, Scaling, and Rotation. What I need to do now is compositing.

Specifically, I am studying the example code in:

ti-gc320-test/tests/src/test/hal/common/UnitTest/units/gal2D/MultiSourceBlitRotation/101/101.c

When I implement this code into my existing test application, I always get the error: "gcvSTATUS_NOT_SUPPORTED" when I call gco2D_MultiSourceBlit. Here is the function in my test application:

/**
 * gc320 renderCompositedFrames()
 * Purpose: Perform a render cycle for compositing 2 input rames together
 *
 * @param inputBuffer1 - DMABUF type input buffer
 * @param DMABUF type input buffer
 *
 * @return inputBuffer2 - Return bool success or failure
 */
gctBOOL Gc320::renderCompositedFrames(dmabuf_buffer *inputBuffer1, dmabuf_buffer *inputBuffer2) {

    gceSTATUS status;

    // Destination Rectangle
    gcsRECT targetRect;
    gcsRECT sourceVLRect;
    gcsRECT sourceIRRect;

    // Destination Rectangle
    targetRect.left = 0;
    targetRect.top = 0;
    targetRect.right = FRAME_WIDTH; // These affect the output image ( destination rect )
    targetRect.bottom = FRAME_HEIGHT; // These affect the output image ( destination rect )

    // VL Source Rectangle
    sourceVLRect.left = 0;
    sourceVLRect.top = 0;
    sourceVLRect.right = FRAME_WIDTH; // These affect the input image ( source rect )
    sourceVLRect.bottom = FRAME_HEIGHT; // These affect the input image ( source rect )

    // IR Source Rectangle
    sourceIRRect.left = 0;
    sourceIRRect.top = 0;
    sourceIRRect.right = FRAME_WIDTH; // These affect the input image ( source rect )
    sourceIRRect.bottom = FRAME_HEIGHT; // These affect the input image ( source rect )

    // Set the underlying buffer for VL
    void *VLDataPtr = omap_bo_map(inputBuffer1->bo[0]); // mmap the DMABUF
    configureYuYvSourceSurfaceForVL(VLDataPtr);

    // Set the underlying buffer for IR
    void *IRDataPtr = omap_bo_map(inputBuffer2->bo[0]); // mmap the DMABUF
    configureYuYvSourceSurfaceForIR(IRDataPtr);

    // clear dest temp with grey color
    gcmONERROR(Gal2DCleanSurface(m_Hal, m_TempDstSurf, COLOR_ARGB8(0x00, 0x80, 0x80, 0x80)));

    // Index 1 for VL and index 2 for IR

    ////////////////////// VL //////////////////////////////////////////

    gcmONERROR(gco2D_SetCurrentSourceIndex(m_Engine2d, 0));

    gcmONERROR(gco2D_SetGenericSource(
                   m_Engine2d,
                   (gctUINT32_PTR)&m_VLSrcVirtAddr, 1,
                   (gctUINT32_PTR)&m_VLSrcStride, 1,
                   gcvLINEAR,
                   m_VLSrcFormat,
                   gcvSURF_0_DEGREE,
                   (gctUINT32)inputBuffer1->width,
                   (gctUINT32)inputBuffer1->height));

    gcmONERROR(gco2D_SetSource(m_Engine2d, &sourceVLRect));

    gcmONERROR(gco2D_SetROP(m_Engine2d, 0xCC, 0xCC));

    // disable mirror
    gcmONERROR(gco2D_SetBitBlitMirror(m_Engine2d, gcvFALSE, gcvFALSE));

    ////////////////////// IR //////////////////////////////////////////

    gcmONERROR(gco2D_SetCurrentSourceIndex(m_Engine2d, 1));

    gcmONERROR(gco2D_SetGenericSource(
                   m_Engine2d,
                   (gctUINT32_PTR)&m_IRSrcVirtAddr, 1,
                   (gctUINT32_PTR)&m_IRSrcStride, 1,
                   gcvLINEAR,
                   m_IRSrcFormat,
                   gcvSURF_0_DEGREE,
                   (gctUINT32)inputBuffer2->width,
                   (gctUINT32)inputBuffer2->height));

    gcmONERROR(gco2D_SetSource(m_Engine2d, &sourceIRRect));

    gcmONERROR(gco2D_SetROP(m_Engine2d, 0xCC, 0xCC));

    // disable mirror
    gcmONERROR(gco2D_SetBitBlitMirror(m_Engine2d, gcvFALSE, gcvFALSE));

    ////////////////////////////////////////////////////////////////////

    // disable mirror
    gcmONERROR(gco2D_SetBitBlitMirror(m_Engine2d, gcvFALSE, gcvFALSE));

    gcmONERROR(gco2D_SetClipping(m_Engine2d, &targetRect));

    gcmONERROR(gco2D_SetGenericTarget(
                   m_Engine2d,
                   (gctUINT32_PTR)&m_TempDstPhysAddr, 1,
                   (gctUINT32_PTR)&m_TempDstStride, 1,
                   gcvLINEAR,
                   m_TempDstFormat,
                   gcvSURF_0_DEGREE,
                   m_TempDstWidth,
                   m_TempDstHeight));

    gcmONERROR(gco2D_MultiSourceBlit(m_Engine2d, 0xF, &targetRect, 1));

    // disable mirror
    gcmONERROR(gco2D_SetBitBlitMirror(m_Engine2d, gcvFALSE, gcvFALSE));

    gcmONERROR(gco2D_Flush(m_Engine2d));

    /* draw result to display surface. */
    gcmONERROR(gco2D_SetGenericSource(
                   m_Engine2d,
                   (gctUINT32_PTR)&m_TempDstPhysAddr, 1,
                   (gctUINT32_PTR)&m_TempDstStride, 1,
                   gcvLINEAR,
                   m_TempDstFormat,
                   gcvSURF_0_DEGREE,
                   m_TempDstWidth,
                   m_TempDstHeight));

    gcmONERROR(gco2D_SetSource(m_Engine2d, &targetRect));

    gcmONERROR(gco2D_SetGenericTarget(
                   m_Engine2d,
                   (gctUINT32_PTR)&m_TempDstPhysAddr, 1,
                   (gctUINT32_PTR)&m_TempDstStride, 1,
                   gcvLINEAR,
                   m_TempDstFormat,
                   gcvSURF_0_DEGREE,
                   m_TempDstWidth,
                   m_TempDstHeight));

    gcmONERROR(gco2D_SetStretchRectFactors(
                   m_Engine2d,
                   &targetRect,
                   &targetRect
                   ));

    gcmONERROR(gco2D_StretchBlit(
                   m_Engine2d,
                   1,
                   &targetRect,
                   0xCC, 0xCC,
                   m_DstFormat
                   ));

    gcmONERROR(gco2D_Flush(m_Engine2d));

    gcmONERROR(gcoHAL_Commit(m_Hal, gcvTRUE));

    return gcvTRUE;

OnError:
    fprintf(stderr,"%s(%d) failed:%s\n",__FUNCTION__, __LINE__, gcoOS_DebugStatus2Name(status));
    return gcvFALSE;

}

Is multisource blitting not supported? If it is, what is wrong with the code above? Thank you for the support.

The documentation states that it is supported:

Linux Kernel Version:

uname -r
4.4.41

GAL Version:

GC320 IRQ: 304
Galcore version 5.0.11.33433

GC320 IRQ: 304

[318156.999191] Galcore version 5.0.11.33433