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.
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.
41 #include "scrnintstr.h"
42 #include "regionstr.h"
43 #include "windowstr.h"
44 #include "pixmapstr.h"
45 #include "mivalidate.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
63 unsigned char guid
[16];
68 /* for RGB formats only */
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];
86 } KdImageRec
, *KdImagePtr
;
90 KdScreenInfo
* screen
;
92 unsigned short width
, height
;
93 int *pitches
; /* bytes */
94 int *offsets
; /* in bytes from start of framebuffer */
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
);
141 /*** this is what the driver needs to fill out ***/
146 unsigned short width
, height
;
148 } KdVideoEncodingRec
, *KdVideoEncodingPtr
;
153 } KdVideoFormatRec
, *KdVideoFormatPtr
;
160 } KdAttributeRec
, *KdAttributePtr
;
167 KdVideoEncodingPtr pEncodings
;
169 KdVideoFormatPtr pFormats
;
171 DevUnion
*pPortPrivates
;
173 KdAttributePtr pAttributes
;
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
;
192 int (*alloc_surface
)(KdScreenInfo
* screen
,
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
);
210 KdAttributePtr attributes
;
211 } KdOffscreenImageRec
, *KdOffscreenImagePtr
;
216 KdVideoAdaptorPtr
*Adaptors
,
220 typedef int (* KdXVInitGenericAdaptorPtr
)(KdScreenInfo
* screen
,
221 KdVideoAdaptorPtr
**Adaptors
);
224 KdXVRegisterGenericAdaptorDriver(
225 KdXVInitGenericAdaptorPtr InitFunc
229 KdXVListGenericAdaptors(
230 KdScreenInfo
* screen
,
231 KdVideoAdaptorPtr
**Adaptors
235 KdXVRegisterOffscreenImages(
237 KdOffscreenImagePtr images
,
242 KdXVQueryOffscreenImages(
248 KdXVCopyPackedData(KdScreenInfo
*screen
, CARD8
*src
, CARD8
*dst
, int randr
,
249 int srcPitch
, int dstPitch
, int srcW
, int srcH
, int top
, int left
,
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
);
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 ***/
272 CreateWindowProcPtr CreateWindow
;
273 DestroyWindowProcPtr DestroyWindow
;
274 ClipNotifyProcPtr ClipNotify
;
275 WindowExposuresProcPtr WindowExposures
;
276 } KdXVScreenRec
, *KdXVScreenPtr
;
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
;
294 KdScreenInfo
* screen
;
297 unsigned int subWindowMode
;
299 RegionPtr clientClip
;
300 RegionPtr pCompositeClip
;
301 Bool FreeCompositeClip
;
302 XvAdaptorRecPrivatePtr AdaptorRec
;
305 int vid_x
, vid_y
, vid_w
, vid_h
;
306 int drw_x
, drw_y
, drw_w
, drw_h
;
308 } XvPortRecPrivate
, *XvPortRecPrivatePtr
;
310 typedef struct _KdXVWindowRec
{
311 XvPortRecPrivatePtr PortRec
;
312 struct _KdXVWindowRec
*next
;
313 } KdXVWindowRec
, *KdXVWindowPtr
;
315 #endif /* _XVDIX_H_ */