1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170
|
/*
* Copyright © 2020 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.
*
* Author:
* Karthik B S <karthik.b.s@intel.com>
*/
/**
* TEST: kms multipipe modeset
* Category: Display
* Description: Test simultaneous modeset on all the supported pipes
*/
#include "igt.h"
/**
* SUBTEST: basic-max-pipe-crc-check
* Description: Verify if simultaneous modesets on all the supported pipes is
* successful. Validate using CRC verification
* Driver requirement: i915, xe
* Mega feature: General Display Features
*/
IGT_TEST_DESCRIPTION("Test simultaneous modeset on all the supported pipes");
typedef struct {
int drm_fd;
igt_display_t display;
struct igt_fb fb;
} data_t;
static void run_test(data_t *data, int valid_outputs)
{
igt_output_t *output;
igt_pipe_crc_t *pipe_crcs[IGT_MAX_PIPES] = { 0 };
igt_crc_t ref_crcs[IGT_MAX_PIPES], new_crcs[IGT_MAX_PIPES];
igt_display_t *display = &data->display;
uint16_t width = 0, height = 0;
igt_pipe_t *pipe;
igt_plane_t *plane;
drmModeModeInfo *mode;
int i = 0;
for_each_connected_output(display, output) {
mode = igt_output_get_mode(output);
igt_assert(mode);
igt_output_set_pipe(output, PIPE_NONE);
width = max(width, mode->hdisplay);
height = max(height, mode->vdisplay);
}
igt_create_pattern_fb(data->drm_fd, width, height, DRM_FORMAT_XRGB8888,
DRM_FORMAT_MOD_LINEAR, &data->fb);
/* Collect reference CRC by Committing individually on all outputs*/
for_each_connected_output(display, output) {
pipe = &display->pipes[i];
plane = igt_pipe_get_plane_type(pipe, DRM_PLANE_TYPE_PRIMARY);
mode = NULL;
pipe_crcs[i] = igt_pipe_crc_new(display->drm_fd, i,
IGT_PIPE_CRC_SOURCE_AUTO);
igt_output_set_pipe(output, i);
mode = igt_output_get_mode(output);
igt_assert(mode);
igt_plane_set_fb(plane, &data->fb);
igt_fb_set_size(&data->fb, plane, mode->hdisplay, mode->vdisplay);
igt_plane_set_size(plane, mode->hdisplay, mode->vdisplay);
igt_display_commit2(display, COMMIT_ATOMIC);
igt_pipe_crc_collect_crc(pipe_crcs[i], &ref_crcs[i]);
igt_output_set_pipe(output, PIPE_NONE);
i++;
}
i = 0;
/* Simultaneously commit on all outputs */
for_each_connected_output(display, output) {
pipe = &display->pipes[i];
plane = igt_pipe_get_plane_type(pipe, DRM_PLANE_TYPE_PRIMARY);
mode = NULL;
igt_output_set_pipe(output, i);
mode = igt_output_get_mode(output);
igt_assert(mode);
igt_plane_set_fb(plane, &data->fb);
igt_fb_set_size(&data->fb, plane, mode->hdisplay, mode->vdisplay);
igt_plane_set_size(plane, mode->hdisplay, mode->vdisplay);
i++;
}
igt_display_commit2(display, COMMIT_ATOMIC);
/* CRC Verification */
for (i = 0; i < valid_outputs; i++) {
igt_pipe_crc_collect_crc(pipe_crcs[i], &new_crcs[i]);
igt_assert_crc_equal(&ref_crcs[i], &new_crcs[i]);
}
igt_plane_set_fb(plane, NULL);
igt_remove_fb(data->drm_fd, &data->fb);
}
static void test_multipipe(data_t *data, int num_pipes)
{
igt_output_t *output;
int valid_outputs = 0;
for_each_connected_output(&data->display, output)
valid_outputs++;
igt_require_f(valid_outputs == num_pipes,
"Number of connected outputs(%d) not equal to the "
"number of pipes supported(%d)\n", valid_outputs, num_pipes);
run_test(data, valid_outputs);
}
igt_main
{
data_t data;
drmModeResPtr res;
igt_fixture {
data.drm_fd = drm_open_driver_master(DRIVER_ANY);
kmstest_set_vt_graphics_mode();
igt_require_pipe_crc(data.drm_fd);
igt_display_require(&data.display, data.drm_fd);
res = drmModeGetResources(data.drm_fd);
igt_assert(res);
}
igt_describe("Verify if simultaneous modesets on all the supported "
"pipes is successful. Validate using CRC verification");
igt_subtest("basic-max-pipe-crc-check")
test_multipipe(&data, res->count_crtcs);
igt_fixture {
drmModeFreeResources(res);
igt_display_fini(&data.display);
}
}
|