[PATCH i-g-t] tests/kms_setmode: Dynamic crtc/connector combinations

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 2017-06-05 03:50 PM, Alex Deucher wrote:
> On Mon, Jun 5, 2017 at 2:43 PM, Harry Wentland <harry.wentland at amd.com> wrote:
>> Create crtc/connector combinations based on actual adapter
>> information obtained from drmModeRes.
>>
>> Also set MAX_CRTCs to 6 for AMD GPUs.
>>
>> Signed-off-by: Harry Wentland <harry.wentland at amd.com>
> 
> The code is kind of hard to follow, but it looks good to me:
> Acked-by: Alex Deucher <alexander.deucher at amd.com>
> 

I agree, that's why I only tried to limit the scope of this patch to the 
size of the combinations struct.

Thanks for the Ack. Is it okay to merge into drm/igt-gpu-tools? Do you 
know what the rules are on that? 
https://01.org/linuxgraphics/gfx-docs/maintainer-tools/drm-intel.html is 
quite vague on IGT patches.

Harry

>> ---
>>   tests/kms_setmode.c | 24 ++++++++++++++++++------
>>   1 file changed, 18 insertions(+), 6 deletions(-)
>>
>> diff --git a/tests/kms_setmode.c b/tests/kms_setmode.c
>> index 430568a1c24e..a7a48de44b0e 100644
>> --- a/tests/kms_setmode.c
>> +++ b/tests/kms_setmode.c
>> @@ -31,15 +31,13 @@
>>   #include <unistd.h>
>>   #include <string.h>
>>   #include <sys/time.h>
>> -
>> +#include <math.h>
>>   #include "intel_bufmgr.h"
>>
>>   #define MAX_CONNECTORS  10
>> -#define MAX_CRTCS       3
>> +#define MAX_CRTCS       6
>>
>>   /* max combinations with repetitions */
>> -#define MAX_COMBINATION_COUNT   \
>> -       (MAX_CONNECTORS * MAX_CONNECTORS * MAX_CONNECTORS)
>>   #define MAX_COMBINATION_ELEMS   MAX_CRTCS
>>
>>   static int drm_fd;
>> @@ -702,7 +700,8 @@ struct combination {
>>
>>   struct combination_set {
>>          int count;
>> -       struct combination items[MAX_COMBINATION_COUNT];
>> +       int capacity;
>> +       struct combination *items;
>>   };
>>
>>   /*
>> @@ -716,7 +715,7 @@ static void iterate_combinations(int n, int k, bool allow_repetitions,
>>          int v;
>>
>>          if (!k) {
>> -               igt_assert(set->count < ARRAY_SIZE(set->items));
>> +               igt_assert(set->count < set->capacity);
>>                  set->items[set->count++] = *comb;
>>                  return;
>>          }
>> @@ -751,6 +750,16 @@ static void test_combinations(const struct test_config *tconf,
>>          if (connector_count > 2 && (tconf->flags & TEST_STEALING))
>>                  return;
>>
>> +       igt_assert(tconf->resources);
>> +
>> +       connector_combs.capacity = pow(tconf->resources->count_connectors,
>> +                                      tconf->resources->count_crtcs + 1);
>> +       crtc_combs.capacity = pow(tconf->resources->count_crtcs,
>> +                                 tconf->resources->count_crtcs + 1);
>> +
>> +       connector_combs.items = malloc(connector_combs.capacity * sizeof(struct combination));
>> +       crtc_combs.items = malloc(crtc_combs.capacity * sizeof(struct combination));
>> +
>>          get_combinations(tconf->resources->count_connectors, connector_count,
>>                           false, &connector_combs);
>>          get_combinations(tconf->resources->count_crtcs, connector_count,
>> @@ -787,6 +796,9 @@ static void test_combinations(const struct test_config *tconf,
>>   free_cconfs:
>>                  free(cconfs);
>>          }
>> +
>> +       free(connector_combs.items);
>> +       free(crtc_combs.items);
>>   }
>>
>>   static void run_test(const struct test_config *tconf)
>> --
>> 2.11.0
>>
>> _______________________________________________
>> amd-gfx mailing list
>> amd-gfx at lists.freedesktop.org
>> https://lists.freedesktop.org/mailman/listinfo/amd-gfx


[Index of Archives]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux