linux-fbdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] radeonfb: copyarea() "memmove()" problem
@ 2004-03-29 15:13 David Eger
  2004-03-29 15:49 ` Geert Uytterhoeven
  2004-03-30 23:00 ` Benjamin Herrenschmidt
  0 siblings, 2 replies; 6+ messages in thread
From: David Eger @ 2004-03-29 15:13 UTC (permalink / raw)
  To: linux-fbdev-devel

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


Now that my local kernel actually calls copyarea(), I see that my code was
buggy... That is, the hardware needs to be told which way to do its memory
copies if areas overlap.  Think of memmove() versus memcpy().  
Attached is the fix.

Unfortunately, I think the fbcon layer is also buggy... 
(try opening a file with vim, and typing "5ddP"  the copyarea()'s that 
get sent to the fb driver seem totally bogus...)

-dte

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

--- bk-linuxppc-2.6-benh/drivers/video/aty/radeon_accel.c	2004-03-29 16:37:41.000000000 +0200
+++ linux/drivers/video/aty/radeon_accel.c	2004-03-29 17:06:43.000000000 +0200
@@ -53,14 +53,27 @@
 static void radeonfb_prim_copyarea(struct radeonfb_info *rinfo, 
 				   const struct fb_copyarea *area)
 {
+	int xdir, ydir;
+	u32 sx, sy, dx, dy, w, h;
+
+	w = area->width; h = area->height;
+	dx = area->dx; dy = area->dy;
+	sx = area->sx; sy = area->sy;
+	xdir = sx - dx;
+	ydir = sy - dy;
+
+	if ( xdir < 0 ) { sx += w-1; dx += w-1; }
+	if ( ydir < 0 ) { sy += h-1; dy += h-1; }
+
 	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));
+	OUTREG(DP_CNTL, 
+	        (xdir>=0 ? DST_X_LEFT_TO_RIGHT : 0)
+			| (ydir>=0 ? DST_Y_TOP_TO_BOTTOM : 0));
 
 	radeon_fifo_wait(3);
 	OUTREG(SRC_Y_X, (area->sy << 16) | area->sx);

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

end of thread, other threads:[~2004-04-14 18:08 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2004-03-29 15:13 [PATCH] radeonfb: copyarea() "memmove()" problem David Eger
2004-03-29 15:49 ` Geert Uytterhoeven
2004-03-30 23:00 ` Benjamin Herrenschmidt
2004-04-02 23:49   ` James Simmons
2004-04-11 19:06     ` David Eger
2004-04-14 18:08       ` James Simmons

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).