annotate vidix/drivers/savage_vid.c @ 14856:7b1198123519

Arpi prefers root@mphq for CVS problems.
author diego
date Tue, 01 Mar 2005 03:49:04 +0000
parents 9c33810bbc7b
children 54b6720658f8
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>
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
39
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
40 #include "../vidix.h"
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
41 #include "../fourcc.h"
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
42 #include "../../libdha/libdha.h"
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
43 #include "../../libdha/pci_ids.h"
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
44 #include "../../libdha/pci_names.h"
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
45 #include "../../config.h"
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
46
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
47 #include "savage_regs.h"
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
48
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 #define VF_STREAMS_ON 0x0001
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
51 #define BASE_PAD 0xf
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
52 #define FRAMEBUFFER_SIZE 1024*2000*4
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
53 /**************************************
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
54 S3 streams processor
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
55 **************************************/
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 #define EXT_MISC_CTRL2 0x67
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
58
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
59 /* New streams */
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
60
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
61 /* CR67[2] = 1 : enable stream 1 */
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
62 #define ENABLE_STREAM1 0x04
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
63 /* CR67[1] = 1 : enable stream 2 */
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
64 #define ENABLE_STREAM2 0x02
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
65 /* mask to clear CR67[2,1] */
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
66 #define NO_STREAMS 0xF9
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
67 /* CR67[3] = 1 : Mem-mapped regs */
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
68 #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
69
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
70 #define HDM_SHIFT 16
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
71 #define HDSCALE_4 (2 << HDM_SHIFT)
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
72 #define HDSCALE_8 (3 << HDM_SHIFT)
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
73 #define HDSCALE_16 (4 << HDM_SHIFT)
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
74 #define HDSCALE_32 (5 << HDM_SHIFT)
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
75 #define HDSCALE_64 (6 << HDM_SHIFT)
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
76
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
77 /* Old Streams */
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
78
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
79 #define ENABLE_STREAMS_OLD 0x0c
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
80 #define NO_STREAMS_OLD 0xf3
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
81 /* CR69[0] = 1 : Mem-mapped regs */
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
82 #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
83
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
84 void SavageStreamsOn();
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
85
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 * 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
88 * 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
89 * 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
90 */
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 /* streams registers for old engine */
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
94 #define PSTREAM_CONTROL_REG 0x8180
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
95 #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
96 #define SSTREAM_CONTROL_REG 0x8190
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
97 #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
98 #define SSTREAM_STRETCH_REG 0x8198
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
99 #define COLOR_ADJUSTMENT_REG 0x819C
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
100 #define BLEND_CONTROL_REG 0x81A0
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
101 #define PSTREAM_FBADDR0_REG 0x81C0
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
102 #define PSTREAM_FBADDR1_REG 0x81C4
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
103 #define PSTREAM_STRIDE_REG 0x81C8
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
104 #define DOUBLE_BUFFER_REG 0x81CC
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
105 #define SSTREAM_FBADDR0_REG 0x81D0
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
106 #define SSTREAM_FBADDR1_REG 0x81D4
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
107 #define SSTREAM_STRIDE_REG 0x81D8
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
108 #define SSTREAM_VSCALE_REG 0x81E0
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
109 #define SSTREAM_VINITIAL_REG 0x81E4
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
110 #define SSTREAM_LINES_REG 0x81E8
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
111 #define STREAMS_FIFO_REG 0x81EC
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
112 #define PSTREAM_WINDOW_START_REG 0x81F0
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
113 #define PSTREAM_WINDOW_SIZE_REG 0x81F4
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
114 #define SSTREAM_WINDOW_START_REG 0x81F8
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
115 #define SSTREAM_WINDOW_SIZE_REG 0x81FC
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
116 #define FIFO_CONTROL 0x8200
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
117 #define PSTREAM_FBSIZE_REG 0x8300
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
118 #define SSTREAM_FBSIZE_REG 0x8304
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
119 #define SSTREAM_FBADDR2_REG 0x8308
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
120
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
121 #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
122 #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
123
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
124 #define PCI_COMMAND_MEM 0x2
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
125 #define MAX_FRAMES 3
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
126 /**
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
127 * @brief Information on PCI device.
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
128 */
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
129 pciinfo_t pci_info;
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
130
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 * @brief Unichrome driver colorkey settings.
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
133 */
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
134 static vidix_grkey_t savage_grkey;
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
135
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
136 static int frames[VID_PLAY_MAXFRAMES];
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
137 uint8_t *vio;
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
138 uint8_t mclk_save[3];
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
139
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
140 #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
141 #define inb(reg) INPORT8(reg)
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
142 #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
143 #define inw(reg) INPORT16(reg)
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
144 #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
145 #define inl(reg) INPORT32(reg)
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
146
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 * PCI-Memory IO access macros.
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
150 */
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
151 #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
152 #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
153
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
154 #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
155 #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
156
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
157 #ifndef USE_RMW_CYCLES
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
158 /*
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
159 * 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
160 */
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 #define MEM_BARRIER() __asm__ __volatile__ ("" : : : "memory")
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
163
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
164 #undef VID_WR08
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
165 #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
166 #undef VID_RD08
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
167 #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
168
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
169 #undef VID_WR16
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
170 #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
171 #undef VID_RD16
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
172 #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
173
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
174 #undef VID_WR32
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
175 #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
176 #undef VID_RD32
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
177 #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
178 #endif /* USE_RMW_CYCLES */
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
179
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
180 #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
181 #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
182 #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
183
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 /* from x driver */
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
186
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
187 #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
188 #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
189 #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
190
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
191 #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
192 #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
193 #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
194
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
195 #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
196 #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
197 #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
198 #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
199 #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
200 #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
201
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
202 #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
203
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 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
206
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 struct savage_chip {
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
209 volatile uint32_t *PMC; /* general control */
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
210 volatile uint32_t *PME; /* multimedia port */
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
211 volatile uint32_t *PFB; /* framebuffer control */
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
212 volatile uint32_t *PVIDEO; /* overlay control */
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
213 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
214 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
215 volatile uint32_t *PRAMIN; /* instance memory */
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
216 volatile uint32_t *PRAMHT; /* hash table */
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
217 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
218 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
219 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
220 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
221 volatile uint32_t *PGRAPH; /* graphics engine */
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
222
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
223 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
224 unsigned long fbsize; /* framebuffer size */
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
225 void (* lock) (struct savage_chip *, int);
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
226 };
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
227 typedef struct savage_chip savage_chip;
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
228
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 struct savage_info {
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
231 unsigned int use_colorkey;
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
232 unsigned int colorkey; /* saved xv colorkey*/
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
233 unsigned int vidixcolorkey; /*currently used colorkey*/
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
234 unsigned int depth;
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
235 unsigned int bpp;
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
236 unsigned int videoFlags;
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
237 unsigned int format;
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
238 unsigned int pitch;
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
239 unsigned int blendBase;
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
240 unsigned int lastKnownPitch;
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
241 unsigned int displayWidth, displayHeight;
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
242 unsigned int brightness,hue,saturation,contrast;
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
243 unsigned int src_w,src_h;
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
244 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
245 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
246 unsigned int screen_x; /*screen width*/
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
247 unsigned int screen_y; /*screen height*/
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
248 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
249 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
250 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
251 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
252 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
253 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
254 // struct savage_dma dma; /* DMA structure */
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
255 unsigned int cur_frame;
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
256 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
257 int bps; /* bytes per line */
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
258 void (*SavageWaitIdle) ();
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
259 void (*SavageWaitFifo) (int space);
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
260 };
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
261 typedef struct savage_info savage_info;
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
262
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 static savage_info* info;
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
265
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 * @brief Unichrome driver vidix capabilities.
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
269 */
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
270 static vidix_capability_t savage_cap = {
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
271 "Savage/ProSavage/Twister vidix",
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
272 "Reza Jelveh <reza.jelveh@tuhh.de>",
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
273 TYPE_OUTPUT,
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
274 {0, 0, 0, 0},
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
275 4096,
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 4,
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 -1,
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
280 FLAG_UPSCALER | FLAG_DOWNSCALER,
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
281 VENDOR_S3_INC,
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
282 -1,
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
283 {0, 0, 0, 0}
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
284 };
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 struct savage_cards {
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
287 unsigned short chip_id;
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
288 unsigned short arch;
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
289 };
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 static
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
293 unsigned int GetBlendForFourCC( int id )
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
294 {
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
295 switch( id ) {
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
296 case IMGFMT_YUY2:
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
297 case IMGFMT_YV12:
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
298 case IMGFMT_I420:
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
299 return 1;
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
300 case IMGFMT_Y211:
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
301 return 4;
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
302 case IMGFMT_RGB15:
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
303 return 3;
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
304 case IMGFMT_RGB16:
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
305 return 5;
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
306 default:
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
307 return 0;
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
308 }
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 * @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
313 */
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
314 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
315 /*[ProSavage PN133] AGP4X VGA Controller (Twister)*/
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
316 { PCI_CHIP_S3TWISTER_P, S3_PROSAVAGE },
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
317 /*[ProSavage KN133] AGP4X VGA Controller (TwisterK)*/
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
318 { PCI_CHIP_S3TWISTER_K, S3_PROSAVAGE },
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
319 /*ProSavage DDR*/
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
320 { PCI_CHIP_PROSAVAGE_DDR , S3_PROSAVAGE },
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
321 /*[ProSavageDDR P4M266 K] */
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
322 { PCI_CHIP_PROSAVAGE_DDRK , S3_PROSAVAGE },
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
323 };
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 void SavageSetColorOld()
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
326 {
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 if(
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
330 (info->format == IMGFMT_RGB15) ||
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
331 (info->format == IMGFMT_RGB16)
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
332 )
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 OUTREG( COLOR_ADJUSTMENT_REG, 0 );
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
335 }
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
336 else
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
337 {
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
338 /* Change 0..255 into 0..15 */
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
339 long sat = info->saturation * 16 / 256;
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
340 double hue = info->hue * 0.017453292;
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
341 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
342 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
343
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
344 OUTREG( COLOR_ADJUSTMENT_REG,
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
345 0x80008000 |
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
346 (info->brightness + 128) |
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
347 ((info->contrast & 0xf8) << (12-7)) |
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
348 (hs1 << 16) |
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
349 (hs2 << 24)
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
350 );
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
351 debugout( COLOR_ADJUSTMENT_REG,
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
352 0x80008000 |
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
353 (info->brightness + 128) |
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
354 ((info->contrast & 0xf8) << (12-7)) |
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
355 (hs1 << 16) |
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
356 (hs2 << 24)
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
357 );
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 void SavageSetColorKeyOld()
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
363 {
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
364 int red, green, blue;
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
365
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
366 /* 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
367
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
368 red = (info->vidixcolorkey & 0x00FF0000) >> 16;
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
369 green = (info->vidixcolorkey & 0x0000FF00) >> 8;
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
370 blue = info->vidixcolorkey & 0x000000FF;
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
371
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
372 if( !info->vidixcolorkey ) {
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
373 printf("SavageSetColorKey disabling colorkey\n");
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
374 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
375 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
376 OUTREG( BLEND_CONTROL_REG, 0 );
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
377 }
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
378 else {
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
379 switch (info->depth) {
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
380 // FIXME: isnt fixed yet
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
381 case 8:
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
382 OUTREG( COL_CHROMA_KEY_CONTROL_REG,
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
383 0x37000000 | (info->vidixcolorkey & 0xFF) );
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
384 OUTREG( CHROMA_KEY_UPPER_BOUND_REG,
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
385 0x00000000 | (info->vidixcolorkey & 0xFF) );
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
386 break;
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
387 case 15:
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
388 /* 15 bpp 555 */
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
389 red&=0x1f;
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
390 green&=0x1f;
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
391 blue&=0x1f;
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
392 OUTREG( COL_CHROMA_KEY_CONTROL_REG,
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
393 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
394 OUTREG( CHROMA_KEY_UPPER_BOUND_REG,
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
395 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
396 break;
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
397 case 16:
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
398 /* 16 bpp 565 */
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
399 red&=0x1f;
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
400 green&=0x3f;
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
401 blue&=0x1f;
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
402 OUTREG( COL_CHROMA_KEY_CONTROL_REG,
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
403 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
404 OUTREG( CHROMA_KEY_UPPER_BOUND_REG,
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
405 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
406 break;
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
407 case 24:
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
408 /* 24 bpp 888 */
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
409 OUTREG( COL_CHROMA_KEY_CONTROL_REG,
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
410 0x17000000 | (red<<16) | (green<<8) | (blue) );
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
411 OUTREG( CHROMA_KEY_UPPER_BOUND_REG,
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
412 0x00000000 | (red<<16) | (green<<8) | (blue) );
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
413 break;
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
414 }
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 /* We use destination colorkey */
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
417 OUTREG( BLEND_CONTROL_REG, 0x05000000 );
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
418 }
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 static void
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
423 SavageDisplayVideoOld(
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
424 ){
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
425 int vgaCRIndex, vgaCRReg, vgaIOBase;
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
426 unsigned int ssControl;
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
427 int cr92;
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
428
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 vgaIOBase = 0x3d0;
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
431 vgaCRIndex = vgaIOBase + 4;
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
432 vgaCRReg = vgaIOBase + 5;
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
433
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
434 // if( psav->videoFourCC != id )
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
435 // SavageStreamsOff(pScrn);
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
436
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
437 if( !info->videoFlags & VF_STREAMS_ON )
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
438 {
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
439 SavageStreamsOn();
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
440 // SavageResetVideo();
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
441 SavageSetColorOld();
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
442 SavageSetColorKeyOld();
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
443 }
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 /* Set surface format. */
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
449
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
450 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
451
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
452 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
453
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
454 /* Calculate horizontal scale factor. */
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
455
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
456 //FIXME: enable scaling
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
457 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
458 // debugout(SSTREAM_STRETCH_REG, 1 << 15);
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
459
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
460 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
461 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
462
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 OUTREG(SSTREAM_VINITIAL_REG, 0 );
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
465 debugout(SSTREAM_VINITIAL_REG, 0 );
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
466 /* Calculate vertical scale factor. */
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
467
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
468 // OUTREG(SSTREAM_VSCALE_REG, 1 << 15);
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
469 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
470 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
471 // 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
472
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
473 /* Set surface location and stride. */
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
474
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
475 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
476 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
477
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
478 OUTREG(SSTREAM_FBADDR1_REG, 0 );
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
479 debugout(SSTREAM_FBADDR1_REG, 0 );
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
480
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
481 OUTREG(SSTREAM_STRIDE_REG, info->pitch );
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
482 debugout(SSTREAM_STRIDE_REG, info->pitch );
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
483
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
484 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
485 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
486 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
487 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
488
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 ssControl = 0;
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
492
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
493 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
494 {
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
495 /* BUGBUG shouldn't this be >=? */
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
496 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
497 ssControl |= HDSCALE_4;
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
498 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
499 ssControl |= HDSCALE_8;
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
500 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
501 ssControl |= HDSCALE_16;
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
502 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
503 ssControl |= HDSCALE_32;
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
504 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
505 ssControl |= HDSCALE_64;
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
506 }
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 ssControl |= info->src_w;
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
509 ssControl |= (1 << 24);
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
510
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
511 //FIXME: enable scaling
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
512 OUTREG(SSTREAM_CONTROL_REG, ssControl);
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
513 debugout(SSTREAM_CONTROL_REG, ssControl);
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
514
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
515 // FIXME: this should actually be enabled
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
516
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
517 info->pitch = (info->pitch + 7) / 8;
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
518 VGAOUT8(vgaCRIndex, 0x92);
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
519 cr92 = VGAIN8(vgaCRReg);
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
520 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
521 VGAOUT8(vgaCRIndex, 0x93);
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
522 VGAOUT8(vgaCRReg, info->pitch);
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
523 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
524
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 void SavageInitStreamsOld()
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
531 {
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
532 /*unsigned long jDelta;*/
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
533 unsigned long format = 0;
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
534
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 * 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
537 * 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
538 * 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
539 */
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 /*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
543 switch( info->depth ) {
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
544 case 8: format = 0 << 24; break;
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
545 case 15: format = 3 << 24; break;
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
546 case 16: format = 5 << 24; break;
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
547 case 24: format = 7 << 24; break;
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
548 }
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
549 #warning enable this again
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
550 OUTREG(PSTREAM_FBSIZE_REG,
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
551 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
552
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
553 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
554 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
555 OUTREG( PSTREAM_FBADDR1_REG, 0 );
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
556 /*OUTREG( PSTREAM_STRIDE_REG, jDelta );*/
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
557 OUTREG( PSTREAM_CONTROL_REG, format );
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
558 OUTREG( PSTREAM_FBADDR0_REG, 0 );
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
559
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
560 /*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
561
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
562 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
563 OUTREG( SSTREAM_CONTROL_REG, 0 );
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
564 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
565 OUTREG( SSTREAM_STRETCH_REG, 0 );
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
566 OUTREG( COLOR_ADJUSTMENT_REG, 0 );
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
567 OUTREG( BLEND_CONTROL_REG, 1 << 24 );
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
568 OUTREG( DOUBLE_BUFFER_REG, 0 );
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
569 OUTREG( SSTREAM_FBADDR0_REG, 0 );
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
570 OUTREG( SSTREAM_FBADDR1_REG, 0 );
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
571 OUTREG( SSTREAM_FBADDR2_REG, 0 );
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
572 OUTREG( SSTREAM_FBSIZE_REG, 0 );
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
573 OUTREG( SSTREAM_STRIDE_REG, 0 );
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
574 OUTREG( SSTREAM_VSCALE_REG, 0 );
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
575 OUTREG( SSTREAM_LINES_REG, 0 );
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
576 OUTREG( SSTREAM_VINITIAL_REG, 0 );
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
577 #warning is this needed?
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
578 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
579 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
580
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 void
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
584 SavageStreamsOn()
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
585 {
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
586 unsigned char jStreamsControl;
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
587 unsigned short vgaCRIndex = 0x3d0 + 4;
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
588 unsigned short vgaCRReg = 0x3d0 + 5;
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
589
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
590 // xf86ErrorFVerb(STREAMS_TRACE, "SavageStreamsOn\n" );
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
591
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
592 /* 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
593
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 enable_app_io ();
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
596
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
597 /* Unlock extended registers. */
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
598
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
599 /* 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
600 VGAOUT16(vgaCRIndex, 0x4838 );
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
601 VGAOUT16(vgaCRIndex, 0xa039);
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
602 VGAOUT16(0x3c4, 0x0608);
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
603
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 VGAOUT8( vgaCRIndex, EXT_MISC_CTRL2 );
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
607
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
608 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
609 {
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
610 // SavageInitStreamsNew( pScrn );
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
611
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
612 jStreamsControl = VGAIN8( vgaCRReg ) | ENABLE_STREAM1;
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
613
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
614 /* Wait for VBLANK. */
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
615 VerticalRetraceWait();
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
616 /* Fire up streams! */
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
617 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
618 /* 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
619 OUTREG( SEC_STREAM_COLOR_CONVERT1, 0x0000C892 );
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
620 OUTREG( SEC_STREAM_COLOR_CONVERT2, 0x00039F9A );
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
621 OUTREG( SEC_STREAM_COLOR_CONVERT3, 0x01F1547E );
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
622 }
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
623 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
624 {
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
625 // SavageInitStreams2000( pScrn );
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
626
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
627 jStreamsControl = VGAIN8( vgaCRReg ) | ENABLE_STREAM1;
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
628
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
629 /* Wait for VBLANK. */
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
630 VerticalRetraceWait();
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
631 /* Fire up streams! */
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
632 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
633 /* 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
634 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
635 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
636 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
637 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
638 }
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
639 else
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
640 {
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
641 jStreamsControl = VGAIN8( vgaCRReg ) | ENABLE_STREAMS_OLD;
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
642
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
643 /* Wait for VBLANK. */
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
644
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
645 VerticalRetraceWait();
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
646
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
647 /* Fire up streams! */
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
648
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
649 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
650
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
651 SavageInitStreamsOld( );
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
652 }
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 /* Wait for VBLANK. */
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
655
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
656 VerticalRetraceWait();
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
657
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
658 /* 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
659
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
660 /* SR70 |= 0x10 */
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
661
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
662 info->videoFlags |= VF_STREAMS_ON;
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
663
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 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
670 unsigned char bpp=0;
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
671 uint32_t width=0;
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
672
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
673 uint32_t vgaIOBase, vgaCRIndex, vgaCRReg;
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
674
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
675 vgaIOBase = 0x3d0;
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
676 vgaCRIndex = vgaIOBase + 4;
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
677 vgaCRReg = vgaIOBase + 5;
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
678
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 /* 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
681 VGAOUT8(vgaCRIndex, 0x67);
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
682 bpp = VGAIN8(vgaCRReg);
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
683
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 switch (bpp&0xf0) {
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
686 case 0x00:
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
687 case 0x10:
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
688 info->depth=8;
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
689 info->bpp=8;
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
690 break;
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
691 case 0x20:
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
692 case 0x30:
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
693 info->depth=15;
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
694 info->bpp=16;
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
695 break;
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
696 case 0x40:
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
697 case 0x50:
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
698 info->depth=16;
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
699 info->bpp=16;
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
700 break;
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
701 case 0x70:
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
702 case 0xd0:
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
703 info->depth=24;
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
704 info->bpp=32;
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
705 break;
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
706
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 VGAOUT8(vgaCRIndex, 0x1);
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
712 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
713 /*get screen height*/
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
714 /* 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
715 VGAOUT8(0x03D4, 0x12);
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
716 info->screen_y = VGAIN8(0x03D5);
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
717 VGAOUT8(0x03D4,0x07);
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
718 /* get 9th bit in CRTC_OVERFLOW*/
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
719 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
720 /* and the 10th in CRTC_OVERFLOW*/
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
721 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
722 ++info->screen_y;
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
723
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
724 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
725 }
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 void SavageStreamsOff()
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
729 {
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
730 unsigned char jStreamsControl;
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
731 unsigned short vgaCRIndex = 0x3d0 + 4;
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
732 unsigned short vgaCRReg = 0x3d0 + 5;
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
733
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 /* Unlock extended registers. */
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
736
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
737 VGAOUT16(vgaCRIndex, 0x4838);
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
738 VGAOUT16(vgaCRIndex, 0xa039);
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
739 VGAOUT16(0x3c4, 0x0608);
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
740
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
741 VGAOUT8( vgaCRIndex, EXT_MISC_CTRL2 );
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
742 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
743 (info->chip.arch == S3_SUPERSAVAGE) ||
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
744 (info->chip.arch == S3_SAVAGE2000) )
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
745 jStreamsControl = VGAIN8( vgaCRReg ) & NO_STREAMS;
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
746 else
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
747 jStreamsControl = VGAIN8( vgaCRReg ) & NO_STREAMS_OLD;
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
748
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
749 /* Wait for VBLANK. */
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
750
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
751 VerticalRetraceWait();
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
752
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
753 /* Kill streams. */
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
754
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
755 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
756
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
757 VGAOUT16(vgaCRIndex, 0x0093 );
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
758 VGAOUT8( vgaCRIndex, 0x92 );
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
759 VGAOUT8( vgaCRReg, VGAIN8(vgaCRReg) & 0x40 );
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
760
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
761 info->videoFlags &= ~VF_STREAMS_ON;
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
762 }
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 * @brief Check age of driver.
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
767 *
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
768 * @return vidix version number.
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
769 */
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
770 unsigned int
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
771 vixGetVersion (void)
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
772 {
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
773 return (VIDIX_VERSION);
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
774 }
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 * @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
778 *
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
779 * @param chip_id PCI device ID.
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
780 *
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
781 * @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
782 * -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
783 */
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 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
786 unsigned i;
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
787 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
788 {
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
789 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
790 }
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
791 return -1;
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
792 }
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 * @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
796 *
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
797 * @param verbose specifies verbose level.
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
798 * @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
799 * 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
800 *
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
801 * @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
802 * a negative error code otherwise.
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
803 */
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 int vixProbe(int verbose, int force){
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
806 pciinfo_t lst[MAX_PCI_DEVICES];
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
807 unsigned i,num_pci;
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
808 int err;
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
809
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
810 if (force)
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
811 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
812 err = pci_scan(lst,&num_pci);
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
813 if(err){
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
814 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
815 return err;
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
816 }
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
817 else {
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
818 err = ENXIO;
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
819 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
820 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
821 int idx;
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
822 const char *dname;
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
823 idx = find_chip(lst[i].device);
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
824 if(idx == -1)
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
825 continue;
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
826 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
827 dname = dname ? dname : "Unknown chip";
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
828 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
829 // FIXME: whats wrong here?
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
830 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
831 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
832 continue;
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
833 }
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
834 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
835 err = 0;
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
836 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
837 break;
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
838 }
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 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
842 return err;
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
843 }
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 * @brief Initializes driver.
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
847 *
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
848 * @returns 0 if ok.
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
849 * a negative error code otherwise.
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
850 */
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
851 int
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
852 vixInit (void)
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
853 {
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
854 int mtrr;
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
855 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
856
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
857 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
858 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
859 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
860 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
861
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
862 int videoRam, videoRambytes;
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
863
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
864 uint32_t vgaIOBase, vgaCRIndex, vgaCRReg ;
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
865
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
866 unsigned char val;
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
867
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
868 vgaIOBase = 0x3d0;
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
869 vgaCRIndex = vgaIOBase + 4;
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
870 vgaCRReg = vgaIOBase + 5;
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
871
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
872 fprintf(stderr, "vixInit enter \n");
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
873 // //getc(stdin);
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
874
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
875 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
876
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 /* 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
879 enable_app_io ();
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
880
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
881 /* 12mb + 32kb ? */
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
882 /* allocate some space for control registers */
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
883 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
884
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
885 if (info->chip.arch == S3_SAVAGE3D) {
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
886 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
887 }
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
888 else {
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
889 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
890 }
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 // 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
893
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
894 // FIXME: enable mmio?
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
895 val = VGAIN8 (0x3c3);
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
896 VGAOUT8 (0x3c3, val | 0x01);
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
897 val = VGAIN8 (0x3cc);
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
898 VGAOUT8 (0x3c2, val | 0x01);
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
899
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
900 if (info->chip.arch >= S3_SAVAGE4)
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
901 {
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
902 VGAOUT8 (0x3d4, 0x40);
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
903 val = VGAIN8 (0x3d5);
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
904 VGAOUT8 (0x3d5, val | 1);
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
905 }
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 /* unprotect CRTC[0-7] */
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
910 VGAOUT8(vgaCRIndex, 0x11);
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
911 tmp = VGAIN8(vgaCRReg);
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
912 // printf("$########## tmp = %d\n",tmp);
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
913 VGAOUT8(vgaCRReg, tmp & 0x7f);
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
914
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 /* unlock extended regs */
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
917 VGAOUT16(vgaCRIndex, 0x4838);
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
918 VGAOUT16(vgaCRIndex, 0xa039);
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
919 VGAOUT16(0x3c4, 0x0608);
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
920
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
921 VGAOUT8(vgaCRIndex, 0x40);
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
922 tmp = VGAIN8(vgaCRReg);
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
923 VGAOUT8(vgaCRReg, tmp & ~0x01);
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
924
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
925 /* unlock sys regs */
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
926 VGAOUT8(vgaCRIndex, 0x38);
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
927 VGAOUT8(vgaCRReg, 0x48);
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
928
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
929 /* Unlock system registers. */
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
930 VGAOUT16(vgaCRIndex, 0x4838);
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
931
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
932 /* 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
933
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
934 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
935 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
936
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 switch( info->chip.arch ) {
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
939 case S3_SAVAGE3D:
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
940 videoRam = RamSavage3D[ (config1 & 0xC0) >> 6 ] * 1024;
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
941 break;
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
942
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
943 case S3_SAVAGE4:
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
944 /*
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
945 * 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
946 * 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
947 * 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
948 * can do it different...
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
949 */
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
950 VGAOUT8(0x3d4, 0x68); /* memory control 1 */
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
951 if( (VGAIN8(0x3d5) & 0xC0) == (0x01 << 6) )
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
952 RamSavage4[1] = 8;
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
953
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
954 /*FALLTHROUGH*/
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
955
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
956 case S3_SAVAGE2000:
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
957 videoRam = RamSavage4[ (config1 & 0xE0) >> 5 ] * 1024;
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
958 break;
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
959
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
960 case S3_SAVAGE_MX:
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
961 videoRam = RamSavageMX[ (config1 & 0x0E) >> 1 ] * 1024;
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
962 break;
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
963
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
964 case S3_PROSAVAGE:
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
965 videoRam = RamSavageNB[ (config1 & 0xE0) >> 5 ] * 1024;
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
966 break;
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
967
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
968 default:
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
969 /* How did we get here? */
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
970 videoRam = 0;
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
971 break;
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
972 }
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 printf("###### videoRam = %d\n",videoRam);
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
976 info->chip.fbsize = videoRam * 1024;
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
977
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 /* 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
980 /* VGAOUT8 (0x3d4, 0x66);
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
981 cr66 = VGAIN8 (0x3d5);
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
982 VGAOUT8 (0x3d5, cr66 | 0x02);
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
983 udelay (10000);
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
984
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
985 VGAOUT8 (0x3d4, 0x66);
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
986 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
987 /* udelay (10000); */
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
988
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
989 /* 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
990 if (info->chip.arch == S3_SAVAGE3D) {
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
991 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
992 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
993 }
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
994 else {
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
995 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
996 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
997 // 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
998 }
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
999 if ( info->video_base < 0 ){
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
1000 printf("errno = %s\n", strerror(errno));
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
1001 return -1;
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
1002 }
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 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
1006
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
1007 if ( info->chip.arch == S3_SAVAGE3D ){
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
1008 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
1009 }
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
1010 else{
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
1011 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
1012 }
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 if (mtrr!= 0)
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
1015 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
1016 else
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
1017 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
1018
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
1019 /* 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
1020
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 savage_getscreenproperties(info);
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
1023 // return -1;
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
1024 info->videoFlags = 0;
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
1025
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
1026 SavageStreamsOn();
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
1027 //getc(stdin);
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
1028 //FIXME ADD
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
1029 return 0;
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
1030 }
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 * @brief Destroys driver.
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
1034 */
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
1035 void
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
1036 vixDestroy (void)
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
1037 {
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
1038 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
1039 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
1040 //FIXME ADD
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
1041 }
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 * @brief Get chipset's hardware capabilities.
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
1045 *
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
1046 * @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
1047 *
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
1048 * @returns 0.
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
1049 */
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
1050 int
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
1051 vixGetCapability (vidix_capability_t * to)
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
1052 {
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
1053 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
1054 return 0;
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
1055 }
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 * @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
1059 *
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
1060 * @param fourcc input image format.
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
1061 *
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
1062 * @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
1063 * 0 otherwise.
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
1064 */
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
1065 static int
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
1066 is_supported_fourcc (uint32_t fourcc)
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
1067 {
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
1068 switch (fourcc)
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
1069 {
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
1070 //FIXME: YV12 isnt working properly yet
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
1071 // case IMGFMT_YV12:
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
1072 // case IMGFMT_I420:
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
1073 case IMGFMT_UYVY:
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
1074 case IMGFMT_YVYU:
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
1075 case IMGFMT_YUY2:
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
1076 case IMGFMT_RGB15:
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
1077 case IMGFMT_RGB16:
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
1078 // case IMGFMT_BGR32:
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
1079 return 1;
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
1080 default:
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
1081 return 0;
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
1082 }
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 * @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
1087 *
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
1088 * @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
1089 *
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
1090 * @returns 0 if ok.
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
1091 * errno otherwise.
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
1092 */
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
1093 int
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
1094 vixQueryFourcc (vidix_fourcc_t * to)
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
1095 {
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
1096 if (is_supported_fourcc (to->fourcc))
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
1097 {
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
1098 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
1099 VID_DEPTH_4BPP | VID_DEPTH_8BPP |
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
1100 VID_DEPTH_12BPP | VID_DEPTH_15BPP |
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
1101 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
1102 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
1103 return 0;
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
1104 }
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
1105 else
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
1106 to->depth = to->flags = 0;
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
1107
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
1108 return ENOSYS;
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
1109 }
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 * @brief Get the GrKeys
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
1113 *
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
1114 * @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
1115 *
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
1116 * @return 0.
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
1117 */
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
1118 /*int
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
1119 vixGetGrKeys (vidix_grkey_t * grkey)
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
1120 {
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 // 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
1123
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
1124 return (0);
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
1125 }
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 * @brief Set the GrKeys
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
1130 *
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
1131 * @param grkey Colorkey to be set.
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
1132 *
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
1133 * @return 0.
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
1134 */
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
1135 int
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
1136 vixSetGrKeys (const vidix_grkey_t * grkey)
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
1137 {
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
1138 if (grkey->ckey.op == CKEY_FALSE)
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
1139 {
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
1140 info->use_colorkey = 0;
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
1141 info->vidixcolorkey=0;
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
1142 printf("[savage_vid] colorkeying disabled\n");
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
1143 }
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
1144 else {
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
1145 info->use_colorkey = 1;
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
1146 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
1147
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
1148 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
1149 }
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
1150 //FIXME: freezes if streams arent enabled
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
1151 SavageSetColorKeyOld();
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
1152 return (0);
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
1153 }
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 * @brief Unichrome driver equalizer capabilities.
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
1157 */
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
1158 vidix_video_eq_t equal = {
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
1159 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
1160 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
1161 };
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 * @brief Get the equalizer capabilities.
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
1166 *
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
1167 * @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
1168 *
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
1169 * @return 0.
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
1170 */
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
1171 int
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
1172 vixPlaybackGetEq (vidix_video_eq_t * eq)
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
1173 {
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
1174 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
1175 return 0;
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
1176 }
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 * @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
1180 *
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
1181 * @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
1182 *
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
1183 * @return 0.
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
1184 */
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
1185 int
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
1186 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
1187 {
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
1188 return 0;
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
1189 }
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 * @brief Y, U, V offsets.
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
1193 */
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
1194 static int YOffs, UOffs, VOffs;
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
1195
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 * @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
1198 *
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
1199 * @param info configuration description for playback.
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
1200 *
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
1201 * @returns 0 in case of success.
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
1202 * -1 otherwise.
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
1203 */
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
1204 int
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
1205 vixConfigPlayback (vidix_playback_t * vinfo)
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
1206 {
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
1207 int uv_size, swap_uv;
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
1208 unsigned int i;
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
1209 int extfifo_on;
14215
9c33810bbc7b 1l misplaced variable declaration
rtognimp
parents: 14203
diff changeset
1210 int srcPitch,srcPitch2;
14203
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
1211
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
1212 /* Overlay register settings */
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
1213 uint32_t win_start, win_end;
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
1214 uint32_t zoom, mini;
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
1215 uint32_t dcount, falign, qwfetch;
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
1216 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
1217 uint32_t v_ctrl, fifo_ctrl;
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
1218
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
1219 if (!is_supported_fourcc (vinfo->fourcc))
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
1220 return -1;
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
1221
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 info->src_w = vinfo->src.w;
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
1225 info->src_h = vinfo->src.h;
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
1226
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
1227 info->drw_w = vinfo->dest.w;
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
1228 info->drw_h = vinfo->dest.h;
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
1229
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
1230 info->wx = vinfo->dest.x;
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
1231 info->wy = vinfo->dest.y;
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
1232 info->format = vinfo->fourcc;
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
1233
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
1234 info->lastKnownPitch = 0;
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
1235 info->brightness = 0;
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
1236 info->contrast = 128;
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
1237 info->saturation = 128;
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
1238 info->hue = 0;
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
1239
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 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
1242
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 vinfo->offset.y = 0;
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
1245 vinfo->offset.v = 0;
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
1246 vinfo->offset.u = 0;
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
1247
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
1248 vinfo->dest.pitch.y = 32;
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
1249 vinfo->dest.pitch.u = 32;
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
1250 vinfo->dest.pitch.v = 32;
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
1251 // vinfo->dest.pitch.u = 0;
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
1252 // vinfo->dest.pitch.v = 0;
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
1253
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 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
1256
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
1257 swap_uv = 0;
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
1258 switch (vinfo->fourcc)
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
1259 {
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
1260 case IMGFMT_YUY2:
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
1261 case IMGFMT_UYVY:
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
1262
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
1263 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
1264
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
1265 info->pitch = info->src_w << 1;
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
1266 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
1267 uv_size = 0;
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
1268 break;
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
1269 case IMGFMT_YV12:
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
1270 swap_uv = 1;
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
1271
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 srcPitch = (info->src_w + 3) & ~3;
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
1276 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
1277 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
1278 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
1279
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
1280 vinfo->dest.pitch.y=srcPitch ;
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
1281 vinfo->dest.pitch.v=srcPitch2 ;
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
1282 vinfo->dest.pitch.u=srcPitch2 ;
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
1283 */
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 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
1287 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
1288
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
1289 vinfo->offset.y = 0;
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
1290 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
1291 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
1292 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
1293 /* YOffs = info->offset.y;
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
1294 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
1295 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
1296 */
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
1297 // vinfo->offset.y = info->src_w;
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
1298 // 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
1299 // 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
1300
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
1301 break;
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
1302 }
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
1303 info->pitch |= ((info->pitch >> 1) << 16);
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
1304
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
1305 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
1306
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
1307 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
1308
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 info->buffer_size = vinfo->frame_size;
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
1313 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
1314 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
1315 // vinfo->num_frames = 1;
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
1316 // 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
1317 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
1318
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
1319 return 0;
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
1320 }
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 * @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
1324 *
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
1325 * @return 0.
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
1326 */
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
1327 int
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
1328 vixPlaybackOn (void)
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
1329 {
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
1330 // FIXME: enable
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
1331 SavageDisplayVideoOld();
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
1332 //FIXME ADD
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
1333 return 0;
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
1334 }
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 * @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
1338 *
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
1339 * @return 0.
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
1340 */
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
1341 int
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
1342 vixPlaybackOff (void)
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
1343 {
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
1344 // 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
1345 // FIXME: shouldnt this be enabled?
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
1346 // SavageStreamsOn();
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
1347 SavageStreamsOff();
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
1348 // info->vidixcolorkey=0x0;
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
1349
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
1350 // 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
1351 // SavageSetColorKeyOld();
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
1352 //FIXME ADD
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
1353 return 0;
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
1354 }
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 * @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
1358 *
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
1359 * @param frame the frame index.
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
1360 *
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
1361 * @return 0.
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
1362 *
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
1363 * @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
1364 * 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
1365 */
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
1366 #if 0
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
1367 int
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
1368 vixPlaybackFrameSelect (unsigned int frame)
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
1369 {
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
1370 ////FIXME ADD
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
1371 // savage_overlay_start(info, frame);
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
1372 //if (info->num_frames >= 1)
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
1373 // 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
1374 //
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
1375 // savage4_waitidle(info);
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
1376
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
1377 printf("vixPlaybackFrameSelect Leave\n" );
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
1378 // 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
1379 // VerticalRetraceWait();
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
1380
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
1381 return 0;
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
1382 }
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 #endif
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
1385
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 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
1389 return ;
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
1390 switch ( addr ){
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
1391 case PSTREAM_CONTROL_REG:
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
1392 fprintf(stderr,"PSTREAM_CONTROL_REG");
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
1393 break;
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
1394 case COL_CHROMA_KEY_CONTROL_REG:
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
1395 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
1396 break;
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
1397 case SSTREAM_CONTROL_REG:
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
1398 fprintf(stderr,"SSTREAM_CONTROL_REG");
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
1399 break;
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
1400 case CHROMA_KEY_UPPER_BOUND_REG:
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
1401 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
1402 break;
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
1403 case SSTREAM_STRETCH_REG:
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
1404 fprintf(stderr,"SSTREAM_STRETCH_REG");
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
1405 break;
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
1406 case COLOR_ADJUSTMENT_REG:
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
1407 fprintf(stderr,"COLOR_ADJUSTMENT_REG");
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
1408 break;
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
1409 case BLEND_CONTROL_REG:
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
1410 fprintf(stderr,"BLEND_CONTROL_REG");
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
1411 break;
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
1412 case PSTREAM_FBADDR0_REG:
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
1413 fprintf(stderr,"PSTREAM_FBADDR0_REG");
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
1414 break;
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
1415 case PSTREAM_FBADDR1_REG:
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
1416 fprintf(stderr,"PSTREAM_FBADDR1_REG");
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
1417 break;
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
1418 case PSTREAM_STRIDE_REG:
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
1419 fprintf(stderr,"PSTREAM_STRIDE_REG");
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
1420 break;
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
1421 case DOUBLE_BUFFER_REG:
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
1422 fprintf(stderr,"DOUBLE_BUFFER_REG");
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
1423 break;
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
1424 case SSTREAM_FBADDR0_REG:
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
1425 fprintf(stderr,"SSTREAM_FBADDR0_REG");
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
1426 break;
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
1427 case SSTREAM_FBADDR1_REG:
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
1428 fprintf(stderr,"SSTREAM_FBADDR1_REG");
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
1429 break;
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
1430 case SSTREAM_STRIDE_REG:
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
1431 fprintf(stderr,"SSTREAM_STRIDE_REG");
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
1432 break;
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
1433 case SSTREAM_VSCALE_REG:
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
1434 fprintf(stderr,"SSTREAM_VSCALE_REG");
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
1435 break;
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
1436 case SSTREAM_VINITIAL_REG:
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
1437 fprintf(stderr,"SSTREAM_VINITIAL_REG");
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
1438 break;
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
1439 case SSTREAM_LINES_REG:
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
1440 fprintf(stderr,"SSTREAM_LINES_REG");
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
1441 break;
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
1442 case STREAMS_FIFO_REG:
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
1443 fprintf(stderr,"STREAMS_FIFO_REG");
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
1444 break;
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
1445 case PSTREAM_WINDOW_START_REG:
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
1446 fprintf(stderr,"PSTREAM_WINDOW_START_REG");
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
1447 break;
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
1448 case PSTREAM_WINDOW_SIZE_REG:
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
1449 fprintf(stderr,"PSTREAM_WINDOW_SIZE_REG");
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
1450 break;
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
1451 case SSTREAM_WINDOW_START_REG:
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
1452 fprintf(stderr,"SSTREAM_WINDOW_START_REG");
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
1453 break;
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
1454 case SSTREAM_WINDOW_SIZE_REG:
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
1455 fprintf(stderr,"SSTREAM_WINDOW_SIZE_REG");
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
1456 break;
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
1457 case FIFO_CONTROL:
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
1458 fprintf(stderr,"FIFO_CONTROL");
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
1459 break;
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
1460 case PSTREAM_FBSIZE_REG:
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
1461 fprintf(stderr,"PSTREAM_FBSIZE_REG");
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
1462 break;
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
1463 case SSTREAM_FBSIZE_REG:
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
1464 fprintf(stderr,"SSTREAM_FBSIZE_REG");
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
1465 break;
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
1466 case SSTREAM_FBADDR2_REG:
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
1467 fprintf(stderr,"SSTREAM_FBADDR2_REG");
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
1468 break;
8be9b0f1e4b6 experimental savage vidix driver by Reza Jelveh <reza.jelveh at tu-harburg.de>
faust3
parents:
diff changeset
1469
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 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
1472 }
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