annotate vidix/cyberblade_vid.c @ 22865:441582f3ed87

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