VirtualBox

source: vbox/trunk/src/VBox/Additions/WINNT/Graphics/Video/mp/wddm/VBoxMPVbva.cpp@ 89361

Last change on this file since 89361 was 82968, checked in by vboxsync, 5 years ago

Copyright year updates by scm.

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 2.9 KB
Line 
1/* $Id: VBoxMPVbva.cpp 82968 2020-02-04 10:35:17Z vboxsync $ */
2/** @file
3 * VBox WDDM Miniport driver
4 */
5
6/*
7 * Copyright (C) 2011-2020 Oracle Corporation
8 *
9 * This file is part of VirtualBox Open Source Edition (OSE), as
10 * available from http://www.virtualbox.org. This file is free software;
11 * you can redistribute it and/or modify it under the terms of the GNU
12 * General Public License (GPL) as published by the Free Software
13 * Foundation, in version 2 as it comes in the "COPYING" file of the
14 * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
15 * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
16 */
17
18#include "VBoxMPWddm.h"
19#include "common/VBoxMPCommon.h"
20
21/*
22 * Public hardware buffer methods.
23 */
24int vboxVbvaEnable (PVBOXMP_DEVEXT pDevExt, VBOXVBVAINFO *pVbva)
25{
26 if (VBoxVBVAEnable(&pVbva->Vbva, &VBoxCommonFromDeviceExt(pDevExt)->guestCtx,
27 pVbva->Vbva.pVBVA, pVbva->srcId))
28 return VINF_SUCCESS;
29
30 WARN(("VBoxVBVAEnable failed!"));
31 return VERR_GENERAL_FAILURE;
32}
33
34int vboxVbvaDisable (PVBOXMP_DEVEXT pDevExt, VBOXVBVAINFO *pVbva)
35{
36 VBoxVBVADisable(&pVbva->Vbva, &VBoxCommonFromDeviceExt(pDevExt)->guestCtx, pVbva->srcId);
37 return VINF_SUCCESS;
38}
39
40int vboxVbvaCreate(PVBOXMP_DEVEXT pDevExt, VBOXVBVAINFO *pVbva, ULONG offBuffer, ULONG cbBuffer, D3DDDI_VIDEO_PRESENT_SOURCE_ID srcId)
41{
42 memset(pVbva, 0, sizeof(VBOXVBVAINFO));
43
44 KeInitializeSpinLock(&pVbva->Lock);
45
46 int rc = VBoxMPCmnMapAdapterMemory(VBoxCommonFromDeviceExt(pDevExt),
47 (void**)&pVbva->Vbva.pVBVA,
48 offBuffer,
49 cbBuffer);
50 if (RT_SUCCESS(rc))
51 {
52 Assert(pVbva->Vbva.pVBVA);
53 VBoxVBVASetupBufferContext(&pVbva->Vbva, offBuffer, cbBuffer);
54 pVbva->srcId = srcId;
55 }
56 else
57 {
58 WARN(("VBoxMPCmnMapAdapterMemory failed rc %d", rc));
59 }
60
61
62 return rc;
63}
64
65int vboxVbvaDestroy(PVBOXMP_DEVEXT pDevExt, VBOXVBVAINFO *pVbva)
66{
67 int rc = VINF_SUCCESS;
68 VBoxMPCmnUnmapAdapterMemory(VBoxCommonFromDeviceExt(pDevExt), (void**)&pVbva->Vbva.pVBVA);
69 memset(pVbva, 0, sizeof (VBOXVBVAINFO));
70 return rc;
71}
72
73int vboxVbvaReportDirtyRect (PVBOXMP_DEVEXT pDevExt, PVBOXWDDM_SOURCE pSrc, RECT *pRectOrig)
74{
75 VBVACMDHDR hdr;
76
77 RECT rect = *pRectOrig;
78
79// if (rect.left < 0) rect.left = 0;
80// if (rect.top < 0) rect.top = 0;
81// if (rect.right > (int)ppdev->cxScreen) rect.right = ppdev->cxScreen;
82// if (rect.bottom > (int)ppdev->cyScreen) rect.bottom = ppdev->cyScreen;
83
84 hdr.x = (int16_t)rect.left;
85 hdr.y = (int16_t)rect.top;
86 hdr.w = (uint16_t)(rect.right - rect.left);
87 hdr.h = (uint16_t)(rect.bottom - rect.top);
88
89 hdr.x += (int16_t)pSrc->VScreenPos.x;
90 hdr.y += (int16_t)pSrc->VScreenPos.y;
91
92 if (VBoxVBVAWrite(&pSrc->Vbva.Vbva, &VBoxCommonFromDeviceExt(pDevExt)->guestCtx, &hdr, sizeof(hdr)))
93 return VINF_SUCCESS;
94
95 WARN(("VBoxVBVAWrite failed"));
96 return VERR_GENERAL_FAILURE;
97}
Note: See TracBrowser for help on using the repository browser.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette