17e6fb56fSmrg/*
2963d66acSmrg * Copyright 2006-2015 The Openchrome Project
3983b4bf2Smrg *                     [https://www.freedesktop.org/wiki/Openchrome]
47e6fb56fSmrg * Copyright 1998-2003 VIA Technologies, Inc. All Rights Reserved.
57e6fb56fSmrg * Copyright 2001-2003 S3 Graphics, Inc. All Rights Reserved.
67e6fb56fSmrg *
77e6fb56fSmrg * Permission is hereby granted, free of charge, to any person obtaining a
87e6fb56fSmrg * copy of this software and associated documentation files (the "Software"),
97e6fb56fSmrg * to deal in the Software without restriction, including without limitation
107e6fb56fSmrg * the rights to use, copy, modify, merge, publish, distribute, sub license,
117e6fb56fSmrg * and/or sell copies of the Software, and to permit persons to whom the
127e6fb56fSmrg * Software is furnished to do so, subject to the following conditions:
137e6fb56fSmrg *
147e6fb56fSmrg * The above copyright notice and this permission notice (including the
157e6fb56fSmrg * next paragraph) shall be included in all copies or substantial portions
167e6fb56fSmrg * of the Software.
177e6fb56fSmrg *
187e6fb56fSmrg * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
197e6fb56fSmrg * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
207e6fb56fSmrg * FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL
217e6fb56fSmrg * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
227e6fb56fSmrg * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
237e6fb56fSmrg * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
247e6fb56fSmrg * DEALINGS IN THE SOFTWARE.
257e6fb56fSmrg */
267e6fb56fSmrg
277e6fb56fSmrg#ifndef _VIA_PRIV_H_
287e6fb56fSmrg#define _VIA_PRIV_H_ 1
297e6fb56fSmrg
3090b17f1bSmrg#ifdef HAVE_DRI
317e6fb56fSmrg#include "via_drm.h"
327e6fb56fSmrg#endif
337e6fb56fSmrg#include "exa.h"
347e6fb56fSmrg
357e6fb56fSmrg/*
367e6fb56fSmrg * Alignment macro functions
377e6fb56fSmrg */
387e6fb56fSmrg#define ALIGN_TO(f, alignment) (((f) + ((alignment)-1)) & ~((alignment)-1))
397e6fb56fSmrg
407e6fb56fSmrg/*
417e6fb56fSmrg * FOURCC definitions
427e6fb56fSmrg */
437e6fb56fSmrg
447e6fb56fSmrg#define FOURCC_XVMC     (('C' << 24) + ('M' << 16) + ('V' << 8) + 'X')
457e6fb56fSmrg#define FOURCC_RV15     (('5' << 24) + ('1' << 16) + ('V' << 8) + 'R')
467e6fb56fSmrg#define FOURCC_RV16     (('6' << 24) + ('1' << 16) + ('V' << 8) + 'R')
477e6fb56fSmrg#define FOURCC_RV32     (('2' << 24) + ('3' << 16) + ('V' << 8) + 'R')
487e6fb56fSmrg
497e6fb56fSmrg/*
507e6fb56fSmrg * Structures for create surface
517e6fb56fSmrg */
527e6fb56fSmrgtypedef struct _SWDEVICE
537e6fb56fSmrg{
547e6fb56fSmrg unsigned char * lpSWOverlaySurface[2];   /* Max 2 Pointers to SW Overlay Surface*/
557e6fb56fSmrg unsigned long  dwSWPhysicalAddr[2];     /*Max 2 Physical address to SW Overlay Surface */
567e6fb56fSmrg unsigned long  dwSWCbPhysicalAddr[2];  /* Physical address to SW Cb Overlay Surface, for YV12 format use */
577e6fb56fSmrg unsigned long  dwSWCrPhysicalAddr[2];  /* Physical address to SW Cr Overlay Surface, for YV12 format use */
587e6fb56fSmrg unsigned long  dwHQVAddr[3];             /* Physical address to HQV surface -- CLE_C0   */
597e6fb56fSmrg /*unsigned long  dwHQVAddr[2];*/			  /*Max 2 Physical address to SW HQV Overlay Surface*/
607e6fb56fSmrg unsigned long  dwWidth;                  /*SW Source Width, not changed*/
617e6fb56fSmrg unsigned long  dwHeight;                 /*SW Source Height, not changed*/
627e6fb56fSmrg unsigned long  dwPitch;                  /*SW frame buffer pitch*/
637e6fb56fSmrg unsigned long  gdwSWSrcWidth;           /*SW Source Width, changed if window is out of screen*/
647e6fb56fSmrg unsigned long  gdwSWSrcHeight;          /*SW Source Height, changed if window is out of screen*/
657e6fb56fSmrg unsigned long  gdwSWDstWidth;           /*SW Destination Width*/
667e6fb56fSmrg unsigned long  gdwSWDstHeight;          /*SW Destination Height*/
677e6fb56fSmrg unsigned long  gdwSWDstLeft;            /*SW Position : Left*/
687e6fb56fSmrg unsigned long  gdwSWDstTop;             /*SW Position : Top*/
697e6fb56fSmrg unsigned long  dwDeinterlaceMode;        /*BOB / WEAVE*/
707e6fb56fSmrg}SWDEVICE;
717e6fb56fSmrgtypedef SWDEVICE * LPSWDEVICE;
727e6fb56fSmrg
737e6fb56fSmrgtypedef struct _DDUPDATEOVERLAY
747e6fb56fSmrg{
757e6fb56fSmrg    CARD32 SrcLeft;
767e6fb56fSmrg    CARD32 SrcTop;
777e6fb56fSmrg    CARD32 SrcRight;
787e6fb56fSmrg    CARD32 SrcBottom;
797e6fb56fSmrg
807e6fb56fSmrg    CARD32 DstLeft;
817e6fb56fSmrg    CARD32 DstTop;
827e6fb56fSmrg    CARD32 DstRight;
837e6fb56fSmrg    CARD32 DstBottom;
847e6fb56fSmrg
857e6fb56fSmrg    unsigned long     dwFlags;        /* flags */
867e6fb56fSmrg    unsigned long     dwColorSpaceLowValue;
877e6fb56fSmrg} DDUPDATEOVERLAY;
887e6fb56fSmrgtypedef DDUPDATEOVERLAY * LPDDUPDATEOVERLAY;
897e6fb56fSmrg
907e6fb56fSmrg/* Definition for dwFlags */
917e6fb56fSmrg#define DDOVER_KEYDEST     1
927e6fb56fSmrg#define DDOVER_INTERLEAVED 2
937e6fb56fSmrg#define DDOVER_BOB         4
947e6fb56fSmrg
957e6fb56fSmrg#define FOURCC_HQVSW   0x34565148  /*HQV4*/
967e6fb56fSmrg
977e6fb56fSmrgtypedef struct
987e6fb56fSmrg{
997e6fb56fSmrg    CARD32         dwWidth;
1007e6fb56fSmrg    CARD32         dwHeight;
1017e6fb56fSmrg    CARD32         dwOffset;
1027e6fb56fSmrg    CARD32         dwUVoffset;
1037e6fb56fSmrg    CARD32         dwFlipTime;
1047e6fb56fSmrg    CARD32         dwFlipTag;
1057e6fb56fSmrg    CARD32         dwStartAddr;
1067e6fb56fSmrg    CARD32         dwV1OriWidth;
1077e6fb56fSmrg    CARD32         dwV1OriHeight;
1087e6fb56fSmrg    CARD32         dwV1OriPitch;
1097e6fb56fSmrg    CARD32         dwV1SrcWidth;
1107e6fb56fSmrg    CARD32         dwV1SrcHeight;
1117e6fb56fSmrg    CARD32         dwV1SrcLeft;
1127e6fb56fSmrg    CARD32         dwV1SrcRight;
1137e6fb56fSmrg    CARD32         dwV1SrcTop;
1147e6fb56fSmrg    CARD32         dwV1SrcBot;
1157e6fb56fSmrg    CARD32         dwSPWidth;
1167e6fb56fSmrg    CARD32         dwSPHeight;
1177e6fb56fSmrg    CARD32         dwSPLeft;
1187e6fb56fSmrg    CARD32         dwSPRight;
1197e6fb56fSmrg    CARD32         dwSPTop;
1207e6fb56fSmrg    CARD32         dwSPBot;
1217e6fb56fSmrg    CARD32         dwSPOffset;
1227e6fb56fSmrg    CARD32         dwSPstartAddr;
1237e6fb56fSmrg    CARD32         dwDisplayPictStruct;
1247e6fb56fSmrg    CARD32         dwDisplayBuffIndex;        /* Display buffer Index. 0 to ( dwBufferNumber -1) */
1257e6fb56fSmrg    CARD32         dwFetchAlignment;
1267e6fb56fSmrg    CARD32         dwSPPitch;
1277e6fb56fSmrg    unsigned long  dwHQVAddr[3];          /* CLE_C0 */
1287e6fb56fSmrg    /*unsigned long   dwHQVAddr[2];*/
1297e6fb56fSmrg    CARD32         dwMPEGDeinterlaceMode; /* default value : VIA_DEINTERLACE_WEAVE */
1307e6fb56fSmrg    CARD32         dwMPEGProgressiveMode; /* default value : VIA_PROGRESSIVE */
1317e6fb56fSmrg    CARD32         dwHQVheapInfo;         /* video memory heap of the HQV buffer */
1327e6fb56fSmrg    CARD32         dwVideoControl;        /* video control flag */
13390b17f1bSmrg    CARD32         dwminifyH;			   /* Horizontal minify factor */
1347e6fb56fSmrg    CARD32         dwminifyV;			   /* Vertical minify factor */
1357e6fb56fSmrg    CARD32         dwMpegDecoded;
1367e6fb56fSmrg} OVERLAYRECORD;
1377e6fb56fSmrg
1387e6fb56fSmrg#define MEM_BLOCKS		4
1397e6fb56fSmrg
1407e6fb56fSmrgtypedef struct  {
1417e6fb56fSmrg    unsigned long   gdwVideoFlagSW;
1427e6fb56fSmrg    unsigned long   gdwVideoFlagMPEG;
1437e6fb56fSmrg    unsigned long   gdwAlphaEnabled;		/* For Alpha blending use*/
1447e6fb56fSmrg
14590b17f1bSmrg    struct buffer_object  *HQVMem;
14690b17f1bSmrg    struct buffer_object  *SWfbMem;
1477e6fb56fSmrg
1487e6fb56fSmrg    CARD32 SrcFourCC;
1497e6fb56fSmrg    DDUPDATEOVERLAY UpdateOverlayBackup;    /* For HQVcontrol func use
1507e6fb56fSmrg					    // To save MPEG updateoverlay info.*/
1517e6fb56fSmrg
1527e6fb56fSmrg/* device struct */
1537e6fb56fSmrg    SWDEVICE   SWDevice;
1547e6fb56fSmrg    OVERLAYRECORD   overlayRecordV1;
1557e6fb56fSmrg    OVERLAYRECORD   overlayRecordV3;
1567e6fb56fSmrg
1577e6fb56fSmrg    Bool MPEG_ON;
1587e6fb56fSmrg    Bool SWVideo_ON;
1597e6fb56fSmrg
1607e6fb56fSmrg/*To solve the bandwidth issue */
1617e6fb56fSmrg    unsigned long   gdwUseExtendedFIFO;
1627e6fb56fSmrg
1637e6fb56fSmrg/* For panning mode use */
1647e6fb56fSmrg    int panning_x;
1657e6fb56fSmrg    int panning_y;
1667e6fb56fSmrg    int oldPanningX;
1677e6fb56fSmrg    int oldPanningY;
1687e6fb56fSmrg
1697e6fb56fSmrg/* Maximum resolution with interpolation */
1707e6fb56fSmrg    unsigned long maxWInterp;
1717e6fb56fSmrg    unsigned long maxHInterp;
1727e6fb56fSmrg
1737e6fb56fSmrg} swovRec, *swovPtr;
1747e6fb56fSmrg
1757e6fb56fSmrg#endif /* _VIA_PRIV_H_ */
176