diff mbox series

[i-g-t,1/1] tests/i915_pxp: Use ioctl_wrapper for DRM_IOCTL_PRIME_HANDLE_TO_FD

Message ID 20211006165151.247868-1-alan.previn.teres.alexis@intel.com (mailing list archive)
State New, archived
Headers show
Series [i-g-t,1/1] tests/i915_pxp: Use ioctl_wrapper for DRM_IOCTL_PRIME_HANDLE_TO_FD | expand

Commit Message

Alan Previn Oct. 6, 2021, 4:51 p.m. UTC
Replace private helper with call to ioctl_wrapper for
DRM_IOCTL_PRIME_HANDLE_TO_FD.

Signed-off-by: Alan Previn <alan.previn.teres.alexis@intel.com>
---
 tests/i915/gem_pxp.c | 20 +-------------------
 1 file changed, 1 insertion(+), 19 deletions(-)

Comments

Michael J. Ruhl Oct. 6, 2021, 5:11 p.m. UTC | #1
>-----Original Message-----
>From: Teres Alexis, Alan Previn <alan.previn.teres.alexis@intel.com>
>Sent: Wednesday, October 6, 2021 12:52 PM
>To: igt-dev@lists.freedesktop.org
>Cc: Teres Alexis, Alan Previn <alan.previn.teres.alexis@intel.com>; dri-
>devel@lists.freedesktop.org; Ruhl; Ruhl, Michael J
><michael.j.ruhl@intel.com>; Vivi, Rodrigo <rodrigo.vivi@intel.com>
>Subject: [PATCH i-g-t 1/1] tests/i915_pxp: Use ioctl_wrapper for
>DRM_IOCTL_PRIME_HANDLE_TO_FD
>
>Replace private helper with call to ioctl_wrapper for
>DRM_IOCTL_PRIME_HANDLE_TO_FD.

Reviewed-by: Michael J. Ruhl <michael.j.ruhl@intel.com>

M

>Signed-off-by: Alan Previn <alan.previn.teres.alexis@intel.com>
>---
> tests/i915/gem_pxp.c | 20 +-------------------
> 1 file changed, 1 insertion(+), 19 deletions(-)
>
>diff --git a/tests/i915/gem_pxp.c b/tests/i915/gem_pxp.c
>index 79040165..0430f4b8 100644
>--- a/tests/i915/gem_pxp.c
>+++ b/tests/i915/gem_pxp.c
>@@ -622,23 +622,6 @@ static void test_render_pxp_protsrc_to_protdest(int
>i915)
> 	buf_ops_destroy(bops);
> }
>
>-static int export_handle(int fd, uint32_t handle, int *outfd)
>-{
>-	struct drm_prime_handle args;
>-	int ret;
>-
>-	args.handle = handle;
>-	args.flags = DRM_CLOEXEC;
>-	args.fd = -1;
>-
>-	ret = drmIoctl(fd, DRM_IOCTL_PRIME_HANDLE_TO_FD, &args);
>-	if (ret)
>-		ret = errno;
>-	*outfd = args.fd;
>-
>-	return ret;
>-}
>-
> static void test_pxp_dmabuffshare_refcnt(void)
> {
> 	uint32_t ctx[2], sbo[2], dbo[2];
>@@ -659,8 +642,7 @@ static void test_pxp_dmabuffshare_refcnt(void)
> 			dbo[0] = alloc_and_fill_dest_buff(fd[0], true,
>TSTSURF_SIZE,
>
>TSTSURF_INITCOLOR1);
> 		} else {
>-			ret = export_handle(fd[0], dbo[0], &dmabuf_fd);
>-			igt_assert(ret == 0);
>+			dmabuf_fd = prime_handle_to_fd(fd[0], dbo[0]);
> 			dbo[1] = prime_fd_to_handle(fd[1], dmabuf_fd);
> 			igt_assert(dbo[1]);
> 		}
>--
>2.25.1
Rodrigo Vivi Oct. 6, 2021, 9:56 p.m. UTC | #2
On Wed, Oct 06, 2021 at 05:11:02PM +0000, Ruhl, Michael J wrote:
> >-----Original Message-----
> >From: Teres Alexis, Alan Previn <alan.previn.teres.alexis@intel.com>
> >Sent: Wednesday, October 6, 2021 12:52 PM
> >To: igt-dev@lists.freedesktop.org
> >Cc: Teres Alexis, Alan Previn <alan.previn.teres.alexis@intel.com>; dri-
> >devel@lists.freedesktop.org; Ruhl; Ruhl, Michael J
> ><michael.j.ruhl@intel.com>; Vivi, Rodrigo <rodrigo.vivi@intel.com>
> >Subject: [PATCH i-g-t 1/1] tests/i915_pxp: Use ioctl_wrapper for
> >DRM_IOCTL_PRIME_HANDLE_TO_FD
> >
> >Replace private helper with call to ioctl_wrapper for
> >DRM_IOCTL_PRIME_HANDLE_TO_FD.
> 
> Reviewed-by: Michael J. Ruhl <michael.j.ruhl@intel.com>

pushed, thanks

> 
> M
> 
> >Signed-off-by: Alan Previn <alan.previn.teres.alexis@intel.com>
> >---
> > tests/i915/gem_pxp.c | 20 +-------------------
> > 1 file changed, 1 insertion(+), 19 deletions(-)
> >
> >diff --git a/tests/i915/gem_pxp.c b/tests/i915/gem_pxp.c
> >index 79040165..0430f4b8 100644
> >--- a/tests/i915/gem_pxp.c
> >+++ b/tests/i915/gem_pxp.c
> >@@ -622,23 +622,6 @@ static void test_render_pxp_protsrc_to_protdest(int
> >i915)
> > 	buf_ops_destroy(bops);
> > }
> >
> >-static int export_handle(int fd, uint32_t handle, int *outfd)
> >-{
> >-	struct drm_prime_handle args;
> >-	int ret;
> >-
> >-	args.handle = handle;
> >-	args.flags = DRM_CLOEXEC;
> >-	args.fd = -1;
> >-
> >-	ret = drmIoctl(fd, DRM_IOCTL_PRIME_HANDLE_TO_FD, &args);
> >-	if (ret)
> >-		ret = errno;
> >-	*outfd = args.fd;
> >-
> >-	return ret;
> >-}
> >-
> > static void test_pxp_dmabuffshare_refcnt(void)
> > {
> > 	uint32_t ctx[2], sbo[2], dbo[2];
> >@@ -659,8 +642,7 @@ static void test_pxp_dmabuffshare_refcnt(void)
> > 			dbo[0] = alloc_and_fill_dest_buff(fd[0], true,
> >TSTSURF_SIZE,
> >
> >TSTSURF_INITCOLOR1);
> > 		} else {
> >-			ret = export_handle(fd[0], dbo[0], &dmabuf_fd);
> >-			igt_assert(ret == 0);
> >+			dmabuf_fd = prime_handle_to_fd(fd[0], dbo[0]);
> > 			dbo[1] = prime_fd_to_handle(fd[1], dmabuf_fd);
> > 			igt_assert(dbo[1]);
> > 		}
> >--
> >2.25.1
>
diff mbox series

Patch

diff --git a/tests/i915/gem_pxp.c b/tests/i915/gem_pxp.c
index 79040165..0430f4b8 100644
--- a/tests/i915/gem_pxp.c
+++ b/tests/i915/gem_pxp.c
@@ -622,23 +622,6 @@  static void test_render_pxp_protsrc_to_protdest(int i915)
 	buf_ops_destroy(bops);
 }
 
-static int export_handle(int fd, uint32_t handle, int *outfd)
-{
-	struct drm_prime_handle args;
-	int ret;
-
-	args.handle = handle;
-	args.flags = DRM_CLOEXEC;
-	args.fd = -1;
-
-	ret = drmIoctl(fd, DRM_IOCTL_PRIME_HANDLE_TO_FD, &args);
-	if (ret)
-		ret = errno;
-	*outfd = args.fd;
-
-	return ret;
-}
-
 static void test_pxp_dmabuffshare_refcnt(void)
 {
 	uint32_t ctx[2], sbo[2], dbo[2];
@@ -659,8 +642,7 @@  static void test_pxp_dmabuffshare_refcnt(void)
 			dbo[0] = alloc_and_fill_dest_buff(fd[0], true, TSTSURF_SIZE,
 							  TSTSURF_INITCOLOR1);
 		} else {
-			ret = export_handle(fd[0], dbo[0], &dmabuf_fd);
-			igt_assert(ret == 0);
+			dmabuf_fd = prime_handle_to_fd(fd[0], dbo[0]);
 			dbo[1] = prime_fd_to_handle(fd[1], dmabuf_fd);
 			igt_assert(dbo[1]);
 		}