Subversion Repositories Kolibri OS

Compare Revisions

Regard whitespace Rev 878 → Rev 879

/programs/system/drivers/ati2d/accel_2d.h
1,15 → 1,14
 
#define PX_CREATE 1
#define PX_DESTROY 2
#define PX_DRAW_RECT 3
#define PX_FILL_RECT 4
#define PX_LINE 5
#define PX_BLIT 6
#define PX_BLIT_TRANSPARENT 7
#define PX_BLIT_ALPHA 8
#define PX_CLEAR 3
#define PX_DRAW_RECT 4
#define PX_FILL_RECT 5
#define PX_LINE 6
#define PX_BLIT 7
#define PX_BLIT_TRANSPARENT 8
#define PX_BLIT_ALPHA 9
 
//#define BLIT 4
//#define COMPIZ 5
 
 
typedef unsigned int color_t;
65,10 → 64,6
void *local;
}local_pixmap_t;
 
//int CreatePixmap(userpixmap_t *io);
//int DestroyPixmap(userpixmap_t *io);
//int LockPixmap(userpixmap_t *io);
//int UnlockPixmap(userpixmap_t *io);
 
#define PX_LOCK 1
 
76,6 → 71,13
{
local_pixmap_t *dstpix;
 
color_t color;
}io_clear_t;
 
typedef struct
{
local_pixmap_t *dstpix;
 
struct
{
int x0;
96,7 → 98,7
};
color_t color;
color_t border;
}draw_t;
}io_draw_t;
 
typedef struct
{
112,20 → 114,11
 
u32_t bmp0;
u32_t bmp1;
}fill_t;
color_t border;
}io_fill_t;
 
typedef struct
{
int src_x;
int src_y;
int dst_x;
int dst_y;
int w;
int h;
}blit_t;
 
typedef struct
{
local_pixmap_t *dstpix;
int dst_x;
int dst_y;
135,21 → 128,27
int src_y;
int w;
int h;
}pixblit_t;
 
color_t key;
}io_blit_t;
 
int Line2P(draw_t *draw);
 
int DrawRect(draw_t * draw);
int FillRect(fill_t * fill);
int CreatePixmap(pixmap_t *io);
 
int Blit(blit_t *blit);
int DestroyPixmap(pixmap_t *io);
 
int RadeonComposite( blit_t *blit);
int ClearPixmap(io_clear_t *io);
 
int Line(io_draw_t *draw);
 
int PixBlit(pixblit_t* blit);
int DrawRect(io_draw_t * draw);
 
int FillRect(io_fill_t * fill);
 
int Blit(io_blit_t* blit);
 
int BlitTransparent(io_blit_t* blit);
 
 
 
 
/programs/system/drivers/ati2d/accel_2d.inc
1,7 → 1,66
 
int Line(draw_t *draw)
 
int ClearPixmap(io_clear_t *io)
{
u32_t ifl;
u32_t *ring, write;
 
local_pixmap_t *dstpixmap;
 
dstpixmap = (io->dstpix == (void*)-1) ? &scr_pixmap : io->dstpix ;
 
ifl = safe_cli();
 
#if R300_PIO
 
R5xxFIFOWait(6);
 
OUTREG(R5XX_DP_GUI_MASTER_CNTL,
RADEON_GMC_DST_PITCH_OFFSET_CNTL |
RADEON_GMC_BRUSH_SOLID_COLOR |
RADEON_GMC_DST_32BPP |
RADEON_GMC_SRC_DATATYPE_COLOR |
R5XX_GMC_CLR_CMP_CNTL_DIS |
R5XX_GMC_WR_MSK_DIS |
R5XX_ROP3_P
);
 
OUTREG(R5XX_DP_BRUSH_FRGD_CLR, io->color);
OUTREG(R5XX_DP_CNTL, R5XX_DST_X_LEFT_TO_RIGHT | R5XX_DST_Y_TOP_TO_BOTTOM);
OUTREG(R5XX_DST_PITCH_OFFSET, dstpixmap->pitch_offset);
OUTREG(R5XX_DST_Y_X, 0);
OUTREG(R5XX_DST_WIDTH_HEIGHT,(dstpixmap->width<<16)|dstpixmap->height);
 
#else
BEGIN_RING();
OUT_RING(CP_PACKET3(RADEON_CNTL_PAINT_MULTI, 4));
 
OUT_RING(RADEON_GMC_DST_PITCH_OFFSET_CNTL |
RADEON_GMC_BRUSH_SOLID_COLOR |
RADEON_GMC_DST_32BPP |
RADEON_GMC_SRC_DATATYPE_COLOR |
R5XX_GMC_CLR_CMP_CNTL_DIS |
R5XX_GMC_WR_MSK_DIS |
R5XX_ROP3_P
);
 
OUT_RING(dstpixmap->pitch_offset);
OUT_RING(io->color);
OUT_RING( 0 );
OUT_RING((dstpixmap->width<<16)|dstpixmap->height);
COMMIT_RING();
 
#endif
 
safe_sti(ifl);
 
return ERR_OK;
}
 
 
int Line(io_draw_t *draw)
{
local_pixmap_t *dstpixmap;
clip_t clip;
int x0, y0, x1, y1;
 
30,9 → 89,10
R5xxFIFOWait(6);
 
OUTREG(R5XX_DP_GUI_MASTER_CNTL,
rhd.gui_control |
R5XX_GMC_BRUSH_SOLID_COLOR |
R5XX_GMC_SRC_DATATYPE_COLOR |
RADEON_GMC_DST_PITCH_OFFSET_CNTL |
RADEON_GMC_BRUSH_SOLID_COLOR |
RADEON_GMC_DST_32BPP |
RADEON_GMC_SRC_DATATYPE_COLOR |
R5XX_GMC_CLR_CMP_CNTL_DIS |
R5XX_GMC_WR_MSK_DIS |
R5XX_ROP3_P
68,7 → 128,7
return ERR_OK;
}
 
int DrawRect(draw_t* draw)
int DrawRect(io_draw_t* draw)
{
int x0, y0, x1, y1, xend, yend;
 
108,12 → 168,13
R5xxFIFOWait(6);
 
OUTREG(R5XX_DP_GUI_MASTER_CNTL,
rhd.gui_control |
R5XX_ROP3_P |
R5XX_GMC_BRUSH_SOLID_COLOR |
R5XX_GMC_SRC_DATATYPE_COLOR |
RADEON_GMC_DST_PITCH_OFFSET_CNTL |
RADEON_GMC_BRUSH_SOLID_COLOR |
RADEON_GMC_DST_32BPP |
RADEON_GMC_SRC_DATATYPE_COLOR |
R5XX_GMC_CLR_CMP_CNTL_DIS |
R5XX_GMC_WR_MSK_DIS
R5XX_GMC_WR_MSK_DIS |
R5XX_ROP3_P
);
 
OUTREG(R5XX_DP_BRUSH_FRGD_CLR, draw->color);
182,11 → 243,11
return ERR_OK;
}
 
int FillRect(fill_t *fill)
int FillRect(io_fill_t *fill)
{
local_pixmap_t *dstpixmap;
clip_t dst_clip;
int x0, y0, x1, y1;
int x0, y0, x1, y1, xend, yend;
 
dstpixmap = (fill->dstpix == (void*)-1) ? &scr_pixmap : fill->dstpix ;
 
193,8 → 254,8
x0 = fill->x;
y0 = fill->y;
 
x1 = x0+fill->w-1;
y1 = y0+fill->h-1;
xend = x1 = x0 + fill->w - 1;
yend = y1 = y0 + fill->h - 1;
 
dst_clip.xmin = 0;
dst_clip.ymin = 0;
237,11 → 298,14
 
OUTREG(R5XX_DST_Y_X,(y0<<16)|x0);
OUTREG(R5XX_DST_HEIGHT_WIDTH,(h<<16)|w);
#else
BEGIN_RING();
OUT_RING(CP_PACKET3(RADEON_CNTL_PAINT, 7));
OUT_RING(RADEON_GMC_DST_PITCH_OFFSET_CNTL |
R5XX_GMC_BRUSH_8X8_MONO_FG_BG |
 
if( (fill->border & 0xFF000000) != 0)
{
R5xxFIFOWait(2);
 
OUTREG(R5XX_DP_GUI_MASTER_CNTL,
RADEON_GMC_DST_PITCH_OFFSET_CNTL |
RADEON_GMC_BRUSH_SOLID_COLOR |
RADEON_GMC_DST_32BPP |
RADEON_GMC_SRC_DATATYPE_COLOR |
R5XX_GMC_CLR_CMP_CNTL_DIS |
249,152 → 313,74
R5XX_ROP3_P
);
 
OUT_RING(dstpixmap->pitch_offset);
OUT_RING(fill->bkcolor);
OUT_RING(fill->fcolor);
OUTREG(R5XX_DP_BRUSH_FRGD_CLR, fill->border);
 
OUT_RING(fill->bmp0);
OUT_RING(fill->bmp1);
if( y0 == fill->y)
{
R5xxFIFOWait(2);
 
OUT_RING((y0<<16)|x0);
OUT_RING((y1<<16)|x1);
COMMIT_RING();
OUTREG(R5XX_DST_Y_X,(y0<<16)|x0);
OUTREG(R5XX_DST_WIDTH_HEIGHT,(w<<16)|1);
y0++;
h--;
}
if( y1 == yend )
{
R5xxFIFOWait(2);
 
#endif
safe_sti(ifl);
};
return ERR_OK;
};
 
#if 0
int Blit(blit_t *blit)
OUTREG(R5XX_DST_Y_X,(y1<<16)|x0);
OUTREG(R5XX_DST_WIDTH_HEIGHT,(w<<16)|1);
h--;
}
if( x0 == fill->x)
{
int x0, y0, x1, y1;
R5xxFIFOWait(2);
 
x0 = blit->src_x;
y0 = blit->src_y;
 
x1 = x0+blit->w-1;
y1 = y0+blit->h-1;
 
 
if( ! BlockClip(&clip, &x0, &y0, &x1, &y1))
OUTREG(R5XX_DST_Y_X,(y0<<16)|x0);
OUTREG(R5XX_DST_WIDTH_HEIGHT,(1<<16)|h);
}
if( x1 == xend)
{
u32 *ring, write;
int w, h;
u32 ifl;
R5xxFIFOWait(2);
 
w = x1-x0+1;
h = y1-y0+1;
OUTREG(R5XX_DST_Y_X,(y0<<16)|x1);
OUTREG(R5XX_DST_WIDTH_HEIGHT,(1<<16)|h);
}
};
 
ifl = safe_cli();
 
#if R300_PIO
 
 
#else
 
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 |
OUT_RING(CP_PACKET3(RADEON_CNTL_PAINT, 7));
OUT_RING(RADEON_GMC_DST_PITCH_OFFSET_CNTL |
R5XX_GMC_BRUSH_8X8_MONO_FG_BG |
RADEON_GMC_DST_32BPP |
RADEON_GMC_SRC_DATATYPE_COLOR |
RADEON_DP_SRC_SOURCE_MEMORY |
(1 << 28)+(1 << 30) | R5XX_ROP3_S);
R5XX_GMC_CLR_CMP_CNTL_DIS |
R5XX_GMC_WR_MSK_DIS |
R5XX_ROP3_P
);
 
OUT_RING(rhd.dst_pitch_offset);
OUT_RING(rhd.dst_pitch_offset);
OUT_RING(dstpixmap->pitch_offset);
OUT_RING(fill->bkcolor);
OUT_RING(fill->fcolor);
 
OUT_RING((x0<<16)|y0);
OUT_RING((blit->dst_x<<16)|blit->dst_y);
OUT_RING((w<<16)|h);
OUT_RING(fill->bmp0);
OUT_RING(fill->bmp1);
 
OUT_RING((y0<<16)|x0);
OUT_RING((y1<<16)|x1);
COMMIT_RING();
 
#endif
 
safe_sti(ifl);
} ;
return ERR_OK;
}
 
#endif
 
 
#if 0
 
int LockPixmap(userpixmap_t *io)
{
pixmap_t *pixmap;
size_t size;
void *usermap;
 
dbgprintf("Lock pixmap %x\n", io->pixmap);
 
if(io->pixmap == (pixmap_t*)-1)
return ERR_PARAM;
else
pixmap = io->pixmap;
 
if( (pixmap->flags & 1) == PX_LOCK )
return ERR_PARAM;
 
size = (pixmap->pitch*pixmap->width+4095) & ~ 4095;
if (usermap = UserAlloc(size))
{
CommitPages(usermap, ((u32_t)pixmap->raw+rhd.PhisBase)|7|(1<<9), size);
pixmap->flags |= PX_LOCK;
pixmap->usermap = usermap;
io->usermap = usermap;
io->pitch = pixmap->pitch;
dbgprintf("map at %x\n", io->usermap);
 
return ERR_OK;
}
else
return ERR_PARAM;
};
 
int UnlockPixmap(userpixmap_t *io)
{
pixmap_t *pixmap;
size_t size;
 
dbgprintf("Unlock pixmap %x\n", io->pixmap);
 
if(io->pixmap == (pixmap_t*)-1)
return ERR_PARAM;
else
pixmap = io->pixmap;
 
if( (pixmap->flags & 1) != PX_LOCK )
return ERR_PARAM;
 
/* Sanity checks */
 
if( (pixmap->usermap == 0)||
((u32_t)pixmap->usermap >= 0x80000000) ||
((u32_t)pixmap->usermap & 4095)
)
return ERR_PARAM;
 
size = (pixmap->pitch*pixmap->width+4095) & ~ 4095;
 
UnmapPages(pixmap->usermap, size);
UserFree(pixmap->usermap);
pixmap->usermap = NULL;
pixmap->flags &= ~PX_LOCK;
io->usermap = NULL;
io->pitch = 0;
 
return ERR_OK;
};
 
#endif
 
int PixBlit(pixblit_t *blit)
int Blit(io_blit_t *blit)
{
clip_t src_clip, dst_clip;
 
487,7 → 473,7
};
 
 
int TransBlit(pixblit_t *blit)
int BlitTransparent(io_blit_t *blit)
{
clip_t src_clip, dst_clip;
 
586,3 → 572,74
return ERR_OK;
}
 
 
#if 0
 
int LockPixmap(userpixmap_t *io)
{
pixmap_t *pixmap;
size_t size;
void *usermap;
 
dbgprintf("Lock pixmap %x\n", io->pixmap);
 
if(io->pixmap == (pixmap_t*)-1)
return ERR_PARAM;
else
pixmap = io->pixmap;
 
if( (pixmap->flags & 1) == PX_LOCK )
return ERR_PARAM;
 
size = (pixmap->pitch*pixmap->width+4095) & ~ 4095;
if (usermap = UserAlloc(size))
{
CommitPages(usermap, ((u32_t)pixmap->raw+rhd.PhisBase)|7|(1<<9), size);
pixmap->flags |= PX_LOCK;
pixmap->usermap = usermap;
io->usermap = usermap;
io->pitch = pixmap->pitch;
dbgprintf("map at %x\n", io->usermap);
 
return ERR_OK;
}
else
return ERR_PARAM;
};
 
int UnlockPixmap(userpixmap_t *io)
{
pixmap_t *pixmap;
size_t size;
 
dbgprintf("Unlock pixmap %x\n", io->pixmap);
 
if(io->pixmap == (pixmap_t*)-1)
return ERR_PARAM;
else
pixmap = io->pixmap;
 
if( (pixmap->flags & 1) != PX_LOCK )
return ERR_PARAM;
 
/* Sanity checks */
 
if( (pixmap->usermap == 0)||
((u32_t)pixmap->usermap >= 0x80000000) ||
((u32_t)pixmap->usermap & 4095)
)
return ERR_PARAM;
 
size = (pixmap->pitch*pixmap->width+4095) & ~ 4095;
 
UnmapPages(pixmap->usermap, size);
UserFree(pixmap->usermap);
pixmap->usermap = NULL;
pixmap->flags &= ~PX_LOCK;
io->usermap = NULL;
io->pitch = 0;
 
return ERR_OK;
};
 
#endif
/programs/system/drivers/ati2d/accel_3d.inc
1174,6 → 1174,7
#undef VTX_OUT
#undef VTX_OUT_MASK
 
#if 0
 
int RadeonComposite( blit_t *blit)
{
1235,3 → 1236,4
#endif
}
 
#endif
/programs/system/drivers/ati2d/ati2d.c
30,7 → 30,7
if(action != 1)
return 0;
 
if(!dbg_open("/hd0/2/ati2d.log"))
if(!dbg_open("/rd/1/drivers/ati2d.log"))
{
printf("Can't open /rd/1/drivers/ati2d.log\nExit\n");
return 0;
37,7 → 37,7
}
if( GetScreenBpp() != 32)
{
printf("32 bpp dispaly mode required !\nExit\t");
dbgprintf("32 bpp dispaly mode required !\nExit\t");
return 0;
}
 
82,7 → 82,7
#define SRV_GETVERSION 0
 
 
int _stdcall srv_2d(ioctl_t *io)
int __stdcall srv_2d(ioctl_t *io)
{
u32_t *inp;
u32_t *outp;
110,36 → 110,37
return DestroyPixmap((pixmap_t*)inp);
break;
 
case PX_CLEAR:
if(io->inp_size==2)
return ClearPixmap((io_clear_t*)inp);
break;
 
case PX_DRAW_RECT:
if(io->inp_size==7)
return DrawRect((draw_t*)inp);
return DrawRect((io_draw_t*)inp);
break;
 
case PX_FILL_RECT:
if(io->inp_size==9)
return FillRect((fill_t*)inp);
if(io->inp_size==10)
return FillRect((io_fill_t*)inp);
break;
 
case PX_BLIT:
if(io->inp_size==8)
return PixBlit((pixblit_t*)inp);
return Blit((io_blit_t*)inp);
break;
 
case PX_BLIT_TRANSPARENT:
if(io->inp_size==8)
return TransBlit((pixblit_t*)inp);
if(io->inp_size==9)
return BlitTransparent((io_blit_t*)inp);
break;
 
case PX_LINE:
if(io->inp_size==6)
return Line((draw_t*)inp);
return Line((io_draw_t*)inp);
break;
 
/*
case BLIT:
if(io->inp_size==6)
return Blit((blit_t*)inp);
break;
 
case COMPIZ:
if(io->inp_size==6)
157,7 → 158,6
#include "init.c"
#include "pci.c"
#include "ati_mem.c"
//#include "cursor.inc"
 
#include "r500.inc"
 
164,6 → 164,6
#include "clip.inc"
#include "pixmap.inc"
#include "accel_2d.inc"
#include "accel_3d.inc"
//#include "accel_3d.inc"
 
 
/programs/system/drivers/ati2d/init.c
117,9 → 117,5
return FALSE;
};
 
//int KernelFree(void *p)
//{
//
// return 0;
//}
 
 
/programs/system/drivers/ati2d/makefile
36,7 → 36,7
wlink name ati2d.dll SYS nt_dll lib libdrv op offset=0 op nod op maxe=25 op el op STUB=stub.exe op START=_drvEntry @rhd.lk1
kpack.exe ati2d.dll ati2d.drv
 
ati2d.obj : ati2d.c $(SRC_DEP) $(HFILES)
ati2d.obj : ati2d.c $(SRC_DEP) $(HFILES) Makefile
$(CC) $(CFLAGS) -o ati2d.obj ati2d.c
 
curhelp.obj : curhelp.asm
/programs/system/drivers/ati2d/r500.inc
409,33 → 409,33
 
// load_microcode();
 
rhd.ring_base = CreateRingBuffer(0x8000, PG_SW | PG_NOCACHE);
dbgprintf("create cp ring buffer %x\n", rhd.ring_base);
base = GetPgAddr(rhd.ring_base);
// rhd.ring_base = CreateRingBuffer(0x8000, PG_SW | PG_NOCACHE);
// dbgprintf("create cp ring buffer %x\n", rhd.ring_base);
// base = GetPgAddr(rhd.ring_base);
 
OUTREG(RADEON_CP_RB_BASE, base);
dbgprintf("ring base %x\n", base);
// OUTREG(RADEON_CP_RB_BASE, base);
// dbgprintf("ring base %x\n", base);
 
OUTREG(RADEON_CP_RB_WPTR_DELAY, 0);
// OUTREG(RADEON_CP_RB_WPTR_DELAY, 0);
 
rhd.ring_rp = rhd.ring_wp = INREG(RADEON_CP_RB_RPTR);
OUTREG(RADEON_CP_RB_WPTR,rhd.ring_rp);
// rhd.ring_rp = rhd.ring_wp = INREG(RADEON_CP_RB_RPTR);
// OUTREG(RADEON_CP_RB_WPTR,rhd.ring_rp);
 
OUTREG(RADEON_CP_RB_RPTR_ADDR, 0); // ring buffer read pointer no update
// OUTREG(RADEON_CP_RB_RPTR_ADDR, 0); // ring buffer read pointer no update
 
OUTREG(RADEON_CP_RB_CNTL, RADEON_RB_NO_UPDATE | 12);
OUTREG(RADEON_SCRATCH_UMSK, 0); // no scratch update
// OUTREG(RADEON_CP_RB_CNTL, RADEON_RB_NO_UPDATE | 12);
// OUTREG(RADEON_SCRATCH_UMSK, 0); // no scratch update
 
MASKREG(RADEON_BUS_CNTL,0,RADEON_BUS_MASTER_DIS);
// MASKREG(RADEON_BUS_CNTL,0,RADEON_BUS_MASTER_DIS);
 
R5xx2DIdleLocal();
// R5xx2DIdleLocal();
 
OUTREG(RADEON_ISYNC_CNTL, RADEON_ISYNC_ANY2D_IDLE3D |
RADEON_ISYNC_ANY3D_IDLE2D |
RADEON_ISYNC_WAIT_IDLEGUI |
RADEON_ISYNC_CPSCRATCH_IDLEGUI);
// OUTREG(RADEON_ISYNC_CNTL, RADEON_ISYNC_ANY2D_IDLE3D |
// RADEON_ISYNC_ANY3D_IDLE2D |
// RADEON_ISYNC_WAIT_IDLEGUI |
// RADEON_ISYNC_CPSCRATCH_IDLEGUI);
 
OUTREG(RADEON_CP_CSQ_CNTL, RADEON_CSQ_PRIBM_INDBM); // run
// OUTREG(RADEON_CP_CSQ_CNTL, RADEON_CSQ_PRIBM_INDBM); // run
 
}