rem: void voodoo3_display_overlay(const overlay_window *ow, const overlay_buffer *ob, const overlay_view* ov) {
add: voodoo3_display_overlay(const overlay_window *ow, const overlay_buffer *ob, const overlay_view *ov) {
context: void voodoo3_display_overlay(const overlay_window *ow, const overlay_buffer *ob, const overlay_view* ov) {	uint8 red, green, blue;		int32 offset;    int32 pitch;    int32 dudx, dvdy;    uint32 left=0;    uint32 srcwidth;    uint32 vidcfg, stride;	uint32 x1, y1, x2, y2;		uint32 offset_left, offset_top;	if (ow==NULL||ob==NULL||ov==NULL) return;	offset=(uint32)ob->buffer_dma; // Start OFFSET as PCI Space    pitch=((ob->width<<1) + 3) & ~3;  // offset (of Desktop && Overlay)   	offset_left=ow->h_start<0?-ow->h_start:0;	offset_top=ow->v_start<0?-ow->v_start:0;    dudx = (ob->width << 20) / (ow->width);    dvdy = (ob->height << 20) / (ow->height);    left = ((offset_left*dudx<<16) & 0x0001ffff) << 3; 	x1=ow->h_start + offset_left;	y1=ow->v_start + offset_top;		x2=x1 + ow->width;	if (x2>=accel.width) x2=accel.width; 	y2=y1 + ow->height;	if (y2>=accel.height) y2=accel.height; 			offset+=((offset_left*dudx>>20) & ~1) << 1;	srcwidth=(ob->width<<20);     vidcfg=voodoo3_read32(VIDPROCCFG);	stride=voodoo3_read32(VIDDESKTOPOVERLAYSTRIDE);        vidcfg &= ~VIDPROCCFGMASK;   	vidcfg |= VIDCFG_CHROMA_KEY | VIDCFG_OVL_ENABLE | VIDCFG_OVL_NOT_VIDEO_IN | 		VIDCFG_OVL_CLUT_BYPASS;    if(ob->width != ow->width)    	vidcfg |= VIDCFG_OVL_HSCALE;    if(ob->height != ow->height)    	vidcfg |= VIDCFG_OVL_VSCALE;	switch( ob->space) {			case B_YCbCr422:#if __POWERPC__				switch(accel.bpp) {					case 8:						vidcfg |= VIDCFG_OVL_FMT_YUYV422 << VIDCFG_OVL_FMT_SHIFT;						break;					case 16:						vidcfg |= VIDCFG_OVL_FMT_UYVY422 << VIDCFG_OVL_FMT_SHIFT;						break;					default:						ddpf(( "YCbCr overlays aren't supported in 32 bit mode" ));						return;				}#else				vidcfg |= VIDCFG_OVL_FMT_YUYV422 << VIDCFG_OVL_FMT_SHIFT;#endif				break;#if __POWERPC__			case B_RGB16_BIG:#else			case B_RGB16:#endif				vidcfg |= VIDCFG_OVL_FMT_RGB565 << VIDCFG_OVL_FMT_SHIFT;				break;			default: return;	}    /* can't do bilinear filtering when in 2X mode */  	if( (vidcfg & VIDCFG_2X) == 0 )		vidcfg |= VIDCFG_OVL_FILTER_BILIN << VIDCFG_OVL_FILTER_SHIFT;	voodoo3_make_room( 12 );	    voodoo3_write32(VIDPROCCFG, vidcfg);	if ((ow->flags & B_OVERLAY_COLOR_KEY)==B_OVERLAY_COLOR_KEY) {		uint32 color=0;		red=ow->red.value & ow->red.mask;		green=ow->green.value & ow->green.mask;		blue=ow->blue.value & ow->blue.mask;				switch (voodoo3_bits_per_pixel()) {			case(8):			case(32):				color=	(red << 16)+(green << 8)+(blue << 0);				break;			case(16):				color=	(red << 11)+(green << 5)+(blue << 0);				break;		}	    voodoo3_write32(VIDCHROMAMIN, color);    	voodoo3_write32(VIDCHROMAMAX, color);    }	/* Setting up position of Overlaywindow on Screen */    voodoo3_write32(VIDOVERLAYSTARTCOORDS, x1 | (y1 << 12));	voodoo3_write32(VIDOVERLAYENDSCREENCOORDS, (x2 - 1) | ((y2 - 1) << 12));	/* Setting up scale and position of overlay in Graphics Memory */	voodoo3_write32(VIDOVERLAYDUDX, dudx);	voodoo3_write32(VIDOVERLAYDUDXOFFSETSRCWIDTH, left | srcwidth);	voodoo3_write32(VIDOVERLAYDVDY, dvdy);	voodoo3_write32(VIDOVERLAYDVDYOFFSET, (y1 & 0x0000ffff) << 3);    stride &= 0x0000ffff;    stride |= pitch << 16;    voodoo3_write32(VIDDESKTOPOVERLAYSTRIDE, stride);	voodoo3_write32(SST_3D_LEFTOVERLAYBUF, offset);	voodoo3_write32(VIDINADDR0, offset);}