aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMikulas Patocka <mpatocka@redhat.com>2018-10-08 06:57:35 -0400
committerBartlomiej Zolnierkiewicz <b.zolnierkie@samsung.com>2018-10-08 06:57:35 -0400
commit01c40a17249727472da3f52e2f344cc2cc4138c4 (patch)
tree8ec4aa2139d8f3a2bda32432481f8fef0388da83
parentc09bcc91bb94ed91f1391bffcbe294963d605732 (diff)
mach64: optimize wait_for_fifo
This is a simple optimization for fifo waiting that improves scrolling performance by 5%. If the queue has more free entries that what we consume, we can skip the costly register read next time. Signed-off-by: Mikulas Patocka <mpatocka@redhat.com> Reviewed-by: Ville Syrjälä <syrjala@sci.fi> Signed-off-by: Bartlomiej Zolnierkiewicz <b.zolnierkie@samsung.com>
-rw-r--r--drivers/video/fbdev/aty/atyfb.h12
-rw-r--r--drivers/video/fbdev/aty/mach64_accel.c4
2 files changed, 11 insertions, 5 deletions
diff --git a/drivers/video/fbdev/aty/atyfb.h b/drivers/video/fbdev/aty/atyfb.h
index d09bab3bf224..e5a347c58180 100644
--- a/drivers/video/fbdev/aty/atyfb.h
+++ b/drivers/video/fbdev/aty/atyfb.h
@@ -147,6 +147,7 @@ struct atyfb_par {
147 u16 pci_id; 147 u16 pci_id;
148 u32 accel_flags; 148 u32 accel_flags;
149 int blitter_may_be_busy; 149 int blitter_may_be_busy;
150 unsigned fifo_space;
150 int asleep; 151 int asleep;
151 int lock_blank; 152 int lock_blank;
152 unsigned long res_start; 153 unsigned long res_start;
@@ -346,10 +347,13 @@ extern int aty_init_cursor(struct fb_info *info);
346 * Hardware acceleration 347 * Hardware acceleration
347 */ 348 */
348 349
349static inline void wait_for_fifo(u16 entries, const struct atyfb_par *par) 350static inline void wait_for_fifo(u16 entries, struct atyfb_par *par)
350{ 351{
351 while ((aty_ld_le32(FIFO_STAT, par) & 0xffff) > 352 unsigned fifo_space = par->fifo_space;
352 ((u32) (0x8000 >> entries))); 353 while (entries > fifo_space) {
354 fifo_space = 16 - fls(aty_ld_le32(FIFO_STAT, par) & 0xffff);
355 }
356 par->fifo_space = fifo_space - entries;
353} 357}
354 358
355static inline void wait_for_idle(struct atyfb_par *par) 359static inline void wait_for_idle(struct atyfb_par *par)
@@ -359,7 +363,7 @@ static inline void wait_for_idle(struct atyfb_par *par)
359 par->blitter_may_be_busy = 0; 363 par->blitter_may_be_busy = 0;
360} 364}
361 365
362extern void aty_reset_engine(const struct atyfb_par *par); 366extern void aty_reset_engine(struct atyfb_par *par);
363extern void aty_init_engine(struct atyfb_par *par, struct fb_info *info); 367extern void aty_init_engine(struct atyfb_par *par, struct fb_info *info);
364 368
365void atyfb_copyarea(struct fb_info *info, const struct fb_copyarea *area); 369void atyfb_copyarea(struct fb_info *info, const struct fb_copyarea *area);
diff --git a/drivers/video/fbdev/aty/mach64_accel.c b/drivers/video/fbdev/aty/mach64_accel.c
index 3ad46255f990..e4b2c89baee2 100644
--- a/drivers/video/fbdev/aty/mach64_accel.c
+++ b/drivers/video/fbdev/aty/mach64_accel.c
@@ -37,7 +37,7 @@ static u32 rotation24bpp(u32 dx, u32 direction)
37 return ((rotation << 8) | DST_24_ROTATION_ENABLE); 37 return ((rotation << 8) | DST_24_ROTATION_ENABLE);
38} 38}
39 39
40void aty_reset_engine(const struct atyfb_par *par) 40void aty_reset_engine(struct atyfb_par *par)
41{ 41{
42 /* reset engine */ 42 /* reset engine */
43 aty_st_le32(GEN_TEST_CNTL, 43 aty_st_le32(GEN_TEST_CNTL,
@@ -50,6 +50,8 @@ void aty_reset_engine(const struct atyfb_par *par)
50 /* HOST errors */ 50 /* HOST errors */
51 aty_st_le32(BUS_CNTL, 51 aty_st_le32(BUS_CNTL,
52 aty_ld_le32(BUS_CNTL, par) | BUS_HOST_ERR_ACK | BUS_FIFO_ERR_ACK, par); 52 aty_ld_le32(BUS_CNTL, par) | BUS_HOST_ERR_ACK | BUS_FIFO_ERR_ACK, par);
53
54 par->fifo_space = 0;
53} 55}
54 56
55static void reset_GTC_3D_engine(const struct atyfb_par *par) 57static void reset_GTC_3D_engine(const struct atyfb_par *par)