📄 ddipu_sdc_overlay.cpp
字号:
m_ppData_Overlay.inputRGBPixelFormat.component1_offset = 8;
m_ppData_Overlay.inputRGBPixelFormat.component2_offset = 16;
m_ppData_Overlay.inputRGBPixelFormat.component0_width = 8;
m_ppData_Overlay.inputRGBPixelFormat.component1_width = 8;
m_ppData_Overlay.inputRGBPixelFormat.component2_width = 8;
break;
case ppDataWidth_16BPP:
m_ppData_Overlay.inputRGBPixelFormat.component0_offset = 0;
m_ppData_Overlay.inputRGBPixelFormat.component1_offset = 5;
m_ppData_Overlay.inputRGBPixelFormat.component2_offset = 11;
m_ppData_Overlay.inputRGBPixelFormat.component0_width = 5;
m_ppData_Overlay.inputRGBPixelFormat.component1_width = 6;
m_ppData_Overlay.inputRGBPixelFormat.component2_width = 5;
break;
default:
DEBUGMSG(GPE_ZONE_ERROR, (TEXT("%s: Source data format is invalid.\r\n"), __WFUNCTION__));
break;
}
}
// Set up output format and data width
m_ppData_Overlay.outputFormat = ppFormat_RGB;
switch(m_nScreenBpp)
{
case 24:
m_ppData_Overlay.outputDataWidth = ppDataWidth_24BPP;
m_ppData_Overlay.outputRGBPixelFormat.component0_offset = 0;
m_ppData_Overlay.outputRGBPixelFormat.component1_offset = 8;
m_ppData_Overlay.outputRGBPixelFormat.component2_offset = 16;
m_ppData_Overlay.outputRGBPixelFormat.component0_width = 8;
m_ppData_Overlay.outputRGBPixelFormat.component1_width = 8;
m_ppData_Overlay.outputRGBPixelFormat.component2_width = 8;
break;
case 16:
m_ppData_Overlay.outputDataWidth = ppDataWidth_16BPP;
m_ppData_Overlay.outputRGBPixelFormat.component0_offset = 0;
m_ppData_Overlay.outputRGBPixelFormat.component1_offset = 5;
m_ppData_Overlay.outputRGBPixelFormat.component2_offset = 11;
m_ppData_Overlay.outputRGBPixelFormat.component0_width = 5;
m_ppData_Overlay.outputRGBPixelFormat.component1_width = 6;
m_ppData_Overlay.outputRGBPixelFormat.component2_width = 5;
break;
default:
DEBUGMSG(GPE_ZONE_ERROR, (TEXT("%s: Display output BPP invalid\r\n"), __WFUNCTION__));
break;
}
// Set up post-processing channel CSC parameters
// based on input and output
switch(m_ppData_Overlay.outputFormat)
{
case ppFormat_YUV444:
case ppFormat_YUV422:
case ppFormat_YUV420:
case ppFormat_YUV444IL:
case ppFormat_YUYV422:
case ppFormat_YVYU422:
case ppFormat_UYVY422:
case ppFormat_VYUY422:
if ((m_ppData_Overlay.inputFormat == ppFormat_RGB) |
(m_ppData_Overlay.inputFormat == ppFormat_RGBA))
m_ppData_Overlay.CSCEquation = ppCSCR2Y_A1;
else
m_ppData_Overlay.CSCEquation = ppCSCNoOp;
break;
case ppFormat_RGB:
case ppFormat_RGBA:
if ((m_ppData_Overlay.inputFormat == ppFormat_YUV444IL) |
(m_ppData_Overlay.inputFormat == ppFormat_YUV444) |
(m_ppData_Overlay.inputFormat == ppFormat_YUV422) |
(m_ppData_Overlay.inputFormat == ppFormat_YUV420) |
(m_ppData_Overlay.inputFormat == ppFormat_YUYV422) |
(m_ppData_Overlay.inputFormat == ppFormat_YVYU422) |
(m_ppData_Overlay.inputFormat == ppFormat_UYVY422) |
(m_ppData_Overlay.inputFormat == ppFormat_VYUY422))
m_ppData_Overlay.CSCEquation = ppCSCY2R_A1;
else
m_ppData_Overlay.CSCEquation = ppCSCNoOp;
break;
}
m_ppData_Overlay.inputSize.height = (UINT16) (pSrcRcl->bottom - pSrcRcl->top);
m_ppData_Overlay.inputSize.width = (UINT16) (pSrcRcl->right - pSrcRcl->left);
// m_ppData_Overlay.inputSize.height = pSurf->Height();
// m_ppData_Overlay.inputSize.width = pSurf->Width();
m_ppData_Overlay.inputStride = pSurf->Stride();
switch (m_iRotate)
{
case DMDO_0:
m_ppData_Overlay.flipRot.verticalFlip = FALSE;
m_ppData_Overlay.flipRot.horizontalFlip = FALSE;
m_ppData_Overlay.flipRot.rotate90 = FALSE;
break;
case DMDO_90:
m_ppData_Overlay.flipRot.verticalFlip = TRUE;
m_ppData_Overlay.flipRot.horizontalFlip = TRUE;
m_ppData_Overlay.flipRot.rotate90 = TRUE;
break;
case DMDO_180:
m_ppData_Overlay.flipRot.verticalFlip = TRUE;
m_ppData_Overlay.flipRot.horizontalFlip = TRUE;
m_ppData_Overlay.flipRot.rotate90 = FALSE;
break;
case DMDO_270:
m_ppData_Overlay.flipRot.verticalFlip = FALSE;
m_ppData_Overlay.flipRot.horizontalFlip = FALSE;
m_ppData_Overlay.flipRot.rotate90 = TRUE;
break;
}
// Handle special TV mode settings
if (!m_bTVModeActive)
{
// Normal settings
m_ppData_Overlay.outputSize.height = m_pOverlaySurfaceOp->HeightHw;
m_ppData_Overlay.outputSize.width = m_pOverlaySurfaceOp->WidthHw;
m_ppData_Overlay.outputStride = m_pOverlaySurfaceOp->LineStride;
}
else
{
// If we are in TV mode, do not rotate overlay
m_ppData_Overlay.flipRot.verticalFlip = FALSE;
m_ppData_Overlay.flipRot.horizontalFlip = FALSE;
m_ppData_Overlay.flipRot.rotate90 = FALSE;
// Upsize output dimensions for TV (640x480)
m_ppData_Overlay.outputSize.height = m_pOverlaySurfaceOp->Height * 2;
m_ppData_Overlay.outputSize.width = m_pOverlaySurfaceOp->Width * 2;
m_ppData_Overlay.outputStride = m_ppData_Overlay.outputSize.width * m_pMode->Bpp / 8;
/*
DEBUGMSG(GPE_ZONE_HW, (TEXT("%s: Height: %x\n Width: %x\n HeightHw: %x\n WidthHw: %x\n LineStride: %x\n myheight: %x\n mywidth: %x\n mystride: %x\n\r\n"),
__WFUNCTION__, m_pOverlaySurfaceOp->Height, m_pOverlaySurfaceOp->Width,
m_pOverlaySurfaceOp->HeightHw, m_pOverlaySurfaceOp->WidthHw,
m_pOverlaySurfaceOp->LineStride, m_ppData_Overlay.outputSize.height,
m_ppData_Overlay.outputSize.width, m_ppData_Overlay.outputStride));
*/
}
m_ppData_Overlay.directDisplay = FALSE;
return;
}
/***********************************************************************
*
* These three functions are for future expansion (alpha blending and
* more efficient invert overlay)
*
***********************************************************************/
#if 0
/***********************************************************************
*
* FUNCTION: InverOverlay
*
* DESCRIPTION: This function is to invert the Graphic Window to the
* opposite of the current one.
*
* PARAMETERS:
*
* RETURNS:
* DD_OK successful
* others failed
*
**********************************************************************/
HRESULT DDIPU_SDC::InverOverlay(VOID)
{
if(m_pOverlaySurfaceOp->isUpsideDown)
{
SET_BITS(m_pLcdcReg->GWCR, LCDC_GWCR_GW_RVS, 0);
SET_BITS(m_pLcdcReg->GWSAR, LCDC_GWSAR_GWSA, \
(UINT32)m_pOverlaySurfaceOp->nBufPhysicalAddr);
m_pOverlaySurfaceOp->isUpsideDown = FALSE;
}
else
{
SET_BITS(m_pLcdcReg->GWCR, LCDC_GWCR_GW_RVS, 1);
SET_BITS(m_pLcdcReg->GWSAR, LCDC_GWSAR_GWSA, \
(UINT32)m_pOverlaySurfaceOp->nBufPhysicalAddr + m_pOverlaySurfaceOp->LineStride * (m_pOverlaySurfaceOp->Height - 1));
m_pOverlaySurfaceOp->isUpsideDown = TRUE;
}
return DD_OK;
}
/***********************************************************************
*
* FUNCTION: GetOverlayAlphaValue
*
* DESCRIPTION: This function is to get current transparency of the
* graphic window.
*
* PARAMETERS:
*
* RETURNS:
* DD_OK successful
* others failed
*
**********************************************************************/
HRESULT DDIPU_SDC::GetOverlayAlphaValue(VOID)
{
m_pOverlaySurfaceOp->Transparency = \
LCDC_GW_TRANSPARENCY(GET_BITS(m_pLcdcReg->GWCR, LCDC_GWCR_GWAV));
return DD_OK;
}
/***********************************************************************
*
* FUNCTION: SetOverlayAlphaValue
*
* DESCRIPTION: This function is to set current transparency of the
* graphic window.
*
* PARAMETERS:
*
* RETURNS:
* DD_OK successful
* others failed
*
**********************************************************************/
HRESULT DDIPU_SDC::SetOverlayAlphaValue(VOID)
{
if((m_pOverlaySurfaceOp->Transparency >= 0) &&
(m_pOverlaySurfaceOp->Transparency <= 0xFF))
{
SET_BITS(m_pLcdcReg->GWCR, LCDC_GWCR_GWAV, \
LCDC_GW_TRANSPARENCY(m_pOverlaySurfaceOp->Transparency));
return DD_OK;
}
else
{
SetLastError(ERROR_INVALID_PARAMETER);
return DDERR_INVALIDPARAMS;
}
}
#endif //0
//------------------------------------------------------------------------------
//
// Function: WaitForNotBusyOverlay
//
// This function waits until the graphics window of the IPU is ready to
// update.
//
// Parameters:
// None.
//
// Returns:
// None.
//
//------------------------------------------------------------------------------
VOID DDIPU_SDC::WaitForNotBusyOverlay(VOID)
{
DisplayPlaneWaitForNotBusy(DisplayPlane_1);
return;
}
//------------------------------------------------------------------------------
//
// Function: OverlayWindowSetup
//
// This function waits until the graphics window of the IPU is ready to
// update.
//
// Parameters:
// None.
//
// Returns:
// None.
//
//------------------------------------------------------------------------------
VOID DDIPU_SDC::OverlayWindowSetup(VOID)
{
POINT ptOverlayOffset;
DISPLAY_SDC_FG_CONFIG_DATA dispConfigData;
ptOverlayOffset.x = m_pOverlaySurfaceOp->XOffset;
ptOverlayOffset.y = m_pOverlaySurfaceOp->YOffset;
if (m_bTVModeActive)
{
ptOverlayOffset.x *= 2;
ptOverlayOffset.y *= 2;
}
ForegroundWindowSetOffset(&ptOverlayOffset);
dispConfigData.alpha = m_pOverlaySurfaceOp->Transparency;
dispConfigData.width = m_pOverlaySurfaceOp->WidthHw;
dispConfigData.height = m_pOverlaySurfaceOp->HeightHw;
dispConfigData.bpp = m_pOverlaySurfaceOp->Bpp;
dispConfigData.verticalFlip = m_pOverlaySurfaceOp->isUpsideDown;
dispConfigData.colorKey = m_pOverlaySurfaceOp->ColorKeyMask;
dispConfigData.plane = m_pOverlaySurfaceOp->ColorKeyPlane;
if (m_bTVModeActive)
{
dispConfigData.width = m_pOverlaySurfaceOp->Width * 2;
dispConfigData.height = m_pOverlaySurfaceOp->Height * 2;
}
if (!ForegroundWindowConfig(&dispConfigData))
{
DEBUGMSG(GPE_ZONE_ERROR, (TEXT("DDIPU_SDC SetOverlayPosition: ForegroundWindowConfig error\r\n")));
return;
}
return;
}
//------------------------------------------------------------------------------
//
// Function: SetupOverlayPosition
//
// This function waits until the graphics window of the IPU is ready to
// update.
//
// Parameters:
// pOverlaySurf
// [in/out] Surface for which the X and Y offsets are to
// be configured.
//
// X
// [in] Desired X offset of overlay surface in display.
//
// Y
// [in] Desired Y offset of overlay surface in display.
//
// Returns:
// None.
//
//------------------------------------------------------------------------------
void DDIPU_SDC::SetupOverlayPosition(pOverlaySurf_t pOverlaySurf, LONG X, LONG Y)
{
switch(m_iRotate){
case DMDO_0:
pOverlaySurf->XOffset = (UINT16)X;
pOverlaySurf->YOffset = (UINT16)Y;
break;
case DMDO_90:
pOverlaySurf->XOffset = (UINT16)Y;
pOverlaySurf->YOffset = (UINT16)(m_pMode->width - (X + pOverlaySurf->Width));
break;
case DMDO_180:
pOverlaySurf->XOffset = (UINT16)(m_pMode->width - (X + pOverlaySurf->Width));
pOverlaySurf->YOffset = (UINT16)(m_pMode->height - (Y + pOverlaySurf->Height));
break;
case DMDO_270:
pOverlaySurf->XOffset = (UINT16)(m_pMode->height - (Y + pOverlaySurf->Height));
pOverlaySurf->YOffset = (UINT16)X;
break;
}
}
//------------------------------------------------------------------------------
//
// Function: IsOverlaySurfEqual
//
// This function compares overlay surfaces to determine if they are equal.
// update.
//
// Parameters:
// pSurf1
// [in] Overlay surface descriptor 1.
//
// pSurf2
// [in] Overlay surface descriptor 2.
//
// Returns:
// TRUE if pSurf1 and pSurf2 are equal.
// FALSE if not.
//
//------------------------------------------------------------------------------
BOOL IsOverlaySurfEqual(pOverlaySurf_t pSurf1, pOverlaySurf_t pSurf2)
{
if ((pSurf1->Width == pSurf2->Width) &&
(pSurf1->Height == pSurf2->Height) &&
(pSurf1->WidthHw == pSurf2->WidthHw) &&
(pSurf1->HeightHw == pSurf2->HeightHw) &&
(pSurf1->LineStride == pSurf2->LineStride) &&
(pSurf1->XOffset == pSurf2->YOffset) &&
(pSurf1->Bpp == pSurf2->Bpp) &&
(pSurf1->Transparency == pSurf2->Transparency) &&
(pSurf1->isUpsideDown == pSurf2->isUpsideDown) &&
(pSurf1->ColorKeyMask == pSurf2->ColorKeyMask) &&
(pSurf1->ColorKeyPlane == pSurf2->ColorKeyPlane))
{
return TRUE;
}
else
{
return FALSE;
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -