pm2fb: fb_sync added
PATCH 1/1 pm2fb: fb_sync added
From: Krzysztof Helt <[email protected]>
This patch converts internal wait_pm2() function to fb API fb_sync() method.
---
The change of arguments in acceleration function allows use of fb_sync by them. Current testing shows that fb_sync is not required, but I left new arguments in case it may be needed. I am working on speeding scrolling now.
Regards,
Krzysztof
--- linux.orig/drivers/video/pm2fb.c 2007-05-08
09:21:08.000000000 +0200
+++ linux-2.6.21/drivers/video/pm2fb.c 2007-05-08
09:22:08.000000000 +0200
@@ -204,17 +204,6 @@ static inline void WAIT_FIFO(struct pm2f
}
#endif
-static void wait_pm2(struct pm2fb_par* par) {
-
- WAIT_FIFO(par, 1);
- pm2_WR(par, PM2R_SYNC, 0);
- mb();
- do {
- while (pm2_RD(par, PM2R_OUT_FIFO_WORDS) == 0);
- rmb();
- } while (pm2_RD(par, PM2R_OUT_FIFO) != PM2TAG(PM2R_SYNC));
-}
-
/*
* partial products for the supported horizontal resolutions. */
@@ -1050,13 +1039,30 @@ static int pm2fb_blank(int blank_mode, s
return 0;
}
+static int pm2fb_sync(struct fb_info *info)
+{
+ struct pm2fb_par *par = info->par;
+
+ WAIT_FIFO(par, 1);
+ pm2_WR(par, PM2R_SYNC, 0);
+ mb();
+ do {
+ while (pm2_RD(par, PM2R_OUT_FIFO_WORDS) == 0)
+ udelay(10);
+ rmb();
+ } while (pm2_RD(par, PM2R_OUT_FIFO) != PM2TAG(PM2R_SYNC));
+
+ return 0;
+}
+
/*
* block operation. copy=0: rectangle fill, copy=1: rectangle copy. */
-static void pm2fb_block_op(struct pm2fb_par* par, int copy, +static void pm2fb_block_op(struct fb_info* info, int copy,
s32 xsrc, s32 ysrc,
s32 x, s32 y, s32 w, s32 h, u32 color) {
+ struct pm2fb_par *par = info->par;
if (!w || !h)
return;
@@ -1076,13 +1082,11 @@ static void pm2fb_block_op(struct pm2fb_
(x<xsrc ? PM2F_INCREASE_X : 0) | (y<ysrc ? PM2F_INCREASE_Y : 0) | (copy ? 0 : PM2F_RENDER_FASTFILL));
- wait_pm2(par);
}
static void pm2fb_fillrect (struct fb_info *info,
const struct fb_fillrect *region)
{
- struct pm2fb_par *par = info->par;
struct fb_fillrect modded;
int vxres, vyres;
u32 color = (info->fix.visual == FB_VISUAL_TRUECOLOR) ?
@@ -1116,7 +1120,7 @@ static void pm2fb_fillrect (struct fb_in
color |= color << 16;
if(info->var.bits_per_pixel != 24)
- pm2fb_block_op(par, 0, 0, 0,
+ pm2fb_block_op(info, 0, 0, 0,
modded.dx, modded.dy, modded.width, modded.height, color);
else
@@ -1126,7 +1130,6 @@ static void pm2fb_fillrect (struct fb_in
static void pm2fb_copyarea(struct fb_info *info,
const struct fb_copyarea *area)
{
- struct pm2fb_par *par = info->par;
struct fb_copyarea modded;
u32 vxres, vyres;
@@ -1156,7 +1159,7 @@ static void pm2fb_copyarea(struct fb_inf
if(modded.dy + modded.height > vyres)
modded.height = vyres - modded.dy;
- pm2fb_block_op(par, 1, modded.sx, modded.sy,
+ pm2fb_block_op(info, 1, modded.sx, modded.sy,
modded.dx, modded.dy, modded.width, modded.height, 0);
}
@@ -1177,6 +1180,7 @@ static struct fb_ops pm2fb_ops = {
.fb_fillrect = pm2fb_fillrect,
.fb_copyarea = pm2fb_copyarea,
.fb_imageblit = cfb_imageblit,
+ .fb_sync = pm2fb_sync,
};
/*
----------------------------------------------------
Morderstwa i krew ofiar na ścianach. Mroczne miasto pogrążone w chaosie. Sprawdź kto jest Przybywającym! Przybywający - thriller metafizyczny już w księgarniach.
http://klik.wp.pl/?adr=http%3A%2F%2Fksiazki.wp.pl%2Fkatalog%2Fksiazki%2Fksiazka.html%3Fkw%3D10414&sid=1128
drivers/video/pm2fb.c +21 -17
@@ -204,17 +204,6 @@ static inline void WAIT_FIFO(struct pm2f }#endif -static void wait_pm2 (struct pm2fb_par * par) { - -WAIT_FIFO (par,1 ); -pm2_WR (par,PM2R_SYNC ,0 ); -mb (); -do { -while (pm2_RD (par,PM2R_OUT_FIFO_WORDS ) ==0 ); -rmb (); - }while (pm2_RD (par,PM2R_OUT_FIFO ) !=PM2TAG (PM2R_SYNC )); -} -/* * partial products for the supported horizontal resolutions. */
@@ -1050,13 +1039,30 @@ static int pm2fb_blank(int blank_mode, sreturn 0 ; } +static int pm2fb_sync (struct fb_info *info) +{ +struct pm2fb_par *par = info->par; + +WAIT_FIFO (par,1 ); +pm2_WR (par,PM2R_SYNC ,0 ); +mb (); +do { +while (pm2_RD (par,PM2R_OUT_FIFO_WORDS ) ==0 ) +udelay (10 ); +rmb (); + }while (pm2_RD (par,PM2R_OUT_FIFO ) !=PM2TAG (PM2R_SYNC )); + +return 0 ; +} +/* * block operation. copy=0: rectangle fill, copy=1: rectangle copy. */ -static void pm2fb_block_op (struct pm2fb_par * par,int copy, +static void pm2fb_block_op (struct fb_info * info,int copy,s32 xsrc,s32 ysrc,s32 x,s32 y,s32 w,s32 h,u32 color) { +struct pm2fb_par *par = info->par;if (!w || !h)return ;
@@ -1076,13 +1082,11 @@ static void pm2fb_block_op(struct pm2fb_ (x<xsrc ?PM2F_INCREASE_X :0 ) | (y<ysrc ?PM2F_INCREASE_Y :0 ) | (copy ? 0 : PM2F_RENDER_FASTFILL)); -wait_pm2 (par); }static void pm2fb_fillrect (struct fb_info *info,const struct fb_fillrect *region) { -struct pm2fb_par *par = info->par;struct fb_fillrect modded;int vxres, vyres; u32 color = (info->fix.visual == FB_VISUAL_TRUECOLOR) ?
@@ -1116,7 +1120,7 @@ static void pm2fb_fillrect (struct fb_in color |= color <<16 ;if (info->var.bits_per_pixel !=24 ) -pm2fb_block_op (par,0 ,0 ,0 , +pm2fb_block_op (info,0 ,0 ,0 , modded.dx, modded.dy, modded.width, modded.height, color);else
@@ -1126,7 +1130,6 @@ static void pm2fb_fillrect (struct fb_instatic void pm2fb_copyarea (struct fb_info *info,const struct fb_copyarea *area) { -struct pm2fb_par *par = info->par;struct fb_copyarea modded;u32 vxres, vyres;
@@ -1156,7 +1159,7 @@ static void pm2fb_copyarea(struct fb_infif (modded.dy + modded.height > vyres) modded.height = vyres - modded.dy; -pm2fb_block_op (par,1 , modded.sx, modded.sy, +pm2fb_block_op (info,1 , modded.sx, modded.sy, modded.dx, modded.dy, modded.width, modded.height,0 ); }
@@ -1177,6 +1180,7 @@ static struct fb_ops pm2fb_ops = { .fb_fillrect = pm2fb_fillrect, .fb_copyarea = pm2fb_copyarea, .fb_imageblit = cfb_imageblit, + .fb_sync = pm2fb_sync, };/*
-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
_______________________________________________
Linux-fbdev-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/linux-fbdev-devel
Quoted 5 lines · Krzysztof Helt
From: Krzysztof Helt <[email protected]>
This patch converts internal
wait_pm2()function to fb APIfb_sync()method.
Quoted 7 lines
Signed-off-by Krzysztof Helt <[email protected]>---
The change of arguments in acceleration function allows use offb_syncby them. Current testing shows thatfb_syncis not required, but I left new arguments in case it may be needed. I am working on speeding scrolling now.
Actually, creating an fb_sync() method would be better in terms of maximizing the thoroughput of the GPU in comparison with indiscriminate calls to sync waits. It would have been better if imageblit is also hardware assisted.
Tony
-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
Dnia 8-05-2007 o godz. 14:32 Antonino A. Daplas napisa³(a):
Quoted 8 lines · Krzysztof Helt
Quoted 3 lines
Current testing shows that
fb_syncis not
requiredActually, creating an
fb_sync()method would be better in terms of maximizing the thoroughput of the GPU in comparison with
indiscriminate
Quoted 1 line
calls to sync waits.
I was not clear in the first email. The pm2fb_sync is required to avoid corruption of display (to define it as fb_sync) during scrolling. It is not required to be called inside the pm2fb_block_op() explicitly.
The change is to remove the sync call from the pm2fb_block_op().
Quoted 3 lines
It would have been better if imageblit is also
hardware assisted.
I know, but I have only as much time as my work and family allow
(there was plenty of it last week = holiday).
I see a major problem with using copyarea acceleration comparing to redraw function. The copyarea always moves the whole framebuffer (milions of pixels) while the redraw works very smart to redraw only things which has to be redrawn. I am working to use something smarter for copyarea. No success yet.
Regards,
Krzysztof
----------------------------------------------------
Zobacz, jak± walkê stoczy superbohater, by ocaliæ siebie i swych bliskich. A najwiêksza bitwa rozegra siê w jego duszy. SPIDER-MAN 3 w kinach od 4 maja.
http://klik.wp.pl/?adr=http%3A%2F%2Fadv.reklama.wp.pl%2Fas%2Fspiderman3.html&sid=1122
-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
Quoted 9 lines · Krzysztof Helt
Dnia 8-05-2007 o godz. 14:32 Antonino A. Daplas napisał(a):
Quoted 1 line · Krzysztof Helt
I see a major problem with using copyarea acceleration comparing to redraw function. The copyarea always moves the whole framebuffer (milions of pixels) while the redraw works very smart to redraw only things which has to be redrawn. I am working to use something smarter for copyarea. No success yet.
Are you using just plain move and redraw? How about trying pan + move, or pan + redraw. If you can set var->yres_virtual to be at least 2x var->yres, it might improve scrolling speed a lot.
Tony
-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
_______________________________________________
Linux-fbdev-devel mailing list [email protected]
https://lists.sourceforge.net/lists/listinfo/linux-fbdev-devel