Пример #1
0
void
Savage_InvertRectangle(engine_token *et, fill_rect_params *pList, uint32 count)
{
    int cmd = BCI_CMD_RECT | BCI_CMD_RECT_XP | BCI_CMD_RECT_YP
              | BCI_CMD_DEST_PBD_NEW;

    (void)et;		// avoid compiler warning for unused arg

    BCI_CMD_SET_ROP(cmd, 0x55);		// use GXinvert for rop

    while (count--) {
        int x = pList->left;
        int y = pList->top;
        int w = pList->right - x + 1;
        int h = pList->bottom - y + 1;

        BCI_GET_PTR;

        gInfo.WaitQueue(7);

        BCI_SEND(cmd);
        BCI_SEND(gInfo.sharedInfo->frameBufferOffset);
        BCI_SEND(gInfo.sharedInfo->globalBitmapDesc);

        BCI_SEND(BCI_X_Y(x, y));
        BCI_SEND(BCI_W_H(w, h));

        pList++;
    }
}
Пример #2
0
void savagefb_fillrect(struct fb_info *info, const struct fb_fillrect *rect)
{
	struct savagefb_par *par = info->par;
	int cmd, color;

	if (!rect->width || !rect->height)
		return;

	if (info->fix.visual == FB_VISUAL_PSEUDOCOLOR)
		color = rect->color;
	else
		color = ((u32 *)info->pseudo_palette)[rect->color];

	cmd = BCI_CMD_RECT | BCI_CMD_RECT_XP | BCI_CMD_RECT_YP |
	      BCI_CMD_DEST_GBD | BCI_CMD_SRC_SOLID |
	      BCI_CMD_SEND_COLOR;

	par->bci_ptr = 0;
	BCI_CMD_SET_ROP(cmd, savagefb_rop[rect->rop]);

	par->SavageWaitFifo(par,4);
	BCI_SEND(cmd);
	BCI_SEND(color);
	BCI_SEND( BCI_X_Y(rect->dx, rect->dy) );
	BCI_SEND( BCI_W_H(rect->width, rect->height) );
}
Пример #3
0
static inline void savage4_validate_pbd( Savage4DriverData *sdrv,
                                         Savage4DeviceData *sdev,
                                         CardState         *state )
{
     u32 BitmapDescriptor;
     CoreSurface *source;
     int bpp;

     if (sdev->v_pbd)
          return;

     source = state->source;
     bpp = DFB_BYTES_PER_PIXEL(source->config.format);
     
     BitmapDescriptor = BCI_BD_BW_DISABLE;
     BCI_BD_SET_BPP( BitmapDescriptor, bpp * 8 );
     BCI_BD_SET_STRIDE( BitmapDescriptor, state->src.pitch / bpp );

     
     savage4_waitidle( sdrv, sdev );

     BCI_SEND( BCI_CMD_SETREG | (1 << 16) | BCI_PBD1 );
     BCI_SEND( state->src.offset );

     BCI_SEND( BCI_CMD_SETREG | (1 << 16) | BCI_PBD2 );
     BCI_SEND( BitmapDescriptor );
     
     sdev->v_pbd = 1;
}
Пример #4
0
void savagefb_copyarea(struct fb_info *info, const struct fb_copyarea *region)
{
	struct savagefb_par *par = info->par;
	int sx = region->sx, dx = region->dx;
	int sy = region->sy, dy = region->dy;
	int cmd;

	if (!region->width || !region->height)
		return;
	par->bci_ptr = 0;
	cmd = BCI_CMD_RECT | BCI_CMD_DEST_GBD | BCI_CMD_SRC_GBD;
	BCI_CMD_SET_ROP(cmd, savagefb_rop[0]);

	if (dx <= sx) {
		cmd |= BCI_CMD_RECT_XP;
	} else {
		sx += region->width - 1;
		dx += region->width - 1;
	}

	if (dy <= sy) {
		cmd |= BCI_CMD_RECT_YP;
	} else {
		sy += region->height - 1;
		dy += region->height - 1;
	}

	par->SavageWaitFifo(par,4);
	BCI_SEND(cmd);
	BCI_SEND(BCI_X_Y(sx, sy));
	BCI_SEND(BCI_X_Y(dx, dy));
	BCI_SEND(BCI_W_H(region->width, region->height));
}
Пример #5
0
static inline void savage4_validate_gbd( Savage4DriverData *sdrv,
                                         Savage4DeviceData *sdev,
                                         CardState         *state )
{
     u32 BitmapDescriptor;
     CoreSurface *destination;
     int bpp;

     if (sdev->v_gbd)
          return;

     destination = state->destination;
     bpp = DFB_BYTES_PER_PIXEL(destination->config.format);
     
     BitmapDescriptor = BCI_BD_BW_DISABLE | 8 | 1;
     BCI_BD_SET_BPP( BitmapDescriptor, bpp * 8 );
     BCI_BD_SET_STRIDE( BitmapDescriptor, state->dst.pitch / bpp );

     /* strange effects if we don't wait here for the Savage4 being idle */
     savage4_waitidle( sdrv, sdev );

     BCI_SEND( BCI_CMD_SETREG | (1 << 16) | BCI_GBD1 );
     BCI_SEND( state->dst.offset );

     BCI_SEND( BCI_CMD_SETREG | (1 << 16) | BCI_GBD2 );
     BCI_SEND( BitmapDescriptor );

     sdev->v_gbd = 1;
}
Пример #6
0
static inline void savage3D_set_clip( Savage3DDriverData *sdrv,
                                      Savage3DDeviceData *sdev,
                                      DFBRegion          *clip )
{
     savage3D_waitfifo( sdrv, sdev, 3 );

     BCI_SEND( BCI_CMD_NOP | BCI_CMD_CLIP_NEW );

     BCI_SEND( BCI_CLIP_TL( clip->y1, clip->x1 ) );
     BCI_SEND( BCI_CLIP_BR( clip->y2, clip->x2 ) );
}
Пример #7
0
static inline void savage4_set_clip( Savage4DriverData *sdrv,
                                     Savage4DeviceData *sdev,
                                     DFBRegion         *clip )
{
     SVGDBG("savage4_set_clip x1:%i y1:%i x2:%i y2:%i\n",
            clip->x1, clip->y1, clip->x2, clip->y2);
     savage4_waitfifo( sdrv, sdev, 3 );

     BCI_SEND( BCI_CMD_NOP | BCI_CMD_CLIP_NEW );

     BCI_SEND( BCI_CLIP_TL( clip->y1, clip->x1 ) );
     BCI_SEND( BCI_CLIP_BR( clip->y2, clip->x2 ) );
}
Пример #8
0
static bool savage3DFillRectangle( void *drv, void *dev, DFBRectangle *rect )
{
     Savage3DDriverData *sdrv = (Savage3DDriverData*) drv;
     Savage3DDeviceData *sdev = (Savage3DDeviceData*) dev;
     
     savage3D_waitfifo( sdrv, sdev, 3 );

     BCI_SEND( BCI_CMD_RECT | BCI_CMD_CLIP_CURRENT |
               BCI_CMD_RECT_XP | BCI_CMD_RECT_YP |
               BCI_CMD_DEST_GBD | BCI_CMD_SRC_SOLID | (0xcc << 16) );

     BCI_SEND( BCI_X_Y(rect->x, rect->y) );
     BCI_SEND( BCI_W_H(rect->w, rect->h) );

     return true;
}
Пример #9
0
static bool savage4Blit( void *drv, void *dev,
                         DFBRectangle *rect, int dx, int dy )
{
     Savage4DriverData *sdrv = (Savage4DriverData*) drv;
     Savage4DeviceData *sdev = (Savage4DeviceData*) dev;
     
     u32 cmd = ( BCI_CMD_RECT | sdev->Cmd_Src_Transparent |
                 BCI_CMD_CLIP_CURRENT | BCI_CMD_DEST_GBD |
                 BCI_CMD_SRC_PBD_COLOR | (0xcc << 16) );
 
     SVGDBG("savage4Blit x:%i y:%i w:%i h:%i dx:%i dy:%i\n",
            rect->x, rect->y, rect->w, rect->h, dx, dy);

     if (dx < rect->x && dx >= 0) {
          cmd |= BCI_CMD_RECT_XP; /* left to right */
     } 
     else {
          dx      += rect->w - 1;
          rect->x += rect->w - 1;
     }

     if (dy < rect->y && dy >= 0) { 
          cmd |= BCI_CMD_RECT_YP; /* top to bottom */
     }
     else {
          dy      += rect->h - 1;
          rect->y += rect->h - 1;
     }

     savage4_waitfifo( sdrv, sdev, sdev->Cmd_Src_Transparent ? 5 : 4 );

     BCI_SEND( cmd );

     /* we always have to send the colorkey,
        but at least it does not clobber the fill color */
     if (sdev->Cmd_Src_Transparent)
          BCI_SEND( sdev->src_colorkey );

     BCI_SEND( BCI_X_Y( rect->x, rect->y ) );
     BCI_SEND( BCI_X_Y( dx, dy ) );
     BCI_SEND( BCI_W_H( rect->w, rect->h ) );

     return true;
}
Пример #10
0
static bool savage4DrawLine( void *drv, void *dev, DFBRegion *line )
{
     Savage4DriverData *sdrv = (Savage4DriverData*) drv;
     Savage4DeviceData *sdev = (Savage4DeviceData*) dev;
     
     int dx, dy;
     int min, max, xp, yp, ym;
     

     dx = line->x2 - line->x1;
     dy = line->y2 - line->y1;

     xp = (dx >= 0);
     if (!xp)
          dx = -dx;

     yp = (dy >= 0);
     if (!yp)
          dy = -dy;

     ym = (dy > dx);
     if (ym) {
          max = dy + 1;
          min = dx;
     }
     else {
          max = dx + 1;
          min = dy;
     }

     savage4_waitfifo( sdrv, sdev, 5 );
    
     BCI_SEND( BCI_CMD_LINE_LAST_PIXEL | BCI_CMD_CLIP_CURRENT |
               BCI_CMD_RECT_XP | BCI_CMD_RECT_YP | BCI_CMD_SEND_COLOR |
               BCI_CMD_DEST_GBD | BCI_CMD_SRC_SOLID | (0xcc << 16) );
    
     BCI_SEND( sdev->Fill_Color );
     
     BCI_SEND( BCI_LINE_X_Y( line->x1, line->y1 ) );
     BCI_SEND( BCI_LINE_STEPS( 2 * (min - max), 2 * min ) );
     BCI_SEND( BCI_LINE_MISC( max, ym, xp, yp, 2 * min - max ) );

     return true;
}
Пример #11
0
static bool savage3DBlit( void *drv, void *dev,
                          DFBRectangle *rect, int dx, int dy )
{
     Savage3DDriverData *sdrv = (Savage3DDriverData*) drv;
     Savage3DDeviceData *sdev = (Savage3DDeviceData*) dev;

     u32 cmd = ( BCI_CMD_RECT | sdev->Cmd_Src_Transparent |
                 BCI_CMD_CLIP_CURRENT | BCI_CMD_DEST_GBD |
                 BCI_CMD_SRC_PBD_COLOR | (0xcc << 16) );
     
     if (dx < rect->x) {
          cmd |= BCI_CMD_RECT_XP;
     } 
     else {
          dx      += rect->w - 1;
          rect->x += rect->w - 1;
     }

     if (dy < rect->y) { 
          cmd |= BCI_CMD_RECT_YP;
     }
     else {
          dy      += rect->h - 1;
          rect->y += rect->h - 1;
     }

     savage3D_waitfifo( sdrv, sdev, sdev->Cmd_Src_Transparent ? 5 : 4 );

     BCI_SEND( cmd );

     /* we always have to send the colorkey,
        but at least it does not clobber the fill color */
     if (sdev->Cmd_Src_Transparent)
          BCI_SEND( sdev->src_colorkey );

     BCI_SEND( BCI_X_Y( rect->x, rect->y ) );
     BCI_SEND( BCI_X_Y( dx, dy ) );
     BCI_SEND( BCI_W_H( rect->w, rect->h ) );

     return true;
}
Пример #12
0
void
Savage_ScreenToScreenBlit(engine_token *et, blit_params *pList, uint32 count)
{
    (void)et;		// avoid compiler warning for unused arg

    while (count--) {
        int cmd;
        int src_x = pList->src_left;
        int src_y = pList->src_top;
        int dest_x = pList->dest_left;
        int dest_y = pList->dest_top;
        int width = pList->width;
        int height = pList->height;

        BCI_GET_PTR;

        cmd = BCI_CMD_RECT | BCI_CMD_DEST_PBD_NEW | BCI_CMD_SRC_SBD_COLOR_NEW;
        BCI_CMD_SET_ROP(cmd, 0xCC);		// use GXcopy for rop

        if (dest_x <= src_x) {
            cmd |= BCI_CMD_RECT_XP;
        } else {
            src_x += width;
            dest_x += width;
        }

        if (dest_y <= src_y) {
            cmd |= BCI_CMD_RECT_YP;
        } else {
            src_y += height;
            dest_y += height;
        }

        gInfo.WaitQueue(9);

        BCI_SEND(cmd);

        BCI_SEND(gInfo.sharedInfo->frameBufferOffset);
        BCI_SEND(gInfo.sharedInfo->globalBitmapDesc);

        BCI_SEND(gInfo.sharedInfo->frameBufferOffset);
        BCI_SEND(gInfo.sharedInfo->globalBitmapDesc);

        BCI_SEND(BCI_X_Y(src_x, src_y));
        BCI_SEND(BCI_X_Y(dest_x, dest_y));
        BCI_SEND(BCI_W_H(width + 1, height + 1));

        pList++;
    }
}
Пример #13
0
void savagefb_imageblit(struct fb_info *info, const struct fb_image *image)
{
	struct savagefb_par *par = info->par;
	int fg, bg, size, i, width;
	int cmd;
	u32 *src = (u32 *) image->data;

	if (!image->width || !image->height)
		return;

	if (image->depth != 1) {
		cfb_imageblit(info, image);
		return;
	}

	if (info->fix.visual == FB_VISUAL_PSEUDOCOLOR) {
		fg = image->fg_color;
		bg = image->bg_color;
	} else {
		fg = ((u32 *)info->pseudo_palette)[image->fg_color];
		bg = ((u32 *)info->pseudo_palette)[image->bg_color];
	}

	cmd = BCI_CMD_RECT | BCI_CMD_RECT_XP | BCI_CMD_RECT_YP |
	      BCI_CMD_CLIP_LR | BCI_CMD_DEST_GBD | BCI_CMD_SRC_MONO |
	      BCI_CMD_SEND_COLOR;

	par->bci_ptr = 0;
	BCI_CMD_SET_ROP(cmd, savagefb_rop[0]);

	width = (image->width + 31) & ~31;
	size = (width * image->height)/8;
	size >>= 2;

	par->SavageWaitFifo(par, size + 5);
	BCI_SEND(cmd);
	BCI_SEND(BCI_CLIP_LR(image->dx, image->dx + image->width - 1));
	BCI_SEND(fg);
	BCI_SEND(bg);
	BCI_SEND(BCI_X_Y(image->dx, image->dy));
	BCI_SEND(BCI_W_H(width, image->height));
	for (i = 0; i < size; i++)
		BCI_SEND(src[i]);
}
Пример #14
0
static inline void savage3D_validate_color( Savage3DDriverData *sdrv,
                                            Savage3DDeviceData *sdev,
                                            CardState          *state )
{
     if (sdev->v_color)
          return;

     savage3D_waitfifo( sdrv, sdev, 2 );

     BCI_SEND( BCI_CMD_NOP | BCI_CMD_SEND_COLOR );
     
     switch (state->destination->config.format) {
          case DSPF_A8:
               BCI_SEND( state->color.a );
               break;
          case DSPF_ARGB1555:
               BCI_SEND( PIXEL_ARGB1555(state->color.a,
                                        state->color.r,
                                        state->color.g,
                                        state->color.b) );
               break;
          case DSPF_RGB16:
               BCI_SEND( PIXEL_RGB16(state->color.r,
                                     state->color.g,
                                     state->color.b) );
               break;
          case DSPF_RGB32:
               BCI_SEND( PIXEL_RGB32(state->color.r,
                                     state->color.g,
                                     state->color.b) );
               break;
          case DSPF_ARGB:
               BCI_SEND( PIXEL_ARGB(state->color.a,
                                    state->color.r,
                                    state->color.g,
                                    state->color.b) );
               break;
          default:
               D_ONCE( "unsupported destination format" );
               break;
     }

     sdev->v_color = 1;
}
Пример #15
0
void
Savage_FillSpan(engine_token *et, uint32 color, uint16 *pList, uint32 count)
{
    int cmd = BCI_CMD_RECT | BCI_CMD_RECT_XP | BCI_CMD_RECT_YP
              | BCI_CMD_DEST_PBD_NEW | BCI_CMD_SRC_SOLID | BCI_CMD_SEND_COLOR;

    (void)et;		// avoid compiler warning for unused arg

    BCI_CMD_SET_ROP(cmd, 0xF0);		// use GXcopy for rop

    while (count--) {
        int y = *pList++;
        int x = *pList++;
        int w = *pList++ - x + 1;

        BCI_GET_PTR;

        // The MediaPlayer in Zeta 1.21 displays a window which has 2 zero width
        // spans which the Savage chips display as a line completely across the
        // screen;  thus, the following if statement discards any span with zero
        // or negative width.

        if (w <= 0)
            continue;

        gInfo.WaitQueue(7);

        BCI_SEND(cmd);
        BCI_SEND(gInfo.sharedInfo->frameBufferOffset);
        BCI_SEND(gInfo.sharedInfo->globalBitmapDesc);

        BCI_SEND(color);
        BCI_SEND(BCI_X_Y(x, y));
        BCI_SEND(BCI_W_H(w, 1));
    }
}
Пример #16
0
static bool savage4DrawRectangle( void *drv, void *dev, DFBRectangle *rect )
{
     Savage4DriverData *sdrv = (Savage4DriverData*) drv;
     Savage4DeviceData *sdev = (Savage4DeviceData*) dev;
     
     savage4_waitfifo( sdrv, sdev, 13 );

     /* first line */
     BCI_SEND( BCI_CMD_RECT | BCI_CMD_SEND_COLOR |
               BCI_CMD_RECT_XP | BCI_CMD_RECT_YP |
               BCI_CMD_DEST_GBD | BCI_CMD_SRC_SOLID | (0xcc << 16) );
     
     BCI_SEND( sdev->Fill_Color );
     
     BCI_SEND( BCI_X_Y( rect->x, rect->y) );
     BCI_SEND( BCI_W_H( 1 , rect->h) );     

     /* second line */
     BCI_SEND( BCI_CMD_RECT |
               BCI_CMD_RECT_XP | BCI_CMD_RECT_YP |
               BCI_CMD_DEST_GBD | BCI_CMD_SRC_SOLID | (0xcc << 16) );

     BCI_SEND( BCI_X_Y( rect->x, rect->y) );
     BCI_SEND( BCI_W_H( rect->w , 1 ) );

     /* third line */
     BCI_SEND( BCI_CMD_RECT |
               BCI_CMD_RECT_XP | BCI_CMD_RECT_YP |
               BCI_CMD_DEST_GBD | BCI_CMD_SRC_SOLID | (0xcc << 16) );

     BCI_SEND( BCI_X_Y( rect->x, rect->y+rect->h-1 ) );
     BCI_SEND( BCI_W_H( rect->w , 1 ) );     
     
          
     /* fourth line */
     BCI_SEND( BCI_CMD_RECT |
               BCI_CMD_RECT_XP | BCI_CMD_RECT_YP |
               BCI_CMD_DEST_GBD | BCI_CMD_SRC_SOLID | (0xcc << 16) );

     BCI_SEND( BCI_X_Y( rect->x+rect->w-1, rect->y ) );
     BCI_SEND( BCI_W_H( 1 , rect->h ) );

     return true;
}