[PATCH i-g-t] tests/kms_lease: Cache xe_device info for lease fd

Nautiyal, Ankit K ankit.k.nautiyal at intel.com
Wed Dec 13 05:50:40 UTC 2023


On 12/12/2023 3:37 PM, Mohammed Thasleem wrote:
> Cache xe_device struct info for lease fd before perpare crtc
> with lessee's fd.

I think we should add why this is required for this test.


>
> Signed-off-by: Mohammed Thasleem <mohammed.thasleem at intel.com>
> ---
>   tests/kms_lease.c | 10 ++++++++++
>   1 file changed, 10 insertions(+)
>
> diff --git a/tests/kms_lease.c b/tests/kms_lease.c
> index 8ac58af38..e57aea2a2 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
> @@ -305,6 +307,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);


I wonder this will be required for other subtests too.

I think we should call this in make_lease(), after create_lease() is 
successful and we get file descriptor for the lease.


Regards,

Ankit



> +
>   	igt_display_require(&data->lease.display, data->lease.fd);
>   
>   	/* Set a mode on the leased output */
> @@ -772,6 +778,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 */


More information about the igt-dev mailing list