8505
|
1 /*
|
|
2 Driver for CyberBlade/i1 - Version 0.1.1
|
|
3
|
|
4 Copyright (C) 2002 by Alastair M. Robinson.
|
|
5 Based on Permedia 3 driver by Måns Rullgård
|
|
6
|
|
7 Thanks to Gilles Frattini for bugfixes
|
|
8
|
|
9 Official homepage: http://www.blackfiveservices.co.uk/EPIAVidix.shtml
|
|
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);
|
|
203 }
|
|
204
|
|
205
|
|
206 int vixGetCapability(vidix_capability_t *to)
|
|
207 {
|
|
208 memcpy(to, &cyberblade_cap, sizeof(vidix_capability_t));
|
|
209 return 0;
|
|
210 }
|
|
211
|
|
212
|
|
213 static int is_supported_fourcc(uint32_t fourcc)
|
|
214 {
|
|
215 switch(fourcc)
|
|
216 {
|
|
217 case IMGFMT_YUY2:
|
|
218 case IMGFMT_YV12:
|
|
219 case IMGFMT_YVU9:
|
|
220 case IMGFMT_BGR16:
|
|
221 return 1;
|
|
222 default:
|
|
223 return 0;
|
|
224 }
|
|
225 }
|
|
226
|
|
227 int vixQueryFourcc(vidix_fourcc_t *to)
|
|
228 {
|
|
229 if(is_supported_fourcc(to->fourcc))
|
|
230 {
|
|
231 to->depth = VID_DEPTH_1BPP | VID_DEPTH_2BPP |
|
|
232 VID_DEPTH_4BPP | VID_DEPTH_8BPP |
|
|
233 VID_DEPTH_12BPP| VID_DEPTH_15BPP|
|
|
234 VID_DEPTH_16BPP| VID_DEPTH_24BPP|
|
|
235 VID_DEPTH_32BPP;
|
|
236 to->flags = VID_CAP_EXPAND | VID_CAP_SHRINK | VID_CAP_COLORKEY;
|
|
237 return 0;
|
|
238 }
|
|
239 else
|
|
240 to->depth = to->flags = 0;
|
|
241 return ENOSYS;
|
|
242 }
|
|
243
|
|
244
|
|
245 static int frames[VID_PLAY_MAXFRAMES];
|
|
246
|
|
247 static vidix_grkey_t cyberblade_grkey;
|
|
248
|
|
249 int vixGetGrKeys(vidix_grkey_t *grkey)
|
|
250 {
|
|
251 memcpy(grkey, &cyberblade_grkey, sizeof(vidix_grkey_t));
|
|
252 return(0);
|
|
253 }
|
|
254
|
|
255 int vixSetGrKeys(const vidix_grkey_t *grkey)
|
|
256 {
|
|
257 int pixfmt=CRINB(0x38);
|
|
258 memcpy(&cyberblade_grkey, grkey, sizeof(vidix_grkey_t));
|
|
259
|
|
260 if(pixfmt&0x28) /* 32 or 24 bpp */
|
|
261 {
|
|
262 SROUTB(0x50, cyberblade_grkey.ckey.blue); /* Colour Key */
|
|
263 SROUTB(0x51, cyberblade_grkey.ckey.green); /* Colour Key */
|
|
264 SROUTB(0x52, cyberblade_grkey.ckey.red); /* Colour Key */
|
|
265 SROUTB(0x54, 0xff); /* Colour Key Mask */
|
|
266 SROUTB(0x55, 0xff); /* Colour Key Mask */
|
|
267 SROUTB(0x56, 0xff); /* Colour Key Mask */
|
|
268 }
|
|
269 else
|
|
270 {
|
|
271 int tmp=((cyberblade_grkey.ckey.blue & 0xF8)>>3)
|
|
272 | ((cyberblade_grkey.ckey.green & 0xfc)<<3)
|
|
273 | ((cyberblade_grkey.ckey.red & 0xf8)<<8);
|
|
274 SROUTB(0x50, tmp&0xff); /* Colour Key */
|
|
275 SROUTB(0x51, (tmp>>8)&0xff); /* Colour Key */
|
|
276 SROUTB(0x52, 0); /* Colour Key */
|
|
277 SROUTB(0x54, 0xff); /* Colour Key Mask */
|
|
278 SROUTB(0x55, 0xff); /* Colour Key Mask */
|
|
279 SROUTB(0x56, 0x00); /* Colour Key Mask */
|
|
280 }
|
|
281 return(0);
|
|
282 }
|
|
283
|
|
284
|
|
285 vidix_video_eq_t equal =
|
|
286 {
|
|
287 VEQ_CAP_BRIGHTNESS | VEQ_CAP_SATURATION | VEQ_CAP_HUE,
|
|
288 300, 100, 0, 0, 0, 0, 0, 0
|
|
289 };
|
|
290
|
|
291 int vixPlaybackGetEq( vidix_video_eq_t * eq)
|
|
292 {
|
|
293 memcpy(eq,&equal,sizeof(vidix_video_eq_t));
|
|
294 return 0;
|
|
295 }
|
|
296
|
|
297 int vixPlaybackSetEq( const vidix_video_eq_t * eq)
|
|
298 {
|
|
299 int br,sat,cr,protect;
|
|
300 if(eq->cap & VEQ_CAP_BRIGHTNESS) equal.brightness = eq->brightness;
|
|
301 if(eq->cap & VEQ_CAP_CONTRAST) equal.contrast = eq->contrast;
|
|
302 if(eq->cap & VEQ_CAP_SATURATION) equal.saturation = eq->saturation;
|
|
303 if(eq->cap & VEQ_CAP_HUE) equal.hue = eq->hue;
|
|
304 if(eq->cap & VEQ_CAP_RGB_INTENSITY)
|
|
305 {
|
|
306 equal.red_intensity = eq->red_intensity;
|
|
307 equal.green_intensity = eq->green_intensity;
|
|
308 equal.blue_intensity = eq->blue_intensity;
|
|
309 }
|
|
310 equal.flags = eq->flags;
|
|
311
|
|
312 cr = (equal.contrast) * 31 / 2000; cr+=16;
|
|
313 if (cr < 0) cr = 0; if(cr > 7) cr = 7;
|
|
314 cr=cr<<4 | cr;
|
|
315
|
|
316 br = (equal.brightness+1000) * 63 / 2000;
|
|
317 if (br < 0) br = 0; if(br > 63) br = 63;
|
|
318 if(br>32) br-=32; else br+=32;
|
|
319
|
|
320 sat = (equal.saturation + 1000) * 16 / 2000;
|
|
321 if (sat < 0) sat = 0; if(sat > 31) sat = 31;
|
|
322
|
|
323 protect=SRINB(0x11);
|
|
324 SROUTB(0x11, 0x92);
|
|
325
|
|
326 SROUTB(0xBC,cr);
|
|
327 SROUTW(0xB0,(br<<10)|4);
|
|
328
|
|
329 SROUTB(0x11, protect);
|
|
330
|
|
331 return 0;
|
|
332 }
|
|
333
|
|
334
|
|
335 static int YOffs,UOffs,VOffs;
|
|
336
|
|
337 int vixConfigPlayback(vidix_playback_t *info)
|
|
338 {
|
|
339 int shrink, zoom;
|
|
340 int src_w, drw_w;
|
|
341 int src_h, drw_h;
|
|
342 int hscale,vscale;
|
|
343 long base0;
|
|
344 int y_pitch, uv_pitch;
|
|
345 int protect=0;
|
|
346 int layout=0;
|
|
347 unsigned int i;
|
|
348
|
|
349 if(!is_supported_fourcc(info->fourcc))
|
|
350 return -1;
|
|
351
|
|
352 src_w = info->src.w;
|
|
353 src_h = info->src.h;
|
|
354
|
|
355 drw_w = info->dest.w;
|
|
356 drw_h = info->dest.h;
|
|
357
|
|
358 switch(info->fourcc)
|
|
359 {
|
|
360 case IMGFMT_YUY2:
|
|
361 case IMGFMT_BGR16:
|
|
362 y_pitch = (src_w*2 + 15) & ~15;
|
|
363 uv_pitch = 0;
|
|
364 YOffs=VOffs=UOffs=info->offset.y = info->offset.v = info->offset.u = 0;
|
|
365 info->frame_size = y_pitch*src_h;
|
|
366 layout=0x0; /* packed */
|
|
367 break;
|
|
368 case IMGFMT_YV12:
|
|
369 y_pitch = (src_w+15) & ~15;
|
|
370 uv_pitch = ((src_w/2)+7) & ~7;
|
|
371 YOffs=info->offset.y = 0;
|
|
372 VOffs=info->offset.v = y_pitch*src_h;
|
|
373 UOffs=info->offset.u = info->offset.v+(uv_pitch)*(src_h/2);
|
|
374 info->frame_size = y_pitch*src_h + 2*uv_pitch*(src_h/2);
|
|
375 layout=0x1; /* planar, 4:1:1 */
|
|
376 break;
|
|
377 case IMGFMT_YVU9:
|
|
378 y_pitch = (src_w+15) & ~15;
|
|
379 uv_pitch = ((src_w/4)+3) & ~3;
|
|
380 YOffs=info->offset.y = 0;
|
|
381 VOffs=info->offset.v = y_pitch*src_h;
|
|
382 UOffs=info->offset.u = info->offset.v+(uv_pitch)*(src_h/4);
|
|
383 info->frame_size = y_pitch*src_h + 2*uv_pitch*(src_h/4);
|
|
384 layout=0x51; /* planar, 16:1:1 */
|
|
385 break;
|
|
386 }
|
|
387
|
|
388 /* Assume we have 4 MB to play with */
|
|
389 info->num_frames = 0x400000 / info->frame_size;
|
|
390 if(info->num_frames > VID_PLAY_MAXFRAMES)
|
|
391 info->num_frames = VID_PLAY_MAXFRAMES;
|
|
392
|
|
393 /* Start at 4 MB. Let's hope it's not in use. */
|
|
394 base0 = 0x400000;
|
|
395 info->dga_addr = cyberblade_mem + base0;
|
|
396
|
|
397 info->dest.pitch.y = 16;
|
|
398 info->dest.pitch.u = 16;
|
|
399 info->dest.pitch.v = 16;
|
|
400
|
|
401 for(i = 0; i < info->num_frames; i++)
|
|
402 {
|
|
403 info->offsets[i] = info->frame_size * i;
|
|
404 frames[i] = base0+info->offsets[i];
|
|
405 }
|
|
406
|
|
407 /* Unprotect hardware registers... */
|
|
408 protect=SRINB(0x11);
|
|
409 SROUTB(0x11, 0x92);
|
|
410
|
|
411 SROUTB(0x57, 0xc0); /* Playback key function */
|
|
412 SROUTB(0x21, 0x34); /* Signature control */
|
|
413 SROUTB(0x37, 0x30); /* Video key mode */
|
|
414
|
|
415 {
|
|
416 int pixfmt=CRINB(0x38);
|
|
417 if(pixfmt&0x28) /* 32 or 24 bpp */
|
|
418 {
|
|
419 SROUTB(0x50, cyberblade_grkey.ckey.blue); /* Colour Key */
|
|
420 SROUTB(0x51, cyberblade_grkey.ckey.green); /* Colour Key */
|
|
421 SROUTB(0x52, cyberblade_grkey.ckey.red); /* Colour Key */
|
|
422 SROUTB(0x54, 0xff); /* Colour Key Mask */
|
|
423 SROUTB(0x55, 0xff); /* Colour Key Mask */
|
|
424 SROUTB(0x56, 0xff); /* Colour Key Mask */
|
|
425 }
|
|
426 else
|
|
427 {
|
|
428 int tmp=((cyberblade_grkey.ckey.blue & 0xf8)>>3)
|
|
429 |((cyberblade_grkey.ckey.green & 0xfc)<<3)
|
|
430 |((cyberblade_grkey.ckey.red & 0xf8)<<8);
|
|
431 SROUTB(0x50, tmp&0xff); /* Colour Key */
|
|
432 SROUTB(0x51, (tmp>>8)&0xff); /* Colour Key */
|
|
433 SROUTB(0x52, 0x00); /* Colour Key */
|
|
434 SROUTB(0x54, 0xff); /* Colour Key Mask */
|
|
435 SROUTB(0x55, 0xff); /* Colour Key Mask */
|
|
436 SROUTB(0x56, 0x00); /* Colour Key Mask */
|
|
437 }
|
|
438 }
|
|
439 /* compute_scale_factor(&src_w, &drw_w, &shrink, &zoom); */
|
|
440 {
|
|
441 int HTotal,VTotal,HSync,VSync,Overflow;
|
|
442 int tx1,ty1,tx2,ty2;
|
|
443
|
|
444 if(CRINB(0xd1)&0x80)
|
|
445 {
|
|
446 fprintf(stderr,"[cyberblade] Using TV-CRTC\n");
|
|
447 HTotal=CRINB(0xe0);
|
|
448 HSync=CRINB(0xe4);
|
|
449 VTotal=CRINB(0xe6);
|
|
450 VSync=CRINB(0xf0);
|
|
451 Overflow=CRINB(0xe7);
|
|
452 HTotal <<=3; HTotal-=16;
|
|
453 HSync <<=3;
|
|
454 VTotal |= (Overflow & 1) <<8;
|
|
455 VTotal |= (Overflow & 0x20) <<4;
|
|
456 VTotal +=5;
|
|
457 VSync |= (Overflow & 4) <<6;
|
|
458 VSync |= (Overflow & 0x80) <<2;
|
|
459 }
|
|
460 else
|
|
461 {
|
|
462 fprintf(stderr,"[cyberblade] Using Standard CRTC\n");
|
|
463 HTotal=CRINB(0x00);
|
|
464 HSync=CRINB(0x04);
|
|
465 VTotal=CRINB(0x06);
|
|
466 VSync=CRINB(0x10);
|
|
467 Overflow=CRINB(0x07);
|
|
468 HTotal <<=3;
|
|
469 HSync <<=3;
|
|
470 VTotal |= (Overflow & 1) <<8;
|
|
471 VTotal |= (Overflow & 0x20) <<4;
|
|
472 VSync |= (Overflow & 4) <<6;
|
|
473 VSync |= (Overflow & 0x80) <<2;
|
|
474 }
|
|
475
|
|
476 tx1=(HTotal-HSync)+15+info->dest.x;
|
|
477 ty1=(VTotal-VSync)-8+info->dest.y;
|
|
478 tx2=tx1+info->dest.w;
|
|
479 ty2=ty1+info->dest.h;
|
|
480
|
|
481 CROUTW(0x86,tx1);
|
|
482 CROUTW(0x88,ty1);
|
|
483 CROUTW(0x8a,tx2);
|
|
484 CROUTW(0x8c,ty2+3);
|
|
485 }
|
|
486
|
|
487 if(src_w==drw_w)
|
|
488 hscale=0;
|
|
489 else if(src_w<drw_w)
|
|
490 {
|
|
491 hscale=((src_w<<10)/(drw_w-2)) & 0x1fff;
|
|
492 }
|
|
493 else
|
|
494 {
|
|
495 hscale=0x8000 | ((((src_w/drw_w)-1)&7)<<10) | (((drw_w<<10)/src_w) & 0x3ff);
|
|
496 }
|
|
497
|
|
498 vscale=(src_h<<10)/(drw_h);
|
|
499 if(drw_h<src_h)
|
|
500 vscale=0x8000|((drw_h<<10)/(src_h));
|
|
501
|
|
502 /* Write scale factors to hardware */
|
|
503
|
|
504 CROUTW(0x80,hscale); /* Horizontal Scale */
|
|
505 CROUTW(0x82,vscale); /* Vertical Scale */
|
|
506
|
|
507 /* Now set the start address and data layout */
|
|
508 {
|
|
509 int lb = (y_pitch+2) >> 2;
|
|
510 CROUTB(0x95, ((lb & 0x100)>>1) | 0x08 ); /* Linebuffer level bit 8 & threshold */
|
|
511 CROUTB(0x96, (lb & 0xFF)); /* Linebuffer level */
|
|
512
|
|
513 CROUTB(0x97, 0x00); /* VDE Flags */
|
|
514 CROUTB(0xBA, 0x00); /* Chroma key */
|
|
515 CROUTB(0xBB, 0x00); /* Chroma key */
|
|
516 CROUTB(0xBC, 0xFF); /* Chroma key */
|
|
517 CROUTB(0xBD, 0xFF); /* Chroma key */
|
|
518 CROUTB(0xBE, 0x05); /* Capture control */
|
|
519
|
|
520 if(src_w > 384)
|
|
521 layout|=4; /* 2x line buffers */
|
|
522 SROUTB(0x97, layout);
|
|
523
|
|
524 CROUTW(0x90,y_pitch); /* Y Bytes per row */
|
|
525 SROUTW(0x9A,uv_pitch); /* UV Bytes per row */
|
|
526
|
|
527 switch(info->fourcc)
|
|
528 {
|
|
529 case IMGFMT_BGR16:
|
|
530 CROUTB(0x8F, 0x24); /* VDE Flags - Edge Recovery & CSC Bypass */
|
|
531 CROUTB(0xBF, 0x02); /* Video format - RGB16 */
|
|
532 SROUTB(0xBE, 0x0); /* HSCB disabled */
|
|
533 break;
|
|
534 default:
|
|
535 CROUTB(0x8F, 0x20); /* VDE Flags - Edge Recovery */
|
|
536 CROUTB(0xBF, 0x00); /* Video format - YUV */
|
|
537 SROUTB(0xBE, 0x03); /* HSCB enabled */
|
|
538 break;
|
|
539 }
|
|
540
|
|
541 CROUTB(0x92, ((base0+info->offset.y) >> 3) &0xff); /* Lower 8 bits of start address */
|
|
542 CROUTB(0x93, ((base0+info->offset.y) >> 11) &0xff); /* Mid 8 bits of start address */
|
|
543 CROUTB(0x94, ((base0+info->offset.y) >> 19) &0xf); /* Upper 4 bits of start address */
|
|
544 SROUTB(0x80, ((base0+info->offset.v) >> 3) &0xff); /* Lower 8 bits of start address */
|
|
545 SROUTB(0x81, ((base0+info->offset.v) >> 11) &0xff); /* Mid 8 bits of start address */
|
|
546 SROUTB(0x82, ((base0+info->offset.v) >> 19) &0xf); /* Upper 4 bits of start address */
|
|
547 SROUTB(0x83, ((base0+info->offset.u) >> 3) &0xff); /* Lower 8 bits of start address */
|
|
548 SROUTB(0x84, ((base0+info->offset.u) >> 11) &0xff); /* Mid 8 bits of start address */
|
|
549 SROUTB(0x85, ((base0+info->offset.u) >> 19) &0xf); /* Upper 4 bits of start address */
|
|
550 }
|
|
551
|
|
552 vixPlaybackSetEq(&equal);
|
|
553
|
|
554 /* Protect hardware registers again */
|
|
555 SROUTB(0x11, protect);
|
|
556 return 0;
|
|
557 }
|
|
558
|
|
559
|
|
560 int vixPlaybackOn(void)
|
|
561 {
|
|
562 /* Enable overlay */
|
|
563 CROUTB(0x8E, 0xd4); /* VDE Flags*/
|
|
564
|
|
565 return 0;
|
|
566 }
|
|
567
|
|
568
|
|
569 int vixPlaybackOff(void)
|
|
570 {
|
|
571 /* Disable overlay */
|
|
572 CROUTB(0x8E, 0xc4); /* VDE Flags*/
|
|
573
|
|
574 return 0;
|
|
575 }
|
|
576
|
|
577
|
|
578 int vixPlaybackFrameSelect(unsigned int frame)
|
|
579 {
|
|
580 int protect;
|
|
581 protect=SRINB(0x11);
|
|
582 SROUTB(0x11, 0x92);
|
|
583 /* Set overlay address to that of selected frame */
|
|
584 CROUTB(0x92, ((frames[frame]+YOffs) >> 3) &0xff); /* Lower 8 bits of start address */
|
|
585 CROUTB(0x93, ((frames[frame]+YOffs) >> 11) &0xff); /* Mid 8 bits of start address */
|
|
586 CROUTB(0x94, ((frames[frame]+YOffs) >> 19) &0xf); /* Upper 4 bits of start address */
|
|
587 SROUTB(0x80, ((frames[frame]+VOffs) >> 3) &0xff); /* Lower 8 bits of start address */
|
|
588 SROUTB(0x81, ((frames[frame]+VOffs) >> 11) &0xff); /* Mid 8 bits of start address */
|
|
589 SROUTB(0x82, ((frames[frame]+VOffs) >> 19) &0xf); /* Upper 4 bits of start address */
|
|
590 SROUTB(0x83, ((frames[frame]+UOffs) >> 3) &0xff); /* Lower 8 bits of start address */
|
|
591 SROUTB(0x84, ((frames[frame]+UOffs) >> 11) &0xff); /* Mid 8 bits of start address */
|
|
592 SROUTB(0x85, ((frames[frame]+UOffs) >> 19) &0xf); /* Upper 4 bits of start address */
|
|
593 SROUTB(0x11, protect);
|
|
594 return 0;
|
|
595 }
|
|
596
|
|
597
|