Commit 85ca528e authored by Chris Wilson's avatar Chris Wilson
Browse files

drm/i915/selftests: Replace mock_file hackery with drm's true fake



As drm now exports a method to create an anonymous struct file around a
drm_device for internal use, make use of it to avoid our horrible hacks.

Danial suggested that the mock_file_put() wrapper was suitable for
drm-core, along with the mock_drm_getfile() [and that the vestigal
mock_drm_file() in this patch should perhaps be the drm interface
itself]. However, the eventual goal is to remove the mock_drm_file() and
use the struct file and fput() directly, in this patch we take a simple
transition in that direction.

Signed-off-by: default avatarChris Wilson <chris@chris-wilson.co.uk>
Reviewed-by: default avatarMatthew Auld <matthew.auld@intel.com>
Reviewed-by: default avatarDaniel Vetter <daniel.vetter@ffwll.ch>
Link: https://patchwork.freedesktop.org/patch/msgid/20191107180601.30815-3-chris@chris-wilson.co.uk
parent 4748aa16
Loading
Loading
Loading
Loading
+2 −0
Original line number Diff line number Diff line
@@ -29,6 +29,7 @@ config DRM_I915_DEBUG
	select X86_MSR # used by igt/pm_rpm
	select DRM_VGEM # used by igt/prime_vgem (dmabuf interop checks)
	select DRM_DEBUG_MM if DRM=y
	select DRM_EXPORT_FOR_TESTS if m
	select DRM_DEBUG_SELFTEST
	select DMABUF_SELFTESTS
	select SW_SYNC # signaling validation framework (igt/syncobj*)
@@ -152,6 +153,7 @@ config DRM_I915_SELFTEST
	bool "Enable selftests upon driver load"
	depends on DRM_I915
	default n
	select DRM_EXPORT_FOR_TESTS if m
	select FAULT_INJECTION
	select PRIME_NUMBERS
	help
+1 −1
Original line number Diff line number Diff line
@@ -1944,6 +1944,6 @@ int i915_gem_huge_page_live_selftests(struct drm_i915_private *i915)
	err = i915_subtests(tests, ctx);

out_file:
	mock_file_free(i915, file);
	mock_file_put(file);
	return err;
}
+6 −6
Original line number Diff line number Diff line
@@ -149,7 +149,7 @@ static int live_nop_switch(void *arg)
	}

out_file:
	mock_file_free(i915, file);
	mock_file_put(file);
	return err;
}

@@ -377,7 +377,7 @@ out:
	}
	kfree(data);
out_file:
	mock_file_free(i915, file);
	mock_file_put(file);
	return err;
}

@@ -716,7 +716,7 @@ out_file:
		if (igt_live_test_end(&t))
			err = -EIO;

		mock_file_free(i915, file);
		mock_file_put(file);
		if (err)
			return err;

@@ -854,7 +854,7 @@ out_test:
	if (igt_live_test_end(&t))
		err = -EIO;
out_file:
	mock_file_free(i915, file);
	mock_file_put(file);
	return err;
}

@@ -1426,7 +1426,7 @@ out_file:
	if (igt_live_test_end(&t))
		err = -EIO;

	mock_file_free(i915, file);
	mock_file_put(file);
	return err;
}

@@ -1750,7 +1750,7 @@ static int igt_vm_isolation(void *arg)
out_file:
	if (igt_live_test_end(&t))
		err = -EIO;
	mock_file_free(i915, file);
	mock_file_put(file);
	return err;
}

+2 −2
Original line number Diff line number Diff line
@@ -301,7 +301,7 @@ err_flush:

	intel_context_put(ce);
out_file:
	mock_file_free(i915, file);
	mock_file_put(file);
	return err;
}

@@ -432,7 +432,7 @@ err_flush:

	intel_context_put(ce);
out_file:
	mock_file_free(i915, file);
	mock_file_put(file);
	return err;
}

+2 −2
Original line number Diff line number Diff line
@@ -313,7 +313,7 @@ static int live_active_context(void *arg)
	}

out_file:
	mock_file_free(gt->i915, file);
	mock_file_put(file);
	return err;
}

@@ -423,7 +423,7 @@ static int live_remote_context(void *arg)
	}

out_file:
	mock_file_free(gt->i915, file);
	mock_file_put(file);
	return err;
}

Loading