VirtualBox

source: vbox/trunk/src/VBox/Devices/Graphics/HGSMI/SHGSMIHost.cpp@ 62514

Last change on this file since 62514 was 62498, checked in by vboxsync, 8 years ago

(C)

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 1.8 KB
Line 
1/* $Id: SHGSMIHost.cpp 62498 2016-07-22 19:04:20Z vboxsync $ */
2
3/*
4 * Copyright (C) 2010-2016 Oracle Corporation
5 *
6 * This file is part of VirtualBox Open Source Edition (OSE), as
7 * available from http://www.virtualbox.org. This file is free software;
8 * you can redistribute it and/or modify it under the terms of the GNU
9 * General Public License (GPL) as published by the Free Software
10 * Foundation, in version 2 as it comes in the "COPYING" file of the
11 * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
12 * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
13 */
14
15#include "SHGSMIHost.h"
16#include <VBox/VBoxVideo.h>
17
18/*
19 * VBOXSHGSMI made on top HGSMI and allows receiving notifications
20 * about G->H command completion
21 */
22static bool vboxSHGSMICommandCanCompleteSynch (PVBOXSHGSMIHEADER pHdr)
23{
24 return !(pHdr->fFlags & VBOXSHGSMI_FLAG_GH_ASYNCH_FORCE);
25}
26
27static int vboxSHGSMICommandCompleteAsynch (PHGSMIINSTANCE pIns, PVBOXSHGSMIHEADER pHdr)
28{
29 bool bDoIrq = !!(pHdr->fFlags & VBOXSHGSMI_FLAG_GH_ASYNCH_IRQ)
30 || !!(pHdr->fFlags & VBOXSHGSMI_FLAG_GH_ASYNCH_IRQ_FORCE);
31 return HGSMICompleteGuestCommand(pIns, pHdr, bDoIrq);
32}
33
34void VBoxSHGSMICommandMarkAsynchCompletion (void *pvData)
35{
36 PVBOXSHGSMIHEADER pHdr = VBoxSHGSMIBufferHeader (pvData);
37 Assert(!(pHdr->fFlags & VBOXSHGSMI_FLAG_HG_ASYNCH));
38 pHdr->fFlags |= VBOXSHGSMI_FLAG_HG_ASYNCH;
39}
40
41int VBoxSHGSMICommandComplete (PHGSMIINSTANCE pIns, void *pvData)
42{
43 PVBOXSHGSMIHEADER pHdr = VBoxSHGSMIBufferHeader (pvData);
44 if (!(pHdr->fFlags & VBOXSHGSMI_FLAG_HG_ASYNCH) /* <- check if synchronous completion */
45 && vboxSHGSMICommandCanCompleteSynch(pHdr)) /* <- check if can complete synchronously */
46 return VINF_SUCCESS;
47 pHdr->fFlags |= VBOXSHGSMI_FLAG_HG_ASYNCH;
48 return vboxSHGSMICommandCompleteAsynch(pIns, pHdr);
49}
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