Commit 01c40a17 authored by Mikulas Patocka's avatar Mikulas Patocka Committed by Bartlomiej Zolnierkiewicz

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: default avatarMikulas Patocka <mpatocka@redhat.com>
Reviewed-by: default avatarVille Syrjälä <syrjala@sci.fi>
Signed-off-by: default avatarBartlomiej Zolnierkiewicz <b.zolnierkie@samsung.com>
parent c09bcc91
...@@ -147,6 +147,7 @@ struct atyfb_par { ...@@ -147,6 +147,7 @@ struct atyfb_par {
u16 pci_id; u16 pci_id;
u32 accel_flags; u32 accel_flags;
int blitter_may_be_busy; int blitter_may_be_busy;
unsigned fifo_space;
int asleep; int asleep;
int lock_blank; int lock_blank;
unsigned long res_start; unsigned long res_start;
...@@ -346,10 +347,13 @@ extern int aty_init_cursor(struct fb_info *info); ...@@ -346,10 +347,13 @@ extern int aty_init_cursor(struct fb_info *info);
* Hardware acceleration * 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) > unsigned fifo_space = par->fifo_space;
((u32) (0x8000 >> entries))); while (entries > fifo_space) {
fifo_space = 16 - fls(aty_ld_le32(FIFO_STAT, par) & 0xffff);
}
par->fifo_space = fifo_space - entries;
} }
static inline void wait_for_idle(struct atyfb_par *par) static inline void wait_for_idle(struct atyfb_par *par)
...@@ -359,7 +363,7 @@ static inline void wait_for_idle(struct atyfb_par *par) ...@@ -359,7 +363,7 @@ static inline void wait_for_idle(struct atyfb_par *par)
par->blitter_may_be_busy = 0; par->blitter_may_be_busy = 0;
} }
extern void aty_reset_engine(const struct atyfb_par *par); extern void aty_reset_engine(struct atyfb_par *par);
extern void aty_init_engine(struct atyfb_par *par, struct fb_info *info); extern void aty_init_engine(struct atyfb_par *par, struct fb_info *info);
void atyfb_copyarea(struct fb_info *info, const struct fb_copyarea *area); void atyfb_copyarea(struct fb_info *info, const struct fb_copyarea *area);
......
...@@ -37,7 +37,7 @@ static u32 rotation24bpp(u32 dx, u32 direction) ...@@ -37,7 +37,7 @@ static u32 rotation24bpp(u32 dx, u32 direction)
return ((rotation << 8) | DST_24_ROTATION_ENABLE); return ((rotation << 8) | DST_24_ROTATION_ENABLE);
} }
void aty_reset_engine(const struct atyfb_par *par) void aty_reset_engine(struct atyfb_par *par)
{ {
/* reset engine */ /* reset engine */
aty_st_le32(GEN_TEST_CNTL, aty_st_le32(GEN_TEST_CNTL,
...@@ -50,6 +50,8 @@ void aty_reset_engine(const struct atyfb_par *par) ...@@ -50,6 +50,8 @@ void aty_reset_engine(const struct atyfb_par *par)
/* HOST errors */ /* HOST errors */
aty_st_le32(BUS_CNTL, aty_st_le32(BUS_CNTL,
aty_ld_le32(BUS_CNTL, par) | BUS_HOST_ERR_ACK | BUS_FIFO_ERR_ACK, par); aty_ld_le32(BUS_CNTL, par) | BUS_HOST_ERR_ACK | BUS_FIFO_ERR_ACK, par);
par->fifo_space = 0;
} }
static void reset_GTC_3D_engine(const struct atyfb_par *par) static void reset_GTC_3D_engine(const struct atyfb_par *par)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment