1 /* 2 * Copyright 2006-2015 The Openchrome Project 3 * [https://www.freedesktop.org/wiki/Openchrome] 4 * Copyright 1998-2003 VIA Technologies, Inc. All Rights Reserved. 5 * Copyright 2001-2003 S3 Graphics, Inc. All Rights Reserved. 6 * 7 * Permission is hereby granted, free of charge, to any person obtaining a 8 * copy of this software and associated documentation files (the "Software"), 9 * to deal in the Software without restriction, including without limitation 10 * the rights to use, copy, modify, merge, publish, distribute, sub license, 11 * and/or sell copies of the Software, and to permit persons to whom the 12 * Software is furnished to do so, subject to the following conditions: 13 * 14 * The above copyright notice and this permission notice (including the 15 * next paragraph) shall be included in all copies or substantial portions 16 * of the Software. 17 * 18 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 19 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 20 * FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL 21 * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 22 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 23 * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 24 * DEALINGS IN THE SOFTWARE. 25 */ 26 27 #ifndef _VIA_PRIV_H_ 28 #define _VIA_PRIV_H_ 1 29 30 #ifdef HAVE_DRI 31 #include "via_drm.h" 32 #endif 33 #include "exa.h" 34 35 /* 36 * Alignment macro functions 37 */ 38 #define ALIGN_TO(f, alignment) (((f) + ((alignment)-1)) & ~((alignment)-1)) 39 40 /* 41 * FOURCC definitions 42 */ 43 44 #define FOURCC_XVMC (('C' << 24) + ('M' << 16) + ('V' << 8) + 'X') 45 #define FOURCC_RV15 (('5' << 24) + ('1' << 16) + ('V' << 8) + 'R') 46 #define FOURCC_RV16 (('6' << 24) + ('1' << 16) + ('V' << 8) + 'R') 47 #define FOURCC_RV32 (('2' << 24) + ('3' << 16) + ('V' << 8) + 'R') 48 49 /* 50 * Structures for create surface 51 */ 52 typedef struct _SWDEVICE 53 { 54 unsigned char * lpSWOverlaySurface[2]; /* Max 2 Pointers to SW Overlay Surface*/ 55 unsigned long dwSWPhysicalAddr[2]; /*Max 2 Physical address to SW Overlay Surface */ 56 unsigned long dwSWCbPhysicalAddr[2]; /* Physical address to SW Cb Overlay Surface, for YV12 format use */ 57 unsigned long dwSWCrPhysicalAddr[2]; /* Physical address to SW Cr Overlay Surface, for YV12 format use */ 58 unsigned long dwHQVAddr[3]; /* Physical address to HQV surface -- CLE_C0 */ 59 /*unsigned long dwHQVAddr[2];*/ /*Max 2 Physical address to SW HQV Overlay Surface*/ 60 unsigned long dwWidth; /*SW Source Width, not changed*/ 61 unsigned long dwHeight; /*SW Source Height, not changed*/ 62 unsigned long dwPitch; /*SW frame buffer pitch*/ 63 unsigned long gdwSWSrcWidth; /*SW Source Width, changed if window is out of screen*/ 64 unsigned long gdwSWSrcHeight; /*SW Source Height, changed if window is out of screen*/ 65 unsigned long gdwSWDstWidth; /*SW Destination Width*/ 66 unsigned long gdwSWDstHeight; /*SW Destination Height*/ 67 unsigned long gdwSWDstLeft; /*SW Position : Left*/ 68 unsigned long gdwSWDstTop; /*SW Position : Top*/ 69 unsigned long dwDeinterlaceMode; /*BOB / WEAVE*/ 70 }SWDEVICE; 71 typedef SWDEVICE * LPSWDEVICE; 72 73 typedef struct _DDUPDATEOVERLAY 74 { 75 CARD32 SrcLeft; 76 CARD32 SrcTop; 77 CARD32 SrcRight; 78 CARD32 SrcBottom; 79 80 CARD32 DstLeft; 81 CARD32 DstTop; 82 CARD32 DstRight; 83 CARD32 DstBottom; 84 85 unsigned long dwFlags; /* flags */ 86 unsigned long dwColorSpaceLowValue; 87 } DDUPDATEOVERLAY; 88 typedef DDUPDATEOVERLAY * LPDDUPDATEOVERLAY; 89 90 /* Definition for dwFlags */ 91 #define DDOVER_KEYDEST 1 92 #define DDOVER_INTERLEAVED 2 93 #define DDOVER_BOB 4 94 95 #define FOURCC_HQVSW 0x34565148 /*HQV4*/ 96 97 typedef struct 98 { 99 CARD32 dwWidth; 100 CARD32 dwHeight; 101 CARD32 dwOffset; 102 CARD32 dwUVoffset; 103 CARD32 dwFlipTime; 104 CARD32 dwFlipTag; 105 CARD32 dwStartAddr; 106 CARD32 dwV1OriWidth; 107 CARD32 dwV1OriHeight; 108 CARD32 dwV1OriPitch; 109 CARD32 dwV1SrcWidth; 110 CARD32 dwV1SrcHeight; 111 CARD32 dwV1SrcLeft; 112 CARD32 dwV1SrcRight; 113 CARD32 dwV1SrcTop; 114 CARD32 dwV1SrcBot; 115 CARD32 dwSPWidth; 116 CARD32 dwSPHeight; 117 CARD32 dwSPLeft; 118 CARD32 dwSPRight; 119 CARD32 dwSPTop; 120 CARD32 dwSPBot; 121 CARD32 dwSPOffset; 122 CARD32 dwSPstartAddr; 123 CARD32 dwDisplayPictStruct; 124 CARD32 dwDisplayBuffIndex; /* Display buffer Index. 0 to ( dwBufferNumber -1) */ 125 CARD32 dwFetchAlignment; 126 CARD32 dwSPPitch; 127 unsigned long dwHQVAddr[3]; /* CLE_C0 */ 128 /*unsigned long dwHQVAddr[2];*/ 129 CARD32 dwMPEGDeinterlaceMode; /* default value : VIA_DEINTERLACE_WEAVE */ 130 CARD32 dwMPEGProgressiveMode; /* default value : VIA_PROGRESSIVE */ 131 CARD32 dwHQVheapInfo; /* video memory heap of the HQV buffer */ 132 CARD32 dwVideoControl; /* video control flag */ 133 CARD32 dwminifyH; /* Horizontal minify factor */ 134 CARD32 dwminifyV; /* Vertical minify factor */ 135 CARD32 dwMpegDecoded; 136 } OVERLAYRECORD; 137 138 #define MEM_BLOCKS 4 139 140 typedef struct { 141 unsigned long gdwVideoFlagSW; 142 unsigned long gdwVideoFlagMPEG; 143 unsigned long gdwAlphaEnabled; /* For Alpha blending use*/ 144 145 struct buffer_object *HQVMem; 146 struct buffer_object *SWfbMem; 147 148 CARD32 SrcFourCC; 149 DDUPDATEOVERLAY UpdateOverlayBackup; /* For HQVcontrol func use 150 // To save MPEG updateoverlay info.*/ 151 152 /* device struct */ 153 SWDEVICE SWDevice; 154 OVERLAYRECORD overlayRecordV1; 155 OVERLAYRECORD overlayRecordV3; 156 157 Bool MPEG_ON; 158 Bool SWVideo_ON; 159 160 /*To solve the bandwidth issue */ 161 unsigned long gdwUseExtendedFIFO; 162 163 /* For panning mode use */ 164 int panning_x; 165 int panning_y; 166 int oldPanningX; 167 int oldPanningY; 168 169 /* Maximum resolution with interpolation */ 170 unsigned long maxWInterp; 171 unsigned long maxHInterp; 172 173 } swovRec, *swovPtr; 174 175 #endif /* _VIA_PRIV_H_ */ 176