Commit c60a284c authored by Pauli Nieminen's avatar Pauli Nieminen Committed by Dave Airlie
Browse files

drm/radeon: Skip dma copy test in benchmark if card doesn't have dma engine.



radeon_copy_dma is only available for r200 or newer cards.
Call to radeon_copy_dma would result to NULL pointer
dereference if benchmarking asic without dma engine.

Signed-off-by: default avatarPauli Nieminen <suokkos@gmail.com>
Signed-off-by: default avatarDave Airlie <airlied@redhat.com>
parent 6719fc66
Loading
Loading
Loading
Loading
+33 −22
Original line number Original line Diff line number Diff line
@@ -65,13 +65,20 @@ void radeon_benchmark_move(struct radeon_device *rdev, unsigned bsize,
	if (r) {
	if (r) {
		goto out_cleanup;
		goto out_cleanup;
	}
	}

	/* r100 doesn't have dma engine so skip the test */
	if (rdev->asic->copy_dma) {

		start_jiffies = jiffies;
		start_jiffies = jiffies;
		for (i = 0; i < n; i++) {
		for (i = 0; i < n; i++) {
			r = radeon_fence_create(rdev, &fence);
			r = radeon_fence_create(rdev, &fence);
			if (r) {
			if (r) {
				goto out_cleanup;
				goto out_cleanup;
			}
			}
		r = radeon_copy_dma(rdev, saddr, daddr, size / RADEON_GPU_PAGE_SIZE, fence);

			r = radeon_copy_dma(rdev, saddr, daddr,
					size / RADEON_GPU_PAGE_SIZE, fence);

			if (r) {
			if (r) {
				goto out_cleanup;
				goto out_cleanup;
			}
			}
@@ -86,10 +93,14 @@ void radeon_benchmark_move(struct radeon_device *rdev, unsigned bsize,
		time = jiffies_to_msecs(time);
		time = jiffies_to_msecs(time);
		if (time > 0) {
		if (time > 0) {
			i = ((n * size) >> 10) / time;
			i = ((n * size) >> 10) / time;
		printk(KERN_INFO "radeon: dma %u bo moves of %ukb from %d to %d"
			printk(KERN_INFO "radeon: dma %u bo moves of %ukb from"
		       " in %lums (%ukb/ms %ukb/s %uM/s)\n", n, size >> 10,
					" %d to %d in %lums (%ukb/ms %ukb/s %uM/s)\n",
		       sdomain, ddomain, time, i, i * 1000, (i * 1000) / 1024);
					n, size >> 10,
					sdomain, ddomain, time,
					i, i * 1000, (i * 1000) / 1024);
		}
		}
	}

	start_jiffies = jiffies;
	start_jiffies = jiffies;
	for (i = 0; i < n; i++) {
	for (i = 0; i < n; i++) {
		r = radeon_fence_create(rdev, &fence);
		r = radeon_fence_create(rdev, &fence);