Re: [PATCH 3/3] mach64: optimize wait_for_fifo
From: Bartlomiej Zolnierkiewicz <hidden>
Date: 2018-10-08 10:38:52
Also in:
dri-devel
On 08/27/2018 02:55 PM, Ville Syrj채l채 wrote:
On Sat, Aug 25, 2018 at 03:54:17PM -0400, Mikulas Patocka wrote:quoted
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> --- drivers/video/fbdev/aty/atyfb.h | 12 ++++++++---- drivers/video/fbdev/aty/mach64_accel.c | 4 +++- 2 files changed, 11 insertions(+), 5 deletions(-) Index: linux-stable/drivers/video/fbdev/aty/atyfb.h =================================>> --- linux-stable.orig/drivers/video/fbdev/aty/atyfb.h 2018-08-25 21:49:16.000000000 +0200+++ linux-stable/drivers/video/fbdev/aty/atyfb.h 2018-08-25 21:52:51.000000000 +0200@@ -147,6 +147,7 @@ struct atyfb_par { u16 pci_id; u32 accel_flags; int blitter_may_be_busy; + unsigned fifo_space; int asleep; int lock_blank; unsigned long res_start;@@ -346,10 +347,13 @@ extern int aty_init_cursor(struct fb_inf * Hardware acceleration */ -static inline void wait_for_fifo(u16 entries, const struct atyfb_par *par) +static inline void wait_for_fifo(u16 entries, struct atyfb_par *par) { - while ((aty_ld_le32(FIFO_STAT, par) & 0xffff) > - ((u32) (0x8000 >> entries))); + unsigned fifo_space = par->fifo_space; + while (entries > fifo_space) { + fifo_space = 16 - fls(aty_ld_le32(FIFO_STAT, par) & 0xffff);I don't recall off hand which way this register works, but based on the existing code this looks correct. Reviewed-by: Ville Syrj채l채 <syrjala@sci.fi>
Patch queued for 4.20, thanks. Best regards, -- Bartlomiej Zolnierkiewicz Samsung R&D Institute Poland Samsung Electronics