VirtualBox

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

Last change on this file since 98103 was 98103, checked in by vboxsync, 2 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.2 KB
Line 
1/* $Id: SHGSMIHost.cpp 98103 2023-01-17 14:15:46Z vboxsync $ */
2/** @file
3 * Missing description.
4 */
5
6/*
7 * Copyright (C) 2010-2023 Oracle and/or its affiliates.
8 *
9 * This file is part of VirtualBox base platform packages, as
10 * available from https://www.virtualbox.org.
11 *
12 * This program is free software; you can redistribute it and/or
13 * modify it under the terms of the GNU General Public License
14 * as published by the Free Software Foundation, in version 3 of the
15 * License.
16 *
17 * This program is distributed in the hope that it will be useful, but
18 * WITHOUT ANY WARRANTY; without even the implied warranty of
19 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
20 * General Public License for more details.
21 *
22 * You should have received a copy of the GNU General Public License
23 * along with this program; if not, see <https://www.gnu.org/licenses>.
24 *
25 * SPDX-License-Identifier: GPL-3.0-only
26 */
27
28#include "SHGSMIHost.h"
29#include <VBoxVideo.h>
30
31/*
32 * VBOXSHGSMI made on top HGSMI and allows receiving notifications
33 * about G->H command completion
34 */
35
36static int vboxSHGSMICommandCompleteAsynch (PHGSMIINSTANCE pIns, VBOXSHGSMIHEADER RT_UNTRUSTED_VOLATILE_GUEST *pHdr)
37{
38 bool fDoIrq = !!(pHdr->fFlags & VBOXSHGSMI_FLAG_GH_ASYNCH_IRQ)
39 || !!(pHdr->fFlags & VBOXSHGSMI_FLAG_GH_ASYNCH_IRQ_FORCE);
40 return HGSMICompleteGuestCommand(pIns, pHdr, fDoIrq);
41}
42
43void VBoxSHGSMICommandMarkAsynchCompletion(void RT_UNTRUSTED_VOLATILE_GUEST *pvData)
44{
45 VBOXSHGSMIHEADER RT_UNTRUSTED_VOLATILE_GUEST *pHdr = VBoxSHGSMIBufferHeader(pvData);
46 Assert(!(pHdr->fFlags & VBOXSHGSMI_FLAG_HG_ASYNCH));
47 pHdr->fFlags |= VBOXSHGSMI_FLAG_HG_ASYNCH;
48}
49
50int VBoxSHGSMICommandComplete(PHGSMIINSTANCE pIns, void RT_UNTRUSTED_VOLATILE_GUEST *pvData)
51{
52 VBOXSHGSMIHEADER RT_UNTRUSTED_VOLATILE_GUEST *pHdr = VBoxSHGSMIBufferHeader(pvData);
53 uint32_t fFlags = pHdr->fFlags;
54 ASMCompilerBarrier();
55 if ( !(fFlags & VBOXSHGSMI_FLAG_HG_ASYNCH) /* <- check if synchronous completion */
56 && !(fFlags & VBOXSHGSMI_FLAG_GH_ASYNCH_FORCE)) /* <- check if can complete synchronously */
57 return VINF_SUCCESS;
58
59 pHdr->fFlags = fFlags | VBOXSHGSMI_FLAG_HG_ASYNCH;
60 return vboxSHGSMICommandCompleteAsynch(pIns, pHdr);
61}
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