[igt-dev] [PATCH v2 1/8] tests/panfrost: Make sure we open a DUMB capable node for prime tests
Petri Latvala
petri.latvala at intel.com
Tue Jun 22 09:42:01 UTC 2021
On Tue, Jun 22, 2021 at 11:02:14AM +0200, Boris Brezillon wrote:
> v2:
> * Use __drm_open_driver_another()
>
> Signed-off-by: Boris Brezillon <boris.brezillon at collabora.com>
> ---
> tests/panfrost_prime.c | 25 ++++++++++++++++++++++++-
> 1 file changed, 24 insertions(+), 1 deletion(-)
>
> diff --git a/tests/panfrost_prime.c b/tests/panfrost_prime.c
> index 351d46f2f7e6..dbc741a9eacb 100644
> --- a/tests/panfrost_prime.c
> +++ b/tests/panfrost_prime.c
> @@ -35,13 +35,33 @@
> #include <sys/ioctl.h>
> #include "panfrost_drm.h"
>
> +static bool igt_has_dumb(int fd)
> +{
> + uint64_t value = 0;
> + int ret;
> +
> + ret = drmGetCap(fd, DRM_CAP_DUMB_BUFFER, &value);
> + igt_assert(ret == 0 || errno == EINVAL || errno == EOPNOTSUPP);
> + return value == 1;
> +}
> +
> +static bool igt_has_prime(int fd, uint64_t flags)
> +{
> + uint64_t value = 0;
> + int ret;
> +
> + ret = drmGetCap(fd, DRM_CAP_PRIME, &value);
> + igt_assert(ret == 0 || errno == EINVAL || errno == EOPNOTSUPP);
> + return (value & flags) == flags;
> +}
> +
> igt_main
> {
> int fd, kms_fd;
>
> igt_fixture {
> - kms_fd = drm_open_driver_master(DRIVER_ANY);
> fd = drm_open_driver(DRIVER_PANFROST);
> + kms_fd = __drm_open_driver_another(1, DRIVER_ANY);
> }
>
> igt_subtest("gem-prime-import") {
> @@ -50,6 +70,9 @@ igt_main
> struct drm_panfrost_get_bo_offset get_bo_offset = {0,};
> int dmabuf_fd;
>
> + igt_skip_on(!igt_has_dumb(kms_fd) ||
> + !igt_has_prime(kms_fd, DRM_PRIME_CAP_EXPORT));
For better logs in case any of these trigger, use separate clauses:
igt_require(igt_has_dumb(kms_fd));
igt_require(igt_has_prime(kms_fd, DRM_PRIME_CAP_EXPORT));
Either way, LGTM
Acked-by: Petri Latvala <petri.latvala at intel.com>
> +
> /* Just to be sure that when we import the dumb buffer it has
> * a non-NULL address.
> */
> --
> 2.31.1
>
More information about the igt-dev
mailing list