From: "Maíra Canal" <mcanal@igalia.com>
To: Melissa Wen <mwen@igalia.com>, Daniel Vetter <daniel@ffwll.ch>,
Petri Latvala <adrinael@adrinael.net>,
Kamil Konieczny <kamil.konieczny@linux.intel.com>
Cc: igt-dev@lists.freedesktop.org
Subject: [igt-dev] [PATCH i-g-t v2 1/2] lib/igt_vgem: Use UAPI header
Date: Thu, 9 Mar 2023 10:51:15 -0300 [thread overview]
Message-ID: <20230309135116.128602-2-mcanal@igalia.com> (raw)
In-Reply-To: <20230309135116.128602-1-mcanal@igalia.com>
Currently, VGEM copies the UAPI header contents to source file. So,
delete the copy from the source file and use the UAPI header directly.
Signed-off-by: Maíra Canal <mcanal@igalia.com>
---
lib/igt_vgem.c | 36 +++++++++---------------------------
lib/igt_vgem.h | 2 +-
2 files changed, 10 insertions(+), 28 deletions(-)
diff --git a/lib/igt_vgem.c b/lib/igt_vgem.c
index 468383c7..93c8398e 100644
--- a/lib/igt_vgem.c
+++ b/lib/igt_vgem.c
@@ -94,41 +94,23 @@ void *vgem_mmap(int fd, struct vgem_bo *bo, unsigned prot)
return ptr;
}
-#define LOCAL_VGEM_FENCE_ATTACH 0x1
-#define LOCAL_VGEM_FENCE_SIGNAL 0x2
-
-#define LOCAL_IOCTL_VGEM_FENCE_ATTACH DRM_IOWR( DRM_COMMAND_BASE + LOCAL_VGEM_FENCE_ATTACH, struct local_vgem_fence_attach)
-#define LOCAL_IOCTL_VGEM_FENCE_SIGNAL DRM_IOW( DRM_COMMAND_BASE + LOCAL_VGEM_FENCE_SIGNAL, struct local_vgem_fence_signal)
-
-struct local_vgem_fence_attach {
- uint32_t handle;
- uint32_t flags;
- uint32_t out_fence;
- uint32_t pad;
-};
-
-struct local_vgem_fence_signal {
- uint32_t fence;
- uint32_t flags;
-};
-
bool vgem_has_fences(int fd)
{
- struct local_vgem_fence_signal arg;
+ struct drm_vgem_fence_signal arg;
int err;
err = 0;
memset(&arg, 0, sizeof(arg));
- if (drmIoctl(fd, LOCAL_IOCTL_VGEM_FENCE_SIGNAL, &arg))
+ if (drmIoctl(fd, DRM_IOCTL_VGEM_FENCE_SIGNAL, &arg))
err = -errno;
errno = 0;
return err == -ENOENT;
}
-static int __vgem_fence_attach(int fd, struct local_vgem_fence_attach *arg)
+static int __vgem_fence_attach(int fd, struct drm_vgem_fence_attach *arg)
{
int err = 0;
- if (igt_ioctl(fd, LOCAL_IOCTL_VGEM_FENCE_ATTACH, arg))
+ if (igt_ioctl(fd, DRM_IOCTL_VGEM_FENCE_ATTACH, arg))
err = -errno;
errno = 0;
return err;
@@ -136,7 +118,7 @@ static int __vgem_fence_attach(int fd, struct local_vgem_fence_attach *arg)
bool vgem_fence_has_flag(int fd, unsigned flags)
{
- struct local_vgem_fence_attach arg;
+ struct drm_vgem_fence_attach arg;
struct vgem_bo bo;
bool ret = false;
@@ -160,7 +142,7 @@ bool vgem_fence_has_flag(int fd, unsigned flags)
uint32_t vgem_fence_attach(int fd, struct vgem_bo *bo, unsigned flags)
{
- struct local_vgem_fence_attach arg;
+ struct drm_vgem_fence_attach arg;
memset(&arg, 0, sizeof(arg));
arg.handle = bo->handle;
@@ -169,10 +151,10 @@ uint32_t vgem_fence_attach(int fd, struct vgem_bo *bo, unsigned flags)
return arg.out_fence;
}
-static int ioctl_vgem_fence_signal(int fd, struct local_vgem_fence_signal *arg)
+static int ioctl_vgem_fence_signal(int fd, struct drm_vgem_fence_signal *arg)
{
int err = 0;
- if (igt_ioctl(fd, LOCAL_IOCTL_VGEM_FENCE_SIGNAL, arg))
+ if (igt_ioctl(fd, DRM_IOCTL_VGEM_FENCE_SIGNAL, arg))
err = -errno;
errno = 0;
return err;
@@ -180,7 +162,7 @@ static int ioctl_vgem_fence_signal(int fd, struct local_vgem_fence_signal *arg)
int __vgem_fence_signal(int fd, uint32_t fence)
{
- struct local_vgem_fence_signal arg;
+ struct drm_vgem_fence_signal arg;
memset(&arg, 0, sizeof(arg));
arg.fence = fence;
diff --git a/lib/igt_vgem.h b/lib/igt_vgem.h
index 92045f0e..9fd5e53b 100644
--- a/lib/igt_vgem.h
+++ b/lib/igt_vgem.h
@@ -26,6 +26,7 @@
#include <stdint.h>
#include <stdbool.h>
+#include "vgem_drm.h"
struct vgem_bo {
uint32_t handle;
@@ -43,7 +44,6 @@ void *vgem_mmap(int fd, struct vgem_bo *bo, unsigned prot);
bool vgem_has_fences(int fd);
bool vgem_fence_has_flag(int fd, unsigned flags);
uint32_t vgem_fence_attach(int fd, struct vgem_bo *bo, unsigned flags);
-#define VGEM_FENCE_WRITE 0x1
#define WIP_VGEM_FENCE_NOTIMEOUT 0x2
int __vgem_fence_signal(int fd, uint32_t fence);
void vgem_fence_signal(int fd, uint32_t fence);
--
2.39.2
next prev parent reply other threads:[~2023-03-09 13:51 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-03-09 13:51 [igt-dev] [PATCH i-g-t v2 0/2] Add negative tests to VGEM Maíra Canal
2023-03-09 13:51 ` Maíra Canal [this message]
2023-03-16 18:12 ` [igt-dev] [PATCH i-g-t v2 1/2] lib/igt_vgem: Use UAPI header Kamil Konieczny
2023-03-09 13:51 ` [igt-dev] [PATCH i-g-t v2 2/2] tests/vgem_basic: Add negative tests Maíra Canal
2023-03-16 18:19 ` Kamil Konieczny
2023-03-09 14:26 ` [igt-dev] ✓ Fi.CI.BAT: success for Add negative tests to VGEM (rev2) Patchwork
2023-03-11 3:56 ` [igt-dev] ✓ Fi.CI.IGT: " 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=20230309135116.128602-2-mcanal@igalia.com \
--to=mcanal@igalia.com \
--cc=adrinael@adrinael.net \
--cc=daniel@ffwll.ch \
--cc=igt-dev@lists.freedesktop.org \
--cc=kamil.konieczny@linux.intel.com \
--cc=mwen@igalia.com \
/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