annotate vidix/drivers/cyberblade_vid.c @ 21455:dd49d3712e6f

Rename: ass_process_font -> ass_add_font.
author eugeni
date Sun, 03 Dec 2006 17:35:40 +0000
parents 6a08d0dabca8
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
8505
d794e866cf5f EPIA (CyberBlade/i1) driver by Alastair M. Robinson
alex
parents:
diff changeset
1 /*
9023
e40760677a83 Updated to v0.1.4 by Alastair Robinson <blackfive@fakenhamweb.co.uk>
alex
parents: 8513
diff changeset
2 Driver for CyberBlade/i1 - Version 0.1.4
8505
d794e866cf5f EPIA (CyberBlade/i1) driver by Alastair M. Robinson
alex
parents:
diff changeset
3
d794e866cf5f EPIA (CyberBlade/i1) driver by Alastair M. Robinson
alex
parents:
diff changeset
4 Copyright (C) 2002 by Alastair M. Robinson.
8513
679abb24a76e more safer version by the author
alex
parents: 8505
diff changeset
5 Official homepage: http://www.blackfiveservices.co.uk/EPIAVidix.shtml
679abb24a76e more safer version by the author
alex
parents: 8505
diff changeset
6
8505
d794e866cf5f EPIA (CyberBlade/i1) driver by Alastair M. Robinson
alex
parents:
diff changeset
7 Based on Permedia 3 driver by Måns Rullgård
d794e866cf5f EPIA (CyberBlade/i1) driver by Alastair M. Robinson
alex
parents:
diff changeset
8
d794e866cf5f EPIA (CyberBlade/i1) driver by Alastair M. Robinson
alex
parents:
diff changeset
9 Thanks to Gilles Frattini for bugfixes
d794e866cf5f EPIA (CyberBlade/i1) driver by Alastair M. Robinson
alex
parents:
diff changeset
10
d794e866cf5f EPIA (CyberBlade/i1) driver by Alastair M. Robinson
alex
parents:
diff changeset
11 This program is free software; you can redistribute it and/or modify
d794e866cf5f EPIA (CyberBlade/i1) driver by Alastair M. Robinson
alex
parents:
diff changeset
12 it under the terms of the GNU General Public License as published by
d794e866cf5f EPIA (CyberBlade/i1) driver by Alastair M. Robinson
alex
parents:
diff changeset
13 the Free Software Foundation; either version 2 of the License, or
d794e866cf5f EPIA (CyberBlade/i1) driver by Alastair M. Robinson
alex
parents:
diff changeset
14 (at your option) any later version.
d794e866cf5f EPIA (CyberBlade/i1) driver by Alastair M. Robinson
alex
parents:
diff changeset
15
d794e866cf5f EPIA (CyberBlade/i1) driver by Alastair M. Robinson
alex
parents:
diff changeset
16 This program is distributed in the hope that it will be useful,
d794e866cf5f EPIA (CyberBlade/i1) driver by Alastair M. Robinson
alex
parents:
diff changeset
17 but WITHOUT ANY WARRANTY; without even the implied warranty of
d794e866cf5f EPIA (CyberBlade/i1) driver by Alastair M. Robinson
alex
parents:
diff changeset
18 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
d794e866cf5f EPIA (CyberBlade/i1) driver by Alastair M. Robinson
alex
parents:
diff changeset
19 GNU General Public License for more details.
d794e866cf5f EPIA (CyberBlade/i1) driver by Alastair M. Robinson
alex
parents:
diff changeset
20
d794e866cf5f EPIA (CyberBlade/i1) driver by Alastair M. Robinson
alex
parents:
diff changeset
21 You should have received a copy of the GNU General Public License
d794e866cf5f EPIA (CyberBlade/i1) driver by Alastair M. Robinson
alex
parents:
diff changeset
22 along with this program; if not, write to the Free Software
17367
401b440a6d76 Update licensing information: The FSF changed postal address.
diego
parents: 13657
diff changeset
23 Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
8505
d794e866cf5f EPIA (CyberBlade/i1) driver by Alastair M. Robinson
alex
parents:
diff changeset
24
9023
e40760677a83 Updated to v0.1.4 by Alastair Robinson <blackfive@fakenhamweb.co.uk>
alex
parents: 8513
diff changeset
25 Changes:
e40760677a83 Updated to v0.1.4 by Alastair Robinson <blackfive@fakenhamweb.co.uk>
alex
parents: 8513
diff changeset
26 18/01/03
e40760677a83 Updated to v0.1.4 by Alastair Robinson <blackfive@fakenhamweb.co.uk>
alex
parents: 8513
diff changeset
27 MMIO is no longer used, sidestepping cache issues on EPIA-800
e40760677a83 Updated to v0.1.4 by Alastair Robinson <blackfive@fakenhamweb.co.uk>
alex
parents: 8513
diff changeset
28 TV-Out modes are now better supported - this should be the end
e40760677a83 Updated to v0.1.4 by Alastair Robinson <blackfive@fakenhamweb.co.uk>
alex
parents: 8513
diff changeset
29 of the magenta stripes :)
e40760677a83 Updated to v0.1.4 by Alastair Robinson <blackfive@fakenhamweb.co.uk>
alex
parents: 8513
diff changeset
30 Brightness/Contrast controls disabled for the time being - they were
e40760677a83 Updated to v0.1.4 by Alastair Robinson <blackfive@fakenhamweb.co.uk>
alex
parents: 8513
diff changeset
31 seriously degrading picture quality, especially with TV-Out.
e40760677a83 Updated to v0.1.4 by Alastair Robinson <blackfive@fakenhamweb.co.uk>
alex
parents: 8513
diff changeset
32
8505
d794e866cf5f EPIA (CyberBlade/i1) driver by Alastair M. Robinson
alex
parents:
diff changeset
33 To Do:
d794e866cf5f EPIA (CyberBlade/i1) driver by Alastair M. Robinson
alex
parents:
diff changeset
34 Implement Hue/Saturation controls
d794e866cf5f EPIA (CyberBlade/i1) driver by Alastair M. Robinson
alex
parents:
diff changeset
35 Support / Test multiple frames
d794e866cf5f EPIA (CyberBlade/i1) driver by Alastair M. Robinson
alex
parents:
diff changeset
36 Test colour-key code more extensively
d794e866cf5f EPIA (CyberBlade/i1) driver by Alastair M. Robinson
alex
parents:
diff changeset
37 */
d794e866cf5f EPIA (CyberBlade/i1) driver by Alastair M. Robinson
alex
parents:
diff changeset
38
d794e866cf5f EPIA (CyberBlade/i1) driver by Alastair M. Robinson
alex
parents:
diff changeset
39 #include <errno.h>
d794e866cf5f EPIA (CyberBlade/i1) driver by Alastair M. Robinson
alex
parents:
diff changeset
40 #include <stdio.h>
d794e866cf5f EPIA (CyberBlade/i1) driver by Alastair M. Robinson
alex
parents:
diff changeset
41 #include <stdlib.h>
d794e866cf5f EPIA (CyberBlade/i1) driver by Alastair M. Robinson
alex
parents:
diff changeset
42 #include <string.h>
d794e866cf5f EPIA (CyberBlade/i1) driver by Alastair M. Robinson
alex
parents:
diff changeset
43 #include <inttypes.h>
d794e866cf5f EPIA (CyberBlade/i1) driver by Alastair M. Robinson
alex
parents:
diff changeset
44 #include <unistd.h>
d794e866cf5f EPIA (CyberBlade/i1) driver by Alastair M. Robinson
alex
parents:
diff changeset
45
d794e866cf5f EPIA (CyberBlade/i1) driver by Alastair M. Robinson
alex
parents:
diff changeset
46 #include "../vidix.h"
d794e866cf5f EPIA (CyberBlade/i1) driver by Alastair M. Robinson
alex
parents:
diff changeset
47 #include "../fourcc.h"
d794e866cf5f EPIA (CyberBlade/i1) driver by Alastair M. Robinson
alex
parents:
diff changeset
48 #include "../../libdha/libdha.h"
d794e866cf5f EPIA (CyberBlade/i1) driver by Alastair M. Robinson
alex
parents:
diff changeset
49 #include "../../libdha/pci_ids.h"
d794e866cf5f EPIA (CyberBlade/i1) driver by Alastair M. Robinson
alex
parents:
diff changeset
50 #include "../../libdha/pci_names.h"
d794e866cf5f EPIA (CyberBlade/i1) driver by Alastair M. Robinson
alex
parents:
diff changeset
51 #include "../../config.h"
d794e866cf5f EPIA (CyberBlade/i1) driver by Alastair M. Robinson
alex
parents:
diff changeset
52
d794e866cf5f EPIA (CyberBlade/i1) driver by Alastair M. Robinson
alex
parents:
diff changeset
53 #include "cyberblade_regs.h"
d794e866cf5f EPIA (CyberBlade/i1) driver by Alastair M. Robinson
alex
parents:
diff changeset
54
d794e866cf5f EPIA (CyberBlade/i1) driver by Alastair M. Robinson
alex
parents:
diff changeset
55 pciinfo_t pci_info;
d794e866cf5f EPIA (CyberBlade/i1) driver by Alastair M. Robinson
alex
parents:
diff changeset
56
d794e866cf5f EPIA (CyberBlade/i1) driver by Alastair M. Robinson
alex
parents:
diff changeset
57 char save_colourkey[6];
9023
e40760677a83 Updated to v0.1.4 by Alastair Robinson <blackfive@fakenhamweb.co.uk>
alex
parents: 8513
diff changeset
58 char *cyberblade_mem;
8505
d794e866cf5f EPIA (CyberBlade/i1) driver by Alastair M. Robinson
alex
parents:
diff changeset
59
9023
e40760677a83 Updated to v0.1.4 by Alastair Robinson <blackfive@fakenhamweb.co.uk>
alex
parents: 8513
diff changeset
60 #ifdef DEBUG_LOGFILE
e40760677a83 Updated to v0.1.4 by Alastair Robinson <blackfive@fakenhamweb.co.uk>
alex
parents: 8513
diff changeset
61 FILE *logfile=0;
e40760677a83 Updated to v0.1.4 by Alastair Robinson <blackfive@fakenhamweb.co.uk>
alex
parents: 8513
diff changeset
62 #define LOGWRITE(x) {if(logfile) fprintf(logfile,x);}
e40760677a83 Updated to v0.1.4 by Alastair Robinson <blackfive@fakenhamweb.co.uk>
alex
parents: 8513
diff changeset
63 #else
e40760677a83 Updated to v0.1.4 by Alastair Robinson <blackfive@fakenhamweb.co.uk>
alex
parents: 8513
diff changeset
64 #define LOGWRITE(x)
e40760677a83 Updated to v0.1.4 by Alastair Robinson <blackfive@fakenhamweb.co.uk>
alex
parents: 8513
diff changeset
65 #endif
e40760677a83 Updated to v0.1.4 by Alastair Robinson <blackfive@fakenhamweb.co.uk>
alex
parents: 8513
diff changeset
66
e40760677a83 Updated to v0.1.4 by Alastair Robinson <blackfive@fakenhamweb.co.uk>
alex
parents: 8513
diff changeset
67 /* Helper functions for reading registers. */
8505
d794e866cf5f EPIA (CyberBlade/i1) driver by Alastair M. Robinson
alex
parents:
diff changeset
68
d794e866cf5f EPIA (CyberBlade/i1) driver by Alastair M. Robinson
alex
parents:
diff changeset
69 static int CRINW(int reg)
d794e866cf5f EPIA (CyberBlade/i1) driver by Alastair M. Robinson
alex
parents:
diff changeset
70 {
d794e866cf5f EPIA (CyberBlade/i1) driver by Alastair M. Robinson
alex
parents:
diff changeset
71 int result;
d794e866cf5f EPIA (CyberBlade/i1) driver by Alastair M. Robinson
alex
parents:
diff changeset
72 result=CRINB(reg);
d794e866cf5f EPIA (CyberBlade/i1) driver by Alastair M. Robinson
alex
parents:
diff changeset
73 result|=CRINB(reg+1)<<8;
d794e866cf5f EPIA (CyberBlade/i1) driver by Alastair M. Robinson
alex
parents:
diff changeset
74 return(result);
d794e866cf5f EPIA (CyberBlade/i1) driver by Alastair M. Robinson
alex
parents:
diff changeset
75 }
d794e866cf5f EPIA (CyberBlade/i1) driver by Alastair M. Robinson
alex
parents:
diff changeset
76
d794e866cf5f EPIA (CyberBlade/i1) driver by Alastair M. Robinson
alex
parents:
diff changeset
77 static void CROUTW(int reg,int val)
d794e866cf5f EPIA (CyberBlade/i1) driver by Alastair M. Robinson
alex
parents:
diff changeset
78 {
d794e866cf5f EPIA (CyberBlade/i1) driver by Alastair M. Robinson
alex
parents:
diff changeset
79 CROUTB(reg,val&255);
d794e866cf5f EPIA (CyberBlade/i1) driver by Alastair M. Robinson
alex
parents:
diff changeset
80 CROUTB(reg+1,(val>>8)&255);
d794e866cf5f EPIA (CyberBlade/i1) driver by Alastair M. Robinson
alex
parents:
diff changeset
81 }
d794e866cf5f EPIA (CyberBlade/i1) driver by Alastair M. Robinson
alex
parents:
diff changeset
82
d794e866cf5f EPIA (CyberBlade/i1) driver by Alastair M. Robinson
alex
parents:
diff changeset
83 static int SRINW(int reg)
d794e866cf5f EPIA (CyberBlade/i1) driver by Alastair M. Robinson
alex
parents:
diff changeset
84 {
d794e866cf5f EPIA (CyberBlade/i1) driver by Alastair M. Robinson
alex
parents:
diff changeset
85 int result;
d794e866cf5f EPIA (CyberBlade/i1) driver by Alastair M. Robinson
alex
parents:
diff changeset
86 result=SRINB(reg);
d794e866cf5f EPIA (CyberBlade/i1) driver by Alastair M. Robinson
alex
parents:
diff changeset
87 result|=SRINB(reg+1)<<8;
d794e866cf5f EPIA (CyberBlade/i1) driver by Alastair M. Robinson
alex
parents:
diff changeset
88 return(result);
d794e866cf5f EPIA (CyberBlade/i1) driver by Alastair M. Robinson
alex
parents:
diff changeset
89 }
d794e866cf5f EPIA (CyberBlade/i1) driver by Alastair M. Robinson
alex
parents:
diff changeset
90
d794e866cf5f EPIA (CyberBlade/i1) driver by Alastair M. Robinson
alex
parents:
diff changeset
91 static void SROUTW(int reg,int val)
d794e866cf5f EPIA (CyberBlade/i1) driver by Alastair M. Robinson
alex
parents:
diff changeset
92 {
d794e866cf5f EPIA (CyberBlade/i1) driver by Alastair M. Robinson
alex
parents:
diff changeset
93 SROUTB(reg,val&255);
d794e866cf5f EPIA (CyberBlade/i1) driver by Alastair M. Robinson
alex
parents:
diff changeset
94 SROUTB(reg+1,(val>>8)&255);
d794e866cf5f EPIA (CyberBlade/i1) driver by Alastair M. Robinson
alex
parents:
diff changeset
95 }
d794e866cf5f EPIA (CyberBlade/i1) driver by Alastair M. Robinson
alex
parents:
diff changeset
96
17566
f580a7755ac5 Patch by Stefan Huehner / stefan % huehner ! org \
rathann
parents: 17367
diff changeset
97 void DumpRegisters(void)
9023
e40760677a83 Updated to v0.1.4 by Alastair Robinson <blackfive@fakenhamweb.co.uk>
alex
parents: 8513
diff changeset
98 {
e40760677a83 Updated to v0.1.4 by Alastair Robinson <blackfive@fakenhamweb.co.uk>
alex
parents: 8513
diff changeset
99 int reg,val;
e40760677a83 Updated to v0.1.4 by Alastair Robinson <blackfive@fakenhamweb.co.uk>
alex
parents: 8513
diff changeset
100 #ifdef DEBUG_LOGFILE
e40760677a83 Updated to v0.1.4 by Alastair Robinson <blackfive@fakenhamweb.co.uk>
alex
parents: 8513
diff changeset
101 if(logfile)
e40760677a83 Updated to v0.1.4 by Alastair Robinson <blackfive@fakenhamweb.co.uk>
alex
parents: 8513
diff changeset
102 {
e40760677a83 Updated to v0.1.4 by Alastair Robinson <blackfive@fakenhamweb.co.uk>
alex
parents: 8513
diff changeset
103 LOGWRITE("CRTC Register Dump:\n")
e40760677a83 Updated to v0.1.4 by Alastair Robinson <blackfive@fakenhamweb.co.uk>
alex
parents: 8513
diff changeset
104 for(reg=0;reg<256;++reg)
e40760677a83 Updated to v0.1.4 by Alastair Robinson <blackfive@fakenhamweb.co.uk>
alex
parents: 8513
diff changeset
105 {
e40760677a83 Updated to v0.1.4 by Alastair Robinson <blackfive@fakenhamweb.co.uk>
alex
parents: 8513
diff changeset
106 val=CRINB(reg);
e40760677a83 Updated to v0.1.4 by Alastair Robinson <blackfive@fakenhamweb.co.uk>
alex
parents: 8513
diff changeset
107 fprintf(logfile,"CR0x%2x: 0x%2x\n",reg,val);
e40760677a83 Updated to v0.1.4 by Alastair Robinson <blackfive@fakenhamweb.co.uk>
alex
parents: 8513
diff changeset
108 }
e40760677a83 Updated to v0.1.4 by Alastair Robinson <blackfive@fakenhamweb.co.uk>
alex
parents: 8513
diff changeset
109 LOGWRITE("SR Register Dump:\n")
e40760677a83 Updated to v0.1.4 by Alastair Robinson <blackfive@fakenhamweb.co.uk>
alex
parents: 8513
diff changeset
110 for(reg=0;reg<256;++reg)
e40760677a83 Updated to v0.1.4 by Alastair Robinson <blackfive@fakenhamweb.co.uk>
alex
parents: 8513
diff changeset
111 {
e40760677a83 Updated to v0.1.4 by Alastair Robinson <blackfive@fakenhamweb.co.uk>
alex
parents: 8513
diff changeset
112 val=SRINB(reg);
e40760677a83 Updated to v0.1.4 by Alastair Robinson <blackfive@fakenhamweb.co.uk>
alex
parents: 8513
diff changeset
113 fprintf(logfile,"SR0x%2x: 0x%2x\n",reg,val);
e40760677a83 Updated to v0.1.4 by Alastair Robinson <blackfive@fakenhamweb.co.uk>
alex
parents: 8513
diff changeset
114 }
e40760677a83 Updated to v0.1.4 by Alastair Robinson <blackfive@fakenhamweb.co.uk>
alex
parents: 8513
diff changeset
115 }
e40760677a83 Updated to v0.1.4 by Alastair Robinson <blackfive@fakenhamweb.co.uk>
alex
parents: 8513
diff changeset
116 #endif
e40760677a83 Updated to v0.1.4 by Alastair Robinson <blackfive@fakenhamweb.co.uk>
alex
parents: 8513
diff changeset
117 }
8505
d794e866cf5f EPIA (CyberBlade/i1) driver by Alastair M. Robinson
alex
parents:
diff changeset
118 /* --- */
d794e866cf5f EPIA (CyberBlade/i1) driver by Alastair M. Robinson
alex
parents:
diff changeset
119
d794e866cf5f EPIA (CyberBlade/i1) driver by Alastair M. Robinson
alex
parents:
diff changeset
120 static vidix_capability_t cyberblade_cap =
d794e866cf5f EPIA (CyberBlade/i1) driver by Alastair M. Robinson
alex
parents:
diff changeset
121 {
d794e866cf5f EPIA (CyberBlade/i1) driver by Alastair M. Robinson
alex
parents:
diff changeset
122 "Trident CyberBlade i1 driver",
d794e866cf5f EPIA (CyberBlade/i1) driver by Alastair M. Robinson
alex
parents:
diff changeset
123 "Alastair M. Robinson <blackfive@fakenhamweb.co.uk>",
d794e866cf5f EPIA (CyberBlade/i1) driver by Alastair M. Robinson
alex
parents:
diff changeset
124 TYPE_OUTPUT,
d794e866cf5f EPIA (CyberBlade/i1) driver by Alastair M. Robinson
alex
parents:
diff changeset
125 { 0, 0, 0, 0 },
d794e866cf5f EPIA (CyberBlade/i1) driver by Alastair M. Robinson
alex
parents:
diff changeset
126 1024,
d794e866cf5f EPIA (CyberBlade/i1) driver by Alastair M. Robinson
alex
parents:
diff changeset
127 1024,
d794e866cf5f EPIA (CyberBlade/i1) driver by Alastair M. Robinson
alex
parents:
diff changeset
128 4,
d794e866cf5f EPIA (CyberBlade/i1) driver by Alastair M. Robinson
alex
parents:
diff changeset
129 4,
d794e866cf5f EPIA (CyberBlade/i1) driver by Alastair M. Robinson
alex
parents:
diff changeset
130 -1,
d794e866cf5f EPIA (CyberBlade/i1) driver by Alastair M. Robinson
alex
parents:
diff changeset
131 FLAG_UPSCALER|FLAG_DOWNSCALER,
d794e866cf5f EPIA (CyberBlade/i1) driver by Alastair M. Robinson
alex
parents:
diff changeset
132 VENDOR_TRIDENT,
d794e866cf5f EPIA (CyberBlade/i1) driver by Alastair M. Robinson
alex
parents:
diff changeset
133 -1,
d794e866cf5f EPIA (CyberBlade/i1) driver by Alastair M. Robinson
alex
parents:
diff changeset
134 { 0, 0, 0, 0 }
d794e866cf5f EPIA (CyberBlade/i1) driver by Alastair M. Robinson
alex
parents:
diff changeset
135 };
d794e866cf5f EPIA (CyberBlade/i1) driver by Alastair M. Robinson
alex
parents:
diff changeset
136
d794e866cf5f EPIA (CyberBlade/i1) driver by Alastair M. Robinson
alex
parents:
diff changeset
137
d794e866cf5f EPIA (CyberBlade/i1) driver by Alastair M. Robinson
alex
parents:
diff changeset
138 unsigned int vixGetVersion(void)
d794e866cf5f EPIA (CyberBlade/i1) driver by Alastair M. Robinson
alex
parents:
diff changeset
139 {
d794e866cf5f EPIA (CyberBlade/i1) driver by Alastair M. Robinson
alex
parents:
diff changeset
140 return(VIDIX_VERSION);
d794e866cf5f EPIA (CyberBlade/i1) driver by Alastair M. Robinson
alex
parents:
diff changeset
141 }
d794e866cf5f EPIA (CyberBlade/i1) driver by Alastair M. Robinson
alex
parents:
diff changeset
142
d794e866cf5f EPIA (CyberBlade/i1) driver by Alastair M. Robinson
alex
parents:
diff changeset
143
d794e866cf5f EPIA (CyberBlade/i1) driver by Alastair M. Robinson
alex
parents:
diff changeset
144 static unsigned short cyberblade_card_ids[] =
d794e866cf5f EPIA (CyberBlade/i1) driver by Alastair M. Robinson
alex
parents:
diff changeset
145 {
13657
1255d1604e00 Added new PCI IDS, patch by Benjamin Zores <ben@tutuxclan.org>
faust3
parents: 13656
diff changeset
146 DEVICE_TRIDENT_CYBERBLADE_I7,
1255d1604e00 Added new PCI IDS, patch by Benjamin Zores <ben@tutuxclan.org>
faust3
parents: 13656
diff changeset
147 DEVICE_TRIDENT_CYBERBLADE_I7D,
1255d1604e00 Added new PCI IDS, patch by Benjamin Zores <ben@tutuxclan.org>
faust3
parents: 13656
diff changeset
148 DEVICE_TRIDENT_CYBERBLADE_I1,
1255d1604e00 Added new PCI IDS, patch by Benjamin Zores <ben@tutuxclan.org>
faust3
parents: 13656
diff changeset
149 DEVICE_TRIDENT_CYBERBLADE_I12,
1255d1604e00 Added new PCI IDS, patch by Benjamin Zores <ben@tutuxclan.org>
faust3
parents: 13656
diff changeset
150 DEVICE_TRIDENT_CYBERBLADE_I13,
1255d1604e00 Added new PCI IDS, patch by Benjamin Zores <ben@tutuxclan.org>
faust3
parents: 13656
diff changeset
151 DEVICE_TRIDENT_CYBERBLADE_XPAI1
8505
d794e866cf5f EPIA (CyberBlade/i1) driver by Alastair M. Robinson
alex
parents:
diff changeset
152 };
d794e866cf5f EPIA (CyberBlade/i1) driver by Alastair M. Robinson
alex
parents:
diff changeset
153
d794e866cf5f EPIA (CyberBlade/i1) driver by Alastair M. Robinson
alex
parents:
diff changeset
154
d794e866cf5f EPIA (CyberBlade/i1) driver by Alastair M. Robinson
alex
parents:
diff changeset
155 static int find_chip(unsigned chip_id)
d794e866cf5f EPIA (CyberBlade/i1) driver by Alastair M. Robinson
alex
parents:
diff changeset
156 {
d794e866cf5f EPIA (CyberBlade/i1) driver by Alastair M. Robinson
alex
parents:
diff changeset
157 unsigned i;
d794e866cf5f EPIA (CyberBlade/i1) driver by Alastair M. Robinson
alex
parents:
diff changeset
158 for(i = 0;i < sizeof(cyberblade_card_ids)/sizeof(unsigned short);i++)
d794e866cf5f EPIA (CyberBlade/i1) driver by Alastair M. Robinson
alex
parents:
diff changeset
159 {
d794e866cf5f EPIA (CyberBlade/i1) driver by Alastair M. Robinson
alex
parents:
diff changeset
160 if(chip_id == cyberblade_card_ids[i]) return i;
d794e866cf5f EPIA (CyberBlade/i1) driver by Alastair M. Robinson
alex
parents:
diff changeset
161 }
d794e866cf5f EPIA (CyberBlade/i1) driver by Alastair M. Robinson
alex
parents:
diff changeset
162 return -1;
d794e866cf5f EPIA (CyberBlade/i1) driver by Alastair M. Robinson
alex
parents:
diff changeset
163 }
d794e866cf5f EPIA (CyberBlade/i1) driver by Alastair M. Robinson
alex
parents:
diff changeset
164
d794e866cf5f EPIA (CyberBlade/i1) driver by Alastair M. Robinson
alex
parents:
diff changeset
165 int vixProbe(int verbose, int force)
d794e866cf5f EPIA (CyberBlade/i1) driver by Alastair M. Robinson
alex
parents:
diff changeset
166 {
d794e866cf5f EPIA (CyberBlade/i1) driver by Alastair M. Robinson
alex
parents:
diff changeset
167 pciinfo_t lst[MAX_PCI_DEVICES];
d794e866cf5f EPIA (CyberBlade/i1) driver by Alastair M. Robinson
alex
parents:
diff changeset
168 unsigned i,num_pci;
d794e866cf5f EPIA (CyberBlade/i1) driver by Alastair M. Robinson
alex
parents:
diff changeset
169 int err;
d794e866cf5f EPIA (CyberBlade/i1) driver by Alastair M. Robinson
alex
parents:
diff changeset
170 err = pci_scan(lst,&num_pci);
d794e866cf5f EPIA (CyberBlade/i1) driver by Alastair M. Robinson
alex
parents:
diff changeset
171 if(err)
d794e866cf5f EPIA (CyberBlade/i1) driver by Alastair M. Robinson
alex
parents:
diff changeset
172 {
11678
972d1998bde9 occured --> occurred typo patch by Clinton Roy <croy@dstc.edu.au>
diego
parents: 9767
diff changeset
173 printf("[cyberblade] Error occurred during pci scan: %s\n",strerror(err));
8505
d794e866cf5f EPIA (CyberBlade/i1) driver by Alastair M. Robinson
alex
parents:
diff changeset
174 return err;
d794e866cf5f EPIA (CyberBlade/i1) driver by Alastair M. Robinson
alex
parents:
diff changeset
175 }
d794e866cf5f EPIA (CyberBlade/i1) driver by Alastair M. Robinson
alex
parents:
diff changeset
176 else
d794e866cf5f EPIA (CyberBlade/i1) driver by Alastair M. Robinson
alex
parents:
diff changeset
177 {
d794e866cf5f EPIA (CyberBlade/i1) driver by Alastair M. Robinson
alex
parents:
diff changeset
178 err = ENXIO;
d794e866cf5f EPIA (CyberBlade/i1) driver by Alastair M. Robinson
alex
parents:
diff changeset
179 for(i=0; i < num_pci; i++)
d794e866cf5f EPIA (CyberBlade/i1) driver by Alastair M. Robinson
alex
parents:
diff changeset
180 {
d794e866cf5f EPIA (CyberBlade/i1) driver by Alastair M. Robinson
alex
parents:
diff changeset
181 if(lst[i].vendor == VENDOR_TRIDENT)
d794e866cf5f EPIA (CyberBlade/i1) driver by Alastair M. Robinson
alex
parents:
diff changeset
182 {
d794e866cf5f EPIA (CyberBlade/i1) driver by Alastair M. Robinson
alex
parents:
diff changeset
183 int idx;
d794e866cf5f EPIA (CyberBlade/i1) driver by Alastair M. Robinson
alex
parents:
diff changeset
184 const char *dname;
d794e866cf5f EPIA (CyberBlade/i1) driver by Alastair M. Robinson
alex
parents:
diff changeset
185 idx = find_chip(lst[i].device);
d794e866cf5f EPIA (CyberBlade/i1) driver by Alastair M. Robinson
alex
parents:
diff changeset
186 if(idx == -1)
d794e866cf5f EPIA (CyberBlade/i1) driver by Alastair M. Robinson
alex
parents:
diff changeset
187 continue;
d794e866cf5f EPIA (CyberBlade/i1) driver by Alastair M. Robinson
alex
parents:
diff changeset
188 dname = pci_device_name(VENDOR_TRIDENT, lst[i].device);
d794e866cf5f EPIA (CyberBlade/i1) driver by Alastair M. Robinson
alex
parents:
diff changeset
189 dname = dname ? dname : "Unknown chip";
d794e866cf5f EPIA (CyberBlade/i1) driver by Alastair M. Robinson
alex
parents:
diff changeset
190 printf("[cyberblade] Found chip: %s\n", dname);
9767
f6d2772efca3 Ignore disabled cards. (Jon Burgess <jburgess@uklinux.net>)
ranma
parents: 9023
diff changeset
191 if ((lst[i].command & PCI_COMMAND_IO) == 0)
f6d2772efca3 Ignore disabled cards. (Jon Burgess <jburgess@uklinux.net>)
ranma
parents: 9023
diff changeset
192 {
f6d2772efca3 Ignore disabled cards. (Jon Burgess <jburgess@uklinux.net>)
ranma
parents: 9023
diff changeset
193 printf("[cyberblade] Device is disabled, ignoring\n");
f6d2772efca3 Ignore disabled cards. (Jon Burgess <jburgess@uklinux.net>)
ranma
parents: 9023
diff changeset
194 continue;
f6d2772efca3 Ignore disabled cards. (Jon Burgess <jburgess@uklinux.net>)
ranma
parents: 9023
diff changeset
195 }
8505
d794e866cf5f EPIA (CyberBlade/i1) driver by Alastair M. Robinson
alex
parents:
diff changeset
196 cyberblade_cap.device_id = lst[i].device;
d794e866cf5f EPIA (CyberBlade/i1) driver by Alastair M. Robinson
alex
parents:
diff changeset
197 err = 0;
d794e866cf5f EPIA (CyberBlade/i1) driver by Alastair M. Robinson
alex
parents:
diff changeset
198 memcpy(&pci_info, &lst[i], sizeof(pciinfo_t));
d794e866cf5f EPIA (CyberBlade/i1) driver by Alastair M. Robinson
alex
parents:
diff changeset
199 break;
d794e866cf5f EPIA (CyberBlade/i1) driver by Alastair M. Robinson
alex
parents:
diff changeset
200 }
d794e866cf5f EPIA (CyberBlade/i1) driver by Alastair M. Robinson
alex
parents:
diff changeset
201 }
d794e866cf5f EPIA (CyberBlade/i1) driver by Alastair M. Robinson
alex
parents:
diff changeset
202 }
d794e866cf5f EPIA (CyberBlade/i1) driver by Alastair M. Robinson
alex
parents:
diff changeset
203
d794e866cf5f EPIA (CyberBlade/i1) driver by Alastair M. Robinson
alex
parents:
diff changeset
204 if(err && verbose) printf("[cyberblade] Can't find chip\n");
d794e866cf5f EPIA (CyberBlade/i1) driver by Alastair M. Robinson
alex
parents:
diff changeset
205 return err;
d794e866cf5f EPIA (CyberBlade/i1) driver by Alastair M. Robinson
alex
parents:
diff changeset
206 }
d794e866cf5f EPIA (CyberBlade/i1) driver by Alastair M. Robinson
alex
parents:
diff changeset
207
d794e866cf5f EPIA (CyberBlade/i1) driver by Alastair M. Robinson
alex
parents:
diff changeset
208
d794e866cf5f EPIA (CyberBlade/i1) driver by Alastair M. Robinson
alex
parents:
diff changeset
209 int vixInit(void)
d794e866cf5f EPIA (CyberBlade/i1) driver by Alastair M. Robinson
alex
parents:
diff changeset
210 {
9023
e40760677a83 Updated to v0.1.4 by Alastair Robinson <blackfive@fakenhamweb.co.uk>
alex
parents: 8513
diff changeset
211 cyberblade_mem = map_phys_mem(pci_info.base0, 0x800000);
e40760677a83 Updated to v0.1.4 by Alastair Robinson <blackfive@fakenhamweb.co.uk>
alex
parents: 8513
diff changeset
212 enable_app_io();
8505
d794e866cf5f EPIA (CyberBlade/i1) driver by Alastair M. Robinson
alex
parents:
diff changeset
213 save_colourkey[0]=SRINB(0x50);
d794e866cf5f EPIA (CyberBlade/i1) driver by Alastair M. Robinson
alex
parents:
diff changeset
214 save_colourkey[1]=SRINB(0x51);
d794e866cf5f EPIA (CyberBlade/i1) driver by Alastair M. Robinson
alex
parents:
diff changeset
215 save_colourkey[2]=SRINB(0x52);
d794e866cf5f EPIA (CyberBlade/i1) driver by Alastair M. Robinson
alex
parents:
diff changeset
216 save_colourkey[3]=SRINB(0x54);
d794e866cf5f EPIA (CyberBlade/i1) driver by Alastair M. Robinson
alex
parents:
diff changeset
217 save_colourkey[4]=SRINB(0x55);
d794e866cf5f EPIA (CyberBlade/i1) driver by Alastair M. Robinson
alex
parents:
diff changeset
218 save_colourkey[5]=SRINB(0x56);
9023
e40760677a83 Updated to v0.1.4 by Alastair Robinson <blackfive@fakenhamweb.co.uk>
alex
parents: 8513
diff changeset
219 #ifdef DEBUG_LOGFILE
e40760677a83 Updated to v0.1.4 by Alastair Robinson <blackfive@fakenhamweb.co.uk>
alex
parents: 8513
diff changeset
220 logfile=fopen("/tmp/cyberblade_vidix.log","w");
e40760677a83 Updated to v0.1.4 by Alastair Robinson <blackfive@fakenhamweb.co.uk>
alex
parents: 8513
diff changeset
221 #endif
8505
d794e866cf5f EPIA (CyberBlade/i1) driver by Alastair M. Robinson
alex
parents:
diff changeset
222 return 0;
d794e866cf5f EPIA (CyberBlade/i1) driver by Alastair M. Robinson
alex
parents:
diff changeset
223 }
d794e866cf5f EPIA (CyberBlade/i1) driver by Alastair M. Robinson
alex
parents:
diff changeset
224
d794e866cf5f EPIA (CyberBlade/i1) driver by Alastair M. Robinson
alex
parents:
diff changeset
225 void vixDestroy(void)
d794e866cf5f EPIA (CyberBlade/i1) driver by Alastair M. Robinson
alex
parents:
diff changeset
226 {
d794e866cf5f EPIA (CyberBlade/i1) driver by Alastair M. Robinson
alex
parents:
diff changeset
227 int protect;
9023
e40760677a83 Updated to v0.1.4 by Alastair Robinson <blackfive@fakenhamweb.co.uk>
alex
parents: 8513
diff changeset
228 #ifdef DEBUG_LOGFILE
e40760677a83 Updated to v0.1.4 by Alastair Robinson <blackfive@fakenhamweb.co.uk>
alex
parents: 8513
diff changeset
229 if(logfile)
e40760677a83 Updated to v0.1.4 by Alastair Robinson <blackfive@fakenhamweb.co.uk>
alex
parents: 8513
diff changeset
230 fclose(logfile);
e40760677a83 Updated to v0.1.4 by Alastair Robinson <blackfive@fakenhamweb.co.uk>
alex
parents: 8513
diff changeset
231 #endif
8505
d794e866cf5f EPIA (CyberBlade/i1) driver by Alastair M. Robinson
alex
parents:
diff changeset
232 protect=SRINB(0x11);
d794e866cf5f EPIA (CyberBlade/i1) driver by Alastair M. Robinson
alex
parents:
diff changeset
233 SROUTB(0x11, 0x92);
d794e866cf5f EPIA (CyberBlade/i1) driver by Alastair M. Robinson
alex
parents:
diff changeset
234 CROUTB(0x8E, 0xc4); /* Disable overlay */
d794e866cf5f EPIA (CyberBlade/i1) driver by Alastair M. Robinson
alex
parents:
diff changeset
235 SROUTB(0x50,save_colourkey[0]);
d794e866cf5f EPIA (CyberBlade/i1) driver by Alastair M. Robinson
alex
parents:
diff changeset
236 SROUTB(0x51,save_colourkey[1]);
d794e866cf5f EPIA (CyberBlade/i1) driver by Alastair M. Robinson
alex
parents:
diff changeset
237 SROUTB(0x52,save_colourkey[2]);
d794e866cf5f EPIA (CyberBlade/i1) driver by Alastair M. Robinson
alex
parents:
diff changeset
238 SROUTB(0x54,save_colourkey[3]);
d794e866cf5f EPIA (CyberBlade/i1) driver by Alastair M. Robinson
alex
parents:
diff changeset
239 SROUTB(0x55,save_colourkey[4]);
d794e866cf5f EPIA (CyberBlade/i1) driver by Alastair M. Robinson
alex
parents:
diff changeset
240 SROUTB(0x56,save_colourkey[5]);
d794e866cf5f EPIA (CyberBlade/i1) driver by Alastair M. Robinson
alex
parents:
diff changeset
241 SROUTB(0x11, protect);
8513
679abb24a76e more safer version by the author
alex
parents: 8505
diff changeset
242 disable_app_io();
9023
e40760677a83 Updated to v0.1.4 by Alastair Robinson <blackfive@fakenhamweb.co.uk>
alex
parents: 8513
diff changeset
243 unmap_phys_mem(cyberblade_mem, 0x800000);
8505
d794e866cf5f EPIA (CyberBlade/i1) driver by Alastair M. Robinson
alex
parents:
diff changeset
244 }
d794e866cf5f EPIA (CyberBlade/i1) driver by Alastair M. Robinson
alex
parents:
diff changeset
245
d794e866cf5f EPIA (CyberBlade/i1) driver by Alastair M. Robinson
alex
parents:
diff changeset
246
d794e866cf5f EPIA (CyberBlade/i1) driver by Alastair M. Robinson
alex
parents:
diff changeset
247 int vixGetCapability(vidix_capability_t *to)
d794e866cf5f EPIA (CyberBlade/i1) driver by Alastair M. Robinson
alex
parents:
diff changeset
248 {
d794e866cf5f EPIA (CyberBlade/i1) driver by Alastair M. Robinson
alex
parents:
diff changeset
249 memcpy(to, &cyberblade_cap, sizeof(vidix_capability_t));
d794e866cf5f EPIA (CyberBlade/i1) driver by Alastair M. Robinson
alex
parents:
diff changeset
250 return 0;
d794e866cf5f EPIA (CyberBlade/i1) driver by Alastair M. Robinson
alex
parents:
diff changeset
251 }
d794e866cf5f EPIA (CyberBlade/i1) driver by Alastair M. Robinson
alex
parents:
diff changeset
252
d794e866cf5f EPIA (CyberBlade/i1) driver by Alastair M. Robinson
alex
parents:
diff changeset
253
d794e866cf5f EPIA (CyberBlade/i1) driver by Alastair M. Robinson
alex
parents:
diff changeset
254 static int is_supported_fourcc(uint32_t fourcc)
d794e866cf5f EPIA (CyberBlade/i1) driver by Alastair M. Robinson
alex
parents:
diff changeset
255 {
d794e866cf5f EPIA (CyberBlade/i1) driver by Alastair M. Robinson
alex
parents:
diff changeset
256 switch(fourcc)
d794e866cf5f EPIA (CyberBlade/i1) driver by Alastair M. Robinson
alex
parents:
diff changeset
257 {
d794e866cf5f EPIA (CyberBlade/i1) driver by Alastair M. Robinson
alex
parents:
diff changeset
258 case IMGFMT_YUY2:
d794e866cf5f EPIA (CyberBlade/i1) driver by Alastair M. Robinson
alex
parents:
diff changeset
259 case IMGFMT_YV12:
13656
99b443dd45a8 I420 support patch by Benjamin Zores <ben@tutuxclan.org>
faust3
parents: 13604
diff changeset
260 case IMGFMT_I420:
8505
d794e866cf5f EPIA (CyberBlade/i1) driver by Alastair M. Robinson
alex
parents:
diff changeset
261 case IMGFMT_YVU9:
d794e866cf5f EPIA (CyberBlade/i1) driver by Alastair M. Robinson
alex
parents:
diff changeset
262 case IMGFMT_BGR16:
d794e866cf5f EPIA (CyberBlade/i1) driver by Alastair M. Robinson
alex
parents:
diff changeset
263 return 1;
d794e866cf5f EPIA (CyberBlade/i1) driver by Alastair M. Robinson
alex
parents:
diff changeset
264 default:
d794e866cf5f EPIA (CyberBlade/i1) driver by Alastair M. Robinson
alex
parents:
diff changeset
265 return 0;
d794e866cf5f EPIA (CyberBlade/i1) driver by Alastair M. Robinson
alex
parents:
diff changeset
266 }
d794e866cf5f EPIA (CyberBlade/i1) driver by Alastair M. Robinson
alex
parents:
diff changeset
267 }
d794e866cf5f EPIA (CyberBlade/i1) driver by Alastair M. Robinson
alex
parents:
diff changeset
268
d794e866cf5f EPIA (CyberBlade/i1) driver by Alastair M. Robinson
alex
parents:
diff changeset
269 int vixQueryFourcc(vidix_fourcc_t *to)
d794e866cf5f EPIA (CyberBlade/i1) driver by Alastair M. Robinson
alex
parents:
diff changeset
270 {
d794e866cf5f EPIA (CyberBlade/i1) driver by Alastair M. Robinson
alex
parents:
diff changeset
271 if(is_supported_fourcc(to->fourcc))
d794e866cf5f EPIA (CyberBlade/i1) driver by Alastair M. Robinson
alex
parents:
diff changeset
272 {
d794e866cf5f EPIA (CyberBlade/i1) driver by Alastair M. Robinson
alex
parents:
diff changeset
273 to->depth = VID_DEPTH_1BPP | VID_DEPTH_2BPP |
d794e866cf5f EPIA (CyberBlade/i1) driver by Alastair M. Robinson
alex
parents:
diff changeset
274 VID_DEPTH_4BPP | VID_DEPTH_8BPP |
d794e866cf5f EPIA (CyberBlade/i1) driver by Alastair M. Robinson
alex
parents:
diff changeset
275 VID_DEPTH_12BPP| VID_DEPTH_15BPP|
d794e866cf5f EPIA (CyberBlade/i1) driver by Alastair M. Robinson
alex
parents:
diff changeset
276 VID_DEPTH_16BPP| VID_DEPTH_24BPP|
d794e866cf5f EPIA (CyberBlade/i1) driver by Alastair M. Robinson
alex
parents:
diff changeset
277 VID_DEPTH_32BPP;
d794e866cf5f EPIA (CyberBlade/i1) driver by Alastair M. Robinson
alex
parents:
diff changeset
278 to->flags = VID_CAP_EXPAND | VID_CAP_SHRINK | VID_CAP_COLORKEY;
d794e866cf5f EPIA (CyberBlade/i1) driver by Alastair M. Robinson
alex
parents:
diff changeset
279 return 0;
d794e866cf5f EPIA (CyberBlade/i1) driver by Alastair M. Robinson
alex
parents:
diff changeset
280 }
d794e866cf5f EPIA (CyberBlade/i1) driver by Alastair M. Robinson
alex
parents:
diff changeset
281 else
d794e866cf5f EPIA (CyberBlade/i1) driver by Alastair M. Robinson
alex
parents:
diff changeset
282 to->depth = to->flags = 0;
d794e866cf5f EPIA (CyberBlade/i1) driver by Alastair M. Robinson
alex
parents:
diff changeset
283 return ENOSYS;
d794e866cf5f EPIA (CyberBlade/i1) driver by Alastair M. Robinson
alex
parents:
diff changeset
284 }
d794e866cf5f EPIA (CyberBlade/i1) driver by Alastair M. Robinson
alex
parents:
diff changeset
285
d794e866cf5f EPIA (CyberBlade/i1) driver by Alastair M. Robinson
alex
parents:
diff changeset
286
d794e866cf5f EPIA (CyberBlade/i1) driver by Alastair M. Robinson
alex
parents:
diff changeset
287 static int frames[VID_PLAY_MAXFRAMES];
d794e866cf5f EPIA (CyberBlade/i1) driver by Alastair M. Robinson
alex
parents:
diff changeset
288
d794e866cf5f EPIA (CyberBlade/i1) driver by Alastair M. Robinson
alex
parents:
diff changeset
289 static vidix_grkey_t cyberblade_grkey;
d794e866cf5f EPIA (CyberBlade/i1) driver by Alastair M. Robinson
alex
parents:
diff changeset
290
d794e866cf5f EPIA (CyberBlade/i1) driver by Alastair M. Robinson
alex
parents:
diff changeset
291 int vixGetGrKeys(vidix_grkey_t *grkey)
d794e866cf5f EPIA (CyberBlade/i1) driver by Alastair M. Robinson
alex
parents:
diff changeset
292 {
d794e866cf5f EPIA (CyberBlade/i1) driver by Alastair M. Robinson
alex
parents:
diff changeset
293 memcpy(grkey, &cyberblade_grkey, sizeof(vidix_grkey_t));
d794e866cf5f EPIA (CyberBlade/i1) driver by Alastair M. Robinson
alex
parents:
diff changeset
294 return(0);
d794e866cf5f EPIA (CyberBlade/i1) driver by Alastair M. Robinson
alex
parents:
diff changeset
295 }
d794e866cf5f EPIA (CyberBlade/i1) driver by Alastair M. Robinson
alex
parents:
diff changeset
296
d794e866cf5f EPIA (CyberBlade/i1) driver by Alastair M. Robinson
alex
parents:
diff changeset
297 int vixSetGrKeys(const vidix_grkey_t *grkey)
d794e866cf5f EPIA (CyberBlade/i1) driver by Alastair M. Robinson
alex
parents:
diff changeset
298 {
d794e866cf5f EPIA (CyberBlade/i1) driver by Alastair M. Robinson
alex
parents:
diff changeset
299 int pixfmt=CRINB(0x38);
8513
679abb24a76e more safer version by the author
alex
parents: 8505
diff changeset
300 int protect;
8505
d794e866cf5f EPIA (CyberBlade/i1) driver by Alastair M. Robinson
alex
parents:
diff changeset
301 memcpy(&cyberblade_grkey, grkey, sizeof(vidix_grkey_t));
d794e866cf5f EPIA (CyberBlade/i1) driver by Alastair M. Robinson
alex
parents:
diff changeset
302
8513
679abb24a76e more safer version by the author
alex
parents: 8505
diff changeset
303 protect=SRINB(0x11);
679abb24a76e more safer version by the author
alex
parents: 8505
diff changeset
304 SROUTB(0x11, 0x92);
679abb24a76e more safer version by the author
alex
parents: 8505
diff changeset
305
8505
d794e866cf5f EPIA (CyberBlade/i1) driver by Alastair M. Robinson
alex
parents:
diff changeset
306 if(pixfmt&0x28) /* 32 or 24 bpp */
d794e866cf5f EPIA (CyberBlade/i1) driver by Alastair M. Robinson
alex
parents:
diff changeset
307 {
d794e866cf5f EPIA (CyberBlade/i1) driver by Alastair M. Robinson
alex
parents:
diff changeset
308 SROUTB(0x50, cyberblade_grkey.ckey.blue); /* Colour Key */
d794e866cf5f EPIA (CyberBlade/i1) driver by Alastair M. Robinson
alex
parents:
diff changeset
309 SROUTB(0x51, cyberblade_grkey.ckey.green); /* Colour Key */
d794e866cf5f EPIA (CyberBlade/i1) driver by Alastair M. Robinson
alex
parents:
diff changeset
310 SROUTB(0x52, cyberblade_grkey.ckey.red); /* Colour Key */
d794e866cf5f EPIA (CyberBlade/i1) driver by Alastair M. Robinson
alex
parents:
diff changeset
311 SROUTB(0x54, 0xff); /* Colour Key Mask */
d794e866cf5f EPIA (CyberBlade/i1) driver by Alastair M. Robinson
alex
parents:
diff changeset
312 SROUTB(0x55, 0xff); /* Colour Key Mask */
d794e866cf5f EPIA (CyberBlade/i1) driver by Alastair M. Robinson
alex
parents:
diff changeset
313 SROUTB(0x56, 0xff); /* Colour Key Mask */
d794e866cf5f EPIA (CyberBlade/i1) driver by Alastair M. Robinson
alex
parents:
diff changeset
314 }
d794e866cf5f EPIA (CyberBlade/i1) driver by Alastair M. Robinson
alex
parents:
diff changeset
315 else
d794e866cf5f EPIA (CyberBlade/i1) driver by Alastair M. Robinson
alex
parents:
diff changeset
316 {
d794e866cf5f EPIA (CyberBlade/i1) driver by Alastair M. Robinson
alex
parents:
diff changeset
317 int tmp=((cyberblade_grkey.ckey.blue & 0xF8)>>3)
d794e866cf5f EPIA (CyberBlade/i1) driver by Alastair M. Robinson
alex
parents:
diff changeset
318 | ((cyberblade_grkey.ckey.green & 0xfc)<<3)
d794e866cf5f EPIA (CyberBlade/i1) driver by Alastair M. Robinson
alex
parents:
diff changeset
319 | ((cyberblade_grkey.ckey.red & 0xf8)<<8);
d794e866cf5f EPIA (CyberBlade/i1) driver by Alastair M. Robinson
alex
parents:
diff changeset
320 SROUTB(0x50, tmp&0xff); /* Colour Key */
d794e866cf5f EPIA (CyberBlade/i1) driver by Alastair M. Robinson
alex
parents:
diff changeset
321 SROUTB(0x51, (tmp>>8)&0xff); /* Colour Key */
d794e866cf5f EPIA (CyberBlade/i1) driver by Alastair M. Robinson
alex
parents:
diff changeset
322 SROUTB(0x52, 0); /* Colour Key */
d794e866cf5f EPIA (CyberBlade/i1) driver by Alastair M. Robinson
alex
parents:
diff changeset
323 SROUTB(0x54, 0xff); /* Colour Key Mask */
d794e866cf5f EPIA (CyberBlade/i1) driver by Alastair M. Robinson
alex
parents:
diff changeset
324 SROUTB(0x55, 0xff); /* Colour Key Mask */
d794e866cf5f EPIA (CyberBlade/i1) driver by Alastair M. Robinson
alex
parents:
diff changeset
325 SROUTB(0x56, 0x00); /* Colour Key Mask */
d794e866cf5f EPIA (CyberBlade/i1) driver by Alastair M. Robinson
alex
parents:
diff changeset
326 }
8513
679abb24a76e more safer version by the author
alex
parents: 8505
diff changeset
327 SROUTB(0x11,protect);
8505
d794e866cf5f EPIA (CyberBlade/i1) driver by Alastair M. Robinson
alex
parents:
diff changeset
328 return(0);
d794e866cf5f EPIA (CyberBlade/i1) driver by Alastair M. Robinson
alex
parents:
diff changeset
329 }
d794e866cf5f EPIA (CyberBlade/i1) driver by Alastair M. Robinson
alex
parents:
diff changeset
330
d794e866cf5f EPIA (CyberBlade/i1) driver by Alastair M. Robinson
alex
parents:
diff changeset
331
d794e866cf5f EPIA (CyberBlade/i1) driver by Alastair M. Robinson
alex
parents:
diff changeset
332 vidix_video_eq_t equal =
d794e866cf5f EPIA (CyberBlade/i1) driver by Alastair M. Robinson
alex
parents:
diff changeset
333 {
d794e866cf5f EPIA (CyberBlade/i1) driver by Alastair M. Robinson
alex
parents:
diff changeset
334 VEQ_CAP_BRIGHTNESS | VEQ_CAP_SATURATION | VEQ_CAP_HUE,
d794e866cf5f EPIA (CyberBlade/i1) driver by Alastair M. Robinson
alex
parents:
diff changeset
335 300, 100, 0, 0, 0, 0, 0, 0
d794e866cf5f EPIA (CyberBlade/i1) driver by Alastair M. Robinson
alex
parents:
diff changeset
336 };
d794e866cf5f EPIA (CyberBlade/i1) driver by Alastair M. Robinson
alex
parents:
diff changeset
337
d794e866cf5f EPIA (CyberBlade/i1) driver by Alastair M. Robinson
alex
parents:
diff changeset
338 int vixPlaybackGetEq( vidix_video_eq_t * eq)
d794e866cf5f EPIA (CyberBlade/i1) driver by Alastair M. Robinson
alex
parents:
diff changeset
339 {
d794e866cf5f EPIA (CyberBlade/i1) driver by Alastair M. Robinson
alex
parents:
diff changeset
340 memcpy(eq,&equal,sizeof(vidix_video_eq_t));
d794e866cf5f EPIA (CyberBlade/i1) driver by Alastair M. Robinson
alex
parents:
diff changeset
341 return 0;
d794e866cf5f EPIA (CyberBlade/i1) driver by Alastair M. Robinson
alex
parents:
diff changeset
342 }
d794e866cf5f EPIA (CyberBlade/i1) driver by Alastair M. Robinson
alex
parents:
diff changeset
343
d794e866cf5f EPIA (CyberBlade/i1) driver by Alastair M. Robinson
alex
parents:
diff changeset
344 int vixPlaybackSetEq( const vidix_video_eq_t * eq)
d794e866cf5f EPIA (CyberBlade/i1) driver by Alastair M. Robinson
alex
parents:
diff changeset
345 {
d794e866cf5f EPIA (CyberBlade/i1) driver by Alastair M. Robinson
alex
parents:
diff changeset
346 int br,sat,cr,protect;
d794e866cf5f EPIA (CyberBlade/i1) driver by Alastair M. Robinson
alex
parents:
diff changeset
347 if(eq->cap & VEQ_CAP_BRIGHTNESS) equal.brightness = eq->brightness;
d794e866cf5f EPIA (CyberBlade/i1) driver by Alastair M. Robinson
alex
parents:
diff changeset
348 if(eq->cap & VEQ_CAP_CONTRAST) equal.contrast = eq->contrast;
d794e866cf5f EPIA (CyberBlade/i1) driver by Alastair M. Robinson
alex
parents:
diff changeset
349 if(eq->cap & VEQ_CAP_SATURATION) equal.saturation = eq->saturation;
d794e866cf5f EPIA (CyberBlade/i1) driver by Alastair M. Robinson
alex
parents:
diff changeset
350 if(eq->cap & VEQ_CAP_HUE) equal.hue = eq->hue;
d794e866cf5f EPIA (CyberBlade/i1) driver by Alastair M. Robinson
alex
parents:
diff changeset
351 if(eq->cap & VEQ_CAP_RGB_INTENSITY)
d794e866cf5f EPIA (CyberBlade/i1) driver by Alastair M. Robinson
alex
parents:
diff changeset
352 {
d794e866cf5f EPIA (CyberBlade/i1) driver by Alastair M. Robinson
alex
parents:
diff changeset
353 equal.red_intensity = eq->red_intensity;
d794e866cf5f EPIA (CyberBlade/i1) driver by Alastair M. Robinson
alex
parents:
diff changeset
354 equal.green_intensity = eq->green_intensity;
d794e866cf5f EPIA (CyberBlade/i1) driver by Alastair M. Robinson
alex
parents:
diff changeset
355 equal.blue_intensity = eq->blue_intensity;
d794e866cf5f EPIA (CyberBlade/i1) driver by Alastair M. Robinson
alex
parents:
diff changeset
356 }
d794e866cf5f EPIA (CyberBlade/i1) driver by Alastair M. Robinson
alex
parents:
diff changeset
357 equal.flags = eq->flags;
d794e866cf5f EPIA (CyberBlade/i1) driver by Alastair M. Robinson
alex
parents:
diff changeset
358
d794e866cf5f EPIA (CyberBlade/i1) driver by Alastair M. Robinson
alex
parents:
diff changeset
359 cr = (equal.contrast) * 31 / 2000; cr+=16;
d794e866cf5f EPIA (CyberBlade/i1) driver by Alastair M. Robinson
alex
parents:
diff changeset
360 if (cr < 0) cr = 0; if(cr > 7) cr = 7;
d794e866cf5f EPIA (CyberBlade/i1) driver by Alastair M. Robinson
alex
parents:
diff changeset
361 cr=cr<<4 | cr;
d794e866cf5f EPIA (CyberBlade/i1) driver by Alastair M. Robinson
alex
parents:
diff changeset
362
d794e866cf5f EPIA (CyberBlade/i1) driver by Alastair M. Robinson
alex
parents:
diff changeset
363 br = (equal.brightness+1000) * 63 / 2000;
d794e866cf5f EPIA (CyberBlade/i1) driver by Alastair M. Robinson
alex
parents:
diff changeset
364 if (br < 0) br = 0; if(br > 63) br = 63;
d794e866cf5f EPIA (CyberBlade/i1) driver by Alastair M. Robinson
alex
parents:
diff changeset
365 if(br>32) br-=32; else br+=32;
d794e866cf5f EPIA (CyberBlade/i1) driver by Alastair M. Robinson
alex
parents:
diff changeset
366
d794e866cf5f EPIA (CyberBlade/i1) driver by Alastair M. Robinson
alex
parents:
diff changeset
367 sat = (equal.saturation + 1000) * 16 / 2000;
d794e866cf5f EPIA (CyberBlade/i1) driver by Alastair M. Robinson
alex
parents:
diff changeset
368 if (sat < 0) sat = 0; if(sat > 31) sat = 31;
d794e866cf5f EPIA (CyberBlade/i1) driver by Alastair M. Robinson
alex
parents:
diff changeset
369
d794e866cf5f EPIA (CyberBlade/i1) driver by Alastair M. Robinson
alex
parents:
diff changeset
370 protect=SRINB(0x11);
d794e866cf5f EPIA (CyberBlade/i1) driver by Alastair M. Robinson
alex
parents:
diff changeset
371 SROUTB(0x11, 0x92);
d794e866cf5f EPIA (CyberBlade/i1) driver by Alastair M. Robinson
alex
parents:
diff changeset
372
d794e866cf5f EPIA (CyberBlade/i1) driver by Alastair M. Robinson
alex
parents:
diff changeset
373 SROUTB(0xBC,cr);
d794e866cf5f EPIA (CyberBlade/i1) driver by Alastair M. Robinson
alex
parents:
diff changeset
374 SROUTW(0xB0,(br<<10)|4);
d794e866cf5f EPIA (CyberBlade/i1) driver by Alastair M. Robinson
alex
parents:
diff changeset
375
d794e866cf5f EPIA (CyberBlade/i1) driver by Alastair M. Robinson
alex
parents:
diff changeset
376 SROUTB(0x11, protect);
d794e866cf5f EPIA (CyberBlade/i1) driver by Alastair M. Robinson
alex
parents:
diff changeset
377
d794e866cf5f EPIA (CyberBlade/i1) driver by Alastair M. Robinson
alex
parents:
diff changeset
378 return 0;
d794e866cf5f EPIA (CyberBlade/i1) driver by Alastair M. Robinson
alex
parents:
diff changeset
379 }
d794e866cf5f EPIA (CyberBlade/i1) driver by Alastair M. Robinson
alex
parents:
diff changeset
380
d794e866cf5f EPIA (CyberBlade/i1) driver by Alastair M. Robinson
alex
parents:
diff changeset
381
d794e866cf5f EPIA (CyberBlade/i1) driver by Alastair M. Robinson
alex
parents:
diff changeset
382 static int YOffs,UOffs,VOffs;
d794e866cf5f EPIA (CyberBlade/i1) driver by Alastair M. Robinson
alex
parents:
diff changeset
383
d794e866cf5f EPIA (CyberBlade/i1) driver by Alastair M. Robinson
alex
parents:
diff changeset
384 int vixConfigPlayback(vidix_playback_t *info)
d794e866cf5f EPIA (CyberBlade/i1) driver by Alastair M. Robinson
alex
parents:
diff changeset
385 {
d794e866cf5f EPIA (CyberBlade/i1) driver by Alastair M. Robinson
alex
parents:
diff changeset
386 int shrink, zoom;
d794e866cf5f EPIA (CyberBlade/i1) driver by Alastair M. Robinson
alex
parents:
diff changeset
387 int src_w, drw_w;
d794e866cf5f EPIA (CyberBlade/i1) driver by Alastair M. Robinson
alex
parents:
diff changeset
388 int src_h, drw_h;
d794e866cf5f EPIA (CyberBlade/i1) driver by Alastair M. Robinson
alex
parents:
diff changeset
389 int hscale,vscale;
d794e866cf5f EPIA (CyberBlade/i1) driver by Alastair M. Robinson
alex
parents:
diff changeset
390 long base0;
d794e866cf5f EPIA (CyberBlade/i1) driver by Alastair M. Robinson
alex
parents:
diff changeset
391 int y_pitch, uv_pitch;
d794e866cf5f EPIA (CyberBlade/i1) driver by Alastair M. Robinson
alex
parents:
diff changeset
392 int protect=0;
d794e866cf5f EPIA (CyberBlade/i1) driver by Alastair M. Robinson
alex
parents:
diff changeset
393 int layout=0;
d794e866cf5f EPIA (CyberBlade/i1) driver by Alastair M. Robinson
alex
parents:
diff changeset
394 unsigned int i;
d794e866cf5f EPIA (CyberBlade/i1) driver by Alastair M. Robinson
alex
parents:
diff changeset
395
d794e866cf5f EPIA (CyberBlade/i1) driver by Alastair M. Robinson
alex
parents:
diff changeset
396 if(!is_supported_fourcc(info->fourcc))
d794e866cf5f EPIA (CyberBlade/i1) driver by Alastair M. Robinson
alex
parents:
diff changeset
397 return -1;
d794e866cf5f EPIA (CyberBlade/i1) driver by Alastair M. Robinson
alex
parents:
diff changeset
398
d794e866cf5f EPIA (CyberBlade/i1) driver by Alastair M. Robinson
alex
parents:
diff changeset
399 src_w = info->src.w;
d794e866cf5f EPIA (CyberBlade/i1) driver by Alastair M. Robinson
alex
parents:
diff changeset
400 src_h = info->src.h;
d794e866cf5f EPIA (CyberBlade/i1) driver by Alastair M. Robinson
alex
parents:
diff changeset
401
d794e866cf5f EPIA (CyberBlade/i1) driver by Alastair M. Robinson
alex
parents:
diff changeset
402 drw_w = info->dest.w;
d794e866cf5f EPIA (CyberBlade/i1) driver by Alastair M. Robinson
alex
parents:
diff changeset
403 drw_h = info->dest.h;
d794e866cf5f EPIA (CyberBlade/i1) driver by Alastair M. Robinson
alex
parents:
diff changeset
404
d794e866cf5f EPIA (CyberBlade/i1) driver by Alastair M. Robinson
alex
parents:
diff changeset
405 switch(info->fourcc)
d794e866cf5f EPIA (CyberBlade/i1) driver by Alastair M. Robinson
alex
parents:
diff changeset
406 {
d794e866cf5f EPIA (CyberBlade/i1) driver by Alastair M. Robinson
alex
parents:
diff changeset
407 case IMGFMT_YUY2:
d794e866cf5f EPIA (CyberBlade/i1) driver by Alastair M. Robinson
alex
parents:
diff changeset
408 case IMGFMT_BGR16:
d794e866cf5f EPIA (CyberBlade/i1) driver by Alastair M. Robinson
alex
parents:
diff changeset
409 y_pitch = (src_w*2 + 15) & ~15;
d794e866cf5f EPIA (CyberBlade/i1) driver by Alastair M. Robinson
alex
parents:
diff changeset
410 uv_pitch = 0;
d794e866cf5f EPIA (CyberBlade/i1) driver by Alastair M. Robinson
alex
parents:
diff changeset
411 YOffs=VOffs=UOffs=info->offset.y = info->offset.v = info->offset.u = 0;
d794e866cf5f EPIA (CyberBlade/i1) driver by Alastair M. Robinson
alex
parents:
diff changeset
412 info->frame_size = y_pitch*src_h;
d794e866cf5f EPIA (CyberBlade/i1) driver by Alastair M. Robinson
alex
parents:
diff changeset
413 layout=0x0; /* packed */
d794e866cf5f EPIA (CyberBlade/i1) driver by Alastair M. Robinson
alex
parents:
diff changeset
414 break;
d794e866cf5f EPIA (CyberBlade/i1) driver by Alastair M. Robinson
alex
parents:
diff changeset
415 case IMGFMT_YV12:
13656
99b443dd45a8 I420 support patch by Benjamin Zores <ben@tutuxclan.org>
faust3
parents: 13604
diff changeset
416 case IMGFMT_I420:
8505
d794e866cf5f EPIA (CyberBlade/i1) driver by Alastair M. Robinson
alex
parents:
diff changeset
417 y_pitch = (src_w+15) & ~15;
d794e866cf5f EPIA (CyberBlade/i1) driver by Alastair M. Robinson
alex
parents:
diff changeset
418 uv_pitch = ((src_w/2)+7) & ~7;
d794e866cf5f EPIA (CyberBlade/i1) driver by Alastair M. Robinson
alex
parents:
diff changeset
419 YOffs=info->offset.y = 0;
d794e866cf5f EPIA (CyberBlade/i1) driver by Alastair M. Robinson
alex
parents:
diff changeset
420 VOffs=info->offset.v = y_pitch*src_h;
d794e866cf5f EPIA (CyberBlade/i1) driver by Alastair M. Robinson
alex
parents:
diff changeset
421 UOffs=info->offset.u = info->offset.v+(uv_pitch)*(src_h/2);
d794e866cf5f EPIA (CyberBlade/i1) driver by Alastair M. Robinson
alex
parents:
diff changeset
422 info->frame_size = y_pitch*src_h + 2*uv_pitch*(src_h/2);
d794e866cf5f EPIA (CyberBlade/i1) driver by Alastair M. Robinson
alex
parents:
diff changeset
423 layout=0x1; /* planar, 4:1:1 */
d794e866cf5f EPIA (CyberBlade/i1) driver by Alastair M. Robinson
alex
parents:
diff changeset
424 break;
d794e866cf5f EPIA (CyberBlade/i1) driver by Alastair M. Robinson
alex
parents:
diff changeset
425 case IMGFMT_YVU9:
d794e866cf5f EPIA (CyberBlade/i1) driver by Alastair M. Robinson
alex
parents:
diff changeset
426 y_pitch = (src_w+15) & ~15;
d794e866cf5f EPIA (CyberBlade/i1) driver by Alastair M. Robinson
alex
parents:
diff changeset
427 uv_pitch = ((src_w/4)+3) & ~3;
d794e866cf5f EPIA (CyberBlade/i1) driver by Alastair M. Robinson
alex
parents:
diff changeset
428 YOffs=info->offset.y = 0;
d794e866cf5f EPIA (CyberBlade/i1) driver by Alastair M. Robinson
alex
parents:
diff changeset
429 VOffs=info->offset.v = y_pitch*src_h;
d794e866cf5f EPIA (CyberBlade/i1) driver by Alastair M. Robinson
alex
parents:
diff changeset
430 UOffs=info->offset.u = info->offset.v+(uv_pitch)*(src_h/4);
d794e866cf5f EPIA (CyberBlade/i1) driver by Alastair M. Robinson
alex
parents:
diff changeset
431 info->frame_size = y_pitch*src_h + 2*uv_pitch*(src_h/4);
d794e866cf5f EPIA (CyberBlade/i1) driver by Alastair M. Robinson
alex
parents:
diff changeset
432 layout=0x51; /* planar, 16:1:1 */
d794e866cf5f EPIA (CyberBlade/i1) driver by Alastair M. Robinson
alex
parents:
diff changeset
433 break;
d794e866cf5f EPIA (CyberBlade/i1) driver by Alastair M. Robinson
alex
parents:
diff changeset
434 }
d794e866cf5f EPIA (CyberBlade/i1) driver by Alastair M. Robinson
alex
parents:
diff changeset
435
8513
679abb24a76e more safer version by the author
alex
parents: 8505
diff changeset
436 /* Assume we have 2 MB to play with */
679abb24a76e more safer version by the author
alex
parents: 8505
diff changeset
437 info->num_frames = 0x200000 / info->frame_size;
8505
d794e866cf5f EPIA (CyberBlade/i1) driver by Alastair M. Robinson
alex
parents:
diff changeset
438 if(info->num_frames > VID_PLAY_MAXFRAMES)
d794e866cf5f EPIA (CyberBlade/i1) driver by Alastair M. Robinson
alex
parents:
diff changeset
439 info->num_frames = VID_PLAY_MAXFRAMES;
d794e866cf5f EPIA (CyberBlade/i1) driver by Alastair M. Robinson
alex
parents:
diff changeset
440
8513
679abb24a76e more safer version by the author
alex
parents: 8505
diff changeset
441 /* Start at 6 MB. Let's hope it's not in use. */
679abb24a76e more safer version by the author
alex
parents: 8505
diff changeset
442 base0 = 0x600000;
8505
d794e866cf5f EPIA (CyberBlade/i1) driver by Alastair M. Robinson
alex
parents:
diff changeset
443 info->dga_addr = cyberblade_mem + base0;
d794e866cf5f EPIA (CyberBlade/i1) driver by Alastair M. Robinson
alex
parents:
diff changeset
444
d794e866cf5f EPIA (CyberBlade/i1) driver by Alastair M. Robinson
alex
parents:
diff changeset
445 info->dest.pitch.y = 16;
d794e866cf5f EPIA (CyberBlade/i1) driver by Alastair M. Robinson
alex
parents:
diff changeset
446 info->dest.pitch.u = 16;
d794e866cf5f EPIA (CyberBlade/i1) driver by Alastair M. Robinson
alex
parents:
diff changeset
447 info->dest.pitch.v = 16;
d794e866cf5f EPIA (CyberBlade/i1) driver by Alastair M. Robinson
alex
parents:
diff changeset
448
d794e866cf5f EPIA (CyberBlade/i1) driver by Alastair M. Robinson
alex
parents:
diff changeset
449 for(i = 0; i < info->num_frames; i++)
d794e866cf5f EPIA (CyberBlade/i1) driver by Alastair M. Robinson
alex
parents:
diff changeset
450 {
d794e866cf5f EPIA (CyberBlade/i1) driver by Alastair M. Robinson
alex
parents:
diff changeset
451 info->offsets[i] = info->frame_size * i;
d794e866cf5f EPIA (CyberBlade/i1) driver by Alastair M. Robinson
alex
parents:
diff changeset
452 frames[i] = base0+info->offsets[i];
d794e866cf5f EPIA (CyberBlade/i1) driver by Alastair M. Robinson
alex
parents:
diff changeset
453 }
d794e866cf5f EPIA (CyberBlade/i1) driver by Alastair M. Robinson
alex
parents:
diff changeset
454
8513
679abb24a76e more safer version by the author
alex
parents: 8505
diff changeset
455 OUTPORT8(0x3d4,0x39);
679abb24a76e more safer version by the author
alex
parents: 8505
diff changeset
456 OUTPORT8(0x3d5,INPORT(0x3d5)|1);
679abb24a76e more safer version by the author
alex
parents: 8505
diff changeset
457
679abb24a76e more safer version by the author
alex
parents: 8505
diff changeset
458 SRINB(0x0b); /* Select new mode */
679abb24a76e more safer version by the author
alex
parents: 8505
diff changeset
459
8505
d794e866cf5f EPIA (CyberBlade/i1) driver by Alastair M. Robinson
alex
parents:
diff changeset
460 /* Unprotect hardware registers... */
d794e866cf5f EPIA (CyberBlade/i1) driver by Alastair M. Robinson
alex
parents:
diff changeset
461 protect=SRINB(0x11);
d794e866cf5f EPIA (CyberBlade/i1) driver by Alastair M. Robinson
alex
parents:
diff changeset
462 SROUTB(0x11, 0x92);
d794e866cf5f EPIA (CyberBlade/i1) driver by Alastair M. Robinson
alex
parents:
diff changeset
463
d794e866cf5f EPIA (CyberBlade/i1) driver by Alastair M. Robinson
alex
parents:
diff changeset
464 SROUTB(0x57, 0xc0); /* Playback key function */
d794e866cf5f EPIA (CyberBlade/i1) driver by Alastair M. Robinson
alex
parents:
diff changeset
465 SROUTB(0x21, 0x34); /* Signature control */
d794e866cf5f EPIA (CyberBlade/i1) driver by Alastair M. Robinson
alex
parents:
diff changeset
466 SROUTB(0x37, 0x30); /* Video key mode */
d794e866cf5f EPIA (CyberBlade/i1) driver by Alastair M. Robinson
alex
parents:
diff changeset
467
9023
e40760677a83 Updated to v0.1.4 by Alastair Robinson <blackfive@fakenhamweb.co.uk>
alex
parents: 8513
diff changeset
468 vixSetGrKeys(&cyberblade_grkey);
e40760677a83 Updated to v0.1.4 by Alastair Robinson <blackfive@fakenhamweb.co.uk>
alex
parents: 8513
diff changeset
469
e40760677a83 Updated to v0.1.4 by Alastair Robinson <blackfive@fakenhamweb.co.uk>
alex
parents: 8513
diff changeset
470 /* compute_scale_factor(&src_w, &drw_w, &shrink, &zoom); */
8505
d794e866cf5f EPIA (CyberBlade/i1) driver by Alastair M. Robinson
alex
parents:
diff changeset
471 {
9023
e40760677a83 Updated to v0.1.4 by Alastair Robinson <blackfive@fakenhamweb.co.uk>
alex
parents: 8513
diff changeset
472 int HTotal,VTotal,HSync,VSync,Overflow,HDisp,VDisp;
e40760677a83 Updated to v0.1.4 by Alastair Robinson <blackfive@fakenhamweb.co.uk>
alex
parents: 8513
diff changeset
473 int HWinStart,VWinStart;
e40760677a83 Updated to v0.1.4 by Alastair Robinson <blackfive@fakenhamweb.co.uk>
alex
parents: 8513
diff changeset
474 int tx1,ty1,tx2,ty2;
e40760677a83 Updated to v0.1.4 by Alastair Robinson <blackfive@fakenhamweb.co.uk>
alex
parents: 8513
diff changeset
475
e40760677a83 Updated to v0.1.4 by Alastair Robinson <blackfive@fakenhamweb.co.uk>
alex
parents: 8513
diff changeset
476 HTotal=CRINB(0x00);
e40760677a83 Updated to v0.1.4 by Alastair Robinson <blackfive@fakenhamweb.co.uk>
alex
parents: 8513
diff changeset
477 HSync=CRINB(0x04);
e40760677a83 Updated to v0.1.4 by Alastair Robinson <blackfive@fakenhamweb.co.uk>
alex
parents: 8513
diff changeset
478 VTotal=CRINB(0x06);
e40760677a83 Updated to v0.1.4 by Alastair Robinson <blackfive@fakenhamweb.co.uk>
alex
parents: 8513
diff changeset
479 VSync=CRINB(0x10);
e40760677a83 Updated to v0.1.4 by Alastair Robinson <blackfive@fakenhamweb.co.uk>
alex
parents: 8513
diff changeset
480 Overflow=CRINB(0x07);
e40760677a83 Updated to v0.1.4 by Alastair Robinson <blackfive@fakenhamweb.co.uk>
alex
parents: 8513
diff changeset
481 HTotal <<=3;
e40760677a83 Updated to v0.1.4 by Alastair Robinson <blackfive@fakenhamweb.co.uk>
alex
parents: 8513
diff changeset
482 HSync <<=3;
e40760677a83 Updated to v0.1.4 by Alastair Robinson <blackfive@fakenhamweb.co.uk>
alex
parents: 8513
diff changeset
483 VTotal |= (Overflow & 1) <<8;
e40760677a83 Updated to v0.1.4 by Alastair Robinson <blackfive@fakenhamweb.co.uk>
alex
parents: 8513
diff changeset
484 VTotal |= (Overflow & 0x20) <<4;
e40760677a83 Updated to v0.1.4 by Alastair Robinson <blackfive@fakenhamweb.co.uk>
alex
parents: 8513
diff changeset
485 VTotal +=4;
e40760677a83 Updated to v0.1.4 by Alastair Robinson <blackfive@fakenhamweb.co.uk>
alex
parents: 8513
diff changeset
486 VSync |= (Overflow & 4) <<6;
e40760677a83 Updated to v0.1.4 by Alastair Robinson <blackfive@fakenhamweb.co.uk>
alex
parents: 8513
diff changeset
487 VSync |= (Overflow & 0x80) <<2;
e40760677a83 Updated to v0.1.4 by Alastair Robinson <blackfive@fakenhamweb.co.uk>
alex
parents: 8513
diff changeset
488
e40760677a83 Updated to v0.1.4 by Alastair Robinson <blackfive@fakenhamweb.co.uk>
alex
parents: 8513
diff changeset
489 if(CRINB(0xd1)&0x80)
8505
d794e866cf5f EPIA (CyberBlade/i1) driver by Alastair M. Robinson
alex
parents:
diff changeset
490 {
9023
e40760677a83 Updated to v0.1.4 by Alastair Robinson <blackfive@fakenhamweb.co.uk>
alex
parents: 8513
diff changeset
491 int TVHTotal,TVVTotal,TVHSyncStart,TVVSyncStart,TVOverflow;
e40760677a83 Updated to v0.1.4 by Alastair Robinson <blackfive@fakenhamweb.co.uk>
alex
parents: 8513
diff changeset
492 LOGWRITE("[cyberblade] Using TV-CRTC\n");
e40760677a83 Updated to v0.1.4 by Alastair Robinson <blackfive@fakenhamweb.co.uk>
alex
parents: 8513
diff changeset
493
e40760677a83 Updated to v0.1.4 by Alastair Robinson <blackfive@fakenhamweb.co.uk>
alex
parents: 8513
diff changeset
494 HDisp=(1+CRINB(0x01))*8;
e40760677a83 Updated to v0.1.4 by Alastair Robinson <blackfive@fakenhamweb.co.uk>
alex
parents: 8513
diff changeset
495 VDisp=1+CRINB(0x12);
e40760677a83 Updated to v0.1.4 by Alastair Robinson <blackfive@fakenhamweb.co.uk>
alex
parents: 8513
diff changeset
496 Overflow=CRINB(0x07);
e40760677a83 Updated to v0.1.4 by Alastair Robinson <blackfive@fakenhamweb.co.uk>
alex
parents: 8513
diff changeset
497 VDisp |= (Overflow & 2) <<7;
e40760677a83 Updated to v0.1.4 by Alastair Robinson <blackfive@fakenhamweb.co.uk>
alex
parents: 8513
diff changeset
498 VDisp |= (Overflow & 0x40) << 3;
e40760677a83 Updated to v0.1.4 by Alastair Robinson <blackfive@fakenhamweb.co.uk>
alex
parents: 8513
diff changeset
499
e40760677a83 Updated to v0.1.4 by Alastair Robinson <blackfive@fakenhamweb.co.uk>
alex
parents: 8513
diff changeset
500 TVHTotal=CRINB(0xe0)*8;
e40760677a83 Updated to v0.1.4 by Alastair Robinson <blackfive@fakenhamweb.co.uk>
alex
parents: 8513
diff changeset
501 TVVTotal=CRINB(0xe6);
e40760677a83 Updated to v0.1.4 by Alastair Robinson <blackfive@fakenhamweb.co.uk>
alex
parents: 8513
diff changeset
502 TVOverflow=CRINB(0xe7);
e40760677a83 Updated to v0.1.4 by Alastair Robinson <blackfive@fakenhamweb.co.uk>
alex
parents: 8513
diff changeset
503 if(TVOverflow&0x20) TVVTotal|=512;
e40760677a83 Updated to v0.1.4 by Alastair Robinson <blackfive@fakenhamweb.co.uk>
alex
parents: 8513
diff changeset
504 if(TVOverflow&0x01) TVVTotal|=256;
e40760677a83 Updated to v0.1.4 by Alastair Robinson <blackfive@fakenhamweb.co.uk>
alex
parents: 8513
diff changeset
505 TVHTotal+=40; TVVTotal+=2;
e40760677a83 Updated to v0.1.4 by Alastair Robinson <blackfive@fakenhamweb.co.uk>
alex
parents: 8513
diff changeset
506
e40760677a83 Updated to v0.1.4 by Alastair Robinson <blackfive@fakenhamweb.co.uk>
alex
parents: 8513
diff changeset
507 TVHSyncStart=CRINB(0xe4)*8;
e40760677a83 Updated to v0.1.4 by Alastair Robinson <blackfive@fakenhamweb.co.uk>
alex
parents: 8513
diff changeset
508 TVVSyncStart=CRINB(0xf0);
e40760677a83 Updated to v0.1.4 by Alastair Robinson <blackfive@fakenhamweb.co.uk>
alex
parents: 8513
diff changeset
509 if(TVOverflow&0x80) TVVSyncStart|=512;
e40760677a83 Updated to v0.1.4 by Alastair Robinson <blackfive@fakenhamweb.co.uk>
alex
parents: 8513
diff changeset
510 if(TVOverflow&0x04) TVVSyncStart|=256;
e40760677a83 Updated to v0.1.4 by Alastair Robinson <blackfive@fakenhamweb.co.uk>
alex
parents: 8513
diff changeset
511
e40760677a83 Updated to v0.1.4 by Alastair Robinson <blackfive@fakenhamweb.co.uk>
alex
parents: 8513
diff changeset
512 HWinStart=(TVHTotal-HDisp)&15;
e40760677a83 Updated to v0.1.4 by Alastair Robinson <blackfive@fakenhamweb.co.uk>
alex
parents: 8513
diff changeset
513 HWinStart|=(HTotal-HDisp)&15;
e40760677a83 Updated to v0.1.4 by Alastair Robinson <blackfive@fakenhamweb.co.uk>
alex
parents: 8513
diff changeset
514 HWinStart+=(TVHTotal-TVHSyncStart)-49;
8505
d794e866cf5f EPIA (CyberBlade/i1) driver by Alastair M. Robinson
alex
parents:
diff changeset
515 }
d794e866cf5f EPIA (CyberBlade/i1) driver by Alastair M. Robinson
alex
parents:
diff changeset
516 else
d794e866cf5f EPIA (CyberBlade/i1) driver by Alastair M. Robinson
alex
parents:
diff changeset
517 {
9023
e40760677a83 Updated to v0.1.4 by Alastair Robinson <blackfive@fakenhamweb.co.uk>
alex
parents: 8513
diff changeset
518 LOGWRITE("[cyberblade] Using Standard CRTC\n");
e40760677a83 Updated to v0.1.4 by Alastair Robinson <blackfive@fakenhamweb.co.uk>
alex
parents: 8513
diff changeset
519 HWinStart=(HTotal-HSync)+15;
8505
d794e866cf5f EPIA (CyberBlade/i1) driver by Alastair M. Robinson
alex
parents:
diff changeset
520 }
13604
6d2a63a93190 fix Cyberblade VidiX driver TVOUT patch by Benjamin Zores <ben@tutuxclan.org>
faust3
parents: 11678
diff changeset
521 VWinStart=(VTotal-VSync)-8;
8505
d794e866cf5f EPIA (CyberBlade/i1) driver by Alastair M. Robinson
alex
parents:
diff changeset
522
8513
679abb24a76e more safer version by the author
alex
parents: 8505
diff changeset
523 printf("[cyberblade] HTotal: 0x%x, HSStart: 0x%x\n",HTotal,HSync);
679abb24a76e more safer version by the author
alex
parents: 8505
diff changeset
524 printf(" VTotal: 0x%x, VStart: 0x%x\n",VTotal,VSync);
9023
e40760677a83 Updated to v0.1.4 by Alastair Robinson <blackfive@fakenhamweb.co.uk>
alex
parents: 8513
diff changeset
525 tx1=HWinStart+info->dest.x;
e40760677a83 Updated to v0.1.4 by Alastair Robinson <blackfive@fakenhamweb.co.uk>
alex
parents: 8513
diff changeset
526 ty1=VWinStart+info->dest.y;
8505
d794e866cf5f EPIA (CyberBlade/i1) driver by Alastair M. Robinson
alex
parents:
diff changeset
527 tx2=tx1+info->dest.w;
d794e866cf5f EPIA (CyberBlade/i1) driver by Alastair M. Robinson
alex
parents:
diff changeset
528 ty2=ty1+info->dest.h;
d794e866cf5f EPIA (CyberBlade/i1) driver by Alastair M. Robinson
alex
parents:
diff changeset
529
d794e866cf5f EPIA (CyberBlade/i1) driver by Alastair M. Robinson
alex
parents:
diff changeset
530 CROUTW(0x86,tx1);
d794e866cf5f EPIA (CyberBlade/i1) driver by Alastair M. Robinson
alex
parents:
diff changeset
531 CROUTW(0x88,ty1);
d794e866cf5f EPIA (CyberBlade/i1) driver by Alastair M. Robinson
alex
parents:
diff changeset
532 CROUTW(0x8a,tx2);
d794e866cf5f EPIA (CyberBlade/i1) driver by Alastair M. Robinson
alex
parents:
diff changeset
533 CROUTW(0x8c,ty2+3);
d794e866cf5f EPIA (CyberBlade/i1) driver by Alastair M. Robinson
alex
parents:
diff changeset
534 }
d794e866cf5f EPIA (CyberBlade/i1) driver by Alastair M. Robinson
alex
parents:
diff changeset
535
d794e866cf5f EPIA (CyberBlade/i1) driver by Alastair M. Robinson
alex
parents:
diff changeset
536 if(src_w==drw_w)
d794e866cf5f EPIA (CyberBlade/i1) driver by Alastair M. Robinson
alex
parents:
diff changeset
537 hscale=0;
d794e866cf5f EPIA (CyberBlade/i1) driver by Alastair M. Robinson
alex
parents:
diff changeset
538 else if(src_w<drw_w)
d794e866cf5f EPIA (CyberBlade/i1) driver by Alastair M. Robinson
alex
parents:
diff changeset
539 {
d794e866cf5f EPIA (CyberBlade/i1) driver by Alastair M. Robinson
alex
parents:
diff changeset
540 hscale=((src_w<<10)/(drw_w-2)) & 0x1fff;
d794e866cf5f EPIA (CyberBlade/i1) driver by Alastair M. Robinson
alex
parents:
diff changeset
541 }
d794e866cf5f EPIA (CyberBlade/i1) driver by Alastair M. Robinson
alex
parents:
diff changeset
542 else
d794e866cf5f EPIA (CyberBlade/i1) driver by Alastair M. Robinson
alex
parents:
diff changeset
543 {
d794e866cf5f EPIA (CyberBlade/i1) driver by Alastair M. Robinson
alex
parents:
diff changeset
544 hscale=0x8000 | ((((src_w/drw_w)-1)&7)<<10) | (((drw_w<<10)/src_w) & 0x3ff);
d794e866cf5f EPIA (CyberBlade/i1) driver by Alastair M. Robinson
alex
parents:
diff changeset
545 }
d794e866cf5f EPIA (CyberBlade/i1) driver by Alastair M. Robinson
alex
parents:
diff changeset
546
d794e866cf5f EPIA (CyberBlade/i1) driver by Alastair M. Robinson
alex
parents:
diff changeset
547 vscale=(src_h<<10)/(drw_h);
d794e866cf5f EPIA (CyberBlade/i1) driver by Alastair M. Robinson
alex
parents:
diff changeset
548 if(drw_h<src_h)
d794e866cf5f EPIA (CyberBlade/i1) driver by Alastair M. Robinson
alex
parents:
diff changeset
549 vscale=0x8000|((drw_h<<10)/(src_h));
d794e866cf5f EPIA (CyberBlade/i1) driver by Alastair M. Robinson
alex
parents:
diff changeset
550
d794e866cf5f EPIA (CyberBlade/i1) driver by Alastair M. Robinson
alex
parents:
diff changeset
551 /* Write scale factors to hardware */
d794e866cf5f EPIA (CyberBlade/i1) driver by Alastair M. Robinson
alex
parents:
diff changeset
552
d794e866cf5f EPIA (CyberBlade/i1) driver by Alastair M. Robinson
alex
parents:
diff changeset
553 CROUTW(0x80,hscale); /* Horizontal Scale */
d794e866cf5f EPIA (CyberBlade/i1) driver by Alastair M. Robinson
alex
parents:
diff changeset
554 CROUTW(0x82,vscale); /* Vertical Scale */
d794e866cf5f EPIA (CyberBlade/i1) driver by Alastair M. Robinson
alex
parents:
diff changeset
555
d794e866cf5f EPIA (CyberBlade/i1) driver by Alastair M. Robinson
alex
parents:
diff changeset
556 /* Now set the start address and data layout */
d794e866cf5f EPIA (CyberBlade/i1) driver by Alastair M. Robinson
alex
parents:
diff changeset
557 {
d794e866cf5f EPIA (CyberBlade/i1) driver by Alastair M. Robinson
alex
parents:
diff changeset
558 int lb = (y_pitch+2) >> 2;
d794e866cf5f EPIA (CyberBlade/i1) driver by Alastair M. Robinson
alex
parents:
diff changeset
559 CROUTB(0x95, ((lb & 0x100)>>1) | 0x08 ); /* Linebuffer level bit 8 & threshold */
d794e866cf5f EPIA (CyberBlade/i1) driver by Alastair M. Robinson
alex
parents:
diff changeset
560 CROUTB(0x96, (lb & 0xFF)); /* Linebuffer level */
d794e866cf5f EPIA (CyberBlade/i1) driver by Alastair M. Robinson
alex
parents:
diff changeset
561
d794e866cf5f EPIA (CyberBlade/i1) driver by Alastair M. Robinson
alex
parents:
diff changeset
562 CROUTB(0x97, 0x00); /* VDE Flags */
d794e866cf5f EPIA (CyberBlade/i1) driver by Alastair M. Robinson
alex
parents:
diff changeset
563 CROUTB(0xBA, 0x00); /* Chroma key */
d794e866cf5f EPIA (CyberBlade/i1) driver by Alastair M. Robinson
alex
parents:
diff changeset
564 CROUTB(0xBB, 0x00); /* Chroma key */
d794e866cf5f EPIA (CyberBlade/i1) driver by Alastair M. Robinson
alex
parents:
diff changeset
565 CROUTB(0xBC, 0xFF); /* Chroma key */
d794e866cf5f EPIA (CyberBlade/i1) driver by Alastair M. Robinson
alex
parents:
diff changeset
566 CROUTB(0xBD, 0xFF); /* Chroma key */
9023
e40760677a83 Updated to v0.1.4 by Alastair Robinson <blackfive@fakenhamweb.co.uk>
alex
parents: 8513
diff changeset
567 CROUTB(0xBE, 0x04); /* Capture control */
8505
d794e866cf5f EPIA (CyberBlade/i1) driver by Alastair M. Robinson
alex
parents:
diff changeset
568
d794e866cf5f EPIA (CyberBlade/i1) driver by Alastair M. Robinson
alex
parents:
diff changeset
569 if(src_w > 384)
d794e866cf5f EPIA (CyberBlade/i1) driver by Alastair M. Robinson
alex
parents:
diff changeset
570 layout|=4; /* 2x line buffers */
d794e866cf5f EPIA (CyberBlade/i1) driver by Alastair M. Robinson
alex
parents:
diff changeset
571 SROUTB(0x97, layout);
d794e866cf5f EPIA (CyberBlade/i1) driver by Alastair M. Robinson
alex
parents:
diff changeset
572
d794e866cf5f EPIA (CyberBlade/i1) driver by Alastair M. Robinson
alex
parents:
diff changeset
573 CROUTW(0x90,y_pitch); /* Y Bytes per row */
d794e866cf5f EPIA (CyberBlade/i1) driver by Alastair M. Robinson
alex
parents:
diff changeset
574 SROUTW(0x9A,uv_pitch); /* UV Bytes per row */
d794e866cf5f EPIA (CyberBlade/i1) driver by Alastair M. Robinson
alex
parents:
diff changeset
575
d794e866cf5f EPIA (CyberBlade/i1) driver by Alastair M. Robinson
alex
parents:
diff changeset
576 switch(info->fourcc)
d794e866cf5f EPIA (CyberBlade/i1) driver by Alastair M. Robinson
alex
parents:
diff changeset
577 {
d794e866cf5f EPIA (CyberBlade/i1) driver by Alastair M. Robinson
alex
parents:
diff changeset
578 case IMGFMT_BGR16:
d794e866cf5f EPIA (CyberBlade/i1) driver by Alastair M. Robinson
alex
parents:
diff changeset
579 CROUTB(0x8F, 0x24); /* VDE Flags - Edge Recovery & CSC Bypass */
d794e866cf5f EPIA (CyberBlade/i1) driver by Alastair M. Robinson
alex
parents:
diff changeset
580 CROUTB(0xBF, 0x02); /* Video format - RGB16 */
d794e866cf5f EPIA (CyberBlade/i1) driver by Alastair M. Robinson
alex
parents:
diff changeset
581 SROUTB(0xBE, 0x0); /* HSCB disabled */
d794e866cf5f EPIA (CyberBlade/i1) driver by Alastair M. Robinson
alex
parents:
diff changeset
582 break;
d794e866cf5f EPIA (CyberBlade/i1) driver by Alastair M. Robinson
alex
parents:
diff changeset
583 default:
d794e866cf5f EPIA (CyberBlade/i1) driver by Alastair M. Robinson
alex
parents:
diff changeset
584 CROUTB(0x8F, 0x20); /* VDE Flags - Edge Recovery */
d794e866cf5f EPIA (CyberBlade/i1) driver by Alastair M. Robinson
alex
parents:
diff changeset
585 CROUTB(0xBF, 0x00); /* Video format - YUV */
9023
e40760677a83 Updated to v0.1.4 by Alastair Robinson <blackfive@fakenhamweb.co.uk>
alex
parents: 8513
diff changeset
586 SROUTB(0xBE, 0x00); /* HSCB disable - was 0x03*/
8505
d794e866cf5f EPIA (CyberBlade/i1) driver by Alastair M. Robinson
alex
parents:
diff changeset
587 break;
d794e866cf5f EPIA (CyberBlade/i1) driver by Alastair M. Robinson
alex
parents:
diff changeset
588 }
d794e866cf5f EPIA (CyberBlade/i1) driver by Alastair M. Robinson
alex
parents:
diff changeset
589
d794e866cf5f EPIA (CyberBlade/i1) driver by Alastair M. Robinson
alex
parents:
diff changeset
590 CROUTB(0x92, ((base0+info->offset.y) >> 3) &0xff); /* Lower 8 bits of start address */
d794e866cf5f EPIA (CyberBlade/i1) driver by Alastair M. Robinson
alex
parents:
diff changeset
591 CROUTB(0x93, ((base0+info->offset.y) >> 11) &0xff); /* Mid 8 bits of start address */
d794e866cf5f EPIA (CyberBlade/i1) driver by Alastair M. Robinson
alex
parents:
diff changeset
592 CROUTB(0x94, ((base0+info->offset.y) >> 19) &0xf); /* Upper 4 bits of start address */
d794e866cf5f EPIA (CyberBlade/i1) driver by Alastair M. Robinson
alex
parents:
diff changeset
593 SROUTB(0x80, ((base0+info->offset.v) >> 3) &0xff); /* Lower 8 bits of start address */
d794e866cf5f EPIA (CyberBlade/i1) driver by Alastair M. Robinson
alex
parents:
diff changeset
594 SROUTB(0x81, ((base0+info->offset.v) >> 11) &0xff); /* Mid 8 bits of start address */
d794e866cf5f EPIA (CyberBlade/i1) driver by Alastair M. Robinson
alex
parents:
diff changeset
595 SROUTB(0x82, ((base0+info->offset.v) >> 19) &0xf); /* Upper 4 bits of start address */
d794e866cf5f EPIA (CyberBlade/i1) driver by Alastair M. Robinson
alex
parents:
diff changeset
596 SROUTB(0x83, ((base0+info->offset.u) >> 3) &0xff); /* Lower 8 bits of start address */
d794e866cf5f EPIA (CyberBlade/i1) driver by Alastair M. Robinson
alex
parents:
diff changeset
597 SROUTB(0x84, ((base0+info->offset.u) >> 11) &0xff); /* Mid 8 bits of start address */
d794e866cf5f EPIA (CyberBlade/i1) driver by Alastair M. Robinson
alex
parents:
diff changeset
598 SROUTB(0x85, ((base0+info->offset.u) >> 19) &0xf); /* Upper 4 bits of start address */
d794e866cf5f EPIA (CyberBlade/i1) driver by Alastair M. Robinson
alex
parents:
diff changeset
599 }
d794e866cf5f EPIA (CyberBlade/i1) driver by Alastair M. Robinson
alex
parents:
diff changeset
600
d794e866cf5f EPIA (CyberBlade/i1) driver by Alastair M. Robinson
alex
parents:
diff changeset
601 vixPlaybackSetEq(&equal);
d794e866cf5f EPIA (CyberBlade/i1) driver by Alastair M. Robinson
alex
parents:
diff changeset
602
d794e866cf5f EPIA (CyberBlade/i1) driver by Alastair M. Robinson
alex
parents:
diff changeset
603 /* Protect hardware registers again */
d794e866cf5f EPIA (CyberBlade/i1) driver by Alastair M. Robinson
alex
parents:
diff changeset
604 SROUTB(0x11, protect);
d794e866cf5f EPIA (CyberBlade/i1) driver by Alastair M. Robinson
alex
parents:
diff changeset
605 return 0;
d794e866cf5f EPIA (CyberBlade/i1) driver by Alastair M. Robinson
alex
parents:
diff changeset
606 }
d794e866cf5f EPIA (CyberBlade/i1) driver by Alastair M. Robinson
alex
parents:
diff changeset
607
d794e866cf5f EPIA (CyberBlade/i1) driver by Alastair M. Robinson
alex
parents:
diff changeset
608
d794e866cf5f EPIA (CyberBlade/i1) driver by Alastair M. Robinson
alex
parents:
diff changeset
609 int vixPlaybackOn(void)
d794e866cf5f EPIA (CyberBlade/i1) driver by Alastair M. Robinson
alex
parents:
diff changeset
610 {
9023
e40760677a83 Updated to v0.1.4 by Alastair Robinson <blackfive@fakenhamweb.co.uk>
alex
parents: 8513
diff changeset
611 LOGWRITE("Enable overlay\n");
8505
d794e866cf5f EPIA (CyberBlade/i1) driver by Alastair M. Robinson
alex
parents:
diff changeset
612 CROUTB(0x8E, 0xd4); /* VDE Flags*/
d794e866cf5f EPIA (CyberBlade/i1) driver by Alastair M. Robinson
alex
parents:
diff changeset
613
d794e866cf5f EPIA (CyberBlade/i1) driver by Alastair M. Robinson
alex
parents:
diff changeset
614 return 0;
d794e866cf5f EPIA (CyberBlade/i1) driver by Alastair M. Robinson
alex
parents:
diff changeset
615 }
d794e866cf5f EPIA (CyberBlade/i1) driver by Alastair M. Robinson
alex
parents:
diff changeset
616
d794e866cf5f EPIA (CyberBlade/i1) driver by Alastair M. Robinson
alex
parents:
diff changeset
617
d794e866cf5f EPIA (CyberBlade/i1) driver by Alastair M. Robinson
alex
parents:
diff changeset
618 int vixPlaybackOff(void)
d794e866cf5f EPIA (CyberBlade/i1) driver by Alastair M. Robinson
alex
parents:
diff changeset
619 {
9023
e40760677a83 Updated to v0.1.4 by Alastair Robinson <blackfive@fakenhamweb.co.uk>
alex
parents: 8513
diff changeset
620 LOGWRITE("Disable overlay\n");
8505
d794e866cf5f EPIA (CyberBlade/i1) driver by Alastair M. Robinson
alex
parents:
diff changeset
621 CROUTB(0x8E, 0xc4); /* VDE Flags*/
d794e866cf5f EPIA (CyberBlade/i1) driver by Alastair M. Robinson
alex
parents:
diff changeset
622
d794e866cf5f EPIA (CyberBlade/i1) driver by Alastair M. Robinson
alex
parents:
diff changeset
623 return 0;
d794e866cf5f EPIA (CyberBlade/i1) driver by Alastair M. Robinson
alex
parents:
diff changeset
624 }
d794e866cf5f EPIA (CyberBlade/i1) driver by Alastair M. Robinson
alex
parents:
diff changeset
625
d794e866cf5f EPIA (CyberBlade/i1) driver by Alastair M. Robinson
alex
parents:
diff changeset
626
d794e866cf5f EPIA (CyberBlade/i1) driver by Alastair M. Robinson
alex
parents:
diff changeset
627 int vixPlaybackFrameSelect(unsigned int frame)
d794e866cf5f EPIA (CyberBlade/i1) driver by Alastair M. Robinson
alex
parents:
diff changeset
628 {
d794e866cf5f EPIA (CyberBlade/i1) driver by Alastair M. Robinson
alex
parents:
diff changeset
629 int protect;
9023
e40760677a83 Updated to v0.1.4 by Alastair Robinson <blackfive@fakenhamweb.co.uk>
alex
parents: 8513
diff changeset
630 LOGWRITE("Frame select\n");
8505
d794e866cf5f EPIA (CyberBlade/i1) driver by Alastair M. Robinson
alex
parents:
diff changeset
631 protect=SRINB(0x11);
d794e866cf5f EPIA (CyberBlade/i1) driver by Alastair M. Robinson
alex
parents:
diff changeset
632 SROUTB(0x11, 0x92);
d794e866cf5f EPIA (CyberBlade/i1) driver by Alastair M. Robinson
alex
parents:
diff changeset
633 /* Set overlay address to that of selected frame */
d794e866cf5f EPIA (CyberBlade/i1) driver by Alastair M. Robinson
alex
parents:
diff changeset
634 CROUTB(0x92, ((frames[frame]+YOffs) >> 3) &0xff); /* Lower 8 bits of start address */
d794e866cf5f EPIA (CyberBlade/i1) driver by Alastair M. Robinson
alex
parents:
diff changeset
635 CROUTB(0x93, ((frames[frame]+YOffs) >> 11) &0xff); /* Mid 8 bits of start address */
d794e866cf5f EPIA (CyberBlade/i1) driver by Alastair M. Robinson
alex
parents:
diff changeset
636 CROUTB(0x94, ((frames[frame]+YOffs) >> 19) &0xf); /* Upper 4 bits of start address */
d794e866cf5f EPIA (CyberBlade/i1) driver by Alastair M. Robinson
alex
parents:
diff changeset
637 SROUTB(0x80, ((frames[frame]+VOffs) >> 3) &0xff); /* Lower 8 bits of start address */
d794e866cf5f EPIA (CyberBlade/i1) driver by Alastair M. Robinson
alex
parents:
diff changeset
638 SROUTB(0x81, ((frames[frame]+VOffs) >> 11) &0xff); /* Mid 8 bits of start address */
d794e866cf5f EPIA (CyberBlade/i1) driver by Alastair M. Robinson
alex
parents:
diff changeset
639 SROUTB(0x82, ((frames[frame]+VOffs) >> 19) &0xf); /* Upper 4 bits of start address */
d794e866cf5f EPIA (CyberBlade/i1) driver by Alastair M. Robinson
alex
parents:
diff changeset
640 SROUTB(0x83, ((frames[frame]+UOffs) >> 3) &0xff); /* Lower 8 bits of start address */
d794e866cf5f EPIA (CyberBlade/i1) driver by Alastair M. Robinson
alex
parents:
diff changeset
641 SROUTB(0x84, ((frames[frame]+UOffs) >> 11) &0xff); /* Mid 8 bits of start address */
d794e866cf5f EPIA (CyberBlade/i1) driver by Alastair M. Robinson
alex
parents:
diff changeset
642 SROUTB(0x85, ((frames[frame]+UOffs) >> 19) &0xf); /* Upper 4 bits of start address */
d794e866cf5f EPIA (CyberBlade/i1) driver by Alastair M. Robinson
alex
parents:
diff changeset
643 SROUTB(0x11, protect);
d794e866cf5f EPIA (CyberBlade/i1) driver by Alastair M. Robinson
alex
parents:
diff changeset
644 return 0;
d794e866cf5f EPIA (CyberBlade/i1) driver by Alastair M. Robinson
alex
parents:
diff changeset
645 }
d794e866cf5f EPIA (CyberBlade/i1) driver by Alastair M. Robinson
alex
parents:
diff changeset
646
d794e866cf5f EPIA (CyberBlade/i1) driver by Alastair M. Robinson
alex
parents:
diff changeset
647