kxv.h revision 35c4bbdf
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 9All rights reserved. 10 11Permission is hereby granted, free of charge, to any person obtaining 12a copy of this software and associated documentation files (the 13"Software"), to deal in the Software without restriction, including 14without limitation the rights to use, copy, modify, merge, publish, 15distribute, and/or sell copies of the Software, and to permit persons 16to whom the Software is furnished to do so, provided that the above 17copyright notice(s) and this permission notice appear in all copies of 18the Software and that both the above copyright notice(s) and this 19permission notice appear in supporting documentation. 20 21THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 22EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 23MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT 24OF THIRD PARTY RIGHTS. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR 25HOLDERS INCLUDED IN THIS NOTICE BE LIABLE FOR ANY CLAIM, OR ANY 26SPECIAL INDIRECT OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES WHATSOEVER 27RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF 28CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN 29CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 30 31Except as contained in this notice, the name of a copyright holder 32shall not be used in advertising or otherwise to promote the sale, use 33or other dealings in this Software without prior written authorization 34of the copyright holder. 35 36*/ 37 38#ifndef _XVDIX_H_ 39#define _XVDIX_H_ 40 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" 50 51#include "../../Xext/xvdix.h" 52 53#define VIDEO_OVERLAID_IMAGES 0x00000004 54#define VIDEO_OVERLAID_STILLS 0x00000008 55#define VIDEO_CLIP_TO_VIEWPORT 0x00000010 56 57typedef int (*PutVideoFuncPtr) (KdScreenInfo * screen, DrawablePtr pDraw, 58 short vid_x, short vid_y, short drw_x, 59 short drw_y, short vid_w, short vid_h, 60 short drw_w, short drw_h, RegionPtr clipBoxes, 61 void *data); 62typedef int (*PutStillFuncPtr) (KdScreenInfo * screen, DrawablePtr pDraw, 63 short vid_x, short vid_y, short drw_x, 64 short drw_y, short vid_w, short vid_h, 65 short drw_w, short drw_h, RegionPtr clipBoxes, 66 void *data); 67typedef int (*GetVideoFuncPtr) (KdScreenInfo * screen, DrawablePtr pDraw, 68 short vid_x, short vid_y, short drw_x, 69 short drw_y, short vid_w, short vid_h, 70 short drw_w, short drw_h, RegionPtr clipBoxes, 71 void *data); 72typedef int (*GetStillFuncPtr) (KdScreenInfo * screen, DrawablePtr pDraw, 73 short vid_x, short vid_y, short drw_x, 74 short drw_y, short vid_w, short vid_h, 75 short drw_w, short drw_h, RegionPtr clipBoxes, 76 void *data); 77typedef void (*StopVideoFuncPtr) (KdScreenInfo * screen, void *data, 78 Bool Exit); 79typedef int (*SetPortAttributeFuncPtr) (KdScreenInfo * screen, Atom attribute, 80 int value, void *data); 81typedef int (*GetPortAttributeFuncPtr) (KdScreenInfo * screen, Atom attribute, 82 int *value, void *data); 83typedef void (*QueryBestSizeFuncPtr) (KdScreenInfo * screen, Bool motion, 84 short vid_w, short vid_h, short drw_w, 85 short drw_h, unsigned int *p_w, 86 unsigned int *p_h, void *data); 87typedef int (*PutImageFuncPtr) (KdScreenInfo * screen, DrawablePtr pDraw, 88 short src_x, short src_y, short drw_x, 89 short drw_y, short src_w, short src_h, 90 short drw_w, short drw_h, int image, 91 unsigned char *buf, short width, short height, 92 Bool Sync, RegionPtr clipBoxes, void *data); 93typedef int (*ReputImageFuncPtr) (KdScreenInfo * screen, DrawablePtr pDraw, 94 short drw_x, short drw_y, RegionPtr clipBoxes, 95 void *data); 96typedef int (*QueryImageAttributesFuncPtr) (KdScreenInfo * screen, int image, 97 unsigned short *width, 98 unsigned short *height, 99 int *pitches, int *offsets); 100 101typedef enum { 102 XV_OFF, 103 XV_PENDING, 104 XV_ON 105} XvStatus; 106 107/*** this is what the driver needs to fill out ***/ 108 109typedef struct { 110 int id; 111 const char *name; 112 unsigned short width, height; 113 XvRationalRec rate; 114} KdVideoEncodingRec, *KdVideoEncodingPtr; 115 116typedef struct { 117 char depth; 118 short class; 119} KdVideoFormatRec, *KdVideoFormatPtr; 120 121typedef struct { 122 unsigned int type; 123 int flags; 124 const char *name; 125 int nEncodings; 126 KdVideoEncodingPtr pEncodings; 127 int nFormats; 128 KdVideoFormatPtr pFormats; 129 int nPorts; 130 DevUnion *pPortPrivates; 131 int nAttributes; 132 XvAttributePtr pAttributes; 133 int nImages; 134 XvImagePtr pImages; 135 PutVideoFuncPtr PutVideo; 136 PutStillFuncPtr PutStill; 137 GetVideoFuncPtr GetVideo; 138 GetStillFuncPtr GetStill; 139 StopVideoFuncPtr StopVideo; 140 SetPortAttributeFuncPtr SetPortAttribute; 141 GetPortAttributeFuncPtr GetPortAttribute; 142 QueryBestSizeFuncPtr QueryBestSize; 143 PutImageFuncPtr PutImage; 144 ReputImageFuncPtr ReputImage; 145 QueryImageAttributesFuncPtr QueryImageAttributes; 146} KdVideoAdaptorRec, *KdVideoAdaptorPtr; 147 148Bool 149 KdXVScreenInit(ScreenPtr pScreen, KdVideoAdaptorPtr Adaptors, int num); 150 151void 152 153KdXVCopyPackedData(KdScreenInfo * screen, CARD8 *src, CARD8 *dst, int randr, 154 int srcPitch, int dstPitch, int srcW, int srcH, int top, 155 int left, int h, int w); 156 157void 158 159KdXVCopyPlanarData(KdScreenInfo * screen, CARD8 *src, CARD8 *dst, int randr, 160 int srcPitch, int srcPitch2, int dstPitch, int srcW, 161 int srcH, int height, int top, int left, int h, int w, 162 int id); 163 164KdVideoAdaptorPtr KdXVAllocateVideoAdaptorRec(KdScreenInfo * screen); 165 166void KdXVFreeVideoAdaptorRec(KdVideoAdaptorPtr ptr); 167 168/* Must be called from KdCardInfo functions, can be called without Xv enabled */ 169Bool KdXVEnable(ScreenPtr); 170void KdXVDisable(ScreenPtr); 171 172/*** These are DDX layer privates ***/ 173 174typedef struct { 175 DestroyWindowProcPtr DestroyWindow; 176 ClipNotifyProcPtr ClipNotify; 177 WindowExposuresProcPtr WindowExposures; 178 CloseScreenProcPtr CloseScreen; 179} KdXVScreenRec, *KdXVScreenPtr; 180 181typedef struct { 182 int flags; 183 PutVideoFuncPtr PutVideo; 184 PutStillFuncPtr PutStill; 185 GetVideoFuncPtr GetVideo; 186 GetStillFuncPtr GetStill; 187 StopVideoFuncPtr StopVideo; 188 SetPortAttributeFuncPtr SetPortAttribute; 189 GetPortAttributeFuncPtr GetPortAttribute; 190 QueryBestSizeFuncPtr QueryBestSize; 191 PutImageFuncPtr PutImage; 192 ReputImageFuncPtr ReputImage; 193 QueryImageAttributesFuncPtr QueryImageAttributes; 194} XvAdaptorRecPrivate, *XvAdaptorRecPrivatePtr; 195 196typedef struct { 197 KdScreenInfo *screen; 198 DrawablePtr pDraw; 199 unsigned char type; 200 unsigned int subWindowMode; 201 DDXPointRec clipOrg; 202 RegionPtr clientClip; 203 RegionPtr pCompositeClip; 204 Bool FreeCompositeClip; 205 XvAdaptorRecPrivatePtr AdaptorRec; 206 XvStatus isOn; 207 Bool moved; 208 int vid_x, vid_y, vid_w, vid_h; 209 int drw_x, drw_y, drw_w, drw_h; 210 DevUnion DevPriv; 211} XvPortRecPrivate, *XvPortRecPrivatePtr; 212 213typedef struct _KdXVWindowRec { 214 XvPortRecPrivatePtr PortRec; 215 struct _KdXVWindowRec *next; 216} KdXVWindowRec, *KdXVWindowPtr; 217 218#endif /* _XVDIX_H_ */ 219