* [PATCH i-g-t v2] tests: add device information tests
@ 2017-11-02 16:30 Lionel Landwerlin
2017-11-02 17:23 ` ✓ Fi.CI.BAT: success for tests: add device information tests (rev2) Patchwork
2017-11-02 18:41 ` ✗ Fi.CI.IGT: warning " Patchwork
0 siblings, 2 replies; 3+ messages in thread
From: Lionel Landwerlin @ 2017-11-02 16:30 UTC (permalink / raw)
To: intel-gfx
We can verify that topology is consistent with previous getparam like
EU_TOTAL.
We also verify that CS timestamp frequency is always filled.
v2: Use v2 of kernel uapi (Lionel)
Fix Gen < 8 issue
Signed-off-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
---
tests/Makefile.sources | 1 +
tests/intel_device_info.c | 353 ++++++++++++++++++++++++++++++++++++++++++++++
tests/meson.build | 1 +
3 files changed, 355 insertions(+)
create mode 100644 tests/intel_device_info.c
diff --git a/tests/Makefile.sources b/tests/Makefile.sources
index 2313c12b..c7538cb6 100644
--- a/tests/Makefile.sources
+++ b/tests/Makefile.sources
@@ -168,6 +168,7 @@ TESTS_progs = \
gen3_render_tiledy_blits \
gen7_forcewake_mt \
gvt_basic \
+ intel_device_info \
kms_3d \
kms_addfb_basic \
kms_atomic \
diff --git a/tests/intel_device_info.c b/tests/intel_device_info.c
new file mode 100644
index 00000000..f5032f2c
--- /dev/null
+++ b/tests/intel_device_info.c
@@ -0,0 +1,353 @@
+/*
+ * Copyright © 2017 Intel Corporation
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice (including the next
+ * paragraph) shall be included in all copies or substantial portions of the
+ * Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
+ * IN THE SOFTWARE.
+ *
+ */
+
+#include "igt.h"
+#include <stdbool.h>
+#include <unistd.h>
+#include <stdlib.h>
+#include <sys/ioctl.h>
+#include <stdio.h>
+#include <string.h>
+#include <fcntl.h>
+#include <inttypes.h>
+#include <errno.h>
+
+#include "igt.h"
+
+IGT_TEST_DESCRIPTION("Test device information retrieving through i915_getparam.");
+
+static int drm_fd;
+static int devid;
+
+#ifndef I915_PARAM_SLICE_MASK
+#define I915_PARAM_SLICE_MASK 46
+#endif
+
+#ifndef I915_PARAM_SUBSLICE_MASK
+#define I915_PARAM_SUBSLICE_MASK 47
+#endif
+
+#ifndef I915_PARAM_CS_TIMESTAMP_FREQUENCY
+#define I915_PARAM_CS_TIMESTAMP_FREQUENCY 50
+#endif
+
+#ifndef I915_PARAM_TOPOLOGY
+/* Query various aspects of the topology of the GPU. Below is a list of the
+ * currently supported queries. The motivation of this more detailed query
+ * mechanism is to expose asynmetric properties of the GPU. Starting with CNL,
+ * slices might have different sizes (for example 3 subslices in slice0 and 2
+ * subslices in slice1+). This means we cannot rely on PARAM_SUBSLICE_MASK
+ * anymore.
+ *
+ * When using this parameter, getparam value should point to a structure of
+ * type drm_i915_topology_t. Call this once with query set to the relevant
+ * information to be queried and data_size set to 0. The kernel will then set
+ * params and data_size to the expected length of data[]. The should make sure
+ * memory is allocated to the right length before making a second getparam
+ * with data_size already set. The kernel will then populate data[]. The
+ * meaning of params[] elements is described for each query below.
+ */
+#define I915_PARAM_TOPOLOGY 51
+typedef struct drm_i915_topology {
+ __u32 query;
+ __u32 data_size;
+
+ /* Query the availability of slices :
+ *
+ * params[0] : the maximum number of slices
+ *
+ * Each bit in data indicates whether a slice is available (1) or
+ * fused off (0). Formula to tell if slice X is available :
+ *
+ * (data[X / 8] >> (X % 8)) & 1
+ */
+#define I915_PARAM_TOPOLOGY_QUERY_SLICE_MASK 0
+ /* Query the availability of subslices :
+ *
+ * params[0] : slice stride
+ *
+ * Each bit in data indicates whether a subslice is available (1) or
+ * fused off (0). Formula to tell if slice X subslice Y is available :
+ *
+ * (data[(X * params[0]) + Y / 8] >> (Y % 8)) & 1
+ */
+#define I915_PARAM_TOPOLOGY_QUERY_SUBSLICE_MASK 1
+ /* Query the availability of EUs :
+ *
+ * params[0] : slice stride
+ * params[1] : subslice stride
+ *
+ * Each bit in data indicates whether a slice is available (1) or
+ * fused off (0). Formula to tell if slice X subslice Y eu Z is
+ * available :
+ *
+ * (data[X * params[0] + Y * params[1] + Z / 8] >> (Z % 8)) & 1
+ */
+#define I915_PARAM_TOPOLOGY_QUERY_EU_MASK 2
+
+ __u32 params[10];
+
+ __u8 data[];
+} drm_i915_topology_t;
+#endif /* I915_PARAM_TOPOLOGY */
+
+static bool
+topology_supported(void)
+{
+ drm_i915_topology_t topology;
+ drm_i915_getparam_t gp;
+
+ memset(&topology, 0, sizeof(topology));
+ topology.query = I915_PARAM_TOPOLOGY_QUERY_SLICE_MASK;
+
+ gp.param = I915_PARAM_TOPOLOGY;
+ gp.value = (int *) &topology;
+
+ return ioctl(drm_fd, DRM_IOCTL_I915_GETPARAM, &gp) == 0;
+}
+
+static void
+test_topology_pre_gen8(void)
+{
+ drm_i915_topology_t topology;
+ drm_i915_getparam_t gp;
+
+ memset(&topology, 0, sizeof(topology));
+ topology.query = I915_PARAM_TOPOLOGY_QUERY_SLICE_MASK;
+
+ gp.param = I915_PARAM_TOPOLOGY;
+ gp.value = (int *) &topology;
+ do_ioctl_err(drm_fd, DRM_IOCTL_I915_GETPARAM, &gp, ENODEV);
+}
+
+static void
+test_topology_invalid_params(void)
+{
+ drm_i915_topology_t topology;
+ drm_i915_getparam_t gp;
+
+ /* Invalid query */
+ memset(&topology, 0, sizeof(topology));
+ topology.query = 0xffffffff;
+
+ gp.param = I915_PARAM_TOPOLOGY;
+ gp.value = (int *) &topology;
+ do_ioctl_err(drm_fd, DRM_IOCTL_I915_GETPARAM, &gp, EINVAL);
+
+ /* Invalid data_size */
+ memset(&topology, 0, sizeof(topology));
+ topology.query = I915_PARAM_TOPOLOGY_QUERY_SLICE_MASK;
+
+ gp.param = I915_PARAM_TOPOLOGY;
+ gp.value = (int *) &topology;
+ do_ioctl(drm_fd, DRM_IOCTL_I915_GETPARAM, &gp);
+
+ topology.data_size += 1;
+
+ gp.param = I915_PARAM_TOPOLOGY;
+ gp.value = (int *) &topology;
+ do_ioctl_err(drm_fd, DRM_IOCTL_I915_GETPARAM, &gp, EINVAL);
+}
+
+static void
+test_topology_coherent_slice_mask(void)
+{
+ drm_i915_topology_t *topology;
+ drm_i915_getparam_t gp;
+ int slice_mask, subslice_mask;
+ int i, topology_slices, topology_subslices;
+
+ gp.param = I915_PARAM_SLICE_MASK;
+ gp.value = &slice_mask;
+ do_ioctl(drm_fd, DRM_IOCTL_I915_GETPARAM, &gp);
+
+ gp.param = I915_PARAM_SUBSLICE_MASK;
+ gp.value = &subslice_mask;
+ do_ioctl(drm_fd, DRM_IOCTL_I915_GETPARAM, &gp);
+
+ igt_debug("slice_mask=0x%x subslice_mask=0x%x\n", slice_mask, subslice_mask);
+
+ /* Slices */
+ topology = malloc(sizeof(*topology));
+ memset(topology, 0, sizeof(*topology));
+ topology->query = I915_PARAM_TOPOLOGY_QUERY_SLICE_MASK;
+
+ gp.param = I915_PARAM_TOPOLOGY;
+ gp.value = (int *) topology;
+ do_ioctl(drm_fd, DRM_IOCTL_I915_GETPARAM, &gp);
+
+ topology = realloc(topology, sizeof(*topology) + topology->data_size);
+ memset(topology->data, 0, topology->data_size);
+
+ gp.param = I915_PARAM_TOPOLOGY;
+ gp.value = (int *) topology;
+ do_ioctl(drm_fd, DRM_IOCTL_I915_GETPARAM, &gp);
+
+ topology_slices = 0;
+ for (i = 0; i < topology->data_size; i++)
+ topology_slices += __builtin_popcount(topology->data[i]);
+
+ /* These 2 should always match. */
+ igt_assert(__builtin_popcount(slice_mask) == topology_slices);
+
+ free(topology);
+
+ /* Subslices */
+ topology = malloc(sizeof(*topology));
+ memset(topology, 0, sizeof(*topology));
+ topology->query = I915_PARAM_TOPOLOGY_QUERY_SUBSLICE_MASK;
+
+ gp.param = I915_PARAM_TOPOLOGY;
+ gp.value = (int *) topology;
+ do_ioctl(drm_fd, DRM_IOCTL_I915_GETPARAM, &gp);
+
+ topology = realloc(topology, sizeof(*topology) + topology->data_size);
+
+ gp.param = I915_PARAM_TOPOLOGY;
+ gp.value = (int *) topology;
+ do_ioctl(drm_fd, DRM_IOCTL_I915_GETPARAM, &gp);
+
+ topology_subslices = 0;
+ for (i = 0; i < topology->params[0]; i++)
+ topology_subslices += __builtin_popcount(topology->data[i]);
+
+ /* I915_PARAM_SUBSLICE_MASK returns the value for slice0, we
+ * should match the values for the first slice of the
+ * topology.
+ */
+ igt_assert(__builtin_popcount(subslice_mask) == topology_subslices);
+
+ free(topology);
+}
+
+static void
+test_topology_matches_eu_total(void)
+{
+ drm_i915_topology_t *topology;
+ drm_i915_getparam_t gp;
+ int n_eus, n_eus_topology, s;
+
+ gp.param = I915_PARAM_EU_TOTAL;
+ gp.value = &n_eus;
+ do_ioctl(drm_fd, DRM_IOCTL_I915_GETPARAM, &gp);
+ igt_debug("n_eus=%i\n", n_eus);
+
+ topology = malloc(sizeof(*topology));
+ memset(topology, 0, sizeof(*topology));
+ topology->query = I915_PARAM_TOPOLOGY_QUERY_EU_MASK;
+
+ gp.param = I915_PARAM_TOPOLOGY;
+ gp.value = (int *) topology;
+ do_ioctl(drm_fd, DRM_IOCTL_I915_GETPARAM, &gp);
+
+ topology = realloc(topology, sizeof(*topology) + topology->data_size);
+ memset(topology->data, 0, topology->data_size);
+
+ gp.param = I915_PARAM_TOPOLOGY;
+ gp.value = (int *) topology;
+ do_ioctl(drm_fd, DRM_IOCTL_I915_GETPARAM, &gp);
+
+ n_eus_topology = 0;
+ for (s = 0; s < topology->data_size / topology->params[0]; s++) {
+ int ss;
+
+ igt_debug("slice%i:\n", s);
+
+ for (ss = 0; ss < topology->params[0] / topology->params[1]; ss++) {
+ int eu, n_subslice_eus = 0;
+
+ igt_debug("\tsubslice: %i\n", ss);
+
+ igt_debug("\t\teu_mask:");
+ for (eu = 0; eu < topology->params[1]; eu++) {
+ uint8_t val = topology->data[s * topology->params[0] +
+ ss * topology->params[1] + eu];
+ igt_debug(" 0x%hhx", val);
+ n_subslice_eus += __builtin_popcount(val);
+ n_eus_topology += __builtin_popcount(val);
+ }
+ igt_debug(" (%i)\n", n_subslice_eus);
+ }
+ }
+
+ igt_assert(n_eus_topology == n_eus);
+}
+
+static void
+test_cs_timestamp_frequency(void)
+{
+ drm_i915_getparam_t gp;
+ int frequency, ret;
+
+ gp.param = I915_PARAM_CS_TIMESTAMP_FREQUENCY;
+ gp.value = &frequency;
+
+ /* Not supported? */
+ ret = ioctl(drm_fd, DRM_IOCTL_I915_GETPARAM, &gp);
+ igt_skip_on(ret != 0);
+
+ igt_debug("cs_timestamp_frequency=%i\n", frequency);
+
+ /* This should be available on all platforms. */
+ igt_assert_neq(frequency, 0);
+}
+
+igt_main
+{
+ igt_skip_on_simulation();
+ igt_fixture {
+ drm_fd = drm_open_driver_render(DRIVER_INTEL);
+ devid = intel_get_drm_devid(drm_fd);
+ }
+
+ igt_subtest("topology-pre-gen8") {
+ igt_require(intel_gen(devid) < 8);
+ igt_require(topology_supported());
+ test_topology_pre_gen8();
+ }
+
+ igt_subtest("topology-invalid-params") {
+ igt_require(AT_LEAST_GEN(devid, 8));
+ igt_require(topology_supported());
+ test_topology_invalid_params();
+ }
+
+ igt_subtest("topology-coherent-slice-mask") {
+ igt_require(AT_LEAST_GEN(devid, 8));
+ igt_require(topology_supported());
+ test_topology_coherent_slice_mask();
+ }
+
+ igt_subtest("topology-matches-eu-total") {
+ igt_require(AT_LEAST_GEN(devid, 8));
+ igt_require(topology_supported());
+ test_topology_matches_eu_total();
+ }
+
+ igt_subtest("cs-timestamp-frequency") {
+ test_cs_timestamp_frequency();
+ }
+
+ igt_exit();
+}
diff --git a/tests/meson.build b/tests/meson.build
index c3d5372f..54592339 100644
--- a/tests/meson.build
+++ b/tests/meson.build
@@ -20,6 +20,7 @@ test_progs = [
'drv_module_reload',
'drv_selftest',
'drv_suspend',
+ 'intel_device_info',
'gem_bad_reloc',
'gem_basic',
'gem_busy',
--
2.15.0
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
^ permalink raw reply related [flat|nested] 3+ messages in thread
* ✓ Fi.CI.BAT: success for tests: add device information tests (rev2)
2017-11-02 16:30 [PATCH i-g-t v2] tests: add device information tests Lionel Landwerlin
@ 2017-11-02 17:23 ` Patchwork
2017-11-02 18:41 ` ✗ Fi.CI.IGT: warning " Patchwork
1 sibling, 0 replies; 3+ messages in thread
From: Patchwork @ 2017-11-02 17:23 UTC (permalink / raw)
To: Lionel Landwerlin; +Cc: intel-gfx
== Series Details ==
Series: tests: add device information tests (rev2)
URL : https://patchwork.freedesktop.org/series/32764/
State : success
== Summary ==
IGT patchset tested on top of latest successful build
6d16875736b9fb1ebf4bf3dc5a941f9e431d58e0 lib/igt_debugfs: Remove support for legacy CRC api.
with latest DRM-Tip kernel build CI_DRM_3309
fca2506bc5d4 drm-tip: 2017y-11m-02d-13h-10m-58s UTC integration manifest
Testlist changes:
+igt@intel_device_info@cs-timestamp-frequency
+igt@intel_device_info@topology-coherent-slice-mask
+igt@intel_device_info@topology-invalid-params
+igt@intel_device_info@topology-matches-eu-total
+igt@intel_device_info@topology-pre-gen8
Test kms_cursor_legacy:
Subgroup basic-flip-before-cursor-varying-size:
skip -> PASS (fi-hsw-4770r)
Test kms_pipe_crc_basic:
Subgroup nonblocking-crc-pipe-a-frame-sequence:
dmesg-warn -> PASS (fi-skl-6700k) fdo#103546 +1
Subgroup suspend-read-crc-pipe-a:
pass -> INCOMPLETE (fi-kbl-7560u) fdo#102846
fdo#103546 https://bugs.freedesktop.org/show_bug.cgi?id=103546
fdo#102846 https://bugs.freedesktop.org/show_bug.cgi?id=102846
fi-bdw-5557u total:289 pass:268 dwarn:0 dfail:0 fail:0 skip:21 time:444s
fi-blb-e6850 total:289 pass:223 dwarn:1 dfail:0 fail:0 skip:65 time:387s
fi-bsw-n3050 total:289 pass:243 dwarn:0 dfail:0 fail:0 skip:46 time:539s
fi-bwr-2160 total:289 pass:183 dwarn:0 dfail:0 fail:0 skip:106 time:279s
fi-bxt-dsi total:289 pass:259 dwarn:0 dfail:0 fail:0 skip:30 time:507s
fi-bxt-j4205 total:289 pass:260 dwarn:0 dfail:0 fail:0 skip:29 time:510s
fi-byt-j1900 total:289 pass:253 dwarn:1 dfail:0 fail:0 skip:35 time:513s
fi-byt-n2820 total:289 pass:249 dwarn:1 dfail:0 fail:0 skip:39 time:491s
fi-cfl-s total:289 pass:253 dwarn:4 dfail:0 fail:0 skip:32 time:546s
fi-cnl-y total:289 pass:262 dwarn:0 dfail:0 fail:0 skip:27 time:615s
fi-elk-e7500 total:289 pass:229 dwarn:0 dfail:0 fail:0 skip:60 time:431s
fi-gdg-551 total:289 pass:178 dwarn:1 dfail:0 fail:1 skip:109 time:263s
fi-glk-1 total:289 pass:261 dwarn:0 dfail:0 fail:0 skip:28 time:580s
fi-glk-dsi total:289 pass:258 dwarn:0 dfail:0 fail:1 skip:30 time:498s
fi-hsw-4770 total:289 pass:262 dwarn:0 dfail:0 fail:0 skip:27 time:438s
fi-hsw-4770r total:289 pass:262 dwarn:0 dfail:0 fail:0 skip:27 time:436s
fi-ilk-650 total:289 pass:228 dwarn:0 dfail:0 fail:0 skip:61 time:432s
fi-ivb-3520m total:289 pass:260 dwarn:0 dfail:0 fail:0 skip:29 time:493s
fi-ivb-3770 total:289 pass:260 dwarn:0 dfail:0 fail:0 skip:29 time:468s
fi-kbl-7500u total:289 pass:263 dwarn:1 dfail:0 fail:1 skip:24 time:484s
fi-kbl-7560u total:245 pass:228 dwarn:0 dfail:0 fail:0 skip:16
fi-kbl-7567u total:289 pass:269 dwarn:0 dfail:0 fail:0 skip:20 time:479s
fi-kbl-r total:289 pass:262 dwarn:0 dfail:0 fail:0 skip:27 time:590s
fi-pnv-d510 total:289 pass:222 dwarn:1 dfail:0 fail:0 skip:66 time:573s
fi-skl-6260u total:289 pass:269 dwarn:0 dfail:0 fail:0 skip:20 time:452s
fi-skl-6600u total:289 pass:262 dwarn:0 dfail:0 fail:0 skip:27 time:599s
fi-skl-6700hq total:289 pass:263 dwarn:0 dfail:0 fail:0 skip:26 time:653s
fi-skl-6700k total:289 pass:265 dwarn:0 dfail:0 fail:0 skip:24 time:523s
fi-skl-6770hq total:289 pass:269 dwarn:0 dfail:0 fail:0 skip:20 time:505s
fi-snb-2520m total:289 pass:250 dwarn:0 dfail:0 fail:0 skip:39 time:573s
== Logs ==
For more details see: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_469/
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
^ permalink raw reply [flat|nested] 3+ messages in thread
* ✗ Fi.CI.IGT: warning for tests: add device information tests (rev2)
2017-11-02 16:30 [PATCH i-g-t v2] tests: add device information tests Lionel Landwerlin
2017-11-02 17:23 ` ✓ Fi.CI.BAT: success for tests: add device information tests (rev2) Patchwork
@ 2017-11-02 18:41 ` Patchwork
1 sibling, 0 replies; 3+ messages in thread
From: Patchwork @ 2017-11-02 18:41 UTC (permalink / raw)
To: Lionel Landwerlin; +Cc: intel-gfx
== Series Details ==
Series: tests: add device information tests (rev2)
URL : https://patchwork.freedesktop.org/series/32764/
State : warning
== Summary ==
Test kms_busy:
Subgroup extended-modeset-hang-oldfb-with-reset-render-B:
pass -> DMESG-WARN (shard-hsw)
shard-hsw total:2544 pass:1431 dwarn:3 dfail:0 fail:8 skip:1102 time:9279s
== Logs ==
For more details see: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_469/shards.html
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2017-11-02 18:41 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-11-02 16:30 [PATCH i-g-t v2] tests: add device information tests Lionel Landwerlin
2017-11-02 17:23 ` ✓ Fi.CI.BAT: success for tests: add device information tests (rev2) Patchwork
2017-11-02 18:41 ` ✗ Fi.CI.IGT: warning " Patchwork
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.