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