mirror of
https://github.com/tiagovignatti/intel-gpu-tools.git
synced 2025-06-11 01:46:14 +00:00
test/kms_psr_sink_crc: Split plane setup operations
No functional changes. This reorg will allow to do some operations like dpms off/on with different places to wait for psr to get active. Signed-off-by: Rodrigo Vivi <rodrigo.vivi@intel.com>
This commit is contained in:
parent
fd9ef1b8c8
commit
782d5e7a03
@ -84,6 +84,8 @@ typedef struct {
|
|||||||
struct igt_fb fb_green, fb_white;
|
struct igt_fb fb_green, fb_white;
|
||||||
igt_plane_t *primary, *sprite, *cursor;
|
igt_plane_t *primary, *sprite, *cursor;
|
||||||
int mod_size;
|
int mod_size;
|
||||||
|
drmModeModeInfo *mode;
|
||||||
|
igt_output_t *output;
|
||||||
} data_t;
|
} data_t;
|
||||||
|
|
||||||
static void create_cursor_fb(data_t *data)
|
static void create_cursor_fb(data_t *data)
|
||||||
@ -101,9 +103,32 @@ static void create_cursor_fb(data_t *data)
|
|||||||
igt_assert(cairo_status(cr) == 0);
|
igt_assert(cairo_status(cr) == 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
static void setup_output(data_t *data)
|
||||||
|
{
|
||||||
|
igt_display_t *display = &data->display;
|
||||||
|
igt_output_t *output;
|
||||||
|
|
||||||
|
for_each_connected_output(display, output) {
|
||||||
|
drmModeConnectorPtr c = output->config.connector;
|
||||||
|
|
||||||
|
if (c->connector_type != DRM_MODE_CONNECTOR_eDP ||
|
||||||
|
c->connection != DRM_MODE_CONNECTED)
|
||||||
|
continue;
|
||||||
|
|
||||||
|
igt_output_set_pipe(output, PIPE_ANY);
|
||||||
|
data->crtc_id = output->config.crtc->crtc_id;
|
||||||
|
data->output = output;
|
||||||
|
data->mode = igt_output_get_mode(output);
|
||||||
|
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
static void display_init(data_t *data)
|
static void display_init(data_t *data)
|
||||||
{
|
{
|
||||||
igt_display_init(&data->display, data->drm_fd);
|
igt_display_init(&data->display, data->drm_fd);
|
||||||
|
setup_output(data);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void display_fini(data_t *data)
|
static void display_fini(data_t *data)
|
||||||
@ -321,7 +346,7 @@ static void assert_or_manual(bool condition, const char *expected)
|
|||||||
igt_assert(igt_interactive_debug || condition);
|
igt_assert(igt_interactive_debug || condition);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void test_crc(data_t *data)
|
static void run_test(data_t *data)
|
||||||
{
|
{
|
||||||
uint32_t handle = data->fb_white.gem_handle;
|
uint32_t handle = data->fb_white.gem_handle;
|
||||||
igt_plane_t *test_plane;
|
igt_plane_t *test_plane;
|
||||||
@ -330,9 +355,6 @@ static void test_crc(data_t *data)
|
|||||||
char crc[12];
|
char crc[12];
|
||||||
const char *expected = "";
|
const char *expected = "";
|
||||||
|
|
||||||
igt_plane_set_fb(data->primary, &data->fb_green);
|
|
||||||
igt_display_commit(&data->display);
|
|
||||||
|
|
||||||
/* Confirm that screen became Green */
|
/* Confirm that screen became Green */
|
||||||
get_sink_crc(data, ref_crc);
|
get_sink_crc(data, ref_crc);
|
||||||
assert_or_manual(is_green(ref_crc), "screen GREEN");
|
assert_or_manual(is_green(ref_crc), "screen GREEN");
|
||||||
@ -447,77 +469,60 @@ static void test_cleanup(data_t *data) {
|
|||||||
igt_remove_fb(data->drm_fd, &data->fb_white);
|
igt_remove_fb(data->drm_fd, &data->fb_white);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void run_test(data_t *data)
|
static void setup_test_plane(data_t *data)
|
||||||
{
|
{
|
||||||
igt_display_t *display = &data->display;
|
|
||||||
igt_output_t *output;
|
|
||||||
drmModeModeInfo *mode;
|
|
||||||
uint32_t white_h, white_v;
|
uint32_t white_h, white_v;
|
||||||
|
|
||||||
for_each_connected_output(display, output) {
|
igt_create_color_fb(data->drm_fd,
|
||||||
drmModeConnectorPtr c = output->config.connector;
|
data->mode->hdisplay, data->mode->vdisplay,
|
||||||
|
DRM_FORMAT_XRGB8888,
|
||||||
|
LOCAL_I915_FORMAT_MOD_X_TILED,
|
||||||
|
0.0, 1.0, 0.0,
|
||||||
|
&data->fb_green);
|
||||||
|
|
||||||
if (c->connector_type != DRM_MODE_CONNECTOR_eDP ||
|
data->primary = igt_output_get_plane(data->output, IGT_PLANE_PRIMARY);
|
||||||
c->connection != DRM_MODE_CONNECTED)
|
igt_plane_set_fb(data->primary, NULL);
|
||||||
continue;
|
|
||||||
|
|
||||||
igt_output_set_pipe(output, PIPE_ANY);
|
white_h = data->mode->hdisplay;
|
||||||
data->crtc_id = output->config.crtc->crtc_id;
|
white_v = data->mode->vdisplay;
|
||||||
|
|
||||||
mode = igt_output_get_mode(output);
|
/* Ignoring pitch and bpp to avoid changing full screen */
|
||||||
|
data->mod_size = white_h * white_v;
|
||||||
|
|
||||||
|
switch (data->test_plane) {
|
||||||
|
case SPRITE:
|
||||||
|
data->sprite = igt_output_get_plane(data->output,
|
||||||
|
IGT_PLANE_2);
|
||||||
|
igt_plane_set_fb(data->sprite, NULL);
|
||||||
|
/* To make it different for human eyes let's make
|
||||||
|
* sprite visible in only one quarter of the primary
|
||||||
|
*/
|
||||||
|
white_h = white_h/2;
|
||||||
|
white_v = white_v/2;
|
||||||
|
case PRIMARY:
|
||||||
igt_create_color_fb(data->drm_fd,
|
igt_create_color_fb(data->drm_fd,
|
||||||
mode->hdisplay, mode->vdisplay,
|
white_h, white_v,
|
||||||
DRM_FORMAT_XRGB8888,
|
DRM_FORMAT_XRGB8888,
|
||||||
LOCAL_I915_FORMAT_MOD_X_TILED,
|
LOCAL_I915_FORMAT_MOD_X_TILED,
|
||||||
0.0, 1.0, 0.0,
|
1.0, 1.0, 1.0,
|
||||||
&data->fb_green);
|
&data->fb_white);
|
||||||
|
break;
|
||||||
|
case CURSOR:
|
||||||
|
data->cursor = igt_output_get_plane(data->output,
|
||||||
|
IGT_PLANE_CURSOR);
|
||||||
|
igt_plane_set_fb(data->cursor, NULL);
|
||||||
|
create_cursor_fb(data);
|
||||||
|
igt_plane_set_position(data->cursor, 0, 0);
|
||||||
|
|
||||||
data->primary = igt_output_get_plane(output, IGT_PLANE_PRIMARY);
|
/* Cursor is 64 x 64, ignoring pitch and bbp again */
|
||||||
igt_plane_set_fb(data->primary, NULL);
|
data->mod_size = 64 * 64;
|
||||||
|
break;
|
||||||
white_h = mode->hdisplay;
|
|
||||||
white_v = mode->vdisplay;
|
|
||||||
|
|
||||||
/* Ignoring pitch and bpp to avoid changing full screen */
|
|
||||||
data->mod_size = white_h * white_v;
|
|
||||||
|
|
||||||
switch (data->test_plane) {
|
|
||||||
case SPRITE:
|
|
||||||
data->sprite = igt_output_get_plane(output,
|
|
||||||
IGT_PLANE_2);
|
|
||||||
igt_plane_set_fb(data->sprite, NULL);
|
|
||||||
/* To make it different for human eyes let's make
|
|
||||||
* sprite visible in only one quarter of the primary
|
|
||||||
*/
|
|
||||||
white_h = white_h/2;
|
|
||||||
white_v = white_v/2;
|
|
||||||
case PRIMARY:
|
|
||||||
igt_create_color_fb(data->drm_fd,
|
|
||||||
white_h, white_v,
|
|
||||||
DRM_FORMAT_XRGB8888,
|
|
||||||
LOCAL_I915_FORMAT_MOD_X_TILED,
|
|
||||||
1.0, 1.0, 1.0,
|
|
||||||
&data->fb_white);
|
|
||||||
break;
|
|
||||||
case CURSOR:
|
|
||||||
data->cursor = igt_output_get_plane(output,
|
|
||||||
IGT_PLANE_CURSOR);
|
|
||||||
igt_plane_set_fb(data->cursor, NULL);
|
|
||||||
create_cursor_fb(data);
|
|
||||||
igt_plane_set_position(data->cursor, 0, 0);
|
|
||||||
|
|
||||||
/* Cursor is 64 x 64, ignoring pitch and bbp again */
|
|
||||||
data->mod_size = 64 * 64;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
igt_display_commit(&data->display);
|
|
||||||
|
|
||||||
test_crc(data);
|
|
||||||
|
|
||||||
test_cleanup(data);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
igt_display_commit(&data->display);
|
||||||
|
|
||||||
|
igt_plane_set_fb(data->primary, &data->fb_green);
|
||||||
|
igt_display_commit(&data->display);
|
||||||
}
|
}
|
||||||
|
|
||||||
static int opt_handler(int opt, int opt_index)
|
static int opt_handler(int opt, int opt_index)
|
||||||
@ -566,7 +571,10 @@ int main(int argc, char *argv[])
|
|||||||
igt_subtest_f("primary_%s", op_str(op)) {
|
igt_subtest_f("primary_%s", op_str(op)) {
|
||||||
data.test_plane = PRIMARY;
|
data.test_plane = PRIMARY;
|
||||||
data.op = op;
|
data.op = op;
|
||||||
|
setup_test_plane(&data);
|
||||||
|
igt_assert(wait_psr_entry(&data));
|
||||||
run_test(&data);
|
run_test(&data);
|
||||||
|
test_cleanup(&data);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -574,7 +582,10 @@ int main(int argc, char *argv[])
|
|||||||
igt_subtest_f("sprite_%s", op_str(op)) {
|
igt_subtest_f("sprite_%s", op_str(op)) {
|
||||||
data.test_plane = SPRITE;
|
data.test_plane = SPRITE;
|
||||||
data.op = op;
|
data.op = op;
|
||||||
|
setup_test_plane(&data);
|
||||||
|
igt_assert(wait_psr_entry(&data));
|
||||||
run_test(&data);
|
run_test(&data);
|
||||||
|
test_cleanup(&data);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -582,7 +593,10 @@ int main(int argc, char *argv[])
|
|||||||
igt_subtest_f("cursor_%s", op_str(op)) {
|
igt_subtest_f("cursor_%s", op_str(op)) {
|
||||||
data.test_plane = CURSOR;
|
data.test_plane = CURSOR;
|
||||||
data.op = op;
|
data.op = op;
|
||||||
|
setup_test_plane(&data);
|
||||||
|
igt_assert(wait_psr_entry(&data));
|
||||||
run_test(&data);
|
run_test(&data);
|
||||||
|
test_cleanup(&data);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user