Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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>

authored by

Mikulas Patocka and committed by
Bartlomiej Zolnierkiewicz
01c40a17 c09bcc91

+11 -5
+8 -4
drivers/video/fbdev/aty/atyfb.h
··· 147 147 u16 pci_id; 148 148 u32 accel_flags; 149 149 int blitter_may_be_busy; 150 + unsigned fifo_space; 150 151 int asleep; 151 152 int lock_blank; 152 153 unsigned long res_start; ··· 347 346 * Hardware acceleration 348 347 */ 349 348 350 - static inline void wait_for_fifo(u16 entries, const struct atyfb_par *par) 349 + static inline void wait_for_fifo(u16 entries, struct atyfb_par *par) 351 350 { 352 - while ((aty_ld_le32(FIFO_STAT, par) & 0xffff) > 353 - ((u32) (0x8000 >> entries))); 351 + unsigned fifo_space = par->fifo_space; 352 + while (entries > fifo_space) { 353 + fifo_space = 16 - fls(aty_ld_le32(FIFO_STAT, par) & 0xffff); 354 + } 355 + par->fifo_space = fifo_space - entries; 354 356 } 355 357 356 358 static inline void wait_for_idle(struct atyfb_par *par) ··· 363 359 par->blitter_may_be_busy = 0; 364 360 } 365 361 366 - extern void aty_reset_engine(const struct atyfb_par *par); 362 + extern void aty_reset_engine(struct atyfb_par *par); 367 363 extern void aty_init_engine(struct atyfb_par *par, struct fb_info *info); 368 364 369 365 void atyfb_copyarea(struct fb_info *info, const struct fb_copyarea *area);
+3 -1
drivers/video/fbdev/aty/mach64_accel.c
··· 37 37 return ((rotation << 8) | DST_24_ROTATION_ENABLE); 38 38 } 39 39 40 - void aty_reset_engine(const struct atyfb_par *par) 40 + void aty_reset_engine(struct atyfb_par *par) 41 41 { 42 42 /* reset engine */ 43 43 aty_st_le32(GEN_TEST_CNTL, ··· 50 50 /* HOST errors */ 51 51 aty_st_le32(BUS_CNTL, 52 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 55 57 static void reset_GTC_3D_engine(const struct atyfb_par *par)