• AVR Freaks

Bug in Graphics Library V2.10

Author
concertinaman
Bug Sorter
  • Total Posts : 250
  • Reward points : 0
  • Joined: 2007/06/14 05:56:58
  • Location: UK
  • Status: offline
2010/10/31 10:44:10 (permalink)
0

Bug in Graphics Library V2.10

 
Bitmaps are drawn stretched*2 in the X direction, but at the correct size so only half the bitmap appears.
 
This happens when orientation is 0 or 180 and 8bpp is selected.
 
To see the fault, compile the "Primitives Layer Demo" for the PowerTip 470 x 240 and with 8bpp selected in
HardwareProfile_PIC24FJ256DA210_DEV_BOARD_16PMP_MCHP_DA210_PH480272T_005_I11Q.h
 
The bug is not visable at 16bpp or with orientation 90 or 270.
#1

12 Replies Related Threads

    frankcf1
    Super Member
    • Total Posts : 1105
    • Reward points : 0
    • Joined: 2009/01/09 08:20:10
    • Location: Northern New Jersey
    • Status: offline
    Re:Bug in Graphics Library V2.10 2010/10/31 15:40:25 (permalink)
    0
    It must have something to do with the setup for that board. I have 4 products using 8bpp in both 0 and 180 orientation without any problems.
     
    #2
    concertinaman
    Bug Sorter
    • Total Posts : 250
    • Reward points : 0
    • Joined: 2007/06/14 05:56:58
    • Location: UK
    • Status: offline
    Re:Bug in Graphics Library V2.10 2010/10/31 17:00:40 (permalink)
    0
    Are you using the PIC24FJ256DA210?
     
    This bug is easily demonstrated using the PIC24FJ256DA210 Development Board (DM240312) with the Powertip 480x272 Board (AC164127-6). Bitmaps are in PIC flash memory, not external.
     
    I noticed it when using a Hitachi VGA display. I then tested it on a clean install of the Application Libraries v2010-08-04, on the Powertip display.
    post edited by concertinaman - 2010/11/01 02:16:22
    #3
    frankcf1
    Super Member
    • Total Posts : 1105
    • Reward points : 0
    • Joined: 2009/01/09 08:20:10
    • Location: Northern New Jersey
    • Status: offline
    Re:Bug in Graphics Library V2.10 2010/11/01 05:09:14 (permalink)
    0
    No I'm not using that PIC. That's what I meant I'm using a PIC24HJ256GP610A on one product and the PIC24FJ128GA010 on the others and it works fine using the Microchip library. It must be something to do with the PIC24FJ256DA210 setup.
    post edited by frankcf1 - 2010/11/01 05:10:42
    #4
    concertinaman
    Bug Sorter
    • Total Posts : 250
    • Reward points : 0
    • Joined: 2007/06/14 05:56:58
    • Location: UK
    • Status: offline
    Re:Bug in Graphics Library V2.10 2010/11/01 05:19:15 (permalink)
    0
    Thanks,

    I did some more investigating and 0,180 and 90,270 are handled differently in the driver file "MicrochipGraphicsModule.c".
    90,270 seems to use PutPixel() and 0,180 uses GFX_StartCopy().

    So now I'm wondering if its a silicon issue in the PIC24FJ256DA210.

    A comment from Microchip would be welcome.
    #5
    DEKTRON
    Super Member
    • Total Posts : 1183
    • Reward points : 0
    • Joined: 2003/11/07 12:35:05
    • Location: Calne, Wiltshire, England
    • Status: offline
    Re:Bug in Graphics Library V2.10 2010/11/06 14:26:20 (permalink)
    0
    I had this problem too, using 8 bpp the bmp was only showing the left side of the image. seems to me in MicrochipGraphicsModule.c where it says "// Write pixel to screen" it uses *pData++ = color; where pData is defined as a WORD pointer, so it increments 2 bytes at each write. I changed in Ln 1438 the definition "WORD *pData" to "unsigned char *pData" and the bmp now displays correctly. Not sure that's the best solution, but it works! comments welcome - Phil
    #6
    jtemples
    عُضْوٌ جَدِيد
    • Total Posts : 11241
    • Reward points : 0
    • Joined: 2004/02/13 12:31:19
    • Location: Southern California
    • Status: offline
    Re:Bug in Graphics Library V2.10 2010/11/06 15:26:29 (permalink)
    0
    concertinaman

    A comment from Microchip would be welcome.

    This isn't the place to get comments from Microchip.  Use support.microchip.com for that.

    #7
    concertinaman
    Bug Sorter
    • Total Posts : 250
    • Reward points : 0
    • Joined: 2007/06/14 05:56:58
    • Location: UK
    • Status: offline
    Re:Bug in Graphics Library V2.10 2010/11/08 03:45:05 (permalink)
    0
    Well spotted Phil,
     
    That does appear to be the root of the issue.
    Microchip will need a better fix as just changing it to unsigned char produces compiler warnings and also breaks 16bpp mode.
     
    As it turns out, I've had to abandon the DA210. 8bpp was too limiting and 16bpp too slow at a max of 30 frames/sec.
    I'm now prototyping a pic32/ssd1963 solution.
     
    #8
    tagajaro
    Super Member
    • Total Posts : 374
    • Reward points : 0
    • Joined: 2009/07/15 08:54:51
    • Location: A maya bird in Arizona.
    • Status: offline
    Re:Bug in Graphics Library V2.10 2010/11/09 08:32:34 (permalink)
    0
    There is a bug on version 2.10 of PIC24FJ256DA210 Driver on 8bpp images.
    The fix will be on Version 2.11 which will come out anytime soon.

    #9
    Klemen
    New Member
    • Total Posts : 16
    • Reward points : 0
    • Joined: 2011/03/11 08:31:39
    • Location: Slovenia (EU)
    • Status: offline
    Re:Bug in Graphics Library V2.10 2011/05/02 12:25:21 (permalink)
    0
    Hello all,

    I have the same problem with version 2.11. and PIC24FJ256DA210. Is this bug fixed or not. My configuration: DISP_ORIENTATION = 90;,

    Copy of function:

    void PutImage8BPPExt(SHORT left, SHORT top, void *image, BYTE stretch)
    {
        register DWORD  memOffset;
        BITMAP_HEADER   bmp;
        BYTE            lineBuffer[(GetMaxX() + (DWORD) 1)];
        WORD            palette[256], color;   
        BYTE            *pData;
        WORD             outputSize;
        WORD            *pBufAddr, *pData2;
        WORD            lineBuffer2[(GetMaxX() + (DWORD) 1)];

        BYTE            temp = 0;
        WORD            sizeX, sizeY;
        WORD            x, y;
        WORD            yc;
        BYTE            stretchY;

        #ifdef USE_PALETTE
        BYTE                *pByteData;
        #endif

        // Get image header
        ExternalMemoryCallback(image, 0, sizeof(BITMAP_HEADER), &bmp);
        // Get palette (256 entries)
        ExternalMemoryCallback(image, sizeof(BITMAP_HEADER), 256 * sizeof(WORD), palette);
        // Set offset to the image data
        memOffset = sizeof(BITMAP_HEADER) + 256 * sizeof(WORD);
       
        // Get size
        sizeX = bmp.width;
        sizeY = bmp.height;

        if (stretch == IMAGE_X2) {
            outputSize = sizeX << 1;
        }      
        else //if (stretch == IMAGE_NORMAL)
        {
            outputSize = sizeX;
        }

        // area of the buffer to use is only the area that
        // spans the viewable area
        if ((outputSize > GetMaxX()+1) || (left + outputSize > GetMaxX()+1))
            outputSize = GetMaxX() + 1 - left;        
           
        pBufAddr = lineBuffer2;

        GFX_WaitForCommandQueue(16);
        GFX_WaitForGpu();

        GFX_SetWorkArea1((WORD)pBufAddr);
           GFX_SetWorkArea2(GFX_DISPLAY_BUFFER_START_ADDRESS);
        GFX_RCC_SetSrcOffset(0);

        yc = top;

        for(y = 0; (y < sizeY) && (yc < GetMaxY()); y++)
        {

            // Get line
            ExternalMemoryCallback(image, memOffset, sizeX, lineBuffer);
            memOffset += sizeX;
           
            // render the pixels only in the viewable area (display buffer area)
            for(stretchY = 0; stretchY < stretch; stretchY++)
            {
                  pData = lineBuffer;
                // get the location of the line buffer
               #if ((DISP_ORIENTATION == 0) || (DISP_ORIENTATION == 270))
                      pData2 = lineBuffer2;
               #elif ((DISP_ORIENTATION == 180) || (DISP_ORIENTATION == 90))  
                       pData2 = &lineBuffer2[outputSize-1];
                   
                    #ifdef USE_PALETTE
                    if(IsPaletteEnabled())
                    {
                        pData2 -= outputSize/2;
                    }
                    #endif
                #endif

                #ifdef USE_PALETTE
                    pByteData = (BYTE*)pData2;
                #endif
                   
                // process the pixels of the current line
                for(x = 0; (x < outputSize) && (x + left < GetMaxX()); x++)
                {
                    // take one pixel data when needed
                    if (x%stretch == 0)
                        temp = *pData++;

                    #ifdef USE_PALETTE
                           if(IsPaletteEnabled())
                            color = temp;
                           else
                            color = palette[temp];
                    #else
                            color = palette[temp];
                    #endif
                   
                       #if ((DISP_ORIENTATION == 0) || (DISP_ORIENTATION == 270))
                        #ifdef USE_PALETTE
                              if(IsPaletteEnabled())
                              {
                                  *pByteData++ = (BYTE)color;
                              }
                              else
                              {
                                *pData2++ = color;
                              }   
                        #else
                            *pData2++ = color;
                        #endif
                    #elif ((DISP_ORIENTATION == 180) || (DISP_ORIENTATION == 90))  
                       #ifdef USE_PALETTE
                              if(IsPaletteEnabled())
                              {
                                  *pByteData-- = (BYTE)color;
                              }
                              else
                              {
                                *pData2-- = color;
                              }   
                        #else
                            *pData2-- = color;
                        #endif
                       #endif           
                } // for(x = 0; (x < outputSize) && (x + left < GetMaxX()); x++)


                #if ((DISP_ORIENTATION == 0) || (DISP_ORIENTATION == 180))
                    GFX_RCC_SetSize(x, 1);
                #else   
                    GFX_RCC_SetSize(1, x);
                #endif
                #if (DISP_ORIENTATION == 0)
                    GFX_RCC_SetDestOffset((yc * (DWORD)DISP_HOR_RESOLUTION) + left);
                #elif (DISP_ORIENTATION == 90)
                    GFX_RCC_SetDestOffset(((GetMaxX() + 1 - (left + outputSize)) * (DWORD)DISP_HOR_RESOLUTION) + yc);
                #elif (DISP_ORIENTATION == 180)
                    GFX_RCC_SetDestOffset(((GetMaxY() + 1 - yc) * (DWORD)DISP_HOR_RESOLUTION) + GetMaxX() + 1 - (left+outputSize));
                #elif (DISP_ORIENTATION == 270)
                    GFX_RCC_SetDestOffset((left * (DWORD)DISP_HOR_RESOLUTION) + (GetMaxY() + 1 - yc));
                #endif     
                GFX_RCC_StartCopy(RCC_COPY, RCC_ROP_C, RCC_SRC_ADDR_CONTINUOUS, RCC_DEST_ADDR_DISCONTINUOUS);

                // update the vertical position counter
                yc++;
            }  // for(stretchY = 0; stretchY < stretch; stretchY++)
        }  // for(y = 0; (y < sizeY) && (yc < GetMaxY()); y++)

        // make sure the GPUs are done before exiting
        GFX_WaitForCommandQueue(16);
        GFX_WaitForGpu();

    }
    #10
    Klemen
    New Member
    • Total Posts : 16
    • Reward points : 0
    • Joined: 2011/03/11 08:31:39
    • Location: Slovenia (EU)
    • Status: offline
    Re:Bug in Graphics Library V2.10 2011/05/03 14:26:33 (permalink)
    0
    If I use Palette function than picture is also displayed correctly. So the problem stays for displaing BMP 8bpp DISP_ORIENTATION = 90, any solution?

    <problem description:
    <I had this problem too, using 8 bpp the bmp was only showing the left side of the image. seems to me in MicrochipGraphicsModule.c where it says "// Write pixel to screen" it uses *pData++ = color; where pData is defined as a WORD <pointer, so it increments 2 bytes at each write. I changed in Ln 1438 the definition "WORD *pData" to "unsigned char *pData" and the bmp now displays correctly. Not sure that's the best solution, but it works! comments welcome - Phil
    < DEKTRON


    Best regards,
    Klemen
    #11
    seyyah
    Super Member
    • Total Posts : 609
    • Reward points : 0
    • Joined: 2004/05/14 12:49:28
    • Status: offline
    Re:Bug in Graphics Library V2.10 2011/05/05 02:27:25 (permalink)
    0
    Hi Klemen, how do you use palette?
    #12
    Klemen
    New Member
    • Total Posts : 16
    • Reward points : 0
    • Joined: 2011/03/11 08:31:39
    • Location: Slovenia (EU)
    • Status: offline
    Re:Bug in Graphics Library V2.10 2011/05/06 00:14:12 (permalink)
    0
    I don't want to use PALLETE. I fix problem with use the same code like in PALLETE MODE. I get instructions from microchip:

    Problem Resolution:
    [font="arial,sans-serif; color: navy; font-size: 10pt"][[font="arial,sans-serif; color: navy; font-size: 10pt"][[
    [<font]

    Best regards,
    Klemen
    #13
    Jump to:
    © 2019 APG vNext Commercial Version 4.5