📄 hwverify.cpp
字号:
CopySurface(pbySurfStart, // Copy src
m_sVerifyRgn.right - m_sVerifyRgn.left,
m_sVerifyRgn.bottom - m_sVerifyRgn.top,
ulDstStride,
((PBYTE)m_pvDestSwCopy + ulCopyOffset), // Copy dst
ulDstStride,
ulDstBpp);
/* Now make a copy for pdump if we want to, NOTE copying from DestSwCopy and not FB as it should be quicker */
if (m_bPDumpFailures == TRUE)
{
pbySurfStart = ((PBYTE)m_pvDestSwCopy + ulCopyOffset);
CopySurface(pbySurfStart, // Copy src
m_sVerifyRgn.right - m_sVerifyRgn.left,
m_sVerifyRgn.bottom - m_sVerifyRgn.top,
ulDstStride,
((PBYTE)m_pvDestPDumpCopy + ulCopyOffset), // Copy dst
ulDstStride,
ulDstBpp);
}
if (m_eVerDst == VERDST_RECT_PLUS)
{
m_ulNoDestCopy++;
/*
If we are verifing the dest plus a pixel and we do not need to copy the dest
rect we need to copy the one pxiel border around the out size
*/
if (m_bExtendTop == TRUE)
{
ulCopyOffset = (ULONG)(m_sVerifyRgn.top * ulDstStride) + (ULONG)(m_sVerifyRgn.left * (ulDstBpp / 8));
pbySurfStart = (PBYTE)(m_pbyDstPtr + ulCopyOffset);
CopySurface(pbySurfStart, // Copy src
m_sVerifyRgn.right - m_sVerifyRgn.left,
1,
ulDstStride,
((PBYTE)m_pvDestSwCopy + ulCopyOffset), // Copy dst
ulDstStride,
ulDstBpp);
/* Now make a copy for pdump if we want to, NOTE copying from destswcopy and not FB as it should be quicker */
if (m_bPDumpFailures == TRUE)
{
pbySurfStart=((PBYTE)m_pvDestSwCopy + ulCopyOffset);
CopySurface(pbySurfStart, // Copy src
m_sVerifyRgn.right - m_sVerifyRgn.left,
1,
ulDstStride,
((PBYTE)m_pvDestPDumpCopy + ulCopyOffset), // Copy dst
ulDstStride,
ulDstBpp);
}
}
if (m_bExtendBottom == TRUE)
{
ulCopyOffset = (ULONG)((m_sVerifyRgn.bottom-1) * ulDstStride) + (ULONG)(m_sVerifyRgn.left * (ulDstBpp / 8));
pbySurfStart = (PBYTE)(m_pbyDstPtr + ulCopyOffset);
CopySurface(pbySurfStart, // Copy src
m_sVerifyRgn.right - m_sVerifyRgn.left,
1,
ulDstStride,
((PBYTE)m_pvDestSwCopy + ulCopyOffset), // Copy dst
ulDstStride,
ulDstBpp);
/* Now make a copy for pdump if we want to, NOTE copying from destswcopy and not FB as it should be quicker */
if (m_bPDumpFailures == TRUE)
{
pbySurfStart = ((PBYTE)m_pvDestSwCopy + ulCopyOffset);
CopySurface(pbySurfStart, // Copy src
m_sVerifyRgn.right - m_sVerifyRgn.left,
1,
ulDstStride,
((PBYTE)m_pvDestPDumpCopy + ulCopyOffset), // Copy dst
ulDstStride,
ulDstBpp);
}
}
if (m_bExtendLeft == TRUE)
{
ulCopyOffset = (ULONG)(m_sVerifyRgn.top * ulDstStride) + (ULONG)(m_sVerifyRgn.left * (ulDstBpp / 8));
pbySurfStart = (PBYTE)(m_pbyDstPtr + ulCopyOffset);
CopySurface(pbySurfStart, // Copy src
1,
m_sVerifyRgn.bottom - m_sVerifyRgn.top,
ulDstStride,
((PBYTE)m_pvDestSwCopy + ulCopyOffset), // Copy dst
ulDstStride,
ulDstBpp);
/* Now make a copy for pdump if we want to, NOTE copying from destswcopy and not FB as it should be quicker */
if (m_bPDumpFailures == TRUE)
{
pbySurfStart = ((PBYTE)m_pvDestSwCopy + ulCopyOffset);
CopySurface(pbySurfStart, // Copy src
1,
m_sVerifyRgn.bottom - m_sVerifyRgn.top,
ulDstStride,
((PBYTE)m_pvDestPDumpCopy + ulCopyOffset), // Copy dst
ulDstStride,
ulDstBpp);
}
}
if (m_bExtendRight == TRUE)
{
ulCopyOffset = (ULONG)(m_sVerifyRgn.top * ulDstStride) + (ULONG)((m_sVerifyRgn.right-1) * (ulDstBpp / 8));
pbySurfStart = (PBYTE)(m_pbyDstPtr + ulCopyOffset);
CopySurface(pbySurfStart, // Copy src
1,
m_sVerifyRgn.bottom - m_sVerifyRgn.top,
ulDstStride,
((PBYTE)m_pvDestSwCopy + ulCopyOffset), // Copy dst
ulDstStride,
ulDstBpp);
/* Now make a copy for pdump if we want to, NOTE copying from destswcopy and not FB as it should be quicker */
if (m_bPDumpFailures == TRUE)
{
pbySurfStart=((PBYTE)m_pvDestSwCopy + ulCopyOffset);
CopySurface(pbySurfStart, // Copy src
1,
m_sVerifyRgn.bottom - m_sVerifyRgn.top,
ulDstStride,
((PBYTE)m_pvDestPDumpCopy + ulCopyOffset), // Copy dst
ulDstStride,
ulDstBpp);
}
}
}//VERDST_RECT_PLUS
return (TRUE);
}
/***********************************************************************************
Function Name : UpdateClipRegions
Inputs :
Outputs :
Returns :
Globals Used :
Description :
************************************************************************************/
void CHWVerify::UpdateClipRegions (PRECT prclClip)
{
if (prclClip == NULL)
{
m_nClipIndex = m_nClipRectCount = 0;
}
else
{
m_nClipRectCount++;
if (m_nClipIndex < MAX_HWV_RECTS)
{
memcpy(&m_prclClip[m_nClipIndex], prclClip, sizeof(RECT));
m_nClipIndex++;
}
}
}
/***********************************************************************************
Function Name : UpdateStripeBufInfo
Inputs :
Outputs :
Returns :
Globals Used :
Description :
************************************************************************************/
void CHWVerify::UpdateStripeBufInfo (PBUFINFO psVidBufInfo)
{
if (psVidBufInfo == NULL)
{
m_nBufInfoIndex = 0;
}
else if (m_nBufInfoIndex < MAX_HWV_RECTS)
{
memcpy(&m_VidBuffInfo[m_nBufInfoIndex], psVidBufInfo, sizeof(BUFINFO));
m_nBufInfoIndex++;
}
}
/***********************************************************************************
Function Name : UpdateMaskBufInfo
Inputs :
Outputs :
Returns :
Globals Used :
Description :
************************************************************************************/
void CHWVerify::UpdateMaskBufInfo (PBUFINFO psVidBufInfo)
{
/* there can only be one */
memcpy(&m_VidBuffInfo[MAX_HWV_RECTS], psVidBufInfo, sizeof(BUFINFO));
}
/***********************************************************************************
Function Name : UpdatePaletteAddr
Inputs :
Outputs :
Returns :
Globals Used :
Description :
************************************************************************************/
void CHWVerify::UpdatePaletteAddr (PPALINFO psPalInfo)
{
m_psPalInfo = psPalInfo;
}
/***********************************************************************************
Function Name : VerifyHW
Inputs :
Outputs :
Returns :
Globals Used :
Description :
************************************************************************************/
BOOL CHWVerify::VerifyHW(GPEBltParms *psParms)
{
PVOID pvCmpFail=NULL;
ULONG ulByteOffsetofClipStart;
ULONG ulClipRgnX;
ULONG ulClipRgnY;
PVOID pvHwDrawnSurfCmpStart;
PVOID pvSwDrawnSurfCmpStart;
TCHAR tszBuf[128];
ULONG ulStride = psParms->pDst->Stride();
EGPEFormat eDstFmt = psParms->pDst->Format();
ULONG ulBpp = EGPEFormatToBpp[eDstFmt];
m_ulAccelerated++;
/* Calc bytes from start of surfaces to start of clip rgn as we only compare the clip region */
ulByteOffsetofClipStart = (ULONG)(m_sVerifyRgn.top * ulStride) +
(ULONG)(m_sVerifyRgn.left * (ulBpp / 8));
/* Find start of compare surfaces */
pvHwDrawnSurfCmpStart = (PVOID)((PBYTE)psParms->pDst->Buffer() + ulByteOffsetofClipStart);
pvSwDrawnSurfCmpStart = (PVOID)((PBYTE)m_pvDestSwCopy + ulByteOffsetofClipStart);
/* Find size of clip rgn */
ulClipRgnX = m_sVerifyRgn.right - m_sVerifyRgn.left;
ulClipRgnY = m_sVerifyRgn.bottom - m_sVerifyRgn.top;
if ((psParms->pConvert) &&
(psParms->pSrc->Format() == gpe32Bpp) &&
(eDstFmt == gpe32Bpp))
{
/* Check if we have a error but ignore */
pvCmpFail = Compare32BppSurfacesWithoutAlpha((PBYTE)pvHwDrawnSurfCmpStart,
ulClipRgnX, ulClipRgnY,
ulStride,
(PBYTE)pvSwDrawnSurfCmpStart,
ulStride,
ulBpp);
}
else
{
/* Check if we have a error */
pvCmpFail = CompareSurfaces((PBYTE)pvHwDrawnSurfCmpStart,
ulClipRgnX, ulClipRgnY,
ulStride,
(PBYTE)pvSwDrawnSurfCmpStart,
ulStride,
ulBpp);
}
if (pvCmpFail == NULL) // It passed the test but do we still want to capture it ?
{
if (m_bForceFail || gdwActionReplay)
{
pvCmpFail = psParms->pDst->Buffer(); // Capture this blt at offset 0
}
}
if (pvCmpFail != NULL)
{
ULONG ulFailOffset = (ULONG)pvCmpFail- (ULONG)psParms->pDst->Buffer();
ULONG ulFailX = ((ulFailOffset % ulStride) * 8) / ulBpp;
ULONG ulFailY = ulFailOffset / ulStride;
BOOL bDumpCompleteSurface = TRUE;
RECT *prclClip = m_prclClip;
m_bForceFail = FALSE;
/* Create dir for all the files */
CreateDirectory(m_tszHWVerPath, NULL);
MessageAndPDumpComment (("BitBlt : HwVerify failure number %ld", m_ulHwVerifyFailureCo));
PrintSurfaceDetails (L"Destination", psParms->pDst, (PRECT)psParms->prclDst, FALSE, eDstFmt, NULL);
PrintSurfaceDetails (L"Source", psParms->pSrc, (PRECT)psParms->prclSrc, TRUE, eDstFmt, psParms->pLookup);
PrintSurfaceDetails (L"Pattern", psParms->pBrush, (PRECT)psParms->pptlBrush, TRUE, eDstFmt, psParms->pLookup);
PrintSurfaceDetails (L"Mask", psParms->pMask, (PRECT)psParms->prclMask, TRUE, eDstFmt, psParms->pLookup);
MessageAndPDumpComment (("BitBlt : ROP code is 0x%lx", psParms->rop4));
MessageAndPDumpComment (("BitBlt : Sw drawn surf @ 0x%lx", m_pvDestSwCopy));
MessageAndPDumpComment (("BitBlt : Verify region rgn (%ld, %ld) pixels starting @ (%ld, %ld)", ulClipRgnX, ulClipRgnY, m_sVerifyRgn.left, m_sVerifyRgn.top));
MessageAndPDumpComment (("BitBlt : HW operation failed verify with Sw emulation @ 0x%lx in Hw drawn dst surf", pvCmpFail));
MessageAndPDumpComment (("BitBlt : HW operation failed verify with Sw emulation @ 0x%lx in Sw drawn surf", (PBYTE)m_pvDestSwCopy + ulFailOffset));
MessageAndPDumpComment (("BitBlt : HW verify error is 0x%lx bytes into dest surf, which is pixel (%ld, %ld)", ulFailOffset, ulFailX, ulFailY));
MessageAndPDumpComment (("BitBlt : The blit has %ld clipping rgns that are :", m_nClipRectCount));
for (int nIdx = 0; nIdx < m_nClipIndex; nIdx++, prclClip++)
{
MessageAndPDumpComment(("BitBlt : Clip rgn (%ld, %ld) pixels starting @ (%ld, %ld)",
prclClip->right - prclClip->left,
prclClip->bottom - prclClip->top,
prclClip->left,
prclClip->top));
}
if (m_nClipIndex != m_nClipRectCount)
{
MessageAndPDumpComment(("BitBlt : Only %d clip regions were saved", MAX_HWV_RECTS));
}
if (psParms->pMask && !psParms->pMask->InVideoMemory() &&
((psParms->pMask->Format() == gpe1Bpp) || (psParms->pMask->Format() == gpe4Bpp)))
{
MessageAndPDumpComment (("BitBlt : Generating MaskInFB.bmp"));
wcscpy(tszBuf, m_tszHWVerPath);
wcscat(tszBuf, L"\\maskinfb.bmp");
CreateBmp ( tszBuf,
m_VidBuffInfo[MAX_HWV_RECTS].pvLinAddr,
m_VidBuffInfo[MAX_HWV_RECTS].ulWidth,
m_VidBuffInfo[MAX_HWV_RECTS].ulHeight,
m_VidBuffInfo[MAX_HWV_RECTS].ulStride,
EGPEFormatToBpp[psParms->pMask->Format()],
psParms->pDst->Format(),
(RGBQUAD *)&gMaskPalette);
}
if (psParms->pSrc && !psParms->pSrc->InVideoMemory() && (m_nBufInfoIndex > 0))
{
int nStart = m_nBufInfoIndex - (NUM_OF_STRIPED_BUFFERS);
if (nStart < 0)
{
nStart = 0;
}
MessageAndPDumpComment (("BitBlt : Generating SrcInFB.bmp"));
for (int sn = nStart; sn < m_nBufInfoIndex; sn++)
{
wsprintf(tszBuf, L"%s\\Srcinfb%d.bmp", m_tszHWVerPath, sn);
CreateBmp ( tszBuf,
m_VidBuffInfo[sn].pvLinAddr,
m_VidBuffInfo[sn].ulWidth,
m_VidBuffInfo[sn].ulHeight,
m_VidBuffInfo[sn].ulStride,
EGPEFormatToBpp[psParms->pSrc->Format()],
psParms->pDst->Format(),
m_psPalInfo->prgbqSrcPalette);
}
}
// hw_rgn.bmp
MessageAndPDumpComment (("BitBlt : Generating hw_rgn.bmp, verify rgn that Hw rendered"));
wcscpy(tszBuf, m_tszHWVerPath);
wcscat(tszBuf, L"\\hw_rgn.bmp");
CreateBmp ( tszBuf,
pvHwDrawnSurfCmpStart,
ulClipRgnX,
ulClipRgnY,
ulStride,
ulBpp,
psParms->pDst->Format(),
m_psPalInfo->prgbqSrcPalette);
// sw_rgn.bmp
MessageAndPDumpComment (("BitBlt : Generating sw_rgn.bmp, verify rgn that Sw rendered"));
wcscpy(tszBuf, m_tszHWVerPath);
wcscat(tszBuf, L"\\sw_rgn.bmp");
CreateBmp ( tszBuf,
pvSwDrawnSurfCmpStart,
ulClipRgnX,
ulClipRgnY,
ulStride,
ulBpp,
psParms->pDst->Format(),
m_psPalInfo->prgbqSrcPalette);
// hw_all.bmp
MessageAndPDumpComment (("BitBlt : Generating hw_all.bmp, dest surface that Hw rendered to"));
wcscpy(tszBuf, m_tszHWVerPath);
wcscat(tszBuf, L"\\hw_all.bmp");
CreateBmp ( tszBuf,
psParms->pDst->Buffer(),
m_lDstWidthRotated,
m_lDstHeightRotated,
ulStride,
ulBpp,
psParms->pDst->Format(),
m_psPalInfo->prgbqSrcPalette);
// sw_all.bmp
MessageAndPDumpComment(("BitBlt : Generating sw_all.bmp, dest surface that Sw rendered to"));
wcscpy(tszBuf, m_tszHWVerPath);
wcscat(tszBuf, L"\\sw_all.bmp");
CreateBmp ( tszBuf,
m_pvDestSwCopy,
m_lDstWidthRotated,
m_lDstHeightRotated,
ulStride,
ulBpp,
psParms->pDst->Format(),
m_psPalInfo->prgbqSrcPalette);
if (m_bPDumpFailures == TRUE)
{
// before_all.bmp
MessageAndPDumpComment (("BitBlt : Generating before_all.bmp, dest surface before any rendering"));
wcscpy(tszBuf, m_tszHWVerPath);
wcscat(tszBuf, L"\\before_all.bmp");
CreateBmp ( tszBuf,
m_pvDestPDumpCopy,
m_lDstWidthRotated,
m_lDstHeightRotated,
ulStride,
ulBpp,
psParms->pDst->Format(),
m_psPalInfo->prgbqSrcPalette);
}
BuildPrmFile(psParms);
#if PDUMP
/* save pdumping */
PDumpFlushVirtual(m_szLDBList);
#endif
/* Do we want to stop */
if (m_bUnattendedMode == FALSE)
{
DebugBreak();
//
// Action replay option :
//
// This restores the destination surface to it's former state so you can repeat the blt again.
// To do this you will need to put a breakpoint at a higher level (eg./ DrvBitBlt)
// using the stack window, and then when it gets there you must
// force the program counter back to repeat the operation.
//
// This allows you to make some tweaks using the debugger to fix the problem second time round.
// You can have as many action replays as you want.
//
if (gdwActionReplay)
{
ULONG ulCopyOffset;
ULONG ulDstStride = psParms->pDst->Stride();
ULONG ulDstBpp = EGPEFormatToBpp[psParms->pDst->Format()];
// Offset to start copying
ulCopyOffset = (ULONG)(m_sVerifyRgn.top * ulDstStride) + (ULONG)(m_sVerifyRgn.left * (ulDstBpp / 8));
CopySurface(((PBYTE)m_pvDestPDumpCopy + ulCopyOffset), // Copy src = Dest copy
m_sVerifyRgn.right - m_sVerifyRgn.left,
m_sVerifyRgn.bottom - m_sVerifyRgn.top,
ulDstStride,
((PBYTE)psParms->pDst->Buffer() + ulCopyOffset), // Copy dst = Actual dest
ulDstStride,
ulDstBpp);
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -