/programs/system/drivers/ati2d/accel_2d.inc |
---|
292,6 → 292,32 |
return ERR_OK; |
} |
int DestroyPixmap( userpixmap_t *io) |
{ |
pixmap_t *pixmap; |
dbgprintf("Destroy pixmap %x\n", io->pixmap); |
if(io->pixmap == (pixmap_t*)-1) |
return ERR_PARAM; |
else |
pixmap = io->pixmap; |
if( (pixmap->flags & 1) == PX_LOCK ) |
UnlockPixmap(io); |
UserFree(pixmap->usermap); |
rhd_mem_free(&rhd,RHD_MEM_FB,pixmap->raw); |
free(pixmap); |
io->pixmap = NULL; |
io->usermap = NULL; |
io->format = 0; |
io->pitch = 0; |
return ERR_OK; |
}; |
int LockPixmap(userpixmap_t *io) |
{ |
pixmap_t *pixmap; |
400,3 → 426,57 |
safe_sti(ifl); |
return ERR_OK; |
} |
int TransBlit(pixblit_t *blit) |
{ |
u32 *ring, write; |
int w, h; |
u32 ifl; |
int x0, y0; |
pixmap_t *srcpixmap; |
pixmap_t *dstpixmap; |
dbgprintf("Transblit 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_TRANBLT, 8)); |
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 << 30) | R5XX_ROP3_S); |
OUT_RING(srcpixmap->pitch_offset); |
OUT_RING(dstpixmap->pitch_offset); |
OUT_RING((2<<24)+5); |
OUT_RING(0xFF000000); |
OUT_RING(0xFF000000); |
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 ERR_OK; |
} |
/programs/system/drivers/ati2d/ati2d.c |
---|
182,6 → 182,17 |
return UnlockPixmap((userpixmap_t*)inp); |
break; |
case PIXDESTROY: |
if(io->inp_size==6) |
return DestroyPixmap((userpixmap_t*)inp); |
break; |
case TRANSBLIT: |
if(io->inp_size==8) |
return TransBlit((pixblit_t*)inp); |
break; |
default: |
return ERR_PARAM; |
}; |
/programs/system/drivers/ati2d/ati2d.h |
---|
386,3 → 386,4 |
PICT_g1 = PICT_FORMAT(1,PICT_TYPE_GRAY,0,0,0,0), |
} PictFormatShort; |
void dump_mem(); |
/programs/system/drivers/ati2d/ati_mem.c |
---|
42,8 → 42,8 |
struct mem_block { |
struct mem_block *next; |
struct mem_block *prev; |
int start; |
int size; |
u32_t start; |
size_t size; |
}; |
/* Initialize. How to check for an uninitialized heap? |
50,15 → 50,15 |
*/ |
static int init_heap(struct mem_block **heap, int start, int size) |
{ |
struct mem_block *blocks = kmalloc(sizeof(*blocks)); |
struct mem_block *blocks = malloc(sizeof(*blocks)); |
if (!blocks) |
return -1; //-ENOMEM; |
*heap = kmalloc(sizeof(**heap)); |
*heap = malloc(sizeof(**heap)); |
if (!*heap) |
{ |
kfree(blocks); |
free(blocks); |
return -1; //-ENOMEM; |
} |
68,6 → 68,7 |
__clear(*heap,sizeof(**heap)); |
(*heap)->next = (*heap)->prev = blocks; |
(*heap)->start |= USED_BLOCK; |
return 0; |
} |
90,7 → 91,7 |
/* Maybe cut off the end of an existing block */ |
if (size < p->size) |
{ |
struct mem_block *newblock = kmalloc(sizeof(*newblock)); |
struct mem_block *newblock = malloc(sizeof(*newblock)); |
if (!newblock) |
goto out; |
newblock->start = p->start + size; |
100,7 → 101,7 |
p->next->prev = newblock; |
p->next = newblock; |
p->size = size; |
p->start|=1; |
p->start|=USED_BLOCK; |
} |
out: |
113,6 → 114,7 |
list_for_each(p, heap) |
{ |
if ( !(p->start & USED_BLOCK) && size <= p->size) |
return split_block(p, size); |
} |
128,7 → 130,6 |
list_for_each(p, heap) |
if ((p->start & ~USED_BLOCK) == start) |
return p; |
return NULL; |
} |
147,7 → 148,7 |
p->size += q->size; |
p->next = q->next; |
p->next->prev = p; |
kfree(q); |
free(q); |
} |
if ( !(p->prev->start & USED_BLOCK)) |
156,7 → 157,7 |
q->size += p->size; |
q->next = p->next; |
q->next->prev = q; |
kfree(p); |
free(p); |
} |
} |
201,7 → 202,7 |
if (!block) |
return -1; |
if ( !(block->start & 1)) |
if ( !(block->start & USED_BLOCK)) |
return -1; |
free_block(block); |
208,4 → 209,17 |
return 0; |
} |
void dump_mem() |
{ |
struct mem_block *p; |
struct mem_block **heap; |
heap = &rhd.fb_heap; |
list_for_each(p, *heap) |
{ |
dbgprintf("block: %x next: %x prev: %x start: %x size:%x\n", |
p,p->next,p->prev,p->start,p->size); |
} |
} |
/programs/system/drivers/ati2d/common.h |
---|
110,12 → 110,7 |
:"a" (mem), "c"(size>>12) |
:"edx" |
); |
asm volatile ( |
"" |
: |
: |
:"eax","ecx" |
); |
asm volatile ("":::"eax","ecx"); |
} |
/////////////////////////////////////////////////////////////////////////////// |
187,8 → 182,10 |
"rep stosb \n" |
:"=c"(tmp),"=D"(tmp) |
:"c"(len),"D"(dst) |
:"memory","eax","cc" |
:"eax" |
); |
asm volatile ("":::"ecx","edi"); |
}; |