diff --git a/ChangeLog b/ChangeLog index 5a54f678f..d462edabb 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,10 @@ +2006-03-15 Benjamin Herrenschmidt + + * hw/xfree86/common/xf86fbman.c: (localAllocateOffscreenLinear): + Make xf86 linear allocator smarter when dealing with alignment + constraints when falling back to X/Y allocations. Fixes various + problems of Xv allocation failures, notably with "nv" driver. + 2006-03-14 Eric Anholt * exa/exa.c: (exaDriverInit): diff --git a/hw/xfree86/common/xf86fbman.c b/hw/xfree86/common/xf86fbman.c index debd828bc..a65b00bc2 100644 --- a/hw/xfree86/common/xf86fbman.c +++ b/hw/xfree86/common/xf86fbman.c @@ -923,7 +923,7 @@ localAllocateOffscreenLinear( ErrorF("ALLOCATING LINEAR\n"); #endif if ((linear = AllocateLinear(offman, length, gran, privData))) - return linear; + return linear; #ifdef DEBUG ErrorF("NOPE, ALLOCATING AREA\n"); @@ -936,11 +936,17 @@ localAllocateOffscreenLinear( extents = REGION_EXTENTS(pScreen, offman->InitialBoxes); pitch = extents->x2 - extents->x1; - if(gran && ((gran > pitch) || (pitch % gran))) { + if (gran && gran > pitch) { /* we can't match the specified alignment with XY allocations */ xfree(link); return NULL; } + if (gran && (pitch % gran)) { + /* pitch and granularity aren't a perfect match, let's allocate + * a bit more so we can align later on + */ + length += gran - 1; + } if(length < pitch) { /* special case */ w = length; @@ -963,6 +969,8 @@ localAllocateOffscreenLinear( linear->pScreen = pScreen; linear->size = h * w; linear->offset = (pitch * area->box.y1) + area->box.x1; + if (gran && linear->offset % gran) + linear->offset += gran - (linear->offset % gran); linear->granularity = gran; linear->MoveLinearCallback = moveCB; linear->RemoveLinearCallback = removeCB;