From: "Maíra Canal" <mcanal@igalia.com>
To: "Melissa Wen" <mwen@igalia.com>,
"André Almeida" <andrealmeid@igalia.com>,
"Petri Latvala" <petri.latvala@intel.com>,
"Maxime Ripard" <maxime@cerno.tech>
Cc: igt-dev@lists.freedesktop.org
Subject: [igt-dev] [PATCH i-g-t v3 1/3] lib/igt_vc4: Rework igt_vc4_get_param()
Date: Tue, 3 Jan 2023 14:52:43 -0300 [thread overview]
Message-ID: <20230103175244.958771-2-mcanal@igalia.com> (raw)
In-Reply-To: <20230103175244.958771-1-mcanal@igalia.com>
Instead of returning the error code of the DRM_IOCTL_VC4_GET_PARAM ioctl,
make igt_vc4_get_param() return the value of the parameter, considering
that the current return is not being used and the value of the parameter
is being used.
Signed-off-by: Maíra Canal <mcanal@igalia.com>
---
lib/igt_vc4.c | 19 ++++++++++++-------
lib/igt_vc4.h | 2 +-
tests/vc4/vc4_purgeable_bo.c | 5 +----
3 files changed, 14 insertions(+), 12 deletions(-)
diff --git a/lib/igt_vc4.c b/lib/igt_vc4.c
index 6b6ad16c..a9084f01 100644
--- a/lib/igt_vc4.c
+++ b/lib/igt_vc4.c
@@ -168,19 +168,24 @@ uint64_t igt_vc4_get_tiling(int fd, uint32_t handle)
return get.modifier;
}
-int igt_vc4_get_param(int fd, uint32_t param, uint64_t *val)
+/**
+ * igt_vc4_get_param:
+ * @fd: device file descriptor
+ * @param: vc4 parameter
+ *
+ * This wraps the GET_PARAM ioctl.
+ *
+ * Returns the current value of the parameter.
+ */
+uint64_t igt_vc4_get_param(int fd, uint32_t param)
{
struct drm_vc4_get_param arg = {
.param = param,
};
- int ret;
- ret = igt_ioctl(fd, DRM_IOCTL_VC4_GET_PARAM, &arg);
- if (ret)
- return ret;
+ do_ioctl(fd, DRM_IOCTL_VC4_GET_PARAM, &arg);
- *val = arg.value;
- return 0;
+ return arg.value;
}
bool igt_vc4_purgeable_bo(int fd, int handle, bool purgeable)
diff --git a/lib/igt_vc4.h b/lib/igt_vc4.h
index 384d7d6e..4c08f175 100644
--- a/lib/igt_vc4.h
+++ b/lib/igt_vc4.h
@@ -31,7 +31,7 @@
uint32_t igt_vc4_get_cleared_bo(int fd, size_t size, uint32_t clearval);
int igt_vc4_create_bo(int fd, size_t size);
void *igt_vc4_mmap_bo(int fd, uint32_t handle, uint32_t size, unsigned prot);
-int igt_vc4_get_param(int fd, uint32_t param, uint64_t *val);
+uint64_t igt_vc4_get_param(int fd, uint32_t param);
bool igt_vc4_purgeable_bo(int fd, int handle, bool purgeable);
bool igt_vc4_is_tiled(uint64_t modifier);
bool igt_vc4_is_v3d(int fd);
diff --git a/tests/vc4/vc4_purgeable_bo.c b/tests/vc4/vc4_purgeable_bo.c
index 676bc1f3..27771012 100644
--- a/tests/vc4/vc4_purgeable_bo.c
+++ b/tests/vc4/vc4_purgeable_bo.c
@@ -102,11 +102,8 @@ igt_main
int fd, ret;
igt_fixture {
- uint64_t val = 0;
-
fd = drm_open_driver(DRIVER_VC4);
- igt_vc4_get_param(fd, DRM_VC4_PARAM_SUPPORTS_MADVISE, &val);
- igt_require(val);
+ igt_require(igt_vc4_get_param(fd, DRM_VC4_PARAM_SUPPORTS_MADVISE));
IGT_INIT_LIST_HEAD(&list);
}
--
2.38.1
next prev parent reply other threads:[~2023-01-03 17:55 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-01-03 17:52 [igt-dev] [PATCH i-g-t v3 0/3] Make sure v3d/vc4 support performance monitors Maíra Canal
2023-01-03 17:52 ` Maíra Canal [this message]
2023-01-11 18:04 ` [igt-dev] [PATCH i-g-t v3 1/3] lib/igt_vc4: Rework igt_vc4_get_param() Melissa Wen
2023-01-03 17:52 ` [igt-dev] [PATCH i-g-t v3 2/3] tests/vc4_perfmon: Make sure vc4 supports perfmon Maíra Canal
2023-01-03 17:52 ` [igt-dev] [PATCH i-g-t v3 3/3] tests/v3d_perfmon: Make sure v3d " Maíra Canal
2023-01-03 19:19 ` [igt-dev] ✗ Fi.CI.BAT: failure for Make sure v3d/vc4 support performance monitors (rev2) 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=20230103175244.958771-2-mcanal@igalia.com \
--to=mcanal@igalia.com \
--cc=andrealmeid@igalia.com \
--cc=igt-dev@lists.freedesktop.org \
--cc=maxime@cerno.tech \
--cc=mwen@igalia.com \
--cc=petri.latvala@intel.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