Chinaunix首页 | 论坛 | 博客
  • 博客访问: 1547159
  • 博文数量: 596
  • 博客积分: 0
  • 博客等级: 民兵
  • 技术积分: 173
  • 用 户 组: 普通用户
  • 注册时间: 2016-07-06 15:50
个人简介

在线笔记

文章分类

全部博文(596)

文章存档

2016年(1)

2015年(104)

2014年(228)

2013年(226)

2012年(26)

2011年(11)

分类: 虚拟化

2015-04-08 17:03:46


  1. //
  2. // GDI calls the driver's DrvEnableDirectDraw function to obtain pointers to the DirectDraw callbacks that the driver supports.
  3. // 驱动支持DirectDraw的函数
  4. //
  5. // 填充三个回调接口
  6. // DD_CALLBACKS
  7. //   DDHAL_CB32_CREATESURFACE
  8. //   DDHAL_CB32_CANCREATESURFACE
  9. //   DDHAL_CB32_MAPMEMORY

  10. // DD_SURFACECALLBACKS
  11. //   DDHAL_SURFCB32_LOCK
  12. //   DDHAL_SURFCB32_UNLOCK

  13. // DD_PALETTECALLBACKS
  14. //
  15. //
  16. // 如果支持硬件加速,则增加DD_SURFACECALLBACKS的回调
  17. //
  18. BOOL APIENTRY
  19. VBoxDispDrvEnableDirectDraw(DHPDEV dhpdev, DD_CALLBACKS *pCallBacks, DD_SURFACECALLBACKS *pSurfaceCallBacks,
  20.                             DD_PALETTECALLBACKS *pPaletteCallBacks)
  21. {
  22.     LOGF_ENTER();

  23.     pCallBacks->dwSize = sizeof(DD_CALLBACKS);
  24.     pCallBacks->CreateSurface = VBoxDispDDCreateSurface;
  25.     pCallBacks->CanCreateSurface = VBoxDispDDCanCreateSurface;
  26.     pCallBacks->MapMemory = VBoxDispDDMapMemory;
  27.     pCallBacks->dwFlags = DDHAL_CB32_CREATESURFACE|DDHAL_CB32_CANCREATESURFACE|DDHAL_CB32_MAPMEMORY;

  28.     pSurfaceCallBacks->dwSize = sizeof(DD_SURFACECALLBACKS);
  29.     pSurfaceCallBacks->Lock = VBoxDispDDLock;
  30.     pSurfaceCallBacks->Unlock = VBoxDispDDUnlock;
  31.     pSurfaceCallBacks->dwFlags = DDHAL_SURFCB32_LOCK|DDHAL_SURFCB32_UNLOCK;

  32.     pPaletteCallBacks->dwSize = sizeof(DD_PALETTECALLBACKS);
  33.     pPaletteCallBacks->dwFlags = 0;

  34. #ifdef VBOX_WITH_VIDEOHWACCEL
  35.     PVBOXDISPDEV pDev = (PVBOXDISPDEV)dhpdev;

  36.     if (pDev->vhwa.bEnabled)
  37.     {
  38.         pSurfaceCallBacks->DestroySurface = VBoxDispDDDestroySurface;
  39.         pSurfaceCallBacks->Flip = VBoxDispDDFlip;
  40.         pSurfaceCallBacks->GetFlipStatus = VBoxDispDDGetFlipStatus;
  41.         pSurfaceCallBacks->Blt = VBoxDispDDBlt;
  42.         pSurfaceCallBacks->GetBltStatus = VBoxDispDDGetBltStatus;
  43.         pSurfaceCallBacks->SetColorKey = VBoxDispDDSetColorKey;
  44.         pSurfaceCallBacks->dwFlags |= DDHAL_SURFCB32_DESTROYSURFACE|
  45.                                       DDHAL_SURFCB32_FLIP|DDHAL_SURFCB32_GETFLIPSTATUS|
  46.                                       DDHAL_SURFCB32_BLT|DDHAL_SURFCB32_GETBLTSTATUS|
  47.                                       DDHAL_SURFCB32_SETCOLORKEY;

  48.         if(pDev->vhwa.caps & VBOXVHWA_CAPS_OVERLAY)
  49.         {
  50.             pSurfaceCallBacks->UpdateOverlay = VBoxDispDDUpdateOverlay;
  51.             pSurfaceCallBacks->SetOverlayPosition = VBoxDispDDSetOverlayPosition;
  52.             pSurfaceCallBacks->dwFlags |= DDHAL_SURFCB32_UPDATEOVERLAY|DDHAL_SURFCB32_SETOVERLAYPOSITION;
  53.         }
  54.     }
  55. #endif

  56.     LOGF_LEAVE();
  57.     return TRUE;
  58. }

阅读(959) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~