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