Skip to contentSkip to conversation

tests/prime_udl: Remove intel-libdrm dependency

PATCH Superseded Zbigniew Kempczyński 2 participants 2 messages Nov 28, 2022

v1 of 5 Superseded Latest is v5 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 tests/prime_udl: Remove intel-libdrm dependency

To remove all intel-libdrm code in intel_batchbuffer we need to rewrite and drop it in all dependent code. Currently CI doesn't exercise this test and I don't have DisplayLink hardware so this is blind rewrite (instead of removing the test). Common xf86drmMode calls are left intact as igt likely won't remove libdrm totally.

---
 tests/prime_udl.c | 61 +++++++++++++++++------------------------------
 1 file changed, 22 insertions(+), 39 deletions(-)
tests/prime_udl.c +22 -39
index 582e31f5df..4898694f5f 100644
@@ -12,6 +12,7 @@
 #include <xf86drmMode.h>
 
 #include "intel_bufmgr.h"
+#include "i915/gem_create.h"
 
 IGT_TEST_DESCRIPTION("Basic set of prime tests between Intel and DisplayLink");
 
@@ -30,6 +31,7 @@ static int find_and_open_devices(void)
 	FILE *fl;
 	char vendor_id[8];
 	int venid;
+
 	for (i = 0; i < 9; i++) {
 		sprintf(path, "/sys/class/drm/card%d/device/vendor", i);
 		if (stat(path, &buf)) {
@@ -78,57 +80,50 @@ static int dumb_bo_destroy(int fd, uint32_t handle)
 /*
  * simple share and import
  */
-static int test1(void)
+static void test1(void)
 {
-	drm_intel_bo *test_intel_bo;
+	uint32_t intel_handle, udl_handle;
 	int prime_fd;
-	int ret;
-	uint32_t udl_handle;
 
-	test_intel_bo = drm_intel_bo_alloc(bufmgr, "test bo", BO_SIZE, 4096);
+	intel_handle = gem_create(intel_fd, BO_SIZE);
 
-	drm_intel_bo_gem_export_to_prime(test_intel_bo, &prime_fd);
+	prime_fd = prime_handle_to_fd(intel_fd, intel_handle);
+	igt_assert(prime_fd >= 0);
 
-	ret = drmPrimeFDToHandle(udl_fd, prime_fd, &udl_handle);
+	udl_handle = prime_fd_to_handle(udl_fd, prime_fd);
+	igt_assert(udl_handle > 0);
 
 	dumb_bo_destroy(udl_fd, udl_handle);
-	drm_intel_bo_unreference(test_intel_bo);
-	return ret;
+	gem_close(intel_fd, intel_handle);
 }
 
-static int test2(void)
+static void test2(void)
 {
-	drm_intel_bo *test_intel_bo;
+	uint32_t intel_handle, udl_handle;
 	uint32_t fb_id;
 	drmModeClip clip;
 	int prime_fd;
-	uint32_t udl_handle;
 	int ret;
 
-	test_intel_bo = drm_intel_bo_alloc(bufmgr, "test bo", BO_SIZE, 4096);
+	intel_handle = gem_create(intel_fd, BO_SIZE);
 
-	drm_intel_bo_gem_export_to_prime(test_intel_bo, &prime_fd);
+	prime_fd = prime_handle_to_fd(intel_fd, intel_handle);
+	igt_assert(prime_fd >= 0);
 
-	ret = drmPrimeFDToHandle(udl_fd, prime_fd, &udl_handle);
-	if (ret)
-		goto out;
+	udl_handle = prime_fd_to_handle(udl_fd, prime_fd);
 
 	ret = drmModeAddFB(udl_fd, 640, 480, 16, 16, 640, udl_handle, &fb_id);
-	if (ret)
-		goto out;
+	igt_assert(ret == 0);
 
 	clip.x1 = 0;
 	clip.y1 = 0;
 	clip.x2 = 10;
 	clip.y2 = 10;
 	ret = drmModeDirtyFB(udl_fd, fb_id, &clip, 1);
-	if (ret) {
-		return ret;
-	}
-out:
+	igt_assert(ret == 0);
+
 	dumb_bo_destroy(udl_fd, udl_handle);
-	drm_intel_bo_unreference(test_intel_bo);
-	return ret;
+	gem_close(intel_fd, intel_handle);
 }
 
 igt_simple_main
@@ -138,22 +133,10 @@ igt_simple_main
 	igt_skip_on(udl_fd == -1);
 	igt_skip_on(intel_fd == -1);
 
-	/* set up intel bufmgr */
-	bufmgr = drm_intel_bufmgr_gem_init(intel_fd, 4096);
-	drm_intel_bufmgr_gem_enable_reuse(bufmgr);
-
-	/* set up an intel batch buffer */
-	devid = intel_get_drm_devid(intel_fd);
-	intel_batch = intel_batchbuffer_alloc(bufmgr, devid);
-
 	/* create an object on the i915 */
-	igt_assert(test1() == 0);
-
-	igt_assert(test2() == 0);
-
-	intel_batchbuffer_free(intel_batch);
+	test1();
 
-	drm_intel_bufmgr_destroy(bufmgr);
+	test2();
 
 	close(intel_fd);
 	close(udl_fd);
Signature · 1 line
2.34.1
#1 lore raw

[igt-dev] ✓ Fi.CI.BAT: success for tests/prime_udl: Remove intel-libdrm dependency

== Series Details ==

== Series Details ==

Series: tests/prime_udl: Remove intel-libdrm dependency
URL : https://patchwork.freedesktop.org/series/111387/
State : success

== Summary ==

CI Bug Log - changes from CI_DRM_12436 -> IGTPW_8158
====================================================

Summary
-------

**SUCCESS**

No regressions found.

External URL: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_8158/index.html

Participating hosts (31 -> 28)
------------------------------

Additional (1): fi-tgl-dsi
Missing (4): fi-hsw-4770 bat-rpls-2 fi-rkl-11600 bat-dg1-6

Known issues
------------

Here are the changes found in IGTPW_8158 that come from known issues:

### IGT changes ###

#### Issues hit ####

* igt@gem_lmem_swapping@basic:
- fi-apl-guc: NOTRUN -> [SKIP][1] ([fdo#109271] / [i915#4613]) +3 similar issues
[1]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_8158/fi-apl-guc/igt@[email protected]

* igt@kms_chamelium@common-hpd-after-suspend:
- fi-apl-guc: NOTRUN -> [SKIP][2] ([fdo#109271] / [fdo#111827])
[2]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_8158/fi-apl-guc/igt@[email protected]

#### Possible fixes ####

* igt@core_hotunplug@unbind-rebind:
- fi-apl-guc: [INCOMPLETE][3] ([i915#7073]) -> [PASS][4]
[3]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_12436/fi-apl-guc/igt@[email protected]
[4]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_8158/fi-apl-guc/igt@[email protected]

* igt@i915_selftest@live@gt_pm:
- {bat-adln-1}: [DMESG-FAIL][5] ([i915#4258]) -> [PASS][6]
[5]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_12436/bat-adln-1/igt@i915_selftest@live@gt_pm.html
[6]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_8158/bat-adln-1/igt@i915_selftest@live@gt_pm.html

* igt@i915_selftest@live@slpc:
- {bat-adln-1}: [DMESG-FAIL][7] ([i915#6997]) -> [PASS][8]
[7]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_12436/bat-adln-1/igt@i915_selftest@[email protected]
[8]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_8158/bat-adln-1/igt@i915_selftest@[email protected]

{name}: This element is suppressed. This means it is ignored when computing
the status of the difference (SUCCESS, WARNING, or FAILURE).

[fdo#109271]: https://bugs.freedesktop.org/show_bug.cgi?id=109271
[fdo#109284]: https://bugs.freedesktop.org/show_bug.cgi?id=109284
[fdo#109285]: https://bugs.freedesktop.org/show_bug.cgi?id=109285
[fdo#109295]: https://bugs.freedesktop.org/show_bug.cgi?id=109295
[fdo#110189]: https://bugs.freedesktop.org/show_bug.cgi?id=110189
[fdo#111827]: https://bugs.freedesktop.org/show_bug.cgi?id=111827
[i915#2190]: https://gitlab.freedesktop.org/drm/intel/issues/2190
[i915#2411]: https://gitlab.freedesktop.org/drm/intel/issues/2411
[i915#3301]: https://gitlab.freedesktop.org/drm/intel/issues/3301
[i915#3555]: https://gitlab.freedesktop.org/drm/intel/issues/3555
[i915#4103]: https://gitlab.freedesktop.org/drm/intel/issues/4103
[i915#4258]: https://gitlab.freedesktop.org/drm/intel/issues/4258
[i915#4312]: https://gitlab.freedesktop.org/drm/intel/issues/4312
[i915#4613]: https://gitlab.freedesktop.org/drm/intel/issues/4613
[i915#4983]: https://gitlab.freedesktop.org/drm/intel/issues/4983
[i915#5354]: https://gitlab.freedesktop.org/drm/intel/issues/5354
[i915#6856]: https://gitlab.freedesktop.org/drm/intel/issues/6856
[i915#6997]: https://gitlab.freedesktop.org/drm/intel/issues/6997
[i915#7073]: https://gitlab.freedesktop.org/drm/intel/issues/7073
[i915#7125]: https://gitlab.freedesktop.org/drm/intel/issues/7125
[i915#7360]: https://gitlab.freedesktop.org/drm/intel/issues/7360
[i915#7456]: https://gitlab.freedesktop.org/drm/intel/issues/7456
[i915#7561]: https://gitlab.freedesktop.org/drm/intel/issues/7561

Build changes
-------------

* CI: CI-20190529 -> None
* IGT: IGT_7072 -> IGTPW_8158

CI-20190529: 20190529
CI_DRM_12436: a1b695b469432195cef49cd7b19e32e6bbacd609 @ git://anongit.freedesktop.org/gfx-ci/linux
IGTPW_8158: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_8158/index.html
IGT_7072: 69ba7163475925cdc69aebbdfa0e87453ae165c7 @ https://gitlab.freedesktop.org/drm/igt-gpu-tools.git

Testlist changes
----------------

-igt@gem_exec_gttfill@multigpu-basic

== Logs ==

For more details see: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_8158/index.html