From 037ab747c11513d3514e1100e41d31f01148f7e4 Mon Sep 17 00:00:00 2001 From: "Sergey Semyonov (Serge)" Date: Sun, 12 Oct 2008 21:59:52 +0000 Subject: [PATCH] pixlib support git-svn-id: svn://kolibrios.org@876 a494cfbc-eb01-0410-851d-a64ba20cac60 --- programs/system/drivers/ati2d/accel_2d.h | 188 +++---- programs/system/drivers/ati2d/accel_2d.inc | 609 ++++++++++++--------- programs/system/drivers/ati2d/ati2d.c | 255 +-------- programs/system/drivers/ati2d/ati2d.h | 94 +++- programs/system/drivers/ati2d/r500.inc | 4 +- 5 files changed, 529 insertions(+), 621 deletions(-) diff --git a/programs/system/drivers/ati2d/accel_2d.h b/programs/system/drivers/ati2d/accel_2d.h index 0836e569c..15666fd6a 100644 --- a/programs/system/drivers/ati2d/accel_2d.h +++ b/programs/system/drivers/ati2d/accel_2d.h @@ -4,7 +4,7 @@ #define LINE_2P 3 #define BLIT 4 #define COMPIZ 5 -#define PIXMAP 6 +#define PX_CREATE 6 #define PIXBLIT 7 #define PIXLOCK 8 #define PIXUNLOCK 9 @@ -16,18 +16,90 @@ typedef unsigned int color_t; typedef struct { - pixmap_t *dstpix; + int x; + int y; +}pt_t; - int x; - int y; - u32_t w; - u32_t h; +/*********** Clipping **********/ + +typedef struct +{ + int xmin; + int ymin; + int xmax; + int ymax; +}clip_t, *PTRclip; + +#define CLIP_TOP 1 +#define CLIP_BOTTOM 2 +#define CLIP_RIGHT 4 +#define CLIP_LEFT 8 + +int LineClip ( clip_t *clip, int *x1, int *y1, int *x2, int *y2 ); + +int BlockClip( clip_t *clip, int *x1, int *y1, int *x2, int* y2 ); + +typedef struct +{ + unsigned width; + unsigned height; + u32_t format; + u32_t flags; + unsigned pitch; + void *mapped; + u32_t handle; +}pixmap_t; + + +typedef struct +{ + unsigned width; + unsigned height; + u32_t format; + u32_t flags; + + unsigned pitch; + void *mapped; + + unsigned pitch_offset; + 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 + +typedef struct +{ + local_pixmap_t *dstpix; + + struct + { + int x0; + int y0; + }; + union + { + struct + { + int x1; + int y1; + }; + struct + { + int w; + int h; + }; + }; color_t color; }draw_t; typedef struct { - pixmap_t *dstpix; + local_pixmap_t *dstpix; int x; int y; @@ -53,31 +125,11 @@ typedef struct typedef struct { - int x0; - int y0; - int x1; - int y1; - u32 color; -}line2p_t; - -typedef struct -{ - pixmap_t *pixmap; - void *usermap; - u32_t format; - u32_t pitch; - - u32_t width; - u32_t height; -}userpixmap_t; - -typedef struct -{ - pixmap_t *dstpix; + local_pixmap_t *dstpix; int dst_x; int dst_y; - pixmap_t *srcpix; + local_pixmap_t *srcpix; int src_x; int src_y; int w; @@ -85,94 +137,18 @@ typedef struct }pixblit_t; -int LineClip( int *x1, int *y1, int *x2, int *y2 ); -int BlockClip( int *x1, int *y1, int *x2, int* y2); +int Line2P(draw_t *draw); int DrawRect(draw_t * draw); int FillRect(fill_t * fill); -int Line2P(line2p_t *draw); - int Blit(blit_t *blit); int RadeonComposite( blit_t *blit); -int CreatePixmap(userpixmap_t *io); -int DestroyPixmap(userpixmap_t *io); -int LockPixmap(userpixmap_t *io); -int UnlockPixmap(userpixmap_t *io); int PixBlit(pixblit_t* blit); -# define RADEON_GMC_SRC_PITCH_OFFSET_CNTL (1 << 0) -# define RADEON_GMC_DST_PITCH_OFFSET_CNTL (1 << 1) -# define RADEON_GMC_BRUSH_SOLID_COLOR (13 << 4) -# define RADEON_GMC_BRUSH_NONE (15 << 4) -# define RADEON_GMC_DST_16BPP (4 << 8) -# define RADEON_GMC_DST_24BPP (5 << 8) -# define RADEON_GMC_DST_32BPP (6 << 8) -# define RADEON_GMC_DST_DATATYPE_SHIFT 8 -# define RADEON_GMC_SRC_DATATYPE_COLOR (3 << 12) -# define RADEON_DP_SRC_SOURCE_MEMORY (2 << 24) -# define RADEON_DP_SRC_SOURCE_HOST_DATA (3 << 24) -# define RADEON_GMC_CLR_CMP_CNTL_DIS (1 << 28) -# define RADEON_GMC_WR_MSK_DIS (1 << 30) -# define RADEON_ROP3_S 0x00cc0000 -# define RADEON_ROP3_P 0x00f00000 - -#define RADEON_CP_PACKET0 0x00000000 -#define RADEON_CP_PACKET1 0x40000000 -#define RADEON_CP_PACKET2 0x80000000 -#define RADEON_CP_PACKET3 0xC0000000 - -# define RADEON_CNTL_PAINT 0x00009100 -# define RADEON_CNTL_BITBLT 0x00009200 -# define RADEON_CNTL_TRANBLT 0x00009C00 - - -# define RADEON_CNTL_PAINT_POLYLINE 0x00009500 -# define RADEON_CNTL_PAINT_MULTI 0x00009A00 - -#define CP_PACKET0(reg, n) \ - (RADEON_CP_PACKET0 | ((n) << 16) | ((reg) >> 2)) - -#define CP_PACKET1(reg0, reg1) \ - (RADEON_CP_PACKET1 | (((reg1) >> 2) << 11) | ((reg0) >> 2)) - -#define CP_PACKET2() \ - (RADEON_CP_PACKET2) - -#define CP_PACKET3( pkt, n ) \ - (RADEON_CP_PACKET3 | (pkt) | ((n) << 16)) - -#define BEGIN_RING( n ) do { \ - ring = rhd.ring_base; \ - write = rhd.ring_wp; \ -} while (0) - -#define ADVANCE_RING() - -#define OUT_RING( x ) do { \ - ring[write++] = (x); \ -} while (0) - -#define OUT_RING_REG(reg, val) \ -do { \ - OUT_RING(CP_PACKET0(reg, 0)); \ - OUT_RING(val); \ -} while (0) - -#define DRM_MEMORYBARRIER() __asm volatile("lock; addl $0,0(%%esp)" : : : "memory"); - -#define COMMIT_RING() do { \ - rhd.ring_wp = write & 0x1FFF; \ - /* Flush writes to ring */ \ - DRM_MEMORYBARRIER(); \ - /*GET_RING_HEAD( dev_priv ); */ \ - OUTREG( RADEON_CP_RB_WPTR, rhd.ring_wp); \ - /* read from PCI bus to ensure correct posting */ \ - INREG( RADEON_CP_RB_RPTR ); \ -} while (0) diff --git a/programs/system/drivers/ati2d/accel_2d.inc b/programs/system/drivers/ati2d/accel_2d.inc index 3a9bd0e05..12589527d 100644 --- a/programs/system/drivers/ati2d/accel_2d.inc +++ b/programs/system/drivers/ati2d/accel_2d.inc @@ -1,128 +1,167 @@ -#define BRUSH_MONO (0<<4) - int DrawRect(draw_t* draw) { - int x0, y0, x1, y1; + int x0, y0, x1, y1; - pixmap_t *dstpixmap; + local_pixmap_t *dstpixmap; + clip_t dst_clip; - dstpixmap = (draw->dstpix == (void*)-1) ? &scr_pixmap : draw->dstpix ; + dstpixmap = (draw->dstpix == (void*)-1) ? &scr_pixmap : draw->dstpix ; - x0 = draw->x; - y0 = draw->y; + x0 = draw->x0; + y0 = draw->y0; + + x1 = x0+draw->w-1; + y1 = y0+draw->h-1; + + dst_clip.xmin = 0; + dst_clip.ymin = 0; + dst_clip.xmax = dstpixmap->width-1; + dst_clip.ymax = dstpixmap->height-1; - x1 = x0+draw->w-1; - y1 = y0+draw->h-1; // dbgprintf("draw rect x0:%d, y0:%d, x1:%d, y1:%d, color: %x\n", // x0, y0, x1, y1, draw->color); - if( ! BlockClip( &x0, &y0, &x1, &y1)) - { - u32 *ring, write; - int w, h; - u32 ifl; + if( ! BlockClip( &dst_clip, &x0, &y0, &x1, &y1)) + { + u32_t *ring, write; + u32_t ifl; + int w, h; - w = x1-x0+1; - h = y1-y0+1; - - ifl = safe_cli(); + w = x1-x0+1; + h = y1-y0+1; + ifl = safe_cli(); #if R300_PIO - R5xxFIFOWait(7); + R5xxFIFOWait(6); - OUTREG(R5XX_DP_GUI_MASTER_CNTL, rhd.gui_control | R5XX_ROP3_P | - R5XX_GMC_BRUSH_SOLID_COLOR | - R5XX_GMC_SRC_DATATYPE_COLOR); - - OUTREG(R5XX_DP_BRUSH_FRGD_CLR, draw->color); - OUTREG(R5XX_DP_WRITE_MASK, 0xFFFFFFFF); - 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,(y0<<16)|x0); - OUTREG(R5XX_DST_WIDTH_HEIGHT,(w<<16)|h); + OUTREG(R5XX_DP_GUI_MASTER_CNTL, + rhd.gui_control | + R5XX_ROP3_P | + R5XX_GMC_BRUSH_SOLID_COLOR | + R5XX_GMC_SRC_DATATYPE_COLOR | + R5XX_GMC_CLR_CMP_CNTL_DIS | + R5XX_GMC_WR_MSK_DIS + ); + OUTREG(R5XX_DP_BRUSH_FRGD_CLR, draw->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,(draw->y0<<16)|draw->x0); + OUTREG(R5XX_DST_WIDTH_HEIGHT,(w<<16)|h); #else + BEGIN_RING(); + OUT_RING(CP_PACKET3(RADEON_CNTL_PAINT_MULTI, 4)); - 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 | - (1 << 28)+(1 << 30) | R5XX_ROP3_P); - - OUT_RING(dstpixmap->pitch_offset); - OUT_RING(draw->color); - OUT_RING((x0<<16)|y0); - OUT_RING((w<<16)|h); - COMMIT_RING(); + 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(draw->color); + OUT_RING((draw->x0<<16)|y0); + OUT_RING((w<<16)|h); + COMMIT_RING(); #endif - - safe_sti(ifl); - } ; - return ERR_OK; + safe_sti(ifl); + }; + return ERR_OK; } int FillRect(fill_t *fill) { - pixmap_t *dstpixmap; - int x0, y0, x1, y1; + local_pixmap_t *dstpixmap; + clip_t dst_clip; + int x0, y0, x1, y1; - dstpixmap = (fill->dstpix == (void*)-1) ? &scr_pixmap : fill->dstpix ; + dstpixmap = (fill->dstpix == (void*)-1) ? &scr_pixmap : fill->dstpix ; - x0 = fill->x; - y0 = fill->y; + x0 = fill->x; + y0 = fill->y; - x1 = x0+fill->w-1; - y1 = y0+fill->h-1; + x1 = x0+fill->w-1; + y1 = y0+fill->h-1; + + dst_clip.xmin = 0; + dst_clip.ymin = 0; + dst_clip.xmax = dstpixmap->width-1; + dst_clip.ymax = dstpixmap->height-1; // dbgprintf("fill rect x0:%d, y0:%d, x1:%d, y1:%d\n", // x0, y0, x1, y1); - if( ! BlockClip( &x0, &y0, &x1, &y1)) - { - u32 *ring, write; - u32 ifl; - - ifl = safe_cli(); + if( ! BlockClip(&dst_clip, &x0, &y0, &x1, &y1)) + { + u32_t *ring, write; + u32_t ifl = safe_cli(); #if R300_PIO + int w = x1-x0+1; + int h = y1-y0+1; + + R5xxFIFOWait(9); + + OUTREG(R5XX_DP_GUI_MASTER_CNTL, + RADEON_GMC_DST_PITCH_OFFSET_CNTL | + R5XX_GMC_BRUSH_8X8_MONO_FG_BG | + RADEON_GMC_DST_32BPP | + R5XX_GMC_SRC_DATATYPE_COLOR | + R5XX_GMC_CLR_CMP_CNTL_DIS | + R5XX_GMC_WR_MSK_DIS | + R5XX_ROP3_P + ); + + OUTREG(R5XX_DP_BRUSH_BKGD_CLR, fill->bkcolor); + OUTREG(R5XX_DP_BRUSH_FRGD_CLR, fill->fcolor); + + OUTREG(R5XX_BRUSH_DATA0, fill->bmp0); + OUTREG(R5XX_BRUSH_DATA1, fill->bmp1); + + 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,(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 | + RADEON_GMC_DST_32BPP | + RADEON_GMC_SRC_DATATYPE_COLOR | + R5XX_GMC_CLR_CMP_CNTL_DIS | + R5XX_GMC_WR_MSK_DIS | + R5XX_ROP3_P + ); - BEGIN_RING(); - OUT_RING(CP_PACKET3(RADEON_CNTL_PAINT, 7)); - OUT_RING(RADEON_GMC_DST_PITCH_OFFSET_CNTL | - BRUSH_MONO | - RADEON_GMC_DST_32BPP | - RADEON_GMC_SRC_DATATYPE_COLOR | - (1 << 28)+(1 << 30) | R5XX_ROP3_P); + OUT_RING(dstpixmap->pitch_offset); + OUT_RING(fill->bkcolor); + OUT_RING(fill->fcolor); - OUT_RING(dstpixmap->pitch_offset); - OUT_RING(fill->bkcolor); - OUT_RING(fill->fcolor); + OUT_RING(fill->bmp0); + OUT_RING(fill->bmp1); - OUT_RING(fill->bmp0); - OUT_RING(fill->bmp1); - - OUT_RING((y0<<16)|x0); - OUT_RING((y1<<16)|x1); - COMMIT_RING(); + OUT_RING((y0<<16)|x0); + OUT_RING((y1<<16)|x1); + COMMIT_RING(); #endif + safe_sti(ifl); + }; + return ERR_OK; +}; - safe_sti(ifl); - }; - return ERR_OK; -} - +#if 0 int Blit(blit_t *blit) { int x0, y0, x1, y1; @@ -134,7 +173,7 @@ int Blit(blit_t *blit) y1 = y0+blit->h-1; - if( ! BlockClip( &x0, &y0, &x1, &y1)) + if( ! BlockClip(&clip, &x0, &y0, &x1, &y1)) { u32 *ring, write; int w, h; @@ -176,23 +215,25 @@ int Blit(blit_t *blit) return ERR_OK; } -int Line2P(line2p_t *draw) +int Line2P(draw_t *draw) { - + local_pixmap_t *dstpixmap; int x0, y0, x1, y1; + dstpixmap = (draw->dstpix == (void*)-1) ? &scr_pixmap : draw->dstpix ; + x0 = draw->x0; y0 = draw->y0; x1 = draw->x1; y1 = draw->y1; - if ( !LineClip( &x0, &y0, &x1, &y1 )) + if ( !LineClip(&clip, &x0, &y0, &x1, &y1 )) { - u32 ifl; + u32 efl; u32 *ring, write; - ifl = safe_cli(); + efl = safe_cli(); #if R300_PIO @@ -234,96 +275,113 @@ int Line2P(line2p_t *draw) COMMIT_RING(); #endif - safe_sti(ifl); + safe_sti(efl); }; return ERR_OK; } +#endif - -int CreatePixmap(userpixmap_t *io) +int CreatePixmap(pixmap_t *io) { + local_pixmap_t *pixmap; - pixmap_t *pixmap; + unsigned pitch; + size_t size; - u32_t pitch; - void *raw; + void *local; - 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); + 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 ERR_PARAM; + }; + + pitch = ((io->width+15)&~15)*4; + size = pitch*io->height; + + dbgprintf("pitch = %d\n", pitch); + + local = rhd_mem_alloc(&rhd,RHD_MEM_FB,size) ; + if ( !local) + { + dbgprintf("Not enough memory for pixmap\n"); + return ERR_PARAM; + }; + + pixmap = malloc(sizeof(local_pixmap_t)); + if(!pixmap) + { + rhd_mem_free(&rhd, RHD_MEM_FB,local); + return ERR_PARAM; + } + else + { + void *mapped; + + size = (size+4095) & ~ 4095; + + if (mapped = UserAlloc(size)) + { + CommitPages(mapped, ((u32_t)local+rhd.PhisBase)|7|(1<<9), size); + + io->mapped = mapped; + io->pitch = pitch; + io->handle = (u32_t)pixmap; + + pixmap->width = io->width; + pixmap->height = io->height; + pixmap->format = PICT_a8r8g8b8; + pixmap->flags = io->flags; + pixmap->pitch = pitch; + pixmap->mapped = mapped; + pixmap->pitch_offset = ((pitch/64)<<22)| (((u32_t)local+rhd.FbIntAddress)>>10); + pixmap->local = local; + + dbgprintf("pixmap.pitch_offset: %x\n", pixmap->pitch_offset); + dbgprintf("width: %d height: %d\n",pixmap->width,pixmap->height ); + dbgprintf("map at %x\n", pixmap->mapped); + + return ERR_OK; + }; + rhd_mem_free(&rhd, RHD_MEM_FB,local); + free(pixmap); + }; return ERR_PARAM; - - }; - - 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 ERR_PARAM; - }; - - pixmap = malloc(sizeof(pixmap_t)); - if(!pixmap) - { - rhd_mem_free(&rhd, RHD_MEM_FB,raw); - return ERR_PARAM; - } - else - { - io->pixmap = pixmap; - io->usermap = NULL; - io->format = PICT_a8r8g8b8; - io->pitch = 0; - - pixmap->width = io->width; - pixmap->height = io->height; - pixmap->format = PICT_a8r8g8b8; - pixmap->flags = 0; - pixmap->pitch = pitch; - pixmap->offset = (u32_t)raw+rhd.FbIntAddress; - pixmap->pitch_offset = ((pitch/64)<<22)| (pixmap->offset>>10); - pixmap->raw = raw; - pixmap->usermap = NULL; - - 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 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 DestroyPixmap( pixmap_t *io ) +{ + local_pixmap_t *pixmap; + size_t size; + + dbgprintf("Destroy pixmap %x\n", io->handle); + + if(io->handle == -1) + return ERR_PARAM; + else + pixmap = (local_pixmap_t*)io->handle; + + size = (pixmap->pitch*pixmap->height+4095) & ~ 4095; + + UnmapPages(pixmap->mapped, size); + UserFree(pixmap->mapped); + + rhd_mem_free(&rhd,RHD_MEM_FB,pixmap->local); + free(pixmap); + + io->format = 0; + io->pitch = 0; + io->mapped = NULL; + io->handle = 0; + + return ERR_OK; +}; + +#if 0 + int LockPixmap(userpixmap_t *io) { pixmap_t *pixmap; @@ -391,17 +449,14 @@ int UnlockPixmap(userpixmap_t *io) return ERR_OK; }; +#endif int PixBlit(pixblit_t *blit) { + clip_t src_clip, dst_clip; - u32 *ring, write; - int w, h; - u32 ifl; - int x0, y0; - - pixmap_t *srcpixmap; - pixmap_t *dstpixmap; + local_pixmap_t *srcpixmap; + local_pixmap_t *dstpixmap; //dbgprintf("Pixblit src: %x dst: %x\n",blit->srcpix, blit->dstpix); @@ -415,74 +470,86 @@ int PixBlit(pixblit_t *blit) //dbgprintf("srcpitch: %x dstpitch: %x\n", // srcpixmap->pitch_offset,dstpixmap->pitch_offset); - ifl = safe_cli(); + src_clip.xmin = 0; + src_clip.ymin = 0; + src_clip.xmax = srcpixmap->width-1; + src_clip.ymax = srcpixmap->height-1; + + dst_clip.xmin = 0; + dst_clip.ymin = 0; + dst_clip.xmax = dstpixmap->width-1; + dst_clip.ymax = dstpixmap->height-1; + + if( !blit_clip(&dst_clip, &blit->dst_x, &blit->dst_y, + &src_clip, &blit->src_x, &blit->src_y, + &blit->w, &blit->h) ) + { + u32_t *ring, write; + + u32_t ifl = safe_cli(); #if R300_PIO - R5xxFIFOWait(7); + R5xxFIFOWait(7); - OUTREG(R5XX_DP_GUI_MASTER_CNTL, - 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 | - R5XX_GMC_CLR_CMP_CNTL_DIS | - R5XX_GMC_WR_MSK_DIS | - R5XX_ROP3_S - ); + OUTREG(R5XX_DP_GUI_MASTER_CNTL, + 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 | + R5XX_GMC_CLR_CMP_CNTL_DIS | + R5XX_GMC_WR_MSK_DIS | + R5XX_ROP3_S + ); - OUTREG(R5XX_DP_CNTL, R5XX_DST_X_LEFT_TO_RIGHT | R5XX_DST_Y_TOP_TO_BOTTOM); + 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_SRC_PITCH_OFFSET, srcpixmap->pitch_offset); + OUTREG(R5XX_DST_PITCH_OFFSET, dstpixmap->pitch_offset); + OUTREG(R5XX_SRC_PITCH_OFFSET, srcpixmap->pitch_offset); - OUTREG(R5XX_SRC_Y_X,(blit->src_y<<16)|blit->src_x); - OUTREG(R5XX_DST_Y_X,(blit->dst_y<<16)|blit->dst_x); - OUTREG(R5XX_DST_HEIGHT_WIDTH,(blit->h<<16)|blit->w); + OUTREG(R5XX_SRC_Y_X,(blit->src_y<<16)|blit->src_x); + OUTREG(R5XX_DST_Y_X,(blit->dst_y<<16)|blit->dst_x); + OUTREG(R5XX_DST_HEIGHT_WIDTH,(blit->h<<16)|blit->w); #else - BEGIN_RING(); - OUT_RING(CP_PACKET3(RADEON_CNTL_BITBLT, 5)); + 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 | - R5XX_GMC_CLR_CMP_CNTL_DIS | - R5XX_GMC_WR_MSK_DIS | - R5XX_ROP3_S - ); + 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 | + R5XX_GMC_CLR_CMP_CNTL_DIS | + R5XX_GMC_WR_MSK_DIS | + R5XX_ROP3_S + ); - OUT_RING(srcpixmap->pitch_offset); - OUT_RING(dstpixmap->pitch_offset); + OUT_RING(srcpixmap->pitch_offset); + OUT_RING(dstpixmap->pitch_offset); - 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(); + 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(); #endif - - safe_sti(ifl); - return ERR_OK; -} + safe_sti(ifl); + }; + return ERR_OK; +}; int TransBlit(pixblit_t *blit) { + clip_t src_clip, dst_clip; - u32 *ring, write; - int w, h; - u32 ifl; - int x0, y0; - - pixmap_t *srcpixmap; - pixmap_t *dstpixmap; + local_pixmap_t *srcpixmap; + local_pixmap_t *dstpixmap; // dbgprintf("Transblit src: %x dst: %x\n",blit->srcpix, blit->dstpix); @@ -495,68 +562,84 @@ int TransBlit(pixblit_t *blit) //dbgprintf("src.width: %d src.height: %d\n", srcpixmap->width,srcpixmap->height); //dbgprintf("srcpitch: %x dstpitch: %x\n", // srcpixmap->pitch_offset,dstpixmap->pitch_offset); + src_clip.xmin = 0; + src_clip.ymin = 0; + src_clip.xmax = srcpixmap->width-1; + src_clip.ymax = srcpixmap->height-1; - ifl = safe_cli(); + dst_clip.xmin = 0; + dst_clip.ymin = 0; + dst_clip.xmax = dstpixmap->width-1; + dst_clip.ymax = dstpixmap->height-1; + + if( !blit_clip(&dst_clip, &blit->dst_x, &blit->dst_y, + &src_clip, &blit->src_x, &blit->src_y, + &blit->w, &blit->h) ) + { + u32_t *ring, write; + + u32_t ifl = safe_cli(); #if R300_PIO - R5xxFIFOWait(10); + R5xxFIFOWait(10); - OUTREG(R5XX_DP_GUI_MASTER_CNTL, - 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 | - R5XX_GMC_WR_MSK_DIS | - R5XX_ROP3_S - ); + OUTREG(R5XX_DP_GUI_MASTER_CNTL, + 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 | + R5XX_GMC_WR_MSK_DIS | + R5XX_ROP3_S + ); - OUTREG(R5XX_DP_CNTL, R5XX_DST_X_LEFT_TO_RIGHT | R5XX_DST_Y_TOP_TO_BOTTOM); + OUTREG(R5XX_DP_CNTL, R5XX_DST_X_LEFT_TO_RIGHT | R5XX_DST_Y_TOP_TO_BOTTOM); - OUTREG(R5XX_CLR_CMP_CLR_SRC, 0xFF000000); - OUTREG(R5XX_CLR_CMP_MASK, R5XX_CLR_CMP_MSK); - OUTREG(R5XX_CLR_CMP_CNTL, R5XX_SRC_CMP_EQ_COLOR | R5XX_CLR_CMP_SRC_SOURCE); + OUTREG(R5XX_CLR_CMP_CLR_SRC, 0xFF000000); + OUTREG(R5XX_CLR_CMP_MASK, R5XX_CLR_CMP_MSK); + OUTREG(R5XX_CLR_CMP_CNTL, R5XX_SRC_CMP_EQ_COLOR | R5XX_CLR_CMP_SRC_SOURCE); - OUTREG(R5XX_DST_PITCH_OFFSET, dstpixmap->pitch_offset); - OUTREG(R5XX_SRC_PITCH_OFFSET, srcpixmap->pitch_offset); + OUTREG(R5XX_DST_PITCH_OFFSET, dstpixmap->pitch_offset); + OUTREG(R5XX_SRC_PITCH_OFFSET, srcpixmap->pitch_offset); - OUTREG(R5XX_SRC_Y_X,(blit->src_y<<16)|blit->src_x); - OUTREG(R5XX_DST_Y_X,(blit->dst_y<<16)|blit->dst_x); - OUTREG(R5XX_DST_HEIGHT_WIDTH,(blit->h<<16)|blit->w); + OUTREG(R5XX_SRC_Y_X,(blit->src_y<<16)|blit->src_x); + OUTREG(R5XX_DST_Y_X,(blit->dst_y<<16)|blit->dst_x); + OUTREG(R5XX_DST_HEIGHT_WIDTH,(blit->h<<16)|blit->w); #else - BEGIN_RING(); - OUT_RING(CP_PACKET3(RADEON_CNTL_TRANBLT, 8)); + 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 | - R5XX_GMC_WR_MSK_DIS | - R5XX_ROP3_S - ); + 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 | + R5XX_GMC_WR_MSK_DIS | + R5XX_ROP3_S + ); - OUT_RING(srcpixmap->pitch_offset); - OUT_RING(dstpixmap->pitch_offset); + OUT_RING(srcpixmap->pitch_offset); + OUT_RING(dstpixmap->pitch_offset); - OUT_RING(R5XX_CLR_CMP_SRC_SOURCE | R5XX_SRC_CMP_EQ_COLOR); - OUT_RING(0xFF000000); - OUT_RING(0xFF000000); + OUT_RING(R5XX_CLR_CMP_SRC_SOURCE | R5XX_SRC_CMP_EQ_COLOR); + 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); + 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(); + COMMIT_RING(); #endif - safe_sti(ifl); - return ERR_OK; + safe_sti(ifl); + }; + return ERR_OK; } diff --git a/programs/system/drivers/ati2d/ati2d.c b/programs/system/drivers/ati2d/ati2d.c index acacceba0..71c3052c4 100644 --- a/programs/system/drivers/ati2d/ati2d.c +++ b/programs/system/drivers/ati2d/ati2d.c @@ -2,16 +2,18 @@ //ld -T ld.x -s --shared --image-base 0 --file-alignment 32 -o test.exe test.obj core.lib #include "common.h" + #include "ati2d.h" #include "accel_2d.h" RHD_t rhd; -pixmap_t scr_pixmap; - static clip_t clip; +static local_pixmap_t scr_pixmap; + +/* void STDCALL (*SelectHwCursor)(cursor_t*)__asm__("SelectHwCursor"); void STDCALL (*SetHwCursor)(cursor_t*,int x,int y)__asm__("SetHwCursor"); void STDCALL (*HwCursorRestore)(int x, int y)__asm("HwCursorRestore"); @@ -22,6 +24,7 @@ void (__stdcall *old_set)(cursor_t*,int x,int y); void (__stdcall *old_restore)(int x, int y); cursor_t* (*old_create)(void); cursor_t* __create_cursor(void); +*/ static void Init3DEngine(RHDPtr rhdPtr); @@ -86,14 +89,11 @@ u32 __stdcall drvEntry(int action) }; -#pragma pack (push,1) - -#pragma pack (pop) - #define API_VERSION 0x01000100 #define SRV_GETVERSION 0 +/* int _stdcall srv_cursor(ioctl_t *io) { u32 *inp; @@ -117,7 +117,7 @@ int _stdcall srv_cursor(ioctl_t *io) }; return ERR_PARAM; } - +*/ int _stdcall srv_2d(ioctl_t *io) { @@ -146,10 +146,10 @@ int _stdcall srv_2d(ioctl_t *io) if(io->inp_size==9) return FillRect((fill_t*)inp); break; - +/* case LINE_2P: - if(io->inp_size==5) - return Line2P((line2p_t*)inp); + if(io->inp_size==6) + return Line2P((draw_t*)inp); break; case BLIT: @@ -161,10 +161,10 @@ int _stdcall srv_2d(ioctl_t *io) if(io->inp_size==6) return RadeonComposite((blit_t*)inp); break; - - case PIXMAP: - if(io->inp_size==6) - return CreatePixmap((userpixmap_t*)inp); +*/ + case PX_CREATE: + if(io->inp_size==7) + return CreatePixmap((pixmap_t*)inp); break; case PIXBLIT: @@ -172,19 +172,19 @@ int _stdcall srv_2d(ioctl_t *io) return PixBlit((pixblit_t*)inp); break; - case PIXLOCK: - if(io->inp_size==6) - return LockPixmap((userpixmap_t*)inp); - break; +// case PIXLOCK: +// if(io->inp_size==6) +// return LockPixmap((userpixmap_t*)inp); +// break; - case PIXUNLOCK: - if(io->inp_size==6) - return UnlockPixmap((userpixmap_t*)inp); - break; +// case PIXUNLOCK: +// if(io->inp_size==6) +// return UnlockPixmap((userpixmap_t*)inp); +// break; case PIXDESTROY: if(io->inp_size==6) - return DestroyPixmap((userpixmap_t*)inp); + return DestroyPixmap((pixmap_t*)inp); break; case TRANSBLIT: @@ -206,214 +206,9 @@ int _stdcall srv_2d(ioctl_t *io) //#include "cursor.inc" #include "r500.inc" + +#include "clip.inc" #include "accel_2d.inc" #include "accel_3d.inc" -#define CLIP_TOP 1 -#define CLIP_BOTTOM 2 -#define CLIP_RIGHT 4 -#define CLIP_LEFT 8 - -char _L1OutCode( int x, int y ) -/*================================= - - Verify that a point is inside or outside the active viewport. */ -{ - char flag; - - flag = 0; - if( x < clip.xmin ) { - flag |= CLIP_LEFT; - } else if( x > clip.xmax ) { - flag |= CLIP_RIGHT; - } - if( y < clip.ymin ) { - flag |= CLIP_TOP; - } else if( y > clip.ymax ) { - flag |= CLIP_BOTTOM; - } - return( flag ); -} - - -static void line_inter( int * x1, int* y1, int x2, int y2, int x ) -/*=========================================================================== - - Find the intersection of a line with a boundary of the viewport. - (x1, y1) is outside and ( x2, y2 ) is inside the viewport. - NOTE : the signs of denom and ( x - *x1 ) cancel out during division - so make both of them positive before rounding. */ -{ - int numer; - int denom; - - denom = abs( x2 - *x1 ); - numer = 2L * (long)( y2 - *y1 ) * abs( x - *x1 ); - if( numer > 0 ) { - numer += denom; /* round to closest pixel */ - } else { - numer -= denom; - } - *y1 += numer / ( denom << 1 ); - *x1 = x; -} - - -int LineClip( int *x1, int *y1, int *x2, int *y2 ) -/*============================================================= - - Clips the line with end points (x1,y1) and (x2,y2) to the active - viewport using the Cohen-Sutherland clipping algorithm. Return the - clipped coordinates and a decision drawing flag. */ -{ - char flag1; - char flag2; - - flag1 = _L1OutCode( *x1, *y1 ); - flag2 = _L1OutCode( *x2, *y2 ); - for( ;; ) { - if( flag1 & flag2 ) break; /* trivially outside */ - if( flag1 == flag2 ) break; /* completely inside */ - if( flag1 == 0 ) { /* first point inside */ - if( flag2 & CLIP_TOP ) { - line_inter( y2, x2, *y1, *x1, clip.ymin ); - } else if( flag2 & CLIP_BOTTOM ) { - line_inter( y2, x2, *y1, *x1, clip.ymax ); - } else if( flag2 & CLIP_RIGHT ) { - line_inter( x2, y2, *x1, *y1, clip.xmax ); - } else if( flag2 & CLIP_LEFT ) { - line_inter( x2, y2, *x1, *y1, clip.xmin ); - } - flag2 = _L1OutCode( *x2, *y2 ); - } else { /* second point inside */ - if( flag1 & CLIP_TOP ) { - line_inter( y1, x1, *y2, *x2, clip.ymin ); - } else if( flag1 & CLIP_BOTTOM ) { - line_inter( y1, x1, *y2, *x2, clip.ymax ); - } else if( flag1 & CLIP_RIGHT ) { - line_inter( x1, y1, *x2, *y2, clip.xmax ); - } else if( flag1 & CLIP_LEFT ) { - line_inter( x1, y1, *x2, *y2, clip.xmin ); - } - flag1 = _L1OutCode( *x1, *y1 ); - } - } - return( flag1 & flag2 ); -} - - -static void block_inter( int *x, int *y, int flag ) -/*====================================================== - - Find the intersection of a block with a boundary of the viewport. */ -{ - if( flag & CLIP_TOP ) { - *y = clip.ymin; - } else if( flag & CLIP_BOTTOM ) { - *y = clip.ymax; - } else if( flag & CLIP_RIGHT ) { - *x = clip.xmax; - } else if( flag & CLIP_LEFT ) { - *x = clip.xmin; - } -} - - -int BlockClip( int *x1, int *y1, int *x2, int* y2 ) -/*============================================================== - - Clip a block with opposite corners (x1,y1) and (x2,y2) to the - active viewport based on the Cohen-Sutherland algorithm for line - clipping. Return the clipped coordinates and a decision drawing - flag ( 0 draw : 1 don't draw ). */ -{ - char flag1; - char flag2; - - flag1 = _L1OutCode( *x1, *y1 ); - flag2 = _L1OutCode( *x2, *y2 ); - for( ;; ) { - if( flag1 & flag2 ) break; /* trivially outside */ - if( flag1 == flag2 ) break; /* completely inside */ - if( flag1 == 0 ) { - block_inter( x2, y2, flag2 ); - flag2 = _L1OutCode( *x2, *y2 ); - } else { - block_inter( x1, y1, flag1 ); - flag1 = _L1OutCode( *x1, *y1 ); - } - } - return( flag1 & flag2 ); -} - -#if 0 -typedef struct -{ - int left; - int top; - int right; - int bottom; -}rect_t; - -typedef struct _window -{ - struct _window *fd; - struct _window *bk; - - rect_t pos; - int width; - int height; - - int level; -}win_t, *WINPTR; - - -WINPTR top = NULL; -WINPTR bottom = NULL; - -WINPTR alloc_window() -{ - WINPTR pwin = malloc(sizeof(win_t)); - - return pwin; -}; - - -WINPTR create_win(int l, int t, int w, int h, int level) -{ - WINPTR pwin = alloc_window(); - - pwin->pos.left = l; - pwin->pos.top = t; - pwin->pos.right = l+w-1; - pwin->pos.bottom = t+h-1; - pwin->width = w; - pwin->height = h; - - pwin->level = level; - - return pwin; -}; - -void insert_window(WINPTR pwin) -{ - WINPTR p = top; - - if(p) - { - if(pwin->level <= p->level) - { - pwin->fd = p; - pwin->bk = p->bk; - pwin->bk->fd = pwin; - p->bk = pwin; - } - else - p = p->fd; - } - else - top = pwin; -} - -#endif diff --git a/programs/system/drivers/ati2d/ati2d.h b/programs/system/drivers/ati2d/ati2d.h index 7e8d86373..86983c13e 100644 --- a/programs/system/drivers/ati2d/ati2d.h +++ b/programs/system/drivers/ati2d/ati2d.h @@ -167,29 +167,83 @@ typedef struct RHDRec extern RHD_t rhd; -typedef struct -{ - int xmin; - int ymin; - int xmax; - int ymax; -}clip_t, *PTRclip; -typedef struct -{ - u32_t width; - u32_t height; - u32_t format; - u32_t flags; - u32_t pitch_offset; - u32_t pitch; - u32_t offset; - void* raw; - void* usermap; -}pixmap_t; +#define R5XX_DP_BRUSH_BKGD_CLR 0x1478 +#define R5XX_DP_BRUSH_FRGD_CLR 0x147c +#define R5XX_BRUSH_DATA0 0x1480 +#define R5XX_BRUSH_DATA1 0x1484 + +# define RADEON_GMC_SRC_PITCH_OFFSET_CNTL (1 << 0) +# define RADEON_GMC_DST_PITCH_OFFSET_CNTL (1 << 1) +# define RADEON_GMC_BRUSH_SOLID_COLOR (13 << 4) +# define RADEON_GMC_BRUSH_NONE (15 << 4) +# define RADEON_GMC_DST_16BPP (4 << 8) +# define RADEON_GMC_DST_24BPP (5 << 8) +# define RADEON_GMC_DST_32BPP (6 << 8) +# define RADEON_GMC_DST_DATATYPE_SHIFT 8 +# define RADEON_GMC_SRC_DATATYPE_COLOR (3 << 12) +# define RADEON_DP_SRC_SOURCE_MEMORY (2 << 24) +# define RADEON_DP_SRC_SOURCE_HOST_DATA (3 << 24) +# define RADEON_GMC_CLR_CMP_CNTL_DIS (1 << 28) +# define RADEON_GMC_WR_MSK_DIS (1 << 30) +# define RADEON_ROP3_S 0x00cc0000 +# define RADEON_ROP3_P 0x00f00000 + +#define RADEON_CP_PACKET0 0x00000000 +#define RADEON_CP_PACKET1 0x40000000 +#define RADEON_CP_PACKET2 0x80000000 +#define RADEON_CP_PACKET3 0xC0000000 + +# define RADEON_CNTL_PAINT 0x00009100 +# define RADEON_CNTL_BITBLT 0x00009200 +# define RADEON_CNTL_TRANBLT 0x00009C00 + +# define RADEON_CNTL_PAINT_POLYLINE 0x00009500 +# define RADEON_CNTL_PAINT_MULTI 0x00009A00 + +#define CP_PACKET0(reg, n) \ + (RADEON_CP_PACKET0 | ((n) << 16) | ((reg) >> 2)) + +#define CP_PACKET1(reg0, reg1) \ + (RADEON_CP_PACKET1 | (((reg1) >> 2) << 11) | ((reg0) >> 2)) + +#define CP_PACKET2() \ + (RADEON_CP_PACKET2) + +#define CP_PACKET3( pkt, n ) \ + (RADEON_CP_PACKET3 | (pkt) | ((n) << 16)) + +#define BEGIN_RING( n ) do { \ + ring = rhd.ring_base; \ + write = rhd.ring_wp; \ +} while (0) + +#define ADVANCE_RING() + +#define OUT_RING( x ) do { \ + ring[write++] = (x); \ +} while (0) + +#define OUT_RING_REG(reg, val) \ +do { \ + OUT_RING(CP_PACKET0(reg, 0)); \ + OUT_RING(val); \ +} while (0) + +#define DRM_MEMORYBARRIER() __asm volatile("lock; addl $0,0(%%esp)" : : : "memory"); + +#define COMMIT_RING() do { \ + rhd.ring_wp = write & 0x1FFF; \ + /* Flush writes to ring */ \ + DRM_MEMORYBARRIER(); \ + /*GET_RING_HEAD( dev_priv ); */ \ + OUTREG( RADEON_CP_RB_WPTR, rhd.ring_wp); \ + /* read from PCI bus to ensure correct posting */ \ + INREG( RADEON_CP_RB_RPTR ); \ +} while (0) + -#define PX_LOCK 1 typedef struct { int token; /* id of the token */ diff --git a/programs/system/drivers/ati2d/r500.inc b/programs/system/drivers/ati2d/r500.inc index 17bbe1f15..4594926ce 100644 --- a/programs/system/drivers/ati2d/r500.inc +++ b/programs/system/drivers/ati2d/r500.inc @@ -389,9 +389,9 @@ void R5xx2DInit() scr_pixmap.height = rhd.displayHeight; scr_pixmap.format = PICT_a8r8g8b8; scr_pixmap.pitch = rhd.displayWidth * 4; - scr_pixmap.offset = rhd.FbIntAddress; + scr_pixmap.local = (void*)rhd.FbIntAddress; scr_pixmap.pitch_offset = rhd.dst_pitch_offset; - scr_pixmap.raw = (void*)0; + scr_pixmap.mapped = (void*)0; MASKREG(R5XX_GB_TILE_CONFIG, 0, R5XX_ENABLE_TILING);