Skip to contentSkip to conversation

i-g-t: Adding plane scaling test case

PATCH In review Chandra Konduru 2 participants 5 messages Mar 21, 2015 – Mar 30, 2015 Library code

lore
Share & tools
lore
#0 lore raw

PATCH 1/2 i-g-t: Adding plane scaling test case

From: chandra konduru <[email protected]>

This patch is adding i-g-t plane scaling test case to test couple basic display plane scaling usages. Additional test scenarios can be added later.

v2:
-Added iterative scaling to visually observe scaling (me)

v3:
-Added a flag to control primary plane scaling.

---
 lib/igt_fb.h              |    4 +
 lib/igt_kms.c             |  122 +++++++++++++--
 lib/igt_kms.h             |    5 +
 tests/.gitignore          |    1 +
 tests/Android.mk          |    1 +
 tests/Makefile.sources    |    1 +
 tests/kms_plane_scaling.c |  370 +++++++++++++++++++++++++++++++++++++++++++++
 7 files changed, 488 insertions(+), 16 deletions(-)
 create mode 100644 tests/kms_plane_scaling.c
lib/igt_fb.h +4 -0
index d9fb6bb..c21d1d0 100644
@@ -54,6 +54,10 @@ struct igt_fb {
 	unsigned tiling;
 	unsigned size;
 	cairo_surface_t *cairo_surface;
+	uint32_t src_x;
+	uint32_t src_y;
+	uint32_t src_w;
+	uint32_t src_h;
 };
 
 enum igt_text_align {
lib/igt_kms.c +106 -16

192 lines not on this page · raw message

lib/igt_kms.h +5 -0
index 4fada1b..2dde5d3 100644
@@ -181,6 +181,7 @@ typedef struct {
 	unsigned int position_changed : 1;
 	unsigned int panning_changed  : 1;
 	unsigned int rotation_changed : 1;
+	unsigned int size_changed     : 1;
 	/*
 	 * drm_plane can be NULL for primary and cursor planes (when not
 	 * using the atomic modeset API)
@@ -255,6 +256,10 @@ void igt_plane_set_size(igt_plane_t *plane, int w, int h);
 void igt_plane_set_panning(igt_plane_t *plane, int x, int y);
 void igt_plane_set_rotation(igt_plane_t *plane, igt_rotation_t rotation);
 void igt_crtc_set_background(igt_pipe_t *pipe, uint64_t background);
+void igt_fb_set_position(struct igt_fb *fb, igt_plane_t *plane,
+	uint32_t x, uint32_t y);
+void igt_fb_set_size(struct igt_fb *fb, igt_plane_t *plane,
+	uint32_t w, uint32_t h);
 
 void igt_wait_for_vblank(int drm_fd, enum pipe pipe);
 
tests/.gitignore +1 -0
index 69d2ba0..d1381cd 100644
@@ -138,6 +138,7 @@ kms_setmode
 kms_sink_crc_basic
 kms_universal_plane
 kms_crtc_background_color
+kms_plane_scaling
 multi-tests.txt
 pm_lpsp
 pm_psr
tests/Android.mk +1 -0
index 96a32b9..c024296 100644
@@ -76,6 +76,7 @@ else
     kms_force_connector \
     kms_flip_event_leak \
     kms_crtc_background_color \
+    kms_plane_scaling \
     kms_pwrite_crc
     IGT_LOCAL_CFLAGS += -DANDROID_HAS_CAIRO=0
 endif
tests/Makefile.sources +1 -0
index 4f612e6..460df02 100644
@@ -78,6 +78,7 @@ TESTS_progs_M = \
 	kms_setmode \
 	kms_universal_plane \
 	kms_crtc_background_color \
+	kms_plane_scaling \
 	pm_lpsp \
 	pm_rpm \
 	pm_rps \
tests/kms_plane_scaling.c new file +370 -0

370 lines not on this page · raw message

Signature · 6 lines
1.7.9.5

_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
#1 lore raw

PATCH 1/2 i-g-t: Adding plane scaling test case

From: chandra konduru <[email protected]>

This patch is adding i-g-t plane scaling test case to test couple basic display plane scaling usages. Additional test scenarios can be added later.

v2:
-Added iterative scaling to visually observe scaling (me)

v3:
-Added a flag to control primary plane scaling (me)

v4:
-Use new tiled types when calling igt_create_fb (me)

---
 lib/igt_fb.h              |    4 +
 lib/igt_kms.c             |  122 +++++++++++++--
 lib/igt_kms.h             |    5 +
 tests/.gitignore          |    1 +
 tests/Android.mk          |    1 +
 tests/Makefile.sources    |    1 +
 tests/kms_plane_scaling.c |  370 +++++++++++++++++++++++++++++++++++++++++++++
 7 files changed, 488 insertions(+), 16 deletions(-)
 create mode 100644 tests/kms_plane_scaling.c
lib/igt_fb.h +4 -0
index bafafcd..a07acd2 100644
@@ -54,6 +54,10 @@ struct igt_fb {
 	uint64_t tiling;
 	unsigned size;
 	cairo_surface_t *cairo_surface;
+	uint32_t src_x;
+	uint32_t src_y;
+	uint32_t src_w;
+	uint32_t src_h;
 };
 
 enum igt_text_align {
lib/igt_kms.c +106 -16

192 lines not on this page · raw message

lib/igt_kms.h +5 -0
index 84e8456..c5a5854 100644
@@ -182,6 +182,7 @@ typedef struct {
 	unsigned int position_changed : 1;
 	unsigned int panning_changed  : 1;
 	unsigned int rotation_changed : 1;
+	unsigned int size_changed     : 1;
 	/*
 	 * drm_plane can be NULL for primary and cursor planes (when not
 	 * using the atomic modeset API)
@@ -256,6 +257,10 @@ void igt_plane_set_size(igt_plane_t *plane, int w, int h);
 void igt_plane_set_panning(igt_plane_t *plane, int x, int y);
 void igt_plane_set_rotation(igt_plane_t *plane, igt_rotation_t rotation);
 void igt_crtc_set_background(igt_pipe_t *pipe, uint64_t background);
+void igt_fb_set_position(struct igt_fb *fb, igt_plane_t *plane,
+	uint32_t x, uint32_t y);
+void igt_fb_set_size(struct igt_fb *fb, igt_plane_t *plane,
+	uint32_t w, uint32_t h);
 
 void igt_wait_for_vblank(int drm_fd, enum pipe pipe);
 
tests/.gitignore +1 -0
index 0f08ce0..0d03fbe 100644
@@ -142,6 +142,7 @@ kms_sink_crc_basic
 kms_universal_plane
 kms_vblank
 kms_crtc_background_color
+kms_plane_scaling
 multi-tests.txt
 pm_lpsp
 pm_rc6_residency
tests/Android.mk +1 -0
index 96a32b9..c024296 100644
@@ -76,6 +76,7 @@ else
     kms_force_connector \
     kms_flip_event_leak \
     kms_crtc_background_color \
+    kms_plane_scaling \
     kms_pwrite_crc
     IGT_LOCAL_CFLAGS += -DANDROID_HAS_CAIRO=0
 endif
tests/Makefile.sources +1 -0
index 5235b5f..a04c31e 100644
@@ -83,6 +83,7 @@ TESTS_progs_M = \
 	kms_universal_plane \
 	kms_vblank \
 	kms_crtc_background_color \
+	kms_plane_scaling \
 	pm_lpsp \
 	pm_rpm \
 	pm_rps \
tests/kms_plane_scaling.c new file +370 -0

370 lines not on this page · raw message

Signature · 6 lines
1.7.9.5

_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
#2 lore raw
In reply to Chandra Konduru
Quoted 4 lines · Chandra Konduru

From: chandra konduru <[email protected]>

This patch is adding i-g-t plane scaling test case to test couple basic display plane scaling usages. Additional test scenarios can be added later.

Unfortunately both patches in this series don't apply cleanly to current master of intel-gpu-tools. Please could you rebase and send them again?

Quoted 181 lines

v2:
-Added iterative scaling to visually observe scaling (me)

v3:
-Added a flag to control primary plane scaling.

---
 lib/igt_fb.h              |    4 +
 lib/igt_kms.c             |  122 +++++++++++++--
 lib/igt_kms.h             |    5 +
 tests/.gitignore          |    1 +
 tests/Android.mk          |    1 +
 tests/Makefile.sources    |    1 +
 tests/kms_plane_scaling.c |  370 +++++++++++++++++++++++++++++++++++++++++++++
 7 files changed, 488 insertions(+), 16 deletions(-)
 create mode 100644 tests/kms_plane_scaling.c
lib/igt_fb.h +4 -0
index d9fb6bb..c21d1d0 100644
@@ -54,6 +54,10 @@ struct igt_fb {
        unsigned tiling;
        unsigned size;
        cairo_surface_t *cairo_surface;
+       uint32_t src_x;
+       uint32_t src_y;
+       uint32_t src_w;
+       uint32_t src_h;
 };
 
 enum igt_text_align {
lib/igt_kms.c +57 -12
index 72841ef..895830b 100644
@@ -1299,6 +1299,14 @@ static int igt_drm_plane_commit(igt_plane_t *plane,
        igt_display_t *display = output->display;
        uint32_t fb_id, crtc_id;
        int ret;
+       uint32_t src_x;
+       uint32_t src_y;
+       uint32_t src_w;
+       uint32_t src_h;
+       int32_t crtc_x;
+       int32_t crtc_y;
+       uint32_t crtc_w;
+       uint32_t crtc_h;
 
        igt_assert(plane->drm_plane);
 
@@ -1329,32 +1337,43 @@ static int igt_drm_plane_commit(igt_plane_t *plane,
                                      IGT_FIXED(0,0) /* src_h */);
 
                CHECK_RETURN(ret, fail_on_error);
-       } else if (plane->fb_changed || plane->position_changed) {
+       } else if (plane->fb_changed || plane->position_changed ||
+               plane->size_changed) {
+               src_x = IGT_FIXED(plane->fb->src_x,0); /* src_x */
+               src_y = IGT_FIXED(plane->fb->src_y,0); /* src_y */
+               src_w = IGT_FIXED(plane->fb->src_w,0); /* src_w */
+               src_h = IGT_FIXED(plane->fb->src_h,0); /* src_h */
+               crtc_x = plane->crtc_x;
+               crtc_y = plane->crtc_y;
+               crtc_w = plane->crtc_w;
+               crtc_h = plane->crtc_h;
+
                LOG(display,
-                   "%s: SetPlane %s.%d, fb %u, position (%d, %d)\n",
+                   "%s: SetPlane %s.%d, fb %u, src = (%d, %d) "
+                       "%ux%u dst = (%u, %u) %ux%u\n",
                    igt_output_name(output),
                    kmstest_pipe_name(output->config.pipe),
                    plane->index,
                    fb_id,
-                   plane->crtc_x, plane->crtc_y);
+                   src_x >> 16, src_y >> 16, src_w >> 16, src_h >> 16,
+                   crtc_x, crtc_y, crtc_w, crtc_h);
 
                ret = drmModeSetPlane(display->drm_fd,
                                      plane->drm_plane->plane_id,
                                      crtc_id,
                                      fb_id,
                                      0,    /* flags */
-                                     plane->crtc_x, plane->crtc_y,
-                                     plane->crtc_w, plane->crtc_h,
-                                     IGT_FIXED(0,0), /* src_x */
-                                     IGT_FIXED(0,0), /* src_y */
-                                     IGT_FIXED(plane->fb->width,0), /* src_w */
-                                     IGT_FIXED(plane->fb->height,0) /* src_h */);
+                                     crtc_x, crtc_y,
+                                     crtc_w, crtc_h,
+                                     src_x, src_y,
+                                     src_w, src_h);
 
                CHECK_RETURN(ret, fail_on_error);
        }
 
        plane->fb_changed = false;
        plane->position_changed = false;
+       plane->size_changed = false;
 
        if (plane->rotation_changed) {
                igt_plane_set_property(plane, plane->rotation_property,
@@ -1449,7 +1468,7 @@ static int igt_primary_plane_commit_legacy(igt_plane_t *primary,
        igt_assert(!primary->rotation_changed);
 
        if (!primary->fb_changed && !primary->position_changed &&
-           !primary->panning_changed)
+               !primary->size_changed && !primary->panning_changed)
                return 0;
 
        crtc_id = output->config.crtc->crtc_id;
@@ -1496,6 +1515,7 @@ static int igt_primary_plane_commit_legacy(igt_plane_t *primary,
        primary->pipe->enabled = (fb_id != 0);
        primary->fb_changed = false;
        primary->position_changed = false;
+       primary->size_changed = false;
        primary->panning_changed = false;
 
        return 0;
@@ -1553,7 +1573,7 @@ static int igt_output_commit(igt_output_t *output,
        for (i = 0; i < pipe->n_planes; i++) {
                igt_plane_t *plane = &pipe->planes[i];
 
-               if (plane->fb_changed || plane->position_changed)
+               if (plane->fb_changed || plane->position_changed || plane->size_changed)
                        need_wait_for_vblank = true;
 
                ret = igt_plane_commit(plane, output, s, fail_on_error);
@@ -1722,7 +1742,22 @@ void igt_plane_set_fb(igt_plane_t *plane, struct igt_fb *fb)
                plane->crtc_h = 0;
        }
 
+       if (fb) {
+               /* set default plane pos/size as fb size */
+               plane->crtc_x = 0;
+               plane->crtc_y = 0;
+               plane->crtc_w = fb->width;
+               plane->crtc_h = fb->height;
+
+               /* set default src pos/size as fb size */
+               fb->src_x = 0;
+               fb->src_y = 0;
+               fb->src_w = fb->width;
+               fb->src_h = fb->height;
+       }
+
        plane->fb_changed = true;
+       plane->size_changed = true;
 }
 
 void igt_plane_set_position(igt_plane_t *plane, int x, int y)
@@ -1739,21 +1774,76 @@ void igt_plane_set_position(igt_plane_t *plane, int x, int y)
        plane->position_changed = true;
 }
 
+/**
+ * igt_plane_set_size:
+ * @plane: plane pointer for which size to be set
+ * @w: width
+ * @h: height
+ *
+ * This function sets width and height for requested plane.
+ * New size will be commited at plane commit time via
+ * drmModeSetPlane().
+ */
 void igt_plane_set_size(igt_plane_t *plane, int w, int h)
 {
        igt_pipe_t *pipe = plane->pipe;
        igt_display_t *display = pipe->display;
 
-       LOG(display, "%s.%d: plane_set_size(%d,%d)\n",
+       LOG(display, "%s.%d: plane_set_size (%dx%d)\n",
            kmstest_pipe_name(pipe->pipe), plane->index, w, h);
 
        plane->crtc_w = w;
        plane->crtc_h = h;
 

lib/igt_kms.c void igt_plane_set_position(igt_plane_t *plane, int x, int y) · line 1803

Quoted 10 lines
lib/igt_kms.c +6 -4
-       /*
-        * must be fb_changed so that legacy cursors call
-        * drmModeSetCursor() instead of drmModeMoveCursor()
-        */
+       plane->size_changed = true;
+}
+
+/**
+ * igt_fb_set_position:
+ * @fb: framebuffer pointer

The plane parameter description is missing here.

Quoted 13 lines
lib/igt_kms.c +13 -0
+ * @x: X position
+ * @y: Y position
+ *
+ * This function sets position for requested framebuffer as src to plane.
+ * New position will be commited at plane commit time via drmModeSetPlane().
+ */
+void igt_fb_set_position(struct igt_fb *fb, igt_plane_t *plane,
+       uint32_t x, uint32_t y)
+{
+       igt_pipe_t *pipe = plane->pipe;
+       igt_display_t *display = pipe->display;
+
+       LOG(display, "%s.%d: fb_set_position(%d,%d)\n",

lib/igt_kms.c void igt_plane_set_position(igt_plane_t *plane, int x, int y) · line 1826

Quoted 10 lines
lib/igt_kms.c +10 -0
+           kmstest_pipe_name(pipe->pipe), plane->index, x, y);
+
+       fb->src_x = x;
+       fb->src_y = y;
+
+       plane->fb_changed = true;
+}
+
+/**
+ * igt_fb_set_position:

This should be igt_fb_set_size, and is also missing the plane parameter description.

Quoted 210 lines
lib/igt_kms.c +20 -0
+ * @fb: framebuffer pointer
+ * @w: width
+ * @h: height
+ *
+ * This function sets fetch rect size from requested framebuffer as src
+ * to plane. New size will be commited at plane commit time via
+ * drmModeSetPlane().
+ */
+void igt_fb_set_size(struct igt_fb *fb, igt_plane_t *plane,
+       uint32_t w, uint32_t h)
+{
+       igt_pipe_t *pipe = plane->pipe;
+       igt_display_t *display = pipe->display;
+
+       LOG(display, "%s.%d: fb_set_position(%dx%d)\n",
+           kmstest_pipe_name(pipe->pipe), plane->index, w, h);
+
+       fb->src_w = w;
+       fb->src_h = h;
+
        plane->fb_changed = true;
 }
 
lib/igt_kms.h +5 -0
index 4fada1b..2dde5d3 100644
@@ -181,6 +181,7 @@ typedef struct {
        unsigned int position_changed : 1;
        unsigned int panning_changed  : 1;
        unsigned int rotation_changed : 1;
+       unsigned int size_changed     : 1;
        /*
         * drm_plane can be NULL for primary and cursor planes (when not
         * using the atomic modeset API)
@@ -255,6 +256,10 @@ void igt_plane_set_size(igt_plane_t *plane, int w, int h);
 void igt_plane_set_panning(igt_plane_t *plane, int x, int y);
 void igt_plane_set_rotation(igt_plane_t *plane, igt_rotation_t rotation);
 void igt_crtc_set_background(igt_pipe_t *pipe, uint64_t background);
+void igt_fb_set_position(struct igt_fb *fb, igt_plane_t *plane,
+       uint32_t x, uint32_t y);
+void igt_fb_set_size(struct igt_fb *fb, igt_plane_t *plane,
+       uint32_t w, uint32_t h);
 
 void igt_wait_for_vblank(int drm_fd, enum pipe pipe);
 
tests/.gitignore +1 -0
index 69d2ba0..d1381cd 100644
@@ -138,6 +138,7 @@ kms_setmode
 kms_sink_crc_basic
 kms_universal_plane
 kms_crtc_background_color
+kms_plane_scaling
 multi-tests.txt
 pm_lpsp
 pm_psr
tests/Android.mk +1 -0
index 96a32b9..c024296 100644
@@ -76,6 +76,7 @@ else
     kms_force_connector \
     kms_flip_event_leak \
     kms_crtc_background_color \
+    kms_plane_scaling \
     kms_pwrite_crc
     IGT_LOCAL_CFLAGS += -DANDROID_HAS_CAIRO=0
 endif
tests/Makefile.sources +1 -0
index 4f612e6..460df02 100644
@@ -78,6 +78,7 @@ TESTS_progs_M = \
        kms_setmode \
        kms_universal_plane \
        kms_crtc_background_color \
+       kms_plane_scaling \
        pm_lpsp \
        pm_rpm \
        pm_rps \
tests/kms_plane_scaling.c new file +122 -0
new file mode 100644
index 0000000..180ff5e
@@ -0,0 +1,370 @@
+/*
+ * Copyright © 2013,2014 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.
+ *
+ */
+
+#include <math.h>
+
+#include "drmtest.h"
+#include "igt_debugfs.h"
+#include "igt_kms.h"
+#include "igt_core.h"
+#include "intel_chipset.h"
+#include "igt_aux.h"
+
+IGT_TEST_DESCRIPTION("Test display plane scaling");
+
+typedef struct {
+       uint32_t devid;
+       int drm_fd;
+       igt_display_t display;
+       igt_crc_t ref_crc;
+       igt_pipe_crc_t *pipe_crc;
+
+       int image_w;
+       int image_h;
+
+       int num_scalers;
+
+       struct igt_fb fb1;
+       struct igt_fb fb2;
+       struct igt_fb fb3;
+       int fb_id1;
+       int fb_id2;
+       int fb_id3;
+
+       igt_plane_t *plane1;
+       igt_plane_t *plane2;
+       igt_plane_t *plane3;
+       igt_plane_t *plane4;
+} data_t;
+
+#define FILE_NAME   "1080p-left.png"
+
+static void
+paint_color(data_t *d, struct igt_fb *fb, uint16_t w, uint16_t h)
+{
+       cairo_t *cr;
+
+       cr = igt_get_cairo_ctx(d->drm_fd, fb);
+       igt_paint_test_pattern(cr, w, h);
+       cairo_destroy(cr);
+}
+
+static void
+paint_image(data_t *d, struct igt_fb *fb, uint16_t w, uint16_t h)
+{
+       cairo_t *cr;
+
+       cr = igt_get_cairo_ctx(d->drm_fd, fb);
+       igt_paint_image(cr, FILE_NAME, 0, 0, w, h);
+       cairo_destroy(cr);
+}
+
+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)
+{
+       igt_display_t *display = &data->display;
+
+       igt_output_set_pipe(output, pipe);
+
+       /* create the pipe_crc object for this pipe */
+       igt_pipe_crc_free(data->pipe_crc);
+       data->pipe_crc = igt_pipe_crc_new(pipe, INTEL_PIPE_CRC_SOURCE_AUTO);
+
+       /* before allocating, free if any older fb */
+       if (data->fb_id1) {
+               igt_remove_fb(data->drm_fd, &data->fb1);
+               data->fb_id1 = 0;
+       }
+
+       /* allocate fb for plane 1 */
+       data->fb_id1 = igt_create_fb(data->drm_fd,
+                       mode->hdisplay, mode->vdisplay,
+                       DRM_FORMAT_XRGB8888,
+                       true, /* tiled */
+                       &data->fb1);
+       igt_assert(data->fb_id1);
+
+       paint_color(data, &data->fb1, mode->hdisplay, mode->vdisplay);
+
+       /*
+        * We always set the primary plane to actually enable the pipe as
+        * there's no way (that works) to light up a pipe with only a sprite
+        * plane enabled at the moment.
+        */
+       if (!plane->is_primary) {
+               igt_plane_t *primary;
+
+               primary = igt_output_get_plane(output, IGT_PLANE_PRIMARY);
+               igt_plane_set_fb(primary, &data->fb1);
+       }
+
+       igt_plane_set_fb(plane, &data->fb1);

tests/kms_plane_scaling.c line 132

Quoted 10 lines
tests/kms_plane_scaling.c new file +10 -0
+       if (s == COMMIT_LEGACY) {
+               int ret;
+               ret = drmModeSetCrtc(data->drm_fd,
+                               output->config.crtc->crtc_id,
+                               data->fb_id1,
+                               plane->pan_x, plane->pan_y,
+                               &output->id,
+                               1,
+                               mode);
+               igt_assert(ret == 0);

igt.cocci suggests igt_assert_eq(ret, 0) here instead of igt_assert.

Quoted 222 lines
tests/kms_plane_scaling.c new file +222 -0
+       } else {
+               igt_display_commit2(display, s);
+       }
+}
+
+static void cleanup_crtc(data_t *data, igt_output_t *output, igt_plane_t *plane)
+{
+       igt_display_t *display = &data->display;
+
+       igt_pipe_crc_free(data->pipe_crc);
+       data->pipe_crc = NULL;
+
+       if (data->fb_id1) {
+               igt_remove_fb(data->drm_fd, &data->fb1);
+               data->fb_id1 = 0;
+       }
+       if (data->fb_id2) {
+               igt_remove_fb(data->drm_fd, &data->fb2);
+               data->fb_id2 = 0;
+       }
+       if (data->fb_id3) {
+               igt_remove_fb(data->drm_fd, &data->fb3);
+               data->fb_id3 = 0;
+       }
+
+       if (!plane->is_primary) {
+               igt_plane_t *primary;
+
+               primary = igt_output_get_plane(output, IGT_PLANE_PRIMARY);
+               igt_plane_set_fb(primary, NULL);
+       }
+
+       igt_plane_set_fb(plane, NULL);
+       igt_output_set_pipe(output, PIPE_ANY);
+
+       igt_display_commit2(display, COMMIT_UNIVERSAL);
+}
+
+/* does iterative scaling on plane2 */
+static void iterate_plane_scaling(data_t *d, drmModeModeInfo *mode)
+{
+       igt_display_t *display = &d->display;
+
+       if (mode->hdisplay >= d->fb2.width) {
+               int w, h;
+               /* fixed fb */
+               igt_fb_set_position(&d->fb2, d->plane2, 0, 0);
+               igt_fb_set_size(&d->fb2, d->plane2, d->fb2.width, d->fb2.height);
+               igt_plane_set_position(d->plane2, 0, 0);
+
+               /* adjust plane size */
+               for (w = d->fb2.width; w <= mode->hdisplay; w+=10) {
+                       h = w * d->fb2.height / d->fb2.width;
+                       igt_plane_set_size(d->plane2, w, h);
+                       igt_display_commit2(display, COMMIT_UNIVERSAL);
+               }
+       } else {
+               int w, h;
+               /* fixed plane */
+               igt_plane_set_position(d->plane2, 0, 0);
+               igt_plane_set_size(d->plane2, mode->hdisplay, mode->vdisplay);
+               igt_fb_set_position(&d->fb2, d->plane2, 0, 0);
+
+               /* adjust fb size */
+               for (w = mode->hdisplay; w <= d->fb2.width; w+=10) {
+                       h = w * mode->hdisplay / mode->vdisplay;
+                       igt_fb_set_size(&d->fb2, d->plane2, w, h);
+                       igt_display_commit2(display, COMMIT_UNIVERSAL);
+               }
+       }
+}
+
+static void test_plane_scaling(data_t *d)
+{
+       igt_display_t *display = &d->display;
+       igt_output_t *output;
+       cairo_surface_t *image;
+       enum pipe pipe;
+       int valid_tests = 0;
+       int primary_plane_scaling = 0; /* For now */
+
+       igt_require(d->display.has_universal_planes);
+       igt_require(d->num_scalers);
+
+       for_each_connected_output(display, output) {
+               drmModeModeInfo *mode;
+
+               pipe = output->config.pipe;
+               igt_output_set_pipe(output, pipe);
+
+               mode = igt_output_get_mode(output);
+
+               /* allocate fb2 with image size */
+               image = cairo_image_surface_create_from_png(FILE_NAME);
+               igt_assert(cairo_surface_status(image) == CAIRO_STATUS_SUCCESS);
+               d->image_w = cairo_image_surface_get_width(image);
+               d->image_h = cairo_image_surface_get_height(image);
+               cairo_surface_destroy(image);
+
+               d->fb_id2 = igt_create_fb(d->drm_fd,
+                               d->image_w, d->image_h,
+                               DRM_FORMAT_XRGB8888,
+                               true, /* tiled */
+                               &d->fb2);
+               igt_assert(d->fb_id2);
+               paint_image(d, &d->fb2, d->fb2.width, d->fb2.height);
+
+               d->fb_id3 = igt_create_fb(d->drm_fd,
+                               mode->hdisplay, mode->vdisplay,
+                               DRM_FORMAT_XRGB8888,
+                               true, /* tiled */
+                               &d->fb3);
+               igt_assert(d->fb_id3);
+               paint_color(d, &d->fb3, mode->hdisplay, mode->vdisplay);
+
+               /* Set up display with plane 1 */
+               d->plane1 = igt_output_get_plane(output, IGT_PLANE_PRIMARY);
+               prepare_crtc(d, output, pipe, d->plane1, mode, COMMIT_UNIVERSAL);
+
+               if (primary_plane_scaling) {
+                       /* Primary plane upscaling */
+                       igt_fb_set_position(&d->fb1, d->plane1, 100, 100);
+                       igt_fb_set_size(&d->fb1, d->plane1, 500, 500);
+                       igt_plane_set_position(d->plane1, 0, 0);
+                       igt_plane_set_size(d->plane1, mode->hdisplay, mode->vdisplay);
+                       igt_display_commit2(display, COMMIT_UNIVERSAL);
+
+                       /* Primary plane 1:1 no scaling */
+                       igt_fb_set_position(&d->fb1, d->plane1, 0, 0);
+                       igt_fb_set_size(&d->fb1, d->plane1, d->fb1.width, d->fb1.height);
+                       igt_plane_set_position(d->plane1, 0, 0);
+                       igt_plane_set_size(d->plane1, mode->hdisplay, mode->vdisplay);
+                       igt_display_commit2(display, COMMIT_UNIVERSAL);
+               }
+
+               /* Set up fb2->plane2 mapping. */
+               d->plane2 = igt_output_get_plane(output, IGT_PLANE_2);
+               igt_plane_set_fb(d->plane2, &d->fb2);
+
+               /* 2nd plane windowed */
+               igt_fb_set_position(&d->fb2, d->plane2, 100, 100);
+               igt_fb_set_size(&d->fb2, d->plane2, d->fb2.width-200, d->fb2.height-200);
+               igt_plane_set_position(d->plane2, 100, 100);
+               igt_plane_set_size(d->plane2, mode->hdisplay-200, mode->vdisplay-200);
+               igt_display_commit2(display, COMMIT_UNIVERSAL);
+
+               iterate_plane_scaling(d, mode);
+
+               /* 2nd plane up scaling */
+               igt_fb_set_position(&d->fb2, d->plane2, 100, 100);
+               igt_fb_set_size(&d->fb2, d->plane2, 500, 500);
+               igt_plane_set_position(d->plane2, 10, 10);
+               igt_plane_set_size(d->plane2, mode->hdisplay-20, mode->vdisplay-20);
+               igt_display_commit2(display, COMMIT_UNIVERSAL);
+
+               /* 2nd plane downscaling */
+               igt_fb_set_position(&d->fb2, d->plane2, 0, 0);
+               igt_fb_set_size(&d->fb2, d->plane2, d->fb2.width, d->fb2.height);
+               igt_plane_set_position(d->plane2, 10, 10);
+               igt_plane_set_size(d->plane2, 500, 500 * d->fb2.height/d->fb2.width);
+               igt_display_commit2(display, COMMIT_UNIVERSAL);
+
+               if (primary_plane_scaling) {
+                       /* Primary plane up scaling */
+                       igt_fb_set_position(&d->fb1, d->plane1, 100, 100);
+                       igt_fb_set_size(&d->fb1, d->plane1, 500, 500);
+                       igt_plane_set_position(d->plane1, 0, 0);
+                       igt_plane_set_size(d->plane1, mode->hdisplay, mode->vdisplay);
+                       igt_display_commit2(display, COMMIT_UNIVERSAL);
+               }
+
+               /* Set up fb3->plane3 mapping. */
+               d->plane3 = igt_output_get_plane(output, IGT_PLANE_3);
+               igt_plane_set_fb(d->plane3, &d->fb3);
+
+               /* 3rd plane windowed - no scaling */
+               igt_fb_set_position(&d->fb3, d->plane3, 100, 100);
+               igt_fb_set_size(&d->fb3, d->plane3, d->fb3.width-300, d->fb3.height-300);
+               igt_plane_set_position(d->plane3, 100, 100);
+               igt_plane_set_size(d->plane3, mode->hdisplay-300, mode->vdisplay-300);
+               igt_display_commit2(display, COMMIT_UNIVERSAL);
+
+               /* Switch scaler from plane 2 to plane 3 */
+               igt_fb_set_position(&d->fb2, d->plane2, 100, 100);
+               igt_fb_set_size(&d->fb2, d->plane2, d->fb2.width-200, d->fb2.height-200);
+               igt_plane_set_position(d->plane2, 100, 100);
+               igt_plane_set_size(d->plane2, d->fb2.width-200, d->fb2.height-200);
+
+               igt_fb_set_position(&d->fb3, d->plane3, 100, 100);
+               igt_fb_set_size(&d->fb3, d->plane3, d->fb3.width-400, d->fb3.height-400);
+               igt_plane_set_position(d->plane3, 10, 10);
+               igt_plane_set_size(d->plane3, mode->hdisplay-300, mode->vdisplay-300);
+               igt_display_commit2(display, COMMIT_UNIVERSAL);
+
+               if (primary_plane_scaling) {
+                       /* Switch scaler from plane 1 to plane 2 */
+                       igt_fb_set_position(&d->fb1, d->plane1, 0, 0);
+                       igt_fb_set_size(&d->fb1, d->plane1, d->fb1.width, d->fb1.height);
+                       igt_plane_set_position(d->plane1, 0, 0);
+                       igt_plane_set_size(d->plane1, mode->hdisplay, mode->vdisplay);
+
+                       igt_fb_set_position(&d->fb2, d->plane2, 100, 100);
+                       igt_fb_set_size(&d->fb2, d->plane2, d->fb2.width-500,d->fb2.height-500);
+                       igt_plane_set_position(d->plane2, 100, 100);
+                       igt_plane_set_size(d->plane2, mode->hdisplay-200, mode->vdisplay-200);
+                       igt_display_commit2(display, COMMIT_UNIVERSAL);
+               }
+
+               /* back to single plane mode */
+               igt_plane_set_fb(d->plane2, NULL);
+               igt_plane_set_fb(d->plane3, NULL);
+               igt_display_commit2(display, COMMIT_UNIVERSAL);
+
+               valid_tests++;
+               cleanup_crtc(d, output, d->plane1);
+       }
+       igt_require_f(valid_tests, "no valid crtc/connector combinations found\n");
+}
+
+igt_main
+{
+       data_t data = {};

tests/kms_plane_scaling.c line 364

Quoted 10 lines
tests/kms_plane_scaling.c new file +10 -0
+
+       igt_skip_on_simulation();
+
+
+       data.drm_fd = drm_open_any();
+       igt_require_pipe_crc();
+       igt_display_init(&data.display, data.drm_fd);
+       data.devid = intel_get_drm_devid(data.drm_fd);
+
+       data.num_scalers = intel_gen(data.devid) >= 9 ? 2 : 0;

Since test_plane_scaling() requires num_scalers not to be zero, would it be clearer just to add an igt_skip here with a suitable explanation?

tests/kms_plane_scaling.c line 367

Quoted 3 lines
tests/kms_plane_scaling.c new file +3 -0
+
+       igt_subtest("plane-scaling")
+               test_plane_scaling(&data);

Do you intent to add more subtests? If not then this could be reduced to a simple test without subtests.

Quoted 10 lines
tests/kms_plane_scaling.c new file +3 -1
+
+       igt_display_fini(&data.display);
+}
--

1.7.9.5

_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx

_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx

#3 lore raw

PATCH 2/2 i-g-t: Adding panel fitting test case

In reply to Chandra Konduru

From: chandra konduru <[email protected]>

This patch is adding i-g-t test case to test panel fitting usages.

---
 tests/.gitignore          |    1 +
 tests/Android.mk          |    1 +
 tests/Makefile.sources    |    1 +
 tests/kms_panel_fitting.c |  270 +++++++++++++++++++++++++++++++++++++++++++++
 4 files changed, 273 insertions(+)
 create mode 100644 tests/kms_panel_fitting.c
tests/.gitignore +1 -0
index d1381cd..ca588fa 100644
@@ -139,6 +139,7 @@ kms_sink_crc_basic
 kms_universal_plane
 kms_crtc_background_color
 kms_plane_scaling
+kms_panel_fitting
 multi-tests.txt
 pm_lpsp
 pm_psr
tests/Android.mk +1 -0
index c024296..ee508ec 100644
@@ -77,6 +77,7 @@ else
     kms_flip_event_leak \
     kms_crtc_background_color \
     kms_plane_scaling \
+    kms_panel_fitting \
     kms_pwrite_crc
     IGT_LOCAL_CFLAGS += -DANDROID_HAS_CAIRO=0
 endif
tests/Makefile.sources +1 -0
index 460df02..6e6cad0 100644
@@ -79,6 +79,7 @@ TESTS_progs_M = \
 	kms_universal_plane \
 	kms_crtc_background_color \
 	kms_plane_scaling \
+	kms_panel_fitting \
 	pm_lpsp \
 	pm_rpm \
 	pm_rps \
tests/kms_panel_fitting.c new file +270 -0

270 lines not on this page · raw message

Signature · 6 lines
1.7.9.5

_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
#4 lore raw

PATCH 2/2 i-g-t: Adding panel fitting test case

From: chandra konduru <[email protected]>

This patch is adding i-g-t test case to test panel fitting usages.

v2:
-use new tiled types when calling igt_create_fb (me)

---
 tests/.gitignore          |    1 +
 tests/Android.mk          |    1 +
 tests/Makefile.sources    |    1 +
 tests/kms_panel_fitting.c |  270 +++++++++++++++++++++++++++++++++++++++++++++
 4 files changed, 273 insertions(+)
 create mode 100644 tests/kms_panel_fitting.c
tests/.gitignore +1 -0
index 0d03fbe..59b12ee 100644
@@ -143,6 +143,7 @@ kms_universal_plane
 kms_vblank
 kms_crtc_background_color
 kms_plane_scaling
+kms_panel_fitting
 multi-tests.txt
 pm_lpsp
 pm_rc6_residency
tests/Android.mk +1 -0
index c024296..ee508ec 100644
@@ -77,6 +77,7 @@ else
     kms_flip_event_leak \
     kms_crtc_background_color \
     kms_plane_scaling \
+    kms_panel_fitting \
     kms_pwrite_crc
     IGT_LOCAL_CFLAGS += -DANDROID_HAS_CAIRO=0
 endif
tests/Makefile.sources +1 -0
index a04c31e..ab1f40e 100644
@@ -84,6 +84,7 @@ TESTS_progs_M = \
 	kms_vblank \
 	kms_crtc_background_color \
 	kms_plane_scaling \
+	kms_panel_fitting \
 	pm_lpsp \
 	pm_rpm \
 	pm_rps \
tests/kms_panel_fitting.c new file +270 -0

270 lines not on this page · raw message

Signature · 6 lines
1.7.9.5

_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx