?? dalgdo.c
字號:
ULONG d;
// BOOL bRebuildModeTable;
ULONG ulConnected, ulOldFlags;
// bRebuildModeTable = FALSE;
ulConnected = 0;
lpCRTDisplay = NULL;
if (lpHDE->ulFlags & HDAL_SHARINGMODETABLE)
{
// since DAL is sharing the mode table from another DAL instance, the connected
// displays are also shared
return(lpHDE->ulConnectedDisplays);
}
// Zero initialize ulHotPluggableDisplays.
lpHDE->ulHotPlaggableDisplays = 0;
// loop through each of the displays, or the array of them
for (d = 0; d < lpHDE->ulDisplaysCount; d++)
{
lpDisplay = (LPDEVGDO) &lpHDE->aDisplays[d];
if (lpDisplay->lpHWED->ulDisplayType & HW_DISPLAY_TYPE_CRT)
{
lpCRTDisplay = lpDisplay;
}
// Store old flags for future comparison
ulOldFlags = lpDisplay->ulFlags;
vIsDisplayPhysicallyConnected(lpHDE, lpDisplay);
if ((ulOldFlags & GDO_PHYSICALLY_CONNECTED) !=
(lpDisplay->ulFlags & GDO_PHYSICALLY_CONNECTED))
{
// if the display was last detected as not connected, and has
// now been connected, DAL assumes the display properties could
// have changed between the last connected display, so the mode
// table needs to be updated.
lpHDE->ulFlags |= HDAL_UPDATEDISPLAYSMODESUPPORTED;
// since the physical connection state of the displays has changed,
// mark this data as dirty in the DAL.
lpHDE->ulFlags |= HDAL_SAVECONNECTED;
// if this display was not connected before but
// now it is we must call the vDisplayQueryModeRestriction
// to initialize DDC, ATI Monitor Info or OS Monitor Info
// data. This then will be used later in the call
// vAddDisplaysToModeTable(lpHDE)
if (lpDisplay->ulFlags & GDO_PHYSICALLY_CONNECTED)
{
vDisplayQueryModeRestrictions(lpHDE, lpDisplay);
}
else //clear GDO_EDID flag if display not connected
{
lpDisplay->ulFlags &= ~(GDO_EDID | GDO_EDID_REPORT_TO_OS_ONLY);
}
// This display is a newly detected device. If this device
// hooks to the INITIALIZE_DEVICE hook and has EDID then the GDO
// function will be called.
if ((lpDisplay->lpHWED->ulFunctionHooks & GDO_HOOK_INITIALIZE_DEVICE) &&
(lpDisplay->ulFlags & (GDO_EDID | GDO_EDID_REPORT_TO_OS_ONLY)))
{
(*lpDisplay->lpHWED->pfnInitializeDevice)(lpDisplay->hGDO, lpDisplay->sEDID);
}
}
if (lpDisplay->ulFlags & GDO_PHYSICALLY_CONNECTED)
{
// if the display is connected, mark it in the returned bit vector
// of the connected displays.
ulConnected |= VECTORFROMINDEX(d);
// This display was detected as connected. Mark it as hot
// pluggable if this GDO reports that
if (lpDisplay->lpHWED->ulFunctionHooks & GDO_HOOK_HOTPLUGABLEDEVICE)
{
// NOTE: some GDOs require an additional check for ACK for EDID
// before the conclusion about whether the monitor is hotpluggable or not.
// See EPR 34587. This particular workaround (and any similar workarounds)
// must be the responsibility of GDO and as such it is skipped here.
//
if((*lpDisplay->lpHWED->pfnIsDeviceHotPluggable)(lpDisplay->hGDO))
{
lpHDE->ulHotPlaggableDisplays |= VECTORFROMINDEX(d);
}
}
}
}
// Update the local dal structure it is used in subsequent functions.
lpHDE->ulConnectedDisplays = ulConnected;
// on 9x, it one trigger to cause DAL to rebuild the mode table, picking
// up changes to the Monitor Information for the CRT, is when the ATI
// property pages call DALCWDDE AdapterGetInfo, which triggers this
// physical display detection routine.
if (NULL != lpCRTDisplay)
{
if(bDisplayMonitorInfoModeRestrictions(lpHDE, lpCRTDisplay))
{
// some property of the Operating Systems MonitorInfo structure has
// changed, so the DAL should update the mode list.
lpHDE->ulFlags |= HDAL_UPDATEDISPLAYSMODESUPPORTED;
}
}
// Update displays mode supported if required
vUpdateDisplaysModeSupported(lpHDE);
/*
if (bRebuildModeTable)
{
// clear the max mode information stored for each display
for (d = 0; d < lpHDE->ulDisplaysCount; d++)
{
lpHDE->aDisplays[d].sMaxModeInfo.ulPelsWidth = 0;
lpHDE->aDisplays[d].sMaxModeInfo.ulPelsHeight = 0;
lpHDE->aDisplays[d].sMaxModeInfo.ulDisplayFrequency = 0;
}
// DAL needs to rebuild the section of the mode table describing which
// displays support which modes.
vAddDisplaysToModeTable(lpHDE);
}
for (d = 0; d < lpHDE->ulDisplaysCount; d++)
{
// every time after the displays are queried for physical display
// connection, the size of the DFP is programmed into the controller, so
// the GCO knows how to set a centered mode. This DAL makes the
// assumption there is only one DFP per adapter.
if (((lpHDE->aDisplays[d].lpHWED->ulDisplayType & HW_DISPLAY_TYPE_LCD) &&
(lpHDE->aDisplays[d].lpHWED->ulDisplayType & HW_DISPLAY_DFP)) ||
(lpHDE->aDisplays[d].lpHWED->ulDisplayType & HW_DISPLAY_TYPES_DFP_MASK))
{
lpDisplay = (LPDEVGDO) &lpHDE->aDisplays[d];
vControllersSetDFPSize(lpHDE,
lpDisplay->sMaxModeInfo.ulPelsWidth,
lpDisplay->sMaxModeInfo.ulPelsHeight,
lpDisplay->lpHWED->ulDisplayType);
}
}
*/
if (!(lpHDE->ulDalRule1 & DALRULE1_DONTSHAREMODETABLE))
{
// when the DAL can share the mode table with another DAL instance for an Aurora
// configuration, the DAL calls the DDL to pass the mode table and list of
// connected displays into the other DAL instance.
DDLShareModeTable(lpHDE->hDDL, (LPVOID)lpHDE->lpaModes, ulConnected);
}
return(ulConnected);
}
/****************************Private*Routine*******************************\
*
* VOID vIsDisplayPhysicallyConnected()
*
* Determines if a display is physically connected.
*
* Note: If the display is not active as part of a mode, it is not easily
* detected as part of the mode, and hence we may have difficulty
* determining if it is connected. In any case, if we cannot detect
* with certainty if it is connected, we will rely on the last state
* of the display.
*
\**************************************************************************/
VOID vIsDisplayPhysicallyConnected(
LPHW_DAL_EXTENSION lpHDE,
LPDEVGDO lpDisplay)
{
LPDEVGCO lpInactiveController;
LPDEVGCO lpActiveController;
LPDEVGDO lpActiveDisplay;
DEVMODE_INFO dmMode;
GCO_QUERY_STRUCTURE sQueryGCO;
ULONG ulSavedDisplays;
ULONG ulTempDisplays;
ULONG ulFlags;
ULONG ulOffset;
ULONG ulPitch;
ULONG i, j;
LONG n;
{
// Perform Display detection to determine if it is connected
if (lpDisplay->lpHWED->ulDisplayCaps & GDO_CAPS_ACTIVATE_BEFORE_DETECT)
{
// display must be active before detection can be performed
if (lpDisplay->ulFlags & GDO_ACTIVE)
{
// display is active, but may turned off because of DPMS,
// hence we must turn on the display before calling the physical
// detection routine, and then restore the display to the off state.
lpActiveController = (LPDEVGCO) &lpHDE->aControllers[lpDisplay->ulController];
ulFlags = lpDisplay->ulFlags;
if (ulFlags & GDO_DPMS_DISABLED)
{
// if the display was turned off by DPMS, restore the display to the
// on state before testing for a physical connection.
vSetDisplayPowerState(lpHDE, lpDisplay, POWERSTATE_ON);
}
// test to see if the display is physically connected
if (bIsDisplayDDCPhysicallyConnected(lpHDE, lpDisplay))
{
lpDisplay->ulFlags |= GDO_PHYSICALLY_CONNECTED;
} else
{
lpDisplay->ulFlags &= ~GDO_PHYSICALLY_CONNECTED;
}
if (ulFlags & GDO_DPMS_DISABLED)
{
// restore the DPMS state
vSetDisplayPowerState(lpHDE, lpDisplay, lpHDE->ulPowerState);
}
} else
{
// display can't perform the test to determine if the display is
// physically connected without being activated in a mode, hence
// activate it before the detection test, and deactivate it after
for (n = lpHDE->ulControllersCount -1; n >= 0 ; n--)
{
if (!(lpHDE->aControllers[n].ulFlags & GCO_ACTIVE))
{
// found an inactive controller, which can be used to drive the
// display as part of the physical connection detection.
lpInactiveController = (LPDEVGCO) &lpHDE->aControllers[n];
break;
}
}
if (n >= 0)
{
// DAL will use the identified inactive controller to set a mode
// to detection of the display. If another active controller exists,
// DAL wants to keep an acceptable image on the display, so the
// inactive controller attempts to read from the same drawing surface
// as another controller if one exists.
ulOffset = 0;
ulPitch = 0;
for (n = lpHDE->ulControllersCount -1; n >= 0 ; n--)
{
if (lpHDE->aControllers[n].ulFlags & GCO_ACTIVE)
{
ulOffset = lpHDE->aControllers[n].ulOffset;
ulPitch = lpHDE->aControllers[n].ulPitch;
dmMode.ulBitsPerPixel = lpHDE->aControllers[n].sModeInfo.ulBitsPerPixel;
break;
}
}
// here DAL is making the assumption that all displays support at
// least 640x480@60hz.
dmMode.ulDisplayFrequency = 60;
dmMode.ulPelsWidth = 640;
dmMode.ulPelsHeight = 480;
if (ulPitch == 0)
{
// since the pitch is zero, there are no active controllers whose
// drawing surface could be shared with, so the DAL must choose it's
// own surface defaults, and hope the memory is initialized to
// blackness ... or we are going to have annoying visual effects
// on the screen.
ulOffset = 0;
ulPitch = 640;
dmMode.ulBitsPerPixel = 8;
}
vControllerSetMode(lpHDE,
(LPDEVMODE_INFO)&dmMode,
lpInactiveController,
(VECTORFROMINDEX(lpDisplay->ulDisplay)),
ulOffset,
ulPitch);
// display is now active, so perform the detection.
if (bIsDisplayDDCPhysicallyConnected(lpHDE, lpDisplay))
{
lpDisplay->ulFlags |= GDO_PHYSICALLY_CONNECTED;
} else
{
lpDisplay->ulFlags &= ~GDO_PHYSICALLY_CONNECTED;
}
// this controller was not active, so reset it and power it down to
// it's former state.
vControllerSetMode(lpHDE,
(LPDEVMODE_INFO)&dmMode,
lpInactiveController,
0,
ulOffset,
ulPitch);
vControllerResetMode(lpHDE, lpInactiveController);
vControllerPowerDown(lpHDE, lpInactiveController);
} else
{
// DAL could not find a controller which is not active to perfom the
// detection of the display, so DAL will attach the display to
// the an active controller along with the other displays attached
// to it, so DAL can activate the display for the physical detection.
for (i = 0; i < lpHDE->ulControllersCount; i++)
{
// next step, is for DAL to search through the list of active
// controllers, and determine if the display is supported in
// the mode on one of the currently active controllers
if (lpHDE->aControllers[i].ulFlags & GCO_ACTIVE)
{
lpActiveController = (LPDEVGCO) &lpHDE->aControllers[i];
if (bDisplayIsModeSupported(lpHDE, lpDisplay,
(LPDEVMODE_INFO) &lpActiveController->sModeInfo,
lpActiveController->ulController))
{
ulSavedDisplays = lpActiveController->ulDisplays;
ulPitch = lpActiveController->ulPitch;
// get the pertinent info from the GCO
(*lpActiveController->lpHWED->pfnGetInfo)
(lpActiveController->hGCO, i,
(LPGCO_QUERY_STRUCTURE) &sQueryGCO);
// Since the controller is already active we MUST first
// call vControllerResetMode or will lead to bandwidth leak problems.
vControllerResetMode(lpHDE, lpActiveController);
if ((0 == lpActiveController->sModeInfo.ulPelsWidth) ||
(0 == lpActiveController->sModeInfo.ulPelsHeight) ||
(0 == lpActiveController->sModeInfo.ulBitsPerPixel) ||
(0 == lpActiveController->sModeInfo.ulDisplayFrequency))
{
// the mode may be bogus if DAL has never set a mode before, in this case
// DAL defaults to 640x480 8bpp. This behaviour is ugly! the problem
// occurs on single CRTC devices, when a display is already active in VGA mode
// but another display needs to be connected for display detection.
lpActiveController->sModeInfo.ulPelsWidth = 640;
lpActiveController->sModeInfo.ulPelsHeight = 480;
lpActiveController->sModeInfo.ulBitsPerPixel = 8;
lpActiveController->sModeInfo.ulDisplayFrequency = 60;
}
// By default follow the old ways. Set mode with both
?? 快捷鍵說明
復(fù)制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -