读书人

怎样设置VESA的32位色深显示模式解决办

发布时间: 2012-04-13 13:50:24 作者: rapoo

怎样设置VESA的32位色深显示模式
VBE文档里面只有24位的模式号啊,32位色深的模式号谁知道?

[解决办法]
VBE中“色彩模式”这个词的含义与Windows下的不同!
VBE中“色彩模式”的含义是:每个象素实际使用的颜色位数,不包括填充位。
Windows中“色彩模式”的含义是:每个象素所占位数,包括填充位。


对于这些色彩模式:
RGB555:VBE中是“32K(1:5:5:5)”,Windows中是“16位高彩色”
RGB565:VBE中是“64K(5:6:5)”,Windows中是“16位高彩色”
RGB888:VBE中是“16.8M(8:8:8)”,Windows中是“24位真彩色”
ARGB8888:VBE中是“16.8M(8:8:8)”,Windows中是“32位真彩色”

32位ARGB模式下,Alpha分量只在图层合并时使用,对于显卡而言只有RGB的24位有效。所以VBE文档将这种色彩模式称为“16.8M(8:8:8)”。
反之,若某种色彩模式在VBE中被称为“16.8M(8:8:8)”,那它有可能是24位或32位。你必须调用VBE功能01h,获得该视频模式的详细信息后才能确定。


事实上,现在支持24位模式的显卡是极其少见的,因为24位模式下不无法充分利用32位的优势。


比如这块显卡——NVIDIA GeForce2 MX/MX 400:
// http://blog.csdn.net/zyl910/archive/2006/11/14/1384562.aspx
// VBE_INFO(获取VBE信息)
[VBE]
VbeSignature : VESA
VbeVersion : 0x0300
OemStringPtr : NVidia
Capabilities : 0x00000001
D0=1DAC width is switchable to 8 bits per primary color
D1=0Controller is VGA compatible
D2=0Normal RAMDAC operation
D3=0No hardware stereoscopic signaling support
D4=0Stereo signaling supported via external VESA stereo connector
VideoModePtr : 07C5:FE12
TotalMemory : 0x0200(32768KB)
OemSoftwareRev : 0x0000
OemVendorNamePtr : (null)
OemProductNamePtr: (null)
OemProductRevPtr : (null)

[VBE Mode List]
ModeResolutionAttrMemoryModel
0100: [G] 640 * 400 * 8039F04 - Packed pixel
0101: [G] 640 * 480 * 8039F04 - Packed pixel
0102: [G] 800 * 600 * 4031F03 - Planar
0103: [G] 800 * 600 * 8039F04 - Packed pixel
0104: [G] 1024 * 768 * 4031F03 - Planar
0105: [G] 1024 * 768 * 8039F04 - Packed pixel
0106: [G] 1280 * 1024 * 4031F03 - Planar
0107: [G] 1280 * 1024 * 8039F04 - Packed pixel
0108: [T] 80 * 60 * 4038F00 - Text mode
0109: [T] 132 * 25 * 4038F00 - Text mode
010A: [T] 132 * 43 * 4038F00 - Text mode
010B: [T] 132 * 50 * 4038F00 - Text mode
010C: [T] 132 * 60 * 4038F00 - Text mode
010E: [G] 320 * 200 * 16039F06 - Direct Color
010F: [G] 320 * 200 * 32039F06 - Direct Color
0111: [G] 640 * 480 * 16039F06 - Direct Color
0112: [G] 640 * 480 * 32039F06 - Direct Color
0114: [G] 800 * 600 * 16039F06 - Direct Color
0115: [G] 800 * 600 * 32039F06 - Direct Color
0117: [G] 1024 * 768 * 16039F06 - Direct Color
0118: [G] 1024 * 768 * 32039F06 - Direct Color
011A: [G] 1280 * 1024 * 16039F06 - Direct Color
0130: [G] 320 * 200 * 8039F04 - Packed pixel
0131: [G] 320 * 400 * 8039F04 - Packed pixel
0132: [G] 320 * 400 * 16039F06 - Direct Color
0133: [G] 320 * 400 * 32039F06 - Direct Color
0134: [G] 320 * 240 * 8039F04 - Packed pixel
0135: [G] 320 * 240 * 16039F06 - Direct Color
0136: [G] 320 * 240 * 32039F06 - Direct Color
013D: [G] 640 * 400 * 16039F06 - Direct Color
013E: [G] 640 * 400 * 32039F06 - Direct Color
0145: [G] 1600 * 1200 * 8039F04 - Packed pixel
0146: [G] 1600 * 1200 * 16039F06 - Direct Color

[Mode: 10Fh]
ModeAttributes : 0x039F
D0=1Mode supported in hardware
D1=1Reserved(Must 1)
D2=1TTY Output functions supported by BIOS
D3=1Color mode
D4=1Graphics mode
D5=0VGA compatible mode: Yes
D6=0VGA compatible windowed memory mode is available: Yes
D7=1Linear frame buffer mode is available: Yes
D8=1Double scan mode is available: Yes
D9=1Interlaced mode is available: Yes
D10=0Hardware triple buffering support: No
D11=0Hardware stereoscopic display support: No


D12=0Dual display start address support: No
WinAAttributes : 0x07
WinBAttributes : 0x00
WinGranularity : 0x0040(64KB)
WinSize : 0x0040(64KB)
WinASegment : 0xA000
WinBSegment : 0x0000
WinFuncPtr : C000:6D95
BytesPerScanLine : 1280
XResolution : 320
YResolution : 200
XCharSize : 8
YCharSize : 16
NumberOfPlanes : 1
BitsPerPixel : 32
NumberOfBanks : 1
MemoryModel : 06 - Direct Color
BankSize : 0x0000(0KB)
NumberOfImagePages : 15
RedMaskSize : 8
RedFieldPosition : 16
GreenMaskSize : 8
GreenFieldPosition : 8
BlueMaskSize : 8
BlueFieldPosition : 0
RsvdMaskSize : 8
RsvdFieldPosition : 24
DirectColorModeInfo : 00
PhysBasePtr : E0000000
OffScreenMemOffset : 0
OffScreenMemSize : 0
LinBytesPerScanLine : 1280
BnkNumberOfImagePages: 15
LinNumberOfImagePages: 15
LinRedMaskSize : 8
LinRedFieldPosition : 16
LinGreenMaskSize : 8
LinGreenFieldPosition: 8
LinBlueMaskSize : 8
LinBlueFieldPosition: 0
LinRsvdMaskSize : 8
LinRsvdFieldPosition: 24
MaxPixelClock : 229500000

[解决办法]
当处于32位模式下,每像素4字节,顺序为:B、G、R、A。
如果将这四个字节读取到一个DWord中,由于Intel处理器是小端方式的,所以看起来是:0xAARRGGBB.

由于Windows使用了驱动程序机制,所以VBE现在不更新了,不支持硬件Alpha混合等新功能。
即Alpha分量对VBE来说是保留位,不处理。

要实现Alpha透明,得靠软件实现。
这就是为什么现在的CPU有MMX/SSE等多媒体指令集。

读书人网 >汇编语言

热点推荐