Share via


ATI Sample Display Driver Optimization (Windows CE 5.0)

Send Feedback

The sample ATI driver has a performance issue with video memory to video memory bit block transfers that also use TRANPARENCY.

The following code example shows how to resolve this issue by using this code to replace the ATI::AcceleratedSrcCopyBlt function in the %_WINCEROOT%\Public\Common\OAK\Drivers\Display\ATI directory.

SCODE
ATI::AcceleratedSrcCopyBlt (GPEBltParms *pBltParms)
{
   DWORD  DstCntl = DST_Y_TOP_TO_BOTTOM | DST_X_LEFT_TO_RIGHT;
   int    srcX = pBltParms->prclSrc->left + ((ATISurf *) (pBltParms->pSrc))->Left(); // left of source rect
   int    srcY = pBltParms->prclSrc->top + ((ATISurf *) (pBltParms->pSrc))->Top();   // top of source rect
   int    dstX = pBltParms->prclDst->left + ((ATISurf *) (pBltParms->pDst))->Left(); // left of dest rect
   int    dstY = pBltParms->prclDst->top + ((ATISurf *) (pBltParms->pDst))->Top();   // top of dest rect
   int    width = pBltParms->prclDst->right  - pBltParms->prclDst->left;             // Rectangle Width Data Store
   int    height = pBltParms->prclDst->bottom - pBltParms->prclDst->top;             // Rectangle Height Data Store

   RETAILMSG (ATI_FUNCTION_MSGS, (TEXT("ATI::AcceleratedSrcCopyBlt()\r\n")));
 
   // check for negative x or y direction and correct values accordingly

   if (!pBltParms->xPositive)
   {
          srcX += (width - 1);
          dstX += (width - 1);
          DstCntl &= ~DST_X_LEFT_TO_RIGHT;
   }
 
   if (!pBltParms->yPositive)
   {
          srcY += (height - 1);
          dstY += (height - 1);
          DstCntl &= ~DST_Y_TOP_TO_BOTTOM;
   }
 
   WaitForFIFO(10);           // wait for max number of possibly used registers to be available
 
   if (pBltParms->bltFlags & BLT_TRANSPARENT)
   {
          _memwD_reg (CLR_CMP_CNTL, COMPARE_SOURCE | COMPARE_EQUAL);    // turn on transparency
          _memwD_reg (CLR_CMP_CLR, pBltParms->solidColor);              // set comparison color
   }
 
   switch (pBltParms->rop4)
   {
          case   0x6666:       // SRCINVERT
                 _memwD_reg (DP_MIX, FRGD_MIX_D_XOR_S | BKGD_MIX_D);
                 break;
 
          case   0x8888:       // SRCAND
                 _memwD_reg (DP_MIX, FRGD_MIX_D_AND_S | BKGD_MIX_D);
                 break;
 
          default:

          case   0xCCCC:       // SRCCOPY
                 _memwD_reg (DP_MIX, FRGD_MIX_S | BKGD_MIX_D);
                 break;
 
          case   0xEEEE:       // SRCPAINT
                 _memwD_reg (DP_MIX, FRGD_MIX_D_OR_S | BKGD_MIX_D);
                 break;
   }
 
   _memwD_reg (DP_SRC, FRGD_SRC_BLIT);
   _memwD_reg (SRC_Y_X, (srcX << 16) | srcY);
   _memwD_reg (SRC_HEIGHT1_WIDTH1, (width << 16) | height);
   _memwD_reg (DST_CNTL, DstCntl);
   _memwD_reg (DST_Y_X, (dstX << 16) | dstY);
   _memwD_reg (DST_HEIGHT_WIDTH, (width << 16) | height);
 
   if (pBltParms->bltFlags & BLT_TRANSPARENT)
   {
          _memwD_reg (CLR_CMP_CNTL, COMPARE_DESTINATION | COMPARE_FALSE);      // turn off Transparency

   }
 
   return S_OK;
}

See Also

FLAT Sample Display Driver | ATI Sample Display Driver | Sample DrvEscape Function | Sample Blit Acceleration | Display Driver Performance Profiling | Display Driver Registry Settings | Display Driver Development Concepts | Display Driver Extensions | Display Driver Recommendations

Send Feedback on this topic to the authors

Feedback FAQs

© 2006 Microsoft Corporation. All rights reserved.