227,3 → 227,114 |
}; |
return 0; |
} |
|
|
int CreatePixmap(new_pixmap_t *io) |
{ |
|
pixmap_t *pixmap; |
|
u32_t pitch; |
void *raw; |
|
if( (io->width == 0) || (io->width > 2048)|| |
(io->height == 0)|| (io->height > 2048)) |
{ |
dbgprintf("Invalid pixmap size w:%d h:%d\n", io->width,io->height); |
return 0; |
|
}; |
|
pitch = ((io->width+15)&~15)*4; |
dbgprintf("pitch = %d\n", pitch); |
|
raw = rhd_mem_alloc(&rhd,RHD_MEM_FB,pitch*io->height) ; |
if (! raw) |
{ |
dbgprintf("Not enough memory for pixmap\n"); |
return 0; |
}; |
|
pixmap = malloc(sizeof(pixmap_t)); |
if(!pixmap) |
{ |
rhd_mem_free(&rhd, RHD_MEM_FB,raw); |
return 0; |
} |
else |
{ |
io->pixmap = (u32_t)pixmap; |
io->format = PICT_a8r8g8b8; |
io->pitch = pitch; |
|
pixmap->width = io->width; |
pixmap->height = io->height; |
pixmap->format = PICT_a8r8g8b8; |
pixmap->pitch = pitch; |
pixmap->offset = (u32_t)raw-rhd.FbBase+rhd.FbIntAddress; |
pixmap->pitch_offset = ((pitch/64)<<22)| (pixmap->offset>>10); |
pixmap->raw = raw; |
|
dbgprintf("pixmap.pitch_offset: %x\n", pixmap->pitch_offset); |
dbgprintf("width: %d height: %d\n",pixmap->width,pixmap->height ); |
dbgprintf("pixmap.offset: %x\n", pixmap->offset); |
|
} |
return 1; |
} |
|
|
|
int PixBlit(pixblit_t *blit) |
{ |
|
u32 *ring, write; |
int w, h; |
u32 ifl; |
int x0, y0; |
|
pixmap_t *srcpixmap; |
pixmap_t *dstpixmap; |
|
dbgprintf("Pixblit src: %x dst: %x\n",blit->srcpix, blit->dstpix); |
|
dstpixmap = (blit->dstpix == (void*)-1) ? &scr_pixmap : blit->dstpix ; |
srcpixmap = (blit->srcpix == (void*)-1) ? &scr_pixmap : blit->srcpix ; |
|
dbgprintf("srcpixmap: %x dstpixmap: %x\n",srcpixmap, dstpixmap); |
|
dbgprintf("dst.width: %d dst.height: %d\n", dstpixmap->width,dstpixmap->height); |
dbgprintf("src.width: %d src.height: %d\n", srcpixmap->width,srcpixmap->height); |
dbgprintf("srcpitch: %x dstpitch: %x\n", |
srcpixmap->pitch_offset,dstpixmap->pitch_offset); |
|
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(srcpixmap->pitch_offset); |
OUT_RING(dstpixmap->pitch_offset); |
|
// x0 = blit->src_x; |
// y0 = blit->src_y; |
// w = blit->w; |
// h = blit->h; |
|
OUT_RING((blit->src_x<<16)|blit->src_y); |
OUT_RING((blit->dst_x<<16)|blit->dst_y); |
OUT_RING((blit->w<<16)|blit->h); |
COMMIT_RING(); |
|
safe_sti(ifl); |
return 0; |
} |