1 /**********************************************************
2 * Copyright 2007-2009 VMware, Inc. All rights reserved.
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:
12 * The above copyright notice and this permission notice shall be
13 * included in all copies or substantial portions of the Software.
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
24 **********************************************************/
29 * Definitions for video-overlay support.
32 #ifndef _SVGA_OVERLAY_H_
33 #define _SVGA_OVERLAY_H_
38 * Video formats we support
41 #define VMWARE_FOURCC_YV12 0x32315659 /* 'Y' 'V' '1' '2' */
42 #define VMWARE_FOURCC_YUY2 0x32595559 /* 'Y' 'U' 'Y' '2' */
43 #define VMWARE_FOURCC_UYVY 0x59565955 /* 'U' 'Y' 'V' 'Y' */
46 SVGA_OVERLAY_FORMAT_INVALID
= 0,
47 SVGA_OVERLAY_FORMAT_YV12
= VMWARE_FOURCC_YV12
,
48 SVGA_OVERLAY_FORMAT_YUY2
= VMWARE_FOURCC_YUY2
,
49 SVGA_OVERLAY_FORMAT_UYVY
= VMWARE_FOURCC_UYVY
,
52 #define SVGA_VIDEO_COLORKEY_MASK 0x00ffffff
54 #define SVGA_ESCAPE_VMWARE_VIDEO 0x00020000
56 #define SVGA_ESCAPE_VMWARE_VIDEO_SET_REGS 0x00020001
57 /* FIFO escape layout:
58 * Type, Stream Id, (Register Id, Value) pairs */
60 #define SVGA_ESCAPE_VMWARE_VIDEO_FLUSH 0x00020002
61 /* FIFO escape layout:
65 struct SVGAEscapeVideoSetRegs
{
71 /* May include zero or more items. */
76 } SVGAEscapeVideoSetRegs
;
79 struct SVGAEscapeVideoFlush
{
82 } SVGAEscapeVideoFlush
;
86 * Struct definitions for the video overlay commands built on
93 } SVGAFifoEscapeCmdVideoBase
;
97 SVGAFifoEscapeCmdVideoBase videoCmd
;
98 } SVGAFifoEscapeCmdVideoFlush
;
102 SVGAFifoEscapeCmdVideoBase videoCmd
;
107 } SVGAFifoEscapeCmdVideoSetRegs
;
111 SVGAFifoEscapeCmdVideoBase videoCmd
;
115 } items
[SVGA_VIDEO_NUM_REGS
];
116 } SVGAFifoEscapeCmdVideoSetAllRegs
;
120 *----------------------------------------------------------------------
122 * VMwareVideoGetAttributes --
124 * Computes the size, pitches and offsets for YUV frames.
127 * TRUE on success; otherwise FALSE on failure.
130 * Pitches and offsets for the given YUV frame are put in 'pitches'
131 * and 'offsets' respectively. They are both optional though.
133 *----------------------------------------------------------------------
137 VMwareVideoGetAttributes(const SVGAOverlayFormat format
, /* IN */
138 uint32
*width
, /* IN / OUT */
139 uint32
*height
, /* IN / OUT */
140 uint32
*size
, /* OUT */
141 uint32
*pitches
, /* OUT (optional) */
142 uint32
*offsets
) /* OUT (optional) */
146 *width
= (*width
+ 1) & ~1;
153 case VMWARE_FOURCC_YV12
:
154 *height
= (*height
+ 1) & ~1;
155 *size
= (*width
+ 3) & ~3;
167 tmp
= ((*width
>> 1) + 3) & ~3;
170 pitches
[1] = pitches
[2] = tmp
;
173 tmp
*= (*height
>> 1);
183 case VMWARE_FOURCC_YUY2
:
184 case VMWARE_FOURCC_UYVY
:
201 #endif /* _SVGA_OVERLAY_H_ */