FreeBSD/sys/dev/drm2/radeon/radeon_device.c
/**
 * radeon_wb_init- Init Writeback driver info and allocate memory
 *
 * @rdev: radeon_device pointer
 *
 * Disables Writeback and frees the Writeback memory (all asics).
 * Used at driver startup.
 * Returns 0 on success or an -error on failure.
 */
radeon_wb_init- Init Writeback driver info and allocate memory
@rdev: radeon_device pointer

Disables Writeback and frees the Writeback memory (all asics).
Used at driver startup.
Returns 0 on success or an -error on failure.
radeon_wb_init - Init Writeback driver info and allocate memory @rdev : radeon_device pointer Disables Writeback and frees the Writeback memory ( all asics ) . Used at driver startup . Returns 0 on success or an - error on failure .
int radeon_wb_init(struct radeon_device *rdev)
{
	int r;
	void *wb_ptr; 
	if (rdev->wb.wb_obj == NULL) {
		r = radeon_bo_create(rdev, RADEON_GPU_PAGE_SIZE, PAGE_SIZE, true,
				     RADEON_GEM_DOMAIN_GTT, NULL, &rdev->wb.wb_obj);
		if (r) {
			dev_warn(rdev->dev, "(%d) create WB bo failed\n", r);
			return r;
		}
	}
	r = radeon_bo_reserve(rdev->wb.wb_obj, false);
	if (unlikely(r != 0)) {
		radeon_wb_fini(rdev);
		return r;
	}
	r = radeon_bo_pin(rdev->wb.wb_obj, RADEON_GEM_DOMAIN_GTT,
			  &rdev->wb.gpu_addr);
	if (r) {
		radeon_bo_unreserve(rdev->wb.wb_obj);
		dev_warn(rdev->dev, "(%d) pin WB bo failed\n", r);
		radeon_wb_fini(rdev);
		return r;
	}
	wb_ptr = &rdev->wb.wb;
	r = radeon_bo_kmap(rdev->wb.wb_obj, wb_ptr);
	radeon_bo_unreserve(rdev->wb.wb_obj);
	if (r) {
		dev_warn(rdev->dev, "(%d) map WB bo failed\n", r);
		radeon_wb_fini(rdev);
		return r;
	}
	memset(*(void **)wb_ptr, 0, RADEON_GPU_PAGE_SIZE);
	rdev->wb.use_event = false;
	if (radeon_no_wb == 1) {
		rdev->wb.enabled = false;
	} else {
		if (rdev->flags & RADEON_IS_AGP) {
			rdev->wb.enabled = false;
		} else if (rdev->family < CHIP_R300) {
			rdev->wb.enabled = false;
		} else {
			rdev->wb.enabled = true;
			if (rdev->family >= CHIP_R600) {
				rdev->wb.use_event = true;
			}
		}
	}
	if (rdev->family >= CHIP_PALM) {
		rdev->wb.enabled = true;
		rdev->wb.use_event = true;
	}
	dev_info(rdev->dev, "WB %sabled\n", rdev->wb.enabled ? "en" : "dis");
	return 0;
}
int radeon_wb_init ( struct radeon_device * rdev ) { int r ; void * wb_ptr ; if ( rdev -> wb . wb_obj == NULL ) { r = radeon_bo_create ( rdev , RADEON_GPU_PAGE_SIZE , PAGE_SIZE , true , RADEON_GEM_DOMAIN_GTT , NULL , & rdev -> wb . wb_obj ) ; if ( r ) { dev_warn ( rdev -> dev , " \n " , r ) ; return r ; } } r = radeon_bo_reserve ( rdev -> wb . wb_obj , false ) ; if ( unlikely ( r != 0 ) ) { radeon_wb_fini ( rdev ) ; return r ; } r = radeon_bo_pin ( rdev -> wb . wb_obj , RADEON_GEM_DOMAIN_GTT , & rdev -> wb . gpu_addr ) ; if ( r ) { radeon_bo_unreserve ( rdev -> wb . wb_obj ) ; dev_warn ( rdev -> dev , " \n " , r ) ; radeon_wb_fini ( rdev ) ; return r ; } wb_ptr = & rdev -> wb . wb ; r = radeon_bo_kmap ( rdev -> wb . wb_obj , wb_ptr ) ; radeon_bo_unreserve ( rdev -> wb . wb_obj ) ; if ( r ) { dev_warn ( rdev -> dev , " \n " , r ) ; radeon_wb_fini ( rdev ) ; return r ; } memset ( * ( void * * ) wb_ptr , 0 , RADEON_GPU_PAGE_SIZE ) ; rdev -> wb . use_event = false ; if ( radeon_no_wb == 1 ) { rdev -> wb . enabled = false ; } else { if ( rdev -> flags & RADEON_IS_AGP ) { rdev -> wb . enabled = false ; } else if ( rdev -> family < CHIP_R300 ) { rdev -> wb . enabled = false ; } else { rdev -> wb . enabled = true ; if ( rdev -> family >= CHIP_R600 ) { rdev -> wb . use_event = true ; } } } if ( rdev -> family >= CHIP_PALM ) { rdev -> wb . enabled = true ; rdev -> wb . use_event = true ; } dev_info ( rdev -> dev , " \n " , rdev -> wb . enabled ? " " : " " ) ; return 0 ; }
radeon_wb_init- Init Writeback driver info and allocate memory
 @rdev: radeon_device pointer
radeon_wb_init - Init Writeback driver info and allocate memory @rdev : radeon_device pointer
/* FreeBSD: to please GCC 4.2. */ /* clear wb memory */ /* disable event_write fences */ /* disabled via module param */ /* often unreliable on AGP */ /* often unreliable on pre-r300 */ /* event_write fences are only available on r600+ */ /* always use writeback/events on NI, APUs */