linux/drivers/gpu/drm/selftests/test-drm_dp_mst_helper.c
Lyude Paul 7cbce45d62 drm/dp_mst: Move test_calc_pbn_mode() into an actual selftest
Yes, apparently we've been testing this for every single driver load for
quite a long time now. At least that means our PBN calculation is solid!

Anyway, introduce self tests for MST and move this into there.

Cc: Juston Li <juston.li@intel.com>
Cc: Imre Deak <imre.deak@intel.com>
Cc: Ville Syrjälä <ville.syrjala@linux.intel.com>
Cc: Harry Wentland <hwentlan@amd.com>
Reviewed-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Signed-off-by: Lyude Paul <lyude@redhat.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20190903204645.25487-5-lyude@redhat.com
2019-09-03 19:28:20 -04:00

34 lines
732 B
C

// SPDX-License-Identifier: GPL-2.0-only
/*
* Test cases for for the DRM DP MST helpers
*/
#include <drm/drm_dp_mst_helper.h>
#include <drm/drm_print.h>
#include "test-drm_modeset_common.h"
int igt_dp_mst_calc_pbn_mode(void *ignored)
{
int pbn, i;
const struct {
int rate;
int bpp;
int expected;
} test_params[] = {
{ 154000, 30, 689 },
{ 234000, 30, 1047 },
{ 297000, 24, 1063 },
};
for (i = 0; i < ARRAY_SIZE(test_params); i++) {
pbn = drm_dp_calc_pbn_mode(test_params[i].rate,
test_params[i].bpp);
FAIL(pbn != test_params[i].expected,
"Expected PBN %d for clock %d bpp %d, got %d\n",
test_params[i].expected, test_params[i].rate,
test_params[i].bpp, pbn);
}
return 0;
}