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> | 2006-03-14  Eric Anholt  <anholt@FreeBSD.org> | ||||||
| 
 | 
 | ||||||
| 	* exa/exa.c: (exaDriverInit): | 	* exa/exa.c: (exaDriverInit): | ||||||
|  |  | ||||||
|  | @ -923,7 +923,7 @@ localAllocateOffscreenLinear( | ||||||
|    ErrorF("ALLOCATING LINEAR\n"); |    ErrorF("ALLOCATING LINEAR\n"); | ||||||
| #endif | #endif | ||||||
|    if ((linear = AllocateLinear(offman, length, gran, privData))) |    if ((linear = AllocateLinear(offman, length, gran, privData))) | ||||||
|    	return linear; |   	return linear; | ||||||
| 
 | 
 | ||||||
| #ifdef DEBUG | #ifdef DEBUG | ||||||
|    ErrorF("NOPE, ALLOCATING AREA\n"); |    ErrorF("NOPE, ALLOCATING AREA\n"); | ||||||
|  | @ -936,11 +936,17 @@ localAllocateOffscreenLinear( | ||||||
|    extents = REGION_EXTENTS(pScreen, offman->InitialBoxes); |    extents = REGION_EXTENTS(pScreen, offman->InitialBoxes); | ||||||
|    pitch = extents->x2 - extents->x1; |    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 */ | 	/* we can't match the specified alignment with XY allocations */ | ||||||
| 	xfree(link); | 	xfree(link); | ||||||
| 	return NULL; | 	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 */ |    if(length < pitch) { /* special case */ | ||||||
| 	w = length; | 	w = length; | ||||||
|  | @ -963,6 +969,8 @@ localAllocateOffscreenLinear( | ||||||
| 	linear->pScreen = pScreen; | 	linear->pScreen = pScreen; | ||||||
| 	linear->size = h * w; | 	linear->size = h * w; | ||||||
| 	linear->offset = (pitch * area->box.y1) + area->box.x1; | 	linear->offset = (pitch * area->box.y1) + area->box.x1; | ||||||
|  | 	if (gran && linear->offset % gran) | ||||||
|  | 		linear->offset += gran - (linear->offset % gran); | ||||||
| 	linear->granularity = gran; | 	linear->granularity = gran; | ||||||
| 	linear->MoveLinearCallback = moveCB; | 	linear->MoveLinearCallback = moveCB; | ||||||
| 	linear->RemoveLinearCallback = removeCB; | 	linear->RemoveLinearCallback = removeCB; | ||||||
|  |  | ||||||
		Loading…
	
		Reference in New Issue