First import
[xorg_rtime.git] / xorg-server-1.4 / hw / kdrive / src / kxv.h
blob5d1441642bac350cecb05067d24a2f8e362da89a
1 /*
3 XFree86 Xv DDX written by Mark Vojkovich (markv@valinux.com)
4 Adapted for KDrive by Pontus Lidman <pontus.lidman@nokia.com>
6 Copyright (C) 2000, 2001 - Nokia Home Communications
7 Copyright (C) 1998, 1999 - The XFree86 Project Inc.
9 All rights reserved.
11 Permission is hereby granted, free of charge, to any person obtaining
12 a copy of this software and associated documentation files (the
13 "Software"), to deal in the Software without restriction, including
14 without limitation the rights to use, copy, modify, merge, publish,
15 distribute, and/or sell copies of the Software, and to permit persons
16 to whom the Software is furnished to do so, provided that the above
17 copyright notice(s) and this permission notice appear in all copies of
18 the Software and that both the above copyright notice(s) and this
19 permission notice appear in supporting documentation.
21 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
22 EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
23 MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT
24 OF THIRD PARTY RIGHTS. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
25 HOLDERS INCLUDED IN THIS NOTICE BE LIABLE FOR ANY CLAIM, OR ANY
26 SPECIAL INDIRECT OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES WHATSOEVER
27 RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF
28 CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
29 CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
31 Except as contained in this notice, the name of a copyright holder
32 shall not be used in advertising or otherwise to promote the sale, use
33 or other dealings in this Software without prior written authorization
34 of the copyright holder.
38 #ifndef _XVDIX_H_
39 #define _XVDIX_H_
41 #include "scrnintstr.h"
42 #include "regionstr.h"
43 #include "windowstr.h"
44 #include "pixmapstr.h"
45 #include "mivalidate.h"
46 #include "validate.h"
47 #include "resource.h"
48 #include "gcstruct.h"
49 #include "dixstruct.h"
51 #include "../../Xext/xvdix.h"
53 #define VIDEO_NO_CLIPPING 0x00000001
54 #define VIDEO_INVERT_CLIPLIST 0x00000002
55 #define VIDEO_OVERLAID_IMAGES 0x00000004
56 #define VIDEO_OVERLAID_STILLS 0x00000008
57 #define VIDEO_CLIP_TO_VIEWPORT 0x00000010
59 typedef struct {
60 int id;
61 int type;
62 int byte_order;
63 unsigned char guid[16];
64 int bits_per_pixel;
65 int format;
66 int num_planes;
68 /* for RGB formats only */
69 int depth;
70 unsigned int red_mask;
71 unsigned int green_mask;
72 unsigned int blue_mask;
74 /* for YUV formats only */
75 unsigned int y_sample_bits;
76 unsigned int u_sample_bits;
77 unsigned int v_sample_bits;
78 unsigned int horz_y_period;
79 unsigned int horz_u_period;
80 unsigned int horz_v_period;
81 unsigned int vert_y_period;
82 unsigned int vert_u_period;
83 unsigned int vert_v_period;
84 char component_order[32];
85 int scanline_order;
86 } KdImageRec, *KdImagePtr;
89 typedef struct {
90 KdScreenInfo * screen;
91 int id;
92 unsigned short width, height;
93 int *pitches; /* bytes */
94 int *offsets; /* in bytes from start of framebuffer */
95 DevUnion devPrivate;
96 } KdSurfaceRec, *KdSurfacePtr;
99 typedef int (* PutVideoFuncPtr)( KdScreenInfo * screen, DrawablePtr pDraw,
100 short vid_x, short vid_y, short drw_x, short drw_y,
101 short vid_w, short vid_h, short drw_w, short drw_h,
102 RegionPtr clipBoxes, pointer data );
103 typedef int (* PutStillFuncPtr)( KdScreenInfo * screen, DrawablePtr pDraw,
104 short vid_x, short vid_y, short drw_x, short drw_y,
105 short vid_w, short vid_h, short drw_w, short drw_h,
106 RegionPtr clipBoxes, pointer data );
107 typedef int (* GetVideoFuncPtr)( KdScreenInfo * screen, DrawablePtr pDraw,
108 short vid_x, short vid_y, short drw_x, short drw_y,
109 short vid_w, short vid_h, short drw_w, short drw_h,
110 RegionPtr clipBoxes, pointer data );
111 typedef int (* GetStillFuncPtr)( KdScreenInfo * screen, DrawablePtr pDraw,
112 short vid_x, short vid_y, short drw_x, short drw_y,
113 short vid_w, short vid_h, short drw_w, short drw_h,
114 RegionPtr clipBoxes, pointer data );
115 typedef void (* StopVideoFuncPtr)(KdScreenInfo * screen, pointer data, Bool Exit);
116 typedef int (* SetPortAttributeFuncPtr)(KdScreenInfo * screen, Atom attribute,
117 int value, pointer data);
118 typedef int (* GetPortAttributeFuncPtr)(KdScreenInfo * screen, Atom attribute,
119 int *value, pointer data);
120 typedef void (* QueryBestSizeFuncPtr)(KdScreenInfo * screen, Bool motion,
121 short vid_w, short vid_h, short drw_w, short drw_h,
122 unsigned int *p_w, unsigned int *p_h, pointer data);
123 typedef int (* PutImageFuncPtr)( KdScreenInfo * screen, DrawablePtr pDraw,
124 short src_x, short src_y, short drw_x, short drw_y,
125 short src_w, short src_h, short drw_w, short drw_h,
126 int image, unsigned char* buf, short width, short height, Bool Sync,
127 RegionPtr clipBoxes, pointer data );
128 typedef int (* ReputImageFuncPtr)( KdScreenInfo * screen, DrawablePtr pDraw,
129 short drw_x, short drw_y,
130 RegionPtr clipBoxes, pointer data );
131 typedef int (*QueryImageAttributesFuncPtr)(KdScreenInfo * screen,
132 int image, unsigned short *width, unsigned short *height,
133 int *pitches, int *offsets);
135 typedef enum {
136 XV_OFF,
137 XV_PENDING,
138 XV_ON
139 } XvStatus;
141 /*** this is what the driver needs to fill out ***/
143 typedef struct {
144 int id;
145 char *name;
146 unsigned short width, height;
147 XvRationalRec rate;
148 } KdVideoEncodingRec, *KdVideoEncodingPtr;
150 typedef struct {
151 char depth;
152 short class;
153 } KdVideoFormatRec, *KdVideoFormatPtr;
155 typedef struct {
156 int flags;
157 int min_value;
158 int max_value;
159 char *name;
160 } KdAttributeRec, *KdAttributePtr;
162 typedef struct {
163 unsigned int type;
164 int flags;
165 char *name;
166 int nEncodings;
167 KdVideoEncodingPtr pEncodings;
168 int nFormats;
169 KdVideoFormatPtr pFormats;
170 int nPorts;
171 DevUnion *pPortPrivates;
172 int nAttributes;
173 KdAttributePtr pAttributes;
174 int nImages;
175 KdImagePtr pImages;
176 PutVideoFuncPtr PutVideo;
177 PutStillFuncPtr PutStill;
178 GetVideoFuncPtr GetVideo;
179 GetStillFuncPtr GetStill;
180 StopVideoFuncPtr StopVideo;
181 SetPortAttributeFuncPtr SetPortAttribute;
182 GetPortAttributeFuncPtr GetPortAttribute;
183 QueryBestSizeFuncPtr QueryBestSize;
184 PutImageFuncPtr PutImage;
185 ReputImageFuncPtr ReputImage;
186 QueryImageAttributesFuncPtr QueryImageAttributes;
187 } KdVideoAdaptorRec, *KdVideoAdaptorPtr;
189 typedef struct {
190 KdImagePtr image;
191 int flags;
192 int (*alloc_surface)(KdScreenInfo * screen,
193 int id,
194 unsigned short width,
195 unsigned short height,
196 KdSurfacePtr surface);
197 int (*free_surface)(KdSurfacePtr surface);
198 int (*display) (KdSurfacePtr surface,
199 short vid_x, short vid_y,
200 short drw_x, short drw_y,
201 short vid_w, short vid_h,
202 short drw_w, short drw_h,
203 RegionPtr clipBoxes);
204 int (*stop) (KdSurfacePtr surface);
205 int (*getAttribute) (KdScreenInfo * screen, Atom attr, INT32 *value);
206 int (*setAttribute) (KdScreenInfo * screen, Atom attr, INT32 value);
207 int max_width;
208 int max_height;
209 int num_attributes;
210 KdAttributePtr attributes;
211 } KdOffscreenImageRec, *KdOffscreenImagePtr;
213 Bool
214 KdXVScreenInit(
215 ScreenPtr pScreen,
216 KdVideoAdaptorPtr *Adaptors,
217 int num
220 typedef int (* KdXVInitGenericAdaptorPtr)(KdScreenInfo * screen,
221 KdVideoAdaptorPtr **Adaptors);
224 KdXVRegisterGenericAdaptorDriver(
225 KdXVInitGenericAdaptorPtr InitFunc
229 KdXVListGenericAdaptors(
230 KdScreenInfo * screen,
231 KdVideoAdaptorPtr **Adaptors
234 Bool
235 KdXVRegisterOffscreenImages(
236 ScreenPtr pScreen,
237 KdOffscreenImagePtr images,
238 int num
241 KdOffscreenImagePtr
242 KdXVQueryOffscreenImages(
243 ScreenPtr pScreen,
244 int *num
247 void
248 KdXVCopyPackedData(KdScreenInfo *screen, CARD8 *src, CARD8 *dst, int randr,
249 int srcPitch, int dstPitch, int srcW, int srcH, int top, int left,
250 int h, int w);
252 void
253 KdXVCopyPlanarData(KdScreenInfo *screen, CARD8 *src, CARD8 *dst, int randr,
254 int srcPitch, int srcPitch2, int dstPitch, int srcW, int srcH, int height,
255 int top, int left, int h, int w, int id);
257 void
258 KXVPaintRegion (DrawablePtr pDraw, RegionPtr pRgn, Pixel fg);
260 KdVideoAdaptorPtr KdXVAllocateVideoAdaptorRec(KdScreenInfo * screen);
262 void KdXVFreeVideoAdaptorRec(KdVideoAdaptorPtr ptr);
264 /* Must be called from KdCardInfo functions, can be called without Xv enabled */
265 Bool KdXVEnable(ScreenPtr);
266 void KdXVDisable(ScreenPtr);
268 /*** These are DDX layer privates ***/
271 typedef struct {
272 CreateWindowProcPtr CreateWindow;
273 DestroyWindowProcPtr DestroyWindow;
274 ClipNotifyProcPtr ClipNotify;
275 WindowExposuresProcPtr WindowExposures;
276 } KdXVScreenRec, *KdXVScreenPtr;
278 typedef struct {
279 int flags;
280 PutVideoFuncPtr PutVideo;
281 PutStillFuncPtr PutStill;
282 GetVideoFuncPtr GetVideo;
283 GetStillFuncPtr GetStill;
284 StopVideoFuncPtr StopVideo;
285 SetPortAttributeFuncPtr SetPortAttribute;
286 GetPortAttributeFuncPtr GetPortAttribute;
287 QueryBestSizeFuncPtr QueryBestSize;
288 PutImageFuncPtr PutImage;
289 ReputImageFuncPtr ReputImage;
290 QueryImageAttributesFuncPtr QueryImageAttributes;
291 } XvAdaptorRecPrivate, *XvAdaptorRecPrivatePtr;
293 typedef struct {
294 KdScreenInfo * screen;
295 DrawablePtr pDraw;
296 unsigned char type;
297 unsigned int subWindowMode;
298 DDXPointRec clipOrg;
299 RegionPtr clientClip;
300 RegionPtr pCompositeClip;
301 Bool FreeCompositeClip;
302 XvAdaptorRecPrivatePtr AdaptorRec;
303 XvStatus isOn;
304 Bool moved;
305 int vid_x, vid_y, vid_w, vid_h;
306 int drw_x, drw_y, drw_w, drw_h;
307 DevUnion DevPriv;
308 } XvPortRecPrivate, *XvPortRecPrivatePtr;
310 typedef struct _KdXVWindowRec{
311 XvPortRecPrivatePtr PortRec;
312 struct _KdXVWindowRec *next;
313 } KdXVWindowRec, *KdXVWindowPtr;
315 #endif /* _XVDIX_H_ */