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.
			
			
This commit is contained in:
		
							parent
							
								
									c1601717d5
								
							
						
					
					
						commit
						02d80a0de9
					
				|  | @ -1,3 +1,10 @@ | |||
| 2006-03-15  Benjamin Herrenschmidt  <benh@kernel.crashing.org> | ||||
| 
 | ||||
| 	* 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  <anholt@FreeBSD.org> | ||||
| 
 | ||||
| 	* exa/exa.c: (exaDriverInit): | ||||
|  |  | |||
|  | @ -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; | ||||
|  |  | |||
		Loading…
	
		Reference in New Issue