⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 crtcrpro.c

📁 此代码为WCE5.0下显示器的源代码
💻 C
📖 第 1 页 / 共 5 页
字号:

//
// DESCRIPTION:
//  RageProEnumerateStandardModes is used by DAL to enumerate the set of
//  standard modes supported by a graphics controller.
//
// PARAMETERS:
//  hGCO            Handle of the controller object structure, which
//                  uniquely identifies the graphics controller object.
//  lpMI            Points to the mode information structure to be
//                  filled with the mode information of the specific mode
//                  index.
//  ulController    Specifies a bit vector specifying a single controller
//                  whose standard modes are being enumerated.
//  ulModeIndex     Specifies the index of the standard mode to be
//                  described in lpMI.
//
// RETURN VALUE:
//  The return value is TRUE if the controller has a mode at ulModeIndex.
//  Otherwise it is FALSE.
//
BOOL FAR RageProEnumerateStandardModes(
    HGCO hGCO,
    LPDEVMODE_INFO lpMI,
    ULONG ulController,
    ULONG ulModeIndex
    )
{
    // DEVMODE_INFO DevModeInfo;
   
    LPHW_RAGEPROCRTC_EXTENSION lpHwCrtc = (LPHW_RAGEPROCRTC_EXTENSION)hGCO;
   
    DALDEBUG((DALDBG_ENTRY_EXIT, "ATIRAGEIII RageProEnumerateStandardModes: *** entry point ***"));

    // Reset the pointers
    if (0 == ulModeIndex)
    {
        // Point to the top of the stadard mode table
        lpHwCrtc->lpCurrentMode = (LPMODE_DATA)&(Gco_ex_aModeData[0]);

        // We will enumerate modes beginning at 8 bpp then increment
        // by 8 to 16, 24 and 32.
        lpHwCrtc->ulCurrentBpp = 8;
    }

    //Task #5255 & 5287 Sony requested feature to use single INF for 1K, 1400x1050, 1024x480 panels
    while((lpHwCrtc->lpCurrentMode->BiosCrtcTiming.usFlags & CRTC_TIMING_FLAGS_PANEL_MODE) &&
          (lpHwCrtc->lpCurrentMode->DevModeInfo.ulModeFlags & DEVMODEFLAG_NONSTANDARDMODE))
    {
      // This mode is panel specific. So make sure that it applies to current panel.
      // Skip the mode if it does not exist in BIOS panel parameter table.
      // This will allow us to use same INF for multiple panels, including non-standard sizes e.g 1400x1050.
      if(!bIsBIOSSupportsPanelSpecificMode(hGCO, (LPDEVMODE_INFO)(&lpHwCrtc->lpCurrentMode->DevModeInfo)))
      {
        // Skip this mode since panel does not supports this panel specific mode.
        lpHwCrtc->lpCurrentMode++;
      }
      else
      {
        // Panel parameter table in BIOS supports this panel specific mode so don't skip it.
        break;
      }
    }
      
    // Loop through every mode available in the BIG mode list.
    if (0 != lpHwCrtc->lpCurrentMode->DevModeInfo.ulPelsWidth)
    {        
        // Fill in the structure to be returned.
        lpMI->ulModeFlags = lpHwCrtc->lpCurrentMode->DevModeInfo.ulModeFlags;
        lpMI->ulPelsWidth = lpHwCrtc->lpCurrentMode->DevModeInfo.ulPelsWidth;
        lpMI->ulPelsHeight = lpHwCrtc->lpCurrentMode->DevModeInfo.ulPelsHeight;
        lpMI->ulDisplayFrequency = lpHwCrtc->lpCurrentMode->DevModeInfo.ulDisplayFrequency;
        lpMI->ulBitsPerPixel = lpHwCrtc->ulCurrentBpp;

        // If we are at the last pixel depth for a mode, reset the
        // Bpp value and increment the Mode pointer.
        if (32 == lpHwCrtc->ulCurrentBpp)
        {
            // Reset the ulCurrentBPP value to 8 and increment the
            // pointer to the mode table.
            lpHwCrtc->ulCurrentBpp = 8;
            lpHwCrtc->lpCurrentMode++;
        }
        else
        {
            // Continue using the same resolution and frequency only
            // increment ulCurrentBPP to the next BPP value.
            lpHwCrtc->ulCurrentBpp += 8;
        }

        DALDEBUG((DALDBG_DETAIL,
                  "ATI RAGEIII RageProEnumerateStandardModes: \
                  %ldx%ldx%ldbpp at %ldHz - enumerated",
                  lpMI->ulPelsWidth,
                  lpMI->ulPelsHeight,
                  lpMI->ulBitsPerPixel,
                  lpMI->ulDisplayFrequency));

        DALDEBUG((DALDBG_ENTRY_EXIT, "ATI RAGEIII RageProEnumerateStandardModes: *** exit pass ***"));

        return TRUE;
    }

    DALDEBUG((DALDBG_DETAIL, "ATI RAGEIII RageProEnumerateStandardModes: no more modes"));

    // End of mode list
    DALDEBUG((DALDBG_ENTRY_EXIT, "ATIRAGEII RageProEnumerateStandardModes: *** exit point ***"));

    return FALSE;
}   // RageProEnumerateStandardModes()

//
// DESCRIPTION:
//  RageProGetGammaCorrection is used to retrieve the default gamma
//  correction for a graphics controller.
//
// PARAMETERS:
//  hGCO            Handle of the controller object structure, which
//                  uniquely identifies the graphics controller object.
//  ulController    Specifies a bit vector specifying a single controller
//                  whose standard modes are being enumerated.
//  lpaGamma        Points to an array of DEVCLUT structures containing
//                  the 24bpp colors to retrieve the gamma correction
//                  default values.
//
// RETURN VALUE:
//  None
//
VOID FAR RageProGetGammaCorrection(
    HGCO hGCO,
    ULONG ulController,
    LPDEVCLUT lpaGamma
    )
{
    ULONG ulCount;
    LPHW_RAGEPROCRTC_EXTENSION lpHwCrtc = (LPHW_RAGEPROCRTC_EXTENSION)hGCO;

    DALDEBUG((DALDBG_ENTRY_EXIT, "ATIRAGE RageProGetGammaCorrection: *** entry point ***"));

    //
    // Set the array to the default linear gamma:
    //
    for (ulCount = 0; ulCount < 256; ulCount++)
    {
        lpaGamma[ulCount].ucRed   =
        lpaGamma[ulCount].ucGreen =
        lpaGamma[ulCount].ucBlue  = (UCHAR)(ulCount & 0x000000FF);
    }

    DALDEBUG((DALDBG_ENTRY_EXIT, "ATIRAGE RageProGetGammaCorrection: *** exit ***"));
}   // RageProGetGammaCorrection()


//
// DESCRIPTION:
//  Used to query the minimum, maximum, and default values for the text
//  cursor blinking speed.
//
// PARAMETERS:
//  hGCO            Handle of the controller object structure, which
//                  uniquely identifies the controller.
//  lpAdjustment    Points to a hardware adjustment structure to be
//                  filled in with minimum, maximum, default and step
//                  values for the speed of the full screen DOS text
//                  cursor blinking.
//
// RETURN VALUE:
//  None
//
VOID FAR RageProGetTextCursorBlinkingAdjustment(
    HGCO hGCO,
    LPHW_ADJUSTMENT lpAdjustment
    )
{
    LPHW_RAGEPROCRTC_EXTENSION lpHwCrtc = (LPHW_RAGEPROCRTC_EXTENSION)hGCO;

    DALDEBUG((DALDBG_ENTRY_EXIT, "ATIRAGE RageProGetTextCursorBlinkingAdjustment: *** entry point ***"));

    lpAdjustment->lDefault  = VGA_BLINK_RATE_DEFAULT;
    lpAdjustment->lMin      = VGA_BLINK_RATE_MIN;
    lpAdjustment->lMax      = VGA_BLINK_RATE_MAX;
    lpAdjustment->lStep     = VGA_BLINK_RATE_STEP;

    DALDEBUG((DALDBG_ENTRY_EXIT, "ATIRAGE RageProGetTextCursorBlinkingAdjustment: *** exit ***"));
}   // RageProGetTextCursorBlinkingAdjustment()


//
// DESCRIPTION:
//  Used to query the minimum, maximum, and default values for the overlay
//  gamma.
//
// PARAMETERS:
//  hGCO            Handle of the controller object structure, which
//                  uniquely identifies the controller.
//  lpAdjustment    Points to a hardware adjustment structure to be
//                  filled in with minimum, maximum, default and step
//                  values for the speed of the full screen DOS text
//                  cursor blinking.
//
// RETURN VALUE:
//  None
//
VOID FAR RageProGetOverlayGammaAdjustment(
    HGCO hGCO,
    LPHW_ADJUSTMENT lpAdjustment
    )
{
    LPHW_RAGEPROCRTC_EXTENSION lpHwCrtc = (LPHW_RAGEPROCRTC_EXTENSION)hGCO;

    DALDEBUG((DALDBG_ENTRY_EXIT, "ATIRAGE RageProGetOverlayGammaAdjustment: *** entry point ***"));

    lpAdjustment->lDefault  = OVERLAY_BRIGHTNESS_DEFAULT;
    lpAdjustment->lMin      = OVERLAY_BRIGHTNESS_MIN;
    lpAdjustment->lMax      = OVERLAY_BRIGHTNESS_MAX;
    lpAdjustment->lStep     = OVERLAY_BRIGHTNESS_STEP;

    DALDEBUG((DALDBG_ENTRY_EXIT, "ATIRAGE RageProGetOverlayGammaAdjustment: *** exit ***"));
}   // RageProGetOverlayGammaAdjustment()


//
// DESCRIPTION:
//  RageProIsNonStandardModeSupported is used by DAL to query if a non-
//  standard mode added to the mode list by the OEM or user is supported
//  by a graphics controller.
//
// PARAMETERS:
//  hGCO            Handle of the controller object structure, which
//                  uniquely identifies the graphics controller object.
//
//  lpMI            Points to the mode information structure to be
//                  filled with the mode information of the specific mode
//                  index.
//
//  ulController    Specifies a bit vector specifying a single controller
//                  whose standard modes are being enumerated.
//
// RETURN VALUE:
//  The return value is TRUE if the controller supports the nonstandard
//  mode.  Otherwise it is FALSE.
//
BOOL FAR RageProIsNonStandardModeSupported(
    HGCO hGCO,
    LPDEVMODE_INFO lpMI,
    ULONG ulController
    )
{
    LPCAP_DATA   lpLookupCapData;

    LPMODE_DATA lpLookupModeData = (LPMODE_DATA)&(Gco_ex_aGameModeData[0]);   // Pointer to mode table
    LPCAP_DATA  lpFirstCapMode = (LPCAP_DATA)&(Gco_ex_aCapDataPro[0]);


    LPHW_RAGEPROCRTC_EXTENSION lpHwCrtc = (LPHW_RAGEPROCRTC_EXTENSION)hGCO;

    DALDEBUG((DALDBG_ENTRY_EXIT, "ATIRAGE RageProIsNonStandardModeSupported: *** entry point ***"));

    DALASSERT(NULL != lpMI, "Mode information structure is NULL");

    // Find this mode in the mode table.( Game mode table )
    while ((lpMI->ulPelsWidth        != lpLookupModeData->DevModeInfo.ulPelsWidth)  ||
           (lpMI->ulPelsHeight       != lpLookupModeData->DevModeInfo.ulPelsHeight) ||
           (lpMI->ulDisplayFrequency != lpLookupModeData->DevModeInfo.ulDisplayFrequency))
    {
        if (0 == lpLookupModeData->DevModeInfo.ulPelsWidth)
        {
            DALDEBUG((DALDBG_NORMAL, "ATIRAGE RageProIsNonStandardModeSupported: mode not in mode table"));
            return FALSE;           // TODO: Later use GTFs to determine if mode can be supported.
        }

        lpLookupModeData++;

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -