Add patch that contain Mali fixes.
[deb_xorg-server.git] / xf86xv.h
... / ...
CommitLineData
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/*
40 * Usage of VIDEO_CLIP_TO_VIEWPORT is not recommended.
41 * It can make reput behaviour inconsistent.
42 */
43#define VIDEO_CLIP_TO_VIEWPORT 0x00000010
44
45typedef struct {
46 int id;
47 int type;
48 int byte_order;
49 unsigned char guid[16];
50 int bits_per_pixel;
51 int format;
52 int num_planes;
53
54 /* for RGB formats only */
55 int depth;
56 unsigned int red_mask;
57 unsigned int green_mask;
58 unsigned int blue_mask;
59
60 /* for YUV formats only */
61 unsigned int y_sample_bits;
62 unsigned int u_sample_bits;
63 unsigned int v_sample_bits;
64 unsigned int horz_y_period;
65 unsigned int horz_u_period;
66 unsigned int horz_v_period;
67 unsigned int vert_y_period;
68 unsigned int vert_u_period;
69 unsigned int vert_v_period;
70 char component_order[32];
71 int scanline_order;
72} XF86ImageRec, *XF86ImagePtr;
73
74typedef struct {
75 ScrnInfoPtr pScrn;
76 int id;
77 unsigned short width, height;
78 int *pitches; /* bytes */
79 int *offsets; /* in bytes from start of framebuffer */
80 DevUnion devPrivate;
81} XF86SurfaceRec, *XF86SurfacePtr;
82
83typedef int (*PutVideoFuncPtr) (ScrnInfoPtr pScrn,
84 short vid_x, short vid_y, short drw_x,
85 short drw_y, short vid_w, short vid_h,
86 short drw_w, short drw_h, RegionPtr clipBoxes,
87 pointer data, DrawablePtr pDraw);
88typedef int (*PutStillFuncPtr) (ScrnInfoPtr pScrn, short vid_x, short vid_y,
89 short drw_x, short drw_y, short vid_w,
90 short vid_h, short drw_w, short drw_h,
91 RegionPtr clipBoxes, pointer data,
92 DrawablePtr pDraw);
93typedef int (*GetVideoFuncPtr) (ScrnInfoPtr pScrn, short vid_x, short vid_y,
94 short drw_x, short drw_y, short vid_w,
95 short vid_h, short drw_w, short drw_h,
96 RegionPtr clipBoxes, pointer data,
97 DrawablePtr pDraw);
98typedef int (*GetStillFuncPtr) (ScrnInfoPtr pScrn, short vid_x, short vid_y,
99 short drw_x, short drw_y, short vid_w,
100 short vid_h, short drw_w, short drw_h,
101 RegionPtr clipBoxes, pointer data,
102 DrawablePtr pDraw);
103typedef void (*StopVideoFuncPtr) (ScrnInfoPtr pScrn, pointer data, Bool Exit);
104typedef int (*SetPortAttributeFuncPtr) (ScrnInfoPtr pScrn, Atom attribute,
105 INT32 value, pointer data);
106typedef int (*GetPortAttributeFuncPtr) (ScrnInfoPtr pScrn, Atom attribute,
107 INT32 *value, pointer data);
108typedef void (*QueryBestSizeFuncPtr) (ScrnInfoPtr pScrn, Bool motion,
109 short vid_w, short vid_h, short drw_w,
110 short drw_h, unsigned int *p_w,
111 unsigned int *p_h, pointer data);
112typedef int (*PutImageFuncPtr) (ScrnInfoPtr pScrn, short src_x, short src_y,
113 short drw_x, short drw_y, short src_w,
114 short src_h, short drw_w, short drw_h,
115 int image, unsigned char *buf, short width,
116 short height, Bool Sync, RegionPtr clipBoxes,
117 pointer data, DrawablePtr pDraw);
118typedef int (*ReputImageFuncPtr) (ScrnInfoPtr pScrn, short src_x, short src_y,
119 short drw_x, short drw_y, short src_w,
120 short src_h, short drw_w, short drw_h,
121 RegionPtr clipBoxes, pointer data,
122 DrawablePtr pDraw);
123typedef int (*QueryImageAttributesFuncPtr) (ScrnInfoPtr pScrn, int image,
124 unsigned short *width,
125 unsigned short *height,
126 int *pitches, int *offsets);
127typedef void (*ClipNotifyFuncPtr) (ScrnInfoPtr pScrn, pointer data,
128 WindowPtr window, int dx, int dy);
129
130typedef enum {
131 XV_OFF,
132 XV_PENDING,
133 XV_ON
134} XvStatus;
135
136/*** this is what the driver needs to fill out ***/
137
138typedef struct {
139 int id;
140 char *name;
141 unsigned short width, height;
142 XvRationalRec rate;
143} XF86VideoEncodingRec, *XF86VideoEncodingPtr;
144
145typedef struct {
146 char depth;
147 short class;
148} XF86VideoFormatRec, *XF86VideoFormatPtr;
149
150typedef struct {
151 int flags;
152 int min_value;
153 int max_value;
154 char *name;
155} XF86AttributeRec, *XF86AttributePtr;
156
157typedef struct {
158 unsigned int type;
159 int flags;
160 char *name;
161 int nEncodings;
162 XF86VideoEncodingPtr pEncodings;
163 int nFormats;
164 XF86VideoFormatPtr pFormats;
165 int nPorts;
166 DevUnion *pPortPrivates;
167 int nAttributes;
168 XF86AttributePtr pAttributes;
169 int nImages;
170 XF86ImagePtr pImages;
171 PutVideoFuncPtr PutVideo;
172 PutStillFuncPtr PutStill;
173 GetVideoFuncPtr GetVideo;
174 GetStillFuncPtr GetStill;
175 StopVideoFuncPtr StopVideo;
176 SetPortAttributeFuncPtr SetPortAttribute;
177 GetPortAttributeFuncPtr GetPortAttribute;
178 QueryBestSizeFuncPtr QueryBestSize;
179 PutImageFuncPtr PutImage;
180 ReputImageFuncPtr ReputImage; /* image/still */
181 QueryImageAttributesFuncPtr QueryImageAttributes;
182 ClipNotifyFuncPtr ClipNotify;
183} XF86VideoAdaptorRec, *XF86VideoAdaptorPtr;
184
185typedef struct {
186 XF86ImagePtr image;
187 int flags;
188 int (*alloc_surface) (ScrnInfoPtr pScrn,
189 int id,
190 unsigned short width,
191 unsigned short height, XF86SurfacePtr surface);
192 int (*free_surface) (XF86SurfacePtr surface);
193 int (*display) (XF86SurfacePtr surface,
194 short vid_x, short vid_y,
195 short drw_x, short drw_y,
196 short vid_w, short vid_h,
197 short drw_w, short drw_h, RegionPtr clipBoxes);
198 int (*stop) (XF86SurfacePtr surface);
199 int (*getAttribute) (ScrnInfoPtr pScrn, Atom attr, INT32 *value);
200 int (*setAttribute) (ScrnInfoPtr pScrn, Atom attr, INT32 value);
201 int max_width;
202 int max_height;
203 int num_attributes;
204 XF86AttributePtr attributes;
205} XF86OffscreenImageRec, *XF86OffscreenImagePtr;
206
207extern _X_EXPORT Bool
208 xf86XVScreenInit(ScreenPtr pScreen, XF86VideoAdaptorPtr * Adaptors, int num);
209
210typedef int (*xf86XVInitGenericAdaptorPtr) (ScrnInfoPtr pScrn,
211 XF86VideoAdaptorPtr ** Adaptors);
212
213extern _X_EXPORT int
214 xf86XVRegisterGenericAdaptorDriver(xf86XVInitGenericAdaptorPtr InitFunc);
215
216extern _X_EXPORT int
217 xf86XVListGenericAdaptors(ScrnInfoPtr pScrn, XF86VideoAdaptorPtr ** Adaptors);
218
219extern _X_EXPORT Bool
220
221xf86XVRegisterOffscreenImages(ScreenPtr pScreen,
222 XF86OffscreenImagePtr images, int num);
223
224extern _X_EXPORT XF86OffscreenImagePtr
225xf86XVQueryOffscreenImages(ScreenPtr pScreen, int *num);
226
227extern _X_EXPORT XF86VideoAdaptorPtr xf86XVAllocateVideoAdaptorRec(ScrnInfoPtr
228 pScrn);
229
230extern _X_EXPORT void xf86XVFreeVideoAdaptorRec(XF86VideoAdaptorPtr ptr);
231
232extern _X_EXPORT void
233 xf86XVFillKeyHelper(ScreenPtr pScreen, CARD32 key, RegionPtr clipboxes);
234
235extern _X_EXPORT void
236
237xf86XVFillKeyHelperDrawable(DrawablePtr pDraw, CARD32 key, RegionPtr clipboxes);
238
239extern _X_EXPORT void
240
241xf86XVFillKeyHelperPort(DrawablePtr pDraw, pointer data, CARD32 key,
242 RegionPtr clipboxes, Bool fillEverything);
243
244extern _X_EXPORT Bool
245
246xf86XVClipVideoHelper(BoxPtr dst,
247 INT32 *xa,
248 INT32 *xb,
249 INT32 *ya,
250 INT32 *yb, RegionPtr reg, INT32 width, INT32 height);
251
252extern _X_EXPORT void
253
254xf86XVCopyYUV12ToPacked(const void *srcy,
255 const void *srcv,
256 const void *srcu,
257 void *dst,
258 int srcPitchy,
259 int srcPitchuv, int dstPitch, int h, int w);
260
261extern _X_EXPORT void
262
263xf86XVCopyPacked(const void *src,
264 void *dst, int srcPitch, int dstPitch, int h, int w);
265
266#endif /* _XF86XV_H_ */