1 | /* $XFree86: xc/programs/Xserver/hw/xfree86/common/xf86xv.h,v 1.25 2003/08/24 17:36:56 dawes Exp $ */
|
---|
2 |
|
---|
3 | /*
|
---|
4 | * Copyright (c) 1998-2003 by The XFree86 Project, Inc.
|
---|
5 | *
|
---|
6 | * Permission is hereby granted, free of charge, to any person obtaining a
|
---|
7 | * copy of this software and associated documentation files (the "Software"),
|
---|
8 | * to deal in the Software without restriction, including without limitation
|
---|
9 | * the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
---|
10 | * and/or sell copies of the Software, and to permit persons to whom the
|
---|
11 | * Software is furnished to do so, subject to the following conditions:
|
---|
12 | *
|
---|
13 | * The above copyright notice and this permission notice shall be included in
|
---|
14 | * all copies or substantial portions of the Software.
|
---|
15 | *
|
---|
16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
---|
17 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
---|
18 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
---|
19 | * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR
|
---|
20 | * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
|
---|
21 | * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
|
---|
22 | * OTHER DEALINGS IN THE SOFTWARE.
|
---|
23 | *
|
---|
24 | * Except as contained in this notice, the name of the copyright holder(s)
|
---|
25 | * and author(s) shall not be used in advertising or otherwise to promote
|
---|
26 | * the sale, use or other dealings in this Software without prior written
|
---|
27 | * authorization from the copyright holder(s) and author(s).
|
---|
28 | */
|
---|
29 |
|
---|
30 | #ifndef _XF86XV_H_
|
---|
31 | #define _XF86XV_H_
|
---|
32 |
|
---|
33 | #include "xvdix.h"
|
---|
34 | #include "xf86str.h"
|
---|
35 |
|
---|
36 | #define VIDEO_NO_CLIPPING 0x00000001
|
---|
37 | #define VIDEO_INVERT_CLIPLIST 0x00000002
|
---|
38 | #define VIDEO_OVERLAID_IMAGES 0x00000004
|
---|
39 | #define VIDEO_OVERLAID_STILLS 0x00000008
|
---|
40 | #define VIDEO_CLIP_TO_VIEWPORT 0x00000010
|
---|
41 |
|
---|
42 | typedef struct {
|
---|
43 | int id;
|
---|
44 | int type;
|
---|
45 | int byte_order;
|
---|
46 | unsigned char guid[16];
|
---|
47 | int bits_per_pixel;
|
---|
48 | int format;
|
---|
49 | int num_planes;
|
---|
50 |
|
---|
51 | /* for RGB formats only */
|
---|
52 | int depth;
|
---|
53 | unsigned int red_mask;
|
---|
54 | unsigned int green_mask;
|
---|
55 | unsigned int blue_mask;
|
---|
56 |
|
---|
57 | /* for YUV formats only */
|
---|
58 | unsigned int y_sample_bits;
|
---|
59 | unsigned int u_sample_bits;
|
---|
60 | unsigned int v_sample_bits;
|
---|
61 | unsigned int horz_y_period;
|
---|
62 | unsigned int horz_u_period;
|
---|
63 | unsigned int horz_v_period;
|
---|
64 | unsigned int vert_y_period;
|
---|
65 | unsigned int vert_u_period;
|
---|
66 | unsigned int vert_v_period;
|
---|
67 | char component_order[32];
|
---|
68 | int scanline_order;
|
---|
69 | } XF86ImageRec, *XF86ImagePtr;
|
---|
70 |
|
---|
71 |
|
---|
72 | typedef struct {
|
---|
73 | ScrnInfoPtr pScrn;
|
---|
74 | int id;
|
---|
75 | unsigned short width, height;
|
---|
76 | int *pitches; /* bytes */
|
---|
77 | int *offsets; /* in bytes from start of framebuffer */
|
---|
78 | DevUnion devPrivate;
|
---|
79 | } XF86SurfaceRec, *XF86SurfacePtr;
|
---|
80 |
|
---|
81 |
|
---|
82 | typedef int (* PutVideoFuncPtr)( ScrnInfoPtr pScrn,
|
---|
83 | short vid_x, short vid_y, short drw_x, short drw_y,
|
---|
84 | short vid_w, short vid_h, short drw_w, short drw_h,
|
---|
85 | RegionPtr clipBoxes, pointer data );
|
---|
86 | typedef int (* PutStillFuncPtr)( ScrnInfoPtr pScrn,
|
---|
87 | short vid_x, short vid_y, short drw_x, short drw_y,
|
---|
88 | short vid_w, short vid_h, short drw_w, short drw_h,
|
---|
89 | RegionPtr clipBoxes, pointer data );
|
---|
90 | typedef int (* GetVideoFuncPtr)( ScrnInfoPtr pScrn,
|
---|
91 | short vid_x, short vid_y, short drw_x, short drw_y,
|
---|
92 | short vid_w, short vid_h, short drw_w, short drw_h,
|
---|
93 | RegionPtr clipBoxes, pointer data );
|
---|
94 | typedef int (* GetStillFuncPtr)( ScrnInfoPtr pScrn,
|
---|
95 | short vid_x, short vid_y, short drw_x, short drw_y,
|
---|
96 | short vid_w, short vid_h, short drw_w, short drw_h,
|
---|
97 | RegionPtr clipBoxes, pointer data );
|
---|
98 | typedef void (* StopVideoFuncPtr)(ScrnInfoPtr pScrn, pointer data, Bool Exit);
|
---|
99 | typedef int (* SetPortAttributeFuncPtr)(ScrnInfoPtr pScrn, Atom attribute,
|
---|
100 | INT32 value, pointer data);
|
---|
101 | typedef int (* GetPortAttributeFuncPtr)(ScrnInfoPtr pScrn, Atom attribute,
|
---|
102 | INT32 *value, pointer data);
|
---|
103 | typedef void (* QueryBestSizeFuncPtr)(ScrnInfoPtr pScrn, Bool motion,
|
---|
104 | short vid_w, short vid_h, short drw_w, short drw_h,
|
---|
105 | unsigned int *p_w, unsigned int *p_h, pointer data);
|
---|
106 | typedef int (* PutImageFuncPtr)( ScrnInfoPtr pScrn,
|
---|
107 | short src_x, short src_y, short drw_x, short drw_y,
|
---|
108 | short src_w, short src_h, short drw_w, short drw_h,
|
---|
109 | int image, unsigned char* buf, short width, short height, Bool Sync,
|
---|
110 | RegionPtr clipBoxes, pointer data );
|
---|
111 | typedef int (* ReputImageFuncPtr)( ScrnInfoPtr pScrn, short drw_x, short drw_y,
|
---|
112 | RegionPtr clipBoxes, pointer data );
|
---|
113 | typedef int (*QueryImageAttributesFuncPtr)(ScrnInfoPtr pScrn,
|
---|
114 | int image, unsigned short *width, unsigned short *height,
|
---|
115 | int *pitches, int *offsets);
|
---|
116 |
|
---|
117 | typedef enum {
|
---|
118 | XV_OFF,
|
---|
119 | XV_PENDING,
|
---|
120 | XV_ON
|
---|
121 | } XvStatus;
|
---|
122 |
|
---|
123 | /*** this is what the driver needs to fill out ***/
|
---|
124 |
|
---|
125 | typedef struct {
|
---|
126 | int id;
|
---|
127 | char *name;
|
---|
128 | unsigned short width, height;
|
---|
129 | XvRationalRec rate;
|
---|
130 | } XF86VideoEncodingRec, *XF86VideoEncodingPtr;
|
---|
131 |
|
---|
132 | typedef struct {
|
---|
133 | char depth;
|
---|
134 | short class;
|
---|
135 | } XF86VideoFormatRec, *XF86VideoFormatPtr;
|
---|
136 |
|
---|
137 | typedef struct {
|
---|
138 | int flags;
|
---|
139 | int min_value;
|
---|
140 | int max_value;
|
---|
141 | char *name;
|
---|
142 | } XF86AttributeRec, *XF86AttributePtr;
|
---|
143 |
|
---|
144 | typedef struct {
|
---|
145 | unsigned int type;
|
---|
146 | int flags;
|
---|
147 | char *name;
|
---|
148 | int nEncodings;
|
---|
149 | XF86VideoEncodingPtr pEncodings;
|
---|
150 | int nFormats;
|
---|
151 | XF86VideoFormatPtr pFormats;
|
---|
152 | int nPorts;
|
---|
153 | DevUnion *pPortPrivates;
|
---|
154 | int nAttributes;
|
---|
155 | XF86AttributePtr pAttributes;
|
---|
156 | int nImages;
|
---|
157 | XF86ImagePtr pImages;
|
---|
158 | PutVideoFuncPtr PutVideo;
|
---|
159 | PutStillFuncPtr PutStill;
|
---|
160 | GetVideoFuncPtr GetVideo;
|
---|
161 | GetStillFuncPtr GetStill;
|
---|
162 | StopVideoFuncPtr StopVideo;
|
---|
163 | SetPortAttributeFuncPtr SetPortAttribute;
|
---|
164 | GetPortAttributeFuncPtr GetPortAttribute;
|
---|
165 | QueryBestSizeFuncPtr QueryBestSize;
|
---|
166 | PutImageFuncPtr PutImage;
|
---|
167 | ReputImageFuncPtr ReputImage;
|
---|
168 | QueryImageAttributesFuncPtr QueryImageAttributes;
|
---|
169 | } XF86VideoAdaptorRec, *XF86VideoAdaptorPtr;
|
---|
170 |
|
---|
171 | typedef struct {
|
---|
172 | XF86ImagePtr image;
|
---|
173 | int flags;
|
---|
174 | int (*alloc_surface)(ScrnInfoPtr pScrn,
|
---|
175 | int id,
|
---|
176 | unsigned short width,
|
---|
177 | unsigned short height,
|
---|
178 | XF86SurfacePtr surface);
|
---|
179 | int (*free_surface)(XF86SurfacePtr surface);
|
---|
180 | int (*display) (XF86SurfacePtr surface,
|
---|
181 | short vid_x, short vid_y,
|
---|
182 | short drw_x, short drw_y,
|
---|
183 | short vid_w, short vid_h,
|
---|
184 | short drw_w, short drw_h,
|
---|
185 | RegionPtr clipBoxes);
|
---|
186 | int (*stop) (XF86SurfacePtr surface);
|
---|
187 | int (*getAttribute) (ScrnInfoPtr pScrn, Atom attr, INT32 *value);
|
---|
188 | int (*setAttribute) (ScrnInfoPtr pScrn, Atom attr, INT32 value);
|
---|
189 | int max_width;
|
---|
190 | int max_height;
|
---|
191 | int num_attributes;
|
---|
192 | XF86AttributePtr attributes;
|
---|
193 | } XF86OffscreenImageRec, *XF86OffscreenImagePtr;
|
---|
194 |
|
---|
195 | Bool
|
---|
196 | xf86XVScreenInit(
|
---|
197 | ScreenPtr pScreen,
|
---|
198 | XF86VideoAdaptorPtr *Adaptors,
|
---|
199 | int num
|
---|
200 | );
|
---|
201 |
|
---|
202 | typedef int (* xf86XVInitGenericAdaptorPtr)(ScrnInfoPtr pScrn,
|
---|
203 | XF86VideoAdaptorPtr **Adaptors);
|
---|
204 |
|
---|
205 | int
|
---|
206 | xf86XVRegisterGenericAdaptorDriver(
|
---|
207 | xf86XVInitGenericAdaptorPtr InitFunc
|
---|
208 | );
|
---|
209 |
|
---|
210 | int
|
---|
211 | xf86XVListGenericAdaptors(
|
---|
212 | ScrnInfoPtr pScrn,
|
---|
213 | XF86VideoAdaptorPtr **Adaptors
|
---|
214 | );
|
---|
215 |
|
---|
216 | Bool
|
---|
217 | xf86XVRegisterOffscreenImages(
|
---|
218 | ScreenPtr pScreen,
|
---|
219 | XF86OffscreenImagePtr images,
|
---|
220 | int num
|
---|
221 | );
|
---|
222 |
|
---|
223 | XF86OffscreenImagePtr
|
---|
224 | xf86XVQueryOffscreenImages(
|
---|
225 | ScreenPtr pScreen,
|
---|
226 | int *num
|
---|
227 | );
|
---|
228 |
|
---|
229 | XF86VideoAdaptorPtr xf86XVAllocateVideoAdaptorRec(ScrnInfoPtr pScrn);
|
---|
230 |
|
---|
231 | void xf86XVFreeVideoAdaptorRec(XF86VideoAdaptorPtr ptr);
|
---|
232 |
|
---|
233 | void
|
---|
234 | xf86XVFillKeyHelper (ScreenPtr pScreen, CARD32 key, RegionPtr clipboxes);
|
---|
235 |
|
---|
236 | Bool
|
---|
237 | xf86XVClipVideoHelper(
|
---|
238 | BoxPtr dst,
|
---|
239 | INT32 *xa,
|
---|
240 | INT32 *xb,
|
---|
241 | INT32 *ya,
|
---|
242 | INT32 *yb,
|
---|
243 | RegionPtr reg,
|
---|
244 | INT32 width,
|
---|
245 | INT32 height
|
---|
246 | );
|
---|
247 |
|
---|
248 | void
|
---|
249 | xf86XVCopyYUV12ToPacked(
|
---|
250 | const void *srcy,
|
---|
251 | const void *srcv,
|
---|
252 | const void *srcu,
|
---|
253 | void *dst,
|
---|
254 | int srcPitchy,
|
---|
255 | int srcPitchuv,
|
---|
256 | int dstPitch,
|
---|
257 | int h,
|
---|
258 | int w
|
---|
259 | );
|
---|
260 |
|
---|
261 | void
|
---|
262 | xf86XVCopyPacked(
|
---|
263 | const void *src,
|
---|
264 | void *dst,
|
---|
265 | int srcPitch,
|
---|
266 | int dstPitch,
|
---|
267 | int h,
|
---|
268 | int w
|
---|
269 | );
|
---|
270 |
|
---|
271 | #endif /* _XF86XV_H_ */
|
---|