From: Vidya Srinivas <vidya.srinivas@intel.com>
To: intel-gfx@lists.freedesktop.org
Cc: daniel.vetter@intel.com, Vidya Srinivas <vidya.srinivas@intel.com>
Subject: [PATCH i-g-t 4/6] i-g-t kms_plane_scaling: test scaling with tiling rotation and pixel formats
Date: Wed, 13 Dec 2017 15:20:50 +0530 [thread overview]
Message-ID: <1513158652-8912-5-git-send-email-vidya.srinivas@intel.com> (raw)
In-Reply-To: <1513158652-8912-1-git-send-email-vidya.srinivas@intel.com>
From: Jyoti Yadav <jyoti.r.yadav@intel.com>
This patch adds subtest for testing scaling in combination with rotation
and pixel formats.
Signed-off-by: Jyoti Yadav <jyoti.r.yadav@intel.com>
Signed-off-by: Mahesh Kumar <mahesh1.kumar@intel.com>
Signed-off-by: Vidya Srinivas <vidya.srinivas@intel.com>
---
tests/kms_plane_scaling.c | 203 ++++++++++++++++++++++++++++++++++++++++++++--
1 file changed, 194 insertions(+), 9 deletions(-)
diff --git a/tests/kms_plane_scaling.c b/tests/kms_plane_scaling.c
index a827cb3..3725d8e 100644
--- a/tests/kms_plane_scaling.c
+++ b/tests/kms_plane_scaling.c
@@ -54,6 +54,52 @@ typedef struct {
} data_t;
#define FILE_NAME "1080p-left.png"
+#define MIN_SRC_WIDTH_HEIGHT 9
+#define MAX_SRC_WIDTH 4096
+
+#define MAX_ROTATION 4
+static igt_rotation_t get_rotation_angle(int rot)
+{
+ switch (rot) {
+ case 0:
+ return IGT_ROTATION_0;
+ break;
+ case 1:
+ return IGT_ROTATION_90;
+ break;
+ case 2:
+ return IGT_ROTATION_180;
+ break;
+ case 3:
+ return IGT_ROTATION_270;
+ break;
+ default:
+ igt_info("Unknown/Unsupported Rotation %d\n", rot);
+ return IGT_ROTATION_0;
+ }
+}
+
+#define MAX_TILING 4
+static uint64_t get_tiling(int tiling)
+{
+ switch (tiling) {
+ case 0:
+ return LOCAL_DRM_FORMAT_MOD_NONE;
+ break;
+ case 1:
+ return LOCAL_I915_FORMAT_MOD_X_TILED;
+ break;
+ case 2:
+ return LOCAL_I915_FORMAT_MOD_Y_TILED;
+ break;
+ case 3:
+ return LOCAL_I915_FORMAT_MOD_Yf_TILED;
+ break;
+ default:
+ igt_info("Unknown/Unsupported Tiling %d\n", tiling);
+ return LOCAL_DRM_FORMAT_MOD_NONE;
+ }
+}
static void prepare_crtc(data_t *data, igt_output_t *output, enum pipe pipe,
igt_plane_t *plane, drmModeModeInfo *mode, enum igt_commit_style s)
@@ -129,6 +175,128 @@ static void cleanup_crtc(data_t *data, igt_output_t *output, igt_plane_t *plane)
igt_display_commit2(display, COMMIT_UNIVERSAL);
}
+static void paint_fb(data_t *d, struct igt_fb *fb)
+{
+ cairo_t *cr;
+
+ cr = igt_get_cairo_ctx(d->drm_fd, fb);
+ igt_paint_color(cr, 0, 0, fb->width, fb->height, 0.0, 1.0, 0.0);
+ igt_assert(cairo_status(cr) == 0);
+ cairo_destroy(cr);
+}
+
+static void check_scaling_pipe_plane_rot(data_t *d, igt_plane_t *plane, uint32_t pixel_format,
+ uint64_t tiling, enum pipe pipe, igt_output_t *output,
+ igt_rotation_t rot)
+{
+ igt_display_t *display = &d->display;
+ int width, height;
+ drmModeModeInfo *mode;
+ igt_output_set_pipe(output, pipe);
+ mode = igt_output_get_mode(output);
+
+ /* create buffer in the range of min and max source side limit.*/
+ width = height = MIN_SRC_WIDTH_HEIGHT;
+ d->fb_id1 = igt_create_fb(display->drm_fd, width, height,
+ pixel_format, tiling, &d->fb1);
+ paint_fb(d, &d->fb1);
+ igt_assert(d->fb_id1);
+ igt_plane_set_fb(plane, &d->fb1);
+
+ /* Check min to full resolution upscaling */
+ igt_fb_set_position(&d->fb1, plane, 0, 0);
+ igt_fb_set_size(&d->fb1, plane, width, height);
+ igt_plane_set_position(plane, 0, 0);
+ igt_plane_set_size(plane, mode->hdisplay, mode->vdisplay);
+ igt_plane_set_rotation(plane, rot);
+ igt_display_commit2(display, COMMIT_ATOMIC);
+
+ igt_plane_set_fb(plane, NULL);
+ igt_plane_set_position(plane, 0, 0);
+ if (d->fb_id1) {
+ igt_remove_fb(d->drm_fd, &d->fb1);
+ d->fb_id1 = 0;
+ }
+}
+
+static void test_scaler_with_rotation_pipe(data_t *d, igt_output_t *output,
+ enum pipe pipe)
+{
+ igt_display_t *display = &d->display;
+ igt_plane_t *plane;
+
+ igt_output_set_pipe(output, pipe);
+ for_each_plane_on_pipe(display, pipe, plane) {
+
+ if (plane->type == DRM_PLANE_TYPE_CURSOR)
+ continue;
+
+ for (int i = 0; i < MAX_ROTATION; i++) {
+ igt_rotation_t rot = get_rotation_angle(i);
+ check_scaling_pipe_plane_rot(d, plane, DRM_FORMAT_XRGB8888,
+ LOCAL_I915_FORMAT_MOD_Y_TILED,
+ pipe, output, rot);
+ }
+ }
+}
+
+static void test_scaler_with_rotation(data_t *d, enum pipe pipe)
+{
+ igt_output_t *output;
+
+ for_each_valid_output_on_pipe(&d->display, pipe, output) {
+ igt_output_set_pipe(output, pipe);
+ test_scaler_with_rotation_pipe(d, output, pipe);
+ igt_output_set_pipe(output, PIPE_ANY);
+ }
+}
+
+static void
+test_scaler_with_pixel_format_pipe_plane(data_t *d, igt_output_t *output,
+ enum pipe pipe, igt_plane_t *plane,
+ uint64_t tiling)
+{
+ uint32_t format;
+
+ for_each_format_in_plane(plane, format) {
+ if (igt_is_cairo_supported_format(format)) {
+ check_scaling_pipe_plane_rot(d, plane, format, tiling,
+ pipe, output, IGT_ROTATION_0);
+ }
+ }
+}
+
+static void test_scaler_with_pixel_format_pipe(data_t *d, igt_output_t *output,
+ enum pipe pipe)
+{
+ igt_display_t *display = &d->display;
+ igt_plane_t *plane;
+
+ igt_output_set_pipe(output, pipe);
+ for_each_plane_on_pipe(display, pipe, plane) {
+
+ if (plane->type == DRM_PLANE_TYPE_CURSOR)
+ continue;
+
+ for (int i = 0; i < MAX_TILING; i++) {
+ uint64_t tiling = get_tiling(i);
+ test_scaler_with_pixel_format_pipe_plane(d, output, pipe, plane,
+ tiling);
+ }
+ }
+}
+
+static void test_scaler_with_pixel_format(data_t *d, enum pipe pipe)
+{
+ igt_output_t *output;
+
+ for_each_valid_output_on_pipe(&d->display, pipe, output) {
+ igt_output_set_pipe(output, pipe);
+ test_scaler_with_pixel_format_pipe(d, output, pipe);
+ igt_output_set_pipe(output, PIPE_ANY);
+ }
+}
+
/* does iterative scaling on plane2 */
static void iterate_plane_scaling(data_t *d, drmModeModeInfo *mode)
{
@@ -312,23 +480,40 @@ static void test_plane_scaling(data_t *d, enum pipe pipe)
igt_require_f(valid_tests, "no valid crtc/connector combinations found\n");
}
-igt_simple_main
+igt_main
{
data_t data = {};
enum pipe pipe;
igt_skip_on_simulation();
-
- data.drm_fd = drm_open_driver(DRIVER_INTEL);
- igt_require_pipe_crc(data.drm_fd);
- igt_display_init(&data.display, data.drm_fd);
- data.devid = intel_get_drm_devid(data.drm_fd);
+ igt_fixture {
+ data.drm_fd = drm_open_driver(DRIVER_INTEL);
+ kmstest_set_vt_graphics_mode();
+ igt_require_pipe_crc(data.drm_fd);
+ igt_display_init(&data.display, data.drm_fd);
+ data.devid = intel_get_drm_devid(data.drm_fd);
+ igt_require_gem(data.drm_fd);
+ }
data.num_scalers = intel_gen(data.devid) >= 9 ? 2 : 0;
- for_each_pipe_static(pipe)
- test_plane_scaling(&data, pipe);
+ for_each_pipe_static(pipe) {
+
+ igt_subtest_f("scaler_basic_test") {
+ test_plane_scaling(&data, pipe);
+ }
+
+ igt_subtest_f("scaler_with_pixel_format") {
+ test_scaler_with_pixel_format(&data, pipe);
+ }
- igt_display_fini(&data.display);
+ igt_subtest_f("scaler_with_rotation") {
+ test_scaler_with_rotation(&data, pipe);
+ }
+
+ igt_fixture {
+ igt_display_fini(&data.display);
+ }
+ }
}
--
2.7.4
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
next prev parent reply other threads:[~2017-12-13 9:41 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-12-13 9:50 [PATCH i-g-t 0/6] kms_plane_scaling fixes and enhancement Vidya Srinivas
2017-12-13 9:50 ` [PATCH i-g-t 1/6] i-g-t: kms_plane_scaling: Fix basic scaling test Vidya Srinivas
2018-01-04 14:56 ` Maarten Lankhorst
2018-01-05 3:45 ` Srinivas, Vidya
2017-12-13 9:50 ` [PATCH i-g-t 2/6] i-g-t: lib: Add plane pixel format support Vidya Srinivas
2018-01-09 12:10 ` Maarten Lankhorst
2018-01-09 12:32 ` Maarten Lankhorst
2017-12-13 9:50 ` [PATCH i-g-t 3/6] i-g-t: lib/igt_kms: Run kms_plane for all supported pixel formats Vidya Srinivas
2018-01-09 12:24 ` Maarten Lankhorst
2017-12-13 9:50 ` Vidya Srinivas [this message]
2017-12-14 10:55 ` [PATCH i-g-t 4/6] i-g-t kms_plane_scaling: test scaling with tiling rotation and " Daniel Vetter
2017-12-14 17:41 ` Srinivas, Vidya
2018-01-09 12:33 ` Maarten Lankhorst
2017-12-13 9:50 ` [PATCH i-g-t 5/6] i-g-t: kms_plane_scaling: test scaler with clipping clamping Vidya Srinivas
2017-12-13 9:50 ` [PATCH i-g-t 6/6] i-g-t: kms_plane_scaling: test for multi pipe with scaling Vidya Srinivas
2018-01-09 14:00 ` Maarten Lankhorst
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1513158652-8912-5-git-send-email-vidya.srinivas@intel.com \
--to=vidya.srinivas@intel.com \
--cc=daniel.vetter@intel.com \
--cc=intel-gfx@lists.freedesktop.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox