[Intel-gfx] [PATCH 2/2] i-g-t: Adding panel fitting test case
From: chandra konduru chandra.kond...@intel.com 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) Signed-off-by: chandra konduru chandra.kond...@intel.com --- 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 diff --git a/tests/.gitignore b/tests/.gitignore index 0d03fbe..59b12ee 100644 --- a/tests/.gitignore +++ b/tests/.gitignore @@ -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 diff --git a/tests/Android.mk b/tests/Android.mk index c024296..ee508ec 100644 --- a/tests/Android.mk +++ b/tests/Android.mk @@ -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 diff --git a/tests/Makefile.sources b/tests/Makefile.sources index a04c31e..ab1f40e 100644 --- a/tests/Makefile.sources +++ b/tests/Makefile.sources @@ -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 \ diff --git a/tests/kms_panel_fitting.c b/tests/kms_panel_fitting.c new file mode 100644 index 000..d541091 --- /dev/null +++ b/tests/kms_panel_fitting.c @@ -0,0 +1,270 @@ +/* + * 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 panel fitting); + +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_XRGB, + LOCAL_I915_FORMAT_MOD_X_TILED, /* tiled */ + data-fb1); + igt_assert(data-fb_id1); + +
[Intel-gfx] [PATCH 2/2] i-g-t: Adding panel fitting test case
From: chandra konduru chandra.kond...@intel.com This patch is adding i-g-t test case to test panel fitting usages. Signed-off-by: chandra konduru chandra.kond...@intel.com --- 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 diff --git a/tests/.gitignore b/tests/.gitignore index d1381cd..ca588fa 100644 --- a/tests/.gitignore +++ b/tests/.gitignore @@ -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 diff --git a/tests/Android.mk b/tests/Android.mk index c024296..ee508ec 100644 --- a/tests/Android.mk +++ b/tests/Android.mk @@ -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 diff --git a/tests/Makefile.sources b/tests/Makefile.sources index 460df02..6e6cad0 100644 --- a/tests/Makefile.sources +++ b/tests/Makefile.sources @@ -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 \ diff --git a/tests/kms_panel_fitting.c b/tests/kms_panel_fitting.c new file mode 100644 index 000..84e63d5 --- /dev/null +++ b/tests/kms_panel_fitting.c @@ -0,0 +1,270 @@ +/* + * 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 panel fitting); + +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_XRGB, + true, /* tiled */ + data-fb1); + igt_assert(data-fb_id1); + + paint_color(data, data-fb1, mode-hdisplay, mode-vdisplay); + + /* +*