EXA: Don't defragment offscreen memory at allocation time.
Fixes http://bugs.freedesktop.org/show_bug.cgi?id=24300 . Offscreen memory allocation can occur from various places, and apparently doing defragmentation from at least some of them can confuse some driver acceleration code. There's still the regular background defragmentation in the WakeupHandler, which should manage to keep fragmentation at a reasonable level. Signed-off-by: Michel Dänzer <daenzer@vmware.com> Signed-off-by: Keith Packard <keithp@keithp.com>
This commit is contained in:
parent
0e555a1033
commit
8754db77d8
|
@ -169,7 +169,7 @@ exaOffscreenAlloc (ScreenPtr pScreen, int size, int align,
|
|||
{
|
||||
ExaOffscreenArea *area;
|
||||
ExaScreenPriv (pScreen);
|
||||
int real_size = 0, free_total = 0, largest_avail = 0;
|
||||
int real_size = 0, largest_avail = 0;
|
||||
#if DEBUG_OFFSCREEN
|
||||
static int number = 0;
|
||||
ErrorF("================= ============ allocating a new pixmap %d\n", ++number);
|
||||
|
@ -208,33 +208,10 @@ exaOffscreenAlloc (ScreenPtr pScreen, int size, int align,
|
|||
if (real_size <= area->size)
|
||||
break;
|
||||
|
||||
free_total += area->size;
|
||||
|
||||
if (area->size > largest_avail)
|
||||
largest_avail = area->size;
|
||||
}
|
||||
|
||||
if (!area && free_total >= size) {
|
||||
CARD32 now = GetTimeInMillis();
|
||||
|
||||
/* Don't defragment more than once per second, to avoid adding more
|
||||
* overhead than we're trying to prevent
|
||||
*/
|
||||
if (abs((INT32) (now - pExaScr->lastDefragment)) > 1000) {
|
||||
area = ExaOffscreenDefragment(pScreen);
|
||||
pExaScr->lastDefragment = now;
|
||||
|
||||
if (area) {
|
||||
/* adjust size to match alignment requirement */
|
||||
real_size = size + (area->base_offset + area->size - size) % align;
|
||||
|
||||
/* does it fit? */
|
||||
if (real_size > area->size)
|
||||
area = NULL;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (!area)
|
||||
{
|
||||
area = exaFindAreaToEvict(pExaScr, size, align);
|
||||
|
|
Loading…
Reference in New Issue
Block a user