AMD GPUs can have 6 CRTCs.

This requires us to allocate the combinations on the heap.

v2:
  Of course We should free the new allocation. Thanks, Alex.

Signed-off-by: Harry Wentland <harry.wentl...@amd.com>
---
 tests/kms_setmode.c | 28 ++++++++++++++++++----------
 1 file changed, 18 insertions(+), 10 deletions(-)

diff --git a/tests/kms_setmode.c b/tests/kms_setmode.c
index 430568a1c24e..62905ec27e80 100644
--- a/tests/kms_setmode.c
+++ b/tests/kms_setmode.c
@@ -35,11 +35,13 @@
 #include "intel_bufmgr.h"
 
 #define MAX_CONNECTORS  10
-#define MAX_CRTCS       3
+#define MAX_CRTCS       6
 
 /* max combinations with repetitions */
+/* MAX_CONNECTORS ^ MAX_CRTCS */
+/* TODO should really be MAX_CONNECTORS ^ MAX_CONNECTORS ??? */
 #define MAX_COMBINATION_COUNT   \
-       (MAX_CONNECTORS * MAX_CONNECTORS * MAX_CONNECTORS)
+       (MAX_CONNECTORS * MAX_CONNECTORS * MAX_CONNECTORS * MAX_CONNECTORS * 
MAX_CONNECTORS * MAX_CONNECTORS)
 #define MAX_COMBINATION_ELEMS   MAX_CRTCS
 
 static int drm_fd;
@@ -743,22 +745,25 @@ static void get_combinations(int n, int k, bool 
allow_repetitions,
 static void test_combinations(const struct test_config *tconf,
                              int connector_count)
 {
-       struct combination_set connector_combs;
-       struct combination_set crtc_combs;
+       struct combination_set *connector_combs;
+       struct combination_set *crtc_combs;
        struct connector_config *cconfs;
        int i;
 
        if (connector_count > 2 && (tconf->flags & TEST_STEALING))
                return;
 
+       connector_combs = malloc(sizeof(*connector_combs));
+       crtc_combs = malloc(sizeof(*crtc_combs));
+
        get_combinations(tconf->resources->count_connectors, connector_count,
-                        false, &connector_combs);
+                        false, connector_combs);
        get_combinations(tconf->resources->count_crtcs, connector_count,
-                        true, &crtc_combs);
+                        true, crtc_combs);
 
        igt_info("Testing: %s %d connector combinations\n", tconf->name,
                 connector_count);
-       for (i = 0; i < connector_combs.count; i++) {
+       for (i = 0; i < connector_combs->count; i++) {
                int *connector_idxs;
                int ret;
                int j;
@@ -766,14 +771,14 @@ static void test_combinations(const struct test_config 
*tconf,
                cconfs = malloc(sizeof(*cconfs) * connector_count);
                igt_assert(cconfs);
 
-               connector_idxs = &connector_combs.items[i].elems[0];
+               connector_idxs = &connector_combs->items[i].elems[0];
                ret = get_connectors(tconf->resources, connector_idxs,
                                     connector_count, cconfs);
                if (ret < 0)
                        goto free_cconfs;
 
-               for (j = 0; j < crtc_combs.count; j++) {
-                       int *crtc_idxs = &crtc_combs.items[j].elems[0];
+               for (j = 0; j < crtc_combs->count; j++) {
+                       int *crtc_idxs = &crtc_combs->items[j].elems[0];
                        ret = assign_crtc_to_connectors(tconf, crtc_idxs,
                                                        connector_count,
                                                        cconfs);
@@ -787,6 +792,9 @@ static void test_combinations(const struct test_config 
*tconf,
 free_cconfs:
                free(cconfs);
        }
+
+       free(connector_combs);
+       free(crtc_combs);
 }
 
 static void run_test(const struct test_config *tconf)
-- 
2.11.0

_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

Reply via email to