add bitblit

git-svn-id: svn://kolibrios.org@810 a494cfbc-eb01-0410-851d-a64ba20cac60
This commit is contained in:
Sergey Semyonov (Serge) 2008-06-27 10:46:14 +00:00
parent 37d1685bad
commit 9040dc17ec
3 changed files with 67 additions and 11 deletions

View File

@ -2,6 +2,8 @@
#define FILL_RECT 1 #define FILL_RECT 1
#define DRAW_RECT 2 #define DRAW_RECT 2
#define LINE_2P 3 #define LINE_2P 3
#define BLIT 4
typedef unsigned int color_t; typedef unsigned int color_t;
typedef unsigned int u32_t; typedef unsigned int u32_t;
@ -29,6 +31,16 @@ typedef struct
u32_t bmp1; u32_t bmp1;
}fill_t; }fill_t;
typedef struct
{
int src_x;
int src_y;
int dst_x;
int dst_y;
int w;
int h;
}blit_t;
typedef struct typedef struct
{ {
int x0; int x0;
@ -46,6 +58,7 @@ int FillRect(fill_t * fill);
int Line2P(line2p_t *draw); int Line2P(line2p_t *draw);
int Blit(blit_t *blit);
# define RADEON_GMC_SRC_PITCH_OFFSET_CNTL (1 << 0) # define RADEON_GMC_SRC_PITCH_OFFSET_CNTL (1 << 0)
# define RADEON_GMC_DST_PITCH_OFFSET_CNTL (1 << 1) # define RADEON_GMC_DST_PITCH_OFFSET_CNTL (1 << 1)
@ -66,6 +79,8 @@ int Line2P(line2p_t *draw);
#define RADEON_CP_PACKET3 0xC0000000 #define RADEON_CP_PACKET3 0xC0000000
# define RADEON_CNTL_PAINT 0x00009100 # define RADEON_CNTL_PAINT 0x00009100
# define RADEON_CNTL_BITBLT 0x00009200
# define RADEON_CNTL_PAINT_POLYLINE 0x00009500 # define RADEON_CNTL_PAINT_POLYLINE 0x00009500
# define RADEON_CNTL_PAINT_MULTI 0x00009A00 # define RADEON_CNTL_PAINT_MULTI 0x00009A00

View File

@ -100,14 +100,6 @@ int FillRect(fill_t *fill)
OUT_RING(fill->bmp0); OUT_RING(fill->bmp0);
OUT_RING(fill->bmp1); OUT_RING(fill->bmp1);
// OUT_RING(0xCCCC3333);
// OUT_RING(0xCCCC3333);
// OUT_RING(~0x11884422);
// OUT_RING(~0x11884422);
// OUT_RING(0x88112244);
// OUT_RING(0x88112244);
OUT_RING((y0<<16)|x0); OUT_RING((y0<<16)|x0);
OUT_RING((y1<<16)|x1); OUT_RING((y1<<16)|x1);
COMMIT_RING(); COMMIT_RING();
@ -117,7 +109,51 @@ int FillRect(fill_t *fill)
return 0; return 0;
} }
int Blit(blit_t *blit)
{
int x0, y0, x1, y1;
x0 = blit->src_x;
y0 = blit->src_y;
x1 = x0+blit->w-1;
y1 = y0+blit->h-1;
if( ! BlockClip( &x0, &y0, &x1, &y1))
{
u32 *ring, write;
int w, h;
u32 ifl;
w = x1-x0+1;
h = y1-y0+1;
ifl = safe_cli();
BEGIN_RING();
OUT_RING(CP_PACKET3(RADEON_CNTL_BITBLT, 5));
OUT_RING(RADEON_GMC_SRC_PITCH_OFFSET_CNTL |
RADEON_GMC_DST_PITCH_OFFSET_CNTL |
RADEON_GMC_BRUSH_NONE |
RADEON_GMC_DST_32BPP |
RADEON_GMC_SRC_DATATYPE_COLOR |
RADEON_DP_SRC_SOURCE_MEMORY |
(1 << 28)+(1 << 30) | R5XX_ROP3_S);
OUT_RING(rhd.dst_pitch_offset);
OUT_RING(rhd.dst_pitch_offset);
OUT_RING((x0<<16)|y0);
OUT_RING((blit->dst_x<<16)|blit->dst_y);
OUT_RING((w<<16)|h);
COMMIT_RING();
safe_sti(ifl);
} ;
return 0;
}
int Line2P(line2p_t *draw) int Line2P(line2p_t *draw)
{ {

View File

@ -138,14 +138,19 @@ int _stdcall srv_2d(ioctl_t *io)
return DrawRect((draw_t*)inp); return DrawRect((draw_t*)inp);
break; break;
case FILL_RECT:
if(io->inp_size==8)
return FillRect((fill_t*)inp);
break;
case LINE_2P: case LINE_2P:
if(io->inp_size==5) if(io->inp_size==5)
return Line2P((line2p_t*)inp); return Line2P((line2p_t*)inp);
break; break;
case FILL_RECT: case BLIT:
if(io->inp_size==8) if(io->inp_size==6)
return FillRect((fill_t*)inp); return Blit((blit_t*)inp);
break; break;
default: default: