3 * Copyright (c) 1998-2003 by The XFree86 Project, Inc.
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:
12 * The above copyright notice and this permission notice shall be included in
13 * all copies or substantial portions of the Software.
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.
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).
35 #define VIDEO_NO_CLIPPING 0x00000001
36 #define VIDEO_INVERT_CLIPLIST 0x00000002
37 #define VIDEO_OVERLAID_IMAGES 0x00000004
38 #define VIDEO_OVERLAID_STILLS 0x00000008
40 * Usage of VIDEO_CLIP_TO_VIEWPORT is not recommended.
41 * It can make reput behaviour inconsistent.
43 #define VIDEO_CLIP_TO_VIEWPORT 0x00000010
49 unsigned char guid
[16];
54 /* for RGB formats only */
56 unsigned int red_mask
;
57 unsigned int green_mask
;
58 unsigned int blue_mask
;
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];
72 } XF86ImageRec
, *XF86ImagePtr
;
77 unsigned short width
, height
;
78 int *pitches
; /* bytes */
79 int *offsets
; /* in bytes from start of framebuffer */
81 } XF86SurfaceRec
, *XF86SurfacePtr
;
83 typedef 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
);
88 typedef 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
,
93 typedef 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
,
98 typedef 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
,
103 typedef void (*StopVideoFuncPtr
) (ScrnInfoPtr pScrn
, pointer data
, Bool Exit
);
104 typedef int (*SetPortAttributeFuncPtr
) (ScrnInfoPtr pScrn
, Atom attribute
,
105 INT32 value
, pointer data
);
106 typedef int (*GetPortAttributeFuncPtr
) (ScrnInfoPtr pScrn
, Atom attribute
,
107 INT32
*value
, pointer data
);
108 typedef 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
);
112 typedef 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
);
118 typedef 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
,
123 typedef int (*QueryImageAttributesFuncPtr
) (ScrnInfoPtr pScrn
, int image
,
124 unsigned short *width
,
125 unsigned short *height
,
126 int *pitches
, int *offsets
);
127 typedef void (*ClipNotifyFuncPtr
) (ScrnInfoPtr pScrn
, pointer data
,
128 WindowPtr window
, int dx
, int dy
);
136 /*** this is what the driver needs to fill out ***/
141 unsigned short width
, height
;
143 } XF86VideoEncodingRec
, *XF86VideoEncodingPtr
;
148 } XF86VideoFormatRec
, *XF86VideoFormatPtr
;
155 } XF86AttributeRec
, *XF86AttributePtr
;
162 XF86VideoEncodingPtr pEncodings
;
164 XF86VideoFormatPtr pFormats
;
166 DevUnion
*pPortPrivates
;
168 XF86AttributePtr pAttributes
;
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
;
188 int (*alloc_surface
) (ScrnInfoPtr pScrn
,
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
);
204 XF86AttributePtr attributes
;
205 } XF86OffscreenImageRec
, *XF86OffscreenImagePtr
;
207 extern _X_EXPORT Bool
208 xf86XVScreenInit(ScreenPtr pScreen
, XF86VideoAdaptorPtr
* Adaptors
, int num
);
210 typedef int (*xf86XVInitGenericAdaptorPtr
) (ScrnInfoPtr pScrn
,
211 XF86VideoAdaptorPtr
** Adaptors
);
214 xf86XVRegisterGenericAdaptorDriver(xf86XVInitGenericAdaptorPtr InitFunc
);
217 xf86XVListGenericAdaptors(ScrnInfoPtr pScrn
, XF86VideoAdaptorPtr
** Adaptors
);
219 extern _X_EXPORT Bool
221 xf86XVRegisterOffscreenImages(ScreenPtr pScreen
,
222 XF86OffscreenImagePtr images
, int num
);
224 extern _X_EXPORT XF86OffscreenImagePtr
225 xf86XVQueryOffscreenImages(ScreenPtr pScreen
, int *num
);
227 extern _X_EXPORT XF86VideoAdaptorPtr
xf86XVAllocateVideoAdaptorRec(ScrnInfoPtr
230 extern _X_EXPORT
void xf86XVFreeVideoAdaptorRec(XF86VideoAdaptorPtr ptr
);
232 extern _X_EXPORT
void
233 xf86XVFillKeyHelper(ScreenPtr pScreen
, CARD32 key
, RegionPtr clipboxes
);
235 extern _X_EXPORT
void
237 xf86XVFillKeyHelperDrawable(DrawablePtr pDraw
, CARD32 key
, RegionPtr clipboxes
);
239 extern _X_EXPORT
void
241 xf86XVFillKeyHelperPort(DrawablePtr pDraw
, pointer data
, CARD32 key
,
242 RegionPtr clipboxes
, Bool fillEverything
);
244 extern _X_EXPORT Bool
246 xf86XVClipVideoHelper(BoxPtr dst
,
250 INT32
*yb
, RegionPtr reg
, INT32 width
, INT32 height
);
252 extern _X_EXPORT
void
254 xf86XVCopyYUV12ToPacked(const void *srcy
,
259 int srcPitchuv
, int dstPitch
, int h
, int w
);
261 extern _X_EXPORT
void
263 xf86XVCopyPacked(const void *src
,
264 void *dst
, int srcPitch
, int dstPitch
, int h
, int w
);
266 #endif /* _XF86XV_H_ */