tests/kms_sink_crc_basic: Basic test to verify Sink CRC debugfs.
PATCH 1/2 tests/kms_sink_crc_basic: Basic test to verify Sink CRC debugfs.
v2: rebase after a long time.
--- tests/Android.mk | 1 + tests/Makefile.sources | 1 + tests/kms_sink_crc_basic.c | 201 +++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 203 insertions(+) create mode 100644 tests/kms_sink_crc_basic.c
tests/Android.mk +1 -0
@@ -66,6 +66,7 @@ else kms_pipe_crc_basic \ kms_fbc_crc \ kms_setmode \ + kms_sink_crc_basic \ gem_render_copy \ pm_lpsp \ kms_fence_pin_leak
tests/Makefile.sources +1 -0
@@ -68,6 +68,7 @@ TESTS_progs_M = \ kms_plane \ kms_render \ kms_setmode \ + kms_sink_crc_basic \ pm_lpsp \ pm_pc8 \ pm_rps \
tests/kms_sink_crc_basic.c new file +201 -0
201 lines not on this page · raw message
Signature · 6 lines
1.9.0 _______________________________________________ Intel-gfx mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/intel-gfx
PATCH 2/2 tests/kms_psr_sink_crc: Create test to test PSR by checking panel CRC.
v2: Wait psr enable with timeout and more subtest added.
v3: Add wait for v_blank leeting test more reliable and preparing to
add Baytrail per-pipe tests.
v4: Call busy_ioctl on mmap_gtt to match the real usage and remove the need
of inactivate on set_domain, what was semantically wrong.
v5: Adding more test cases to cover mmap_gtt with and without followed by
busy ioctl and also without busy and waiting 10 seconds between set_domain and actual write.
v6: rebase after kms_plane added and debugfs api changed.
Plus adding more test cases.
v7: Some rework and sprite test added
--- tests/Android.mk | 1 + tests/Makefile.sources | 1 + tests/kms_psr_sink_crc.c | 623 +++++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 625 insertions(+) create mode 100644 tests/kms_psr_sink_crc.c
tests/Android.mk +1 -0
@@ -64,6 +64,7 @@ else kms_flip \ kms_flip_tiling \ kms_pipe_crc_basic \ + kms_psr_sink_crc \ kms_fbc_crc \ kms_setmode \ kms_sink_crc_basic \
tests/Makefile.sources +1 -0
@@ -66,6 +66,7 @@ TESTS_progs_M = \ kms_flip_tiling \ kms_pipe_crc_basic \ kms_plane \ + kms_psr_sink_crc \ kms_render \ kms_setmode \ kms_sink_crc_basic \
tests/kms_psr_sink_crc.c new file +623 -0
623 lines not on this page · raw message
Signature · 6 lines
1.9.0 _______________________________________________ Intel-gfx mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/intel-gfx
Quoted 3 lines · Rodrigo Vivi
v2: rebase after a long time.
Signed-off-by Rodrigo Vivi <[email protected]>
Oh dear, the basic test was completely lost when we've merged the sink_crc debugfs support :( Applied now, thanks for the patch.
One comment below.
Quoted 200 lines
--- tests/Android.mk | 1 + tests/Makefile.sources | 1 + tests/kms_sink_crc_basic.c | 201 +++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 203 insertions(+) create mode 100644 tests/kms_sink_crc_basic.ctests/Android.mk +1
-0@@ -66,6 +66,7 @@ else kms_pipe_crc_basic \ kms_fbc_crc \ kms_setmode \ + kms_sink_crc_basic \ gem_render_copy \ pm_lpsp \ kms_fence_pin_leaktests/Makefile.sources +1
-0@@ -68,6 +68,7 @@ TESTS_progs_M = \ kms_plane \ kms_render \ kms_setmode \ + kms_sink_crc_basic \ pm_lpsp \ pm_pc8 \ pm_rps \tests/kms_sink_crc_basic.c new file +163
-0@@ -0,0 +1,201 @@ +/* +* Copyright © 2013 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 <errno.h> +#include <limits.h> +#include <stdbool.h> +#include <stdio.h> +#include <string.h> + +#include "drm_fourcc.h" + +#include "drmtest.h" +#include "igt_debugfs.h" +#include "igt_kms.h" + +enum color { +WHITE , +BLACK , +NUM_COLORS , +}; + +typedef struct { +struct kmstest_connector_config config; +struct igt_fb fb; +}connector_t ; + +typedef struct { +int drm_fd; +drmModeRes *resources; +}data_t ; + +static void get_crc (char *crc) { +int ret; +FILE *file =fopen ("/sys/kernel/debug/dri/0/i915_sink_crc_eDP1" ,"r" ); +igt_require (file); + + ret =fscanf (file,"%s\n" , crc); +igt_require (ret >0 ); + +fclose (file); +} + +static uint32_t create_fb (data_t *data, +int w,int h, +double r,double g,double b, +struct igt_fb *fb) +{ +cairo_t *cr; +uint32_t fb_id; + + fb_id =igt_create_fb (data->drm_fd, w, h, +DRM_FORMAT_XRGB8888 , false, fb); +igt_assert (fb_id); + + cr =igt_get_cairo_ctx (data->drm_fd, fb); +igt_paint_color (cr,0 ,0 , w, h, r, g, b); +igt_assert (cairo_status (cr) ==0 ); + +return fb_id; +} + +static bool +connector_set_mode (data_t *data,connector_t *connector,drmModeModeInfo *mode, +enum color crtc_color) +{ +struct kmstest_connector_config *config = &connector->config; +unsigned int fb_id; +int ret; + +if (crtc_color ==WHITE ) + fb_id =create_fb (data, mode->hdisplay, mode->vdisplay, +1.0 ,1.0 ,1.0 , &connector->fb); +else + fb_id =create_fb (data, mode->hdisplay, mode->vdisplay, +0.0 ,0.0 ,0.0 , &connector->fb); +igt_assert (fb_id); + + ret =drmModeSetCrtc (data->drm_fd, + config->crtc->crtc_id, + connector->fb.fb_id, +0 ,0 ,/* x, y */ + &config->connector->connector_id, +1 , + mode); +igt_assert (ret ==0 ); + +return 0 ; +} + +static void basic_sink_crc_check (data_t *data,uint32_t connector_id) +{ +connector_t connector; +int ret; +char ref_crc_white[12 ]; +char ref_crc_black[12 ]; +char crc_check[12 ]; + + ret =kmstest_get_connector_config (data->drm_fd, + connector_id, +1 <<0 , + &connector.config); +igt_require (ret ==0 ); + +/*Go White*/ +connector_set_mode (data, &connector, &connector.config.default_mode,WHITE ); + +/* get reference crc for white color */ +get_crc (ref_crc_white); + +/* Go Black */ +connector_set_mode (data, &connector, &connector.config.default_mode,BLACK ); + +/* get reference crc for black color */ +get_crc (ref_crc_black); + +if (strcmp (ref_crc_black, ref_crc_white) ==0 ) { +fprintf (stderr,"CRC Black should differ from CRC White\n" ); +igt_fail (1 ); + } + +/*Go White again*/ +connector_set_mode (data, &connector, &connector.config.default_mode,WHITE ); + +get_crc (crc_check); +if (strcmp (crc_check, ref_crc_white) !=0 ) { +fprintf (stderr,"CRC check for white differ from reference\n" ); +igt_fail (1 ); + } + +/* Go Black again */ +connector_set_mode (data, &connector, &connector.config.default_mode,BLACK ); + +get_crc (crc_check); +if (strcmp (crc_check, ref_crc_black) !=0 ) { +fprintf (stderr,"CRC check for black differ from reference\n" ); +igt_fail (1 ); + } + +kmstest_free_connector_config (&connector.config); +} + +static void run_test (data_t *data)
tests/kms_sink_crc_basic.c line 173
Quoted 10 lines
tests/kms_sink_crc_basic.c new file +10
-0+{ +int i; +drmModeConnectorPtr c; +uint32_t connector_id =0 ; + +for (i =0 ; i < data->resources->count_connectors; i++) { + connector_id = data->resources->connectors[i]; + c =drmModeGetConnector (data->drm_fd, connector_id); + + if (c->connector_type != DRM_MODE_CONNECTOR_eDP ||
Just one comment here: Do we really need to check for edp here (same for the kernel btw)? Afaik sink crc is a generic DP feature, but obligatory for edp with psr. So would make sense to also run the basic test on other DP ports, just to give it a bit more testing.
-Daniel
Quoted 35 lines
tests/kms_sink_crc_basic.c new file +28
-0+ c->connection != DRM_MODE_CONNECTED) +continue ; + +basic_sink_crc_check (data, connector_id); +return ; + } + +fprintf (stderr,"no eDP with CRC support found\n" ); +igt_fail (1 ); +} + +igt_simple_main +{ +data_t data = {}; + +igt_skip_on_simulation (); + + data.drm_fd =drm_open_any (); + +igt_set_vt_graphics_mode (); + + data.resources =drmModeGetResources (data.drm_fd); +igt_assert (data.resources); + +run_test (&data); + +drmModeFreeResources (data.resources); +}Signature · 6 lines
1.9.0 _______________________________________________ Intel-gfx mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/intel-gfx
Signature · 3 lines
Daniel Vetter Software Engineer, Intel Corporation +41 (0) 79 365 57 48 - http://blog.ffwll.ch