All of lore.kernel.org
 help / color / mirror / Atom feed
From: Dominik Grzegorzek <dominik.grzegorzek@intel.com>
To: igt-dev@lists.freedesktop.org
Cc: Chris Wilson <chris@chris-wilson.co.uk>
Subject: [igt-dev] [PATCH i-g-t v4 20/25] tests/prime_udl: Remove libdrm dependency
Date: Tue, 22 Sep 2020 13:52:24 +0200	[thread overview]
Message-ID: <20200922115229.28371-21-dominik.grzegorzek@intel.com> (raw)
In-Reply-To: <20200922115229.28371-1-dominik.grzegorzek@intel.com>

Use intel_bb / intel_buf to remove libdrm dependency.

Signed-off-by: Dominik Grzegorzek <dominik.grzegorzek@intel.com>
Cc: Zbigniew Kempczyński <zbigniew.kempczynski@intel.com>
Cc: Chris Wilson <chris@chris-wilson.co.uk>
---
 tests/prime_udl.c | 44 ++++++++++++++++++++------------------------
 1 file changed, 20 insertions(+), 24 deletions(-)

diff --git a/tests/prime_udl.c b/tests/prime_udl.c
index 9b600659..b2e94160 100644
--- a/tests/prime_udl.c
+++ b/tests/prime_udl.c
@@ -27,14 +27,13 @@
 #include "xf86drm.h"
 #include <xf86drmMode.h>
 
-#include "intel_bufmgr.h"
-
 int intel_fd = -1, udl_fd = -1;
-drm_intel_bufmgr *bufmgr;
-uint32_t devid;
-struct intel_batchbuffer *intel_batch;
+struct buf_ops *bops;
+
+#define WIDTH 640
+#define HEIGHT 480
+#define BO_SIZE (WIDTH*HEIGHT*2)
 
-#define BO_SIZE (640*480*2)
 
 static int find_and_open_devices(void)
 {
@@ -94,34 +93,38 @@ static int dumb_bo_destroy(int fd, uint32_t handle)
  */
 static int test1(void)
 {
-	drm_intel_bo *test_intel_bo;
+	struct intel_buf *test_intel_buf;
 	int prime_fd;
 	int ret;
 	uint32_t udl_handle;
 
-	test_intel_bo = drm_intel_bo_alloc(bufmgr, "test bo", BO_SIZE, 4096);
+	test_intel_buf = intel_buf_create(bops, WIDTH, HEIGHT, 16, 4096,
+					  I915_TILING_NONE,
+					  I915_COMPRESSION_NONE);
 
-	drm_intel_bo_gem_export_to_prime(test_intel_bo, &prime_fd);
+	prime_fd = prime_handle_to_fd(intel_fd, test_intel_buf->handle);
 
 	ret = drmPrimeFDToHandle(udl_fd, prime_fd, &udl_handle);
 
 	dumb_bo_destroy(udl_fd, udl_handle);
-	drm_intel_bo_unreference(test_intel_bo);
+	intel_buf_destroy(test_intel_buf);
 	return ret;
 }
 
 static int test2(void)
 {
-	drm_intel_bo *test_intel_bo;
+	struct intel_buf *test_intel_buf;
 	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);
+	test_intel_buf = intel_buf_create(bops, WIDTH, HEIGHT, 16, 4096,
+					  I915_TILING_NONE,
+					  I915_COMPRESSION_NONE);
 
-	drm_intel_bo_gem_export_to_prime(test_intel_bo, &prime_fd);
+	prime_fd = prime_handle_to_fd(intel_fd, test_intel_buf->handle);
 
 	ret = drmPrimeFDToHandle(udl_fd, prime_fd, &udl_handle);
 	if (ret)
@@ -141,7 +144,7 @@ static int test2(void)
 	}
 out:
 	dumb_bo_destroy(udl_fd, udl_handle);
-	drm_intel_bo_unreference(test_intel_bo);
+	intel_buf_destroy(test_intel_buf);
 	return ret;
 }
 
@@ -152,22 +155,15 @@ 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);
+	/* set up intel buf ops */
+	bops = buf_ops_create(intel_fd);
 
 	/* create an object on the i915 */
 	igt_assert(test1() == 0);
 
 	igt_assert(test2() == 0);
 
-	intel_batchbuffer_free(intel_batch);
-
-	drm_intel_bufmgr_destroy(bufmgr);
+	buf_ops_destroy(bops);
 
 	close(intel_fd);
 	close(udl_fd);
-- 
2.20.1

_______________________________________________
igt-dev mailing list
igt-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/igt-dev

  parent reply	other threads:[~2020-09-22 11:53 UTC|newest]

Thread overview: 44+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-09-22 11:52 [igt-dev] [PATCH i-g-t v4 00/25] tests/benchmarks: Libdrm removal Dominik Grzegorzek
2020-09-22 11:52 ` [igt-dev] [PATCH i-g-t v4 01/25] i915/gem_mmap: Modified offset in subtest "bad-size" Dominik Grzegorzek
2020-09-22 11:56   ` Grzegorzek, Dominik
2020-09-22 11:52 ` [igt-dev] [PATCH i-g-t v4 02/25] lib/intel_batchbuffer: Add control over fencing in intel_bb Dominik Grzegorzek
2020-09-22 11:52 ` [igt-dev] [PATCH i-g-t v4 03/25] lib/intel_batchbuffer: add intel_bb_blit_copy wrapper Dominik Grzegorzek
2020-09-22 13:44   ` Zbigniew Kempczyński
2020-09-22 11:52 ` [igt-dev] [PATCH i-g-t v4 04/25] Remove unused intel_bufmgr.h headers Dominik Grzegorzek
2020-09-22 11:52 ` [igt-dev] [PATCH i-g-t v4 05/25] i915/gem_pwrite_snooped: Remove libdrm dependency Dominik Grzegorzek
2020-09-22 11:52 ` [igt-dev] [PATCH i-g-t v4 06/25] i915/gem_pipe_control_store_loop.c: " Dominik Grzegorzek
2020-09-22 13:51   ` Zbigniew Kempczyński
2020-09-23  7:19     ` Grzegorzek, Dominik
2020-09-23  8:24       ` Zbigniew Kempczyński
2020-09-23 13:09       ` Zbigniew Kempczyński
2020-09-22 11:52 ` [igt-dev] [PATCH i-g-t v4 07/25] i915/gem_pread_after_blit.c: " Dominik Grzegorzek
2020-09-22 14:01   ` Zbigniew Kempczyński
2020-09-22 11:52 ` [igt-dev] [PATCH i-g-t v4 08/25] i915/gem_threaded_access_tiled.c: " Dominik Grzegorzek
2020-09-22 11:52 ` [igt-dev] [PATCH i-g-t v4 09/25] i915/gem_tiled_blits: " Dominik Grzegorzek
2020-09-22 11:52 ` [igt-dev] [PATCH i-g-t v4 10/25] i915/gem_unfence_active_buffers.c: Remove librdm dependency Dominik Grzegorzek
2020-09-23  8:39   ` Zbigniew Kempczyński
2020-09-22 11:52 ` [igt-dev] [PATCH i-g-t v4 11/25] i915/gem_unref_active_buffers.c: Remove libdrm dependency Dominik Grzegorzek
2020-09-23 10:35   ` Zbigniew Kempczyński
2020-09-22 11:52 ` [igt-dev] [PATCH i-g-t v4 12/25] i915/gem_tiled_partial_pwrite_pread: " Dominik Grzegorzek
2020-09-23 11:36   ` Zbigniew Kempczyński
2020-09-22 11:52 ` [igt-dev] [PATCH i-g-t v4 13/25] i915/gem_set_tiling_vs_blit.c: " Dominik Grzegorzek
2020-09-22 11:52 ` [igt-dev] [PATCH i-g-t v4 14/25] tests/kms_fence_pin_leak.c: " Dominik Grzegorzek
2020-09-23 12:59   ` Zbigniew Kempczyński
2020-09-22 11:52 ` [igt-dev] [PATCH i-g-t v4 15/25] tests/kms_flip.c: " Dominik Grzegorzek
2020-09-23 13:07   ` Zbigniew Kempczyński
2020-09-22 11:52 ` [igt-dev] [PATCH i-g-t v4 16/25] tests/kms_psr2_su.c: Get rid of unused bufmgr Dominik Grzegorzek
2020-09-24  5:47   ` Zbigniew Kempczyński
2020-09-22 11:52 ` [igt-dev] [PATCH i-g-t v4 17/25] benchmarks: Remove libdrm dependency Dominik Grzegorzek
2020-09-22 11:52 ` [igt-dev] [PATCH i-g-t v4 18/25] tests/prime_mmap_coherency.c: " Dominik Grzegorzek
2020-09-22 11:52 ` [igt-dev] [PATCH i-g-t v4 19/25] tools/intel_perf_counters: " Dominik Grzegorzek
2020-09-28  8:03   ` Zbigniew Kempczyński
2020-09-22 11:52 ` Dominik Grzegorzek [this message]
2020-09-22 11:52 ` [igt-dev] [PATCH i-g-t v4 21/25] tests/prime_nv_pcopy.c: " Dominik Grzegorzek
2020-09-22 11:52 ` [igt-dev] [PATCH i-g-t v4 22/25] tests/prime_nv_api.c: " Dominik Grzegorzek
2020-09-28  7:40   ` Zbigniew Kempczyński
2020-09-22 11:52 ` [igt-dev] [PATCH i-g-t v4 23/25] tests/prime_nv_test.c: " Dominik Grzegorzek
2020-09-28  7:49   ` Zbigniew Kempczyński
2020-09-22 11:52 ` [igt-dev] [PATCH i-g-t v4 24/25] tests/i915/gem_ppgtt: make copying more readable Dominik Grzegorzek
2020-09-28  7:53   ` Zbigniew Kempczyński
2020-09-22 11:52 ` [igt-dev] [PATCH i-g-t v4 25/25] HAX: run changed tests in BAT only Dominik Grzegorzek
2020-09-22 12:35 ` [igt-dev] ✗ Fi.CI.BAT: failure for tests/benchmarks: Libdrm removal (rev4) Patchwork

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20200922115229.28371-21-dominik.grzegorzek@intel.com \
    --to=dominik.grzegorzek@intel.com \
    --cc=chris@chris-wilson.co.uk \
    --cc=igt-dev@lists.freedesktop.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.