From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mgamail.intel.com (mgamail.intel.com [192.55.52.151]) by gabe.freedesktop.org (Postfix) with ESMTPS id 28A0010E751 for ; Fri, 22 Dec 2023 07:05:21 +0000 (UTC) Message-ID: Date: Fri, 22 Dec 2023 12:34:43 +0530 Subject: Re: [PATCH i-g-t] tests/kms_lease: Cache xe_device info for lease fd Content-Language: en-US From: "Nautiyal, Ankit K" To: Mohammed Thasleem , References: <20231212100712.3301571-1-mohammed.thasleem@intel.com> <4dadb6ba-89e5-48bd-9de3-548533864c01@intel.com> In-Reply-To: <4dadb6ba-89e5-48bd-9de3-548533864c01@intel.com> Content-Type: text/plain; charset="UTF-8"; format=flowed Content-Transfer-Encoding: 8bit MIME-Version: 1.0 List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: igt-dev-bounces@lists.freedesktop.org Sender: "igt-dev" List-ID: On 12/13/2023 11:20 AM, Nautiyal, Ankit K wrote: > > 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 >> --- >>   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 >>   #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. Missed to mention, we also need to remove it with xe_device_put, while terminating the lease. Regards, Ankit > > > 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 */ From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Message-ID: Date: Fri, 22 Dec 2023 12:34:43 +0530 Subject: Re: [PATCH i-g-t] tests/kms_lease: Cache xe_device info for lease fd Content-Language: en-US From: "Nautiyal, Ankit K" References: <20231212100712.3301571-1-mohammed.thasleem@intel.com> <4dadb6ba-89e5-48bd-9de3-548533864c01@intel.com> In-Reply-To: <4dadb6ba-89e5-48bd-9de3-548533864c01@intel.com> Content-Type: text/plain; charset="utf-8"; format="flowed" Content-Transfer-Encoding: 8bit MIME-Version: 1.0 List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: igt-dev-bounces@lists.freedesktop.org Sender: "igt-dev" List-ID: To: Mohammed Thasleem , igt-dev@lists.freedesktop.org Message-ID: <20231222070443.0vxPplmNMWQ-JoaQ1WX-9rvjb_KV1GK-iPpRGUDO_do@z> On 12/13/2023 11:20 AM, Nautiyal, Ankit K wrote: > > 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 >> --- >>   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 >>   #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. Missed to mention, we also need to remove it with xe_device_put, while terminating the lease. Regards, Ankit > > > 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 */