annotate vidix/drivers/savage_vid.c @ 15255:e9b4eeb31768

synced with 1.73
author gabrov
date Sun, 24 Apr 2005 22:16:09 +0000
parents 54b6720658f8
children 934380353fd6
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
14203
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
1 /*
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
2 Driver for S3 Savage Series
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
3
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
4 Copyright (C) 2004 by Reza Jelveh
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
5
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
6 Based on the X11 driver and nvidia vid
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
7
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
8 Thanks to Alex Deucher for Support
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
9
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
10 This program is free software; you can redistribute it and/or modify
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
11 it under the terms of the GNU General Public License as published by
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
12 the Free Software Foundation; either version 2 of the License, or
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
13 (at your option) any later version.
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
14
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
15 This program is distributed in the hope that it will be useful,
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
16 but WITHOUT ANY WARRANTY; without even the implied warranty of
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
17 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
18 GNU General Public License for more details.
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
19
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
20 You should have received a copy of the GNU General Public License
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
21 along with this program; if not, write to the Free Software
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
22 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
23
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
24 Changes:
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
25 2004-11-09
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
26 Initial version
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
27
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
28 To Do:
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
29
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
30 */
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
31
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
32
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
33 #include <errno.h>
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
34 #include <stdio.h>
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
35 #include <stdlib.h>
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
36 #include <string.h>
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
37 #include <inttypes.h>
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
38 #include <unistd.h>
14885
54b6720658f8 missing #include
rathann
parents: 14215
diff changeset
39 #include <math.h>
14203
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
40
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
41 #include "../vidix.h"
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
42 #include "../fourcc.h"
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
43 #include "../../libdha/libdha.h"
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
44 #include "../../libdha/pci_ids.h"
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
45 #include "../../libdha/pci_names.h"
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
46 #include "../../config.h"
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
47
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
48 #include "savage_regs.h"
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
49
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
50
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
51 #define VF_STREAMS_ON 0x0001
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
52 #define BASE_PAD 0xf
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
53 #define FRAMEBUFFER_SIZE 1024*2000*4
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
54 /**************************************
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
55 S3 streams processor
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
56 **************************************/
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
57
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
58 #define EXT_MISC_CTRL2 0x67
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
59
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
60 /* New streams */
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
61
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
62 /* CR67[2] = 1 : enable stream 1 */
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
63 #define ENABLE_STREAM1 0x04
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
64 /* CR67[1] = 1 : enable stream 2 */
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
65 #define ENABLE_STREAM2 0x02
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
66 /* mask to clear CR67[2,1] */
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
67 #define NO_STREAMS 0xF9
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
68 /* CR67[3] = 1 : Mem-mapped regs */
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
69 #define USE_MM_FOR_PRI_STREAM 0x08
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
70
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
71 #define HDM_SHIFT 16
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
72 #define HDSCALE_4 (2 << HDM_SHIFT)
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
73 #define HDSCALE_8 (3 << HDM_SHIFT)
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
74 #define HDSCALE_16 (4 << HDM_SHIFT)
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
75 #define HDSCALE_32 (5 << HDM_SHIFT)
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
76 #define HDSCALE_64 (6 << HDM_SHIFT)
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
77
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
78 /* Old Streams */
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
79
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
80 #define ENABLE_STREAMS_OLD 0x0c
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
81 #define NO_STREAMS_OLD 0xf3
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
82 /* CR69[0] = 1 : Mem-mapped regs */
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
83 #define USE_MM_FOR_PRI_STREAM_OLD 0x01
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
84
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
85 void SavageStreamsOn();
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
86
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
87 /*
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
88 * There are two different streams engines used in the Savage line.
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
89 * The old engine is in the 3D, 4, Pro, and Twister.
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
90 * The new engine is in the 2000, MX, IX, and Super.
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
91 */
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
92
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
93
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
94 /* streams registers for old engine */
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
95 #define PSTREAM_CONTROL_REG 0x8180
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
96 #define COL_CHROMA_KEY_CONTROL_REG 0x8184
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
97 #define SSTREAM_CONTROL_REG 0x8190
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
98 #define CHROMA_KEY_UPPER_BOUND_REG 0x8194
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
99 #define SSTREAM_STRETCH_REG 0x8198
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
100 #define COLOR_ADJUSTMENT_REG 0x819C
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
101 #define BLEND_CONTROL_REG 0x81A0
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
102 #define PSTREAM_FBADDR0_REG 0x81C0
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
103 #define PSTREAM_FBADDR1_REG 0x81C4
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
104 #define PSTREAM_STRIDE_REG 0x81C8
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
105 #define DOUBLE_BUFFER_REG 0x81CC
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
106 #define SSTREAM_FBADDR0_REG 0x81D0
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
107 #define SSTREAM_FBADDR1_REG 0x81D4
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
108 #define SSTREAM_STRIDE_REG 0x81D8
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
109 #define SSTREAM_VSCALE_REG 0x81E0
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
110 #define SSTREAM_VINITIAL_REG 0x81E4
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
111 #define SSTREAM_LINES_REG 0x81E8
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
112 #define STREAMS_FIFO_REG 0x81EC
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
113 #define PSTREAM_WINDOW_START_REG 0x81F0
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
114 #define PSTREAM_WINDOW_SIZE_REG 0x81F4
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
115 #define SSTREAM_WINDOW_START_REG 0x81F8
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
116 #define SSTREAM_WINDOW_SIZE_REG 0x81FC
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
117 #define FIFO_CONTROL 0x8200
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
118 #define PSTREAM_FBSIZE_REG 0x8300
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
119 #define SSTREAM_FBSIZE_REG 0x8304
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
120 #define SSTREAM_FBADDR2_REG 0x8308
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
121
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
122 #define OS_XY(x,y) (((x+1)<<16)|(y+1))
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
123 #define OS_WH(x,y) (((x-1)<<16)|(y))
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
124
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
125 #define PCI_COMMAND_MEM 0x2
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
126 #define MAX_FRAMES 3
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
127 /**
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
128 * @brief Information on PCI device.
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
129 */
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
130 pciinfo_t pci_info;
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
131
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
132 /**
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
133 * @brief Unichrome driver colorkey settings.
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
134 */
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
135 static vidix_grkey_t savage_grkey;
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
136
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
137 static int frames[VID_PLAY_MAXFRAMES];
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
138 uint8_t *vio;
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
139 uint8_t mclk_save[3];
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
140
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
141 #define outb(reg,val) OUTPORT8(reg,val)
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
142 #define inb(reg) INPORT8(reg)
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
143 #define outw(reg,val) OUTPORT16(reg,val)
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
144 #define inw(reg) INPORT16(reg)
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
145 #define outl(reg,val) OUTPORT32(reg,val)
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
146 #define inl(reg) INPORT32(reg)
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
147
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
148
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
149 /*
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
150 * PCI-Memory IO access macros.
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
151 */
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
152 #define VID_WR08(p,i,val) (((uint8_t *)(p))[(i)]=(val))
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
153 #define VID_RD08(p,i) (((uint8_t *)(p))[(i)])
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
154
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
155 #define VID_WR32(p,i,val) (((uint32_t *)(p))[(i)/4]=(val))
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
156 #define VID_RD32(p,i) (((uint32_t *)(p))[(i)/4])
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
157
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
158 #ifndef USE_RMW_CYCLES
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
159 /*
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
160 * Can be used to inhibit READ-MODIFY-WRITE cycles. On by default.
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
161 */
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
162
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
163 #define MEM_BARRIER() __asm__ __volatile__ ("" : : : "memory")
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
164
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
165 #undef VID_WR08
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
166 #define VID_WR08(p,i,val) ({ MEM_BARRIER(); ((uint8_t *)(p))[(i)]=(val); })
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
167 #undef VID_RD08
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
168 #define VID_RD08(p,i) ({ MEM_BARRIER(); ((uint8_t *)(p))[(i)]; })
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
169
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
170 #undef VID_WR16
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
171 #define VID_WR16(p,i,val) ({ MEM_BARRIER(); ((uint16_t *)(p))[(i)/2]=(val); })
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
172 #undef VID_RD16
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
173 #define VID_RD16(p,i) ({ MEM_BARRIER(); ((uint16_t *)(p))[(i)/2]; })
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
174
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
175 #undef VID_WR32
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
176 #define VID_WR32(p,i,val) ({ MEM_BARRIER(); ((uint32_t *)(p))[(i)/4]=(val); })
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
177 #undef VID_RD32
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
178 #define VID_RD32(p,i) ({ MEM_BARRIER(); ((uint32_t *)(p))[(i)/4]; })
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
179 #endif /* USE_RMW_CYCLES */
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
180
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
181 #define VID_AND32(p,i,val) VID_WR32(p,i,VID_RD32(p,i)&(val))
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
182 #define VID_OR32(p,i,val) VID_WR32(p,i,VID_RD32(p,i)|(val))
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
183 #define VID_XOR32(p,i,val) VID_WR32(p,i,VID_RD32(p,i)^(val))
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
184
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
185
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
186 /* from x driver */
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
187
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
188 #define VGAIN8(addr) VID_RD08(info->control_base+0x8000, addr)
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
189 #define VGAIN16(addr) VID_RD16(info->control_base+0x8000, addr)
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
190 #define VGAIN(addr) VID_RD32(info->control_base+0x8000, addr)
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
191
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
192 #define VGAOUT8(addr,val) VID_WR08(info->control_base+0x8000, addr, val)
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
193 #define VGAOUT16(addr,val) VID_WR16(info->control_base+0x8000, addr, val)
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
194 #define VGAOUT(addr,val) VID_WR32(info->control_base+0x8000, addr, val)
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
195
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
196 #define INREG(addr) VID_RD32(info->control_base, addr)
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
197 #define OUTREG(addr,val) VID_WR32(info->control_base, addr, val)
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
198 #define INREG8(addr) VID_RD08(info->control_base, addr)
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
199 #define OUTREG8(addr,val) VID_WR08(info->control_base, addr, val)
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
200 #define INREG16(addr) VID_RD16(info->control_base, addr)
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
201 #define OUTREG16(addr,val) VID_WR16(info->control_base, addr, val)
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
202
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
203 #define ALIGN_TO(v, n) (((v) + (n-1)) & ~(n-1))
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
204
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
205
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
206 void debugout(unsigned int addr, unsigned int val);
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
207
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
208
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
209 struct savage_chip {
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
210 volatile uint32_t *PMC; /* general control */
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
211 volatile uint32_t *PME; /* multimedia port */
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
212 volatile uint32_t *PFB; /* framebuffer control */
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
213 volatile uint32_t *PVIDEO; /* overlay control */
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
214 volatile uint8_t *PCIO; /* SVGA (CRTC, ATTR) registers */
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
215 volatile uint8_t *PVIO; /* SVGA (MISC, GRAPH, SEQ) registers */
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
216 volatile uint32_t *PRAMIN; /* instance memory */
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
217 volatile uint32_t *PRAMHT; /* hash table */
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
218 volatile uint32_t *PRAMFC; /* fifo context table */
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
219 volatile uint32_t *PRAMRO; /* fifo runout table */
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
220 volatile uint32_t *PFIFO; /* fifo control region */
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
221 volatile uint32_t *FIFO; /* fifo channels (USER) */
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
222 volatile uint32_t *PGRAPH; /* graphics engine */
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
223
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
224 int arch; /* compatible NV_ARCH_XX define */
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
225 unsigned long fbsize; /* framebuffer size */
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
226 void (* lock) (struct savage_chip *, int);
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
227 };
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
228 typedef struct savage_chip savage_chip;
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
229
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
230
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
231 struct savage_info {
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
232 unsigned int use_colorkey;
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
233 unsigned int colorkey; /* saved xv colorkey*/
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
234 unsigned int vidixcolorkey; /*currently used colorkey*/
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
235 unsigned int depth;
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
236 unsigned int bpp;
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
237 unsigned int videoFlags;
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
238 unsigned int format;
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
239 unsigned int pitch;
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
240 unsigned int blendBase;
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
241 unsigned int lastKnownPitch;
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
242 unsigned int displayWidth, displayHeight;
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
243 unsigned int brightness,hue,saturation,contrast;
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
244 unsigned int src_w,src_h;
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
245 unsigned int drw_w,drw_h; /*scaled width && height*/
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
246 unsigned int wx,wy; /*window x && y*/
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
247 unsigned int screen_x; /*screen width*/
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
248 unsigned int screen_y; /*screen height*/
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
249 unsigned long buffer_size; /* size of the image buffer */
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
250 struct savage_chip chip; /* NV architecture structure */
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
251 void* video_base; /* virtual address of control region */
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
252 void* control_base; /* virtual address of fb region */
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
253 unsigned long picture_base; /* direct pointer to video picture */
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
254 unsigned long picture_offset; /* offset of video picture in frame buffer */
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
255 // struct savage_dma dma; /* DMA structure */
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
256 unsigned int cur_frame;
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
257 unsigned int num_frames; /* number of buffers */
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
258 int bps; /* bytes per line */
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
259 void (*SavageWaitIdle) ();
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
260 void (*SavageWaitFifo) (int space);
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
261 };
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
262 typedef struct savage_info savage_info;
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
263
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
264
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
265 static savage_info* info;
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
266
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
267
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
268 /**
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
269 * @brief Unichrome driver vidix capabilities.
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
270 */
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
271 static vidix_capability_t savage_cap = {
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
272 "Savage/ProSavage/Twister vidix",
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
273 "Reza Jelveh <reza.jelveh@tuhh.de>",
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
274 TYPE_OUTPUT,
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
275 {0, 0, 0, 0},
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
276 4096,
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
277 4096,
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
278 4,
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
279 4,
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
280 -1,
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
281 FLAG_UPSCALER | FLAG_DOWNSCALER,
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
282 VENDOR_S3_INC,
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
283 -1,
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
284 {0, 0, 0, 0}
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
285 };
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
286
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
287 struct savage_cards {
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
288 unsigned short chip_id;
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
289 unsigned short arch;
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
290 };
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
291
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
292
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
293 static
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
294 unsigned int GetBlendForFourCC( int id )
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
295 {
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
296 switch( id ) {
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
297 case IMGFMT_YUY2:
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
298 case IMGFMT_YV12:
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
299 case IMGFMT_I420:
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
300 return 1;
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
301 case IMGFMT_Y211:
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
302 return 4;
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
303 case IMGFMT_RGB15:
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
304 return 3;
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
305 case IMGFMT_RGB16:
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
306 return 5;
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
307 default:
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
308 return 0;
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
309 }
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
310 }
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
311
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
312 /**
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
313 * @brief list of card IDs compliant with the Unichrome driver .
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
314 */
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
315 static struct savage_cards savage_card_ids[] = {
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
316 /*[ProSavage PN133] AGP4X VGA Controller (Twister)*/
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
317 { PCI_CHIP_S3TWISTER_P, S3_PROSAVAGE },
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
318 /*[ProSavage KN133] AGP4X VGA Controller (TwisterK)*/
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
319 { PCI_CHIP_S3TWISTER_K, S3_PROSAVAGE },
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
320 /*ProSavage DDR*/
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
321 { PCI_CHIP_PROSAVAGE_DDR , S3_PROSAVAGE },
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
322 /*[ProSavageDDR P4M266 K] */
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
323 { PCI_CHIP_PROSAVAGE_DDRK , S3_PROSAVAGE },
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
324 };
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
325
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
326 void SavageSetColorOld()
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
327 {
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
328
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
329
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
330 if(
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
331 (info->format == IMGFMT_RGB15) ||
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
332 (info->format == IMGFMT_RGB16)
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
333 )
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
334 {
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
335 OUTREG( COLOR_ADJUSTMENT_REG, 0 );
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
336 }
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
337 else
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
338 {
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
339 /* Change 0..255 into 0..15 */
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
340 long sat = info->saturation * 16 / 256;
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
341 double hue = info->hue * 0.017453292;
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
342 unsigned long hs1 = ((long)(sat * cos(hue))) & 0x1f;
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
343 unsigned long hs2 = ((long)(sat * sin(hue))) & 0x1f;
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
344
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
345 OUTREG( COLOR_ADJUSTMENT_REG,
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
346 0x80008000 |
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
347 (info->brightness + 128) |
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
348 ((info->contrast & 0xf8) << (12-7)) |
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
349 (hs1 << 16) |
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
350 (hs2 << 24)
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
351 );
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
352 debugout( COLOR_ADJUSTMENT_REG,
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
353 0x80008000 |
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
354 (info->brightness + 128) |
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
355 ((info->contrast & 0xf8) << (12-7)) |
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
356 (hs1 << 16) |
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
357 (hs2 << 24)
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
358 );
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
359
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
360 }
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
361 }
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
362
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
363 void SavageSetColorKeyOld()
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
364 {
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
365 int red, green, blue;
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
366
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
367 /* Here, we reset the colorkey and all the controls. */
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
368
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
369 red = (info->vidixcolorkey & 0x00FF0000) >> 16;
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
370 green = (info->vidixcolorkey & 0x0000FF00) >> 8;
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
371 blue = info->vidixcolorkey & 0x000000FF;
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
372
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
373 if( !info->vidixcolorkey ) {
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
374 printf("SavageSetColorKey disabling colorkey\n");
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
375 OUTREG( COL_CHROMA_KEY_CONTROL_REG, 0 );
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
376 OUTREG( CHROMA_KEY_UPPER_BOUND_REG, 0 );
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
377 OUTREG( BLEND_CONTROL_REG, 0 );
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
378 }
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
379 else {
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
380 switch (info->depth) {
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
381 // FIXME: isnt fixed yet
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
382 case 8:
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
383 OUTREG( COL_CHROMA_KEY_CONTROL_REG,
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
384 0x37000000 | (info->vidixcolorkey & 0xFF) );
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
385 OUTREG( CHROMA_KEY_UPPER_BOUND_REG,
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
386 0x00000000 | (info->vidixcolorkey & 0xFF) );
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
387 break;
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
388 case 15:
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
389 /* 15 bpp 555 */
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
390 red&=0x1f;
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
391 green&=0x1f;
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
392 blue&=0x1f;
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
393 OUTREG( COL_CHROMA_KEY_CONTROL_REG,
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
394 0x05000000 | (red<<19) | (green<<11) | (blue<<3) );
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
395 OUTREG( CHROMA_KEY_UPPER_BOUND_REG,
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
396 0x00000000 | (red<<19) | (green<<11) | (blue<<3) );
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
397 break;
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
398 case 16:
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
399 /* 16 bpp 565 */
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
400 red&=0x1f;
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
401 green&=0x3f;
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
402 blue&=0x1f;
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
403 OUTREG( COL_CHROMA_KEY_CONTROL_REG,
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
404 0x16000000 | (red<<19) | (green<<10) | (blue<<3) );
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
405 OUTREG( CHROMA_KEY_UPPER_BOUND_REG,
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
406 0x00020002 | (red<<19) | (green<<10) | (blue<<3) );
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
407 break;
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
408 case 24:
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
409 /* 24 bpp 888 */
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
410 OUTREG( COL_CHROMA_KEY_CONTROL_REG,
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
411 0x17000000 | (red<<16) | (green<<8) | (blue) );
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
412 OUTREG( CHROMA_KEY_UPPER_BOUND_REG,
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
413 0x00000000 | (red<<16) | (green<<8) | (blue) );
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
414 break;
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
415 }
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
416
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
417 /* We use destination colorkey */
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
418 OUTREG( BLEND_CONTROL_REG, 0x05000000 );
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
419 }
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
420 }
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
421
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
422
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
423 static void
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
424 SavageDisplayVideoOld(
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
425 ){
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
426 int vgaCRIndex, vgaCRReg, vgaIOBase;
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
427 unsigned int ssControl;
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
428 int cr92;
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
429
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
430
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
431 vgaIOBase = 0x3d0;
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
432 vgaCRIndex = vgaIOBase + 4;
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
433 vgaCRReg = vgaIOBase + 5;
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
434
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
435 // if( psav->videoFourCC != id )
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
436 // SavageStreamsOff(pScrn);
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
437
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
438 if( !info->videoFlags & VF_STREAMS_ON )
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
439 {
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
440 SavageStreamsOn();
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
441 // SavageResetVideo();
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
442 SavageSetColorOld();
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
443 SavageSetColorKeyOld();
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
444 }
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
445
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
446
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
447
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
448
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
449 /* Set surface format. */
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
450
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
451 OUTREG(SSTREAM_CONTROL_REG,GetBlendForFourCC(info->format) << 24 | info->src_w);
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
452
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
453 debugout(SSTREAM_CONTROL_REG,GetBlendForFourCC(info->format) << 24 | info->src_w);
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
454
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
455 /* Calculate horizontal scale factor. */
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
456
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
457 //FIXME: enable scaling
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
458 OUTREG(SSTREAM_STRETCH_REG, (info->src_w << 15) / info->drw_w );
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
459 // debugout(SSTREAM_STRETCH_REG, 1 << 15);
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
460
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
461 OUTREG(SSTREAM_LINES_REG, info->src_h );
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
462 debugout(SSTREAM_LINES_REG, info->src_h );
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
463
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
464
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
465 OUTREG(SSTREAM_VINITIAL_REG, 0 );
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
466 debugout(SSTREAM_VINITIAL_REG, 0 );
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
467 /* Calculate vertical scale factor. */
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
468
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
469 // OUTREG(SSTREAM_VSCALE_REG, 1 << 15);
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
470 OUTREG(SSTREAM_VSCALE_REG, VSCALING(info->src_h,info->drw_h) );
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
471 debugout(SSTREAM_VSCALE_REG, VSCALING(info->src_h,info->drw_h) );
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
472 // OUTREG(SSTREAM_VSCALE_REG, (info->src_h << 15) / info->drw_h );
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
473
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
474 /* Set surface location and stride. */
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
475
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
476 OUTREG(SSTREAM_FBADDR0_REG, info->picture_offset );
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
477 debugout(SSTREAM_FBADDR0_REG, info->picture_offset );
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
478
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
479 OUTREG(SSTREAM_FBADDR1_REG, 0 );
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
480 debugout(SSTREAM_FBADDR1_REG, 0 );
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
481
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
482 OUTREG(SSTREAM_STRIDE_REG, info->pitch );
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
483 debugout(SSTREAM_STRIDE_REG, info->pitch );
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
484
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
485 OUTREG(SSTREAM_WINDOW_START_REG, OS_XY(info->wx, info->wy) );
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
486 debugout(SSTREAM_WINDOW_START_REG, OS_XY(info->wx, info->wy) );
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
487 OUTREG(SSTREAM_WINDOW_SIZE_REG, OS_WH(info->drw_w, info->drw_h) );
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
488 debugout(SSTREAM_WINDOW_SIZE_REG, OS_WH(info->drw_w, info->drw_h) );
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
489
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
490
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
491
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
492 ssControl = 0;
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
493
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
494 if( info->src_w > (info->drw_w << 1) )
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
495 {
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
496 /* BUGBUG shouldn't this be >=? */
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
497 if( info->src_w <= (info->drw_w << 2) )
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
498 ssControl |= HDSCALE_4;
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
499 else if( info->src_w > (info->drw_w << 3) )
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
500 ssControl |= HDSCALE_8;
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
501 else if( info->src_w > (info->drw_w << 4) )
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
502 ssControl |= HDSCALE_16;
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
503 else if( info->src_w > (info->drw_w << 5) )
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
504 ssControl |= HDSCALE_32;
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
505 else if( info->src_w > (info->drw_w << 6) )
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
506 ssControl |= HDSCALE_64;
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
507 }
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
508
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
509 ssControl |= info->src_w;
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
510 ssControl |= (1 << 24);
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
511
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
512 //FIXME: enable scaling
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
513 OUTREG(SSTREAM_CONTROL_REG, ssControl);
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
514 debugout(SSTREAM_CONTROL_REG, ssControl);
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
515
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
516 // FIXME: this should actually be enabled
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
517
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
518 info->pitch = (info->pitch + 7) / 8;
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
519 VGAOUT8(vgaCRIndex, 0x92);
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
520 cr92 = VGAIN8(vgaCRReg);
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
521 VGAOUT8(vgaCRReg, (cr92 & 0x40) | (info->pitch >> 8) | 0x80);
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
522 VGAOUT8(vgaCRIndex, 0x93);
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
523 VGAOUT8(vgaCRReg, info->pitch);
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
524 OUTREG(STREAMS_FIFO_REG, 2 | 25 << 5 | 32 << 11);
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
525
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
526
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
527
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
528
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
529 }
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
530
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
531 void SavageInitStreamsOld()
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
532 {
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
533 /*unsigned long jDelta;*/
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
534 unsigned long format = 0;
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
535
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
536 /*
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
537 * For the OLD streams engine, several of these registers
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
538 * cannot be touched unless streams are on. Seems backwards to me;
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
539 * I'd want to set 'em up, then cut 'em loose.
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
540 */
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
541
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
542
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
543 /*jDelta = pScrn->displayWidth * (pScrn->bitsPerPixel + 7) / 8;*/
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
544 switch( info->depth ) {
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
545 case 8: format = 0 << 24; break;
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
546 case 15: format = 3 << 24; break;
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
547 case 16: format = 5 << 24; break;
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
548 case 24: format = 7 << 24; break;
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
549 }
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
550 #warning enable this again
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
551 OUTREG(PSTREAM_FBSIZE_REG,
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
552 info->screen_y * info->screen_x * (info->bpp >> 3));
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
553
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
554 OUTREG( PSTREAM_WINDOW_START_REG, OS_XY(0,0) );
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
555 OUTREG( PSTREAM_WINDOW_SIZE_REG, OS_WH(info->screen_x, info->screen_y) );
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
556 OUTREG( PSTREAM_FBADDR1_REG, 0 );
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
557 /*OUTREG( PSTREAM_STRIDE_REG, jDelta );*/
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
558 OUTREG( PSTREAM_CONTROL_REG, format );
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
559 OUTREG( PSTREAM_FBADDR0_REG, 0 );
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
560
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
561 /*OUTREG( PSTREAM_FBSIZE_REG, jDelta * pScrn->virtualY >> 3 );*/
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
562
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
563 OUTREG( COL_CHROMA_KEY_CONTROL_REG, 0 );
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
564 OUTREG( SSTREAM_CONTROL_REG, 0 );
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
565 OUTREG( CHROMA_KEY_UPPER_BOUND_REG, 0 );
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
566 OUTREG( SSTREAM_STRETCH_REG, 0 );
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
567 OUTREG( COLOR_ADJUSTMENT_REG, 0 );
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
568 OUTREG( BLEND_CONTROL_REG, 1 << 24 );
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
569 OUTREG( DOUBLE_BUFFER_REG, 0 );
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
570 OUTREG( SSTREAM_FBADDR0_REG, 0 );
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
571 OUTREG( SSTREAM_FBADDR1_REG, 0 );
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
572 OUTREG( SSTREAM_FBADDR2_REG, 0 );
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
573 OUTREG( SSTREAM_FBSIZE_REG, 0 );
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
574 OUTREG( SSTREAM_STRIDE_REG, 0 );
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
575 OUTREG( SSTREAM_VSCALE_REG, 0 );
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
576 OUTREG( SSTREAM_LINES_REG, 0 );
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
577 OUTREG( SSTREAM_VINITIAL_REG, 0 );
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
578 #warning is this needed?
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
579 OUTREG( SSTREAM_WINDOW_START_REG, OS_XY(0xfffe, 0xfffe) );
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
580 OUTREG( SSTREAM_WINDOW_SIZE_REG, OS_WH(10,2) );
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
581
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
582 }
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
583
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
584 void
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
585 SavageStreamsOn()
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
586 {
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
587 unsigned char jStreamsControl;
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
588 unsigned short vgaCRIndex = 0x3d0 + 4;
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
589 unsigned short vgaCRReg = 0x3d0 + 5;
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
590
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
591 // xf86ErrorFVerb(STREAMS_TRACE, "SavageStreamsOn\n" );
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
592
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
593 /* Sequence stolen from streams.c in M7 NT driver */
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
594
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
595
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
596 enable_app_io ();
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
597
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
598 /* Unlock extended registers. */
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
599
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
600 /* FIXME: it looks like mmaped io is broken with vgaout16 */
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
601 VGAOUT16(vgaCRIndex, 0x4838 );
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
602 VGAOUT16(vgaCRIndex, 0xa039);
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
603 VGAOUT16(0x3c4, 0x0608);
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
604
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
605
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
606
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
607 VGAOUT8( vgaCRIndex, EXT_MISC_CTRL2 );
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
608
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
609 if( S3_SAVAGE_MOBILE_SERIES(info->chip.arch) )
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
610 {
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
611 // SavageInitStreamsNew( pScrn );
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
612
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
613 jStreamsControl = VGAIN8( vgaCRReg ) | ENABLE_STREAM1;
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
614
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
615 /* Wait for VBLANK. */
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
616 VerticalRetraceWait();
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
617 /* Fire up streams! */
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
618 VGAOUT16( vgaCRIndex, (jStreamsControl << 8) | EXT_MISC_CTRL2 );
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
619 /* These values specify brightness, contrast, saturation and hue. */
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
620 OUTREG( SEC_STREAM_COLOR_CONVERT1, 0x0000C892 );
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
621 OUTREG( SEC_STREAM_COLOR_CONVERT2, 0x00039F9A );
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
622 OUTREG( SEC_STREAM_COLOR_CONVERT3, 0x01F1547E );
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
623 }
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
624 else if (info->chip.arch == S3_SAVAGE2000)
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
625 {
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
626 // SavageInitStreams2000( pScrn );
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
627
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
628 jStreamsControl = VGAIN8( vgaCRReg ) | ENABLE_STREAM1;
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
629
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
630 /* Wait for VBLANK. */
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
631 VerticalRetraceWait();
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
632 /* Fire up streams! */
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
633 VGAOUT16( vgaCRIndex, (jStreamsControl << 8) | EXT_MISC_CTRL2 );
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
634 /* These values specify brightness, contrast, saturation and hue. */
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
635 OUTREG( SEC_STREAM_COLOR_CONVERT0_2000, 0x0000C892 );
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
636 OUTREG( SEC_STREAM_COLOR_CONVERT1_2000, 0x00033400 );
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
637 OUTREG( SEC_STREAM_COLOR_CONVERT2_2000, 0x000001CF );
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
638 OUTREG( SEC_STREAM_COLOR_CONVERT3_2000, 0x01F1547E );
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
639 }
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
640 else
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
641 {
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
642 jStreamsControl = VGAIN8( vgaCRReg ) | ENABLE_STREAMS_OLD;
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
643
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
644 /* Wait for VBLANK. */
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
645
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
646 VerticalRetraceWait();
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
647
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
648 /* Fire up streams! */
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
649
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
650 VGAOUT16( vgaCRIndex, (jStreamsControl << 8) | EXT_MISC_CTRL2 );
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
651
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
652 SavageInitStreamsOld( );
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
653 }
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
654
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
655 /* Wait for VBLANK. */
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
656
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
657 VerticalRetraceWait();
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
658
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
659 /* Turn on secondary stream TV flicker filter, once we support TV. */
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
660
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
661 /* SR70 |= 0x10 */
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
662
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
663 info->videoFlags |= VF_STREAMS_ON;
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
664
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
665 }
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
666
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
667
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
668
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
669
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
670 static void savage_getscreenproperties(struct savage_info *info){
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
671 unsigned char bpp=0;
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
672 uint32_t width=0;
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
673
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
674 uint32_t vgaIOBase, vgaCRIndex, vgaCRReg;
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
675
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
676 vgaIOBase = 0x3d0;
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
677 vgaCRIndex = vgaIOBase + 4;
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
678 vgaCRReg = vgaIOBase + 5;
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
679
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
680
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
681 /* a little reversed from x driver source code */
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
682 VGAOUT8(vgaCRIndex, 0x67);
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
683 bpp = VGAIN8(vgaCRReg);
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
684
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
685
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
686 switch (bpp&0xf0) {
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
687 case 0x00:
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
688 case 0x10:
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
689 info->depth=8;
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
690 info->bpp=8;
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
691 break;
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
692 case 0x20:
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
693 case 0x30:
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
694 info->depth=15;
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
695 info->bpp=16;
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
696 break;
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
697 case 0x40:
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
698 case 0x50:
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
699 info->depth=16;
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
700 info->bpp=16;
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
701 break;
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
702 case 0x70:
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
703 case 0xd0:
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
704 info->depth=24;
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
705 info->bpp=32;
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
706 break;
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
707
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
708
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
709 }
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
710
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
711
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
712 VGAOUT8(vgaCRIndex, 0x1);
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
713 info->screen_x = (1 + VGAIN8(vgaCRReg)) <<3;
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
714 /*get screen height*/
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
715 /* get first 8 bits in VT_DISPLAY_END*/
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
716 VGAOUT8(0x03D4, 0x12);
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
717 info->screen_y = VGAIN8(0x03D5);
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
718 VGAOUT8(0x03D4,0x07);
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
719 /* get 9th bit in CRTC_OVERFLOW*/
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
720 info->screen_y |= (VGAIN8(0x03D5) &0x02)<<7;
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
721 /* and the 10th in CRTC_OVERFLOW*/
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
722 info->screen_y |=(VGAIN8(0x03D5) &0x40)<<3;
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
723 ++info->screen_y;
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
724
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
725 printf("screen_x = %d, screen_y = %d, bpp = %d\n",info->screen_x,info->screen_y,info->bpp);
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
726 }
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
727
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
728
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
729 void SavageStreamsOff()
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
730 {
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
731 unsigned char jStreamsControl;
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
732 unsigned short vgaCRIndex = 0x3d0 + 4;
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
733 unsigned short vgaCRReg = 0x3d0 + 5;
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
734
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
735
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
736 /* Unlock extended registers. */
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
737
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
738 VGAOUT16(vgaCRIndex, 0x4838);
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
739 VGAOUT16(vgaCRIndex, 0xa039);
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
740 VGAOUT16(0x3c4, 0x0608);
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
741
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
742 VGAOUT8( vgaCRIndex, EXT_MISC_CTRL2 );
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
743 if( S3_SAVAGE_MOBILE_SERIES(info->chip.arch) ||
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
744 (info->chip.arch == S3_SUPERSAVAGE) ||
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
745 (info->chip.arch == S3_SAVAGE2000) )
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
746 jStreamsControl = VGAIN8( vgaCRReg ) & NO_STREAMS;
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
747 else
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
748 jStreamsControl = VGAIN8( vgaCRReg ) & NO_STREAMS_OLD;
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
749
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
750 /* Wait for VBLANK. */
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
751
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
752 VerticalRetraceWait();
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
753
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
754 /* Kill streams. */
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
755
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
756 VGAOUT16(vgaCRIndex, (jStreamsControl << 8) | EXT_MISC_CTRL2 );
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
757
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
758 VGAOUT16(vgaCRIndex, 0x0093 );
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
759 VGAOUT8( vgaCRIndex, 0x92 );
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
760 VGAOUT8( vgaCRReg, VGAIN8(vgaCRReg) & 0x40 );
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
761
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
762 info->videoFlags &= ~VF_STREAMS_ON;
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
763 }
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
764
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
765
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
766 /**
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
767 * @brief Check age of driver.
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
768 *
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
769 * @return vidix version number.
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
770 */
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
771 unsigned int
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
772 vixGetVersion (void)
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
773 {
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
774 return (VIDIX_VERSION);
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
775 }
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
776
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
777 /**
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
778 * @brief Find chip index in Unichrome compliant devices list.
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
779 *
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
780 * @param chip_id PCI device ID.
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
781 *
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
782 * @returns index position in savage_card_ids if successful.
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
783 * -1 if chip_id is not a compliant chipset ID.
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
784 */
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
785
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
786 static int find_chip(unsigned chip_id){
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
787 unsigned i;
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
788 for(i = 0;i < sizeof(savage_card_ids)/sizeof(struct savage_cards);i++)
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
789 {
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
790 if(chip_id == savage_card_ids[i].chip_id)return i;
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
791 }
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
792 return -1;
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
793 }
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
794
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
795 /**
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
796 * @brief Probe hardware to find some useable chipset.
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
797 *
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
798 * @param verbose specifies verbose level.
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
799 * @param force specifies force mode : driver should ignore
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
800 * device_id (danger but useful for new devices)
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
801 *
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
802 * @returns 0 if it can handle something in PC.
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
803 * a negative error code otherwise.
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
804 */
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
805
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
806 int vixProbe(int verbose, int force){
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
807 pciinfo_t lst[MAX_PCI_DEVICES];
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
808 unsigned i,num_pci;
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
809 int err;
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
810
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
811 if (force)
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
812 printf("[savage_vid]: warning: forcing not supported yet!\n");
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
813 err = pci_scan(lst,&num_pci);
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
814 if(err){
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
815 printf("[savage_vid] Error occurred during pci scan: %s\n",strerror(err));
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
816 return err;
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
817 }
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
818 else {
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
819 err = ENXIO;
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
820 for(i=0; i < num_pci; i++){
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
821 if(lst[i].vendor == VENDOR_S3_INC) {
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
822 int idx;
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
823 const char *dname;
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
824 idx = find_chip(lst[i].device);
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
825 if(idx == -1)
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
826 continue;
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
827 dname = pci_device_name(lst[i].vendor, lst[i].device);
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
828 dname = dname ? dname : "Unknown chip";
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
829 printf("[savage_vid] Found chip: %s\n", dname);
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
830 // FIXME: whats wrong here?
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
831 if ((lst[i].command & PCI_COMMAND_IO ) == 0){
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
832 printf("[savage_vid] Device is disabled, ignoring\n");
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
833 continue;
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
834 }
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
835 savage_cap.device_id = lst[i].device;
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
836 err = 0;
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
837 memcpy(&pci_info, &lst[i], sizeof(pciinfo_t));
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
838 break;
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
839 }
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
840 }
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
841 }
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
842 if(err && verbose) printf("[savage_vid] Can't find chip\n");
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
843 return err;
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
844 }
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
845
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
846 /**
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
847 * @brief Initializes driver.
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
848 *
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
849 * @returns 0 if ok.
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
850 * a negative error code otherwise.
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
851 */
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
852 int
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
853 vixInit (void)
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
854 {
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
855 int mtrr;
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
856 unsigned char config1, m, n, n1, n2, sr8, cr3f, cr66 = 0, tmp;
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
857
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
858 static unsigned char RamSavage3D[] = { 8, 4, 4, 2 };
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
859 static unsigned char RamSavage4[] = { 2, 4, 8, 12, 16, 32, 64, 32 };
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
860 static unsigned char RamSavageMX[] = { 2, 8, 4, 16, 8, 16, 4, 16 };
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
861 static unsigned char RamSavageNB[] = { 0, 2, 4, 8, 16, 32, 16, 2 };
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
862
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
863 int videoRam, videoRambytes;
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
864
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
865 uint32_t vgaIOBase, vgaCRIndex, vgaCRReg ;
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
866
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
867 unsigned char val;
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
868
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
869 vgaIOBase = 0x3d0;
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
870 vgaCRIndex = vgaIOBase + 4;
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
871 vgaCRReg = vgaIOBase + 5;
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
872
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
873 fprintf(stderr, "vixInit enter \n");
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
874 // //getc(stdin);
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
875
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
876 info = (savage_info*)calloc(1,sizeof(savage_info));
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
877
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
878
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
879 /* need this if we want direct outb and inb access? */
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
880 enable_app_io ();
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
881
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
882 /* 12mb + 32kb ? */
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
883 /* allocate some space for control registers */
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
884 info->chip.arch = savage_card_ids[find_chip(pci_info.device)].arch;
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
885
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
886 if (info->chip.arch == S3_SAVAGE3D) {
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
887 info->control_base = map_phys_mem(pci_info.base0+SAVAGE_NEWMMIO_REGBASE_S3, SAVAGE_NEWMMIO_REGSIZE);
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
888 }
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
889 else {
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
890 info->control_base = map_phys_mem(pci_info.base0+SAVAGE_NEWMMIO_REGBASE_S4, SAVAGE_NEWMMIO_REGSIZE);
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
891 }
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
892
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
893 // info->chip.PCIO = (uint8_t *) (info->control_base + SAVAGE_NEWMMIO_VGABASE);
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
894
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
895 // FIXME: enable mmio?
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
896 val = VGAIN8 (0x3c3);
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
897 VGAOUT8 (0x3c3, val | 0x01);
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
898 val = VGAIN8 (0x3cc);
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
899 VGAOUT8 (0x3c2, val | 0x01);
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
900
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
901 if (info->chip.arch >= S3_SAVAGE4)
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
902 {
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
903 VGAOUT8 (0x3d4, 0x40);
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
904 val = VGAIN8 (0x3d5);
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
905 VGAOUT8 (0x3d5, val | 1);
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
906 }
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
907
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
908
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
909
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
910 /* unprotect CRTC[0-7] */
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
911 VGAOUT8(vgaCRIndex, 0x11);
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
912 tmp = VGAIN8(vgaCRReg);
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
913 // printf("$########## tmp = %d\n",tmp);
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
914 VGAOUT8(vgaCRReg, tmp & 0x7f);
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
915
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
916
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
917 /* unlock extended regs */
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
918 VGAOUT16(vgaCRIndex, 0x4838);
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
919 VGAOUT16(vgaCRIndex, 0xa039);
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
920 VGAOUT16(0x3c4, 0x0608);
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
921
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
922 VGAOUT8(vgaCRIndex, 0x40);
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
923 tmp = VGAIN8(vgaCRReg);
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
924 VGAOUT8(vgaCRReg, tmp & ~0x01);
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
925
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
926 /* unlock sys regs */
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
927 VGAOUT8(vgaCRIndex, 0x38);
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
928 VGAOUT8(vgaCRReg, 0x48);
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
929
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
930 /* Unlock system registers. */
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
931 VGAOUT16(vgaCRIndex, 0x4838);
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
932
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
933 /* Next go on to detect amount of installed ram */
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
934
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
935 VGAOUT8(vgaCRIndex, 0x36); /* for register CR36 (CONFG_REG1), */
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
936 config1 = VGAIN8(vgaCRReg); /* get amount of vram installed */
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
937
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
938
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
939 switch( info->chip.arch ) {
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
940 case S3_SAVAGE3D:
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
941 videoRam = RamSavage3D[ (config1 & 0xC0) >> 6 ] * 1024;
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
942 break;
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
943
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
944 case S3_SAVAGE4:
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
945 /*
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
946 * The Savage4 has one ugly special case to consider. On
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
947 * systems with 4 banks of 2Mx32 SDRAM, the BIOS says 4MB
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
948 * when it really means 8MB. Why do it the same when you
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
949 * can do it different...
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
950 */
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
951 VGAOUT8(0x3d4, 0x68); /* memory control 1 */
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
952 if( (VGAIN8(0x3d5) & 0xC0) == (0x01 << 6) )
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
953 RamSavage4[1] = 8;
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
954
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
955 /*FALLTHROUGH*/
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
956
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
957 case S3_SAVAGE2000:
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
958 videoRam = RamSavage4[ (config1 & 0xE0) >> 5 ] * 1024;
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
959 break;
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
960
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
961 case S3_SAVAGE_MX:
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
962 videoRam = RamSavageMX[ (config1 & 0x0E) >> 1 ] * 1024;
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
963 break;
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
964
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
965 case S3_PROSAVAGE:
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
966 videoRam = RamSavageNB[ (config1 & 0xE0) >> 5 ] * 1024;
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
967 break;
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
968
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
969 default:
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
970 /* How did we get here? */
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
971 videoRam = 0;
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
972 break;
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
973 }
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
974
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
975
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
976 printf("###### videoRam = %d\n",videoRam);
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
977 info->chip.fbsize = videoRam * 1024;
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
978
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
979
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
980 /* reset graphics engine to avoid memory corruption */
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
981 /* VGAOUT8 (0x3d4, 0x66);
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
982 cr66 = VGAIN8 (0x3d5);
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
983 VGAOUT8 (0x3d5, cr66 | 0x02);
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
984 udelay (10000);
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
985
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
986 VGAOUT8 (0x3d4, 0x66);
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
987 VGAOUT8 (0x3d5, cr66 & ~0x02); /* clear reset flag */
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
988 /* udelay (10000); */
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
989
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
990 /* This maps framebuffer @6MB, thus 2MB are left for video. */
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
991 if (info->chip.arch == S3_SAVAGE3D) {
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
992 info->video_base = map_phys_mem(pci_info.base0, info->chip.fbsize);
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
993 info->picture_offset = 1024*768* 4 * ((info->chip.fbsize > 4194304)?2:1);
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
994 }
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
995 else {
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
996 info->video_base = map_phys_mem(pci_info.base1, info->chip.fbsize);
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
997 info->picture_offset = info->chip.fbsize - FRAMEBUFFER_SIZE;
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
998 // info->picture_offset = 1024*1024* 4 * 2;
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
999 }
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
1000 if ( info->video_base < 0 ){
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
1001 printf("errno = %s\n", strerror(errno));
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
1002 return -1;
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
1003 }
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
1004
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
1005
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
1006 info->picture_base = (uint32_t) info->video_base + info->picture_offset;
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
1007
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
1008 if ( info->chip.arch == S3_SAVAGE3D ){
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
1009 mtrr = mtrr_set_type(pci_info.base0, info->chip.fbsize, MTRR_TYPE_WRCOMB);
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
1010 }
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
1011 else{
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
1012 mtrr = mtrr_set_type(pci_info.base1, info->chip.fbsize, MTRR_TYPE_WRCOMB);
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
1013 }
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
1014
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
1015 if (mtrr!= 0)
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
1016 printf("[savage_vid] unable to setup MTRR: %s\n", strerror(mtrr));
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
1017 else
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
1018 printf("[savage_vid] MTRR set up\n");
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
1019
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
1020 /* This may trash your screen for resolutions greater than 1024x768, sorry. */
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
1021
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
1022
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
1023 savage_getscreenproperties(info);
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
1024 // return -1;
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
1025 info->videoFlags = 0;
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
1026
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
1027 SavageStreamsOn();
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
1028 //getc(stdin);
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
1029 //FIXME ADD
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
1030 return 0;
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
1031 }
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
1032
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
1033 /**
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
1034 * @brief Destroys driver.
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
1035 */
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
1036 void
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
1037 vixDestroy (void)
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
1038 {
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
1039 unmap_phys_mem(info->video_base, info->chip.fbsize);
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
1040 unmap_phys_mem(info->control_base, SAVAGE_NEWMMIO_REGSIZE);
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
1041 //FIXME ADD
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
1042 }
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
1043
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
1044 /**
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
1045 * @brief Get chipset's hardware capabilities.
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
1046 *
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
1047 * @param to Pointer to the vidix_capability_t structure to be filled.
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
1048 *
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
1049 * @returns 0.
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
1050 */
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
1051 int
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
1052 vixGetCapability (vidix_capability_t * to)
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
1053 {
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
1054 memcpy (to, &savage_cap, sizeof (vidix_capability_t));
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
1055 return 0;
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
1056 }
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
1057
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
1058 /**
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
1059 * @brief Report if the video FourCC is supported by hardware.
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
1060 *
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
1061 * @param fourcc input image format.
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
1062 *
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
1063 * @returns 1 if the fourcc is supported.
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
1064 * 0 otherwise.
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
1065 */
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
1066 static int
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
1067 is_supported_fourcc (uint32_t fourcc)
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
1068 {
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
1069 switch (fourcc)
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
1070 {
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
1071 //FIXME: YV12 isnt working properly yet
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
1072 // case IMGFMT_YV12:
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
1073 // case IMGFMT_I420:
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
1074 case IMGFMT_UYVY:
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
1075 case IMGFMT_YVYU:
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
1076 case IMGFMT_YUY2:
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
1077 case IMGFMT_RGB15:
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
1078 case IMGFMT_RGB16:
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
1079 // case IMGFMT_BGR32:
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
1080 return 1;
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
1081 default:
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
1082 return 0;
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
1083 }
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
1084 }
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
1085
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
1086 /**
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
1087 * @brief Try to configure video memory for given fourcc.
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
1088 *
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
1089 * @param to Pointer to the vidix_fourcc_t structure to be filled.
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
1090 *
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
1091 * @returns 0 if ok.
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
1092 * errno otherwise.
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
1093 */
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
1094 int
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
1095 vixQueryFourcc (vidix_fourcc_t * to)
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
1096 {
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
1097 if (is_supported_fourcc (to->fourcc))
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
1098 {
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
1099 to->depth = VID_DEPTH_1BPP | VID_DEPTH_2BPP |
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
1100 VID_DEPTH_4BPP | VID_DEPTH_8BPP |
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
1101 VID_DEPTH_12BPP | VID_DEPTH_15BPP |
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
1102 VID_DEPTH_16BPP | VID_DEPTH_24BPP | VID_DEPTH_32BPP;
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
1103 to->flags = VID_CAP_EXPAND | VID_CAP_SHRINK | VID_CAP_COLORKEY;
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
1104 return 0;
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
1105 }
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
1106 else
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
1107 to->depth = to->flags = 0;
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
1108
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
1109 return ENOSYS;
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
1110 }
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
1111
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
1112 /**
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
1113 * @brief Get the GrKeys
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
1114 *
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
1115 * @param grkey Pointer to the vidix_grkey_t structure to be filled by driver.
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
1116 *
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
1117 * @return 0.
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
1118 */
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
1119 /*int
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
1120 vixGetGrKeys (vidix_grkey_t * grkey)
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
1121 {
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
1122
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
1123 // if(info->d_width && info->d_height)savage_overlay_start(info,0);
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
1124
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
1125 return (0);
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
1126 }
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
1127 * */
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
1128
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
1129 /**
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
1130 * @brief Set the GrKeys
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
1131 *
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
1132 * @param grkey Colorkey to be set.
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
1133 *
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
1134 * @return 0.
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
1135 */
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
1136 int
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
1137 vixSetGrKeys (const vidix_grkey_t * grkey)
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
1138 {
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
1139 if (grkey->ckey.op == CKEY_FALSE)
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
1140 {
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
1141 info->use_colorkey = 0;
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
1142 info->vidixcolorkey=0;
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
1143 printf("[savage_vid] colorkeying disabled\n");
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
1144 }
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
1145 else {
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
1146 info->use_colorkey = 1;
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
1147 info->vidixcolorkey = ((grkey->ckey.red<<16)|(grkey->ckey.green<<8)|grkey->ckey.blue);
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
1148
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
1149 printf("[savage_vid] set colorkey 0x%x\n",info->vidixcolorkey);
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
1150 }
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
1151 //FIXME: freezes if streams arent enabled
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
1152 SavageSetColorKeyOld();
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
1153 return (0);
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
1154 }
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
1155
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
1156 /**
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
1157 * @brief Unichrome driver equalizer capabilities.
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
1158 */
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
1159 vidix_video_eq_t equal = {
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
1160 VEQ_CAP_BRIGHTNESS | VEQ_CAP_SATURATION | VEQ_CAP_HUE,
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
1161 300, 100, 0, 0, 0, 0, 0, 0
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
1162 };
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
1163
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
1164
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
1165 /**
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
1166 * @brief Get the equalizer capabilities.
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
1167 *
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
1168 * @param eq Pointer to the vidix_video_eq_t structure to be filled by driver.
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
1169 *
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
1170 * @return 0.
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
1171 */
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
1172 int
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
1173 vixPlaybackGetEq (vidix_video_eq_t * eq)
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
1174 {
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
1175 memcpy (eq, &equal, sizeof (vidix_video_eq_t));
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
1176 return 0;
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
1177 }
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
1178
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
1179 /**
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
1180 * @brief Set the equalizer capabilities for color correction
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
1181 *
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
1182 * @param eq equalizer capabilities to be set.
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
1183 *
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
1184 * @return 0.
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
1185 */
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
1186 int
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
1187 vixPlaybackSetEq (const vidix_video_eq_t * eq)
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
1188 {
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
1189 return 0;
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
1190 }
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
1191
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
1192 /**
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
1193 * @brief Y, U, V offsets.
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
1194 */
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
1195 static int YOffs, UOffs, VOffs;
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
1196
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
1197 /**
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
1198 * @brief Configure driver for playback. Driver should prepare BES.
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
1199 *
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
1200 * @param info configuration description for playback.
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
1201 *
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
1202 * @returns 0 in case of success.
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
1203 * -1 otherwise.
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
1204 */
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
1205 int
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
1206 vixConfigPlayback (vidix_playback_t * vinfo)
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
1207 {
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
1208 int uv_size, swap_uv;
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
1209 unsigned int i;
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
1210 int extfifo_on;
14215
9c33810bbc7b 1l misplaced variable declaration
rtognimp
parents: 14203
diff changeset
1211 int srcPitch,srcPitch2;
14203
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
1212
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
1213 /* Overlay register settings */
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
1214 uint32_t win_start, win_end;
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
1215 uint32_t zoom, mini;
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
1216 uint32_t dcount, falign, qwfetch;
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
1217 uint32_t y_start, u_start, v_start;
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
1218 uint32_t v_ctrl, fifo_ctrl;
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
1219
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
1220 if (!is_supported_fourcc (vinfo->fourcc))
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
1221 return -1;
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
1222
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
1223
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
1224
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
1225 info->src_w = vinfo->src.w;
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
1226 info->src_h = vinfo->src.h;
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
1227
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
1228 info->drw_w = vinfo->dest.w;
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
1229 info->drw_h = vinfo->dest.h;
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
1230
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
1231 info->wx = vinfo->dest.x;
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
1232 info->wy = vinfo->dest.y;
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
1233 info->format = vinfo->fourcc;
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
1234
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
1235 info->lastKnownPitch = 0;
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
1236 info->brightness = 0;
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
1237 info->contrast = 128;
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
1238 info->saturation = 128;
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
1239 info->hue = 0;
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
1240
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
1241
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
1242 vinfo->dga_addr=(void*)(info->picture_base);
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
1243
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
1244
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
1245 vinfo->offset.y = 0;
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
1246 vinfo->offset.v = 0;
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
1247 vinfo->offset.u = 0;
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
1248
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
1249 vinfo->dest.pitch.y = 32;
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
1250 vinfo->dest.pitch.u = 32;
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
1251 vinfo->dest.pitch.v = 32;
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
1252 // vinfo->dest.pitch.u = 0;
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
1253 // vinfo->dest.pitch.v = 0;
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
1254
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
1255
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
1256 info->pitch = ((info->src_w << 1) + 15) & ~15;
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
1257
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
1258 swap_uv = 0;
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
1259 switch (vinfo->fourcc)
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
1260 {
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
1261 case IMGFMT_YUY2:
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
1262 case IMGFMT_UYVY:
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
1263
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
1264 info->pitch = ((info->src_w << 1) + (vinfo->dest.pitch.y-1)) & ~(vinfo->dest.pitch.y-1);
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
1265
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
1266 info->pitch = info->src_w << 1;
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
1267 info->pitch = ALIGN_TO (info->src_w << 1, 32);
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
1268 uv_size = 0;
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
1269 break;
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
1270 case IMGFMT_YV12:
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
1271 swap_uv = 1;
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
1272
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
1273
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
1274
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
1275 /*
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
1276 srcPitch = (info->src_w + 3) & ~3;
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
1277 vinfo->offset.u = srcPitch * info->src_h;
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
1278 srcPitch2 = ((info->src_w >> 1) + 3) & ~3;
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
1279 vinfo->offset.v = (srcPitch2 * (info->src_h >> 1)) + vinfo->offset.v;
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
1280
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
1281 vinfo->dest.pitch.y=srcPitch ;
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
1282 vinfo->dest.pitch.v=srcPitch2 ;
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
1283 vinfo->dest.pitch.u=srcPitch2 ;
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
1284 */
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
1285
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
1286
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
1287 info->pitch = ALIGN_TO (info->src_w, 32);
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
1288 uv_size = (info->pitch >> 1) * (info->src_h >> 1);
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
1289
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
1290 vinfo->offset.y = 0;
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
1291 vinfo->offset.v = vinfo->offset.y + info->pitch * info->src_h;
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
1292 vinfo->offset.u = vinfo->offset.v + uv_size;
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
1293 vinfo->frame_size = vinfo->offset.u + uv_size;
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
1294 /* YOffs = info->offset.y;
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
1295 UOffs = (swap_uv ? vinfo->offset.v : vinfo->offset.u);
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
1296 VOffs = (swap_uv ? vinfo->offset.u : vinfo->offset.v);
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
1297 */
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
1298 // vinfo->offset.y = info->src_w;
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
1299 // vinfo->offset.v = vinfo->offset.y + info->src_w /2 * info->src_h;
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
1300 // vinfo->offset.u = vinfo->offset.v + (info->src_w >> 1) * (info->src_h >> 1) ;
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
1301
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
1302 break;
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
1303 }
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
1304 info->pitch |= ((info->pitch >> 1) << 16);
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
1305
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
1306 vinfo->frame_size = info->pitch * info->src_h;
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
1307
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
1308 printf("$#### destination pitch = %lu\n", info->pitch&0xffff);
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
1309
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
1310
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
1311
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
1312
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
1313 info->buffer_size = vinfo->frame_size;
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
1314 info->num_frames = vinfo->num_frames= (info->chip.fbsize - info->picture_offset)/vinfo->frame_size;
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
1315 if(vinfo->num_frames > MAX_FRAMES)vinfo->num_frames = MAX_FRAMES;
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
1316 // vinfo->num_frames = 1;
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
1317 // printf("[nvidia_vid] Number of frames %i\n",vinfo->num_frames);
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
1318 for(i=0;i <vinfo->num_frames;i++)vinfo->offsets[i] = vinfo->frame_size*i;
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
1319
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
1320 return 0;
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
1321 }
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
1322
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
1323 /**
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
1324 * @brief Set playback on : driver should activate BES on this call.
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
1325 *
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
1326 * @return 0.
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
1327 */
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
1328 int
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
1329 vixPlaybackOn (void)
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
1330 {
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
1331 // FIXME: enable
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
1332 SavageDisplayVideoOld();
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
1333 //FIXME ADD
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
1334 return 0;
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
1335 }
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
1336
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
1337 /**
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
1338 * @brief Set playback off : driver should deactivate BES on this call.
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
1339 *
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
1340 * @return 0.
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
1341 */
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
1342 int
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
1343 vixPlaybackOff (void)
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
1344 {
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
1345 // otherwise we wont disable streams properly in new xorg
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
1346 // FIXME: shouldnt this be enabled?
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
1347 // SavageStreamsOn();
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
1348 SavageStreamsOff();
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
1349 // info->vidixcolorkey=0x0;
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
1350
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
1351 // OUTREG( SSTREAM_WINDOW_START_REG, OS_XY(0xfffe, 0xfffe) );
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
1352 // SavageSetColorKeyOld();
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
1353 //FIXME ADD
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
1354 return 0;
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
1355 }
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
1356
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
1357 /**
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
1358 * @brief Driver should prepare and activate corresponded frame.
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
1359 *
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
1360 * @param frame the frame index.
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
1361 *
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
1362 * @return 0.
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
1363 *
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
1364 * @note This function is used only for double and triple buffering
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
1365 * and never used for single buffering playback.
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
1366 */
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
1367 #if 0
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
1368 int
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
1369 vixPlaybackFrameSelect (unsigned int frame)
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
1370 {
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
1371 ////FIXME ADD
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
1372 // savage_overlay_start(info, frame);
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
1373 //if (info->num_frames >= 1)
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
1374 // info->cur_frame = frame//(frame+1)%info->num_frames;
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
1375 //
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
1376 // savage4_waitidle(info);
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
1377
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
1378 printf("vixPlaybackFrameSelect Leave\n" );
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
1379 // FIXME: does this work to avoid tearing?
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
1380 // VerticalRetraceWait();
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
1381
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
1382 return 0;
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
1383 }
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
1384
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
1385 #endif
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
1386
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
1387
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
1388
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
1389 void debugout(unsigned int addr, unsigned int val){
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
1390 return ;
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
1391 switch ( addr ){
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
1392 case PSTREAM_CONTROL_REG:
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
1393 fprintf(stderr,"PSTREAM_CONTROL_REG");
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
1394 break;
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
1395 case COL_CHROMA_KEY_CONTROL_REG:
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
1396 fprintf(stderr,"COL_CHROMA_KEY_CONTROL_REG");
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
1397 break;
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
1398 case SSTREAM_CONTROL_REG:
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
1399 fprintf(stderr,"SSTREAM_CONTROL_REG");
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
1400 break;
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
1401 case CHROMA_KEY_UPPER_BOUND_REG:
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
1402 fprintf(stderr,"CHROMA_KEY_UPPER_BOUND_REG");
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
1403 break;
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
1404 case SSTREAM_STRETCH_REG:
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
1405 fprintf(stderr,"SSTREAM_STRETCH_REG");
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
1406 break;
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
1407 case COLOR_ADJUSTMENT_REG:
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
1408 fprintf(stderr,"COLOR_ADJUSTMENT_REG");
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
1409 break;
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
1410 case BLEND_CONTROL_REG:
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
1411 fprintf(stderr,"BLEND_CONTROL_REG");
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
1412 break;
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
1413 case PSTREAM_FBADDR0_REG:
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
1414 fprintf(stderr,"PSTREAM_FBADDR0_REG");
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
1415 break;
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
1416 case PSTREAM_FBADDR1_REG:
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
1417 fprintf(stderr,"PSTREAM_FBADDR1_REG");
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
1418 break;
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
1419 case PSTREAM_STRIDE_REG:
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
1420 fprintf(stderr,"PSTREAM_STRIDE_REG");
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
1421 break;
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
1422 case DOUBLE_BUFFER_REG:
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
1423 fprintf(stderr,"DOUBLE_BUFFER_REG");
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
1424 break;
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
1425 case SSTREAM_FBADDR0_REG:
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
1426 fprintf(stderr,"SSTREAM_FBADDR0_REG");
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
1427 break;
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
1428 case SSTREAM_FBADDR1_REG:
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
1429 fprintf(stderr,"SSTREAM_FBADDR1_REG");
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
1430 break;
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
1431 case SSTREAM_STRIDE_REG:
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
1432 fprintf(stderr,"SSTREAM_STRIDE_REG");
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
1433 break;
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
1434 case SSTREAM_VSCALE_REG:
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
1435 fprintf(stderr,"SSTREAM_VSCALE_REG");
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
1436 break;
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
1437 case SSTREAM_VINITIAL_REG:
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
1438 fprintf(stderr,"SSTREAM_VINITIAL_REG");
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
1439 break;
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
1440 case SSTREAM_LINES_REG:
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
1441 fprintf(stderr,"SSTREAM_LINES_REG");
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
1442 break;
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
1443 case STREAMS_FIFO_REG:
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
1444 fprintf(stderr,"STREAMS_FIFO_REG");
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
1445 break;
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
1446 case PSTREAM_WINDOW_START_REG:
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
1447 fprintf(stderr,"PSTREAM_WINDOW_START_REG");
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
1448 break;
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
1449 case PSTREAM_WINDOW_SIZE_REG:
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
1450 fprintf(stderr,"PSTREAM_WINDOW_SIZE_REG");
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
1451 break;
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
1452 case SSTREAM_WINDOW_START_REG:
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
1453 fprintf(stderr,"SSTREAM_WINDOW_START_REG");
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
1454 break;
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
1455 case SSTREAM_WINDOW_SIZE_REG:
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
1456 fprintf(stderr,"SSTREAM_WINDOW_SIZE_REG");
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
1457 break;
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
1458 case FIFO_CONTROL:
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
1459 fprintf(stderr,"FIFO_CONTROL");
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
1460 break;
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
1461 case PSTREAM_FBSIZE_REG:
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
1462 fprintf(stderr,"PSTREAM_FBSIZE_REG");
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
1463 break;
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
1464 case SSTREAM_FBSIZE_REG:
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
1465 fprintf(stderr,"SSTREAM_FBSIZE_REG");
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
1466 break;
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
1467 case SSTREAM_FBADDR2_REG:
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
1468 fprintf(stderr,"SSTREAM_FBADDR2_REG");
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
1469 break;
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
1470
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
1471 }
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
1472 fprintf(stderr,":\t\t 0x%08X = %lu\n",val,val);
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
1473 }
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
1474
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
1475