linux-fbdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] Radeon 2D Acceleration for 2.6
@ 2004-01-20 14:44 random
  2004-01-20 21:40 ` Benjamin Herrenschmidt
  2004-01-20 22:47 ` Benjamin Herrenschmidt
  0 siblings, 2 replies; 7+ messages in thread
From: random @ 2004-01-20 14:44 UTC (permalink / raw)
  To: linux-fbdev-devel; +Cc: benh

[-- Attachment #1: Type: TEXT/PLAIN, Size: 683 bytes --]


Included are copyarea() and fillrect() for Radeon.  It is based on BenH's
new driver in drivers/video/aty, and it works on my PowerBook.
Please test.

To make this work, I've had to tell radeonfb.c to expect to always run
accelerated.  It was checking if the FB_ACCELF_TEXT bit was set in the var
passed in to enable acceleration, and it never was;  consequently, it
never "ran accelerated" meaning it never called radeon_engine_init() and
such.

Also, this is my first experience with BitKeeper, so let me know if I've
screwed something up there (and anywhere else for that matter).

-David Eger
(ps, i'm not on linux-fbdev-devel so if you reply,
     please forward a copy to me)

[-- Attachment #2: Type: TEXT/PLAIN, Size: 7202 bytes --]

# User:	eger
# Host:	rosencrantz.pok.ibm.com
# Root:	/usr/src/linux-2.6-benh-work

# Patch vers:	1.3
# Patch type:	REGULAR

== ChangeSet ==
torvalds@athlon.transmeta.com|ChangeSet|20020205173056|16047|c1d11a41ed024864
benh@kernel.crashing.org|ChangeSet|20040109135753|20972
D 1.1319 04/01/20 15:07:51+01:00 eger@rosencrantz.pok.ibm.com +3 -0
B torvalds@athlon.transmeta.com|ChangeSet|20020205173056|16047|c1d11a41ed024864
C
c Added 2D-acceleration support for radeonfb with copyarea() and fillrect()
K 22174
P ChangeSet
------------------------------------------------

0a0
> patch@athlon.transmeta.com|drivers/video/radeon.h|20020205201335|45853|de7a7433ce71623f eger@rosencrantz.pok.ibm.com|include/video/radeon.h|20040120140412|50553
> torvalds@athlon.transmeta.com|BitKeeper/etc/ignore|20020205173056|17751|fa71c5ed300a3cfc eger@rosencrantz.pok.ibm.com|BitKeeper/etc/ignore|20040120140412|57764
> benh@kernel.crashing.org|drivers/video/aty/radeon_base.c|20030907210758|08926|7b0faecdfcf8e4ae eger@rosencrantz.pok.ibm.com|drivers/video/aty/radeon_base.c|20040120140412|53176

== drivers/video/aty/radeon_base.c ==
benh@kernel.crashing.org|drivers/video/aty/radeon_base.c|20030907210758|08926|7b0faecdfcf8e4ae
benh@kernel.crashing.org|drivers/video/aty/radeon_base.c|20040104002346|65106
D 1.23 04/01/20 15:04:12+01:00 eger@rosencrantz.pok.ibm.com +123 -24
B torvalds@athlon.transmeta.com|ChangeSet|20020205173056|16047|c1d11a41ed024864
C
c Added 2D-acceleration support for radeonfb with copyarea() and fillrect()
K 53176
O -rw-rw-r--
P drivers/video/aty/radeon_base.c
------------------------------------------------

I853 1
\
I859 1
	OUTREG(DEFAULT_SC_TOP_LEFT, 0);
D897 1
I897 1
        int accel = 1;
D1528 1
I1528 1
	int accel = 1;
I1805 92
/* ------------ Accelerated Functions --------------------- */
/* the accelerated functions here are patterned after the 
 * "ACCEL_MMIO" ifdef branches in XFree86             --dte */
void radeonfb_prim_fillrect(struct radeonfb_info *rinfo, 
                       const struct fb_fillrect *region)
{
	radeon_fifo_wait(4);  
  
	OUTREG(DP_GUI_MASTER_CNTL,  
		rinfo->dp_gui_master_cntl  /* contains, like GMC_DST_32BPP */
                | GMC_BRUSH_SOLID_COLOR
                | ROP3_P);
	OUTREG(DP_BRUSH_FRGD_CLR, region->color);
	OUTREG(DP_WRITE_MSK, 0xffffffff);
	OUTREG(DP_CNTL, (DST_X_LEFT_TO_RIGHT | DST_Y_TOP_TO_BOTTOM));
\
	radeon_fifo_wait(2);  
	OUTREG(DST_Y_X, (region->dy << 16) | region->dx);
	OUTREG(DST_WIDTH_HEIGHT, (region->width << 16) | region->height);
	radeon_engine_idle ();
}
\
void radeonfb_fillrect(struct fb_info *info, 
                       const struct fb_fillrect *region)
{
	struct radeonfb_info *rinfo = (struct radeonfb_info *)info;
	struct fb_fillrect modded;
	int vxres, vyres;
  
	vxres = info->var.xres;
	vyres = info->var.yres;
\
	memcpy(&modded, region, sizeof(struct fb_fillrect));
\
	if(!modded.width || !modded.height ||
	   modded.dx >= vxres || modded.dy >= vyres)
		return;
  
	if(modded.dx + modded.width  > vxres) modded.width  = vxres - modded.dx;
	if(modded.dy + modded.height > vyres) modded.height = vyres - modded.dy;
\
	radeonfb_prim_fillrect(rinfo, &modded);
}
\
void radeonfb_prim_copyarea(struct radeonfb_info *rinfo, 
                       const struct fb_copyarea *area)
{
	radeon_fifo_wait(3);
	OUTREG(DP_GUI_MASTER_CNTL,
		rinfo->dp_gui_master_cntl /* i.e. GMC_DST_32BPP */
		| GMC_SRC_DSTCOLOR
		| ROP3_S 
		| DP_SRC_RECT );
	OUTREG(DP_WRITE_MSK, 0xffffffff);
	OUTREG(DP_CNTL, (DST_X_LEFT_TO_RIGHT | DST_Y_TOP_TO_BOTTOM));
\
	radeon_fifo_wait(3);
	OUTREG(SRC_Y_X, (area->sy << 16) | area->sx);
	OUTREG(DST_Y_X, (area->dy << 16) | area->dx);
	OUTREG(DST_HEIGHT_WIDTH, (area->height << 16) | area->width);
	radeon_engine_idle ();
}
\
\
void radeonfb_copyarea(struct fb_info *info, const struct fb_copyarea *area)
{
	struct radeonfb_info *rinfo = (struct radeonfb_info *)info;
	struct fb_copyarea modded;
	u32 vxres, vyres;
	modded.sx = area->sx;
	modded.sy = area->sy;
	modded.dx = area->dx;
	modded.dy = area->dy;
	modded.width  = area->width;
	modded.height = area->height;
  
	vxres = info->var.xres;
	vyres = info->var.yres;
\
	if(!modded.width || !modded.height ||
	   modded.sx >= vxres || modded.sy >= vyres ||
	   modded.dx >= vxres || modded.dy >= vyres)
		return;
  
	if(modded.sx + modded.width > vxres)  modded.width = vxres - modded.sx;
	if(modded.dx + modded.width > vxres)  modded.width = vxres - modded.dx;
	if(modded.sy + modded.height > vyres) modded.height = vyres - modded.sy;
	if(modded.dy + modded.height > vyres) modded.height = vyres - modded.dy;
  
	radeonfb_prim_copyarea(rinfo, &modded);
}
\
D1809 8
I1816 7
	.owner		= THIS_MODULE,
	.fb_check_var	= radeonfb_check_var,
	.fb_set_par	= radeonfb_set_par,
	.fb_setcolreg	= radeonfb_setcolreg,
	.fb_pan_display	= radeonfb_pan_display,
	.fb_blank	= radeonfb_blank,
	.fb_ioctl	= radeonfb_ioctl,
D1819 3
I1821 12
	.fb_imageblit	= cfb_imageblit,
	.fb_cursor	= soft_cursor,
};
\
static struct fb_ops radeonfb_noaccel_ops = {
	.owner		= THIS_MODULE,
	.fb_check_var	= radeonfb_check_var,
	.fb_set_par	= radeonfb_set_par,
	.fb_setcolreg	= radeonfb_setcolreg,
	.fb_pan_display	= radeonfb_pan_display,
	.fb_blank	= radeonfb_blank,
	.fb_ioctl	= radeonfb_ioctl,
D1825 1
D1840 1
D1856 8
I1863 2
	if (noaccel) {
		info->fix.accel = FB_ACCEL_NONE;
D1865 1
I1865 3
		info->fbops = &radeonfb_noaccel_ops;
	} else {
		info->fix.accel = FB_ACCEL_ATI_RADEON;
I1866 3
		info->fbops = &radeonfb_ops;
	}
	fb_alloc_cmap(&info->cmap, 256, 0);

== include/video/radeon.h ==
patch@athlon.transmeta.com|drivers/video/radeon.h|20020205201335|45853|de7a7433ce71623f
benh@kernel.crashing.org|include/video/radeon.h|20031009155225|47316
D 1.18 04/01/20 15:04:12+01:00 eger@rosencrantz.pok.ibm.com +1 -0
B torvalds@athlon.transmeta.com|ChangeSet|20020205173056|16047|c1d11a41ed024864
C
c New constant from XFree86 headers: DEFAULT_SC_TOP_LEFT
K 50553
O -rw-rw-r--
P include/video/radeon.h
------------------------------------------------

I367 1
#define DEFAULT_SC_TOP_LEFT                    0x16EC

== BitKeeper/etc/ignore ==
torvalds@athlon.transmeta.com|BitKeeper/etc/ignore|20020205173056|17751|fa71c5ed300a3cfc
benh@kernel.crashing.org|BitKeeper/etc/ignore|20031014072735|36220
D 1.64 04/01/20 15:04:12+01:00 eger@rosencrantz.pok.ibm.com +7 -0
B torvalds@athlon.transmeta.com|ChangeSet|20020205173056|16047|c1d11a41ed024864
C
c Added arch/ppc/boot/openfirmware/coffboot arch/ppc/boot/openfirmware/note arch/ppc/boot/prep/zImage arch/ppc/boot/prep/zImage.bin drivers/video/logo/logo_linux_mono.c drivers/video/logo/logo_linux_vga16.c include/asm-ppc/offsets.h to the ignore list
K 57764
O -rw-rw-r--
P BitKeeper/etc/ignore
------------------------------------------------

I284 7
arch/ppc/boot/openfirmware/coffboot
arch/ppc/boot/openfirmware/note
arch/ppc/boot/prep/zImage
arch/ppc/boot/prep/zImage.bin
drivers/video/logo/logo_linux_mono.c
drivers/video/logo/logo_linux_vga16.c
include/asm-ppc/offsets.h

# Patch checksum=36be6db7

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2004-01-23  2:21 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2004-01-20 14:44 [PATCH] Radeon 2D Acceleration for 2.6 random
2004-01-20 21:40 ` Benjamin Herrenschmidt
2004-01-20 22:47 ` Benjamin Herrenschmidt
2004-01-20 23:09   ` random
2004-01-21 11:10     ` Benjamin Herrenschmidt
2004-01-23  1:22     ` Michel Dänzer
2004-01-23  2:19       ` Benjamin Herrenschmidt

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).