Igt-dev Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Mohammed Thasleem <mohammed.thasleem@intel.com>
To: igt-dev@lists.freedesktop.org
Subject: [PATCH v3 2/2] tests/kms_lease: Cache xe_device info for lease fd
Date: Fri, 22 Apr 2022 07:34:58 +0530	[thread overview]
Message-ID: <20220422020458.2877-3-mohammed.thasleem@intel.com> (raw)
In-Reply-To: <20220422020458.2877-1-mohammed.thasleem@intel.com>

In case of xe device for lessor fd, the xe_device struct gets
created and cached during drm_open. But for the lessee fd,
the xe_device info struct is not created and cached.

This causes problem in prepare_crtc() for lessee with xe, which
needs the xe_device info struct. So, create and cache the xe_device
struct info for lease fd, when we make lease and remove it from
cache while terminating the lease.

v2: -Update description and move logic to make_lease call. (Ankit)
    -Add xe_device_put, while terminating the lease. (Ankit)
v3: -Move xe_device check to failed tests.

Signed-off-by: Mohammed Thasleem <mohammed.thasleem@intel.com>
---
 tests/kms_lease.c | 14 ++++++++++++++
 1 file changed, 14 insertions(+)

diff --git a/tests/kms_lease.c b/tests/kms_lease.c
index 8ac58af38..20f28600c 100644
--- a/tests/kms_lease.c
+++ b/tests/kms_lease.c
@@ -48,6 +48,8 @@
 
 #include <drm.h>
 #include "igt_device.h"
+#include "xe_drm.h"
+#include "xe/xe_query.h"
 
 /**
  * SUBTEST: atomic-implicit-crtc
@@ -273,6 +275,10 @@ static int make_lease(data_t *data)
 
 static void terminate_lease(int lease_fd)
 {
+	/* Remove xe_device from cache. */
+	if (is_xe_device(lease_fd))
+		xe_device_put(lease_fd);
+
 	close(lease_fd);
 }
 
@@ -305,6 +311,10 @@ static void simple_lease(data_t *data)
 	/* Create a valid lease */
 	igt_assert_eq(make_lease(data), 0);
 
+	/* Cache xe_device struct */
+	if (is_xe_device(data->lease.fd))
+		xe_device_get(data->lease.fd);
+
 	igt_display_require(&data->lease.display, data->lease.fd);
 
 	/* Set a mode on the leased output */
@@ -772,6 +782,10 @@ static void lease_revoke(data_t *data)
 	/* Create a valid lease */
 	igt_assert_eq(make_lease(data), 0);
 
+	/* Cache xe_device struct */
+	if (is_xe_device(data->lease.fd))
+		xe_device_get(data->lease.fd);
+
 	igt_display_require(&data->lease.display, data->lease.fd);
 
 	/* try to revoke an invalid lease */
-- 
2.25.1

  parent reply	other threads:[~2024-01-03 12:33 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-04-22  2:04 [PATCH v3 0/2] Cache xe_device info for lease fd Mohammed Thasleem
2022-04-22  2:04 ` [PATCH v3 1/2] HAX/DO_NOT_MERGE: Patch adding to test to kms_lease Mohammed Thasleem
2022-04-22  2:04 ` Mohammed Thasleem [this message]
2024-01-03 13:16 ` ✗ Fi.CI.BAT: failure for Cache xe_device info for lease fd (rev3) Patchwork
2024-01-03 13:29 ` ✓ CI.xeBAT: success " Patchwork
2024-01-04  8:17 ` ✗ Fi.CI.BAT: failure " Patchwork
2024-01-04  8:36 ` ✓ Fi.CI.BAT: success " Patchwork
2024-01-04  9:57 ` ✓ Fi.CI.IGT: " Patchwork
  -- strict thread matches above, loose matches on Subject: below --
2024-01-02  8:09 [PATCH v3 0/2] Cache xe_device info for lease fd Mohammed Thasleem
2024-01-02  8:09 ` [PATCH v3 2/2] tests/kms_lease: " Mohammed Thasleem

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=20220422020458.2877-3-mohammed.thasleem@intel.com \
    --to=mohammed.thasleem@intel.com \
    --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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox