savage_streams.h revision aa9e3350
1#ifndef SAVAGE_STREAMS_H 2#define SAVAGE_STREAMS_H 3 4/************************************** 5 S3 streams processor 6**************************************/ 7 8#define EXT_MISC_CTRL2 0x67 9 10/* New streams */ 11 12/* CR67[2] = 1 : enable secondary stream 1 */ 13#define ENABLE_STREAM1 0x04 14/* CR67[1] = 1 : enable secondary stream 2 */ 15#define ENABLE_STREAM2 0x02 16/* mask to clear CR67[2,1] */ 17#define NO_STREAMS 0xF9 18/* CR67[3] = 1 : Mem-mapped regs */ 19#define USE_MM_FOR_PRI_STREAM 0x08 20 21#define HDM_SHIFT 16 22#define HDSCALE_4 (2 << HDM_SHIFT) 23#define HDSCALE_8 (3 << HDM_SHIFT) 24#define HDSCALE_16 (4 << HDM_SHIFT) 25#define HDSCALE_32 (5 << HDM_SHIFT) 26#define HDSCALE_64 (6 << HDM_SHIFT) 27 28/* Old Streams */ 29 30#define ENABLE_STREAMS_OLD 0x0c 31#define NO_STREAMS_OLD 0xf3 32/* CR69[0] = 1 : Mem-mapped regs */ 33#define USE_MM_FOR_PRI_STREAM_OLD 0x01 34 35 36/* 37 * There are two different streams engines used in the Savage line. 38 * The old engine is in the 3D, 4, Pro, and Twister. 39 * The new engine is in the 2000, MX, IX, and Super. 40 */ 41 42 43/* streams registers for old engine */ 44#define PSTREAM_CONTROL_REG 0x8180 45#define COL_CHROMA_KEY_CONTROL_REG 0x8184 46#define SSTREAM_CONTROL_REG 0x8190 47#define CHROMA_KEY_UPPER_BOUND_REG 0x8194 48#define SSTREAM_STRETCH_REG 0x8198 49#define COLOR_ADJUSTMENT_REG 0x819C 50#define BLEND_CONTROL_REG 0x81A0 51#define PSTREAM_FBADDR0_REG 0x81C0 52#define PSTREAM_FBADDR1_REG 0x81C4 53#define PSTREAM_STRIDE_REG 0x81C8 54#define DOUBLE_BUFFER_REG 0x81CC 55/* updated by peterzhu,original define is DOUBLE_BUFFER_REG*/ 56#define MULTIPLE_BUFFER_REG 0x81CC 57#define SSTREAM_FBADDR0_REG 0x81D0 58#define SSTREAM_FBADDR1_REG 0x81D4 59#define SSTREAM_STRIDE_REG 0x81D8 60#define SSTREAM_VSCALE_REG 0x81E0 61#define SSTREAM_VINITIAL_REG 0x81E4 62#define SSTREAM_LINES_REG 0x81E8 63#define STREAMS_FIFO_REG 0x81EC 64#define PSTREAM_WINDOW_START_REG 0x81F0 65#define PSTREAM_WINDOW_SIZE_REG 0x81F4 66#define SSTREAM_WINDOW_START_REG 0x81F8 67#define SSTREAM_WINDOW_SIZE_REG 0x81FC 68#define FIFO_CONTROL 0x8200 69#define PSTREAM_FBSIZE_REG 0x8300 70#define SSTREAM_FBSIZE_REG 0x8304 71#define SSTREAM_FBADDR2_REG 0x8308 72 73#define OS_XY(x,y) (((x)<<16)|(y+1)) /*(((x+1)<<16)|(y+1))*/ 74#define OS_WH(x,y) (((x-1)<<16)|(y)) 75 76/* Streams Processor macros */ 77#define H_Shift 0 78#define H_Mask (((1L << 11) - 1) << H_Shift) 79#define W_Shift 16 80#define W_Mask (((1L << 11) - 1) << W_Shift) 81 82#define Y_Shift 0 83#define Y_Mask (((1L << 11) - 1) << Y_Shift) 84#define X_Shift 16 85#define X_Mask (((1L << 11) - 1) << X_Shift) 86 87#define XY(x,y) ((((x+1)<<X_Shift)&X_Mask) | (((y+1)<<Y_Shift)&Y_Mask)) 88#define WH(w,h) ((((w-1)<<W_Shift)&W_Mask) | (((h)<<H_Shift)&H_Mask)) 89 90#define HSCALING_Shift 0 91#define HSCALING_Mask (((1L << 16)-1) << HSCALING_Shift) 92#define HSCALING(w0,w1) ((((unsigned int)(((double)w0/(double)w1) * (1 << 15))) \ 93 << HSCALING_Shift) \ 94 & HSCALING_Mask) 95 96#define VSCALING_Shift 0 97#define VSCALING_Mask (((1L << 20)-1) << VSCALING_Shift) 98#define VSCALING(h0,h1) ((((unsigned int) (((double)h0/(double)h1) * (1 << 15))) \ 99 << VSCALING_Shift) \ 100 & VSCALING_Mask) 101 102/* New Streams Processor */ 103/* Stream Processor 1 */ 104 105/* Primary Stream 1 Frame Buffer Address 0 */ 106#define PRI_STREAM_FBUF_ADDR0 0x81c0 107/* Primary Stream 1 Frame Buffer Address 0 */ 108#define PRI_STREAM_FBUF_ADDR1 0x81c4 109/* Primary Stream 1 Stride */ 110#define PRI_STREAM_STRIDE 0x81c8 111/* Primary Stream 1 Frame Buffer Size */ 112#define PRI_STREAM_BUFFERSIZE 0x8214 113 114/* Secondary stream 1 Color/Chroma Key Control */ 115#define SEC_STREAM_CKEY_LOW 0x8184 116/* Secondary stream 1 Chroma Key Upper Bound */ 117#define SEC_STREAM_CKEY_UPPER 0x8194 118/* Blend Control of Secondary Stream 1 & 2 */ 119#define BLEND_CONTROL 0x8190 120/* Secondary Stream 1 Color conversion/Adjustment 1 */ 121#define SEC_STREAM_COLOR_CONVERT1 0x8198 122/* Secondary Stream 1 Color conversion/Adjustment 2 */ 123#define SEC_STREAM_COLOR_CONVERT2 0x819c 124/* Secondary Stream 1 Color conversion/Adjustment 3 */ 125#define SEC_STREAM_COLOR_CONVERT3 0x81e4 126/* Secondary Stream 1 Horizontal Scaling */ 127#define SEC_STREAM_HSCALING 0x81a0 128/* Secondary Stream 1 Frame Buffer Size */ 129#define SEC_STREAM_BUFFERSIZE 0x81a8 130/* Secondary Stream 1 Horizontal Scaling Normalization (2K only) */ 131#define SEC_STREAM_HSCALE_NORMALIZE 0x81ac 132/* Secondary Stream 1 Horizontal Scaling */ 133#define SEC_STREAM_VSCALING 0x81e8 134/* Secondary Stream 1 Frame Buffer Address 0 */ 135#define SEC_STREAM_FBUF_ADDR0 0x81d0 136/* Secondary Stream 1 Frame Buffer Address 1 */ 137#define SEC_STREAM_FBUF_ADDR1 0x81d4 138/* Secondary Stream 1 Frame Buffer Address 2 */ 139#define SEC_STREAM_FBUF_ADDR2 0x81ec 140/* Secondary Stream 1 Stride */ 141#define SEC_STREAM_STRIDE 0x81d8 142/* Secondary Stream 1 Window Start Coordinates */ 143#define SEC_STREAM_WINDOW_START 0x81f8 144/* Secondary Stream 1 Window Size */ 145#define SEC_STREAM_WINDOW_SZ 0x81fc 146/* Secondary Streams Tile Offset */ 147#define SEC_STREAM_TILE_OFF 0x821c 148/* Secondary Stream 1 Opaque Overlay Control */ 149#define SEC_STREAM_OPAQUE_OVERLAY 0x81dc 150 151 152/* Stream Processor 2 */ 153 154/* Primary Stream 2 Frame Buffer Address 0 */ 155#define PRI_STREAM2_FBUF_ADDR0 0x81b0 156/* Primary Stream 2 Frame Buffer Address 1 */ 157#define PRI_STREAM2_FBUF_ADDR1 0x81b4 158/* Primary Stream 2 Stride */ 159#define PRI_STREAM2_STRIDE 0x81b8 160/* Primary Stream 2 Frame Buffer Size */ 161#define PRI_STREAM2_BUFFERSIZE 0x8218 162 163/* Secondary Stream 2 Color/Chroma Key Control */ 164#define SEC_STREAM2_CKEY_LOW 0x8188 165/* Secondary Stream 2 Chroma Key Upper Bound */ 166#define SEC_STREAM2_CKEY_UPPER 0x818c 167/* Secondary Stream 2 Horizontal Scaling */ 168#define SEC_STREAM2_HSCALING 0x81a4 169/* Secondary Stream 2 Horizontal Scaling */ 170#define SEC_STREAM2_VSCALING 0x8204 171/* Secondary Stream 2 Frame Buffer Size */ 172#define SEC_STREAM2_BUFFERSIZE 0x81ac 173/* Secondary Stream 2 Frame Buffer Address 0 */ 174#define SEC_STREAM2_FBUF_ADDR0 0x81bc 175/* Secondary Stream 2 Frame Buffer Address 1 */ 176#define SEC_STREAM2_FBUF_ADDR1 0x81e0 177/* Secondary Stream 2 Frame Buffer Address 2 */ 178#define SEC_STREAM2_FBUF_ADDR2 0x8208 179/* Multiple Buffer/LPB and Secondary Stream 2 Stride */ 180#define SEC_STREAM2_STRIDE_LPB 0x81cc 181/* Secondary Stream 2 Color conversion/Adjustment 1 */ 182#define SEC_STREAM2_COLOR_CONVERT1 0x81f0 183/* Secondary Stream 2 Color conversion/Adjustment 2 */ 184#define SEC_STREAM2_COLOR_CONVERT2 0x81f4 185/* Secondary Stream 2 Color conversion/Adjustment 3 */ 186#define SEC_STREAM2_COLOR_CONVERT3 0x8200 187/* Secondary Stream 2 Window Start Coordinates */ 188#define SEC_STREAM2_WINDOW_START 0x820c 189/* Secondary Stream 2 Window Size */ 190#define SEC_STREAM2_WINDOW_SZ 0x8210 191/* Secondary Stream 2 Opaque Overlay Control */ 192#define SEC_STREAM2_OPAQUE_OVERLAY 0x8180 193 194/* savage 2000 */ 195#define SEC_STREAM_COLOR_CONVERT0_2000 0x8198 196#define SEC_STREAM_COLOR_CONVERT1_2000 0x819c 197#define SEC_STREAM_COLOR_CONVERT2_2000 0x81e0 198#define SEC_STREAM_COLOR_CONVERT3_2000 0x81e4 199#define SEC_STREAM_SRC_START_2000 0x818c 200#define SEC_STREAM_SRC_SIZE_2000 0x81a8 201#define SEC_STREAM_BUFFERSIZE_2000 0x81a4 202#define S_SRC_H_Mask 0x00000fff 203#define S_SRC_W_Shift 16 204#define S_SRC_W_Mask 0x0fff0000 205#define SRCSIZE(w,h) (((w <<S_SRC_W_Shift) & S_SRC_W_Mask) | (h & S_SRC_H_Mask)) 206#define SRCSTART(x,y) (((x <<S_SRC_W_Shift) & 0x7ff0000) | (y & 0x000007ff)) 207#define VSCALING_2000(h0,h1) ((unsigned int) (((float)h0/(float)h1) * (float)(65536.0) )) 208#define HSCALING_NORMALIZE(h0,h1) ((unsigned int) ((float)2048.0 * ((float)h0/ (float)h1))) << 16 209#define HSCALING_2000(w0,w1) ((unsigned int) (((float)w0/ (float)w1) * (float)(65536.0))) 210#define XY_2000(x,y) ((((x)<<X_Shift)&X_Mask) | (((y)<<Y_Shift)&Y_Mask)) 211#define WH_2000(w,h) ((((w)<<W_Shift)&W_Mask) | (((h)<<H_Shift)&H_Mask)) 212 213#define BASE_PAD 0xf 214 215#define STREAMS_MODE32 0x7 216#define STREAMS_MODE24 0x6 217#define STREAMS_MODE16 0x5 /* @@@ */ 218 219#define SSTREAMS_MODE(bpp) (bpp > 16 ? (bpp > 24 ? STREAMS_MODE32 :\ 220 STREAMS_MODE24) : STREAMS_MODE16) 221 222#endif /* SAVAGE_STREAMS_H */ 223