ruritanian,
能否提供实现GetModeInfo,NumModes和SetMode这三个函数的参考代码。我在我的display驱动中找到了这三个函数,但是实现挺简单的:
SCODE
TCCDISP::GetModeInfo(GPEMode *mode, int modeNo)
{
//RETAILMSG(TC_LOG_LEVEL(TC_DEBUG), (TEXT("[DISPLAY ] TCCDISP::GetModeInfo()\n\r")));
if (modeNo != 0)
{
RETAILMSG(TC_LOG_LEVEL(TC_ERROR), (TEXT("[DISPDRV:ERR] GetModeInfo() : modeNo = %d, Driver Support Only Mode 0\n\r"), modeNo));
return E_INVALIDARG;
}
*mode = *m_pMode;
return S_OK;
}
int
TCCDISP::NumModes()
{
RETAILMSG(TC_LOG_LEVEL(TC_DEBUG), (TEXT("[DISPLAY ] TCCDISP::NumModes()\n\r")));
return 1;
}
SCODE
TCCDISP::SetMode (INT modeId, HPALETTE *palette)
{
SCODE scRet = S_OK;
RETAILMSG(TC_LOG_LEVEL(TC_LOG), (TEXT("[DISPLAY ] ++TCCDISP::SetMode(%d)\n\r"), modeId));
if (modeId == 0)
{
m_dwPhysicalModeID = m_pMode->modeId;
// Create Palette
if (palette)
{
*palette = EngCreatePalette(PAL_BITFIELDS, 0, NULL, gBitMasks[0], gBitMasks[1], gBitMasks[2]);
}
//Allocate Primary Surface
if (NULL == m_pPrimarySurface)
{
if (FAILED(AllocSurface((DDGPESurf **)&m_pPrimarySurface,
m_nScreenWidthSave, m_nScreenHeightSave,
m_pMode->format, m_pModeEx->ePixelFormat,
GPE_REQUIRE_VIDEO_MEMORY)))
{
RETAILMSG(TC_LOG_LEVEL(TC_ERROR), (TEXT("[DISPLAY ] SetMode() : m_pPrimarySurface AllocSurface() Fail\n\r")));
scRet = E_INVALIDARG;
}
else
{
m_pVisibleSurface = (TCCDISPSurf*)m_pPrimarySurface;
}
}
m_pPrimarySurface->SetRotation(m_nScreenWidth, m_nScreenHeight, m_iRotate);
}
else
{
RETAILMSG(TC_LOG_LEVEL(TC_ERROR), (TEXT("[DISPLAY ] SetMode() : modeId = %d, Driver Support Only Mode 0\n\r"), modeId));
scRet = E_INVALIDARG;
}
#ifdef _USING_HW_ACCELETE_
//reserved for H/W Accelerate Dump Memory
pHWTempHeap = m_pVideoMemoryHeap->Alloc(800*480*4);
#endif
RETAILMSG(TC_LOG_LEVEL(TC_LOG), (TEXT("[DISPLAY ] --TCCDISP::SetMode()\n\r")));
return scRet;
}