mirror of
https://github.com/reactos/reactos.git
synced 2024-12-28 10:04:49 +00:00
- Implementation of IOCTL_VIDEO_QUERY_CURRENT_MODE. Based on patch by Herv� Poussineau.
svn path=/trunk/; revision=9296
This commit is contained in:
parent
99282d8160
commit
73812409b4
2 changed files with 105 additions and 49 deletions
|
@ -442,7 +442,8 @@ VBEStartIO(
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case IOCTL_VIDEO_UNMAP_VIDEO_MEMORY:
|
case IOCTL_VIDEO_UNMAP_VIDEO_MEMORY:
|
||||||
Result = VBEUnmapVideoMemory((PVBE_DEVICE_EXTENSION)HwDeviceExtension,
|
Result = VBEUnmapVideoMemory(
|
||||||
|
(PVBE_DEVICE_EXTENSION)HwDeviceExtension,
|
||||||
RequestPacket->StatusBlock);
|
RequestPacket->StatusBlock);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
@ -482,6 +483,17 @@ VBEStartIO(
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case IOCTL_VIDEO_QUERY_CURRENT_MODE:
|
case IOCTL_VIDEO_QUERY_CURRENT_MODE:
|
||||||
|
if (RequestPacket->OutputBufferLength < sizeof(VIDEO_MODE_INFORMATION))
|
||||||
|
{
|
||||||
|
RequestPacket->StatusBlock->Status = ERROR_INSUFFICIENT_BUFFER;
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
|
Result = VBEQueryCurrentMode(
|
||||||
|
(PVBE_DEVICE_EXTENSION)HwDeviceExtension,
|
||||||
|
(PVIDEO_MODE_INFORMATION)RequestPacket->OutputBuffer,
|
||||||
|
RequestPacket->StatusBlock);
|
||||||
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
RequestPacket->StatusBlock->Status = STATUS_NOT_IMPLEMENTED;
|
RequestPacket->StatusBlock->Status = STATUS_NOT_IMPLEMENTED;
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
@ -651,6 +663,69 @@ VBEQueryNumAvailModes(
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* VBEQueryMode
|
||||||
|
*
|
||||||
|
* Returns information about one particular video mode.
|
||||||
|
*/
|
||||||
|
|
||||||
|
VOID FASTCALL
|
||||||
|
VBEQueryMode(
|
||||||
|
PVBE_DEVICE_EXTENSION DeviceExtension,
|
||||||
|
PVIDEO_MODE_INFORMATION VideoMode,
|
||||||
|
ULONG VideoModeId)
|
||||||
|
{
|
||||||
|
PVBE_MODEINFO VBEMode = &DeviceExtension->ModeInfo[VideoModeId];
|
||||||
|
|
||||||
|
VideoMode->Length = sizeof(VIDEO_MODE_INFORMATION);
|
||||||
|
VideoMode->ModeIndex = VideoModeId;
|
||||||
|
VideoMode->VisScreenWidth = VBEMode->XResolution;
|
||||||
|
VideoMode->VisScreenHeight = VBEMode->YResolution;
|
||||||
|
VideoMode->ScreenStride = VBEMode->BytesPerScanLine;
|
||||||
|
VideoMode->NumberOfPlanes = VBEMode->NumberOfPlanes;
|
||||||
|
VideoMode->BitsPerPlane = VBEMode->BitsPerPixel / VBEMode->NumberOfPlanes;
|
||||||
|
VideoMode->Frequency = 0; /* FIXME */
|
||||||
|
VideoMode->XMillimeter = 0; /* FIXME */
|
||||||
|
VideoMode->YMillimeter = 0; /* FIXME */
|
||||||
|
if (VBEMode->BitsPerPixel > 8)
|
||||||
|
{
|
||||||
|
if (DeviceExtension->VBEVersion < 0x300)
|
||||||
|
{
|
||||||
|
VideoMode->NumberRedBits = VBEMode->RedMaskSize;
|
||||||
|
VideoMode->NumberGreenBits = VBEMode->GreenMaskSize;
|
||||||
|
VideoMode->NumberBlueBits = VBEMode->BlueMaskSize;
|
||||||
|
VideoMode->RedMask = ((1 << VBEMode->RedMaskSize) - 1) << VBEMode->RedFieldPosition;
|
||||||
|
VideoMode->GreenMask = ((1 << VBEMode->GreenMaskSize) - 1) << VBEMode->GreenFieldPosition;
|
||||||
|
VideoMode->BlueMask = ((1 << VBEMode->BlueMaskSize) - 1) << VBEMode->BlueFieldPosition;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
VideoMode->NumberRedBits = VBEMode->LinRedMaskSize;
|
||||||
|
VideoMode->NumberGreenBits = VBEMode->LinGreenMaskSize;
|
||||||
|
VideoMode->NumberBlueBits = VBEMode->LinBlueMaskSize;
|
||||||
|
VideoMode->RedMask = ((1 << VBEMode->LinRedMaskSize) - 1) << VBEMode->LinRedFieldPosition;
|
||||||
|
VideoMode->GreenMask = ((1 << VBEMode->LinGreenMaskSize) - 1) << VBEMode->LinGreenFieldPosition;
|
||||||
|
VideoMode->BlueMask = ((1 << VBEMode->LinBlueMaskSize) - 1) << VBEMode->LinBlueFieldPosition;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
VideoMode->NumberRedBits =
|
||||||
|
VideoMode->NumberGreenBits =
|
||||||
|
VideoMode->NumberBlueBits = 6;
|
||||||
|
VideoMode->RedMask =
|
||||||
|
VideoMode->GreenMask =
|
||||||
|
VideoMode->BlueMask = 0;
|
||||||
|
}
|
||||||
|
VideoMode->VideoMemoryBitmapWidth = VBEMode->XResolution;
|
||||||
|
VideoMode->VideoMemoryBitmapHeight = VBEMode->YResolution;
|
||||||
|
VideoMode->AttributeFlags = VIDEO_MODE_GRAPHICS | VIDEO_MODE_COLOR |
|
||||||
|
VIDEO_MODE_NO_OFF_SCREEN;
|
||||||
|
if (VideoMode->BitsPerPlane <= 8)
|
||||||
|
VideoMode->AttributeFlags |= VIDEO_MODE_PALETTE_DRIVEN;
|
||||||
|
VideoMode->DriverSpecificAttributeFlags = 0;
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* VBEQueryAvailModes
|
* VBEQueryAvailModes
|
||||||
*
|
*
|
||||||
|
@ -672,54 +747,7 @@ VBEQueryAvailModes(
|
||||||
CurrentModeId < DeviceExtension->ModeCount;
|
CurrentModeId < DeviceExtension->ModeCount;
|
||||||
CurrentModeId++, CurrentMode++, CurrentVBEMode++)
|
CurrentModeId++, CurrentMode++, CurrentVBEMode++)
|
||||||
{
|
{
|
||||||
CurrentMode->Length = sizeof(VIDEO_MODE_INFORMATION);
|
VBEQueryMode(DeviceExtension, CurrentMode, CurrentModeId);
|
||||||
CurrentMode->ModeIndex = CurrentModeId;
|
|
||||||
CurrentMode->VisScreenWidth = CurrentVBEMode->XResolution;
|
|
||||||
CurrentMode->VisScreenHeight = CurrentVBEMode->YResolution;
|
|
||||||
CurrentMode->ScreenStride = CurrentVBEMode->BytesPerScanLine;
|
|
||||||
CurrentMode->NumberOfPlanes = CurrentVBEMode->NumberOfPlanes;
|
|
||||||
CurrentMode->BitsPerPlane = CurrentVBEMode->BitsPerPixel /
|
|
||||||
CurrentVBEMode->NumberOfPlanes;
|
|
||||||
CurrentMode->Frequency = 0; /* FIXME */
|
|
||||||
CurrentMode->XMillimeter = 0; /* FIXME */
|
|
||||||
CurrentMode->YMillimeter = 0; /* FIXME */
|
|
||||||
if (CurrentVBEMode->BitsPerPixel > 8)
|
|
||||||
{
|
|
||||||
if (DeviceExtension->VBEVersion < 0x300)
|
|
||||||
{
|
|
||||||
CurrentMode->NumberRedBits = CurrentVBEMode->RedMaskSize;
|
|
||||||
CurrentMode->NumberGreenBits = CurrentVBEMode->GreenMaskSize;
|
|
||||||
CurrentMode->NumberBlueBits = CurrentVBEMode->BlueMaskSize;
|
|
||||||
CurrentMode->RedMask = ((1 << CurrentVBEMode->RedMaskSize) - 1) << CurrentVBEMode->RedFieldPosition;
|
|
||||||
CurrentMode->GreenMask = ((1 << CurrentVBEMode->GreenMaskSize) - 1) << CurrentVBEMode->GreenFieldPosition;
|
|
||||||
CurrentMode->BlueMask = ((1 << CurrentVBEMode->BlueMaskSize) - 1) << CurrentVBEMode->BlueFieldPosition;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
CurrentMode->NumberRedBits = CurrentVBEMode->LinRedMaskSize;
|
|
||||||
CurrentMode->NumberGreenBits = CurrentVBEMode->LinGreenMaskSize;
|
|
||||||
CurrentMode->NumberBlueBits = CurrentVBEMode->LinBlueMaskSize;
|
|
||||||
CurrentMode->RedMask = ((1 << CurrentVBEMode->LinRedMaskSize) - 1) << CurrentVBEMode->LinRedFieldPosition;
|
|
||||||
CurrentMode->GreenMask = ((1 << CurrentVBEMode->LinGreenMaskSize) - 1) << CurrentVBEMode->LinGreenFieldPosition;
|
|
||||||
CurrentMode->BlueMask = ((1 << CurrentVBEMode->LinBlueMaskSize) - 1) << CurrentVBEMode->LinBlueFieldPosition;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
CurrentMode->NumberRedBits =
|
|
||||||
CurrentMode->NumberGreenBits =
|
|
||||||
CurrentMode->NumberBlueBits = 6;
|
|
||||||
CurrentMode->RedMask =
|
|
||||||
CurrentMode->GreenMask =
|
|
||||||
CurrentMode->BlueMask = 0;
|
|
||||||
}
|
|
||||||
CurrentMode->VideoMemoryBitmapWidth = CurrentVBEMode->XResolution;
|
|
||||||
CurrentMode->VideoMemoryBitmapHeight = CurrentVBEMode->YResolution;
|
|
||||||
CurrentMode->AttributeFlags = VIDEO_MODE_GRAPHICS | VIDEO_MODE_COLOR |
|
|
||||||
VIDEO_MODE_NO_OFF_SCREEN;
|
|
||||||
if (CurrentMode->BitsPerPlane <= 8)
|
|
||||||
CurrentMode->AttributeFlags |= VIDEO_MODE_PALETTE_DRIVEN;
|
|
||||||
CurrentMode->DriverSpecificAttributeFlags = 0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
StatusBlock->Information =
|
StatusBlock->Information =
|
||||||
|
@ -728,6 +756,28 @@ VBEQueryAvailModes(
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* VBEQueryCurrentMode
|
||||||
|
*
|
||||||
|
* Returns information about current video mode.
|
||||||
|
*/
|
||||||
|
|
||||||
|
BOOL FASTCALL
|
||||||
|
VBEQueryCurrentMode(
|
||||||
|
PVBE_DEVICE_EXTENSION DeviceExtension,
|
||||||
|
PVIDEO_MODE_INFORMATION VideoModeInfo,
|
||||||
|
PSTATUS_BLOCK StatusBlock)
|
||||||
|
{
|
||||||
|
StatusBlock->Information = sizeof(VIDEO_MODE_INFORMATION);
|
||||||
|
|
||||||
|
VBEQueryMode(
|
||||||
|
DeviceExtension,
|
||||||
|
VideoModeInfo,
|
||||||
|
DeviceExtension->CurrentMode);
|
||||||
|
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* VBESetColorRegisters
|
* VBESetColorRegisters
|
||||||
*
|
*
|
||||||
|
|
|
@ -215,6 +215,12 @@ VBEQueryAvailModes(
|
||||||
PVIDEO_MODE_INFORMATION ReturnedModes,
|
PVIDEO_MODE_INFORMATION ReturnedModes,
|
||||||
PSTATUS_BLOCK StatusBlock);
|
PSTATUS_BLOCK StatusBlock);
|
||||||
|
|
||||||
|
BOOL FASTCALL
|
||||||
|
VBEQueryCurrentMode(
|
||||||
|
PVBE_DEVICE_EXTENSION DeviceExtension,
|
||||||
|
PVIDEO_MODE_INFORMATION VideoModeInfo,
|
||||||
|
PSTATUS_BLOCK StatusBlock);
|
||||||
|
|
||||||
BOOL FASTCALL
|
BOOL FASTCALL
|
||||||
VBESetColorRegisters(
|
VBESetColorRegisters(
|
||||||
PVBE_DEVICE_EXTENSION DeviceExtension,
|
PVBE_DEVICE_EXTENSION DeviceExtension,
|
||||||
|
|
Loading…
Reference in a new issue