1/*
2 * Copyright (C) 2006-2017 Oracle Corporation
3 *
4 * Permission is hereby granted, free of charge, to any person obtaining a
5 * copy of this software and associated documentation files (the "Software"),
6 * to deal in the Software without restriction, including without limitation
7 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
8 * and/or sell copies of the Software, and to permit persons to whom the
9 * Software is furnished to do so, subject to the following conditions:
10 *
11 * The above copyright notice and this permission notice shall be included in
12 * all copies or substantial portions of the Software.
13 *
14 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
17 * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR
18 * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
19 * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
20 * OTHER DEALINGS IN THE SOFTWARE.
21 */
22
23#ifndef ___VBox_Graphics_HGSMIChSetup_h
24#define ___VBox_Graphics_HGSMIChSetup_h
25
26#include "HGSMIDefs.h"
27
28/* HGSMI setup and configuration channel commands and data structures. */
29/*
30 * Tell the host the location of hgsmi_host_flags structure, where the host
31 * can write information about pending buffers, etc, and which can be quickly
32 * polled by the guest without a need to port IO.
33 */
34#define HGSMI_CC_HOST_FLAGS_LOCATION 0
35
36typedef struct HGSMIBUFFERLOCATION
37{
38    HGSMIOFFSET offLocation;
39    HGSMISIZE   cbLocation;
40} HGSMIBUFFERLOCATION;
41AssertCompileSize(HGSMIBUFFERLOCATION, 8);
42
43/* HGSMI setup and configuration data structures. */
44/* host->guest commands pending, should be accessed under FIFO lock only */
45#define HGSMIHOSTFLAGS_COMMANDS_PENDING    UINT32_C(0x01)
46/* IRQ is fired, should be accessed under VGAState::lock only  */
47#define HGSMIHOSTFLAGS_IRQ                 UINT32_C(0x02)
48#ifdef VBOX_WITH_WDDM
49/* one or more guest commands is completed, should be accessed under FIFO lock only */
50# define HGSMIHOSTFLAGS_GCOMMAND_COMPLETED UINT32_C(0x04)
51/* watchdog timer interrupt flag (used for debugging), should be accessed under VGAState::lock only */
52# define HGSMIHOSTFLAGS_WATCHDOG           UINT32_C(0x08)
53#endif
54/* vsync interrupt flag, should be accessed under VGAState::lock only */
55#define HGSMIHOSTFLAGS_VSYNC               UINT32_C(0x10)
56/** monitor hotplug flag, should be accessed under VGAState::lock only */
57#define HGSMIHOSTFLAGS_HOTPLUG             UINT32_C(0x20)
58/**
59 * Cursor capability state change flag, should be accessed under
60 * VGAState::lock only.  @see VBVACONF32.
61 */
62#define HGSMIHOSTFLAGS_CURSOR_CAPABILITIES UINT32_C(0x40)
63
64typedef struct HGSMIHOSTFLAGS
65{
66    /*
67     * Host flags can be accessed and modified in multiple threads
68     * concurrently, e.g. CrOpenGL HGCM and GUI threads when completing
69     * HGSMI 3D and Video Accel respectively, EMT thread when dealing with
70     * HGSMI command processing, etc.
71     * Besides settings/cleaning flags atomically, some flags have their
72     * own special sync restrictions, see comments for flags above.
73     */
74    volatile uint32_t u32HostFlags;
75    uint32_t au32Reserved[3];
76} HGSMIHOSTFLAGS;
77AssertCompileSize(HGSMIHOSTFLAGS, 16);
78
79#endif
80