16747b715Smrg/*
205b261ecSmrg
36747b715Smrg   XFree86 Xv DDX written by Mark Vojkovich (markv@valinux.com)
405b261ecSmrg   Adapted for KDrive by Pontus Lidman <pontus.lidman@nokia.com>
505b261ecSmrg
605b261ecSmrg   Copyright (C) 2000, 2001 - Nokia Home Communications
705b261ecSmrg   Copyright (C) 1998, 1999 - The XFree86 Project Inc.
805b261ecSmrg
905b261ecSmrgAll rights reserved.
1005b261ecSmrg
1105b261ecSmrgPermission is hereby granted, free of charge, to any person obtaining
1205b261ecSmrga copy of this software and associated documentation files (the
1305b261ecSmrg"Software"), to deal in the Software without restriction, including
1405b261ecSmrgwithout limitation the rights to use, copy, modify, merge, publish,
1505b261ecSmrgdistribute, and/or sell copies of the Software, and to permit persons
1605b261ecSmrgto whom the Software is furnished to do so, provided that the above
1705b261ecSmrgcopyright notice(s) and this permission notice appear in all copies of
1805b261ecSmrgthe Software and that both the above copyright notice(s) and this
1905b261ecSmrgpermission notice appear in supporting documentation.
2005b261ecSmrg
2105b261ecSmrgTHE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
2205b261ecSmrgEXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
2305b261ecSmrgMERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT
2405b261ecSmrgOF THIRD PARTY RIGHTS. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
2505b261ecSmrgHOLDERS INCLUDED IN THIS NOTICE BE LIABLE FOR ANY CLAIM, OR ANY
2605b261ecSmrgSPECIAL INDIRECT OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES WHATSOEVER
2705b261ecSmrgRESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF
2805b261ecSmrgCONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
2905b261ecSmrgCONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
3005b261ecSmrg
3105b261ecSmrgExcept as contained in this notice, the name of a copyright holder
3205b261ecSmrgshall not be used in advertising or otherwise to promote the sale, use
3305b261ecSmrgor other dealings in this Software without prior written authorization
3405b261ecSmrgof the copyright holder.
3505b261ecSmrg
3605b261ecSmrg*/
3705b261ecSmrg
3805b261ecSmrg#ifndef _XVDIX_H_
3905b261ecSmrg#define _XVDIX_H_
4005b261ecSmrg
4105b261ecSmrg#include "scrnintstr.h"
4205b261ecSmrg#include "regionstr.h"
4305b261ecSmrg#include "windowstr.h"
4405b261ecSmrg#include "pixmapstr.h"
4505b261ecSmrg#include "mivalidate.h"
4605b261ecSmrg#include "validate.h"
4705b261ecSmrg#include "resource.h"
4805b261ecSmrg#include "gcstruct.h"
4905b261ecSmrg#include "dixstruct.h"
5005b261ecSmrg
5105b261ecSmrg#include "../../Xext/xvdix.h"
5205b261ecSmrg
5305b261ecSmrg#define VIDEO_OVERLAID_IMAGES			0x00000004
5405b261ecSmrg#define VIDEO_OVERLAID_STILLS			0x00000008
5505b261ecSmrg#define VIDEO_CLIP_TO_VIEWPORT			0x00000010
5605b261ecSmrg
5735c4bbdfSmrgtypedef int (*PutVideoFuncPtr) (KdScreenInfo * screen, DrawablePtr pDraw,
5835c4bbdfSmrg                                short vid_x, short vid_y, short drw_x,
5935c4bbdfSmrg                                short drw_y, short vid_w, short vid_h,
6035c4bbdfSmrg                                short drw_w, short drw_h, RegionPtr clipBoxes,
6135c4bbdfSmrg                                void *data);
6235c4bbdfSmrgtypedef int (*PutStillFuncPtr) (KdScreenInfo * screen, DrawablePtr pDraw,
6335c4bbdfSmrg                                short vid_x, short vid_y, short drw_x,
6435c4bbdfSmrg                                short drw_y, short vid_w, short vid_h,
6535c4bbdfSmrg                                short drw_w, short drw_h, RegionPtr clipBoxes,
6635c4bbdfSmrg                                void *data);
6735c4bbdfSmrgtypedef int (*GetVideoFuncPtr) (KdScreenInfo * screen, DrawablePtr pDraw,
6835c4bbdfSmrg                                short vid_x, short vid_y, short drw_x,
6935c4bbdfSmrg                                short drw_y, short vid_w, short vid_h,
7035c4bbdfSmrg                                short drw_w, short drw_h, RegionPtr clipBoxes,
7135c4bbdfSmrg                                void *data);
7235c4bbdfSmrgtypedef int (*GetStillFuncPtr) (KdScreenInfo * screen, DrawablePtr pDraw,
7335c4bbdfSmrg                                short vid_x, short vid_y, short drw_x,
7435c4bbdfSmrg                                short drw_y, short vid_w, short vid_h,
7535c4bbdfSmrg                                short drw_w, short drw_h, RegionPtr clipBoxes,
7635c4bbdfSmrg                                void *data);
7735c4bbdfSmrgtypedef void (*StopVideoFuncPtr) (KdScreenInfo * screen, void *data,
7835c4bbdfSmrg                                  Bool Exit);
7935c4bbdfSmrgtypedef int (*SetPortAttributeFuncPtr) (KdScreenInfo * screen, Atom attribute,
8035c4bbdfSmrg                                        int value, void *data);
8135c4bbdfSmrgtypedef int (*GetPortAttributeFuncPtr) (KdScreenInfo * screen, Atom attribute,
8235c4bbdfSmrg                                        int *value, void *data);
8335c4bbdfSmrgtypedef void (*QueryBestSizeFuncPtr) (KdScreenInfo * screen, Bool motion,
8435c4bbdfSmrg                                      short vid_w, short vid_h, short drw_w,
8535c4bbdfSmrg                                      short drw_h, unsigned int *p_w,
8635c4bbdfSmrg                                      unsigned int *p_h, void *data);
8735c4bbdfSmrgtypedef int (*PutImageFuncPtr) (KdScreenInfo * screen, DrawablePtr pDraw,
8835c4bbdfSmrg                                short src_x, short src_y, short drw_x,
8935c4bbdfSmrg                                short drw_y, short src_w, short src_h,
9035c4bbdfSmrg                                short drw_w, short drw_h, int image,
9135c4bbdfSmrg                                unsigned char *buf, short width, short height,
9235c4bbdfSmrg                                Bool Sync, RegionPtr clipBoxes, void *data);
9335c4bbdfSmrgtypedef int (*ReputImageFuncPtr) (KdScreenInfo * screen, DrawablePtr pDraw,
9435c4bbdfSmrg                                  short drw_x, short drw_y, RegionPtr clipBoxes,
9535c4bbdfSmrg                                  void *data);
9635c4bbdfSmrgtypedef int (*QueryImageAttributesFuncPtr) (KdScreenInfo * screen, int image,
9735c4bbdfSmrg                                            unsigned short *width,
9835c4bbdfSmrg                                            unsigned short *height,
9935c4bbdfSmrg                                            int *pitches, int *offsets);
10005b261ecSmrg
10105b261ecSmrgtypedef enum {
10205b261ecSmrg    XV_OFF,
10305b261ecSmrg    XV_PENDING,
10405b261ecSmrg    XV_ON
10505b261ecSmrg} XvStatus;
10605b261ecSmrg
10705b261ecSmrg/*** this is what the driver needs to fill out ***/
10805b261ecSmrg
10905b261ecSmrgtypedef struct {
11035c4bbdfSmrg    int id;
11135c4bbdfSmrg    const char *name;
11235c4bbdfSmrg    unsigned short width, height;
11335c4bbdfSmrg    XvRationalRec rate;
11405b261ecSmrg} KdVideoEncodingRec, *KdVideoEncodingPtr;
11505b261ecSmrg
11605b261ecSmrgtypedef struct {
11735c4bbdfSmrg    char depth;
11835c4bbdfSmrg    short class;
11905b261ecSmrg} KdVideoFormatRec, *KdVideoFormatPtr;
12005b261ecSmrg
12105b261ecSmrgtypedef struct {
12235c4bbdfSmrg    unsigned int type;
12335c4bbdfSmrg    int flags;
12435c4bbdfSmrg    const char *name;
12535c4bbdfSmrg    int nEncodings;
12635c4bbdfSmrg    KdVideoEncodingPtr pEncodings;
12735c4bbdfSmrg    int nFormats;
12835c4bbdfSmrg    KdVideoFormatPtr pFormats;
12935c4bbdfSmrg    int nPorts;
13035c4bbdfSmrg    DevUnion *pPortPrivates;
13135c4bbdfSmrg    int nAttributes;
13235c4bbdfSmrg    XvAttributePtr pAttributes;
13335c4bbdfSmrg    int nImages;
13435c4bbdfSmrg    XvImagePtr pImages;
13535c4bbdfSmrg    PutVideoFuncPtr PutVideo;
13635c4bbdfSmrg    PutStillFuncPtr PutStill;
13735c4bbdfSmrg    GetVideoFuncPtr GetVideo;
13835c4bbdfSmrg    GetStillFuncPtr GetStill;
13935c4bbdfSmrg    StopVideoFuncPtr StopVideo;
14035c4bbdfSmrg    SetPortAttributeFuncPtr SetPortAttribute;
14135c4bbdfSmrg    GetPortAttributeFuncPtr GetPortAttribute;
14235c4bbdfSmrg    QueryBestSizeFuncPtr QueryBestSize;
14335c4bbdfSmrg    PutImageFuncPtr PutImage;
14435c4bbdfSmrg    ReputImageFuncPtr ReputImage;
14535c4bbdfSmrg    QueryImageAttributesFuncPtr QueryImageAttributes;
14605b261ecSmrg} KdVideoAdaptorRec, *KdVideoAdaptorPtr;
14705b261ecSmrg
14805b261ecSmrgBool
14935c4bbdfSmrg KdXVScreenInit(ScreenPtr pScreen, KdVideoAdaptorPtr Adaptors, int num);
15005b261ecSmrg
15105b261ecSmrg/*** These are DDX layer privates ***/
15205b261ecSmrg
15305b261ecSmrgtypedef struct {
15435c4bbdfSmrg    DestroyWindowProcPtr DestroyWindow;
15535c4bbdfSmrg    ClipNotifyProcPtr ClipNotify;
15635c4bbdfSmrg    WindowExposuresProcPtr WindowExposures;
15735c4bbdfSmrg    CloseScreenProcPtr CloseScreen;
15805b261ecSmrg} KdXVScreenRec, *KdXVScreenPtr;
15905b261ecSmrg
16005b261ecSmrgtypedef struct {
16135c4bbdfSmrg    int flags;
16235c4bbdfSmrg    PutVideoFuncPtr PutVideo;
16335c4bbdfSmrg    PutStillFuncPtr PutStill;
16435c4bbdfSmrg    GetVideoFuncPtr GetVideo;
16535c4bbdfSmrg    GetStillFuncPtr GetStill;
16635c4bbdfSmrg    StopVideoFuncPtr StopVideo;
16735c4bbdfSmrg    SetPortAttributeFuncPtr SetPortAttribute;
16835c4bbdfSmrg    GetPortAttributeFuncPtr GetPortAttribute;
16935c4bbdfSmrg    QueryBestSizeFuncPtr QueryBestSize;
17035c4bbdfSmrg    PutImageFuncPtr PutImage;
17135c4bbdfSmrg    ReputImageFuncPtr ReputImage;
17235c4bbdfSmrg    QueryImageAttributesFuncPtr QueryImageAttributes;
17305b261ecSmrg} XvAdaptorRecPrivate, *XvAdaptorRecPrivatePtr;
17405b261ecSmrg
17505b261ecSmrgtypedef struct {
17635c4bbdfSmrg    KdScreenInfo *screen;
17735c4bbdfSmrg    DrawablePtr pDraw;
17835c4bbdfSmrg    unsigned char type;
17935c4bbdfSmrg    unsigned int subWindowMode;
18035c4bbdfSmrg    DDXPointRec clipOrg;
18135c4bbdfSmrg    RegionPtr clientClip;
18235c4bbdfSmrg    RegionPtr pCompositeClip;
18335c4bbdfSmrg    Bool FreeCompositeClip;
18435c4bbdfSmrg    XvAdaptorRecPrivatePtr AdaptorRec;
18535c4bbdfSmrg    XvStatus isOn;
18635c4bbdfSmrg    Bool moved;
18735c4bbdfSmrg    int vid_x, vid_y, vid_w, vid_h;
18835c4bbdfSmrg    int drw_x, drw_y, drw_w, drw_h;
18935c4bbdfSmrg    DevUnion DevPriv;
19005b261ecSmrg} XvPortRecPrivate, *XvPortRecPrivatePtr;
19105b261ecSmrg
19235c4bbdfSmrgtypedef struct _KdXVWindowRec {
19335c4bbdfSmrg    XvPortRecPrivatePtr PortRec;
19435c4bbdfSmrg    struct _KdXVWindowRec *next;
19505b261ecSmrg} KdXVWindowRec, *KdXVWindowPtr;
19605b261ecSmrg
19735c4bbdfSmrg#endif                          /* _XVDIX_H_ */
198