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