From: "Maíra Canal" <mcanal@igalia.com>
To: "Melissa Wen" <mwen@igalia.com>,
"André Almeida" <andrealmeid@igalia.com>,
"Petri Latvala" <petri.latvala@intel.com>,
"Kamil Konieczny" <kamil.konieczny@linux.intel.com>,
"Maxime Ripard" <maxime@cerno.tech>
Cc: igt-dev@lists.freedesktop.org
Subject: [igt-dev] [PATCH i-g-t v5 3/4] lib/igt_v3d: Rework igt_v3d_get_param()
Date: Thu, 12 Jan 2023 16:37:41 -0300 [thread overview]
Message-ID: <20230112193741.55630-4-mcanal@igalia.com> (raw)
In-Reply-To: <20230112193741.55630-1-mcanal@igalia.com>
Instead of assuming that igt_v3d_get_param() will succeed, allow the
ioctl to fail and return 0. This way, it will be possible to check if the
kernel has the capabilities needed by the test by checking if the return
of the igt_v3d_get_param() function is different than zero.
Signed-off-by: Maíra Canal <mcanal@igalia.com>
---
lib/igt_v3d.c | 15 ++++++++++++++-
1 file changed, 14 insertions(+), 1 deletion(-)
diff --git a/lib/igt_v3d.c b/lib/igt_v3d.c
index 68d11d7f..5d112416 100644
--- a/lib/igt_v3d.c
+++ b/lib/igt_v3d.c
@@ -86,14 +86,27 @@ igt_v3d_get_bo_offset(int fd, uint32_t handle)
return get.offset;
}
+/**
+ * igt_v3d_get_param:
+ * @fd: device file descriptor
+ * @param: v3d parameter
+ *
+ * This wraps the GET_PARAM ioctl.
+ *
+ * Returns the current value of the parameter. If the parameter is
+ * invalid, returns 0.
+ */
uint32_t
igt_v3d_get_param(int fd, enum drm_v3d_param param)
{
struct drm_v3d_get_param get = {
.param = param,
};
+ int ret;
- do_ioctl(fd, DRM_IOCTL_V3D_GET_PARAM, &get);
+ ret = igt_ioctl(fd, DRM_IOCTL_V3D_GET_PARAM, &get);
+ if (ret)
+ return 0;
return get.value;
}
--
2.39.0
next prev parent reply other threads:[~2023-01-12 19:39 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-01-12 19:37 [igt-dev] [PATCH i-g-t v5 0/4] Make sure v3d/vc4 support performance monitors Maíra Canal
2023-01-12 19:37 ` [igt-dev] [PATCH i-g-t v5 1/4] lib/igt_vc4: Rework igt_vc4_get_param() Maíra Canal
2023-01-26 8:59 ` Kamil Konieczny
2023-01-12 19:37 ` [igt-dev] [PATCH i-g-t v5 2/4] tests/vc4_perfmon: Make sure vc4 supports perfmon Maíra Canal
2023-01-12 19:37 ` Maíra Canal [this message]
2023-01-26 9:00 ` [igt-dev] [PATCH i-g-t v5 3/4] lib/igt_v3d: Rework igt_v3d_get_param() Kamil Konieczny
2023-01-12 19:37 ` [igt-dev] [PATCH i-g-t v5 4/4] tests/v3d_perfmon: Make sure v3d supports perfmon Maíra Canal
2023-01-12 20:39 ` [igt-dev] ✓ Fi.CI.BAT: success for Make sure v3d/vc4 support performance monitors (rev4) Patchwork
2023-01-13 10:18 ` [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=20230112193741.55630-4-mcanal@igalia.com \
--to=mcanal@igalia.com \
--cc=andrealmeid@igalia.com \
--cc=igt-dev@lists.freedesktop.org \
--cc=kamil.konieczny@linux.intel.com \
--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