Re: MTRR vesafb and wrong X performance

From: Dave Jones
Date: Mon Nov 29 2004 - 11:58:27 EST


(loony with broken SPF mailfilter removed from Cc)

On Mon, Nov 29, 2004 at 05:22:42PM +0100, Gerd Knorr wrote:

> > vesafb is assuming that the memory used in the current screen mode
> > xres*yres*depth rounded up to nearest power of 2, is the amount of
> > ram the card has, which is not just wrong, it's dumb.
>
> It used to do that, but doesn't any more in 2.6.10-rc2. Check the
> current code please.

ah, I was looking at a 2.6.9 tree, my apologies.

but..

if (mtrr) {
int temp_size = size_total;
/* Find the largest power-of-two */
while (temp_size & (temp_size - 1))
temp_size &= (temp_size - 1);

/* Try and find a power of two to add */
while (temp_size && mtrr_add(vesafb_fix.smem_start, temp_size, MTRR_TYPE_WRCOMB, 1)==-EINVAL) {
temp_size >>= 1;
}
}

size_total is calculated thus:

size_total = screen_info.lfb_size * 65536;
if (vram_total)
size_total = vram_total * 1024 * 1024;
if (size_total < size_vmode)
size_total = size_vmode;


where is screen_info.lfb_size set ?

> > If vesafb can't get it right, maybe it shouldn't be
> > attempted to do it in the half-assed way it currently does.
>
> Well, 2.6.10-rc1 + newer should get it right now. We can't do much
> about BIOS bugs through, other than maybe disabling mtrr by default
> if too many machines are affected.

or blacklist if there aren't too many perhaps?

Dave

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/