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
;
91 unsigned short width
, height
;
92 int *pitches
; /* bytes */
93 int *offsets
; /* in bytes from start of framebuffer */
95 } KdSurfaceRec
, *KdSurfacePtr
;
97 typedef int (*PutVideoFuncPtr
) (KdScreenInfo
* screen
, DrawablePtr pDraw
,
98 short vid_x
, short vid_y
, short drw_x
,
99 short drw_y
, short vid_w
, short vid_h
,
100 short drw_w
, short drw_h
, RegionPtr clipBoxes
,
102 typedef int (*PutStillFuncPtr
) (KdScreenInfo
* screen
, DrawablePtr pDraw
,
103 short vid_x
, short vid_y
, short drw_x
,
104 short drw_y
, short vid_w
, short vid_h
,
105 short drw_w
, short drw_h
, RegionPtr clipBoxes
,
107 typedef int (*GetVideoFuncPtr
) (KdScreenInfo
* screen
, DrawablePtr pDraw
,
108 short vid_x
, short vid_y
, short drw_x
,
109 short drw_y
, short vid_w
, short vid_h
,
110 short drw_w
, short drw_h
, RegionPtr clipBoxes
,
112 typedef int (*GetStillFuncPtr
) (KdScreenInfo
* screen
, DrawablePtr pDraw
,
113 short vid_x
, short vid_y
, short drw_x
,
114 short drw_y
, short vid_w
, short vid_h
,
115 short drw_w
, short drw_h
, RegionPtr clipBoxes
,
117 typedef void (*StopVideoFuncPtr
) (KdScreenInfo
* screen
, pointer data
,
119 typedef int (*SetPortAttributeFuncPtr
) (KdScreenInfo
* screen
, Atom attribute
,
120 int value
, pointer data
);
121 typedef int (*GetPortAttributeFuncPtr
) (KdScreenInfo
* screen
, Atom attribute
,
122 int *value
, pointer data
);
123 typedef void (*QueryBestSizeFuncPtr
) (KdScreenInfo
* screen
, Bool motion
,
124 short vid_w
, short vid_h
, short drw_w
,
125 short drw_h
, unsigned int *p_w
,
126 unsigned int *p_h
, pointer data
);
127 typedef int (*PutImageFuncPtr
) (KdScreenInfo
* screen
, DrawablePtr pDraw
,
128 short src_x
, short src_y
, short drw_x
,
129 short drw_y
, short src_w
, short src_h
,
130 short drw_w
, short drw_h
, int image
,
131 unsigned char *buf
, short width
, short height
,
132 Bool Sync
, RegionPtr clipBoxes
, pointer data
);
133 typedef int (*ReputImageFuncPtr
) (KdScreenInfo
* screen
, DrawablePtr pDraw
,
134 short drw_x
, short drw_y
, RegionPtr clipBoxes
,
136 typedef int (*QueryImageAttributesFuncPtr
) (KdScreenInfo
* screen
, int image
,
137 unsigned short *width
,
138 unsigned short *height
,
139 int *pitches
, int *offsets
);
147 /*** this is what the driver needs to fill out ***/
152 unsigned short width
, height
;
154 } KdVideoEncodingRec
, *KdVideoEncodingPtr
;
159 } KdVideoFormatRec
, *KdVideoFormatPtr
;
166 } KdAttributeRec
, *KdAttributePtr
;
173 KdVideoEncodingPtr pEncodings
;
175 KdVideoFormatPtr pFormats
;
177 DevUnion
*pPortPrivates
;
179 KdAttributePtr pAttributes
;
182 PutVideoFuncPtr PutVideo
;
183 PutStillFuncPtr PutStill
;
184 GetVideoFuncPtr GetVideo
;
185 GetStillFuncPtr GetStill
;
186 StopVideoFuncPtr StopVideo
;
187 SetPortAttributeFuncPtr SetPortAttribute
;
188 GetPortAttributeFuncPtr GetPortAttribute
;
189 QueryBestSizeFuncPtr QueryBestSize
;
190 PutImageFuncPtr PutImage
;
191 ReputImageFuncPtr ReputImage
;
192 QueryImageAttributesFuncPtr QueryImageAttributes
;
193 } KdVideoAdaptorRec
, *KdVideoAdaptorPtr
;
196 KdXVScreenInit(ScreenPtr pScreen
, KdVideoAdaptorPtr
* Adaptors
, int num
);
198 typedef int (*KdXVInitGenericAdaptorPtr
) (KdScreenInfo
* screen
,
199 KdVideoAdaptorPtr
** Adaptors
);
202 KdXVRegisterGenericAdaptorDriver(KdXVInitGenericAdaptorPtr InitFunc
);
205 KdXVListGenericAdaptors(KdScreenInfo
* screen
, KdVideoAdaptorPtr
** Adaptors
);
209 KdXVCopyPackedData(KdScreenInfo
* screen
, CARD8
*src
, CARD8
*dst
, int randr
,
210 int srcPitch
, int dstPitch
, int srcW
, int srcH
, int top
,
211 int left
, int h
, int w
);
215 KdXVCopyPlanarData(KdScreenInfo
* screen
, CARD8
*src
, CARD8
*dst
, int randr
,
216 int srcPitch
, int srcPitch2
, int dstPitch
, int srcW
,
217 int srcH
, int height
, int top
, int left
, int h
, int w
,
221 KXVPaintRegion(DrawablePtr pDraw
, RegionPtr pRgn
, Pixel fg
);
223 KdVideoAdaptorPtr
KdXVAllocateVideoAdaptorRec(KdScreenInfo
* screen
);
225 void KdXVFreeVideoAdaptorRec(KdVideoAdaptorPtr ptr
);
227 /* Must be called from KdCardInfo functions, can be called without Xv enabled */
228 Bool
KdXVEnable(ScreenPtr
);
229 void KdXVDisable(ScreenPtr
);
231 /*** These are DDX layer privates ***/
234 CreateWindowProcPtr CreateWindow
;
235 DestroyWindowProcPtr DestroyWindow
;
236 ClipNotifyProcPtr ClipNotify
;
237 WindowExposuresProcPtr WindowExposures
;
238 } KdXVScreenRec
, *KdXVScreenPtr
;
242 PutVideoFuncPtr PutVideo
;
243 PutStillFuncPtr PutStill
;
244 GetVideoFuncPtr GetVideo
;
245 GetStillFuncPtr GetStill
;
246 StopVideoFuncPtr StopVideo
;
247 SetPortAttributeFuncPtr SetPortAttribute
;
248 GetPortAttributeFuncPtr GetPortAttribute
;
249 QueryBestSizeFuncPtr QueryBestSize
;
250 PutImageFuncPtr PutImage
;
251 ReputImageFuncPtr ReputImage
;
252 QueryImageAttributesFuncPtr QueryImageAttributes
;
253 } XvAdaptorRecPrivate
, *XvAdaptorRecPrivatePtr
;
256 KdScreenInfo
*screen
;
259 unsigned int subWindowMode
;
261 RegionPtr clientClip
;
262 RegionPtr pCompositeClip
;
263 Bool FreeCompositeClip
;
264 XvAdaptorRecPrivatePtr AdaptorRec
;
267 int vid_x
, vid_y
, vid_w
, vid_h
;
268 int drw_x
, drw_y
, drw_w
, drw_h
;
270 } XvPortRecPrivate
, *XvPortRecPrivatePtr
;
272 typedef struct _KdXVWindowRec
{
273 XvPortRecPrivatePtr PortRec
;
274 struct _KdXVWindowRec
*next
;
275 } KdXVWindowRec
, *KdXVWindowPtr
;
277 #endif /* _XVDIX_H_ */