VirtualBox

source: vbox/trunk/src/VBox/Devices/Graphics/vmsvga/svga_overlay.h@ 82254

Last change on this file since 82254 was 76565, checked in by vboxsync, 6 years ago

Devices: Use VBOX_INCLUDED_SRC_ as header guard prefix with scm.

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 5.0 KB
Line 
1/**********************************************************
2 * Copyright 2007-2009 VMware, Inc. All rights reserved.
3 *
4 * Permission is hereby granted, free of charge, to any person
5 * obtaining a copy of this software and associated documentation
6 * files (the "Software"), to deal in the Software without
7 * restriction, including without limitation the rights to use, copy,
8 * modify, merge, publish, distribute, sublicense, and/or sell copies
9 * of the Software, and to permit persons to whom the Software is
10 * furnished to do so, subject to the following conditions:
11 *
12 * The above copyright notice and this permission notice shall be
13 * included in all copies or substantial portions of the Software.
14 *
15 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
16 * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
17 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
18 * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
19 * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
20 * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
21 * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
22 * SOFTWARE.
23 *
24 **********************************************************/
25
26/*
27 * svga_overlay.h --
28 *
29 * Definitions for video-overlay support.
30 */
31
32#ifndef _SVGA_OVERLAY_H_
33#define _SVGA_OVERLAY_H_
34#ifndef RT_WITHOUT_PRAGMA_ONCE
35# pragma once
36#endif
37
38#include "svga_reg.h"
39
40/*
41 * Video formats we support
42 */
43
44#define VMWARE_FOURCC_YV12 0x32315659 // 'Y' 'V' '1' '2'
45#define VMWARE_FOURCC_YUY2 0x32595559 // 'Y' 'U' 'Y' '2'
46#define VMWARE_FOURCC_UYVY 0x59565955 // 'U' 'Y' 'V' 'Y'
47
48typedef enum {
49 SVGA_OVERLAY_FORMAT_INVALID = 0,
50 SVGA_OVERLAY_FORMAT_YV12 = VMWARE_FOURCC_YV12,
51 SVGA_OVERLAY_FORMAT_YUY2 = VMWARE_FOURCC_YUY2,
52 SVGA_OVERLAY_FORMAT_UYVY = VMWARE_FOURCC_UYVY
53} SVGAOverlayFormat;
54
55#define SVGA_VIDEO_COLORKEY_MASK 0x00ffffff
56
57#define SVGA_ESCAPE_VMWARE_VIDEO 0x00020000
58
59#define SVGA_ESCAPE_VMWARE_VIDEO_SET_REGS 0x00020001
60 /* FIFO escape layout:
61 * Type, Stream Id, (Register Id, Value) pairs */
62
63#define SVGA_ESCAPE_VMWARE_VIDEO_FLUSH 0x00020002
64 /* FIFO escape layout:
65 * Type, Stream Id */
66
67typedef
68struct SVGAEscapeVideoSetRegs {
69 struct {
70 uint32_t cmdType;
71 uint32_t streamId;
72 } header;
73
74 // May include zero or more items.
75 struct {
76 uint32_t registerId;
77 uint32_t value;
78 } items[1];
79} SVGAEscapeVideoSetRegs;
80
81typedef
82struct SVGAEscapeVideoFlush {
83 uint32_t cmdType;
84 uint32_t streamId;
85} SVGAEscapeVideoFlush;
86
87
88/*
89 * Struct definitions for the video overlay commands built on
90 * SVGAFifoCmdEscape.
91 */
92typedef
93struct {
94 uint32_t command;
95 uint32_t overlay;
96} SVGAFifoEscapeCmdVideoBase;
97
98typedef
99struct {
100 SVGAFifoEscapeCmdVideoBase videoCmd;
101} SVGAFifoEscapeCmdVideoFlush;
102
103typedef
104struct {
105 SVGAFifoEscapeCmdVideoBase videoCmd;
106 struct {
107 uint32_t regId;
108 uint32_t value;
109 } items[1];
110} SVGAFifoEscapeCmdVideoSetRegs;
111
112typedef
113struct {
114 SVGAFifoEscapeCmdVideoBase videoCmd;
115 struct {
116 uint32_t regId;
117 uint32_t value;
118 } items[SVGA_VIDEO_NUM_REGS];
119} SVGAFifoEscapeCmdVideoSetAllRegs;
120
121
122/*
123 *----------------------------------------------------------------------
124 *
125 * VMwareVideoGetAttributes --
126 *
127 * Computes the size, pitches and offsets for YUV frames.
128 *
129 * Results:
130 * TRUE on success; otherwise FALSE on failure.
131 *
132 * Side effects:
133 * Pitches and offsets for the given YUV frame are put in 'pitches'
134 * and 'offsets' respectively. They are both optional though.
135 *
136 *----------------------------------------------------------------------
137 */
138#if 0
139static INLINE Bool
140VMwareVideoGetAttributes(const SVGAOverlayFormat format, // IN
141 uint32_t *width, // IN / OUT
142 uint32_t *height, // IN / OUT
143 uint32_t *size, // OUT
144 uint32_t *pitches, // OUT (optional)
145 uint32_t *offsets) // OUT (optional)
146{
147 int tmp;
148
149 *width = (*width + 1) & ~1;
150
151 if (offsets) {
152 offsets[0] = 0;
153 }
154
155 switch (format) {
156 case VMWARE_FOURCC_YV12:
157 *height = (*height + 1) & ~1;
158 *size = (*width + 3) & ~3;
159
160 if (pitches) {
161 pitches[0] = *size;
162 }
163
164 *size *= *height;
165
166 if (offsets) {
167 offsets[1] = *size;
168 }
169
170 tmp = ((*width >> 1) + 3) & ~3;
171
172 if (pitches) {
173 pitches[1] = pitches[2] = tmp;
174 }
175
176 tmp *= (*height >> 1);
177 *size += tmp;
178
179 if (offsets) {
180 offsets[2] = *size;
181 }
182
183 *size += tmp;
184 break;
185
186 case VMWARE_FOURCC_YUY2:
187 case VMWARE_FOURCC_UYVY:
188 *size = *width * 2;
189
190 if (pitches) {
191 pitches[0] = *size;
192 }
193
194 *size *= *height;
195 break;
196
197 default:
198 return FALSE;
199 }
200
201 return TRUE;
202}
203#endif
204#endif /* !_SVGA_OVERLAY_H_ */
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