~ubuntu-branches/ubuntu/intrepid/xserver-xgl/intrepid

« back to all changes in this revision

Viewing changes to hw/kdrive/src/kxv.h

  • Committer: Bazaar Package Importer
  • Author(s): Matthew Garrett
  • Date: 2006-02-13 14:21:43 UTC
  • Revision ID: james.westby@ubuntu.com-20060213142143-mad6z9xzem7hzxz9
Tags: upstream-7.0.0
ImportĀ upstreamĀ versionĀ 7.0.0

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/* 
 
2
 
 
3
   XFree86 Xv DDX written by Mark Vojkovich (markv@valinux.com) 
 
4
   Adapted for KDrive by Pontus Lidman <pontus.lidman@nokia.com>
 
5
 
 
6
   Copyright (C) 2000, 2001 - Nokia Home Communications
 
7
   Copyright (C) 1998, 1999 - The XFree86 Project Inc.
 
8
 
 
9
All rights reserved.
 
10
 
 
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.
 
20
 
 
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.
 
30
 
 
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.
 
35
 
 
36
*/
 
37
 
 
38
/* $RCSId: xc/programs/Xserver/hw/kdrive/kxv.h,v 1.1 2001/03/30 02:18:41 keithp Exp $ */
 
39
 
 
40
#ifndef _XVDIX_H_
 
41
#define _XVDIX_H_
 
42
 
 
43
#include "scrnintstr.h"
 
44
#include "regionstr.h"
 
45
#include "windowstr.h"
 
46
#include "pixmapstr.h"
 
47
#include "mivalidate.h"
 
48
#include "validate.h"
 
49
#include "resource.h"
 
50
#include "gcstruct.h"
 
51
#include "dixstruct.h"
 
52
 
 
53
#include "../../Xext/xvdix.h"
 
54
 
 
55
#define VIDEO_NO_CLIPPING                       0x00000001
 
56
#define VIDEO_INVERT_CLIPLIST                   0x00000002
 
57
#define VIDEO_OVERLAID_IMAGES                   0x00000004
 
58
#define VIDEO_OVERLAID_STILLS                   0x00000008
 
59
#define VIDEO_CLIP_TO_VIEWPORT                  0x00000010
 
60
 
 
61
typedef struct {
 
62
  int id;
 
63
  int type;
 
64
  int byte_order;
 
65
  unsigned char guid[16];               
 
66
  int bits_per_pixel;
 
67
  int format;
 
68
  int num_planes;
 
69
 
 
70
  /* for RGB formats only */
 
71
  int depth;
 
72
  unsigned int red_mask;       
 
73
  unsigned int green_mask;   
 
74
  unsigned int blue_mask;   
 
75
 
 
76
  /* for YUV formats only */
 
77
  unsigned int y_sample_bits;
 
78
  unsigned int u_sample_bits;
 
79
  unsigned int v_sample_bits;   
 
80
  unsigned int horz_y_period;
 
81
  unsigned int horz_u_period;
 
82
  unsigned int horz_v_period;
 
83
  unsigned int vert_y_period;
 
84
  unsigned int vert_u_period;
 
85
  unsigned int vert_v_period;
 
86
  char component_order[32];
 
87
  int scanline_order;
 
88
} KdImageRec, *KdImagePtr; 
 
89
 
 
90
 
 
91
typedef struct {
 
92
  KdScreenInfo * screen;
 
93
  int id;
 
94
  unsigned short width, height;
 
95
  int *pitches; /* bytes */
 
96
  int *offsets; /* in bytes from start of framebuffer */
 
97
  DevUnion devPrivate;  
 
98
} KdSurfaceRec, *KdSurfacePtr;
 
99
 
 
100
 
 
101
typedef int (* PutVideoFuncPtr)( KdScreenInfo * screen, DrawablePtr pDraw,
 
102
        short vid_x, short vid_y, short drw_x, short drw_y,
 
103
        short vid_w, short vid_h, short drw_w, short drw_h,
 
104
        RegionPtr clipBoxes, pointer data );
 
105
typedef int (* PutStillFuncPtr)( KdScreenInfo * screen,  DrawablePtr pDraw,
 
106
        short vid_x, short vid_y, short drw_x, short drw_y,
 
107
        short vid_w, short vid_h, short drw_w, short drw_h,
 
108
        RegionPtr clipBoxes, pointer data );
 
109
typedef int (* GetVideoFuncPtr)( KdScreenInfo * screen,  DrawablePtr pDraw,
 
110
        short vid_x, short vid_y, short drw_x, short drw_y,
 
111
        short vid_w, short vid_h, short drw_w, short drw_h,
 
112
        RegionPtr clipBoxes, pointer data );
 
113
typedef int (* GetStillFuncPtr)( KdScreenInfo * screen,  DrawablePtr pDraw,
 
114
        short vid_x, short vid_y, short drw_x, short drw_y,
 
115
        short vid_w, short vid_h, short drw_w, short drw_h,
 
116
        RegionPtr clipBoxes, pointer data );
 
117
typedef void (* StopVideoFuncPtr)(KdScreenInfo * screen, pointer data, Bool Exit);
 
118
typedef int (* SetPortAttributeFuncPtr)(KdScreenInfo * screen, Atom attribute,
 
119
        int value, pointer data);
 
120
typedef int (* GetPortAttributeFuncPtr)(KdScreenInfo * screen, Atom attribute,
 
121
        int *value, pointer data);
 
122
typedef void (* QueryBestSizeFuncPtr)(KdScreenInfo * screen, Bool motion,
 
123
        short vid_w, short vid_h, short drw_w, short drw_h, 
 
124
        unsigned int *p_w, unsigned int *p_h, pointer data);
 
125
typedef int (* PutImageFuncPtr)( KdScreenInfo * screen,  DrawablePtr pDraw,
 
126
        short src_x, short src_y, short drw_x, short drw_y,
 
127
        short src_w, short src_h, short drw_w, short drw_h,
 
128
        int image, unsigned char* buf, short width, short height, Bool Sync,
 
129
        RegionPtr clipBoxes, pointer data );
 
130
typedef int (* ReputImageFuncPtr)( KdScreenInfo * screen, DrawablePtr pDraw,
 
131
                                  short drw_x, short drw_y,
 
132
                                  RegionPtr clipBoxes, pointer data );
 
133
typedef int (*QueryImageAttributesFuncPtr)(KdScreenInfo * screen, 
 
134
        int image, unsigned short *width, unsigned short *height, 
 
135
        int *pitches, int *offsets);
 
136
 
 
137
typedef enum {
 
138
    XV_OFF,
 
139
    XV_PENDING,
 
140
    XV_ON
 
141
} XvStatus;
 
142
 
 
143
/*** this is what the driver needs to fill out ***/
 
144
 
 
145
typedef struct {
 
146
  int id;
 
147
  char *name;
 
148
  unsigned short width, height;
 
149
  XvRationalRec rate;
 
150
} KdVideoEncodingRec, *KdVideoEncodingPtr;
 
151
 
 
152
typedef struct {
 
153
  char  depth;  
 
154
  short class;
 
155
} KdVideoFormatRec, *KdVideoFormatPtr;
 
156
 
 
157
typedef struct {
 
158
  int   flags;
 
159
  int   min_value;
 
160
  int   max_value;
 
161
  char  *name;
 
162
} KdAttributeRec, *KdAttributePtr;
 
163
 
 
164
typedef struct {
 
165
  unsigned int type; 
 
166
  int flags;
 
167
  char *name;
 
168
  int nEncodings;
 
169
  KdVideoEncodingPtr pEncodings;  
 
170
  int nFormats;
 
171
  KdVideoFormatPtr pFormats;  
 
172
  int nPorts;
 
173
  DevUnion *pPortPrivates;
 
174
  int nAttributes;
 
175
  KdAttributePtr pAttributes;
 
176
  int nImages;
 
177
  KdImagePtr pImages;
 
178
  PutVideoFuncPtr PutVideo;
 
179
  PutStillFuncPtr PutStill;
 
180
  GetVideoFuncPtr GetVideo;
 
181
  GetStillFuncPtr GetStill;
 
182
  StopVideoFuncPtr StopVideo;
 
183
  SetPortAttributeFuncPtr SetPortAttribute;
 
184
  GetPortAttributeFuncPtr GetPortAttribute;
 
185
  QueryBestSizeFuncPtr QueryBestSize;
 
186
  PutImageFuncPtr PutImage;
 
187
  ReputImageFuncPtr ReputImage;
 
188
  QueryImageAttributesFuncPtr QueryImageAttributes;
 
189
} KdVideoAdaptorRec, *KdVideoAdaptorPtr;
 
190
 
 
191
typedef struct {
 
192
  KdImagePtr image;
 
193
  int flags;
 
194
  int (*alloc_surface)(KdScreenInfo * screen,
 
195
                  int id,
 
196
                  unsigned short width,         
 
197
                  unsigned short height,
 
198
                  KdSurfacePtr surface);
 
199
  int (*free_surface)(KdSurfacePtr surface);
 
200
  int (*display) (KdSurfacePtr surface,
 
201
                  short vid_x, short vid_y, 
 
202
                  short drw_x, short drw_y,
 
203
                  short vid_w, short vid_h, 
 
204
                  short drw_w, short drw_h,
 
205
                  RegionPtr clipBoxes);
 
206
  int (*stop)    (KdSurfacePtr surface);
 
207
  int (*getAttribute) (KdScreenInfo * screen, Atom attr, INT32 *value);
 
208
  int (*setAttribute) (KdScreenInfo * screen, Atom attr, INT32 value);
 
209
  int max_width;
 
210
  int max_height;
 
211
  int num_attributes;
 
212
  KdAttributePtr attributes;
 
213
} KdOffscreenImageRec, *KdOffscreenImagePtr;
 
214
 
 
215
Bool
 
216
KdXVScreenInit(
 
217
   ScreenPtr pScreen, 
 
218
   KdVideoAdaptorPtr    *Adaptors,
 
219
   int num
 
220
);
 
221
 
 
222
typedef int (* KdXVInitGenericAdaptorPtr)(KdScreenInfo * screen,
 
223
        KdVideoAdaptorPtr **Adaptors);
 
224
 
 
225
int
 
226
KdXVRegisterGenericAdaptorDriver(
 
227
    KdXVInitGenericAdaptorPtr InitFunc
 
228
);
 
229
 
 
230
int
 
231
KdXVListGenericAdaptors(
 
232
    KdScreenInfo *          screen,
 
233
    KdVideoAdaptorPtr  **Adaptors
 
234
);
 
235
 
 
236
Bool 
 
237
KdXVRegisterOffscreenImages(
 
238
   ScreenPtr pScreen,
 
239
   KdOffscreenImagePtr images,
 
240
   int num
 
241
);
 
242
 
 
243
KdOffscreenImagePtr
 
244
KdXVQueryOffscreenImages(
 
245
   ScreenPtr pScreen,
 
246
   int *num
 
247
);
 
248
 
 
249
void
 
250
KdXVCopyPackedData(KdScreenInfo *screen, CARD8 *src, CARD8 *dst, int randr,
 
251
   int srcPitch, int dstPitch, int srcW, int srcH, int top, int left,
 
252
   int h, int w);
 
253
 
 
254
void
 
255
KdXVCopyPlanarData(KdScreenInfo *screen, CARD8 *src, CARD8 *dst, int randr,
 
256
   int srcPitch, int srcPitch2, int dstPitch, int srcW, int srcH, int height,
 
257
   int top, int left, int h, int w, int id);
 
258
 
 
259
void
 
260
KXVPaintRegion (DrawablePtr pDraw, RegionPtr pRgn, Pixel fg);
 
261
 
 
262
KdVideoAdaptorPtr KdXVAllocateVideoAdaptorRec(KdScreenInfo * screen);
 
263
 
 
264
void KdXVFreeVideoAdaptorRec(KdVideoAdaptorPtr ptr);
 
265
 
 
266
/* Must be called from KdCardInfo functions, can be called without Xv enabled */
 
267
Bool KdXVEnable(ScreenPtr);
 
268
void KdXVDisable(ScreenPtr);
 
269
 
 
270
/*** These are DDX layer privates ***/
 
271
 
 
272
 
 
273
typedef struct {
 
274
   CreateWindowProcPtr          CreateWindow;
 
275
   DestroyWindowProcPtr         DestroyWindow;
 
276
   ClipNotifyProcPtr            ClipNotify;
 
277
   WindowExposuresProcPtr       WindowExposures;
 
278
} KdXVScreenRec, *KdXVScreenPtr;
 
279
 
 
280
typedef struct {
 
281
  int flags;  
 
282
  PutVideoFuncPtr PutVideo;
 
283
  PutStillFuncPtr PutStill;
 
284
  GetVideoFuncPtr GetVideo;
 
285
  GetStillFuncPtr GetStill;
 
286
  StopVideoFuncPtr StopVideo;
 
287
  SetPortAttributeFuncPtr SetPortAttribute;
 
288
  GetPortAttributeFuncPtr GetPortAttribute;
 
289
  QueryBestSizeFuncPtr QueryBestSize;
 
290
  PutImageFuncPtr PutImage;
 
291
  ReputImageFuncPtr ReputImage;
 
292
  QueryImageAttributesFuncPtr QueryImageAttributes;
 
293
} XvAdaptorRecPrivate, *XvAdaptorRecPrivatePtr;
 
294
 
 
295
typedef struct {
 
296
   KdScreenInfo * screen;
 
297
   DrawablePtr pDraw;
 
298
   unsigned char type;
 
299
   unsigned int subWindowMode;
 
300
   DDXPointRec clipOrg;
 
301
   RegionPtr clientClip;
 
302
   RegionPtr pCompositeClip;
 
303
   Bool FreeCompositeClip;
 
304
   XvAdaptorRecPrivatePtr AdaptorRec;
 
305
   XvStatus isOn;
 
306
   Bool moved;
 
307
   int vid_x, vid_y, vid_w, vid_h;
 
308
   int drw_x, drw_y, drw_w, drw_h;
 
309
   DevUnion DevPriv;
 
310
} XvPortRecPrivate, *XvPortRecPrivatePtr;
 
311
 
 
312
typedef struct _KdXVWindowRec{
 
313
   XvPortRecPrivatePtr PortRec;
 
314
   struct _KdXVWindowRec *next;
 
315
} KdXVWindowRec, *KdXVWindowPtr;
 
316
 
 
317
#endif  /* _XVDIX_H_ */
 
318