FreeBSD/sys/dev/drm2/radeon/r600.c
/**
 * r600_ioctl_wait_idle - flush host path cache on wait idle ioctl
 * rdev: radeon device structure
 * bo: buffer object struct which userspace is waiting for idle
 *
 * Some R6XX/R7XX doesn't seems to take into account HDP flush performed
 * through ring buffer, this leads to corruption in rendering, see
 * http://bugzilla.kernel.org/show_bug.cgi?id=15186 to avoid this we
 * directly perform HDP flush by writing register through MMIO.
 */
flush host path cache on wait idle ioctl
rdev: radeon device structure
bo: buffer object struct which userspace is waiting for idle


flush host path cache on wait idle ioctl rdev : radeon device structure bo : buffer object struct which userspace is waiting for idle
void r600_ioctl_wait_idle(struct radeon_device *rdev, struct radeon_bo *bo)
{
	if ((rdev->family >= CHIP_RV770) && (rdev->family <= CHIP_RV740) &&
	    rdev->vram_scratch.ptr && !(rdev->flags & RADEON_IS_AGP)) {
		volatile uint32_t *ptr = rdev->vram_scratch.ptr;
		u32 tmp;
		WREG32(HDP_DEBUG1, 0);
		tmp = *ptr;
	} else
		WREG32(R_005480_HDP_MEM_COHERENCY_FLUSH_CNTL, 0x1);
}
void r600_ioctl_wait_idle ( struct radeon_device * rdev , struct radeon_bo * bo ) { if ( ( rdev -> family >= CHIP_RV770 ) && ( rdev -> family <= CHIP_RV740 ) && rdev -> vram_scratch . ptr && ! ( rdev -> flags & RADEON_IS_AGP ) ) { volatile uint32_t * ptr = rdev -> vram_scratch . ptr ; u32 tmp ; WREG32 ( HDP_DEBUG1 , 0 ) ; tmp = * ptr ; } else WREG32 ( R_005480_HDP_MEM_COHERENCY_FLUSH_CNTL , 0x1 ) ; }
r600_ioctl_wait_idle - flush host path cache on wait idle ioctl
 rdev: radeon device structure
 bo: buffer object struct which userspace is waiting for idle
r600_ioctl_wait_idle - flush host path cache on wait idle ioctl rdev : radeon device structure bo : buffer object struct which userspace is waiting for idle
/* r7xx hw bug.  write to HDP_DEBUG1 followed by fb read
	 * rather than write to HDP_REG_COHERENCY_FLUSH_CNTL.
	 * This seems to cause problems on some AGP cards. Just use the old
	 * method for them.
	 */