test/amdgpu: Test max-bpc fallback for 4K modes on HDMI
PATCH 1/1 test/amdgpu: Test max-bpc fallback for 4K modes on HDMI
[Why]
There was a driver regression with which too high max-bpc setting causes 4K video modes failing stream validation and dropped from mode list.
[How]
Add this test to catch the regression.
--- tests/amdgpu/amd_max_bpc.c | 190 +++++++++++++++++++++++++++++++++++++ tests/amdgpu/meson.build | 1 + 2 files changed, 191 insertions(+) create mode 100644 tests/amdgpu/amd_max_bpc.c
tests/amdgpu/amd_max_bpc.c new file +190 -0
@@ -0,0 +1,190 @@ +/* +* Copyright 2021 Advanced Micro Devices, Inc. +* +* 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 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 COPYRIGHT HOLDER(S) OR AUTHOR(S) 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 "igt.h" +#include <fcntl.h> + +IGT_TEST_DESCRIPT ("Test 4K HDMI regression if max bpc is too high" ); + +/* Common test data. */ +typedef struct data { +igt_display_t display; +igt_plane_t *primary; +igt_output_t *output; +igt_pipe_t *pipe; +igt_pipe_crc_t *pipe_crc; +igt_pipe_crc_t *pipe_crc_dither; +drmModeModeInfo *mode; +enum pipe pipe_id; +int fd; +int w; +int h; +}data_t ; + +/* BPC connector state. */ +typedef struct output_bpc { +unsigned int current; +unsigned int maximum; +}output_bpc_t ; + +static drmModeModeInfo uhd_mode = { +594000 , +3840 ,4016 ,4104 ,4400 ,0 , +2160 ,2168 ,2178 ,2250 ,0 , +60 ,0x5 |DRM_MODE_FLAG_PIC_AR_64_27 , +0x40 , +"3840x2160@60" ,/* VIC 107 */ + }; + +/* Returns the current and maximum bpc from the connector debugfs. */ +static output_bpc_t get_output_bpc (data_t *data) +{ +char buf[256 ]; +char *start_loc; +int fd, res; +output_bpc_t info; + + fd =igt_debugfs_connector_dir (data->fd, data->output->name,O_RDONLY ); +igt_assert (fd >=0 ); + + res =igt_debugfs_simple_read (fd,"output_bpc" , buf,sizeof (buf)); + +igt_require (res >0 ); + +close (fd); + +igt_assert (start_loc =strstr (buf,"Current: " )); +igt_assert_eq (sscanf (start_loc,"Current: %u" , &info.current),1 ); + +igt_assert (start_loc =strstr (buf,"Maximum: " )); +igt_assert_eq (sscanf (start_loc,"Maximum: %u" , &info.maximum),1 ); + +return info; +} + +/* Verifies that connector has the correct output bpc. */ +static void assert_output_bpc (data_t *data,unsigned int bpc) +{ +output_bpc_t info =get_output_bpc (data); + +igt_require_f (info.maximum >= bpc, +"Monitor doesn't support %u bpc, max is %u\n" , bpc, + info.maximum); + +igt_assert_eq (info.current, bpc); +} + +/* Common test setup. */ +static void test_init (data_t *data) +{ +igt_display_t *display = &data->display; + +/* It doesn't matter which pipe we choose on amdpgu. */ + data->pipe_id =PIPE_A ; + data->pipe = &data->display.pipes[data->pipe_id]; + +igt_display_reset (display); + +/* find a connected HDMI output */ + data->output =NULL ; +for (int i=0 ; i < data->display.n_outputs; ++i) { +drmModeConnector *connector = data->display.outputs[i].config.connector; +if (connector->connection ==DRM_MODE_CONNECTED && + (connector->connector_type ==DRM_MODE_CONNECTOR_HDMIA )) { + data->output = &data->display.outputs[i]; + } + } +igt_assert_f (data->output,"Requires connected HDMI output\n" ); + +igt_output_set_prop_value (data->output,IGT_CONNECTOR_MAX_BPC ,10 ); +igt_output_override_mode (data->output, &uhd_mode); + + data->mode =igt_output_get_mode (data->output); +igt_assert (data->mode); +assert_output_bpc (data,8 ); + + data->primary = +igt_pipe_get_plane_type (data->pipe,DRM_PLANE_TYPE_PRIMARY ); + + data->pipe_crc =igt_pipe_crc_new (data->fd, data->pipe_id, +INTEL_PIPE_CRC_SOURCE_AUTO ); + +igt_output_set_pipe (data->output, data->pipe_id); + + data->w = data->mode->hdisplay; + data->h = data->mode->vdisplay; +} + +/* Common test cleanup. */ +static void test_fini (data_t *data) +{ +igt_pipe_crc_free (data->pipe_crc); +igt_display_reset (&data->display); +} + +static void test_4k_mode_max_bpc (data_t *data) +{ +igt_display_t *display = &data->display; +igt_fb_t rfb; +int max_bpc =16 ; + +test_init (data); + +igt_info ("Setting output max bpc to %d\n" , max_bpc); + +igt_output_set_prop_value (data->output,IGT_CONNECTOR_MAX_BPC , max_bpc); + +igt_create_pattern_fb (data->fd, data->w, data->h,DRM_FORMAT_XRGB8888 ,0 , &rfb); +igt_plane_set_fb (data->primary, &rfb); +igt_display_commit_atomic (display,DRM_MODE_ATOMIC_ALLOW_MODESET ,NULL ); + +test_fini (data); +igt_remove_fb (data->fd, &rfb); +} + +igt_main +{ +data_t data; + +igt_skip_on_simulation (); + +memset (&data,0 ,sizeof (data)); + + igt_fixture + { + data.fd =drm_open_driver_master (DRIVER_AMDGPU ); + +kmstest_set_vt_graphics_mode (); + +igt_display_require (&data.display, data.fd); +igt_require (data.display.is_atomic); +igt_display_require_output (&data.display); + } + +igt_describe ("Tests overly high 'max bpc' should not affect 4K modes on HDMI" ); + igt_subtest("4k-mode-max-bpc") test_4k_mode_max_bpc(&data); + + igt_fixture + { +igt_display_fini (&data.display); + } +}
tests/amdgpu/meson.build +1 -0
@@ -11,6 +11,7 @@ if libdrm_amdgpu.found() 'amd_hotplug', 'amd_info', 'amd_prime', + 'amd_max_bpc', 'amd_module_load', 'amd_mem_leak', 'amd_link_settings',
Signature · 1 line
2.32.0
Patchwork
CI[igt-dev] ✗ Fi.CI.BUILD: failure for test/amdgpu: Test max-bpc fallback for 4K modes on HDMI
== Series Details ==
== Series Details ==
Series: test/amdgpu: Test max-bpc fallback for 4K modes on HDMI
URL : https://patchwork.freedesktop.org/series/95188/
State : failure
== Summary ==
IGT patchset build failed on latest successful build 6ac2da7fd6b13f04f9aa0ec10f86b831d2756946 lib/intel_batchbuffer: Remove duplicated assignment
[303/433] Linking target tests/kms_busy.
[304/433] Linking target tests/kms_ccs.
[305/433] Linking target tests/kms_cdclk.
[306/433] Linking target tests/kms_dsc.
[307/433] Linking target tests/kms_fbcon_fbt.
[308/433] Linking target tests/kms_fence_pin_leak.
[309/433] Linking target tests/kms_flip_scaled_crc.
[310/433] Linking target tests/kms_flip_tiling.
[311/433] Linking target tests/kms_frontbuffer_tracking.
[312/433] Linking target tests/kms_mmap_write_crc.
[313/433] Linking target tests/kms_legacy_colorkey.
[314/433] Linking target tests/kms_pipe_b_c_ivb.
[315/433] Linking target tests/kms_psr2_su.
[316/433] Linking target tests/kms_psr2_sf.
[317/433] Linking target tests/kms_pwrite_crc.
[318/433] Linking target tests/sysfs_clients.
[319/433] Linking target tests/sysfs_defaults.
[320/433] Linking target tests/sysfs_preempt_timeout.
[321/433] Linking target tests/sysfs_heartbeat_interval.
[322/433] Linking target tests/dumb_buffer.
[323/433] Linking target tests/sysfs_timeslice_duration.
[324/433] Linking target tests/gem_ctx_sseu.
[325/433] Linking target tests/gem_create.
[326/433] Linking target tests/gem_ctx_freq.
[327/433] Linking target tests/gem_eio.
[328/433] Linking target tests/gem_mmap_offset.
[329/433] Linking target tests/gem_exec_balancer.
[330/433] Linking target tests/kms_color_chamelium.
[331/433] Linking target tests/i915_pm_rc6_residency.
[332/433] Linking target tests/core_hotunplug.
[333/433] Linking target tests/perf_pmu.
[334/433] Linking target tests/perf.
[335/433] Linking target tests/testdisplay.
[336/433] Linking target tests/kms_color.
[337/433] Linking target tests/sw_sync.
[338/433] Linking target tests/amdgpu/amd_assr.
[339/433] Linking target tests/amdgpu/amd_abm.
[340/433] Linking target tests/amdgpu/amd_color.
[341/433] Linking target tests/amdgpu/amd_basic.
[342/433] Linking target tests/amdgpu/amd_bypass.
[343/433] Linking target tests/amdgpu/amd_cs_nop.
[344/433] Linking target tests/amdgpu/amd_info.
[345/433] Linking target tests/amdgpu/amd_hotplug.
[346/433] Compiling C object 'tests/amdgpu/tests@amdgpu@@amd_max_bpc@exe/amd_max_bpc.c.o'.
FAILED: tests/amdgpu/tests@amdgpu@@amd_max_bpc@exe/amd_max_bpc.c.o
ccache cc -Itests/amdgpu/tests@amdgpu@@amd_max_bpc@exe -Itests/amdgpu -I../tests/amdgpu -I../include/drm-uapi -Ilib -I../lib -I../lib/stubs/syscalls -I. -I../ -I/usr/include/cairo -I/usr/include/glib-2.0 -I/usr/lib/x86_64-linux-gnu/glib-2.0/include -I/usr/include/pixman-1 -I/usr/include/libpng16 -I/usr/include/freetype2 -I/usr/include/libpng12 -I/usr/include/libdrm -I/usr/include/libdrm/nouveau -I/usr/include/x86_64-linux-gnu -I/usr/include/alsa -I/usr/include -I/home/cidrm/kernel_headers/include -fdiagnostics-color=always -pipe -D_FILE_OFFSET_BITS=64 -Wall -Winvalid-pch -Wextra -std=gnu11 -O2 -g -D_GNU_SOURCE -include config.h -D_FORTIFY_SOURCE=2 -Wbad-function-cast -Wdeclaration-after-statement -Wformat=2 -Wimplicit-fallthrough=0 -Wlogical-op -Wmissing-declarations -Wmissing-format-attribute -Wmissing-noreturn -Wmissing-prototypes -Wnested-externs -Wold-style-definition -Wpointer-arith -Wredundant-decls -Wshadow -Wstrict-prototypes -Wuninitialized -Wunused -Wno-clobbered -Wno-maybe-uninitialized -Wno-missing-field-initializers -Wno-pointer-arith -Wno-sign-compare -Wno-type-limits -Wno-unused-parameter -Wno-unused-result -Werror=address -Werror=array-bounds -Werror=implicit -Werror=init-self -Werror=int-to-pointer-cast -Werror=main -Werror=missing-braces -Werror=nonnull -Werror=pointer-to-int-cast -Werror=return-type -Werror=sequence-point -Werror=trigraphs -Werror=write-strings -fno-builtin-malloc -fno-builtin-calloc -fcommon -pthread -MD -MQ 'tests/amdgpu/tests@amdgpu@@amd_max_bpc@exe/amd_max_bpc.c.o' -MF 'tests/amdgpu/tests@amdgpu@@amd_max_bpc@exe/amd_max_bpc.c.o.d' -o 'tests/amdgpu/tests@amdgpu@@amd_max_bpc@exe/amd_max_bpc.c.o' -c ../tests/amdgpu/amd_max_bpc.c ../tests/amdgpu/amd_max_bpc.c:26:19: error: expected declaration specifiers or ‘...’ before string constant
IGT_TEST_DESCRIPT("Test 4K HDMI regression if max bpc is too high");
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
ninja: build stopped: subcommand failed.
Patchwork
CI[igt-dev] ✗ GitLab.Pipeline: warning for test/amdgpu: Test max-bpc fallback for 4K modes on HDMI
In reply to Stylon Wang== Series Details ==
== Series Details ==
Series: test/amdgpu: Test max-bpc fallback for 4K modes on HDMI
URL : https://patchwork.freedesktop.org/series/95188/
State : warning
== Summary ==
Pipeline status: FAILED.
see https://gitlab.freedesktop.org/gfx-ci/igt-ci-tags/-/pipelines/411416 for the overview.
build:tests-debian-meson has failed (https://gitlab.freedesktop.org/gfx-ci/igt-ci-tags/-/jobs/14118993):
[885/1119] Compiling C object 'tests/amdgpu/b9f2b1d@@amd_link_settings@exe/amd_link_settings.c.o'.
ninja: build stopped: subcommand failed.
ninja: Entering directory `build'
[1/534] Generating version.h with a custom command.
[2/236] Linking target tests/perf_pmu.
[3/236] Linking target tests/perf.
[4/236] Linking target tests/amdgpu/amd_module_load.
[5/236] Compiling C object 'tests/amdgpu/b9f2b1d@@amd_max_bpc@exe/amd_max_bpc.c.o'.
FAILED: tests/amdgpu/b9f2b1d@@amd_max_bpc@exe/amd_max_bpc.c.o
cc -Itests/amdgpu/b9f2b1d@@amd_max_bpc@exe -Itests/amdgpu -I../tests/amdgpu -I../include/drm-uapi -Ilib -I../lib -I../lib/stubs/syscalls -I. -I../ -I/usr/include/cairo -I/usr/include/glib-2.0 -I/usr/lib/x86_64-linux-gnu/glib-2.0/include -I/usr/include/pixman-1 -I/usr/include/uuid -I/usr/include/freetype2 -I/usr/include/libpng16 -I/usr/include/libdrm -I/usr/include/libdrm/nouveau -I/usr/include/x86_64-linux-gnu -I/usr/include/valgrind -I/usr/include/alsa -I/usr/include -fdiagnostics-color=always -pipe -D_FILE_OFFSET_BITS=64 -Wall -Winvalid-pch -Wextra -std=gnu11 -O2 -g -D_GNU_SOURCE -include config.h -D_FORTIFY_SOURCE=2 -Wbad-function-cast -Wdeclaration-after-statement -Wformat=2 -Wimplicit-fallthrough=0 -Wlogical-op -Wmissing-declarations -Wmissing-format-attribute -Wmissing-noreturn -Wmissing-prototypes -Wnested-externs -Wold-style-definition -Wpointer-arith -Wredundant-decls -Wshadow -Wstrict-prototypes -Wuninitialized -Wunused -Wno-clobbered -Wno-maybe-uninitialized -Wno-missing-field-initializers -Wno-pointer-arith -Wno-sign-compare -Wno-type-limits -Wno-unused-parameter -Wno-unused-result -Werror=address -Werror=array-bounds -Werror=implicit -Werror=init-self -Werror=int-to-pointer-cast -Werror=main -Werror=missing-braces -Werror=nonnull -Werror=pointer-to-int-cast -Werror=return-type -Werror=sequence-point -Werror=trigraphs -Werror=write-strings -fno-builtin-malloc -fno-builtin-calloc -fcommon -pthread -MD -MQ 'tests/amdgpu/b9f2b1d@@amd_max_bpc@exe/amd_max_bpc.c.o' -MF 'tests/amdgpu/b9f2b1d@@amd_max_bpc@exe/amd_max_bpc.c.o.d' -o 'tests/amdgpu/b9f2b1d@@amd_max_bpc@exe/amd_max_bpc.c.o' -c ../tests/amdgpu/amd_max_bpc.c ../tests/amdgpu/amd_max_bpc.c:26:19: error: expected declaration specifiers or ‘...’ before string constant
IGT_TEST_DESCRIPT("Test 4K HDMI regression if max bpc is too high");
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
ninja: build stopped: subcommand failed.
section_end:1632893393:step_script
section_start:1632893393:cleanup_file_variables
Cleaning up file based variables
section_end:1632893395:cleanup_file_variables
ERROR: Job failed: exit code 1
build:tests-debian-meson-arm64 has failed (https://gitlab.freedesktop.org/gfx-ci/igt-ci-tags/-/jobs/14118996):
[867/1055] Compiling C object 'tests/amdgpu/b9f2b1d@@amd_mem_leak@exe/amd_mem_leak.c.o'.
[868/1055] Compiling C object 'tests/amdgpu/b9f2b1d@@amd_vrr_range@exe/amd_vrr_range.c.o'.
[869/1055] Compiling C object 'tests/59830eb@@perf@exe/i915_perf.c.o'.
[870/1055] Compiling C object 'tests/59830eb@@gem_concurrent_all@exe/i915_gem_concurrent_all.c.o'.
ninja: build stopped: subcommand failed.
ninja: Entering directory `build'
[1/481] Generating version.h with a custom command.
[2/187] Linking target tests/perf.
[3/187] Compiling C object 'tests/amdgpu/b9f2b1d@@amd_max_bpc@exe/amd_max_bpc.c.o'.
FAILED: tests/amdgpu/b9f2b1d@@amd_max_bpc@exe/amd_max_bpc.c.o
/usr/bin/aarch64-linux-gnu-gcc -Itests/amdgpu/b9f2b1d@@amd_max_bpc@exe -Itests/amdgpu -I../tests/amdgpu -I../include/drm-uapi -Ilib -I../lib -I../lib/stubs/syscalls -I. -I../ -I../lib/stubs/drm -I/usr/include/cairo -I/usr/include/glib-2.0 -I/usr/lib/aarch64-linux-gnu/glib-2.0/include -I/usr/include/pixman-1 -I/usr/include/uuid -I/usr/include/freetype2 -I/usr/include/libpng16 -I/usr/include/libdrm -I/usr/include/libdrm/nouveau -I/usr/include/aarch64-linux-gnu -I/usr/include/valgrind -I/usr/include/alsa -fdiagnostics-color=always -pipe -D_FILE_OFFSET_BITS=64 -Wall -Winvalid-pch -Wextra -std=gnu11 -O2 -g -D_GNU_SOURCE -include config.h -D_FORTIFY_SOURCE=2 -Wbad-function-cast -Wdeclaration-after-statement -Wformat=2 -Wimplicit-fallthrough=0 -Wlogical-op -Wmissing-declarations -Wmissing-format-attribute -Wmissing-noreturn -Wmissing-prototypes -Wnested-externs -Wold-style-definition -Wpointer-arith -Wredundant-decls -Wshadow -Wstrict-prototypes -Wuninitialized -Wunused -Wno-clobbered -Wno-maybe-uninitialized -Wno-missing-field-initializers -Wno-pointer-arith -Wno-sign-compare -Wno-type-limits -Wno-unused-parameter -Wno-unused-result -Werror=address -Werror=array-bounds -Werror=implicit -Werror=init-self -Werror=int-to-pointer-cast -Werror=main -Werror=missing-braces -Werror=nonnull -Werror=pointer-to-int-cast -Werror=return-type -Werror=sequence-point -Werror=trigraphs -Werror=write-strings -fno-builtin-malloc -fno-builtin-calloc -fcommon -pthread -MD -MQ 'tests/amdgpu/b9f2b1d@@amd_max_bpc@exe/amd_max_bpc.c.o' -MF 'tests/amdgpu/b9f2b1d@@amd_max_bpc@exe/amd_max_bpc.c.o.d' -o 'tests/amdgpu/b9f2b1d@@amd_max_bpc@exe/amd_max_bpc.c.o' -c ../tests/amdgpu/amd_max_bpc.c ../tests/amdgpu/amd_max_bpc.c:26:19: error: expected declaration specifiers or ‘...’ before string constant
IGT_TEST_DESCRIPT("Test 4K HDMI regression if max bpc is too high");
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
ninja: build stopped: subcommand failed.
section_end:1632893396:step_script
section_start:1632893396:cleanup_file_variables
Cleaning up file based variables
section_end:1632893397:cleanup_file_variables
ERROR: Job failed: exit code 1
build:tests-debian-meson-armhf has failed (https://gitlab.freedesktop.org/gfx-ci/igt-ci-tags/-/jobs/14118995):
ninja: build stopped: subcommand failed.
ninja: Entering directory `build'
[1/479] Generating version.h with a custom command.
[2/186] Linking target tests/perf_pmu.
[3/186] Linking target tests/perf.
[4/186] Linking target tests/amdgpu/amd_basic.
[5/186] Linking target tests/amdgpu/amd_prime.
[6/186] Compiling C object 'tests/amdgpu/b9f2b1d@@amd_max_bpc@exe/amd_max_bpc.c.o'.
FAILED: tests/amdgpu/b9f2b1d@@amd_max_bpc@exe/amd_max_bpc.c.o
/usr/bin/arm-linux-gnueabihf-gcc -Itests/amdgpu/b9f2b1d@@amd_max_bpc@exe -Itests/amdgpu -I../tests/amdgpu -I../include/drm-uapi -Ilib -I../lib -I../lib/stubs/syscalls -I. -I../ -I../lib/stubs/drm -I/usr/include/cairo -I/usr/include/glib-2.0 -I/usr/lib/arm-linux-gnueabihf/glib-2.0/include -I/usr/include/pixman-1 -I/usr/include/uuid -I/usr/include/freetype2 -I/usr/include/libpng16 -I/usr/include/libdrm -I/usr/include/libdrm/nouveau -I/usr/include/arm-linux-gnueabihf -I/usr/include/valgrind -I/usr/include/alsa -fdiagnostics-color=always -pipe -D_FILE_OFFSET_BITS=64 -Wall -Winvalid-pch -Wextra -std=gnu11 -O2 -g -D_GNU_SOURCE -include config.h -D_FORTIFY_SOURCE=2 -Wbad-function-cast -Wdeclaration-after-statement -Wformat=2 -Wimplicit-fallthrough=0 -Wlogical-op -Wmissing-declarations -Wmissing-format-attribute -Wmissing-noreturn -Wmissing-prototypes -Wnested-externs -Wold-style-definition -Wpointer-arith -Wredundant-decls -Wshadow -Wstrict-prototypes -Wuninitialized -Wunused -Wno-clobbered -Wno-maybe-uninitialized -Wno-missing-field-initializers -Wno-pointer-arith -Wno-sign-compare -Wno-type-limits -Wno-unused-parameter -Wno-unused-result -Werror=address -Werror=array-bounds -Werror=implicit -Werror=init-self -Werror=int-to-pointer-cast -Werror=main -Werror=missing-braces -Werror=nonnull -Werror=pointer-to-int-cast -Werror=return-type -Werror=sequence-point -Werror=trigraphs -Werror=write-strings -fno-builtin-malloc -fno-builtin-calloc -fcommon -pthread -MD -MQ 'tests/amdgpu/b9f2b1d@@amd_max_bpc@exe/amd_max_bpc.c.o' -MF 'tests/amdgpu/b9f2b1d@@amd_max_bpc@exe/amd_max_bpc.c.o.d' -o 'tests/amdgpu/b9f2b1d@@amd_max_bpc@exe/amd_max_bpc.c.o' -c ../tests/amdgpu/amd_max_bpc.c ../tests/amdgpu/amd_max_bpc.c:26:19: error: expected declaration specifiers or ‘...’ before string constant
IGT_TEST_DESCRIPT("Test 4K HDMI regression if max bpc is too high");
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
ninja: build stopped: subcommand failed.
section_end:1632893400:step_script
section_start:1632893400:cleanup_file_variables
Cleaning up file based variables
section_end:1632893401:cleanup_file_variables
ERROR: Job failed: exit code 1
build:tests-debian-meson-mips has failed (https://gitlab.freedesktop.org/gfx-ci/igt-ci-tags/-/jobs/14118997):
ninja: build stopped: subcommand failed.
ninja: Entering directory `build'
[1/472] Generating version.h with a custom command.
[2/176] Linking target tests/perf_pmu.
[3/176] Linking target tests/gem_exec_balancer.
[4/176] Linking target tests/perf.
[5/176] Compiling C object 'tests/amdgpu/b9f2b1d@@amd_max_bpc@exe/amd_max_bpc.c.o'.
FAILED: tests/amdgpu/b9f2b1d@@amd_max_bpc@exe/amd_max_bpc.c.o
/usr/bin/mips-linux-gnu-gcc -Itests/amdgpu/b9f2b1d@@amd_max_bpc@exe -Itests/amdgpu -I../tests/amdgpu -I../include/drm-uapi -Ilib -I../lib -I../lib/stubs/syscalls -I. -I../ -I../lib/stubs/drm -I/usr/include/cairo -I/usr/include/glib-2.0 -I/usr/lib/mips-linux-gnu/glib-2.0/include -I/usr/include/pixman-1 -I/usr/include/uuid -I/usr/include/freetype2 -I/usr/include/libpng16 -I/usr/include/libdrm -I/usr/include/libdrm/nouveau -I/usr/include/mips-linux-gnu -I/usr/include/valgrind -I/usr/include/alsa -fdiagnostics-color=always -pipe -D_FILE_OFFSET_BITS=64 -Wall -Winvalid-pch -Wextra -std=gnu11 -O2 -g -D_GNU_SOURCE -include config.h -D_FORTIFY_SOURCE=2 -Wbad-function-cast -Wdeclaration-after-statement -Wformat=2 -Wimplicit-fallthrough=0 -Wlogical-op -Wmissing-declarations -Wmissing-format-attribute -Wmissing-noreturn -Wmissing-prototypes -Wnested-externs -Wold-style-definition -Wpointer-arith -Wredundant-decls -Wshadow -Wstrict-prototypes -Wuninitialized -Wunused -Wno-clobbered -Wno-maybe-uninitialized -Wno-missing-field-initializers -Wno-pointer-arith -Wno-sign-compare -Wno-type-limits -Wno-unused-parameter -Wno-unused-result -Werror=address -Werror=array-bounds -Werror=implicit -Werror=init-self -Werror=int-to-pointer-cast -Werror=main -Werror=missing-braces -Werror=nonnull -Werror=pointer-to-int-cast -Werror=return-type -Werror=sequence-point -Werror=trigraphs -Werror=write-strings -fno-builtin-malloc -fno-builtin-calloc -fcommon -pthread -MD -MQ 'tests/amdgpu/b9f2b1d@@amd_max_bpc@exe/amd_max_bpc.c.o' -MF 'tests/amdgpu/b9f2b1d@@amd_max_bpc@exe/amd_max_bpc.c.o.d' -o 'tests/amdgpu/b9f2b1d@@amd_max_bpc@exe/amd_max_bpc.c.o' -c ../tests/amdgpu/amd_max_bpc.c ../tests/amdgpu/amd_max_bpc.c:26:19: error: expected declaration specifiers or ‘...’ before string constant
IGT_TEST_DESCRIPT("Test 4K HDMI regression if max bpc is too high");
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
ninja: build stopped: subcommand failed.
section_end:1632893366:step_script
section_start:1632893366:cleanup_file_variables
Cleaning up file based variables
section_end:1632893367:cleanup_file_variables
ERROR: Failed to cleanup volumes
ERROR: Job failed: exit code 1
build:tests-fedora has failed (https://gitlab.freedesktop.org/gfx-ci/igt-ci-tags/-/jobs/14118988):
[888/1119] Compiling C object 'tests/amdgpu/b9f2b1d@@amd_mem_leak@exe/amd_mem_leak.c.o'.
[889/1119] Compiling C object 'tests/amdgpu/b9f2b1d@@amd_vrr_range@exe/amd_vrr_range.c.o'.
[890/1119] Linking target tests/amdgpu/amd_module_load.
[891/1119] Linking target tests/amdgpu/amd_prime.
[892/1119] Compiling C object 'tests/amdgpu/b9f2b1d@@amd_link_settings@exe/amd_link_settings.c.o'.
ninja: build stopped: subcommand failed.
ninja: Entering directory `build'
[1/529] Generating version.h with a custom command.
[2/229] Compiling C object 'tests/amdgpu/b9f2b1d@@amd_max_bpc@exe/amd_max_bpc.c.o'.
FAILED: tests/amdgpu/b9f2b1d@@amd_max_bpc@exe/amd_max_bpc.c.o
cc -Itests/amdgpu/b9f2b1d@@amd_max_bpc@exe -Itests/amdgpu -I../tests/amdgpu -I../include/drm-uapi -Ilib -I../lib -I../lib/stubs/syscalls -I. -I../ -I/usr/include/cairo -I/usr/include/glib-2.0 -I/usr/lib64/glib-2.0/include -I/usr/include/pixman-1 -I/usr/include/freetype2 -I/usr/include/libpng16 -I/usr/include/libdrm -I/usr/include/libdrm/nouveau -I/usr/include/valgrind -fdiagnostics-color=always -pipe -D_FILE_OFFSET_BITS=64 -Wall -Winvalid-pch -Wextra -std=gnu11 -O2 -g -D_GNU_SOURCE -include config.h -D_FORTIFY_SOURCE=2 -Wbad-function-cast -Wdeclaration-after-statement -Wformat=2 -Wimplicit-fallthrough=0 -Wlogical-op -Wmissing-declarations -Wmissing-format-attribute -Wmissing-noreturn -Wmissing-prototypes -Wnested-externs -Wold-style-definition -Wpointer-arith -Wredundant-decls -Wshadow -Wstrict-prototypes -Wuninitialized -Wunused -Wno-clobbered -Wno-maybe-uninitialized -Wno-missing-field-initializers -Wno-pointer-arith -Wno-address-of-packed-member -Wno-sign-compare -Wno-type-limits -Wno-unused-parameter -Wno-unused-result -Werror=address -Werror=array-bounds -Werror=implicit -Werror=init-self -Werror=int-to-pointer-cast -Werror=main -Werror=missing-braces -Werror=nonnull -Werror=pointer-to-int-cast -Werror=return-type -Werror=sequence-point -Werror=trigraphs -Werror=write-strings -fno-builtin-malloc -fno-builtin-calloc -fcommon -pthread -MD -MQ 'tests/amdgpu/b9f2b1d@@amd_max_bpc@exe/amd_max_bpc.c.o' -MF 'tests/amdgpu/b9f2b1d@@amd_max_bpc@exe/amd_max_bpc.c.o.d' -o 'tests/amdgpu/b9f2b1d@@amd_max_bpc@exe/amd_max_bpc.c.o' -c ../tests/amdgpu/amd_max_bpc.c ../tests/amdgpu/amd_max_bpc.c:26:19: error: expected declaration specifiers or ‘...’ before string constant
26 | IGT_TEST_DESCRIPT("Test 4K HDMI regression if max bpc is too high");
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ninja: build stopped: subcommand failed.
section_end:1632893390:step_script
section_start:1632893390:cleanup_file_variables
Cleaning up file based variables
section_end:1632893392:cleanup_file_variables
ERROR: Job failed: exit code 1
build:tests-fedora-clang has failed (https://gitlab.freedesktop.org/gfx-ci/igt-ci-tags/-/jobs/14118992):
IGT_TEST_DESCRIPT("Test 4K HDMI regression if max bpc is too high");
^
../tests/amdgpu/amd_max_bpc.c:26:19: error: expected ')'
../tests/amdgpu/amd_max_bpc.c:26:18: note: to match this '('
IGT_TEST_DESCRIPT("Test 4K HDMI regression if max bpc is too high");
^
../tests/amdgpu/amd_max_bpc.c:26:1: error: type specifier missing, defaults to 'int' [-Werror,-Wimplicit-int]
IGT_TEST_DESCRIPT("Test 4K HDMI regression if max bpc is too high");
^
../tests/amdgpu/amd_max_bpc.c:26:18: warning: this function declaration is not a prototype [-Wstrict-prototypes]
IGT_TEST_DESCRIPT("Test 4K HDMI regression if max bpc is too high");
^
void 1 warning and 3 errors generated.
ninja: build stopped: subcommand failed.
section_end:1632893408:step_script
section_start:1632893408:cleanup_file_variables
Cleaning up file based variables
section_end:1632893408:cleanup_file_variables
ERROR: Job failed: exit code 1
build:tests-fedora-no-libunwind has failed (https://gitlab.freedesktop.org/gfx-ci/igt-ci-tags/-/jobs/14118989):
[883/1119] Compiling C object 'tests/59830eb@@perf@exe/i915_perf.c.o'.
ninja: build stopped: subcommand failed.
ninja: Entering directory `build'
[1/533] Generating version.h with a custom command.
[2/238] Linking target tests/perf_pmu.
[3/238] Linking target tests/perf.
[4/238] Linking target tests/amdgpu/amd_info.
[5/238] Compiling C object 'tests/amdgpu/b9f2b1d@@amd_max_bpc@exe/amd_max_bpc.c.o'.
FAILED: tests/amdgpu/b9f2b1d@@amd_max_bpc@exe/amd_max_bpc.c.o
cc -Itests/amdgpu/b9f2b1d@@amd_max_bpc@exe -Itests/amdgpu -I../tests/amdgpu -I../include/drm-uapi -Ilib -I../lib -I../lib/stubs/syscalls -I. -I../ -I../lib/stubs/libunwind -I/usr/include/cairo -I/usr/include/glib-2.0 -I/usr/lib64/glib-2.0/include -I/usr/include/pixman-1 -I/usr/include/freetype2 -I/usr/include/libpng16 -I/usr/include/libdrm -I/usr/include/libdrm/nouveau -I/usr/include/valgrind -fdiagnostics-color=always -pipe -D_FILE_OFFSET_BITS=64 -Wall -Winvalid-pch -Wextra -std=gnu11 -O2 -g -D_GNU_SOURCE -include config.h -D_FORTIFY_SOURCE=2 -Wbad-function-cast -Wdeclaration-after-statement -Wformat=2 -Wimplicit-fallthrough=0 -Wlogical-op -Wmissing-declarations -Wmissing-format-attribute -Wmissing-noreturn -Wmissing-prototypes -Wnested-externs -Wold-style-definition -Wpointer-arith -Wredundant-decls -Wshadow -Wstrict-prototypes -Wuninitialized -Wunused -Wno-clobbered -Wno-maybe-uninitialized -Wno-missing-field-initializers -Wno-pointer-arith -Wno-address-of-packed-member -Wno-sign-compare -Wno-type-limits -Wno-unused-parameter -Wno-unused-result -Werror=address -Werror=array-bounds -Werror=implicit -Werror=init-self -Werror=int-to-pointer-cast -Werror=main -Werror=missing-braces -Werror=nonnull -Werror=pointer-to-int-cast -Werror=return-type -Werror=sequence-point -Werror=trigraphs -Werror=write-strings -fno-builtin-malloc -fno-builtin-calloc -fcommon -pthread -MD -MQ 'tests/amdgpu/b9f2b1d@@amd_max_bpc@exe/amd_max_bpc.c.o' -MF 'tests/amdgpu/b9f2b1d@@amd_max_bpc@exe/amd_max_bpc.c.o.d' -o 'tests/amdgpu/b9f2b1d@@amd_max_bpc@exe/amd_max_bpc.c.o' -c ../tests/amdgpu/amd_max_bpc.c ../tests/amdgpu/amd_max_bpc.c:26:19: error: expected declaration specifiers or ‘...’ before string constant
26 | IGT_TEST_DESCRIPT("Test 4K HDMI regression if max bpc is too high");
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ninja: build stopped: subcommand failed.
section_end:1632893393:step_script
section_start:1632893393:cleanup_file_variables
Cleaning up file based variables
section_end:1632893395:cleanup_file_variables
ERROR: Job failed: exit code 1
build:tests-fedora-oldest-meson has failed (https://gitlab.freedesktop.org/gfx-ci/igt-ci-tags/-/jobs/14118990):
[883/1119] Compiling C object 'tests/tests@@perf@exe/i915_perf.c.o'.
[884/1119] Compiling C object 'tests/tests@@perf_pmu@exe/i915_perf_pmu.c.o'.
[885/1119] Linking target tests/amdgpu/amd_prime.
ninja: build stopped: subcommand failed.
ninja: Entering directory `build'
[1/533] Generating version.h with a custom command.
[2/236] Linking target tests/perf_pmu.
[3/236] Linking target tests/perf.
[4/236] Compiling C object 'tests/amdgpu/tests@amdgpu@@amd_max_bpc@exe/amd_max_bpc.c.o'.
FAILED: tests/amdgpu/tests@amdgpu@@amd_max_bpc@exe/amd_max_bpc.c.o
cc -Itests/amdgpu/tests@amdgpu@@amd_max_bpc@exe -Itests/amdgpu -I../tests/amdgpu -I../include/drm-uapi -Ilib -I../lib -I../lib/stubs/syscalls -I. -I../ -I/usr/include/cairo -I/usr/include/glib-2.0 -I/usr/lib64/glib-2.0/include -I/usr/include/pixman-1 -I/usr/include/freetype2 -I/usr/include/libpng16 -I/usr/include/libdrm -I/usr/include/libdrm/nouveau -I/usr/include/valgrind -fdiagnostics-color=always -pipe -D_FILE_OFFSET_BITS=64 -Wall -Winvalid-pch -Wextra -std=gnu11 -O2 -g -D_GNU_SOURCE -include config.h -D_FORTIFY_SOURCE=2 -Wbad-function-cast -Wdeclaration-after-statement -Wformat=2 -Wimplicit-fallthrough=0 -Wlogical-op -Wmissing-declarations -Wmissing-format-attribute -Wmissing-noreturn -Wmissing-prototypes -Wnested-externs -Wold-style-definition -Wpointer-arith -Wredundant-decls -Wshadow -Wstrict-prototypes -Wuninitialized -Wunused -Wno-clobbered -Wno-maybe-uninitialized -Wno-missing-field-initializers -Wno-pointer-arith -Wno-address-of-packed-member -Wno-sign-compare -Wno-type-limits -Wno-unused-parameter -Wno-unused-result -Werror=address -Werror=array-bounds -Werror=implicit -Werror=init-self -Werror=int-to-pointer-cast -Werror=main -Werror=missing-braces -Werror=nonnull -Werror=pointer-to-int-cast -Werror=return-type -Werror=sequence-point -Werror=trigraphs -Werror=write-strings -fno-builtin-malloc -fno-builtin-calloc -fcommon -pthread -MD -MQ 'tests/amdgpu/tests@amdgpu@@amd_max_bpc@exe/amd_max_bpc.c.o' -MF 'tests/amdgpu/tests@amdgpu@@amd_max_bpc@exe/amd_max_bpc.c.o.d' -o 'tests/amdgpu/tests@amdgpu@@amd_max_bpc@exe/amd_max_bpc.c.o' -c ../tests/amdgpu/amd_max_bpc.c ../tests/amdgpu/amd_max_bpc.c:26:19: error: expected declaration specifiers or ‘...’ before string constant
26 | IGT_TEST_DESCRIPT("Test 4K HDMI regression if max bpc is too high");
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ninja: build stopped: subcommand failed.
section_end:1632893393:step_script
section_start:1632893393:cleanup_file_variables
Cleaning up file based variables
section_end:1632893394:cleanup_file_variables
ERROR: Job failed: exit code 1
== Logs ==
For more details see: https://gitlab.freedesktop.org/gfx-ci/igt-ci-tags/-/pipelines/411416
Hi Stylon,
We tried this test in some ASICs, and it failed. Does it mean that our driver has a regression?
Thanks
Siqueira
Quoted 226 lines · Stylon Wang
[Why]
There was a driver regression with which too high max-bpc setting causes 4K video modes failing stream validation and dropped from mode list.[How]
Add this test to catch the regression.Signed-off-by Stylon Wang <[email protected]>--- tests/amdgpu/amd_max_bpc.c | 190 +++++++++++++++++++++++++++++++++++++ tests/amdgpu/meson.build | 1 + 2 files changed, 191 insertions(+) create mode 100644 tests/amdgpu/amd_max_bpc.ctests/amdgpu/amd_max_bpc.c new file +190
-0@@ -0,0 +1,190 @@ +/* +* Copyright 2021 Advanced Micro Devices, Inc. +* +* 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 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 COPYRIGHT HOLDER(S) OR AUTHOR(S) 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 "igt.h" +#include <fcntl.h> + +IGT_TEST_DESCRIPT ("Test 4K HDMI regression if max bpc is too high" ); + +/* Common test data. */ +typedef struct data { +igt_display_t display; +igt_plane_t *primary; +igt_output_t *output; +igt_pipe_t *pipe; +igt_pipe_crc_t *pipe_crc; +igt_pipe_crc_t *pipe_crc_dither; +drmModeModeInfo *mode; +enum pipe pipe_id; +int fd; +int w; +int h; +}data_t ; + +/* BPC connector state. */ +typedef struct output_bpc { +unsigned int current; +unsigned int maximum; +}output_bpc_t ; + +static drmModeModeInfo uhd_mode = { +594000 , +3840 ,4016 ,4104 ,4400 ,0 , +2160 ,2168 ,2178 ,2250 ,0 , +60 ,0x5 |DRM_MODE_FLAG_PIC_AR_64_27 , +0x40 , +"3840x2160@60" ,/* VIC 107 */ + }; + +/* Returns the current and maximum bpc from the connector debugfs. */ +static output_bpc_t get_output_bpc (data_t *data) +{ +char buf[256 ]; +char *start_loc; +int fd, res; +output_bpc_t info; + + fd =igt_debugfs_connector_dir (data->fd, data->output->name,O_RDONLY ); +igt_assert (fd >=0 ); + + res =igt_debugfs_simple_read (fd,"output_bpc" , buf,sizeof (buf)); + +igt_require (res >0 ); + +close (fd); + +igt_assert (start_loc =strstr (buf,"Current: " )); +igt_assert_eq (sscanf (start_loc,"Current: %u" , &info.current),1 ); + +igt_assert (start_loc =strstr (buf,"Maximum: " )); +igt_assert_eq (sscanf (start_loc,"Maximum: %u" , &info.maximum),1 ); + +return info; +} + +/* Verifies that connector has the correct output bpc. */ +static void assert_output_bpc (data_t *data,unsigned int bpc) +{ +output_bpc_t info =get_output_bpc (data); + +igt_require_f (info.maximum >= bpc, +"Monitor doesn't support %u bpc, max is %u\n" , bpc, + info.maximum); + +igt_assert_eq (info.current, bpc); +} + +/* Common test setup. */ +static void test_init (data_t *data) +{ +igt_display_t *display = &data->display; + +/* It doesn't matter which pipe we choose on amdpgu. */ + data->pipe_id =PIPE_A ; + data->pipe = &data->display.pipes[data->pipe_id]; + +igt_display_reset (display); + +/* find a connected HDMI output */ + data->output =NULL ; +for (int i=0 ; i < data->display.n_outputs; ++i) { +drmModeConnector *connector = data->display.outputs[i].config.connector; +if (connector->connection ==DRM_MODE_CONNECTED && + (connector->connector_type ==DRM_MODE_CONNECTOR_HDMIA )) { + data->output = &data->display.outputs[i]; + } + } +igt_assert_f (data->output,"Requires connected HDMI output\n" ); + +igt_output_set_prop_value (data->output,IGT_CONNECTOR_MAX_BPC ,10 ); +igt_output_override_mode (data->output, &uhd_mode); + + data->mode =igt_output_get_mode (data->output); +igt_assert (data->mode); +assert_output_bpc (data,8 ); + + data->primary = +igt_pipe_get_plane_type (data->pipe,DRM_PLANE_TYPE_PRIMARY ); + + data->pipe_crc =igt_pipe_crc_new (data->fd, data->pipe_id, +INTEL_PIPE_CRC_SOURCE_AUTO ); + +igt_output_set_pipe (data->output, data->pipe_id); + + data->w = data->mode->hdisplay; + data->h = data->mode->vdisplay; +} + +/* Common test cleanup. */ +static void test_fini (data_t *data) +{ +igt_pipe_crc_free (data->pipe_crc); +igt_display_reset (&data->display); +} + +static void test_4k_mode_max_bpc (data_t *data) +{ +igt_display_t *display = &data->display; +igt_fb_t rfb; +int max_bpc =16 ; + +test_init (data); + +igt_info ("Setting output max bpc to %d\n" , max_bpc); + +igt_output_set_prop_value (data->output,IGT_CONNECTOR_MAX_BPC , max_bpc); + +igt_create_pattern_fb (data->fd, data->w, data->h,DRM_FORMAT_XRGB8888 ,0 , &rfb); +igt_plane_set_fb (data->primary, &rfb); +igt_display_commit_atomic (display,DRM_MODE_ATOMIC_ALLOW_MODESET ,NULL ); + +test_fini (data); +igt_remove_fb (data->fd, &rfb); +} + +igt_main +{ +data_t data; + +igt_skip_on_simulation (); + +memset (&data,0 ,sizeof (data)); + + igt_fixture + { + data.fd =drm_open_driver_master (DRIVER_AMDGPU ); + +kmstest_set_vt_graphics_mode (); + +igt_display_require (&data.display, data.fd); +igt_require (data.display.is_atomic); +igt_display_require_output (&data.display); + } + +igt_describe ("Tests overly high 'max bpc' should not affect 4K modes on HDMI" ); + igt_subtest("4k-mode-max-bpc") test_4k_mode_max_bpc(&data); + + igt_fixture + { +igt_display_fini (&data.display); + } +}tests/amdgpu/meson.build +1
-0@@ -11,6 +11,7 @@ if libdrm_amdgpu.found() 'amd_hotplug', 'amd_info', 'amd_prime', + 'amd_max_bpc', 'amd_module_load', 'amd_mem_leak', 'amd_link_settings',Signature · 1 line
2.32.0
Signature · 2 lines
Rodrigo Siqueira https://siqueira.tech