|
切换LCD分辨率时,调色板创建错误,大家来探讨一下!
[复制链接]
MINI2440开发板下为了支持动态修改分辨率,在S3C2440DISP:S3C2440DISP()中生成了一个2个元素的数组GPEModeEx m_ModeInfoEx[2],保存了2个显示模式的分辨率,NumModes()改为返回2,此外其他修改的源代码如下:
SCODE S3C2440DISP::GetModeInfo(GPEMode *mode, INT modeNumber)
{
RETAILMSG(DBGLCD, (TEXT("++S3C2440DISP::GetModeInfo\r\n")));
*mode = m_ModeInfoEx[modeNumber].modeInfo;
RETAILMSG(DBGLCD, (TEXT("--S3C2440DISP::GetModeInfo(modeNumber=%d)\r\n"),modeNumber));
return S_OK;
}
到这里,应该都没什么问题,但是下面这个函数修改代码后,出现了运行错误,代码和错误信息分别列出:
SCODE S3C2440DISP::SetMode (INT modeId, HPALETTE *palette)
{
int nBPP;
RETAILMSG(DBGLCD, (TEXT("++S3C2440DISP::SetMode(modeId=%d)\r\n"),modeId));
if (palette)
{
RETAILMSG(DBGLCD, (TEXT("Calling EngCreatePalette\r\n")));
nBPP = m_pMode->Bpp/8 - 1;
switch (m_pMode->Bpp)
{
//case 8:
case 16:
case 24:
case 32:
*palette = ourengineCallbacks->EngCreatePalette (PAL_BITFIELDS,
0,
NULL,
BitMasks[nBPP][0],
BitMasks[nBPP][1],
BitMasks[nBPP][2]);
break;
default :
RETAILMSG(1, (TEXT("ERR !!! S3C2440DISP::SetMode , m_pMode->Bpp = %d \r\n"),m_pMode->Bpp));
}
// This sets the surface address alignment
m_nSurfaceBitsAlign = (m_pMode->Bpp == 24) ? (128 * 3) : 128;
//Allocate our primary surface here
if(NULL == m_pPrimarySurface)
{
if(modeId==0)
{
if(FAILED(AllocSurface((DDGPESurf **)&m_pPrimarySurface, 240,
320, m_pMode->format, m_pModeEx->ePixelFormat,
GPE_REQUIRE_VIDEO_MEMORY)))
{
RETAILMSG (1, (L"Couldn't allocate primary surface\n"));
return E_INVALIDARG;
}
}
if(modeId==1)
{
if(FAILED(AllocSurface((DDGPESurf **)&m_pPrimarySurface, 240,
320, m_pMode->format, m_pModeEx->ePixelFormat,
GPE_REQUIRE_VIDEO_MEMORY)))
{
RETAILMSG (1, (L"Couldn't allocate primary surface\n"));
return E_INVALIDARG;
}
}
}
if(modeId==0)
{
m_pPrimarySurface->SetRotation(240, 320, m_iRotate);
}
if(modeId==1)
{
m_pPrimarySurface->SetRotation(240, 320, m_iRotate);
}
}
DynRotate(m_iRotate);
RETAILMSG(DBGLCD, (TEXT("--S3C2440DISP::SetMode\r\n")));
return S_OK;
}
在应用程序改变分辨率后,重新创建调色板运行到这里的代码时,出现以下错误:
Calling EngCreatePalette
Exception 'Data Abort' (4): Thread-Id=06640002(pth=8271f000), Proc-Id=00400002(pprc=82008308) 'NK.EXE', VM-active=06630002(pprc=8270addc) 'Window.exe'
PC=c0874048(s3c2440disp.dll+0x00004048) RA=c0874044(s3c2440disp.dll+0x00004044) SP=d33cf924, BVA=0000000c
Exception 'Raised Exception' (-1): Thread-Id=06640002(pth=8271f000), Proc-Id=00400002(pprc=82008308) 'NK.EXE', VM-active=06630002(pprc=8270addc) 'Window.exe'
PC=c003bc10(k.coredll.dll+0x0001bc10) RA=802384c8(kernel.dll+0x000064c8) SP=d33cf558, BVA=ffffffff
有哪位朋友能找出这个错误是什么原因造成的吗?我觉得问题比较怪异,调色板在系统启动时,是可以正常使用的,但是一切换分辨率就出现这个错误,并且WINCE进入死机状态。
|
|