--- xf86fbman.orig.c 2006-03-06 15:59:44.000000000 +1100 +++ xf86fbman.c 2006-03-06 16:14:21.000000000 +1100 @@ -936,11 +936,17 @@ 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 @@ 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;