diff options
-rw-r--r-- | drivers/video/pm2fb.c | 38 |
1 files changed, 21 insertions, 17 deletions
diff --git a/drivers/video/pm2fb.c b/drivers/video/pm2fb.c index 1ac5264bb2c1..ab5e66890e4e 100644 --- a/drivers/video/pm2fb.c +++ b/drivers/video/pm2fb.c | |||
@@ -204,17 +204,6 @@ static inline void WAIT_FIFO(struct pm2fb_par* p, u32 a) | |||
204 | } | 204 | } |
205 | #endif | 205 | #endif |
206 | 206 | ||
207 | static void wait_pm2(struct pm2fb_par* par) { | ||
208 | |||
209 | WAIT_FIFO(par, 1); | ||
210 | pm2_WR(par, PM2R_SYNC, 0); | ||
211 | mb(); | ||
212 | do { | ||
213 | while (pm2_RD(par, PM2R_OUT_FIFO_WORDS) == 0); | ||
214 | rmb(); | ||
215 | } while (pm2_RD(par, PM2R_OUT_FIFO) != PM2TAG(PM2R_SYNC)); | ||
216 | } | ||
217 | |||
218 | /* | 207 | /* |
219 | * partial products for the supported horizontal resolutions. | 208 | * partial products for the supported horizontal resolutions. |
220 | */ | 209 | */ |
@@ -1050,13 +1039,30 @@ static int pm2fb_blank(int blank_mode, struct fb_info *info) | |||
1050 | return 0; | 1039 | return 0; |
1051 | } | 1040 | } |
1052 | 1041 | ||
1042 | static int pm2fb_sync(struct fb_info *info) | ||
1043 | { | ||
1044 | struct pm2fb_par *par = info->par; | ||
1045 | |||
1046 | WAIT_FIFO(par, 1); | ||
1047 | pm2_WR(par, PM2R_SYNC, 0); | ||
1048 | mb(); | ||
1049 | do { | ||
1050 | while (pm2_RD(par, PM2R_OUT_FIFO_WORDS) == 0) | ||
1051 | udelay(10); | ||
1052 | rmb(); | ||
1053 | } while (pm2_RD(par, PM2R_OUT_FIFO) != PM2TAG(PM2R_SYNC)); | ||
1054 | |||
1055 | return 0; | ||
1056 | } | ||
1057 | |||
1053 | /* | 1058 | /* |
1054 | * block operation. copy=0: rectangle fill, copy=1: rectangle copy. | 1059 | * block operation. copy=0: rectangle fill, copy=1: rectangle copy. |
1055 | */ | 1060 | */ |
1056 | static void pm2fb_block_op(struct pm2fb_par* par, int copy, | 1061 | static void pm2fb_block_op(struct fb_info* info, int copy, |
1057 | s32 xsrc, s32 ysrc, | 1062 | s32 xsrc, s32 ysrc, |
1058 | s32 x, s32 y, s32 w, s32 h, | 1063 | s32 x, s32 y, s32 w, s32 h, |
1059 | u32 color) { | 1064 | u32 color) { |
1065 | struct pm2fb_par *par = info->par; | ||
1060 | 1066 | ||
1061 | if (!w || !h) | 1067 | if (!w || !h) |
1062 | return; | 1068 | return; |
@@ -1076,13 +1082,11 @@ static void pm2fb_block_op(struct pm2fb_par* par, int copy, | |||
1076 | (x<xsrc ? PM2F_INCREASE_X : 0) | | 1082 | (x<xsrc ? PM2F_INCREASE_X : 0) | |
1077 | (y<ysrc ? PM2F_INCREASE_Y : 0) | | 1083 | (y<ysrc ? PM2F_INCREASE_Y : 0) | |
1078 | (copy ? 0 : PM2F_RENDER_FASTFILL)); | 1084 | (copy ? 0 : PM2F_RENDER_FASTFILL)); |
1079 | wait_pm2(par); | ||
1080 | } | 1085 | } |
1081 | 1086 | ||
1082 | static void pm2fb_fillrect (struct fb_info *info, | 1087 | static void pm2fb_fillrect (struct fb_info *info, |
1083 | const struct fb_fillrect *region) | 1088 | const struct fb_fillrect *region) |
1084 | { | 1089 | { |
1085 | struct pm2fb_par *par = info->par; | ||
1086 | struct fb_fillrect modded; | 1090 | struct fb_fillrect modded; |
1087 | int vxres, vyres; | 1091 | int vxres, vyres; |
1088 | u32 color = (info->fix.visual == FB_VISUAL_TRUECOLOR) ? | 1092 | u32 color = (info->fix.visual == FB_VISUAL_TRUECOLOR) ? |
@@ -1116,7 +1120,7 @@ static void pm2fb_fillrect (struct fb_info *info, | |||
1116 | color |= color << 16; | 1120 | color |= color << 16; |
1117 | 1121 | ||
1118 | if(info->var.bits_per_pixel != 24) | 1122 | if(info->var.bits_per_pixel != 24) |
1119 | pm2fb_block_op(par, 0, 0, 0, | 1123 | pm2fb_block_op(info, 0, 0, 0, |
1120 | modded.dx, modded.dy, | 1124 | modded.dx, modded.dy, |
1121 | modded.width, modded.height, color); | 1125 | modded.width, modded.height, color); |
1122 | else | 1126 | else |
@@ -1126,7 +1130,6 @@ static void pm2fb_fillrect (struct fb_info *info, | |||
1126 | static void pm2fb_copyarea(struct fb_info *info, | 1130 | static void pm2fb_copyarea(struct fb_info *info, |
1127 | const struct fb_copyarea *area) | 1131 | const struct fb_copyarea *area) |
1128 | { | 1132 | { |
1129 | struct pm2fb_par *par = info->par; | ||
1130 | struct fb_copyarea modded; | 1133 | struct fb_copyarea modded; |
1131 | u32 vxres, vyres; | 1134 | u32 vxres, vyres; |
1132 | 1135 | ||
@@ -1156,7 +1159,7 @@ static void pm2fb_copyarea(struct fb_info *info, | |||
1156 | if(modded.dy + modded.height > vyres) | 1159 | if(modded.dy + modded.height > vyres) |
1157 | modded.height = vyres - modded.dy; | 1160 | modded.height = vyres - modded.dy; |
1158 | 1161 | ||
1159 | pm2fb_block_op(par, 1, modded.sx, modded.sy, | 1162 | pm2fb_block_op(info, 1, modded.sx, modded.sy, |
1160 | modded.dx, modded.dy, | 1163 | modded.dx, modded.dy, |
1161 | modded.width, modded.height, 0); | 1164 | modded.width, modded.height, 0); |
1162 | } | 1165 | } |
@@ -1177,6 +1180,7 @@ static struct fb_ops pm2fb_ops = { | |||
1177 | .fb_fillrect = pm2fb_fillrect, | 1180 | .fb_fillrect = pm2fb_fillrect, |
1178 | .fb_copyarea = pm2fb_copyarea, | 1181 | .fb_copyarea = pm2fb_copyarea, |
1179 | .fb_imageblit = cfb_imageblit, | 1182 | .fb_imageblit = cfb_imageblit, |
1183 | .fb_sync = pm2fb_sync, | ||
1180 | }; | 1184 | }; |
1181 | 1185 | ||
1182 | /* | 1186 | /* |