【转】wince6移植之gwes与显示驱动!!

【出处】  http://bluefish.blog.51cto.com/214870/58122
【MSDN相关文章:显示驱动程序开发概念】 http://msdn.microsoft.com/zh-cn/library/aa447495.aspx
 很无奈没有见过MS的gwes的实现代码。GWES是负责处理图形、窗口和事件的子系统,主要的工作就是处理图形输出和用户交互。显示设备驱动就是被它加载的,同时被GWES加载的还有打印机驱动,键盘驱动,鼠标驱动,触摸屏驱动。
MS的经典图:
      CE下所有的显示驱动都必须实现DDI函数集,这些函数用于初始化显示驱动以及把把图像用块传输(Blit)送往显示设备。显示驱动默认的名字叫做Ddi.dll,它本身所导出的函数只有DrvEnableDriver(实际的显示驱动也必须实现)一个,但是这个函数返回了一个包含27个函数指针的数组。GWES就是通过这些函数指针调用显示驱动(打印驱动)的。
看下DrvEnableDriver(是DDI函数之一),MS的解释:This function is the initial driver entry point exported by the driver DLL for devices that link directly to GWES。由于用到MS的GPE类,所以这个函数就直接调用了GPEEnableDriver,这两个函数连参数都一样。还是看下MS对这个函数的解释:This function initializes the callbacks that GDI provides for display drivers. It also fills in the driver entry points for the display driver in the DRVENABLEDATA structure。
      最终的xxxDISP类(最终继承于GPE)也就是真正的display驱动类的实例化是在GetGPE函数中实现。GetGPE通过DDI函数DrvGetModes被调用。
      GWES加载显示驱动的过程是:去访问候选显示设备列表(这个列表放在HKEY_LOCAL_MACHINE/System/GDI/DisplayCandidates下面,一般是在Platform.reg里建好的),看看是否有驱动程序已经在本机上实例化,如果有的话,GWES会使用它找到的第一个已经实例化的驱动;如果驱动程序没有在本机上实例话或者找不到合适的驱动程序,接下来GWES尝试加载Ddi.dll。默认情况下加载的是Ddi.dll,但是如果注册表项HKEY_LOCAL_MACHINE/System/GDI/Drivers/Display存在,GWES会加载此注册表项所指定的显示驱动。
 
下面是MS的一个列表可以对照上图进行理解
Element
Description
Application
The application can be simple, such as a Hello World application, or complex, such as a three-dimensional engineering application.
Whichever it is, the application calls GDI functions. Coredll.dll exposes these functions.
Coredll.dll
The major set of functions is exposed through a single DLL, called Coredll.dll.
In most cases, this library does not perform the work. Instead, the library packages the parameters for the function call and then triggers a Local Procedure Call (LPC) to another process.
The specific process depends on the function call. All drawing and windowing calls are sent to Gwes.dll.
Gwes.dll
The Graphics, Windowing and Events Subsystem (GWES) is responsible for all graphical output and all interactions with the user.
The drivers that reside in the GWES address space include display drivers, printer drivers, keyboard drivers, mouse drivers, and touch screen drivers.
Ddi.dll
The default name for the display driver is Ddi.dll. As with most DLLs, Ddi.dll communicates through exported functions.
Ddi.dll exports only the  DrvEnableDriver function, which returns a pointer to an array of 27 function pointers to the caller. When GWES requires a display driver, it calls one of these 27 functions.
Writing a device driver involves writing the code for these 27 functions.
Three of these functions are specific to printer drivers, which leaves 24 for the display driver developer.
Hardware
The graphic pipeline ends at the hardware. The display driver communicates to the hardware using the mechanism required by the hardware.
This process typically involves a combination of memory-mapped video buffers and I/O registers.
  • 1
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 2
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 2
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值