IGT tests for the KMS Color Pipeline API
Subsystems (2)
v10 cover IGT tests for the KMS Color Pipeline API
This series introduces support for
* drm_colorop DRM objects
* COLOR_PIPELINE plane property
Kernel changes can be found at [1] and on dri-devel.
It also adds a new kms_colorop test case that tests the color pipeline API. The tests are designed to be easily extensible with a "transform" and "compare" function pointer for each test. The "transform" function performs the transformations under test via SW routines. The "compare" function compares the DRM/KMS result (via a writeback connector) with the result derived via the SW "transform".
This series introduces a number of tests for pre-defined transfer functions, custom LUTs, 3x4 CTMs, a multiplier, 3D LUT, and a bypass test.
It tests 8-bit and 10-bit RGB surface formats, depending on driver support on the drm_plane as well as the writeback drm_connector end.
[1] https://gitlab.freedesktop.org/alex.hung/linux/-/tree/amd-color-pipeline-v11
v10:
- Merge some patches accordingly
- Change drm_color_lut_32 to drm_color_lut32
- Fix 16bit to 32bit coversions in configure_3dlut()
- Fix errors and warnings reported by checkpatch
- Clear dead code and redundant debug messages and comments
v9:
- Check !display->has_plane_color_pipeline before igt_plane_has_prop ( IGT_PLANE_COLOR_ENCODING and IGT_PLANE_COLOR_RANGE) (Chaitanya Kumar Borah)
v8:
- Add a new colorop uniqueness subtest
- Include a patch "lib/igt_kms: Destroy colorops on exit"
- Add function documentation comment for get_writeback_formats_blob
- Fix indentation errors and a new blank line at EOF
v7:
- Add more documents and sync up with kernel implementation
- Update 3DLUT tests according to kernel changes
v5:
- Bypass test
- 10 bpc support
- Proper setup and cleanup
- PQ/BT2020 TFs
- 1D LUT tests
- Multiplier tests
- 3D LUT test
v4:
- Intel color pipeline work, to possibly be combined with v5 in a future iteration.
v3:
- Remove need for IOCTLs and libdrm changes
- Test colorop properties with both atomic and legacy code paths
- move enum drm_colorop_type to drm_mode.h
- Add descriptions for public functions in lib (Kamil)
- Use SPDX style license identifier (Kamil)
- Replace Skia license comment with copyright note in file header
- Fix kms_colorop subtests if applicable color pipeline not found
Alex Hung (9):
tests/kms_colorop: Add a TF sRGB test
lib/igt_color: Add 1D LUT color transformation support test/kms_colorop: Add tests that exercise the 1D LUT colorops tests/kms_colorop: Add multiplier tests scripts/convert_3dlut.py Convert a 3D LUT to igt_3dlut_t array for 3D
LUT API
tests/kms_colorop: Add a 3D LUT subtest
drm-uapi: Update kernel doc for drm_colorop_type
drm-uapi: Sync up definition with kernel colorop implementation tests/kms_colorop: Add a colorop uniqueness subtest
Bhanuprakash Modem (1):
lib/igt_kms: Destroy colorops on exit
Harry Wentland (20):
tests/kms_writeback: Fix kms_writeback for VKMS lib/igt_kms: Introduce DRM_CLIENT_CAP_PLANE_COLOR_PIPELINE
drm-uapi: Add COLOROP object
tests/kms_properties: Add colorop properties test igt/color: Add SW color transform functionality lib/igt_fb: Add igt_copy_fb function
lib/drmtest: Add is_vkms_device() tests/kms_colorop: Add kms_colorop tests lib/igt_kms: Add support for DATA colorop property lib/igt_color: Add support for 3x4 matrices tests/kms_colorop: Add 3x4 CTM tests tests/kms_colorop: Add bypass test tests/kms_colorop: Add 10bpc test tests/kms_colorop: Skip if writeback does not support fourcc lib/igt_fb: Allow any non-planar format for igt_copy_fb lib/igt_color: Support color transform for XRGB2101010 lib/igt_color: Add PQ variants for 0-1 and 0-125 range tests/kms_colorop: Add tests for PQ variants lib/igt_color: add BT2020/BT709 transfer functions tests/kms_colorop: Add TF BT2020/BT709 tests
include/drm-uapi/amdgpu_drm.h | 9 - include/drm-uapi/drm.h | 15 + include/drm-uapi/drm_mode.h | 111 + lib/drmtest.c | 5 + lib/drmtest.h | 1 + lib/igt_color.c | 634 +++++ lib/igt_color.h | 149 + lib/igt_color_lut.h | 4946 +++++++++++++++++++++++++++++++++ lib/igt_fb.c | 33 +- lib/igt_fb.h | 3 + lib/igt_kms.c | 378 ++- lib/igt_kms.h | 98 + lib/meson.build | 1 + scripts/convert_3dlut.py | 94 + tests/kms_colorop.c | 734 +++++ tests/kms_colorop.h | 262 ++ tests/kms_properties.c | 92 +- tests/kms_writeback.c | 19 +- tests/meson.build | 1 + 19 files changed, 7543 insertions(+), 42 deletions(-) create mode 100644 lib/igt_color.c create mode 100644 lib/igt_color.h create mode 100644 lib/igt_color_lut.h create mode 100755 scripts/convert_3dlut.py create mode 100644 tests/kms_colorop.c create mode 100644 tests/kms_colorop.h
Signature · 1 line
2.43.0
PATCH v10 1/30 tests/kms_writeback: Fix kms_writeback for VKMS
From: Harry Wentland <[email protected]>
VKMS doesn't like us to add buffers with unknown fourcc type. Other drivers might behave similarly. Make sure we avoid creating 10bpc buffers if they are not supported.
--- tests/kms_writeback.c | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-)
tests/kms_writeback.c +12 -7
@@ -112,6 +112,10 @@ static bool check_writeback_config(igt_display_t *display, igt_output_t *output, height = override_mode.vdisplay;for (i =0 ; i <sizeof (fourcc) /sizeof (uint32_t ); i++) { + plane =igt_output_get_plane_type (output,DRM_PLANE_TYPE_PRIMARY ); + +if (!igt_plane_has_format_mod (plane, fourcc[i],DRM_FORMAT_MOD_LINEAR )) +continue ; ret =igt_create_fb (display->drm_fd, width, height, fourcc[i], modifier, &input_fb);
@@ -121,7 +125,6 @@ static bool check_writeback_config(igt_display_t *display, igt_output_t *output, fourcc[i], modifier, &output_fb);igt_assert_lte (0 , ret); - plane =igt_output_get_plane_type (output,DRM_PLANE_TYPE_PRIMARY );igt_plane_set_fb (plane, &input_fb);igt_output_set_writeback_fb (output, &output_fb);
@@ -571,12 +574,14 @@ igt_main_args("b:c:f:dl", long_options, help_str, opt_handler, NULL) &input_fb);igt_assert (fb_id >=0 ); - fb_id =igt_create_fb (display.drm_fd, mode.hdisplay, - mode.vdisplay, -DRM_FORMAT_XRGB2101010 , -DRM_FORMAT_MOD_LINEAR , - &input_fb_10bit); -igt_assert (fb_id >=0 ); +if (data.supported_colors &XRGB2101010 ) { + fb_id =igt_create_fb (display.drm_fd, mode.hdisplay, + mode.vdisplay, +DRM_FORMAT_XRGB2101010 , +DRM_FORMAT_MOD_LINEAR , + &input_fb_10bit); +igt_assert (fb_id >=0 ); + }igt_plane_set_fb (plane, &input_fb);
Signature · 1 line
2.43.0
Re: [PATCH V10 01/30] tests/kms_writeback: Fix kms_writeback for VKMS
Le 15/08/2025 à 06:06, Alex Hung a écrit :
Quoted 42 lines
From: Harry Wentland <[email protected]>
VKMS doesn't like us to add buffers with unknown fourcc type. Other drivers might behave similarly. Make sure we avoid creating 10bpc buffers if they are not supported.
Signed-off-by Alex Hung <[email protected]>Signed-off-by Harry Wentland <[email protected]>--- tests/kms_writeback.c | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-)tests/kms_writeback.c +4
-4@@ -112,6 +112,10 @@ static bool check_writeback_config(igt_display_t *display, igt_output_t *output, height = override_mode.vdisplay;for (i =0 ; i <sizeof (fourcc) /sizeof (uint32_t ); i++) { + plane =igt_output_get_plane_type (output,DRM_PLANE_TYPE_PRIMARY ); + +if (!igt_plane_has_format_mod (plane, fourcc[i],DRM_FORMAT_MOD_LINEAR )) +continue ; ret =igt_create_fb (display->drm_fd, width, height, fourcc[i], modifier, &input_fb);@@ -121,7 +125,6 @@ static bool check_writeback_config(igt_display_t *display, igt_output_t *output, fourcc[i], modifier, &output_fb);igt_assert_lte (0 , ret); - plane =igt_output_get_plane_type (output,DRM_PLANE_TYPE_PRIMARY );igt_plane_set_fb (plane, &input_fb);igt_output_set_writeback_fb (output, &output_fb);@@ -571,12 +574,14 @@ igt_main_args("b:c:f:dl", long_options, help_str, opt_handler, NULL) &input_fb);igt_assert (fb_id >=0 ); - fb_id = igt_create_fb(display.drm_fd, mode.hdisplay, - mode.vdisplay, - DRM_FORMAT_XRGB2101010,
tests/kms_writeback.c igt_main_args("b:c:f:dl", long_options, help_str, opt_handler, NULL) · line 583
Quoted 10 lines
tests/kms_writeback.c +7
-3-DRM_FORMAT_MOD_LINEAR , - &input_fb_10bit); -igt_assert (fb_id >=0 ); +if (data.supported_colors &XRGB2101010 ) { + fb_id =igt_create_fb (display.drm_fd, mode.hdisplay, + mode.vdisplay, +DRM_FORMAT_XRGB2101010 , +DRM_FORMAT_MOD_LINEAR , + &input_fb_10bit); +igt_assert (fb_id >=0 );
If the input_fb_10bit is not always created, I think you also need to fix the last igt_fixture (igt_remove_fb(display.drm_fd, &input_fb_10bit);)
Quoted 4 lines
tests/kms_writeback.c +1
-0+ }igt_plane_set_fb (plane, &input_fb);
Signature · 4 lines
-- Louis Chauvet, Bootlin Embedded Linux and Kernel engineering https://bootlin.com
PATCH v10 2/30 lib/igt_kms: Introduce DRM_CLIENT_CAP_PLANE_COLOR_PIPELINE
In reply to Alex HungFrom: Harry Wentland <[email protected]>
Setting the COLOR_PIPELINE plane prop is only allowed when the DRM_CLIENT_CAP_PLANE_COLOR_PIPELINE is set.
Setting COLOR_RANGE and COLOR_ENCODING is only allowed when the DRM_CLIENT_CAP_PLANE_COLOR_PIPELINE is NOT set.
--- include/drm-uapi/drm.h | 15 ++++++++++ lib/igt_kms.c | 63 ++++++++++++++++++++++++++++++++++-------- lib/igt_kms.h | 1 + tests/kms_properties.c | 20 ++++++++++---- 4 files changed, 81 insertions(+), 18 deletions(-)
include/drm-uapi/drm.h +15 -0
@@ -869,6 +869,21 @@ struct drm_get_cap {*/ #define DRM_CLIENT_CAP_CURSOR_PLANE_HOTSPOT 6 +/** +* DRM_CLIENT_CAP_PLANE_COLOR_PIPELINE +* +* If set to 1, the DRM core will +* - expose plane COLOR_PIPELINE properties for pre-blending color management. +* - reject setting of these plane properties: +* - COLOR_ENCODING +* - COLOR_RANGE +* +* The client must enable &DRM_CLIENT_CAP_ATOMIC first. +* +* This capability is currently in development. +*/ +#define DRM_CLIENT_CAP_PLANE_COLOR_PIPELINE 7 +/* DRM_IOCTL_SET_CLIENT_CAP ioctl argument type */ struct drm_set_client_cap {__u64 capability;
lib/igt_kms.c +51 -12
100 lines not on this page · raw message
lib/igt_kms.h +1 -0
@@ -508,6 +508,7 @@ struct igt_display {bool has_cursor_plane;bool is_atomic;bool has_virt_cursor_plane; +bool has_plane_color_pipeline;bool first_commit;uint64_t *modifiers;
tests/kms_properties.c +14 -6
@@ -101,7 +101,7 @@ static void cleanup_pipe(igt_display_t *display, enum pipe pipe, igt_output_t *o }static bool ignore_property (uint32_t obj_type,uint32_t prop_flags, -const char *name,bool atomic) +const char *name,bool atomic,bool has_color_pipeline) {if (prop_flags &DRM_MODE_PROP_IMMUTABLE )return true;
@@ -111,6 +111,14 @@ static bool ignore_property(uint32_t obj_type, uint32_t prop_flags,if (atomic && !strcmp (name,"DPMS" ))return true;break ; +case DRM_MODE_OBJECT_PLANE : +if (has_color_pipeline && !strcmp (name,"COLOR_RANGE" )) +return true; + +if (has_color_pipeline && !strcmp (name,"COLOR_ENCODING" )) +return true; + +break ;default :break ; }
@@ -164,7 +172,7 @@ static bool has_additional_test_lookup(uint32_t obj_type, const char *name,return false; } -static void test_properties (int fd,uint32_t type,uint32_t id,bool atomic) +static void test_properties (int fd,uint32_t type,uint32_t id,bool atomic,bool has_color_pipeline) {drmModeObjectPropertiesPtr props =drmModeObjectGetProperties (fd, id, type);
@@ -183,7 +191,7 @@ static void test_properties(int fd, uint32_t type, uint32_t id, bool atomic)igt_assert (prop); -if (ignore_property (type, prop->flags, prop->name, atomic)) { +if (ignore_property (type, prop->flags, prop->name, atomic, has_color_pipeline)) {igt_debug ("Ignoring property \"%s\"\n" , prop->name);continue ;
@@ -230,7 +238,7 @@ static void run_plane_property_tests(igt_display_t *display, enum pipe pipe, igtigt_info ("Testing plane properties on %s.#%d-%s (output: %s)\n" ,kmstest_pipe_name (pipe), plane->index,kmstest_plane_type_name (plane->type), output->name); -test_properties (display->drm_fd,DRM_MODE_OBJECT_PLANE , plane->drm_plane->plane_id, atomic); +test_properties (display->drm_fd,DRM_MODE_OBJECT_PLANE , plane->drm_plane->plane_id, atomic, display->has_plane_color_pipeline); }cleanup_pipe (display, pipe, output, &fb);
@@ -244,7 +252,7 @@ static void run_crtc_property_tests(igt_display_t *display, enum pipe pipe, igt_igt_info ("Testing crtc properties on %s (output: %s)\n" ,kmstest_pipe_name (pipe), output->name); -test_properties (display->drm_fd,DRM_MODE_OBJECT_CRTC , display->pipes[pipe].crtc_id, atomic); +test_properties (display->drm_fd,DRM_MODE_OBJECT_CRTC , display->pipes[pipe].crtc_id, atomic, false);cleanup_pipe (display, pipe, output, &fb); }
@@ -258,7 +266,7 @@ static void run_connector_property_tests(igt_display_t *display, enum pipe pipe,igt_info ("Testing connector properties on output %s (pipe: %s)\n" , output->name,kmstest_pipe_name (pipe)); -test_properties (display->drm_fd,DRM_MODE_OBJECT_CONNECTOR , output->id, atomic); +test_properties (display->drm_fd,DRM_MODE_OBJECT_CONNECTOR , output->id, atomic, false);if (pipe !=PIPE_NONE )cleanup_pipe (display, pipe, output, &fb);
Signature · 1 line
2.43.0
Re: [PATCH V10 02/30] lib/igt_kms: Introduce DRM_CLIENT_CAP_PLANE_COLOR_PIPELINE
Quoted 27 lines · Alex Hung
From: Harry Wentland <[email protected]>
Setting the
COLOR_PIPELINEplane prop is only allowed when theDRM_CLIENT_CAP_PLANE_COLOR_PIPELINEis set.Setting
COLOR_RANGEandCOLOR_ENCODINGis only allowed when theDRM_CLIENT_CAP_PLANE_COLOR_PIPELINEis NOT set.Signed-off-by Alex Hung <[email protected]>Signed-off-by Harry Wentland <[email protected]>--- include/drm-uapi/drm.h | 15 ++++++++++ lib/igt_kms.c | 63 ++++++++++++++++++++++++++++++++++-------- lib/igt_kms.h | 1 + tests/kms_properties.c | 20 ++++++++++---- 4 files changed, 81 insertions(+), 18 deletions(-)include/drm-uapi/drm.h +2
-0@@ -869,6 +869,21 @@ struct drm_get_cap {*/ #define DRM_CLIENT_CAP_CURSOR_PLANE_HOTSPOT 6 +/** +* DRM_CLIENT_CAP_PLANE_COLOR_PIPELINE
include/drm-uapi/drm.h struct drm_get_cap { · line 883
Quoted 10 lines
include/drm-uapi/drm.h +10
-0+* +* If set to 1, the DRM core will +* - expose plane COLOR_PIPELINE properties for pre-blending color management. +* - reject setting of these plane properties: +* - COLOR_ENCODING +* - COLOR_RANGE +* +* The client must enable &DRM_CLIENT_CAP_ATOMIC first. +* +* This capability is currently in development.
This line can go now.
Quoted 42 lines
include/drm-uapi/drm.h +3
-0+*/ +#define DRM_CLIENT_CAP_PLANE_COLOR_PIPELINE 7 +/* DRM_IOCTL_SET_CLIENT_CAP ioctl argument type */ struct drm_set_client_cap {__u64 capability;lib/igt_kms.c +10
-6@@ -2545,6 +2545,8 @@ static int get_drm_plane_type(int drm_fd, uint32_t plane_id)static void igt_plane_reset (igt_plane_t *plane) { +igt_display_t *display = plane->pipe->display; +/* Reset src coordinates. */ igt_plane_set_prop_value (plane,IGT_PLANE_SRC_X ,0 );igt_plane_set_prop_value (plane,IGT_PLANE_SRC_Y ,0 );@@ -2561,13 +2563,15 @@ static void igt_plane_reset(igt_plane_t *plane)igt_plane_set_prop_value (plane,IGT_PLANE_FB_ID ,0 );igt_plane_set_prop_value (plane,IGT_PLANE_CRTC_ID ,0 ); -if (igt_plane_has_prop (plane,IGT_PLANE_COLOR_ENCODING )) -igt_plane_set_prop_enum (plane,IGT_PLANE_COLOR_ENCODING , -igt_color_encoding_to_str (IGT_COLOR_YCBCR_BT601 )); +if (!display->has_plane_color_pipeline) { +if (igt_plane_has_prop (plane,IGT_PLANE_COLOR_ENCODING )) +igt_plane_set_prop_enum (plane,IGT_PLANE_COLOR_ENCODING , +igt_color_encoding_to_str (IGT_COLOR_YCBCR_BT601 )); -if (igt_plane_has_prop (plane,IGT_PLANE_COLOR_RANGE )) -igt_plane_set_prop_enum (plane,IGT_PLANE_COLOR_RANGE , -igt_color_range_to_str (IGT_COLOR_YCBCR_LIMITED_RANGE )); +if (igt_plane_has_prop (plane,IGT_PLANE_COLOR_RANGE )) +igt_plane_set_prop_enum (plane,IGT_PLANE_COLOR_RANGE , +igt_color_range_to_str (IGT_COLOR_YCBCR_LIMITED_RANGE )); + }/* Use default rotation */ if (igt_plane_has_prop (plane,IGT_PLANE_ROTATION ))
lib/igt_kms.c void igt_display_require(igt_display_t *display, int drm_fd) · line 2991
Quoted 6 lines
lib/igt_kms.c +3
-0@@ -2982,6 +2986,9 @@ void igt_display_require(igt_display_t *display, int drm_fd)if (drmSetClientCap (drm_fd,LOCAL_DRM_CLIENT_CAP_CURSOR_PLANE_HOTSPOT ,1 ) ==0 ) display->has_virt_cursor_plane =1 ; +if (drmSetClientCap (drm_fd,DRM_CLIENT_CAP_PLANE_COLOR_PIPELINE ,1 ) ==0 ) + display->has_plane_color_pipeline =1 ; +
If we do this here, we will be taking out the legacy properties out of the equation for all IGTs (say kms_plane.c). So any place currently setting COLOR_ENCODING/COLOR_RANGE becomes dead code. Other than that probably harmless?
Quoted 16 lines
lib/igt_kms.c +9
-0plane_resources =drmModeGetPlaneResources (display->drm_fd);igt_assert (plane_resources);@@ -3609,6 +3616,29 @@ static uint32_t igt_plane_get_fb_id(igt_plane_t *plane)igt_assert_eq (r,0 ); \ } +static bool +igt_atomic_ignore_plane_prop (igt_pipe_t *pipe,uint32_t prop) +{ +igt_display_t *display = pipe->display; + +if (display->has_plane_color_pipeline) { +switch (prop) { +case IGT_PLANE_COLOR_ENCODING : +case IGT_PLANE_COLOR_RANGE :
lib/igt_kms.c static uint32_t igt_plane_get_fb_id(igt_plane_t *plane) · line 3637
Quoted 10 lines
lib/igt_kms.c +10
-0+return true; +default : +return false; + } + }else { +switch (prop) { +default : +return false; + } + }
The else block makes the last return statement unreachable. We can have something like
static bool igt_atomic_ignore_plane_prop(igt_pipe_t *pipe, uint32_t prop)
{
igt_display_t *display = pipe->display;
switch (prop) {
case IGT_PLANE_COLOR_ENCODING:
case IGT_PLANE_COLOR_RANGE:
return display->has_plane_color_pipeline;
default:
return false;
}
}Quoted 8 lines
lib/igt_kms.c +4
-0+ +return false; +} +/* * Add position and fb changes of a plane to the atomic property set */
lib/igt_kms.c igt_atomic_prepare_plane_commit(igt_plane_t *plane, igt_pipe_t *pipe, · line 3664
Quoted 7 lines
lib/igt_kms.c +4
-0@@ -3628,6 +3658,12 @@ igt_atomic_prepare_plane_commit(igt_plane_t *plane, igt_pipe_t *pipe, igt_plane_get_fb_id(plane));for (i =0 ; i <IGT_NUM_PLANE_PROPS ; i++) { +if (igt_atomic_ignore_plane_prop (pipe, i)) { +igt_debug ("plane %s.%d: Ignoring property \"%s\" to 0x%" PRIx64"/%" PRIi64"\n" , +kmstest_pipe_name (pipe->pipe), plane->index, igt_plane_prop_names[i], + plane->values[i], plane->values[i]);continue ;
Could use a new line
==
Chaitanya
Quoted 112 lines
lib/igt_kms.c +11
-6+ } +if (!igt_plane_is_prop_changed (plane, i))continue ;@@ -5222,12 +5258,15 @@ void igt_plane_set_fb(igt_plane_t *plane, struct igt_fb *fb)igt_fb_set_position (fb, plane,0 ,0 );igt_fb_set_size (fb, plane, fb->width, fb->height); -if (igt_plane_has_prop (plane,IGT_PLANE_COLOR_ENCODING )) -igt_plane_set_prop_enum (plane,IGT_PLANE_COLOR_ENCODING , -igt_color_encoding_to_str (fb->color_encoding)); -if (igt_plane_has_prop (plane,IGT_PLANE_COLOR_RANGE )) -igt_plane_set_prop_enum (plane,IGT_PLANE_COLOR_RANGE , -igt_color_range_to_str (fb->color_range)); +if (!display->has_plane_color_pipeline) { +if (igt_plane_has_prop (plane,IGT_PLANE_COLOR_ENCODING )) +igt_plane_set_prop_enum (plane,IGT_PLANE_COLOR_ENCODING , +igt_color_encoding_to_str (fb->color_encoding)); + +if (igt_plane_has_prop (plane,IGT_PLANE_COLOR_RANGE )) +igt_plane_set_prop_enum (plane,IGT_PLANE_COLOR_RANGE , +igt_color_range_to_str (fb->color_range)); + }/* Hack to prioritize the plane on the pipe that last set fb */ igt_plane_set_pipe (plane, pipe);lib/igt_kms.h +1
-0@@ -508,6 +508,7 @@ struct igt_display {bool has_cursor_plane;bool is_atomic;bool has_virt_cursor_plane; +bool has_plane_color_pipeline;bool first_commit;uint64_t *modifiers;tests/kms_properties.c +14
-6@@ -101,7 +101,7 @@ static void cleanup_pipe(igt_display_t *display, enum pipe pipe, igt_output_t *o }static bool ignore_property (uint32_t obj_type,uint32_t prop_flags, -const char *name,bool atomic) +const char *name,bool atomic,bool has_color_pipeline) {if (prop_flags &DRM_MODE_PROP_IMMUTABLE )return true;@@ -111,6 +111,14 @@ static bool ignore_property(uint32_t obj_type, uint32_t prop_flags,if (atomic && !strcmp (name,"DPMS" ))return true;break ; +case DRM_MODE_OBJECT_PLANE : +if (has_color_pipeline && !strcmp (name,"COLOR_RANGE" )) +return true; + +if (has_color_pipeline && !strcmp (name,"COLOR_ENCODING" )) +return true; + +break ;default :break ; }@@ -164,7 +172,7 @@ static bool has_additional_test_lookup(uint32_t obj_type, const char *name,return false; } -static void test_properties (int fd,uint32_t type,uint32_t id,bool atomic) +static void test_properties (int fd,uint32_t type,uint32_t id,bool atomic,bool has_color_pipeline) {drmModeObjectPropertiesPtr props =drmModeObjectGetProperties (fd, id, type);@@ -183,7 +191,7 @@ static void test_properties(int fd, uint32_t type, uint32_t id, bool atomic)igt_assert (prop); -if (ignore_property (type, prop->flags, prop->name, atomic)) { +if (ignore_property (type, prop->flags, prop->name, atomic, has_color_pipeline)) {igt_debug ("Ignoring property \"%s\"\n" , prop->name);continue ;@@ -230,7 +238,7 @@ static void run_plane_property_tests(igt_display_t *display, enum pipe pipe, igtigt_info ("Testing plane properties on %s.#%d-%s (output: %s)\n" ,kmstest_pipe_name (pipe), plane->index,kmstest_plane_type_name (plane->type), output->name); -test_properties (display->drm_fd,DRM_MODE_OBJECT_PLANE , plane->drm_plane->plane_id, atomic); +test_properties (display->drm_fd,DRM_MODE_OBJECT_PLANE , plane->drm_plane->plane_id, atomic, display->has_plane_color_pipeline); }cleanup_pipe (display, pipe, output, &fb);@@ -244,7 +252,7 @@ static void run_crtc_property_tests(igt_display_t *display, enum pipe pipe, igt_igt_info ("Testing crtc properties on %s (output: %s)\n" ,kmstest_pipe_name (pipe), output->name); -test_properties (display->drm_fd,DRM_MODE_OBJECT_CRTC , display->pipes[pipe].crtc_id, atomic); +test_properties (display->drm_fd,DRM_MODE_OBJECT_CRTC , display->pipes[pipe].crtc_id, atomic, false);cleanup_pipe (display, pipe, output, &fb); }@@ -258,7 +266,7 @@ static void run_connector_property_tests(igt_display_t *display, enum pipe pipe,igt_info ("Testing connector properties on output %s (pipe: %s)\n" , output->name,kmstest_pipe_name (pipe)); -test_properties (display->drm_fd,DRM_MODE_OBJECT_CONNECTOR , output->id, atomic); +test_properties (display->drm_fd,DRM_MODE_OBJECT_CONNECTOR , output->id, atomic, false);if (pipe !=PIPE_NONE )cleanup_pipe (display, pipe, output, &fb);
Re: [PATCH V10 02/30] lib/igt_kms: Introduce DRM_CLIENT_CAP_PLANE_COLOR_PIPELINE
Quoted 10 lines · Chaitanya Kumar
Review void igt_display_require(igt_display_t *display, · line 2992
Quoted 8 lines
(quoted diff) +3
-0@@ -2982,6 +2986,9 @@ void igt_display_require(igt_display_t *display, int drm_fd) if (drmSetClientCap(drm_fd, LOCAL_DRM_CLIENT_CAP_CURSOR_PLANE_HOTSPOT, 1) == 0) display->has_virt_cursor_plane = 1; + if (drmSetClientCap(drm_fd, DRM_CLIENT_CAP_PLANE_COLOR_PIPELINE, 1) == 0) + display->has_plane_color_pipeline = 1; +If we do this here, we will be taking out the legacy properties out of the equation for all IGTs (say
kms_plane.c). So any place currently setting COLOR_ENCODING/COLOR_RANGE becomes dead code. Other than that probably harmless?
if color pipeline is available, we probably want to skip legacy properties, but it is probably too risky for other tests right now.
I can move it out of igt_display_require and append it to igt_display_require() calls in kms_colorop to something like the following diff for the time-being.
Any comments?
lib/igt_kms.c +0 -0
@@ -3108,9 +3108,6 @@ void igt_display_require(igt_display_t *display, int drm_fd) if (drmSetClientCap(drm_fd,
LOCAL_DRM_CLIENT_CAP_CURSOR_PLANE_HOTSPOT, 1) == 0)
display->has_virt_cursor_plane = 1;
- if (drmSetClientCap(drm_fd, DRM_CLIENT_CAP_PLANE_COLOR_PIPELINE, 1) == 0)
- display->has_plane_color_pipeline = 1;
-
plane_resources = drmModeGetPlaneResources(display->drm_fd);
igt_assert(plane_resources);tests/kms_colorop.c +0 -0
@@ -633,10 +633,14 @@ igt_main igt_require_f(!ret, "error setting
DRM_CLIENT_CAP_WRITEBACK_CONNECTORS\n");
igt_display_require(&display, display.drm_fd);
+ if (drmSetClientCap(display.drm_fd, DRM_CLIENT_CAP_PLANE_COLOR_PIPELINE, 1) == 0)
+ display.has_plane_color_pipeline = 1;
kmstest_set_vt_graphics_mode();
igt_display_require(&display, display.drm_fd);+ if (drmSetClientCap(display.drm_fd, DRM_CLIENT_CAP_PLANE_COLOR_PIPELINE, 1) == 0)
+ display.has_plane_color_pipeline = 1;
igt_require(display.is_atomic);
Re: [PATCH V10 02/30] lib/igt_kms: Introduce DRM_CLIENT_CAP_PLANE_COLOR_PIPELINE
Quoted 14 lines · Alex Hung
Quoted 10 lines · Chaitanya Kumar
Review void igt_display_require(igt_display_t · line 2992
Quoted 8 lines
(quoted diff) +3
-0@@ -2982,6 +2986,9 @@ void igt_display_require(igt_display_t *display, int drm_fd) if (drmSetClientCap(drm_fd, LOCAL_DRM_CLIENT_CAP_CURSOR_PLANE_HOTSPOT, 1) == 0) display->has_virt_cursor_plane = 1; + if (drmSetClientCap(drm_fd, DRM_CLIENT_CAP_PLANE_COLOR_PIPELINE, 1) == 0) + display->has_plane_color_pipeline = 1; +If we do this here, we will be taking out the legacy properties out of the equation for all IGTs (say
kms_plane.c). So any place currently setting COLOR_ENCODING/COLOR_RANGE becomes dead code. Other than that probably harmless?
Quoted 6 lines
if color pipeline is available, we probably want to skip legacy properties, but it is probably too risky for other tests right now.
I can move it out of
igt_display_requireand append it toigt_display_require()calls inkms_coloropto something like the following diff for the time-being.Any comments?
Apologies on missing out on your mail. I see you have already made change in the latest version. This makes more sense.
==
Chaitanya
Quoted 39 lines
lib/igt_kms.c +0
-3@@ -3108,9 +3108,6 @@ void igt_display_require(igt_display_t *display, int drm_fd) if (drmSetClientCap(drm_fd,LOCAL_DRM_CLIENT_CAP_CURSOR_PLANE_HOTSPOT ,1 ) ==0 ) display->has_virt_cursor_plane = 1; - if (drmSetClientCap(drm_fd, DRM_CLIENT_CAP_PLANE_COLOR_PIPELINE, 1) == 0) - display->has_plane_color_pipeline = 1; -
plane_resources=drmModeGetPlaneResources(display->drm_fd);igt_assert(plane_resources);tests/kms_colorop.c +4
-0@@ -633,10 +633,14 @@ igt_main igt_require_f(!ret, "error setting DRM_CLIENT_CAP_WRITEBACK_CONNECTORS\n"); igt_display_require(&display, display.drm_fd); + if (drmSetClientCap(display.drm_fd,DRM_CLIENT_CAP_PLANE_COLOR_PIPELINE ,1 ) ==0 ) + display.has_plane_color_pipeline = 1; kmstest_set_vt_graphics_mode(); igt_display_require(&display, display.drm_fd); + if (drmSetClientCap(display.drm_fd,DRM_CLIENT_CAP_PLANE_COLOR_PIPELINE ,1 ) ==0 ) + display.has_plane_color_pipeline = 1;
igt_require(display.is_atomic);
Re: [PATCH V10 02/30] lib/igt_kms: Introduce DRM_CLIENT_CAP_PLANE_COLOR_PIPELINE
In reply to Alex HungLe 15/08/2025 à 06:06, Alex Hung a écrit :
Quoted 30 lines
From: Harry Wentland <[email protected]>
Setting the
COLOR_PIPELINEplane prop is only allowed when theDRM_CLIENT_CAP_PLANE_COLOR_PIPELINEis set.Setting
COLOR_RANGEandCOLOR_ENCODINGis only allowed when theDRM_CLIENT_CAP_PLANE_COLOR_PIPELINEis NOT set.Signed-off-by Alex Hung <[email protected]>Signed-off-by Harry Wentland <[email protected]>--- include/drm-uapi/drm.h | 15 ++++++++++ lib/igt_kms.c | 63 ++++++++++++++++++++++++++++++++++-------- lib/igt_kms.h | 1 + tests/kms_properties.c | 20 ++++++++++---- 4 files changed, 81 insertions(+), 18 deletions(-)include/drm-uapi/drm.h +5
-0@@ -869,6 +869,21 @@ struct drm_get_cap {*/ #define DRM_CLIENT_CAP_CURSOR_PLANE_HOTSPOT 6 +/** +* DRM_CLIENT_CAP_PLANE_COLOR_PIPELINE +* +* If set to 1, the DRM core will +* - expose plane COLOR_PIPELINE properties for pre-blending color management.
include/drm-uapi/drm.h struct drm_get_cap { · line 886
Quoted 10 lines
include/drm-uapi/drm.h +10
-0+* - reject setting of these plane properties: +* - COLOR_ENCODING +* - COLOR_RANGE +* +* The client must enable &DRM_CLIENT_CAP_ATOMIC first. +* +* This capability is currently in development. +*/ +#define DRM_CLIENT_CAP_PLANE_COLOR_PIPELINE 7 +
I think this should go in a separate commit ("inclde/drm-uapi: sync with color pipeline series")
Quoted 181 lines
include/drm-uapi/drm.h +0
-0/* DRM_IOCTL_SET_CLIENT_CAP ioctl argument type */ struct drm_set_client_cap {__u64 capability;lib/igt_kms.c +51
-12@@ -2545,6 +2545,8 @@ static int get_drm_plane_type(int drm_fd, uint32_t plane_id)static void igt_plane_reset (igt_plane_t *plane) { +igt_display_t *display = plane->pipe->display; +/* Reset src coordinates. */ igt_plane_set_prop_value (plane,IGT_PLANE_SRC_X ,0 );igt_plane_set_prop_value (plane,IGT_PLANE_SRC_Y ,0 );@@ -2561,13 +2563,15 @@ static void igt_plane_reset(igt_plane_t *plane)igt_plane_set_prop_value (plane,IGT_PLANE_FB_ID ,0 );igt_plane_set_prop_value (plane,IGT_PLANE_CRTC_ID ,0 ); -if (igt_plane_has_prop (plane,IGT_PLANE_COLOR_ENCODING )) -igt_plane_set_prop_enum (plane,IGT_PLANE_COLOR_ENCODING , -igt_color_encoding_to_str (IGT_COLOR_YCBCR_BT601 )); +if (!display->has_plane_color_pipeline) { +if (igt_plane_has_prop (plane,IGT_PLANE_COLOR_ENCODING )) +igt_plane_set_prop_enum (plane,IGT_PLANE_COLOR_ENCODING , +igt_color_encoding_to_str (IGT_COLOR_YCBCR_BT601 )); -if (igt_plane_has_prop (plane,IGT_PLANE_COLOR_RANGE )) -igt_plane_set_prop_enum (plane,IGT_PLANE_COLOR_RANGE , -igt_color_range_to_str (IGT_COLOR_YCBCR_LIMITED_RANGE )); +if (igt_plane_has_prop (plane,IGT_PLANE_COLOR_RANGE )) +igt_plane_set_prop_enum (plane,IGT_PLANE_COLOR_RANGE , +igt_color_range_to_str (IGT_COLOR_YCBCR_LIMITED_RANGE )); + }/* Use default rotation */ if (igt_plane_has_prop (plane,IGT_PLANE_ROTATION ))@@ -2982,6 +2986,9 @@ void igt_display_require(igt_display_t *display, int drm_fd)if (drmSetClientCap (drm_fd,LOCAL_DRM_CLIENT_CAP_CURSOR_PLANE_HOTSPOT ,1 ) ==0 ) display->has_virt_cursor_plane =1 ; +if (drmSetClientCap (drm_fd,DRM_CLIENT_CAP_PLANE_COLOR_PIPELINE ,1 ) ==0 ) + display->has_plane_color_pipeline =1 ; + plane_resources =drmModeGetPlaneResources (display->drm_fd);igt_assert (plane_resources);@@ -3609,6 +3616,29 @@ static uint32_t igt_plane_get_fb_id(igt_plane_t *plane)igt_assert_eq (r,0 ); \ } +static bool +igt_atomic_ignore_plane_prop (igt_pipe_t *pipe,uint32_t prop) +{ +igt_display_t *display = pipe->display; + +if (display->has_plane_color_pipeline) { +switch (prop) { +case IGT_PLANE_COLOR_ENCODING : +case IGT_PLANE_COLOR_RANGE : +return true; +default : +return false; + } + }else { +switch (prop) { +default : +return false; + } + } + +return false; +} +/* * Add position and fb changes of a plane to the atomic property set */ @@ -3628,6 +3658,12 @@ igt_atomic_prepare_plane_commit(igt_plane_t *plane, igt_pipe_t *pipe, igt_plane_get_fb_id(plane));for (i =0 ; i <IGT_NUM_PLANE_PROPS ; i++) { +if (igt_atomic_ignore_plane_prop (pipe, i)) { +igt_debug ("plane %s.%d: Ignoring property \"%s\" to 0x%" PRIx64"/%" PRIi64"\n" , +kmstest_pipe_name (pipe->pipe), plane->index, igt_plane_prop_names[i], + plane->values[i], plane->values[i]);continue ; + } +if (!igt_plane_is_prop_changed (plane, i))continue ;@@ -5222,12 +5258,15 @@ void igt_plane_set_fb(igt_plane_t *plane, struct igt_fb *fb)igt_fb_set_position (fb, plane,0 ,0 );igt_fb_set_size (fb, plane, fb->width, fb->height); -if (igt_plane_has_prop (plane,IGT_PLANE_COLOR_ENCODING )) -igt_plane_set_prop_enum (plane,IGT_PLANE_COLOR_ENCODING , -igt_color_encoding_to_str (fb->color_encoding)); -if (igt_plane_has_prop (plane,IGT_PLANE_COLOR_RANGE )) -igt_plane_set_prop_enum (plane,IGT_PLANE_COLOR_RANGE , -igt_color_range_to_str (fb->color_range)); +if (!display->has_plane_color_pipeline) { +if (igt_plane_has_prop (plane,IGT_PLANE_COLOR_ENCODING )) +igt_plane_set_prop_enum (plane,IGT_PLANE_COLOR_ENCODING , +igt_color_encoding_to_str (fb->color_encoding)); + +if (igt_plane_has_prop (plane,IGT_PLANE_COLOR_RANGE )) +igt_plane_set_prop_enum (plane,IGT_PLANE_COLOR_RANGE , +igt_color_range_to_str (fb->color_range)); + }/* Hack to prioritize the plane on the pipe that last set fb */ igt_plane_set_pipe (plane, pipe);lib/igt_kms.h +1
-0@@ -508,6 +508,7 @@ struct igt_display {bool has_cursor_plane;bool is_atomic;bool has_virt_cursor_plane; +bool has_plane_color_pipeline;bool first_commit;uint64_t *modifiers;tests/kms_properties.c +12
-4@@ -101,7 +101,7 @@ static void cleanup_pipe(igt_display_t *display, enum pipe pipe, igt_output_t *o }static bool ignore_property (uint32_t obj_type,uint32_t prop_flags, -const char *name,bool atomic) +const char *name,bool atomic,bool has_color_pipeline) {if (prop_flags &DRM_MODE_PROP_IMMUTABLE )return true;@@ -111,6 +111,14 @@ static bool ignore_property(uint32_t obj_type, uint32_t prop_flags,if (atomic && !strcmp (name,"DPMS" ))return true;break ; +case DRM_MODE_OBJECT_PLANE : +if (has_color_pipeline && !strcmp (name,"COLOR_RANGE" )) +return true; + +if (has_color_pipeline && !strcmp (name,"COLOR_ENCODING" )) +return true; + +break ;default :break ; }@@ -164,7 +172,7 @@ static bool has_additional_test_lookup(uint32_t obj_type, const char *name,return false; } -static void test_properties (int fd,uint32_t type,uint32_t id,bool atomic) +static void test_properties (int fd,uint32_t type,uint32_t id,bool atomic,bool has_color_pipeline) {drmModeObjectPropertiesPtr props =drmModeObjectGetProperties (fd, id, type);@@ -183,7 +191,7 @@ static void test_properties(int fd, uint32_t type, uint32_t id, bool atomic)igt_assert (prop); -if (ignore_property (type, prop->flags, prop->name, atomic)) { +if (ignore_property (type, prop->flags, prop->name, atomic, has_color_pipeline)) {igt_debug ("Ignoring property \"%s\"\n" , prop->name);continue ;@@ -230,7 +238,7 @@ static void run_plane_property_tests(igt_display_t *display, enum pipe pipe, igtigt_info ("Testing plane properties on %s.#%d-%s (output: %s)\n" ,kmstest_pipe_name (pipe), plane->index,kmstest_plane_type_name (plane->type), output->name); -test_properties (display->drm_fd,DRM_MODE_OBJECT_PLANE , plane->drm_plane->plane_id, atomic); +test_properties (display->drm_fd,DRM_MODE_OBJECT_PLANE , plane->drm_plane->plane_id, atomic, display->has_plane_color_pipeline); }cleanup_pipe (display, pipe, output, &fb);
tests/kms_properties.c static void run_crtc_property_tests(igt_display_t *display, enum pipe pipe, igt_ · line 255
Quoted 5 lines
tests/kms_properties.c +1
-1@@ -244,7 +252,7 @@ static void run_crtc_property_tests(igt_display_t *display, enum pipe pipe, igt_igt_info ("Testing crtc properties on %s (output: %s)\n" ,kmstest_pipe_name (pipe), output->name); -test_properties (display->drm_fd,DRM_MODE_OBJECT_CRTC , display->pipes[pipe].crtc_id, atomic); +test_properties (display->drm_fd,DRM_MODE_OBJECT_CRTC , display->pipes[pipe].crtc_id, atomic, false);
Is there a reason to not use display->has_plane_color_pipeline here?
tests/kms_properties.c static void run_connector_property_tests(igt_display_t *display, enum pipe pipe, · line 269
Quoted 9 lines
tests/kms_properties.c +1
-1cleanup_pipe (display, pipe, output, &fb); }@@ -258,7 +266,7 @@ static void run_connector_property_tests(igt_display_t *display, enum pipe pipe,igt_info ("Testing connector properties on output %s (pipe: %s)\n" , output->name,kmstest_pipe_name (pipe)); -test_properties (display->drm_fd,DRM_MODE_OBJECT_CONNECTOR , output->id, atomic); +test_properties (display->drm_fd,DRM_MODE_OBJECT_CONNECTOR , output->id, atomic, false);
Ditto
Quoted 3 lines
tests/kms_properties.c +0
-0if (pipe !=PIPE_NONE )cleanup_pipe (display, pipe, output, &fb);
Signature · 4 lines
-- Louis Chauvet, Bootlin Embedded Linux and Kernel engineering https://bootlin.com
Re: [PATCH V10 02/30] lib/igt_kms: Introduce DRM_CLIENT_CAP_PLANE_COLOR_PIPELINE
Hi all,
Quoted 37 lines · Louis Chauvet
Le 15/08/2025 à 06:06, Alex Hung a écrit :
Quoted 34 lines
From: Harry Wentland <[email protected]>
Setting the
COLOR_PIPELINEplane prop is only allowed when theDRM_CLIENT_CAP_PLANE_COLOR_PIPELINEis set.Setting
COLOR_RANGEandCOLOR_ENCODINGis only allowed when theDRM_CLIENT_CAP_PLANE_COLOR_PIPELINEis NOT set.Signed-off-by Alex Hung <[email protected]>Signed-off-by Harry Wentland <[email protected]>--- include/drm-uapi/drm.h | 15 ++++++++++ lib/igt_kms.c | 63 ++++++++++++++++++++++++++++++++++-------- lib/igt_kms.h | 1 + tests/kms_properties.c | 20 ++++++++++---- 4 files changed, 81 insertions(+), 18 deletions(-)include/drm-uapi/drm.h +10
-0@@ -869,6 +869,21 @@ struct drm_get_cap {*/ #define DRM_CLIENT_CAP_CURSOR_PLANE_HOTSPOT 6 +/** +* DRM_CLIENT_CAP_PLANE_COLOR_PIPELINE +* +* If set to 1, the DRM core will +* - expose plane COLOR_PIPELINE properties for pre-blending color management. +* - reject setting of these plane properties: +* - COLOR_ENCODING +* - COLOR_RANGE +* +* The client must enable &DRM_CLIENT_CAP_ATOMIC first.
Quoted 9 lines
include/drm-uapi/drm.h struct drm_get_cap { · line 886
Quoted 5 lines
include/drm-uapi/drm.h +5
-0+* +* This capability is currently in development. +*/ +#define DRM_CLIENT_CAP_PLANE_COLOR_PIPELINE 7 +I think this should go in a separate commit ("inclde/drm-uapi: sync with color pipeline series")
O even shorter:
drm-uapi/drm: sync with color pipeline commit
and in description give a sha1 for drm-next commit which introduces COLOROP changes. See log with
git log -- include/drm-uapi/drm.h
Please make uapi change in separate patch(es). You could also read about it in igt README.md
Regards,
Kamil
[cut]
Re: [PATCH V10 02/30] lib/igt_kms: Introduce DRM_CLIENT_CAP_PLANE_COLOR_PIPELINE
Quoted 53 lines · Kamil Konieczny
Hi all,
Quoted 37 lines · Louis Chauvet
Le 15/08/2025 à 06:06, Alex Hung a écrit :
Quoted 34 lines
From: Harry Wentland <[email protected]>
Setting the
COLOR_PIPELINEplane prop is only allowed when theDRM_CLIENT_CAP_PLANE_COLOR_PIPELINEis set.Setting
COLOR_RANGEandCOLOR_ENCODINGis only allowed when theDRM_CLIENT_CAP_PLANE_COLOR_PIPELINEis NOT set.Signed-off-by Alex Hung <[email protected]>Signed-off-by Harry Wentland <[email protected]>--- include/drm-uapi/drm.h | 15 ++++++++++ lib/igt_kms.c | 63 ++++++++++++++++++++++++++++++++++-------- lib/igt_kms.h | 1 + tests/kms_properties.c | 20 ++++++++++---- 4 files changed, 81 insertions(+), 18 deletions(-)include/drm-uapi/drm.h +10
-0@@ -869,6 +869,21 @@ struct drm_get_cap {*/ #define DRM_CLIENT_CAP_CURSOR_PLANE_HOTSPOT 6 +/** +* DRM_CLIENT_CAP_PLANE_COLOR_PIPELINE +* +* If set to 1, the DRM core will +* - expose plane COLOR_PIPELINE properties for pre-blending color management. +* - reject setting of these plane properties: +* - COLOR_ENCODING +* - COLOR_RANGE +* +* The client must enable &DRM_CLIENT_CAP_ATOMIC first. Quoted 9 lines
include/drm-uapi/drm.h struct drm_get_cap { · line 886
Quoted 5 lines
include/drm-uapi/drm.h +5
-0+* +* This capability is currently in development. +*/ +#define DRM_CLIENT_CAP_PLANE_COLOR_PIPELINE 7 +I think this should go in a separate commit ("inclde/drm-uapi: sync with color pipeline series")
O even shorter:
drm-uapi/drm: sync with color pipeline commit
Quoted 8 lines
and in description give a sha1 for drm-next commit which introduces COLOROP changes. See log with
git log --
include/drm-uapi/drm.hPlease make uapi change in separate patch(es). You could also read about it in igt README.md
Thanks. I will separate changes in drm-uapi into another commit.
Kernel change is not yet merged so sha# may need to be updated later.
Quoted 4 lines
Regards,
Kamil[cut]
Re: [PATCH V10 02/30] lib/igt_kms: Introduce DRM_CLIENT_CAP_PLANE_COLOR_PIPELINE
In reply to Louis ChauvetQuoted 229 lines · Louis Chauvet
Le 15/08/2025 à 06:06, Alex Hung a écrit :
Quoted 38 lines
From: Harry Wentland <[email protected]>
Setting the
COLOR_PIPELINEplane prop is only allowed when theDRM_CLIENT_CAP_PLANE_COLOR_PIPELINEis set.Setting
COLOR_RANGEandCOLOR_ENCODINGis only allowed when theDRM_CLIENT_CAP_PLANE_COLOR_PIPELINEis NOT set.Signed-off-by Alex Hung <[email protected]>Signed-off-by Harry Wentland <[email protected]>---
include/drm-uapi/drm.h| 15 ++++++++++
lib/igt_kms.c | 63 ++++++++++++++++++++++++++++++++++-------- lib/igt_kms.h | 1 +
tests/kms_properties.c| 20 ++++++++++----4 files changed, 81 insertions(+), 18 deletions(-)include/drm-uapi/drm.h +5
-0@@ -869,6 +869,21 @@ struct drm_get_cap {*/ #define DRM_CLIENT_CAP_CURSOR_PLANE_HOTSPOT 6 +/** +* DRM_CLIENT_CAP_PLANE_COLOR_PIPELINE +* +* If set to 1, the DRM core will +* - expose plane COLOR_PIPELINE properties for pre-blending color management.
+ * - reject setting of these plane properties:
+ * -COLOR_ENCODING
+ * -COLOR_RANGE
+ *
+ * The client must enable&DRM_CLIENT_CAP_ATOMICfirst.
+ *
+ * This capability is currently in development.
+ */include/drm-uapi/drm.h struct drm_get_cap { · line 886
Quoted 2 lines
include/drm-uapi/drm.h +2
-0+#define DRM_CLIENT_CAP_PLANE_COLOR_PIPELINE 7 +I think this should go in a separate commit ("inclde/drm-uapi: sync with color pipeline series")
Quoted 183 lines
/*
DRM_IOCTL_SET_CLIENT_CAPioctl argument type */ structdrm_set_client_cap{
__u64capability;lib/igt_kms.c +42
-6@@ -2545,6 +2545,8 @@ static int get_drm_plane_type(int drm_fd, uint32_t plane_id) static void igt_plane_reset(igt_plane_t *plane) { + igt_display_t *display = plane->pipe->display; + /* Reset src coordinates. */ igt_plane_set_prop_value(plane, IGT_PLANE_SRC_X, 0); igt_plane_set_prop_value(plane, IGT_PLANE_SRC_Y, 0);@@ -2561,13 +2563,15 @@ static void igt_plane_reset(igt_plane_t *plane) igt_plane_set_prop_value(plane, IGT_PLANE_FB_ID, 0); igt_plane_set_prop_value(plane, IGT_PLANE_CRTC_ID, 0); - if (igt_plane_has_prop(plane, IGT_PLANE_COLOR_ENCODING)) - igt_plane_set_prop_enum(plane, IGT_PLANE_COLOR_ENCODING, - igt_color_encoding_to_str(IGT_COLOR_YCBCR_BT601)); + if (!display->has_plane_color_pipeline) { + if (igt_plane_has_prop(plane, IGT_PLANE_COLOR_ENCODING)) + igt_plane_set_prop_enum(plane, IGT_PLANE_COLOR_ENCODING, + igt_color_encoding_to_str(IGT_COLOR_YCBCR_BT601)); - if (igt_plane_has_prop(plane, IGT_PLANE_COLOR_RANGE)) - igt_plane_set_prop_enum(plane, IGT_PLANE_COLOR_RANGE, - igt_color_range_to_str(IGT_COLOR_YCBCR_LIMITED_RANGE)); + if (igt_plane_has_prop(plane, IGT_PLANE_COLOR_RANGE)) + igt_plane_set_prop_enum(plane, IGT_PLANE_COLOR_RANGE, + igt_color_range_to_str(IGT_COLOR_YCBCR_LIMITED_RANGE)); + } /* Use default rotation */ if (igt_plane_has_prop(plane, IGT_PLANE_ROTATION))@@ -2982,6 +2986,9 @@ void igt_display_require(igt_display_t *display, int drm_fd) if (drmSetClientCap(drm_fd, LOCAL_DRM_CLIENT_CAP_CURSOR_PLANE_HOTSPOT, 1) == 0) display->has_virt_cursor_plane = 1; + if (drmSetClientCap(drm_fd, DRM_CLIENT_CAP_PLANE_COLOR_PIPELINE,1 ) ==0 ) + display->has_plane_color_pipeline = 1; + plane_resources = drmModeGetPlaneResources(display->drm_fd); igt_assert(plane_resources);@@ -3609,6 +3616,29 @@ static uint32_t igt_plane_get_fb_id(igt_plane_t *plane) igt_assert_eq(r, 0); \ } +static bool +igt_atomic_ignore_plane_prop (igt_pipe_t *pipe,uint32_t prop) +{ + igt_display_t *display = pipe->display; + + if (display->has_plane_color_pipeline) { + switch (prop) { + case IGT_PLANE_COLOR_ENCODING: + case IGT_PLANE_COLOR_RANGE: + return true; + default: + return false; + } + } else { + switch (prop) { + default: + return false; + } + } + + return false; +} + /** Add position and fb changes of a plane to the atomic property set */ @@ -3628,6 +3658,12 @@ igt_atomic_prepare_plane_commit(igt_plane_t *plane, igt_pipe_t *pipe, igt_plane_get_fb_id(plane)); for (i = 0; i < IGT_NUM_PLANE_PROPS; i++) { + if (igt_atomic_ignore_plane_prop(pipe, i)) { + igt_debug("plane %s.%d: Ignoring property \"%s\" to 0x%"PRIx64"/%"PRIi64"\n", + kmstest_pipe_name(pipe->pipe), plane->index, igt_plane_prop_names[i], + plane->values[i], plane->values[i]); continue; + } + if (!igt_plane_is_prop_changed(plane, i))continue;
lib/igt_kms.c +9
-6@@ -5222,12 +5258,15 @@ void igt_plane_set_fb(igt_plane_t *plane, struct igt_fb *fb) igt_fb_set_position(fb, plane, 0, 0); igt_fb_set_size(fb, plane, fb->width, fb->height); - if (igt_plane_has_prop(plane, IGT_PLANE_COLOR_ENCODING)) - igt_plane_set_prop_enum(plane, IGT_PLANE_COLOR_ENCODING, - igt_color_encoding_to_str(fb->color_encoding)); - if (igt_plane_has_prop(plane, IGT_PLANE_COLOR_RANGE)) - igt_plane_set_prop_enum(plane, IGT_PLANE_COLOR_RANGE, - igt_color_range_to_str(fb->color_range)); + if (!display->has_plane_color_pipeline) { + if (igt_plane_has_prop(plane, IGT_PLANE_COLOR_ENCODING)) + igt_plane_set_prop_enum(plane, IGT_PLANE_COLOR_ENCODING, + igt_color_encoding_to_str(fb->color_encoding)); + + if (igt_plane_has_prop(plane, IGT_PLANE_COLOR_RANGE)) + igt_plane_set_prop_enum(plane, IGT_PLANE_COLOR_RANGE, + igt_color_range_to_str(fb->color_range)); + } /* Hack to prioritize the plane on the pipe that last set fb */ igt_plane_set_pipe(plane, pipe);lib/igt_kms.h +1
-0@@ -508,6 +508,7 @@ struct igt_display { bool has_cursor_plane; bool is_atomic; bool has_virt_cursor_plane; + bool has_plane_color_pipeline; bool first_commit; uint64_t *modifiers;tests/kms_properties.c +0
-0@@ -101,7 +101,7 @@ static void cleanup_pipe(igt_display_t *display,enum pipe pipe,
igt_output_t*o
}
static bool ignore_property(uint32_tobj_type,uint32_tprop_flags, - const char *name, bool atomic)
+ const char *name, bool atomic, boolhas_color_pipeline) {
if (prop_flags&DRM_MODE_PROP_IMMUTABLE)
return true;tests/kms_properties.c +8
-0@@ -111,6 +111,14 @@ static bool ignore_property(uint32_t obj_type, uint32_t prop_flags, if (atomic && !strcmp(name, "DPMS")) return true; break; + case DRM_MODE_OBJECT_PLANE: + if (has_color_pipeline && !strcmp(name, "COLOR_RANGE")) + return true; + + if (has_color_pipeline && !strcmp(name, "COLOR_ENCODING")) + return true; + + break;default:
break;
}tests/kms_properties.c +1
-1@@ -164,7 +172,7 @@ static bool has_additional_test_lookup(uint32_t obj_type, const char *name, return false; } -static void test_properties (int fd,uint32_t type,uint32_t id,bool atomic) +static void test_properties(int fd, uint32_t type, uint32_t id, bool atomic,bool has_color_pipeline) {drmModeObjectPropertiesPtr props =
drmModeObjectGetProperties(fd, id, type);tests/kms_properties.c +2
-2@@ -183,7 +191,7 @@ static void test_properties(int fd, uint32_t type, uint32_t id, bool atomic) igt_assert(prop); - if (ignore_property(type, prop->flags, prop->name, atomic)) { + if (ignore_property(type, prop->flags, prop->name, atomic, has_color_pipeline)) { igt_debug("Ignoring property \"%s\"\n", prop->name); continue;@@ -230,7 +238,7 @@ static void run_plane_property_tests(igt_display_t *display, enum pipe pipe, igt igt_info("Testing plane properties on %s.#%d-%s (output: %s)\n", kmstest_pipe_name(pipe), plane->index, kmstest_plane_type_name(plane->type), output->name); - test_properties(display->drm_fd, DRM_MODE_OBJECT_PLANE, plane->drm_plane->plane_id, atomic); + test_properties(display->drm_fd, DRM_MODE_OBJECT_PLANE, plane->drm_plane->plane_id, atomic, display->has_plane_color_pipeline); }
cleanup_pipe(display, pipe, output, &fb);tests/kms_properties.c +0
-1@@ -244,7 +252,7 @@ static void run_crtc_property_tests(igt_display_t *display, enum pipe pipe, igt_ igt_info("Testing crtc properties on %s (output: %s)\n", kmstest_pipe_name(pipe), output->name); - test_properties(display->drm_fd, DRM_MODE_OBJECT_CRTC, display-
Quoted 5 lines
tests/kms_properties.c static void run_crtc_property_tests(igt_display_t · line 256
Quoted 3 lines
tests/kms_properties.c +1
-0>pipes[pipe].crtc_id, atomic); + test_properties(display->drm_fd, DRM_MODE_OBJECT_CRTC, display- >pipes[pipe].crtc_id, atomic, false);Is there a reason to not use
display->has_plane_color_pipelinehere?
The patchset focus on plane so it is false for CRTC and connector (below) for now instead of passing display->has_plane_color_pipeline for CRTC or connector.
Hi Harry, please correct me if I am mistaken.
Quoted 16 lines
tests/kms_properties.c static void · line 270
Quoted 10 lines
tests/kms_properties.c +1
-1cleanup_pipe(display, pipe, output, &fb); }@@ -258,7 +266,7 @@ static void run_connector_property_tests(igt_display_t *display, enum pipe pipe, igt_info("Testing connector properties on output %s (pipe: %s)\n", output->name, kmstest_pipe_name(pipe)); - test_properties(display->drm_fd, DRM_MODE_OBJECT_CONNECTOR, output->id, atomic); + test_properties(display->drm_fd, DRM_MODE_OBJECT_CONNECTOR, output->id, atomic, false);Ditto
Quoted 2 lines
tests/kms_properties.c +0
-0if (pipe != PIPE_NONE) cleanup_pipe(display, pipe, output, &fb);
PATCH v10 3/30 drm-uapi: Add COLOROP object
In reply to Alex HungFrom: Harry Wentland <[email protected]>
DRM is introducing a new DRM core obejct, a drm_colorop. This object will represent one color operation in a color pipeline.
Introduce the object type in the drm-uapi, including the following types:
- DRM_COLOROP_1D_CURVE,
- DRM_COLOROP_1D_LUT,
- DRM_COLOROP_CTM_3X4,
--- include/drm-uapi/amdgpu_drm.h | 9 -- include/drm-uapi/drm_mode.h | 23 +++ lib/igt_kms.c | 272 +++++++++++++++++++++++++++++++++- lib/igt_kms.h | 89 +++++++++++ tests/kms_properties.c | 3 + 5 files changed, 381 insertions(+), 15 deletions(-)
include/drm-uapi/amdgpu_drm.h +0 -9
@@ -1590,15 +1590,6 @@ struct drm_amdgpu_info_uq_metadata {#define AMDGPU_FAMILY_GC_11_5_0 150/* GC 11.5.0 */ #define AMDGPU_FAMILY_GC_12_0_0 152/* GC 12.0.0 */ -/* FIXME wrong namespace! */ -struct drm_color_ctm_3x4 { -/* -* Conversion matrix with 3x4 dimensions in S31.32 sign-magnitude -* (not two's complement!) format. -*/ -__u64 matrix[12 ]; -}; -#if defined(__cplusplus) }#endif
include/drm-uapi/drm_mode.h +23 -0
@@ -629,6 +629,7 @@ struct drm_mode_connector_set_property {#define DRM_MODE_OBJECT_FB 0xfbfbfbfb#define DRM_MODE_OBJECT_BLOB 0xbbbbbbbb#define DRM_MODE_OBJECT_PLANE 0xeeeeeeee +#define DRM_MODE_OBJECT_COLOROP 0xfafafafa#define DRM_MODE_OBJECT_ANY 0struct drm_mode_obj_get_properties {
@@ -846,6 +847,22 @@ struct drm_color_ctm {__u64 matrix[9 ]; }; +struct drm_color_ctm_3x4 { +/* +* Conversion matrix with 3x4 dimensions in S31.32 sign-magnitude +* (not two's complement!) format. +* +* TODO what's the format? +* +* out matrix in +* |R| |0 1 2 3 | | R | +* |G| = |4 5 6 7 | x | G | +* |B| |8 9 10 12| | B | +* |1.0| +*/ +__u64 matrix[12 ]; +}; +struct drm_color_lut {/* * Values are mapped linearly to 0.0 - 1.0 range, with 0x0 == 0.0 and
@@ -857,6 +874,12 @@ struct drm_color_lut {__u16 reserved; }; +enum drm_colorop_type { +DRM_COLOROP_1D_CURVE , +DRM_COLOROP_1D_LUT , +DRM_COLOROP_CTM_3X4 , +}; +/** * struct drm_plane_size_hint - Plane size hints * @width: The width of the plane in pixel
lib/igt_kms.c +266 -6
342 lines not on this page · raw message
lib/igt_kms.h +89 -0
139 lines not on this page · raw message
tests/kms_properties.c +3 -0
@@ -112,6 +112,9 @@ static bool ignore_property(uint32_t obj_type, uint32_t prop_flags,return true;break ;case DRM_MODE_OBJECT_PLANE : +if (!has_color_pipeline && !strcmp (name,"COLOR_PIPELINE" )) +return true; +if (has_color_pipeline && !strcmp (name,"COLOR_RANGE" ))return true;
Signature · 1 line
2.43.0
Re: [PATCH V10 03/30] drm-uapi: Add COLOROP object
Quoted 54 lines · Alex Hung
From: Harry Wentland <[email protected]>
DRM is introducing a new DRM core obejct, a
drm_colorop. This object will represent one color operation in a color pipeline.Introduce the object type in the drm-uapi, including the following types:
-DRM_COLOROP_1D_CURVE,
-DRM_COLOROP_1D_LUT,
-DRM_COLOROP_CTM_3X4,Signed-off-by Alex Hung <[email protected]>Signed-off-by Harry Wentland <[email protected]>--- include/drm-uapi/amdgpu_drm.h | 9 -- include/drm-uapi/drm_mode.h | 23 +++ lib/igt_kms.c | 272 +++++++++++++++++++++++++++++++++- lib/igt_kms.h | 89 +++++++++++ tests/kms_properties.c | 3 + 5 files changed, 381 insertions(+), 15 deletions(-)include/drm-uapi/amdgpu_drm.h +0
-9@@ -1590,15 +1590,6 @@ struct drm_amdgpu_info_uq_metadata {#define AMDGPU_FAMILY_GC_11_5_0 150/* GC 11.5.0 */ #define AMDGPU_FAMILY_GC_12_0_0 152/* GC 12.0.0 */ -/* FIXME wrong namespace! */ -struct drm_color_ctm_3x4 { -/* -* Conversion matrix with 3x4 dimensions in S31.32 sign-magnitude -* (not two's complement!) format. -*/ -__u64 matrix[12 ]; -}; -#if defined(__cplusplus) }#endif include/drm-uapi/drm_mode.h +1
-0@@ -629,6 +629,7 @@ struct drm_mode_connector_set_property {#define DRM_MODE_OBJECT_FB 0xfbfbfbfb#define DRM_MODE_OBJECT_BLOB 0xbbbbbbbb#define DRM_MODE_OBJECT_PLANE 0xeeeeeeee +#define DRM_MODE_OBJECT_COLOROP 0xfafafafa#define DRM_MODE_OBJECT_ANY 0struct drm_mode_obj_get_properties {
include/drm-uapi/drm_mode.h struct drm_color_ctm { · line 855
Quoted 9 lines
include/drm-uapi/drm_mode.h +6
-0@@ -846,6 +847,22 @@ struct drm_color_ctm {__u64 matrix[9 ]; }; +struct drm_color_ctm_3x4 { +/* +* Conversion matrix with 3x4 dimensions in S31.32 sign-magnitude +* (not two's complement!) format. +* +* TODO what's the format?
The format seems to be mentioned right above this line, so perhaps this is a stale TODO ?
include/drm-uapi/drm_mode.h struct drm_color_ctm { · line 860
Quoted 5 lines
include/drm-uapi/drm_mode.h +5
-0+* +* out matrix in +* |R| |0 1 2 3 | | R | +* |G| = |4 5 6 7 | x | G | +* |B| |8 9 10 12| | B |
Typo 11 instead of 12 ?
Re: [PATCH V10 03/30] drm-uapi: Add COLOROP object
In reply to Alex HungQuoted 21 lines · Alex Hung
From: Harry Wentland <[email protected]>
DRM is introducing a new DRM core obejct, a
drm_colorop. This object will represent one color operation in a color pipeline.Introduce the object type in the drm-uapi, including the following types:
-DRM_COLOROP_1D_CURVE,
-DRM_COLOROP_1D_LUT,
-DRM_COLOROP_CTM_3X4,Signed-off-by Alex Hung <[email protected]>Signed-off-by Harry Wentland <[email protected]>---
include/drm-uapi/amdgpu_drm.h | 9 --
include/drm-uapi/drm_mode.h | 23 +++
lib/igt_kms.c | 272
+++++++++++++++++++++++++++++++++-
lib/igt_kms.h | 89 +++++++++++
tests/kms_properties.c | 3 +5 files changed, 381 insertions(+), 15 deletions(-)
[..]
Quoted 13 lines
(quoted diff) +0
-0@@ -4519,6 +4774,11 @@ static int igt_atomic_commit(igt_display_t *display, uint32_t flags, void *user_
if (plane->changed)igt_atomic_prepare_plane_commit(plan e, pipe_obj, req);(quoted diff) +2
-0+ + /* TODO iterate over assigned color pipelineand prepare colorop commit */
(quoted diff) +2
-0+ if (plane->assigned_color_pipeline) + igt_atomic_prepare_colorop_commit(pl
ane->assigned_color_pipeline,(quoted diff) +1
-0+
Quoted 4 lines
pipe_obj, req);
}
}
This seems to be a stale TODO as you're doing exactly that here already.
Signature · 3 lines
Thanks, Nícolas
Re: [PATCH V10 03/30] drm-uapi: Add COLOROP object
In reply to Alex HungLe 15/08/2025 à 06:06, Alex Hung a écrit :
Quoted 11 lines
From: Harry Wentland <[email protected]>
DRM is introducing a new DRM core obejct, a
drm_colorop. This object will represent one color operation in a color pipeline.Introduce the object type in the drm-uapi, including the following types:
-DRM_COLOROP_1D_CURVE,
-DRM_COLOROP_1D_LUT,
-DRM_COLOROP_CTM_3X4,
Quoted 5 lines
Signed-off-by Alex Hung <[email protected]>Signed-off-by Harry Wentland <[email protected]>--- include/drm-uapi/amdgpu_drm.h | 9 -- include/drm-uapi/drm_mode.h | 23 +++
Same as 01/30, I think this could be a separate patch "update headers".
I don't know what maintainers want, but I think all the update could be done in only one commit "update drm uapi headers to match color_op patches"
Quoted 158 lines
lib/igt_kms.c | 272 +++++++++++++++++++++++++++++++++- lib/igt_kms.h | 89 +++++++++++ tests/kms_properties.c | 3 + 5 files changed, 381 insertions(+), 15 deletions(-)include/drm-uapi/amdgpu_drm.h +0
-9@@ -1590,15 +1590,6 @@ struct drm_amdgpu_info_uq_metadata {#define AMDGPU_FAMILY_GC_11_5_0 150/* GC 11.5.0 */ #define AMDGPU_FAMILY_GC_12_0_0 152/* GC 12.0.0 */ -/* FIXME wrong namespace! */ -struct drm_color_ctm_3x4 { -/* -* Conversion matrix with 3x4 dimensions in S31.32 sign-magnitude -* (not two's complement!) format. -*/ -__u64 matrix[12 ]; -}; -#if defined(__cplusplus) }#endif include/drm-uapi/drm_mode.h +23
-0@@ -629,6 +629,7 @@ struct drm_mode_connector_set_property {#define DRM_MODE_OBJECT_FB 0xfbfbfbfb#define DRM_MODE_OBJECT_BLOB 0xbbbbbbbb#define DRM_MODE_OBJECT_PLANE 0xeeeeeeee +#define DRM_MODE_OBJECT_COLOROP 0xfafafafa#define DRM_MODE_OBJECT_ANY 0struct drm_mode_obj_get_properties {@@ -846,6 +847,22 @@ struct drm_color_ctm {__u64 matrix[9 ]; }; +struct drm_color_ctm_3x4 { +/* +* Conversion matrix with 3x4 dimensions in S31.32 sign-magnitude +* (not two's complement!) format. +* +* TODO what's the format? +* +* out matrix in +* |R| |0 1 2 3 | | R | +* |G| = |4 5 6 7 | x | G | +* |B| |8 9 10 12| | B | +* |1.0| +*/ +__u64 matrix[12 ]; +}; +struct drm_color_lut {/* * Values are mapped linearly to 0.0 - 1.0 range, with 0x0 == 0.0 and @@ -857,6 +874,12 @@ struct drm_color_lut {__u16 reserved; }; +enum drm_colorop_type { +DRM_COLOROP_1D_CURVE , +DRM_COLOROP_1D_LUT , +DRM_COLOROP_CTM_3X4 , +}; +/** * struct drm_plane_size_hint - Plane size hints * @width: The width of the plane in pixel lib/igt_kms.c +63
-0@@ -92,6 +92,7 @@#define MAX_CONNECTORS 32#define MAX_EDID 2#define DISPLAY_TILE_BLOCK 0x12 +#define MAX_NUM_COLOROPS 128typedef bool (*igt_connector_attr_set )(int dir,const char *attr,const char *value);@@ -702,6 +703,14 @@ const char * const igt_plane_prop_names[IGT_NUM_PLANE_PROPS] = { [IGT_PLANE_SCALING_FILTER] = "SCALING_FILTER", [IGT_PLANE_SIZE_HINTS] = "SIZE_HINTS", [IGT_PLANE_IN_FORMATS_ASYNC] = "IN_FORMATS_ASYNC", + [IGT_PLANE_COLOR_PIPELINE] = "COLOR_PIPELINE", +}; + +const char *const igt_colorop_prop_names[IGT_NUM_COLOROP_PROPS ] = { + [IGT_COLOROP_TYPE ] ="TYPE" , + [IGT_COLOROP_BYPASS ] ="BYPASS" , + [IGT_COLOROP_CURVE_1D_TYPE ] ="CURVE_1D_TYPE" , + [IGT_COLOROP_NEXT ] ="NEXT" , };const char *const igt_crtc_prop_names[IGT_NUM_CRTC_PROPS ] = {@@ -769,6 +778,108 @@ igt_plane_rotations(igt_display_t *display, igt_plane_t *plane,return rotations; } +/** +* igt_find_colorop: +* @display: display on which to look for colorop. +* @id: DRM object id of the colorop. +* +* Returns: An igt_colorop_t if found, or NULL otherwise. +*/ +igt_colorop_t *igt_find_colorop (igt_display_t *display,uint32_t id) +{ +int i; + +/* find corresponding igt_colorop */ +for (i =0 ; i < display->n_colorops; ++i) { +igt_colorop_t *colorop = &display->colorops[i]; + +if (colorop->id == id) +return colorop; + } + +return NULL ; +} + +/* +* Retrieve all the properies specified in props_name and store them into +* colorop->props. +*/ +static void +igt_fill_colorop_props (igt_display_t *display,igt_colorop_t *colorop, +int num_props,const char *const prop_names[]) +{ +drmModeObjectPropertiesPtr props; +int i, j, fd; + + fd = display->drm_fd; + + props =drmModeObjectGetProperties (fd, colorop->id,DRM_MODE_OBJECT_COLOROP ); +igt_assert (props); + +for (i =0 ; i < props->count_props; i++) { +drmModePropertyPtr prop = +drmModeGetProperty (fd, props->props[i]); + +for (j =0 ; j < num_props; j++) { +if (strcmp (prop->name, prop_names[j]) !=0 ) +continue ; + + colorop->props[j] = props->props[i]; +break ; + } + +drmModeFreeProperty (prop); + } +drmModeFreeObjectProperties (props); +}
lib/igt_kms.c igt_plane_rotations(igt_display_t *display, igt_plane_t *plane, · line 844
Quoted 10 lines
lib/igt_kms.c +10
-0+ +static void igt_fill_colorop (igt_display_t *display,igt_plane_t *plane, +igt_colorop_t *colorop,uint32_t id, +char *name) +{ + colorop->id = id; + colorop->plane = plane; + +if (name) +memcpy (colorop->name, name,sizeof (colorop->name));
Maybe use strncpy to avoid issue if name is smaller than colorop->name.
Quoted 16 lines
lib/igt_kms.c +16
-0+igt_fill_colorop_props (display, colorop,IGT_NUM_COLOROP_PROPS , igt_colorop_prop_names); +} + +static void +igt_fill_plane_color_pipelines (igt_display_t *display,igt_plane_t *plane, +drmModePropertyPtr prop) +{ +int i; +uint32_t colorop_id; + + plane->num_color_pipelines =0 ; + +for (i =0 ; i < prop->count_enums; i++) { +if (prop->enums[i].value) { +igt_colorop_t *colorop = &display->colorops[display->n_colorops++]; +
lib/igt_kms.c igt_plane_rotations(igt_display_t *display, igt_plane_t *plane, · line 871
Quoted 10 lines
lib/igt_kms.c +10
-0+igt_assert (display->n_colorops <MAX_NUM_COLOROPS ); + +igt_fill_colorop (display, plane, colorop, prop->enums[i].value, prop->enums[i].name); + plane->color_pipelines[plane->num_color_pipelines++] = colorop; + +/* get all NEXT colorops */ + colorop_id =igt_colorop_get_prop (display, colorop, +IGT_COLOROP_NEXT ); +while (colorop_id) { + colorop = &display->colorops[display->n_colorops++];
I think you also need to check the n_colorops value:
igt_assert(display->n_colorops < MAX_NUM_COLOROPS);
Quoted 11 lines
lib/igt_kms.c +11
-0+igt_fill_colorop (display, plane, colorop, colorop_id,NULL ); + colorop_id =igt_colorop_get_prop (display, colorop, +IGT_COLOROP_NEXT ); + } + } + } + +igt_assert (plane->num_color_pipelines <IGT_NUM_PLANE_COLOR_PIPELINES ); + +} +
[...]
Quoted 90 lines
lib/igt_kms.h +40
-0@@ -366,9 +366,18 @@ enum igt_atomic_plane_properties {IGT_PLANE_HOTSPOT_Y ,IGT_PLANE_SIZE_HINTS ,IGT_PLANE_IN_FORMATS_ASYNC , +IGT_PLANE_COLOR_PIPELINE , IGT_NUM_PLANE_PROPS, }; +enum igt_atomic_colorop_properties { +IGT_COLOROP_TYPE , +IGT_COLOROP_BYPASS , +IGT_COLOROP_CURVE_1D_TYPE , +IGT_COLOROP_NEXT , +IGT_NUM_COLOROP_PROPS +}; +/** * igt_plane_prop_names * @@ -377,10 +386,20 @@ enum igt_atomic_plane_properties {*/ extern const char *const igt_plane_prop_names[]; +/** +* igt_colorop_prop_names +* +* igt_colorop_prop_names contains a list of colorop property names, +* as indexed by the igt_atomic_colorop_properties enum. +*/ +extern const char *const igt_colorop_prop_names[]; +typedef struct igt_display igt_display_t ;typedef struct igt_pipe igt_pipe_t ;typedef uint32_t igt_fixed_t ;/* 16.16 fixed point */ +#define IGT_NUM_PLANE_COLOR_PIPELINES 4 + typedef enum { /* this maps to the kernel API */ IGT_ROTATION_0 = 1 << 0,@@ -406,6 +425,20 @@ static inline bool igt_rotation_90_or_270(igt_rotation_t rotation)return rotation & (IGT_ROTATION_90 |IGT_ROTATION_270 ); } +typedef struct igt_plane igt_plane_t ; + +typedef struct igt_colorop { +uint32_t id; +igt_plane_t *plane; + +char name[DRM_PROP_NAME_LEN ]; + +uint64_t changed; +uint32_t props[IGT_NUM_COLOROP_PROPS ]; +uint64_t values[IGT_NUM_COLOROP_PROPS ]; + +}igt_colorop_t ; + typedef struct igt_plane { /*< private >*/ igt_pipe_t *pipe;@@ -443,6 +476,11 @@ typedef struct igt_plane {uint64_t *async_modifiers;uint32_t *async_formats;int async_format_mod_count; + +igt_colorop_t *color_pipelines[IGT_NUM_PLANE_COLOR_PIPELINES ]; +int num_color_pipelines; + +igt_colorop_t *assigned_color_pipeline; } igt_plane_t;/* @@ -501,9 +539,11 @@ struct igt_display {int log_shift;int n_pipes;int n_planes; +int n_colorops;int n_outputs;igt_output_t *outputs;igt_plane_t *planes; +igt_colorop_t *colorops;igt_pipe_t *pipes;bool has_cursor_plane;bool is_atomic;
lib/igt_kms.h extern void igt_plane_set_prop_enum(igt_plane_t *plane, · line 894
Quoted 9 lines
lib/igt_kms.h +5
-0@@ -846,6 +886,53 @@ extern void igt_plane_set_prop_enum(igt_plane_t *plane,enum igt_atomic_plane_properties prop, const char *val); + + +extern bool igt_plane_is_valid_colorop (igt_plane_t *plane,igt_colorop_t *colorop); + +extern void igt_plane_set_color_pipeline (igt_plane_t *plane,igt_colorop_t *colorop);
(maybe a dumb question) why those fonctions are extern?
Quoted 65 lines
lib/igt_kms.h +43
-0+/** +* igt_colorop_has_prop: +* @colorop: colorop to check. +* @prop: Property to check. +* +* Check whether colorop supports a given property. +* +* Returns: True if the property is supported, otherwise false. +*/ +static inline bool +igt_colorop_has_prop (igt_colorop_t *colorop,enum igt_atomic_colorop_properties prop) +{ +return colorop->props[prop]; +} + +uint64_t igt_colorop_get_prop (igt_display_t *display,igt_colorop_t *colorop,enum igt_atomic_colorop_properties prop); + +#define igt_colorop_is_prop_changed (colorop, prop) \ + (!!((colorop)->changed & (1 << (prop)))) + +#define igt_colorop_set_prop_changed (colorop, prop) \ + ((colorop)->changed |= 1 << (prop)) + +#define igt_colorop_clear_prop_changed (colorop, prop) \ + ((colorop)->changed &= ~(1 << (prop))) + +#define igt_colorop_set_prop_value (colorop, prop, value) \ + do { \ + colorop->values[prop] = value; \ + igt_colorop_set_prop_changed(colorop, prop); \ + } while (0) + + +extern bool igt_colorop_try_prop_enum (igt_colorop_t *colorop, +enum igt_atomic_colorop_properties prop, +const char *val); + +extern void igt_colorop_set_prop_enum (igt_colorop_t *colorop, +enum igt_atomic_colorop_properties prop, +const char *val); +extern void igt_plane_replace_prop_blob (igt_plane_t *plane,enum igt_atomic_plane_properties prop,const void *ptr,size_t length);@@ -1289,4 +1376,6 @@ int igt_backlight_write(int value, const char *fname, igt_backlight_context_t *cdrmModePropertyBlobRes *igt_get_writeback_formats_blob (igt_output_t *output); +igt_colorop_t *igt_find_colorop (igt_display_t *display,uint32_t id); +#endif /* __IGT_KMS_H__ */ tests/kms_properties.c +3
-0@@ -112,6 +112,9 @@ static bool ignore_property(uint32_t obj_type, uint32_t prop_flags,return true;break ;case DRM_MODE_OBJECT_PLANE : +if (!has_color_pipeline && !strcmp (name,"COLOR_PIPELINE" )) +return true; +if (has_color_pipeline && !strcmp (name,"COLOR_RANGE" ))return true;
Signature · 4 lines
-- Louis Chauvet, Bootlin Embedded Linux and Kernel engineering https://bootlin.com
Re: [PATCH V10 03/30] drm-uapi: Add COLOROP object
Quoted 14 lines · Louis Chauvet
Le 15/08/2025 à 06:06, Alex Hung a écrit :
Quoted 11 lines
From: Harry Wentland <[email protected]>
DRM is introducing a new DRM core obejct, a
drm_colorop. This object will represent one color operation in a color pipeline.Introduce the object type in the drm-uapi, including the following types:
-DRM_COLOROP_1D_CURVE,
-DRM_COLOROP_1D_LUT,
-DRM_COLOROP_CTM_3X4,
Quoted 8 lines
Quoted 5 lines
Signed-off-by Alex Hung <[email protected]>Signed-off-by Harry Wentland <[email protected]>---
include/drm-uapi/amdgpu_drm.h| 9 --
include/drm-uapi/drm_mode.h | 23 +++Same as 01/30, I think this could be a separate patch "update headers".
I don't know what maintainers want, but I think all the update could be done in only one commit "update drm uapi headers to matchcolor_oppatches"
Let me see if I can put all changes to drm-uapi to one patch.
Quoted 159 lines
Quoted 159 lines
lib/igt_kms.c | 272 +++++++++++++++++++++++++++++++++- lib/igt_kms.h | 89 +++++++++++ tests/kms_properties.c | 3 +
5 files changed, 381 insertions(+), 15 deletions(-)include/drm-uapi/amdgpu_drm.h +0
-9@@ -1590,15 +1590,6 @@ struct drm_amdgpu_info_uq_metadata { #define AMDGPU_FAMILY_GC_11_5_0 150 /* GC 11.5.0 */ #define AMDGPU_FAMILY_GC_12_0_0 152 /* GC 12.0.0 */ -/* FIXME wrong namespace! */ -struct drm_color_ctm_3x4 { - /* - * Conversion matrix with 3x4 dimensions in S31.32 sign-magnitude - * (not two's complement!) format. - */ - __u64 matrix[12]; -}; - #if defined(__cplusplus) } #endifinclude/drm-uapi/drm_mode.h +23
-0@@ -629,6 +629,7 @@ struct drm_mode_connector_set_property { #define DRM_MODE_OBJECT_FB 0xfbfbfbfb #define DRM_MODE_OBJECT_BLOB 0xbbbbbbbb #define DRM_MODE_OBJECT_PLANE 0xeeeeeeee +#define DRM_MODE_OBJECT_COLOROP 0xfafafafa #define DRM_MODE_OBJECT_ANY 0 struct drm_mode_obj_get_properties {@@ -846,6 +847,22 @@ struct drm_color_ctm { __u64 matrix[9]; }; +struct drm_color_ctm_3x4 { + /* + * Conversion matrix with 3x4 dimensions in S31.32 sign-magnitude + * (not two's complement!) format. + * + * TODO what's the format? + * + * out matrix in + * |R| |0 1 2 3 | | R | + * |G| = |4 5 6 7 | x | G | + * |B| |8 9 10 12| | B | + * |1.0| + */ + __u64 matrix[12]; +}; + struct drm_color_lut { /** Values are mapped linearly to 0.0 - 1.0 range, with 0x0 == 0.0 and @@ -857,6 +874,12 @@ struct drm_color_lut { __u16 reserved; }; +enum drm_colorop_type { + DRM_COLOROP_1D_CURVE, + DRM_COLOROP_1D_LUT, + DRM_COLOROP_CTM_3X4, +}; + /*** struct drm_plane_size_hint - Plane size hints * @width: The width of the plane in pixel lib/igt_kms.c +33
-0@@ -92,6 +92,7 @@ #define MAX_CONNECTORS 32 #define MAX_EDID 2 #define DISPLAY_TILE_BLOCK 0x12 +#define MAX_NUM_COLOROPS 128 typedef bool (*igt_connector_attr_set)(int dir, const char *attr, const char *value);@@ -702,6 +703,14 @@ const char * const igt_plane_prop_names[IGT_NUM_PLANE_PROPS] = { [IGT_PLANE_SCALING_FILTER] = "SCALING_FILTER", [IGT_PLANE_SIZE_HINTS] = "SIZE_HINTS", [IGT_PLANE_IN_FORMATS_ASYNC] = "IN_FORMATS_ASYNC", + [IGT_PLANE_COLOR_PIPELINE] = "COLOR_PIPELINE", +}; + +const char *const igt_colorop_prop_names[IGT_NUM_COLOROP_PROPS ] = { + [IGT_COLOROP_TYPE] = "TYPE", + [IGT_COLOROP_BYPASS] = "BYPASS", + [IGT_COLOROP_CURVE_1D_TYPE] = "CURVE_1D_TYPE", + [IGT_COLOROP_NEXT] = "NEXT", }; const char * const igt_crtc_prop_names[IGT_NUM_CRTC_PROPS] = {@@ -769,6 +778,108 @@ igt_plane_rotations(igt_display_t *display,igt_plane_t *plane, return rotations; } +/** +* igt_find_colorop: +* @display: display on which to look for colorop. +* @id: DRM object id of the colorop. +* +* Returns: An igt_colorop_t if found, or NULL otherwise. +*/ +igt_colorop_t *igt_find_colorop (igt_display_t *display,uint32_t id) +{ + int i; + + /* find corresponding igt_colorop */ + for (i = 0; i < display->n_colorops; ++i) { + igt_colorop_t *colorop = &display->colorops[i]; + + if (colorop->id == id) + return colorop; + } + + return NULL; +} + +/* +* Retrieve all the properies specified in props_name and store them into
+ *colorop->props.
+ */lib/igt_kms.c +10
-0+static void +igt_fill_colorop_props (igt_display_t *display,igt_colorop_t *colorop, + int num_props, const char * const prop_names[]) +{ + drmModeObjectPropertiesPtr props; + int i, j, fd; + + fd = display->drm_fd; + + props = drmModeObjectGetProperties(fd, colorop->id,
DRM_MODE_OBJECT_COLOROP);
+igt_assert(props);lib/igt_kms.c +21
-0+ + for (i = 0; i < props->count_props; i++) { + drmModePropertyPtr prop = + drmModeGetProperty(fd, props->props[i]); + + for (j = 0; j < num_props; j++) { + if (strcmp(prop->name, prop_names[j]) != 0) + continue; + + colorop->props[j] = props->props[i]; + break; + } + + drmModeFreeProperty(prop); + } + drmModeFreeObjectProperties(props); +} + +static void igt_fill_colorop (igt_display_t *display,igt_plane_t *plane, + igt_colorop_t *colorop, uint32_t id, + char *name)
Quoted 8 lines
lib/igt_kms.c igt_plane_rotations(igt_display_t *display, igt_plane_t *plane, · line 844
Quoted 6 lines
lib/igt_kms.c +6
-0+{ + colorop->id = id; + colorop->plane = plane; + + if (name) + memcpy(colorop->name, name, sizeof(colorop->name));Maybe use strncpy to avoid issue if name is smaller than
colorop->name.
How about "snprintf(colorop->name, sizeof(colorop->name), "%s", name);"?
Quoted 33 lines
Quoted 24 lines
+
igt_fill_colorop_props(display, colorop, IGT_NUM_COLOROP_PROPS, igt_colorop_prop_names);lib/igt_kms.c +4
-0+} + +static void +igt_fill_plane_color_pipelines(igt_display_t *display, igt_plane_t*plane,
+ drmModePropertyPtr prop)lib/igt_kms.c +9
-0+{ + int i; + uint32_t colorop_id; + + plane->num_color_pipelines = 0; + + for (i = 0; i < prop->count_enums; i++) { + if (prop->enums[i].value) { + igt_colorop_t *colorop = &display->colorops[display-Quoted 1 line
n_colorops++];
lib/igt_kms.c +4
-0+ + igt_assert(display->n_colorops < MAX_NUM_COLOROPS); + + igt_fill_colorop(display, plane, colorop, prop-Quoted 1 line
enums[i].value, prop->enums[i].name);
Quoted 8 lines
+ plane->color_pipelines[plane->num_color_pipelines++] = colorop;
+
+ /* get all NEXT colorops */
+colorop_id=igt_colorop_get_prop(display, colorop, + IGT_COLOROP_NEXT);
+ while (colorop_id) {
+ colorop = &display->colorops[display->n_colorops++];
Quoted 1 line
I think you also need to check the
n_coloropsvalue:
Thanks for pointing out.
Quoted 110 lines
igt_assert(display->n_colorops <
MAX_NUM_COLOROPS);Quoted 13 lines
+
igt_fill_colorop(display, plane, colorop, colorop_id, NULL);
+colorop_id=igt_colorop_get_prop(display, colorop, + IGT_COLOROP_NEXT);
+ }
+ }
+ }
+
+igt_assert(plane->num_color_pipelines < IGT_NUM_PLANE_COLOR_PIPELINES);lib/igt_kms.c +3
-0+ +} +[...]
Quoted 91 lines
lib/igt_kms.h +17
-0@@ -366,9 +366,18 @@ enum igt_atomic_plane_properties { IGT_PLANE_HOTSPOT_Y, IGT_PLANE_SIZE_HINTS, IGT_PLANE_IN_FORMATS_ASYNC, + IGT_PLANE_COLOR_PIPELINE, IGT_NUM_PLANE_PROPS, }; +enum igt_atomic_colorop_properties { + IGT_COLOROP_TYPE, + IGT_COLOROP_BYPASS, + IGT_COLOROP_CURVE_1D_TYPE, + IGT_COLOROP_NEXT, + IGT_NUM_COLOROP_PROPS +}; + /*** igt_plane_prop_names * @@ -377,10 +386,20 @@ enum igt_atomic_plane_properties {*/ extern const char * const igt_plane_prop_names[]; +/** +* igt_colorop_prop_names +* +* igt_colorop_prop_names contains a list of colorop property names, +* as indexed by the igt_atomic_colorop_properties enum. +*/ +extern const char *const igt_colorop_prop_names[]; + typedef struct igt_display igt_display_t; typedef struct igt_pipe igt_pipe_t;typedef
uint32_tigt_fixed_t; /* 16.16 fixed point */lib/igt_kms.h +2
-0+#define IGT_NUM_PLANE_COLOR_PIPELINES 4 +typedef enum {
/* this maps to the kernel API */
IGT_ROTATION_0 = 1 << 0,lib/igt_kms.h +23
-0@@ -406,6 +425,20 @@ static inline bool igt_rotation_90_or_270(igt_rotation_t rotation) return rotation & (IGT_ROTATION_90 | IGT_ROTATION_270); } +typedef struct igt_plane igt_plane_t ; + +typedef struct igt_colorop { + uint32_t id; + igt_plane_t *plane; + + char name[DRM_PROP_NAME_LEN]; + + uint64_t changed; + uint32_t props[IGT_NUM_COLOROP_PROPS]; + uint64_t values[IGT_NUM_COLOROP_PROPS]; + +}igt_colorop_t ; + typedef struct igt_plane { /*< private >*/ igt_pipe_t *pipe;@@ -443,6 +476,11 @@ typedef struct igt_plane { uint64_t *async_modifiers; uint32_t *async_formats; int async_format_mod_count; + + igt_colorop_t *color_pipelines[IGT_NUM_PLANE_COLOR_PIPELINES]; + int num_color_pipelines; + + igt_colorop_t *assigned_color_pipeline; } igt_plane_t; /*@@ -501,9 +539,11 @@ struct igt_display { int log_shift; int n_pipes; int n_planes; + int n_colorops; int n_outputs; igt_output_t *outputs; igt_plane_t *planes; + igt_colorop_t *colorops; igt_pipe_t *pipes; bool has_cursor_plane; bool is_atomic;@@ -846,6 +886,53 @@ extern void igt_plane_set_prop_enum(igt_plane_t *plane, enum igt_atomic_plane_properties prop, const char *val); + +
Quoted 8 lines
lib/igt_kms.h extern void igt_plane_set_prop_enum(igt_plane_t · line 896
Quoted 6 lines
lib/igt_kms.h +3
-0+extern bool igt_plane_is_valid_colorop (igt_plane_t *plane,igt_colorop_t *colorop); + +extern void igt_plane_set_color_pipeline (igt_plane_t *plane,igt_colorop_t *colorop);(maybe a dumb question) why those fonctions are extern?
It is to match the coding styles with above function delcarations, and it's probably can be removed.
How about leaving it as it is now? Or does it is preferred to have it removed?
Quoted 68 lines
Quoted 67 lines
lib/igt_kms.h +11
-0+/** +* igt_colorop_has_prop: +* @colorop: colorop to check. +* @prop: Property to check. +* +* Check whether colorop supports a given property. +* +* Returns: True if the property is supported, otherwise false. +*/ +static inline bool +igt_colorop_has_prop(igt_colorop_t *colorop, enum
igt_atomic_colorop_propertiesprop)lib/igt_kms.h +5
-0+{ + return colorop->props[prop]; +} + +uint64_t igt_colorop_get_prop(igt_display_t *display, igt_colorop_t*colorop, enum
igt_atomic_colorop_propertiesprop);lib/igt_kms.h +25
-0+ +#define igt_colorop_is_prop_changed (colorop, prop) \ + (!!((colorop)->changed & (1 << (prop)))) + +#define igt_colorop_set_prop_changed (colorop, prop) \ + ((colorop)->changed |= 1 << (prop)) + +#define igt_colorop_clear_prop_changed (colorop, prop) \ + ((colorop)->changed &= ~(1 << (prop))) + +#define igt_colorop_set_prop_value (colorop, prop, value) \ + do { \ + colorop->values[prop] = value; \ + igt_colorop_set_prop_changed(colorop, prop); \ + } while (0) + + +extern bool igt_colorop_try_prop_enum (igt_colorop_t *colorop, + enum igt_atomic_colorop_properties prop, + const char *val); + +extern void igt_colorop_set_prop_enum (igt_colorop_t *colorop, + enum igt_atomic_colorop_properties prop, + const char *val); +extern void
igt_plane_replace_prop_blob(igt_plane_t *plane, enum igt_atomic_plane_properties prop, const void *ptr, size_t length);lib/igt_kms.h +2
-0@@ -1289,4 +1376,6 @@ int igt_backlight_write(int value, const char *fname, igt_backlight_context_t *c drmModePropertyBlobRes *igt_get_writeback_formats_blob(igt_output_t *output); +igt_colorop_t *igt_find_colorop (igt_display_t *display,uint32_t id); + #endif /* __IGT_KMS_H__ */tests/kms_properties.c +0
-0@@ -112,6 +112,9 @@ static bool ignore_property(uint32_t obj_type, uint32_t prop_flags, return true; break;case
DRM_MODE_OBJECT_PLANE:
+ if (!has_color_pipeline && !strcmp(name, "COLOR_PIPELINE")) + return true;
+
if (has_color_pipeline&& !strcmp(name, "COLOR_RANGE")) return true;
PATCH v10 4/30 lib/igt_kms: Destroy colorops on exit
In reply to Alex HungFrom: Bhanuprakash Modem <[email protected]>
- Free the memory allocated for colorops on igt_display_fini()
- Disable COLOR_PIPELINE on igt_display_reset()
--- lib/igt_kms.c | 6 ++++++ 1 file changed, 6 insertions(+)
lib/igt_kms.c +6 -0
@@ -2708,6 +2708,9 @@ static void igt_plane_reset(igt_plane_t *plane)if (igt_plane_has_prop (plane,IGT_PLANE_HOTSPOT_Y ))igt_plane_set_prop_value (plane,IGT_PLANE_HOTSPOT_Y ,0 ); +if (igt_plane_has_prop (plane,IGT_PLANE_COLOR_PIPELINE )) +igt_plane_set_prop_enum (plane,IGT_PLANE_COLOR_PIPELINE ,"Bypass" ); +igt_plane_clear_prop_changed (plane,IGT_PLANE_IN_FENCE_FD ); plane->values[IGT_PLANE_IN_FENCE_FD ] = ~0ULL ; plane->gem_handle =0 ;
@@ -3436,12 +3439,15 @@ void igt_display_fini(igt_display_t *display)for (i =0 ; i < display->n_outputs; i++)igt_output_fini (&display->outputs[i]); +free (display->outputs); display->outputs =NULL ;free (display->pipes); display->pipes =NULL ;free (display->planes); display->planes =NULL ; +free (display->colorops); + display->colorops =NULL ; }static void igt_display_refresh (igt_display_t *display)
Signature · 1 line
2.43.0
Re: [PATCH V10 04/30] lib/igt_kms: Destroy colorops on exit
Le 15/08/2025 à 06:06, Alex Hung a écrit :
Quoted 3 lines
From: Bhanuprakash Modem <[email protected]>
- Free the memory allocated for colorops on
igt_display_fini()
I think this should be done in the previous patch.
Quoted 38 lines
- Disable
COLOR_PIPELINEonigt_display_reset()Signed-off-by Alex Hung <[email protected]>Signed-off-by Bhanuprakash Modem <[email protected]>--- lib/igt_kms.c | 6 ++++++ 1 file changed, 6 insertions(+)lib/igt_kms.c +6
-0@@ -2708,6 +2708,9 @@ static void igt_plane_reset(igt_plane_t *plane)if (igt_plane_has_prop (plane,IGT_PLANE_HOTSPOT_Y ))igt_plane_set_prop_value (plane,IGT_PLANE_HOTSPOT_Y ,0 ); +if (igt_plane_has_prop (plane,IGT_PLANE_COLOR_PIPELINE )) +igt_plane_set_prop_enum (plane,IGT_PLANE_COLOR_PIPELINE ,"Bypass" ); +igt_plane_clear_prop_changed (plane,IGT_PLANE_IN_FENCE_FD ); plane->values[IGT_PLANE_IN_FENCE_FD ] = ~0ULL ; plane->gem_handle =0 ;@@ -3436,12 +3439,15 @@ void igt_display_fini(igt_display_t *display)for (i =0 ; i < display->n_outputs; i++)igt_output_fini (&display->outputs[i]); +free (display->outputs); display->outputs =NULL ;free (display->pipes); display->pipes =NULL ;free (display->planes); display->planes =NULL ; +free (display->colorops); + display->colorops =NULL ; }static void igt_display_refresh (igt_display_t *display)
Signature · 4 lines
-- Louis Chauvet, Bootlin Embedded Linux and Kernel engineering https://bootlin.com
Re: [PATCH V10 04/30] lib/igt_kms: Destroy colorops on exit
Quoted 9 lines · Louis Chauvet
Le 15/08/2025 à 06:06, Alex Hung a écrit :
Quoted 3 lines
From: Bhanuprakash Modem <[email protected]>
- Free the memory allocated for colorops on
igt_display_fini()I think this should be done in the previous patch.
Let me squash this with the previous patch.
Quoted 37 lines
Quoted 36 lines
- Disable
COLOR_PIPELINEonigt_display_reset()Signed-off-by Alex Hung <[email protected]>Signed-off-by Bhanuprakash Modem <[email protected]>---
lib/igt_kms.c| 6 ++++++1 file changed, 6 insertions(+)lib/igt_kms.c +6
-0@@ -2708,6 +2708,9 @@ static void igt_plane_reset(igt_plane_t *plane) if (igt_plane_has_prop(plane, IGT_PLANE_HOTSPOT_Y)) igt_plane_set_prop_value(plane, IGT_PLANE_HOTSPOT_Y, 0); + if (igt_plane_has_prop(plane, IGT_PLANE_COLOR_PIPELINE)) + igt_plane_set_prop_enum(plane, IGT_PLANE_COLOR_PIPELINE,"Bypass" ); + igt_plane_clear_prop_changed(plane, IGT_PLANE_IN_FENCE_FD); plane->values[IGT_PLANE_IN_FENCE_FD] = ~0ULL; plane->gem_handle = 0;@@ -3436,12 +3439,15 @@ void igt_display_fini(igt_display_t *display) for (i = 0; i < display->n_outputs; i++) igt_output_fini(&display->outputs[i]); + free(display->outputs); display->outputs = NULL; free(display->pipes); display->pipes = NULL; free(display->planes); display->planes = NULL; + free(display->colorops); + display->colorops = NULL; } static void igt_display_refresh(igt_display_t *display)
PATCH v10 5/30 tests/kms_properties: Add colorop properties test
In reply to Alex HungFrom: Harry Wentland <[email protected]>
We've introduced the concept of a new DRM core object, the drm_colorop, to represent a color operation as part of a color pipeline.
Add new tests to kms_properties to test the properties of a drm_colorop object.
--- tests/kms_properties.c | 69 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 69 insertions(+)
tests/kms_properties.c +69 -0
@@ -47,6 +47,7 @@* @crtc: CRTC * @plane: Plane * @invalid: Invalid (connector/crtc/plane) +* @colorop: Colorop * * arg[2]: *
@@ -230,6 +231,39 @@ static void test_properties(int fd, uint32_t type, uint32_t id, bool atomic, boo } } +static void run_colorop_property_tests (igt_display_t *display,enum pipe pipe,igt_output_t *output,bool atomic) +{ +struct igt_fb fb; +igt_plane_t *plane; +igt_colorop_t *colorop; +int i; +int colorop_id =0 ; + +prepare_pipe (display, pipe, output, &fb); + +for_each_plane_on_pipe (display, pipe, plane) { +igt_info ("Testing colorop properties on plane %s.#%d-%s (output: %s)\n" , +kmstest_pipe_name (pipe), plane->index,kmstest_plane_type_name (plane->type), output->name); + +/* iterate over all color pipelines on plane */ +for (i =0 ; i < plane->num_color_pipelines; ++i) { +/* iterate over all colorops in pipeline*/ + colorop = plane->color_pipelines[i]; +while (colorop) { +igt_info ("Testing colorop properties on %s.#%d.#%d-%s (output: %s)\n" , +kmstest_pipe_name (pipe), plane->index, colorop->id,kmstest_plane_type_name (plane->type), output->name); +test_properties (display->drm_fd,DRM_MODE_OBJECT_COLOROP , colorop->id, atomic, false); + + colorop_id =igt_colorop_get_prop (display, colorop, +IGT_COLOROP_NEXT ); + colorop =igt_find_colorop (display, colorop_id); + } + } + } + +cleanup_pipe (display, pipe, output, &fb); +} +static void run_plane_property_tests (igt_display_t *display,enum pipe pipe,igt_output_t *output,bool atomic) {struct igt_fb fb;
@@ -275,6 +309,37 @@ static void run_connector_property_tests(igt_display_t *display, enum pipe pipe,cleanup_pipe (display, pipe, output, &fb); } +static void colorop_properties (igt_display_t *display,bool atomic) +{ +bool found_any = false, found; +igt_output_t *output; +enum pipe pipe; + +/* colorops are only available with atomic */ +igt_skip_on (!display->is_atomic); + +for_each_pipe (display, pipe) { + found = false; + +for_each_valid_output_on_pipe (display, pipe, output) { +igt_display_reset (display); + +igt_output_set_pipe (output, pipe); +if (!intel_pipe_output_combo_valid (display)) +continue ; + + found_any = found = true; + +igt_dynamic_f ("pipe-%s-%s" ,kmstest_pipe_name (pipe), + igt_output_name(output)) { +run_colorop_property_tests (display, pipe, output, atomic); + } + } + } + +igt_skip_on (!found_any); +} +static void plane_properties (igt_display_t *display,bool atomic) {igt_output_t *output;
@@ -853,6 +918,10 @@ igt_main "Tests connector properties with legacy commit" }, {"connector-properties-atomic" , connector_properties, true, "Tests connector properties with atomic commit" }, + { "colorop-properties-legacy", colorop_properties, false, + "Tests colorop properties with legacy commit" }, + { "colorop-properties-atomic", colorop_properties, true, + "Tests colorop properties with atomic commit" }, }; igt_fixture {
Signature · 1 line
2.43.0
Re: [PATCH V10 05/30] tests/kms_properties: Add colorop properties test
Le 15/08/2025 à 06:06, Alex Hung a écrit :
Quoted 43 lines
From: Harry Wentland <[email protected]>
We've introduced the concept of a new DRM core object, the
drm_colorop, to represent a color operation as part of a color pipeline.Add new tests to
kms_propertiesto test the properties of adrm_coloropobject.Signed-off-by Alex Hung <[email protected]>Signed-off-by Harry Wentland <[email protected]>--- tests/kms_properties.c | 69 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 69 insertions(+)tests/kms_properties.c +13
-0@@ -47,6 +47,7 @@* @crtc: CRTC * @plane: Plane * @invalid: Invalid (connector/crtc/plane) +* @colorop: Colorop * * arg[2]: * @@ -230,6 +231,39 @@ static void test_properties(int fd, uint32_t type, uint32_t id, bool atomic, boo } } +static void run_colorop_property_tests (igt_display_t *display,enum pipe pipe,igt_output_t *output,bool atomic) +{ +struct igt_fb fb; +igt_plane_t *plane; +igt_colorop_t *colorop; +int i; +int colorop_id =0 ; + +prepare_pipe (display, pipe, output, &fb); + +for_each_plane_on_pipe (display, pipe, plane) { + igt_info("Testing colorop properties on plane %s.#%d-%s (output: %s)\n",
tests/kms_properties.c static void test_properties(int fd, uint32_t type, uint32_t id, bool atomic, boo · line 255
Quoted 10 lines
tests/kms_properties.c +10
-0+ kmstest_pipe_name(pipe), plane->index, kmstest_plane_type_name(plane->type), output->name); + +/* iterate over all color pipelines on plane */ +for (i =0 ; i < plane->num_color_pipelines; ++i) { +/* iterate over all colorops in pipeline*/ + colorop = plane->color_pipelines[i]; +while (colorop) { +igt_info ("Testing colorop properties on %s.#%d.#%d-%s (output: %s)\n" , +kmstest_pipe_name (pipe), plane->index, colorop->id,kmstest_plane_type_name (plane->type), output->name); +test_properties (display->drm_fd,DRM_MODE_OBJECT_COLOROP , colorop->id, atomic, false);
Same as a previous patch, why do you pass false and not display->has_plane_color_pipeline?
Quoted 63 lines
tests/kms_properties.c +46
-0+ + colorop_id =igt_colorop_get_prop (display, colorop, +IGT_COLOROP_NEXT ); + colorop =igt_find_colorop (display, colorop_id); + } + } + } + +cleanup_pipe (display, pipe, output, &fb); +} +static void run_plane_property_tests (igt_display_t *display,enum pipe pipe,igt_output_t *output,bool atomic) {struct igt_fb fb;@@ -275,6 +309,37 @@ static void run_connector_property_tests(igt_display_t *display, enum pipe pipe,cleanup_pipe (display, pipe, output, &fb); } +static void colorop_properties (igt_display_t *display,bool atomic) +{ +bool found_any = false, found; +igt_output_t *output; +enum pipe pipe; + +/* colorops are only available with atomic */ +igt_skip_on (!display->is_atomic); + +for_each_pipe (display, pipe) { + found = false; + +for_each_valid_output_on_pipe (display, pipe, output) { +igt_display_reset (display); + +igt_output_set_pipe (output, pipe); +if (!intel_pipe_output_combo_valid (display)) +continue ; + + found_any = found = true; + +igt_dynamic_f ("pipe-%s-%s" ,kmstest_pipe_name (pipe), + igt_output_name(output)) { +run_colorop_property_tests (display, pipe, output, atomic); + } + } + } + +igt_skip_on (!found_any); +} +static void plane_properties (igt_display_t *display,bool atomic) {igt_output_t *output;@@ -853,6 +918,10 @@ igt_main "Tests connector properties with legacy commit" }, {"connector-properties-atomic" , connector_properties, true, "Tests connector properties with atomic commit" }, + { "colorop-properties-legacy", colorop_properties, false, + "Tests colorop properties with legacy commit" }, + { "colorop-properties-atomic", colorop_properties, true, + "Tests colorop properties with atomic commit" }, }; igt_fixture {
Signature · 4 lines
-- Louis Chauvet, Bootlin Embedded Linux and Kernel engineering https://bootlin.com
Re: [PATCH V10 05/30] tests/kms_properties: Add colorop properties test
Quoted 59 lines · Louis Chauvet
Le 15/08/2025 à 06:06, Alex Hung a écrit :
Quoted 56 lines
From: Harry Wentland <[email protected]>
We've introduced the concept of a new DRM core object, the
drm_colorop, to represent a color operation as part of a color pipeline.Add new tests to
kms_propertiesto test the properties of adrm_coloropobject.Signed-off-by Alex Hung <[email protected]>Signed-off-by Harry Wentland <[email protected]>---
tests/kms_properties.c| 69 ++++++++++++++++++++++++++++++++++++++++++1 file changed, 69 insertions(+)tests/kms_properties.c +1
-0@@ -47,6 +47,7 @@ * @crtc: CRTC * @plane: Plane * @invalid: Invalid (connector/crtc/plane) + * @colorop: Colorop * * arg[2]: *@@ -230,6 +231,39 @@ static void test_properties(int fd, uint32_ttype,
uint32_tid, bool atomic, boo
}
}
+static voidrun_colorop_property_tests(igt_display_t *display, enum pipe pipe, igt_output_t *output, bool atomic)tests/kms_properties.c +11
-0+{ + struct igt_fb fb; + igt_plane_t *plane; + igt_colorop_t *colorop; + int i; + int colorop_id = 0; + + prepare_pipe(display, pipe, output, &fb); + + for_each_plane_on_pipe(display, pipe, plane) { + igt_info("Testing colorop properties on plane %s.#%d-%s(output: %s)\n",
+kmstest_pipe_name(pipe),plane->index,kmstest_plane_type_name(plane->type),output->name);
+
+ /* iterate over all color pipelines on plane */
+ for (i = 0; i <plane->num_color_pipelines; ++i) { + /* iterate over all colorops in pipeline*/
+ colorop = plane->color_pipelines[i];
+ while (colorop) {
+ igt_info("Testing colorop properties on %s.#%d.#%d-%s (output: %s)\n",
+kmstest_pipe_name(pipe),plane->index, colorop-
Quoted 6 lines
Quoted 3 lines
Quoted 1 line
id,
kmstest_plane_type_name(plane->type),output->name);+
test_properties(display->drm_fd, DRM_MODE_OBJECT_COLOROP, colorop->id, atomic, false);Same as a previous patch, why do you pass false and not display-
Quoted 1 line
has_plane_color_pipeline?
Thanks. I will fix it.
Quoted 65 lines
Quoted 64 lines
tests/kms_properties.c +11
-0+ + colorop_id = igt_colorop_get_prop(display, colorop, + IGT_COLOROP_NEXT); + colorop = igt_find_colorop(display, colorop_id); + } + } + } + + cleanup_pipe(display, pipe, output, &fb); +} +static void
run_plane_property_tests(igt_display_t *display, enum pipe pipe, igt_output_t *output, bool atomic){
structigt_fbfb;tests/kms_properties.c +31
-0@@ -275,6 +309,37 @@ static void run_connector_property_tests(igt_display_t *display, enum pipe pipe, cleanup_pipe(display, pipe, output, &fb); } +static void colorop_properties(igt_display_t *display, bool atomic) +{ + bool found_any = false, found; + igt_output_t *output; + enum pipe pipe; + + /* colorops are only available with atomic */ + igt_skip_on(!display->is_atomic); + + for_each_pipe(display, pipe) { + found = false; + + for_each_valid_output_on_pipe(display, pipe, output) { + igt_display_reset(display); + + igt_output_set_pipe(output, pipe); + if (!intel_pipe_output_combo_valid(display)) + continue; + + found_any = found = true; + + igt_dynamic_f("pipe-%s-%s", kmstest_pipe_name(pipe), + igt_output_name(output)) { + run_colorop_property_tests(display, pipe, output, atomic); + } + } + } + + igt_skip_on(!found_any); +} + static void plane_properties(igt_display_t *display, bool atomic) {
igt_output_t*output;tests/kms_properties.c +4
-0@@ -853,6 +918,10 @@ igt_main "Tests connector properties with legacy commit" }, { "connector-properties-atomic", connector_properties, true, "Tests connector properties with atomic commit" }, + { "colorop-properties-legacy", colorop_properties, false, + "Tests colorop properties with legacy commit" }, + { "colorop-properties-atomic", colorop_properties, true, + "Tests colorop properties with atomic commit" }, }; igt_fixture {
PATCH v10 6/30 igt/color: Add SW color transform functionality
In reply to Alex HungFrom: Harry Wentland <[email protected]>
In order to test color we want to compare a HW (KMS) transform with a SW transform. This introduces color transform for an sRGB EOTF but this can be extended to other transforms. Code is borrowed from Skia.
--- lib/igt_color.c | 246 ++++++++++++++++++++++++++++++++++++++++++++++++ lib/igt_color.h | 45 +++++++++ lib/igt_fb.c | 4 +- lib/igt_fb.h | 2 + lib/meson.build | 1 + 5 files changed, 296 insertions(+), 2 deletions(-) create mode 100644 lib/igt_color.c create mode 100644 lib/igt_color.h
lib/igt_color.c new file +246 -0
@@ -0,0 +1,246 @@ +// SPDX-License-Identifier: MIT +/* +* Copyright 2023 Advanced Micro Devices, Inc. +* +* This file contains code adapted from Skia, which is +* distributed under a BSD-style license which can be +* found at +* https://skia.googlesource.com/skia.git/+/refs/heads/main/LICENSE +*/ + +#include <errno.h> +#include <math.h> + +#include "igt_color.h" +#include "igt_core.h" +#include "igt_x86.h" + + +static float clamp (float val,float min,float max) +{ +return ((val < min) ? min : ((val > max) ? max : val)); +} + +static float igt_color_tf_eval_unclamped (const struct igt_color_tf *fn,float x) +{ +if (x < fn->d) +return fn->c * x + fn->f; + +return pow (fn->a * x + fn->b, fn->g) + fn->e; +} + +static float igt_color_tf_eval (const struct igt_color_tf *fn,float x) +{ +float fn_at_x_unclamped =igt_color_tf_eval_unclamped (fn, x); + +return clamp (fn_at_x_unclamped,0.0f ,1.0f ); +} + +static void tf_inverse (const struct igt_color_tf *fn,struct igt_color_tf *inv) +{ +memset (inv,0 ,sizeof (struct igt_color_tf )); + +if (fn->a >0 && fn->g >0 ) { +double a_to_the_g =pow (fn->a, fn->g); + + inv->a =1.f / a_to_the_g; + inv->b = -fn->e / a_to_the_g; + inv->g =1.f / fn->g; + } + + inv->d = fn->c * fn->d + fn->f; + inv->e = -fn->b / fn->a; +if (fn->c !=0 ) { + inv->c =1.f / fn->c; + inv->f = -fn->f / fn->c; + } +} + +void igt_color_srgb_inv_eotf (igt_pixel_t *pixel) +{ +struct igt_color_tf inv; + +tf_inverse (&srgb_eotf, &inv); + + pixel->r =igt_color_tf_eval (&inv, pixel->r); + pixel->g =igt_color_tf_eval (&inv, pixel->g); + pixel->b =igt_color_tf_eval (&inv, pixel->b); +} + + + +void igt_color_srgb_eotf (igt_pixel_t *pixel) +{ + pixel->r =igt_color_tf_eval (&srgb_eotf, pixel->r); + pixel->g =igt_color_tf_eval (&srgb_eotf, pixel->g); + pixel->b =igt_color_tf_eval (&srgb_eotf, pixel->b); +} + +int igt_color_transform_pixels (igt_fb_t *fb,igt_pixel_transform transforms[],int num_transforms) +{ +uint32_t *line =NULL ; +void *map; +char *ptr; +int x, y, cpp =igt_drm_format_to_bpp (fb->drm_format) /8 ; +uint32_t stride =igt_fb_calc_plane_stride (fb,0 ); + +if (fb->num_planes !=1 ) +return -EINVAL ; + +/* TODO expand for other formats */ +if (fb->drm_format !=DRM_FORMAT_XRGB8888 ) +return -EINVAL ; + + ptr =igt_fb_map_buffer (fb->fd, fb); +igt_assert (ptr); + map = ptr; + +/* +* Framebuffers are often uncached, which can make byte-wise accesses +* very slow. We copy each line of the FB into a local buffer to speed +* up the hashing. +*/ + line =malloc (stride); +if (!line) { +munmap (map, fb->size); +return -ENOMEM ; + } + +for (y =0 ; y < fb->height; y++, ptr += stride) { + +/* get line from buffer */ +igt_memcpy_from_wc (line, ptr, fb->width * cpp); + +for (x =0 ; x < fb->width; x++) { +uint32_t raw_pixel =le32_to_cpu (line[x]); +igt_pixel_t pixel; +int i; + + raw_pixel &=0x00ffffff ; + +/* +* unpack pixel into igt_pixel_t +* +* only for XRGB8888 for now +* +* TODO add "generic" mechanism for unpacking +* other FB formats +*/ + pixel.r = (raw_pixel &0x00ff0000 ) >>16 ; + pixel.g = (raw_pixel &0x0000ff00 ) >>8 ; + pixel.b = (raw_pixel &0x000000ff ); + +/* normalize for 8-bit */ + pixel.r /= (0xff ); + pixel.g /= (0xff ); + pixel.b /= (0xff ); + +/* TODO use read_rgb from igt_fb? */ + +/* run transform on pixel */ + +for (i =0 ; i < num_transforms; i++) + transforms[i](&pixel); + +/* de-normalize back to 8-bit */ + pixel.r *= (0xff ); + pixel.g *= (0xff ); + pixel.b *= (0xff ); + +/* re-pack pixel into FB*/ + raw_pixel =0x0 ; + raw_pixel |= ((uint8_t )(lround (pixel.r) &0xff )) <<16 ; + raw_pixel |= ((uint8_t )(lround (pixel.g) &0xff )) <<8 ; + raw_pixel |= ((uint8_t )(lround (pixel.b) &0xff )); +/* TODO use write_rgb from igt_fb? */ + +/* write back to line */ + line[x] =cpu_to_le32 (raw_pixel); + } + +/* copy line back to fb buffer */ +igt_memcpy_from_wc (ptr, line, fb->width * cpp); + } + +free (line); +igt_fb_unmap_buffer (fb, map); + +return 0 ; +} + +bool igt_cmp_fb_component (uint16_t comp1,uint16_t comp2,uint8_t up,uint8_t down) +{ +int16_t diff = comp2 - comp1; + +if (diff < -down || diff > up) +return false; + +return true; +} + +bool igt_cmp_fb_pixels (igt_fb_t *fb1,igt_fb_t *fb2,uint8_t up,uint8_t down) +{ +uint32_t *ptr1, *ptr2; +uint32_t pixel1, pixel2, i, j; +bool matched = true; + + ptr1 =igt_fb_map_buffer (fb1->fd, fb1); + ptr2 =igt_fb_map_buffer (fb2->fd, fb2); + +igt_assert (fb1->drm_format == fb2->drm_format); +igt_assert (fb1->size == fb2->size); + +for (i =0 ; i < fb1->size /sizeof (uint32_t ); i++) { +uint16_t mask =0xff ; +uint16_t shift =8 ; + +if (fb1->drm_format ==DRM_FORMAT_XRGB2101010 ) { +/* ignore alpha */ + pixel1 = ptr1[i] & ~0xc0000000 ; + pixel2 = ptr2[i] & ~0xc0000000 ; + + mask =0x3ff ; + shift =10 ; + }else if (fb1->drm_format ==DRM_FORMAT_XRGB8888 ) { +/* ignore alpha */ + pixel1 = ptr1[i] & ~0xff000000 ; + pixel2 = ptr2[i] & ~0xff000000 ; + + mask =0xff ; + shift =8 ; + }else { + pixel1 = ptr1[i]; + pixel2 = ptr2[i]; + } + +for (j =0 ; j <3 ; j++) { +uint16_t comp1 = (pixel1 >> (shift * j)) & mask; +uint16_t comp2 = (pixel2 >> (shift * j)) & mask; + +if (!igt_cmp_fb_component (comp1, comp2, up, down)) { +igt_info ("i %d j %d shift %d mask %x comp1 %x comp2 %x, pixel1 %x pixel2 %x\n" , + i, j, shift, mask, comp1, comp2, pixel1, pixel2); +return false; + } + } + } + +igt_fb_unmap_buffer (fb1, ptr1); +igt_fb_unmap_buffer (fb2, ptr2); + +return matched; +} + +void igt_dump_fb (igt_display_t *display,igt_fb_t *fb, +const char *path_name,const char *file_name) +{ +char filepath_out[PATH_MAX ]; +cairo_surface_t *fb_surface_out; +cairo_status_t status; + +snprintf (filepath_out,PATH_MAX ,"%s/%s.png" , path_name, file_name); + fb_surface_out =igt_get_cairo_surface (display->drm_fd, fb); + status =cairo_surface_write_to_png (fb_surface_out, filepath_out); +igt_assert_eq (status,CAIRO_STATUS_SUCCESS ); +cairo_surface_destroy (fb_surface_out); +}
lib/igt_color.h new file +45 -0
45 lines not on this page · raw message
lib/igt_fb.c +2 -2
@@ -787,7 +787,7 @@ void igt_init_fb(struct igt_fb *fb, int fd, int width, int height, } } -static uint32_t calc_plane_stride (struct igt_fb *fb,int plane) +uint32_t igt_fb_calc_plane_stride (struct igt_fb *fb,int plane) {uint32_t min_stride = fb->plane_width[plane] * (fb->plane_bpp[plane] /8 );
@@ -977,7 +977,7 @@ void igt_calc_fb_size(struct igt_fb *fb)/* respect the stride requested by the caller */ if (!fb->strides[plane]) - fb->strides[plane] =calc_plane_stride (fb, plane); + fb->strides[plane] =igt_fb_calc_plane_stride (fb, plane); align =get_plane_alignment (fb, plane);if (align)
lib/igt_fb.h +2 -0
@@ -169,6 +169,8 @@ int igt_dirty_fb(int fd, struct igt_fb *fb);void *igt_fb_map_buffer (int fd,struct igt_fb *fb);void igt_fb_unmap_buffer (struct igt_fb *fb,void *buffer); +uint32_t igt_fb_calc_plane_stride (struct igt_fb *fb,int plane); +void igt_create_bo_for_fb (int fd,int width,int height,uint32_t format,uint64_t modifier,struct igt_fb *fb);
lib/meson.build +1 -0
@@ -112,6 +112,7 @@ lib_sources = [ 'igt_edid.c', 'igt_eld.c', 'igt_infoframe.c', + 'igt_color.c', 'veboxcopy_gen12.c', 'igt_msm.c', 'igt_dsc.c',
Signature · 1 line
2.43.0
PATCH v10 7/30 lib/igt_fb: Add igt_copy_fb function
In reply to Alex HungFrom: Harry Wentland <[email protected]>
Add a function to copy fb of DRM_FORMAT_XRGB8888.
--- lib/igt_fb.c | 33 +++++++++++++++++++++++++++++++++ lib/igt_fb.h | 1 + 2 files changed, 34 insertions(+)
lib/igt_fb.c +33 -0
@@ -2170,6 +2170,39 @@ unsigned int igt_create_fb(int fd, int width, int height, uint32_t format, fb, 0, 0); } +unsigned int igt_copy_fb (int fd,struct igt_fb *src,struct igt_fb *fb) +{ +char *in_ptr, *out_ptr; +int cpp =igt_drm_format_to_bpp (src->drm_format) /8 ; +int fb_id =0 ; + +igt_assert (src); + +/* TODO allow multiple planes */ +if (src->num_planes !=1 ) +return -EINVAL ; + +/* TODO expand for other formats */ +if (src->drm_format !=DRM_FORMAT_XRGB8888 ) +return -EINVAL ; + + fb_id =igt_create_fb (fd, src->width, src->height, src->drm_format, + src->modifier, fb); + +/* copy buffer contents */ + in_ptr =igt_fb_map_buffer (fb->fd, src); +igt_assert (in_ptr); + out_ptr =igt_fb_map_buffer (fb->fd, fb); +igt_assert (out_ptr); + +igt_memcpy_from_wc (out_ptr, in_ptr, fb->width * fb->height * cpp); + +igt_fb_unmap_buffer (fb, out_ptr); +igt_fb_unmap_buffer (src, in_ptr); + +return fb_id; +} +/** * igt_create_color_fb: * @fd: open drm file descriptor
lib/igt_fb.h +1 -0
@@ -141,6 +141,7 @@ struct intel_buf *igt_fb_create_intel_buf(int fd, struct buf_ops *bops, const struct igt_fb *fb, const char *name);unsigned int igt_create_fb (int fd,int width,int height,uint32_t format,uint64_t modifier,struct igt_fb *fb); +unsigned int igt_copy_fb (int fd,struct igt_fb *src,struct igt_fb *fb); unsigned int igt_create_color_fb(int fd, int width, int height, uint32_t format, uint64_t modifier, double r, double g, double b,
Signature · 1 line
2.43.0
Re: [PATCH V10 07/30] lib/igt_fb: Add igt_copy_fb function
Hi Alex,
Quoted 4 lines · Alex Hung
From: Harry Wentland <[email protected]>
Add a function to copy fb of
DRM_FORMAT_XRGB8888.
+cc Karthik and Juha-Pekka
Cc: Karthik B S <[email protected]>
Cc: Juha-Pekka Heikkila <[email protected]>
Cc: Juha-Pekka Heikkila <[email protected]>
Quoted 12 lines
Signed-off-by Alex Hung <[email protected]>Signed-off-by Harry Wentland <[email protected]>--- lib/igt_fb.c | 33 +++++++++++++++++++++++++++++++++ lib/igt_fb.h | 1 + 2 files changed, 34 insertions(+)lib/igt_fb.c +0
-0
lib/igt_fb.c unsigned int igt_create_fb(int fd, int width, int height, uint32_t format, · line 2176
Quoted 7 lines
lib/igt_fb.c +4
-0@@ -2170,6 +2170,39 @@ unsigned int igt_create_fb(int fd, int width, int height, uint32_t format, fb, 0, 0); } +unsigned int igt_copy_fb (int fd,struct igt_fb *src,struct igt_fb *fb) +{ +char *in_ptr, *out_ptr; +int cpp =igt_drm_format_to_bpp (src->drm_format) /8 ;
Why setup it here?
lib/igt_fb.c unsigned int igt_create_fb(int fd, int width, int height, uint32_t format, · line 2179
Quoted 3 lines
lib/igt_fb.c +3
-0+int fb_id =0 ; + +igt_assert (src);
cpp setup above whould trigger before this assert if src==NULL
lib/igt_fb.c unsigned int igt_create_fb(int fd, int width, int height, uint32_t format, · line 2183
Quoted 4 lines
lib/igt_fb.c +4
-0+ +/* TODO allow multiple planes */ +if (src->num_planes !=1 ) +return -EINVAL ;
return type is unsigned, maybe use bool instead?
lib/igt_fb.c unsigned int igt_create_fb(int fd, int width, int height, uint32_t format, · line 2187
Quoted 4 lines
lib/igt_fb.c +4
-0+ +/* TODO expand for other formats */ +if (src->drm_format !=DRM_FORMAT_XRGB8888 ) +return -EINVAL ;
Same here.
Regards,
Kamil
Quoted 36 lines
lib/igt_fb.c +18
-0+ + fb_id =igt_create_fb (fd, src->width, src->height, src->drm_format, + src->modifier, fb); + +/* copy buffer contents */ + in_ptr =igt_fb_map_buffer (fb->fd, src); +igt_assert (in_ptr); + out_ptr =igt_fb_map_buffer (fb->fd, fb); +igt_assert (out_ptr); + +igt_memcpy_from_wc (out_ptr, in_ptr, fb->width * fb->height * cpp); + +igt_fb_unmap_buffer (fb, out_ptr); +igt_fb_unmap_buffer (src, in_ptr); + +return fb_id; +} +/** * igt_create_color_fb: * @fd: open drm file descriptor lib/igt_fb.h +1
-0@@ -141,6 +141,7 @@ struct intel_buf *igt_fb_create_intel_buf(int fd, struct buf_ops *bops, const struct igt_fb *fb, const char *name);unsigned int igt_create_fb (int fd,int width,int height,uint32_t format,uint64_t modifier,struct igt_fb *fb); +unsigned int igt_copy_fb (int fd,struct igt_fb *src,struct igt_fb *fb); unsigned int igt_create_color_fb(int fd, int width, int height, uint32_t format, uint64_t modifier, double r, double g, double b,Signature · 1 line
2.43.0
PATCH v10 8/30 lib/drmtest: Add is_vkms_device()
In reply to Alex HungFrom: Harry Wentland <[email protected]>
Add a function to check vkms device.
--- lib/drmtest.c | 5 +++++ lib/drmtest.h | 1 + 2 files changed, 6 insertions(+)
lib/drmtest.c +5 -0
@@ -118,6 +118,11 @@ static bool __is_device(int fd, const char *expect)return strcmp (expect, name) ==0 ; } +bool is_vkms_device (int fd) +{ +return __is_device (fd,"vkms" ); +} +bool is_amdgpu_device (int fd) {return __is_device (fd,"amdgpu" );
lib/drmtest.h +1 -0
@@ -136,6 +136,7 @@ void igt_require_nouveau(int fd);void igt_require_vc4 (int fd);void igt_require_xe (int fd); +bool is_vkms_device (int fd);bool is_amdgpu_device (int fd);bool is_i915_device (int fd);bool is_mtk_device (int fd);
Signature · 1 line
2.43.0
Re: [PATCH V10 08/30] lib/drmtest: Add is_vkms_device()
Hi Alex,
Quoted 16 lines · Alex Hung
From: Harry Wentland <[email protected]>
Add a function to check vkms device.
Signed-off-by Alex Hung <[email protected]>Signed-off-by Harry Wentland <[email protected]>--- lib/drmtest.c | 5 +++++ lib/drmtest.h | 1 + 2 files changed, 6 insertions(+)lib/drmtest.c +0
-0
lib/drmtest.c static bool __is_device(int fd, const char *expect) · line 123
Quoted 6 lines
lib/drmtest.c +3
-0@@ -118,6 +118,11 @@ static bool __is_device(int fd, const char *expect)return strcmp (expect, name) ==0 ; } +bool is_vkms_device (int fd) +{ +return __is_device (fd,"vkms" );
Do you need this change in your series?
There is a separate VKMS series almost ready to merge, so imho you could drop this patch.
See https://patchwork.freedesktop.org/series/145065/
+cc Karthik
Regards,
Kamil
Quoted 20 lines
lib/drmtest.c +2
-0+} +bool is_amdgpu_device (int fd) {return __is_device (fd,"amdgpu" );lib/drmtest.h +1
-0@@ -136,6 +136,7 @@ void igt_require_nouveau(int fd);void igt_require_vc4 (int fd);void igt_require_xe (int fd); +bool is_vkms_device (int fd);bool is_amdgpu_device (int fd);bool is_i915_device (int fd);bool is_mtk_device (int fd);Signature · 1 line
2.43.0
Re: [PATCH V10 08/30] lib/drmtest: Add is_vkms_device()
In reply to Alex HungLe 15/08/2025 à 06:06, Alex Hung a écrit :
Quoted 6 lines
From: Harry Wentland <[email protected]>
Add a function to check vkms device.
Signed-off-by Alex Hung <[email protected]>Signed-off-by Harry Wentland <[email protected]>
Quoted 33 lines
--- lib/drmtest.c | 5 +++++ lib/drmtest.h | 1 + 2 files changed, 6 insertions(+)lib/drmtest.c +5
-0@@ -118,6 +118,11 @@ static bool __is_device(int fd, const char *expect)return strcmp (expect, name) ==0 ; } +bool is_vkms_device (int fd) +{ +return __is_device (fd,"vkms" ); +} +bool is_amdgpu_device (int fd) {return __is_device (fd,"amdgpu" );lib/drmtest.h +1
-0@@ -136,6 +136,7 @@ void igt_require_nouveau(int fd);void igt_require_vc4 (int fd);void igt_require_xe (int fd); +bool is_vkms_device (int fd);bool is_amdgpu_device (int fd);bool is_i915_device (int fd);bool is_mtk_device (int fd);
Signature · 4 lines
-- Louis Chauvet, Bootlin Embedded Linux and Kernel engineering https://bootlin.com
PATCH v10 9/30 tests/kms_colorop: Add kms_colorop tests
In reply to Alex HungFrom: Harry Wentland <[email protected]>
This tests the color pipeline API, exposed via the COLOR PIPELINE plane property and drm_colorop objects.
We introduce tests for:
- sRGB EOTF
- sRGB Inverse EOTF
- sRGB EOTF + sRGB Inverse EOTF
The last one is the holy grail of LUT testing. It tests that after applying an EOTF, followed by its inverse EOTF we arrive back at the original value. We can use this to test for precision loss in the pipeline.
All tests are tested via writeback. All transforms are done in SW (in floating point) and at the end the SW transformed buffer is compared with the KMS writeback output buffer. The two should match within a bracket of acceptable deviations. Since these deviations might look different for different KMS drivers we'll do this check on a driver-specific basis.
--- tests/kms_colorop.c | 508 ++++++++++++++++++++++++++++++++++++++++++++ tests/kms_colorop.h | 88 ++++++++ tests/meson.build | 1 + 3 files changed, 597 insertions(+) create mode 100644 tests/kms_colorop.c create mode 100644 tests/kms_colorop.h
tests/kms_colorop.c new file +508 -0
@@ -0,0 +1,508 @@ +// SPDX-License-Identifier: MIT +/* +* Copyright 2023 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 "igt_color.h" +#include "sw_sync.h" +#include "kms_colorop.h" + +/** +* TEST: kms colorop +* Category: Display +* Description: Test to validate the retrieving and setting of DRM colorops +* +* SUBTEST: plane-%s +* Description: Tests DRM colorop properties on a plane +* Driver requirement: amdgpu +* Functionality: kms_core +* Mega feature: General Display Features +* Test category: functionality test +* +* arg[1]: +* +* @srgb_eotf: sRGB EOTF +* @srgb_inv_eotf: sRGB Inverse EOTF +* @srgb_eotf-srgb_inv_eotf: sRGB EOTF -> sRGB Inverse EOTF +* +*/ + +/* TODO move to lib for kms_writeback and kms_colorop (and other future) use */ +static bool check_writeback_config (igt_display_t *display,igt_output_t *output, +drmModeModeInfo override_mode) +{ +igt_fb_t input_fb, output_fb; +igt_plane_t *plane; +uint32_t writeback_format =DRM_FORMAT_XRGB8888 ; +uint64_t modifier =DRM_FORMAT_MOD_LINEAR ; +int width, height, ret; + +igt_output_override_mode (output, &override_mode); + + width = override_mode.hdisplay; + height = override_mode.vdisplay; + + ret =igt_create_fb (display->drm_fd, width, height, +DRM_FORMAT_XRGB8888 , modifier, &input_fb); +igt_assert (ret >=0 ); + + ret =igt_create_fb (display->drm_fd, width, height, + writeback_format, modifier, &output_fb); +igt_assert (ret >=0 ); + + plane =igt_output_get_plane_type (output,DRM_PLANE_TYPE_PRIMARY ); +igt_plane_set_fb (plane, &input_fb); +igt_output_set_writeback_fb (output, &output_fb); + + ret =igt_display_try_commit_atomic (display,DRM_MODE_ATOMIC_TEST_ONLY | +DRM_MODE_ATOMIC_ALLOW_MODESET ,NULL ); +igt_plane_set_fb (plane,NULL ); +igt_remove_fb (display->drm_fd, &input_fb); +igt_remove_fb (display->drm_fd, &output_fb); + +return !ret; +} + +/* TODO move to lib for kms_writeback and kms_colorop (and other future) use */ +typedef struct { +bool builtin_mode; +bool custom_mode; +bool list_modes; +bool dump_check; +int mode_index; +drmModeModeInfo user_mode; +}data_t ; + +static data_t data; + +/* TODO move to lib for kms_writeback and kms_colorop (and other future) use */ +static igt_output_t *kms_writeback_get_output (igt_display_t *display) +{ +int i; +enum pipe pipe; + +drmModeModeInfo override_mode = { + .clock =25175 , + .hdisplay =640 , + .hsync_start =656 , + .hsync_end =752 , + .htotal =800 , + .hskew =0 , + .vdisplay =480 , + .vsync_start =490 , + .vsync_end =492 , + .vtotal =525 , + .vscan =0 , + .vrefresh =60 , + .flags =DRM_MODE_FLAG_NHSYNC |DRM_MODE_FLAG_NVSYNC , + .name = {"640x480-60" }, + }; + +for (i =0 ; i < display->n_outputs; i++) { +igt_output_t *output = &display->outputs[i]; + +if (output->config.connector->connector_type !=DRM_MODE_CONNECTOR_WRITEBACK ) +continue ; + +for_each_pipe (display, pipe) { +igt_output_set_pipe (output, pipe); + +if (data.custom_mode) + override_mode = data.user_mode; +if (data.builtin_mode) + override_mode = output->config.connector->modes[data.mode_index]; + +if (check_writeback_config (display, output, override_mode)) { +igt_debug ("Using connector %u:%s on pipe %d\n" , + output->config.connector->connector_id, + output->name, pipe); +return output; + } + } + +igt_debug ("We found %u:%s, but this test will not be able to use it.\n" , + output->config.connector->connector_id, output->name); + +/* Restore any connectors we don't use, so we don't trip on them later */ +kmstest_force_connector (display->drm_fd, output->config.connector,FORCE_CONNECTOR_UNSPECIFIED ); + } + +return NULL ; +} + +/* TODO move to lib for kms_writeback and kms_colorop (and other future) use */ +static uint64_t get_writeback_fb_id (igt_output_t *output) +{ +return igt_output_get_prop (output,IGT_CONNECTOR_WRITEBACK_FB_ID ); +} + +/* TODO move to lib for kms_writeback and kms_colorop (and other future) use */ +static void detach_crtc (igt_display_t *display,igt_output_t *output) +{ +if (get_writeback_fb_id (output) ==0 ) +return ; + +igt_output_set_pipe (output,PIPE_NONE ); +igt_display_commit2 (display,COMMIT_ATOMIC ); +} + +static void get_and_wait_out_fence (igt_output_t *output) +{ +int ret; + +igt_assert (output->writeback_out_fence_fd >=0 ); + + ret =sync_fence_wait (output->writeback_out_fence_fd,1000 ); +igt_assert_f (ret ==0 ,"sync_fence_wait failed: %s\n" ,strerror (-ret)); +close (output->writeback_out_fence_fd); + output->writeback_out_fence_fd =-1 ; +} + +static bool can_use_colorop (igt_display_t *display,igt_colorop_t *colorop,kms_colorop_t *desired) +{ +switch (desired->type) { +case KMS_COLOROP_ENUMERATED_LUT1D : +if (igt_colorop_get_prop (display, colorop,IGT_COLOROP_TYPE ) ==DRM_COLOROP_1D_CURVE ) +return true; +case KMS_COLOROP_CUSTOM_LUT1D : +case KMS_COLOROP_CTM : +case KMS_COLOROP_LUT3D : +default : +return false; + } +} + +/** +* Iterate color pipeline that begins with colorop and try to map +* colorops[] to it. +*/ +static bool map_to_pipeline (igt_display_t *display, +igt_colorop_t *colorop, +kms_colorop_t *colorops[]) +{ +igt_colorop_t *next = colorop; +kms_colorop_t *current_op; +int i =0 ; +int prop_val =0 ; + + current_op = colorops[i++]; +igt_require (current_op); + +while (next) { +if (can_use_colorop (display, next, current_op)) { + current_op->colorop = next; + current_op = colorops[i++]; +if (!current_op) +break ; + } + prop_val =igt_colorop_get_prop (display, next, +IGT_COLOROP_NEXT ); + next =igt_find_colorop (display, prop_val); + } + +if (current_op) { +/* we failed to map the pipeline */ + +/* clean up colorops[i].colorop mappings */ +for (i =0 , current_op = colorops[0 ]; current_op; current_op = colorops[i++]) + current_op->colorop =NULL ; + +return false; + } + +return true; +} + +static igt_colorop_t *get_color_pipeline (igt_display_t *display, +igt_plane_t *plane, +kms_colorop_t *colorops[]) +{ +igt_colorop_t *colorop =NULL ; +int i; + +/* go through all color pipelines */ +for (i =0 ; i < plane->num_color_pipelines; ++i) { +if (map_to_pipeline (display, plane->color_pipelines[i], colorops)) { + colorop = plane->color_pipelines[i]; +break ; + } + } + +return colorop; +} + +static void set_colorop (igt_display_t *display, +kms_colorop_t *colorop) +{ +igt_assert (colorop->colorop); +igt_colorop_set_prop_value (colorop->colorop,IGT_COLOROP_BYPASS ,0 ); + +/* Set to desired value from kms_colorop_t */ +switch (colorop->type) { +case KMS_COLOROP_ENUMERATED_LUT1D : +switch (colorop->enumerated_lut1d_info.tf) { +case KMS_COLOROP_LUT1D_SRGB_EOTF : +igt_colorop_set_prop_enum (colorop->colorop,IGT_COLOROP_CURVE_1D_TYPE ,"sRGB EOTF" ); +break ; +case KMS_COLOROP_LUT1D_SRGB_INV_EOTF : +igt_colorop_set_prop_enum (colorop->colorop,IGT_COLOROP_CURVE_1D_TYPE ,"sRGB Inverse EOTF" ); +break ; +case KMS_COLOROP_LUT1D_PQ_EOTF : +case KMS_COLOROP_LUT1D_PQ_INV_EOTF : +default : +igt_fail (IGT_EXIT_FAILURE ); + } +break ; +case KMS_COLOROP_CUSTOM_LUT1D : +case KMS_COLOROP_CTM : +case KMS_COLOROP_LUT3D : +default : +igt_fail (IGT_EXIT_FAILURE ); + } +} + +static void set_color_pipeline (igt_display_t *display, +igt_plane_t *plane, +kms_colorop_t *colorops[], +igt_colorop_t *color_pipeline) +{ +igt_colorop_t *next; +int prop_val =0 ; +int i; + +igt_plane_set_color_pipeline (plane, color_pipeline); + +for (i =0 ; colorops[i]; i++) +set_colorop (display, colorops[i]); + +/* set unused ops in pipeline to bypass */ + next = color_pipeline; + i =0 ; +while (next) { +if (!colorops[i] || colorops[i]->colorop != next) +igt_colorop_set_prop_value (next,IGT_COLOROP_BYPASS ,1 ); +else + i++; + + prop_val =igt_colorop_get_prop (display, next, +IGT_COLOROP_NEXT ); + next =igt_find_colorop (display, prop_val); + } +} + +static void set_color_pipeline_bypass (igt_plane_t *plane) +{ +igt_plane_set_prop_enum (plane,IGT_PLANE_COLOR_PIPELINE ,"Bypass" ); +} + +static bool compare_with_bracket (igt_fb_t *in,igt_fb_t *out) +{ +if (is_vkms_device (in->fd)) +return igt_cmp_fb_pixels (in, out,1 ,1 ); + +/* +* By default we'll look for a [0, 0] bracket. We can then +* define it for each driver that implements support for this +* test. That way we can understand the precision of each +* driver better. +*/ +return igt_cmp_fb_pixels (in, out,0 ,0 ); +} + +#define DUMP_FBS 1 + +#define MAX_COLOROPS 3 +#define NUM_COLOROP_TESTS 3 +#define MAX_NAME_SIZE 256 + +static void apply_transforms (kms_colorop_t *colorops[],igt_fb_t *sw_transform_fb) +{ +int i; +igt_pixel_transform transforms[MAX_COLOROPS ]; + +for (i =0 ; colorops[i]; i++) + transforms[i] = colorops[i]->transform; + +igt_color_transform_pixels (sw_transform_fb, transforms, i); +} + +static void colorop_plane_test (igt_display_t *display, +kms_colorop_t *colorops[]) +{ +igt_colorop_t *color_pipeline =NULL ; +igt_output_t *output; +igt_plane_t *plane; +igt_fb_t input_fb; +igt_fb_t sw_transform_fb; +igt_fb_t output_fb; +drmModeModeInfo mode; +unsigned int fb_id; +igt_crc_t input_crc, output_crc; + + output =kms_writeback_get_output (display); +igt_require (output); + +if (output->use_override_mode) +memcpy (&mode, &output->override_mode,sizeof (mode)); +else +memcpy (&mode, &output->config.default_mode,sizeof (mode)); + +/* create input fb */ + plane =igt_output_get_plane_type (output,DRM_PLANE_TYPE_PRIMARY ); +igt_assert (plane); + + fb_id =igt_create_color_pattern_fb (display->drm_fd, + mode.hdisplay, mode.vdisplay, +DRM_FORMAT_XRGB8888 ,DRM_FORMAT_MOD_LINEAR , +0.2 ,0.2 ,0.2 , &input_fb); +igt_assert (fb_id >=0 ); +igt_plane_set_fb (plane, &input_fb); +#if DUMP_FBS +igt_dump_fb (display, &input_fb,"." ,"input" ); +#endif + +/* create output fb */ + fb_id =igt_create_fb (display->drm_fd, mode.hdisplay, mode.vdisplay, +DRM_FORMAT_XRGB8888 , +igt_fb_mod_to_tiling (0 ), + &output_fb); +igt_require (fb_id >0 ); + +igt_fb_get_fnv1a_crc (&input_fb, &input_crc); + +igt_require (igt_plane_has_prop (plane,IGT_PLANE_COLOR_PIPELINE )); + +/* reset color pipeline*/ + +set_color_pipeline_bypass (plane); + +/* Commit */ +igt_plane_set_fb (plane, &input_fb); +igt_output_set_writeback_fb (output, &output_fb); + +igt_display_commit_atomic (output->display, +DRM_MODE_ATOMIC_ALLOW_MODESET , +NULL ); +get_and_wait_out_fence (output); + +/* Compare input and output buffers. They should be equal here. */ +igt_fb_get_fnv1a_crc (&output_fb, &output_crc); + +igt_assert_crc_equal (&input_crc, &output_crc); + +/* create sw transformed buffer */ + +igt_copy_fb (display->drm_fd, &input_fb, &sw_transform_fb); +igt_assert (igt_cmp_fb_pixels (&input_fb, &sw_transform_fb,0 ,0 )); + +apply_transforms (colorops, &sw_transform_fb); +#if DUMP_FBS +igt_dump_fb (display, &sw_transform_fb,"." ,"sw_transform" ); +#endif +/* discover and set COLOR PIPELINE */ + +/* get COLOR_PIPELINE enum */ + color_pipeline =get_color_pipeline (display, plane, colorops); + +/* skip test if we can't find applicable pipeline */ +igt_skip_on (!color_pipeline); + +set_color_pipeline (display, plane, colorops, color_pipeline); + +igt_output_set_writeback_fb (output, &output_fb); + +/* commit COLOR_PIPELINE */ +igt_display_commit_atomic (display, +DRM_MODE_ATOMIC_ALLOW_MODESET , +NULL ); +get_and_wait_out_fence (output); +#if DUMP_FBS +igt_dump_fb (display, &output_fb,"." ,"output" ); +#endif + +/* compare sw transformed and KMS transformed FBs */ +igt_assert (compare_with_bracket (&sw_transform_fb, &output_fb)); + +/* reset color pipeline*/ +set_color_pipeline_bypass (plane); + +/* Commit */ +igt_plane_set_fb (plane, &input_fb); +igt_output_set_writeback_fb (output, &output_fb); + +igt_display_commit_atomic (output->display, +DRM_MODE_ATOMIC_ALLOW_MODESET , +NULL ); +get_and_wait_out_fence (output); + +/* cleanup */ +detach_crtc (display, output); +igt_remove_fb (display->drm_fd, &input_fb); +igt_remove_fb (display->drm_fd, &output_fb); +} + +igt_main +{ + +struct { +kms_colorop_t *colorops[MAX_COLOROPS ]; +const char *name; + } tests[] = { + { { &kms_colorop_srgb_eotf,NULL },"srgb_eotf" }, + { { &kms_colorop_srgb_inv_eotf,NULL },"srgb_inv_eotf" }, + { { &kms_colorop_srgb_eotf, &kms_colorop_srgb_inv_eotf,NULL },"srgb_eotf-srgb_inv_eotf" } + }; + +igt_display_t display; +int i, ret; + + igt_fixture { + display.drm_fd =drm_open_driver_master (DRIVER_ANY ); + +if (drmSetClientCap (display.drm_fd,DRM_CLIENT_CAP_ATOMIC ,1 ) ==0 ) + display.is_atomic =1 ; + + ret =drmSetClientCap (display.drm_fd,DRM_CLIENT_CAP_WRITEBACK_CONNECTORS ,1 ); + +igt_require_f (!ret,"error setting DRM_CLIENT_CAP_WRITEBACK_CONNECTORS\n" ); + +igt_display_require (&display, display.drm_fd); + +kmstest_set_vt_graphics_mode (); + +igt_display_require (&display, display.drm_fd); + +igt_require (display.is_atomic); + + } + +for (i =0 ; i <ARRAY_SIZE (tests); i++) { +igt_describe ("Check color ops on a plane" ); + igt_subtest_f("plane-%s", tests[i].name) +colorop_plane_test (&display, tests[i].colorops); + } + +igt_describe ("Tests getting and setting COLOR_PIPELINE property on plane" ); + igt_fixture { +igt_display_fini (&display); + } +}
tests/kms_colorop.h new file +88 -0
88 lines not on this page · raw message
tests/meson.build +1 -0
@@ -26,6 +26,7 @@ test_progs = [ 'kms_bw', 'kms_color', 'kms_concurrent', + 'kms_colorop', 'kms_content_protection', 'kms_cursor_crc', 'kms_cursor_edge_walk',
Signature · 1 line
2.43.0
Re: [PATCH V10 09/30] tests/kms_colorop: Add kms_colorop tests
Quoted 409 lines · Alex Hung
From: Harry Wentland <[email protected]>
This tests the color pipeline API, exposed via the COLOR PIPELINE plane property and
drm_coloropobjects.We introduce tests for:
- sRGB EOTF
- sRGB Inverse EOTF
- sRGB EOTF + sRGB Inverse EOTFThe last one is the holy grail of LUT testing. It tests that after applying an EOTF, followed by its inverse EOTF we arrive back at the original value. We can use this to test for precision loss in the pipeline.
All tests are tested via writeback. All transforms are done in SW (in floating point) and at the end the SW transformed buffer is compared with the KMS writeback output buffer. The two should match within a bracket of acceptable deviations. Since these deviations might look different for different KMS drivers we'll do this check on a driver-specific basis.
Signed-off-by Alex Hung <[email protected]>Signed-off-by Harry Wentland <[email protected]>--- tests/kms_colorop.c | 508 ++++++++++++++++++++++++++++++++++++++++++++ tests/kms_colorop.h | 88 ++++++++ tests/meson.build | 1 + 3 files changed, 597 insertions(+)create mode 100644
tests/kms_colorop.c
create mode 100644tests/kms_colorop.htests/kms_colorop.c new file +371
-0@@ -0,0 +1,508 @@ +// SPDX-License-Identifier: MIT +/* +* Copyright 2023 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 "igt_color.h" +#include "sw_sync.h" +#include "kms_colorop.h" + +/** +* TEST: kms colorop +* Category: Display +* Description: Test to validate the retrieving and setting of DRM colorops +* +* SUBTEST: plane-%s +* Description: Tests DRM colorop properties on a plane +* Driver requirement: amdgpu +* Functionality: kms_core +* Mega feature: General Display Features +* Test category: functionality test +* +* arg[1]: +* +* @srgb_eotf: sRGB EOTF +* @srgb_inv_eotf: sRGB Inverse EOTF +* @srgb_eotf-srgb_inv_eotf: sRGB EOTF -> sRGB Inverse EOTF +* +*/ + +/* TODO move to lib for kms_writeback and kms_colorop (and other future) use */ +static bool check_writeback_config (igt_display_t *display,igt_output_t *output, +drmModeModeInfo override_mode) +{ +igt_fb_t input_fb, output_fb; +igt_plane_t *plane; +uint32_t writeback_format =DRM_FORMAT_XRGB8888 ; +uint64_t modifier =DRM_FORMAT_MOD_LINEAR ; +int width, height, ret; + +igt_output_override_mode (output, &override_mode); + + width = override_mode.hdisplay; + height = override_mode.vdisplay; + + ret =igt_create_fb (display->drm_fd, width, height, +DRM_FORMAT_XRGB8888 , modifier, &input_fb); +igt_assert (ret >=0 ); + + ret =igt_create_fb (display->drm_fd, width, height, + writeback_format, modifier, &output_fb); +igt_assert (ret >=0 ); + + plane =igt_output_get_plane_type (output,DRM_PLANE_TYPE_PRIMARY ); +igt_plane_set_fb (plane, &input_fb); +igt_output_set_writeback_fb (output, &output_fb); + + ret =igt_display_try_commit_atomic (display,DRM_MODE_ATOMIC_TEST_ONLY | +DRM_MODE_ATOMIC_ALLOW_MODESET ,NULL ); +igt_plane_set_fb (plane,NULL ); +igt_remove_fb (display->drm_fd, &input_fb); +igt_remove_fb (display->drm_fd, &output_fb); + +return !ret; +} + +/* TODO move to lib for kms_writeback and kms_colorop (and other future) use */ +typedef struct { +bool builtin_mode; +bool custom_mode; +bool list_modes; +bool dump_check; +int mode_index; +drmModeModeInfo user_mode; +}data_t ; + +static data_t data; + +/* TODO move to lib for kms_writeback and kms_colorop (and other future) use */ +static igt_output_t *kms_writeback_get_output (igt_display_t *display) +{ +int i; +enum pipe pipe; + +drmModeModeInfo override_mode = { + .clock =25175 , + .hdisplay =640 , + .hsync_start =656 , + .hsync_end =752 , + .htotal =800 , + .hskew =0 , + .vdisplay =480 , + .vsync_start =490 , + .vsync_end =492 , + .vtotal =525 , + .vscan =0 , + .vrefresh =60 , + .flags =DRM_MODE_FLAG_NHSYNC |DRM_MODE_FLAG_NVSYNC , + .name = {"640x480-60" }, + }; + +for (i =0 ; i < display->n_outputs; i++) { +igt_output_t *output = &display->outputs[i]; + +if (output->config.connector->connector_type !=DRM_MODE_CONNECTOR_WRITEBACK ) +continue ; + +for_each_pipe (display, pipe) { +igt_output_set_pipe (output, pipe); + +if (data.custom_mode) + override_mode = data.user_mode; +if (data.builtin_mode) + override_mode = output->config.connector->modes[data.mode_index]; + +if (check_writeback_config (display, output, override_mode)) { +igt_debug ("Using connector %u:%s on pipe %d\n" , + output->config.connector->connector_id, + output->name, pipe); +return output; + } + } + +igt_debug ("We found %u:%s, but this test will not be able to use it.\n" , + output->config.connector->connector_id, output->name); + +/* Restore any connectors we don't use, so we don't trip on them later */ +kmstest_force_connector (display->drm_fd, output->config.connector,FORCE_CONNECTOR_UNSPECIFIED ); + } + +return NULL ; +} + +/* TODO move to lib for kms_writeback and kms_colorop (and other future) use */ +static uint64_t get_writeback_fb_id (igt_output_t *output) +{ +return igt_output_get_prop (output,IGT_CONNECTOR_WRITEBACK_FB_ID ); +} + +/* TODO move to lib for kms_writeback and kms_colorop (and other future) use */ +static void detach_crtc (igt_display_t *display,igt_output_t *output) +{ +if (get_writeback_fb_id (output) ==0 ) +return ; + +igt_output_set_pipe (output,PIPE_NONE ); +igt_display_commit2 (display,COMMIT_ATOMIC ); +} + +static void get_and_wait_out_fence (igt_output_t *output) +{ +int ret; + +igt_assert (output->writeback_out_fence_fd >=0 ); + + ret =sync_fence_wait (output->writeback_out_fence_fd,1000 ); +igt_assert_f (ret ==0 ,"sync_fence_wait failed: %s\n" ,strerror (-ret)); +close (output->writeback_out_fence_fd); + output->writeback_out_fence_fd =-1 ; +} + +static bool can_use_colorop (igt_display_t *display,igt_colorop_t *colorop,kms_colorop_t *desired) +{ +switch (desired->type) { +case KMS_COLOROP_ENUMERATED_LUT1D : +if (igt_colorop_get_prop (display, colorop,IGT_COLOROP_TYPE ) ==DRM_COLOROP_1D_CURVE ) +return true; +case KMS_COLOROP_CUSTOM_LUT1D : +case KMS_COLOROP_CTM : +case KMS_COLOROP_LUT3D : +default : +return false; + } +} + +/** +* Iterate color pipeline that begins with colorop and try to map +* colorops[] to it. +*/ +static bool map_to_pipeline (igt_display_t *display, +igt_colorop_t *colorop, +kms_colorop_t *colorops[]) +{ +igt_colorop_t *next = colorop; +kms_colorop_t *current_op; +int i =0 ; +int prop_val =0 ; + + current_op = colorops[i++]; +igt_require (current_op); + +while (next) { +if (can_use_colorop (display, next, current_op)) { + current_op->colorop = next; + current_op = colorops[i++]; +if (!current_op) +break ; + } + prop_val =igt_colorop_get_prop (display, next, +IGT_COLOROP_NEXT ); + next =igt_find_colorop (display, prop_val); + } + +if (current_op) { +/* we failed to map the pipeline */ + +/* clean up colorops[i].colorop mappings */ +for (i =0 , current_op = colorops[0 ]; current_op; current_op = colorops[i++]) + current_op->colorop =NULL ; + +return false; + } + +return true; +} + +static igt_colorop_t *get_color_pipeline (igt_display_t *display, +igt_plane_t *plane, +kms_colorop_t *colorops[]) +{ +igt_colorop_t *colorop =NULL ; +int i; + +/* go through all color pipelines */ +for (i =0 ; i < plane->num_color_pipelines; ++i) { +if (map_to_pipeline (display, plane->color_pipelines[i], colorops)) { + colorop = plane->color_pipelines[i]; +break ; + } + } + +return colorop; +} + +static void set_colorop (igt_display_t *display, +kms_colorop_t *colorop) +{ +igt_assert (colorop->colorop); +igt_colorop_set_prop_value (colorop->colorop,IGT_COLOROP_BYPASS ,0 ); + +/* Set to desired value from kms_colorop_t */ +switch (colorop->type) { +case KMS_COLOROP_ENUMERATED_LUT1D : +switch (colorop->enumerated_lut1d_info.tf) { +case KMS_COLOROP_LUT1D_SRGB_EOTF : +igt_colorop_set_prop_enum (colorop->colorop,IGT_COLOROP_CURVE_1D_TYPE ,"sRGB EOTF" ); +break ; +case KMS_COLOROP_LUT1D_SRGB_INV_EOTF : +igt_colorop_set_prop_enum (colorop->colorop,IGT_COLOROP_CURVE_1D_TYPE ,"sRGB Inverse EOTF" ); +break ; +case KMS_COLOROP_LUT1D_PQ_EOTF : +case KMS_COLOROP_LUT1D_PQ_INV_EOTF : +default : +igt_fail (IGT_EXIT_FAILURE ); + } +break ; +case KMS_COLOROP_CUSTOM_LUT1D : +case KMS_COLOROP_CTM : +case KMS_COLOROP_LUT3D : +default : +igt_fail (IGT_EXIT_FAILURE ); + } +} + +static void set_color_pipeline (igt_display_t *display, +igt_plane_t *plane, +kms_colorop_t *colorops[], +igt_colorop_t *color_pipeline) +{ +igt_colorop_t *next; +int prop_val =0 ; +int i; + +igt_plane_set_color_pipeline (plane, color_pipeline); + +for (i =0 ; colorops[i]; i++) +set_colorop (display, colorops[i]); + +/* set unused ops in pipeline to bypass */ + next = color_pipeline; + i =0 ; +while (next) { +if (!colorops[i] || colorops[i]->colorop != next) +igt_colorop_set_prop_value (next,IGT_COLOROP_BYPASS ,1 ); +else + i++; + + prop_val =igt_colorop_get_prop (display, next, +IGT_COLOROP_NEXT ); + next =igt_find_colorop (display, prop_val); + } +} + +static void set_color_pipeline_bypass (igt_plane_t *plane) +{ +igt_plane_set_prop_enum (plane,IGT_PLANE_COLOR_PIPELINE ,"Bypass" ); +} + +static bool compare_with_bracket (igt_fb_t *in,igt_fb_t *out) +{ +if (is_vkms_device (in->fd)) +return igt_cmp_fb_pixels (in, out,1 ,1 ); + +/* +* By default we'll look for a [0, 0] bracket. We can then +* define it for each driver that implements support for this +* test. That way we can understand the precision of each +* driver better. +*/ +return igt_cmp_fb_pixels (in, out,0 ,0 ); +} + +#define DUMP_FBS 1 + +#define MAX_COLOROPS 3 +#define NUM_COLOROP_TESTS 3 +#define MAX_NAME_SIZE 256 + +static void apply_transforms (kms_colorop_t *colorops[],igt_fb_t *sw_transform_fb) +{ +int i; +igt_pixel_transform transforms[MAX_COLOROPS ]; + +for (i =0 ; colorops[i]; i++) + transforms[i] = colorops[i]->transform; + +igt_color_transform_pixels (sw_transform_fb, transforms, i); +} + +static void colorop_plane_test (igt_display_t *display, +kms_colorop_t *colorops[]) +{ +igt_colorop_t *color_pipeline =NULL ; +igt_output_t *output; +igt_plane_t *plane; +igt_fb_t input_fb; +igt_fb_t sw_transform_fb; +igt_fb_t output_fb; +drmModeModeInfo mode; +unsigned int fb_id; +igt_crc_t input_crc, output_crc; + + output =kms_writeback_get_output (display); +igt_require (output); + +if (output->use_override_mode) +memcpy (&mode, &output->override_mode,sizeof (mode)); +else +memcpy (&mode, &output->config.default_mode,sizeof (mode)); + +/* create input fb */ + plane =igt_output_get_plane_type (output,DRM_PLANE_TYPE_PRIMARY ); +igt_assert (plane);
tests/kms_colorop.c line 381
Quoted 10 lines
tests/kms_colorop.c new file +10
-0+ + fb_id =igt_create_color_pattern_fb (display->drm_fd, + mode.hdisplay, mode.vdisplay, +DRM_FORMAT_XRGB8888 ,DRM_FORMAT_MOD_LINEAR , +0.2 ,0.2 ,0.2 , &input_fb); +igt_assert (fb_id >=0 ); +igt_plane_set_fb (plane, &input_fb); +#if DUMP_FBS +igt_dump_fb (display, &input_fb,"." ,"input" ); +#endif
This is defined to 1 in this file. Leftover from a debug session?
Quoted 233 lines
tests/kms_colorop.c new file +127
-0+ +/* create output fb */ + fb_id =igt_create_fb (display->drm_fd, mode.hdisplay, mode.vdisplay, +DRM_FORMAT_XRGB8888 , +igt_fb_mod_to_tiling (0 ), + &output_fb); +igt_require (fb_id >0 ); + +igt_fb_get_fnv1a_crc (&input_fb, &input_crc); + +igt_require (igt_plane_has_prop (plane,IGT_PLANE_COLOR_PIPELINE )); + +/* reset color pipeline*/ + +set_color_pipeline_bypass (plane); + +/* Commit */ +igt_plane_set_fb (plane, &input_fb); +igt_output_set_writeback_fb (output, &output_fb); + +igt_display_commit_atomic (output->display, +DRM_MODE_ATOMIC_ALLOW_MODESET , +NULL ); +get_and_wait_out_fence (output); + +/* Compare input and output buffers. They should be equal here. */ +igt_fb_get_fnv1a_crc (&output_fb, &output_crc); + +igt_assert_crc_equal (&input_crc, &output_crc); + +/* create sw transformed buffer */ + +igt_copy_fb (display->drm_fd, &input_fb, &sw_transform_fb); +igt_assert (igt_cmp_fb_pixels (&input_fb, &sw_transform_fb,0 ,0 )); + +apply_transforms (colorops, &sw_transform_fb); +#if DUMP_FBS +igt_dump_fb (display, &sw_transform_fb,"." ,"sw_transform" ); +#endif +/* discover and set COLOR PIPELINE */ + +/* get COLOR_PIPELINE enum */ + color_pipeline =get_color_pipeline (display, plane, colorops); + +/* skip test if we can't find applicable pipeline */ +igt_skip_on (!color_pipeline); + +set_color_pipeline (display, plane, colorops, color_pipeline); + +igt_output_set_writeback_fb (output, &output_fb); + +/* commit COLOR_PIPELINE */ +igt_display_commit_atomic (display, +DRM_MODE_ATOMIC_ALLOW_MODESET , +NULL ); +get_and_wait_out_fence (output); +#if DUMP_FBS +igt_dump_fb (display, &output_fb,"." ,"output" ); +#endif + +/* compare sw transformed and KMS transformed FBs */ +igt_assert (compare_with_bracket (&sw_transform_fb, &output_fb)); + +/* reset color pipeline*/ +set_color_pipeline_bypass (plane); + +/* Commit */ +igt_plane_set_fb (plane, &input_fb); +igt_output_set_writeback_fb (output, &output_fb); + +igt_display_commit_atomic (output->display, +DRM_MODE_ATOMIC_ALLOW_MODESET , +NULL ); +get_and_wait_out_fence (output); + +/* cleanup */ +detach_crtc (display, output); +igt_remove_fb (display->drm_fd, &input_fb); +igt_remove_fb (display->drm_fd, &output_fb); +} + +igt_main +{ + +struct { +kms_colorop_t *colorops[MAX_COLOROPS ]; +const char *name; + } tests[] = { + { { &kms_colorop_srgb_eotf,NULL },"srgb_eotf" }, + { { &kms_colorop_srgb_inv_eotf,NULL },"srgb_inv_eotf" }, + { { &kms_colorop_srgb_eotf, &kms_colorop_srgb_inv_eotf,NULL },"srgb_eotf-srgb_inv_eotf" } + }; + +igt_display_t display; +int i, ret; + + igt_fixture { + display.drm_fd =drm_open_driver_master (DRIVER_ANY ); + +if (drmSetClientCap (display.drm_fd,DRM_CLIENT_CAP_ATOMIC ,1 ) ==0 ) + display.is_atomic =1 ; + + ret =drmSetClientCap (display.drm_fd,DRM_CLIENT_CAP_WRITEBACK_CONNECTORS ,1 ); + +igt_require_f (!ret,"error setting DRM_CLIENT_CAP_WRITEBACK_CONNECTORS\n" ); + +igt_display_require (&display, display.drm_fd); + +kmstest_set_vt_graphics_mode (); + +igt_display_require (&display, display.drm_fd); + +igt_require (display.is_atomic); + + } + +for (i =0 ; i <ARRAY_SIZE (tests); i++) { +igt_describe ("Check color ops on a plane" ); + igt_subtest_f("plane-%s", tests[i].name) +colorop_plane_test (&display, tests[i].colorops); + } + +igt_describe ("Tests getting and setting COLOR_PIPELINE property on plane" ); + igt_fixture { +igt_display_fini (&display); + } +}tests/kms_colorop.h new file +88
-0@@ -0,0 +1,88 @@ +/* SPDX-License-Identifier: MIT */ +/* +* Copyright 2023 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. +*/ + +#ifndef __KMS_COLOROP_H__ +#define __KMS_COLOROP_H__ + +#include "igt_color.h" + +typedef bool (*compare_fb_t )(igt_fb_t *in,igt_fb_t *out); + +typedef int (*transform_fb )(igt_fb_t *in); + +typedef int (*transform_pixel )(igt_pixel_t *pixel); + +/* Test version definitions */ +typedef enum kms_colorop_type { +KMS_COLOROP_ENUMERATED_LUT1D , +KMS_COLOROP_CUSTOM_LUT1D , +KMS_COLOROP_CTM , +KMS_COLOROP_LUT3D +}kms_colorop_type_t ; + +typedef enum kms_colorop_lut1d_tf { +KMS_COLOROP_LUT1D_SRGB_EOTF , +KMS_COLOROP_LUT1D_SRGB_INV_EOTF , +KMS_COLOROP_LUT1D_PQ_EOTF , +KMS_COLOROP_LUT1D_PQ_INV_EOTF , +}kms_colorop_lut1d_tf_t ; + +typedef struct kms_colorop_enumerated_lut1d_info { +kms_colorop_lut1d_tf_t tf; +}kms_colorop_enumerated_lut1d_info_t ; + +typedef struct kms_colorop { +kms_colorop_type_t type; + +union { +kms_colorop_enumerated_lut1d_info_t enumerated_lut1d_info; + }; + +const char *name; + +igt_pixel_transform transform; + +/* Mapped colorop */ +igt_colorop_t *colorop; + +}kms_colorop_t ; + +kms_colorop_t kms_colorop_srgb_eotf = { + .type =KMS_COLOROP_ENUMERATED_LUT1D , + .enumerated_lut1d_info = { + .tf =KMS_COLOROP_LUT1D_SRGB_EOTF + }, + .name ="srgb_eotf" , + .transform = &igt_color_srgb_eotf +}; + +kms_colorop_t kms_colorop_srgb_inv_eotf = { + .type =KMS_COLOROP_ENUMERATED_LUT1D , + .enumerated_lut1d_info = { + .tf =KMS_COLOROP_LUT1D_SRGB_INV_EOTF + }, + .name ="srgb_inv_eotf" , + .transform = &igt_color_srgb_inv_eotf +}; + +#endif /* __KMS_COLOROP_H__ */ tests/meson.build +1
-0@@ -26,6 +26,7 @@ test_progs = [ 'kms_bw', 'kms_color', 'kms_concurrent', + 'kms_colorop', 'kms_content_protection', 'kms_cursor_crc', 'kms_cursor_edge_walk',
Re: [PATCH V10 09/30] tests/kms_colorop: Add kms_colorop tests
In reply to Alex HungHi Alex,
Quoted 38 lines · Alex Hung
From: Harry Wentland <[email protected]>
This tests the color pipeline API, exposed via the COLOR PIPELINE plane property and
drm_coloropobjects.We introduce tests for:
- sRGB EOTF
- sRGB Inverse EOTF
- sRGB EOTF + sRGB Inverse EOTFThe last one is the holy grail of LUT testing. It tests that after applying an EOTF, followed by its inverse EOTF we arrive back at the original value. We can use this to test for precision loss in the pipeline.
All tests are tested via writeback. All transforms are done in SW (in floating point) and at the end the SW transformed buffer is compared with the KMS writeback output buffer. The two should match within a bracket of acceptable deviations. Since these deviations might look different for different KMS drivers we'll do this check on a driver-specific basis.
Signed-off-by Alex Hung <[email protected]>Signed-off-by Harry Wentland <[email protected]>--- tests/kms_colorop.c | 508 ++++++++++++++++++++++++++++++++++++++++++++ tests/kms_colorop.h | 88 ++++++++ tests/meson.build | 1 + 3 files changed, 597 insertions(+) create mode 100644 tests/kms_colorop.c create mode 100644 tests/kms_colorop.htests/kms_colorop.c new file +0
-0
tests/kms_colorop.c line 5
Quoted 5 lines
tests/kms_colorop.c new file +5
-0@@ -0,0 +1,508 @@ +// SPDX-License-Identifier: MIT +/* +* Copyright 2023 Advanced Micro Devices, Inc. +* +* Permission is hereby granted, free of charge, to any person obtaining a
Please remove this text as it is replaced by SPDX above.
Quoted 509 lines
tests/kms_colorop.c new file +503
-0+* 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 "igt_color.h" +#include "sw_sync.h" +#include "kms_colorop.h" + +/** +* TEST: kms colorop +* Category: Display +* Description: Test to validate the retrieving and setting of DRM colorops +* +* SUBTEST: plane-%s +* Description: Tests DRM colorop properties on a plane +* Driver requirement: amdgpu +* Functionality: kms_core +* Mega feature: General Display Features +* Test category: functionality test +* +* arg[1]: +* +* @srgb_eotf: sRGB EOTF +* @srgb_inv_eotf: sRGB Inverse EOTF +* @srgb_eotf-srgb_inv_eotf: sRGB EOTF -> sRGB Inverse EOTF +* +*/ + +/* TODO move to lib for kms_writeback and kms_colorop (and other future) use */ +static bool check_writeback_config (igt_display_t *display,igt_output_t *output, +drmModeModeInfo override_mode) +{ +igt_fb_t input_fb, output_fb; +igt_plane_t *plane; +uint32_t writeback_format =DRM_FORMAT_XRGB8888 ; +uint64_t modifier =DRM_FORMAT_MOD_LINEAR ; +int width, height, ret; + +igt_output_override_mode (output, &override_mode); + + width = override_mode.hdisplay; + height = override_mode.vdisplay; + + ret =igt_create_fb (display->drm_fd, width, height, +DRM_FORMAT_XRGB8888 , modifier, &input_fb); +igt_assert (ret >=0 ); + + ret =igt_create_fb (display->drm_fd, width, height, + writeback_format, modifier, &output_fb); +igt_assert (ret >=0 ); + + plane =igt_output_get_plane_type (output,DRM_PLANE_TYPE_PRIMARY ); +igt_plane_set_fb (plane, &input_fb); +igt_output_set_writeback_fb (output, &output_fb); + + ret =igt_display_try_commit_atomic (display,DRM_MODE_ATOMIC_TEST_ONLY | +DRM_MODE_ATOMIC_ALLOW_MODESET ,NULL ); +igt_plane_set_fb (plane,NULL ); +igt_remove_fb (display->drm_fd, &input_fb); +igt_remove_fb (display->drm_fd, &output_fb); + +return !ret; +} + +/* TODO move to lib for kms_writeback and kms_colorop (and other future) use */ +typedef struct { +bool builtin_mode; +bool custom_mode; +bool list_modes; +bool dump_check; +int mode_index; +drmModeModeInfo user_mode; +}data_t ; + +static data_t data; + +/* TODO move to lib for kms_writeback and kms_colorop (and other future) use */ +static igt_output_t *kms_writeback_get_output (igt_display_t *display) +{ +int i; +enum pipe pipe; + +drmModeModeInfo override_mode = { + .clock =25175 , + .hdisplay =640 , + .hsync_start =656 , + .hsync_end =752 , + .htotal =800 , + .hskew =0 , + .vdisplay =480 , + .vsync_start =490 , + .vsync_end =492 , + .vtotal =525 , + .vscan =0 , + .vrefresh =60 , + .flags =DRM_MODE_FLAG_NHSYNC |DRM_MODE_FLAG_NVSYNC , + .name = {"640x480-60" }, + }; + +for (i =0 ; i < display->n_outputs; i++) { +igt_output_t *output = &display->outputs[i]; + +if (output->config.connector->connector_type !=DRM_MODE_CONNECTOR_WRITEBACK ) +continue ; + +for_each_pipe (display, pipe) { +igt_output_set_pipe (output, pipe); + +if (data.custom_mode) + override_mode = data.user_mode; +if (data.builtin_mode) + override_mode = output->config.connector->modes[data.mode_index]; + +if (check_writeback_config (display, output, override_mode)) { +igt_debug ("Using connector %u:%s on pipe %d\n" , + output->config.connector->connector_id, + output->name, pipe); +return output; + } + } + +igt_debug ("We found %u:%s, but this test will not be able to use it.\n" , + output->config.connector->connector_id, output->name); + +/* Restore any connectors we don't use, so we don't trip on them later */ +kmstest_force_connector (display->drm_fd, output->config.connector,FORCE_CONNECTOR_UNSPECIFIED ); + } + +return NULL ; +} + +/* TODO move to lib for kms_writeback and kms_colorop (and other future) use */ +static uint64_t get_writeback_fb_id (igt_output_t *output) +{ +return igt_output_get_prop (output,IGT_CONNECTOR_WRITEBACK_FB_ID ); +} + +/* TODO move to lib for kms_writeback and kms_colorop (and other future) use */ +static void detach_crtc (igt_display_t *display,igt_output_t *output) +{ +if (get_writeback_fb_id (output) ==0 ) +return ; + +igt_output_set_pipe (output,PIPE_NONE ); +igt_display_commit2 (display,COMMIT_ATOMIC ); +} + +static void get_and_wait_out_fence (igt_output_t *output) +{ +int ret; + +igt_assert (output->writeback_out_fence_fd >=0 ); + + ret =sync_fence_wait (output->writeback_out_fence_fd,1000 ); +igt_assert_f (ret ==0 ,"sync_fence_wait failed: %s\n" ,strerror (-ret)); +close (output->writeback_out_fence_fd); + output->writeback_out_fence_fd =-1 ; +} + +static bool can_use_colorop (igt_display_t *display,igt_colorop_t *colorop,kms_colorop_t *desired) +{ +switch (desired->type) { +case KMS_COLOROP_ENUMERATED_LUT1D : +if (igt_colorop_get_prop (display, colorop,IGT_COLOROP_TYPE ) ==DRM_COLOROP_1D_CURVE ) +return true; +case KMS_COLOROP_CUSTOM_LUT1D : +case KMS_COLOROP_CTM : +case KMS_COLOROP_LUT3D : +default : +return false; + } +} + +/** +* Iterate color pipeline that begins with colorop and try to map +* colorops[] to it. +*/ +static bool map_to_pipeline (igt_display_t *display, +igt_colorop_t *colorop, +kms_colorop_t *colorops[]) +{ +igt_colorop_t *next = colorop; +kms_colorop_t *current_op; +int i =0 ; +int prop_val =0 ; + + current_op = colorops[i++]; +igt_require (current_op); + +while (next) { +if (can_use_colorop (display, next, current_op)) { + current_op->colorop = next; + current_op = colorops[i++]; +if (!current_op) +break ; + } + prop_val =igt_colorop_get_prop (display, next, +IGT_COLOROP_NEXT ); + next =igt_find_colorop (display, prop_val); + } + +if (current_op) { +/* we failed to map the pipeline */ + +/* clean up colorops[i].colorop mappings */ +for (i =0 , current_op = colorops[0 ]; current_op; current_op = colorops[i++]) + current_op->colorop =NULL ; + +return false; + } + +return true; +} + +static igt_colorop_t *get_color_pipeline (igt_display_t *display, +igt_plane_t *plane, +kms_colorop_t *colorops[]) +{ +igt_colorop_t *colorop =NULL ; +int i; + +/* go through all color pipelines */ +for (i =0 ; i < plane->num_color_pipelines; ++i) { +if (map_to_pipeline (display, plane->color_pipelines[i], colorops)) { + colorop = plane->color_pipelines[i]; +break ; + } + } + +return colorop; +} + +static void set_colorop (igt_display_t *display, +kms_colorop_t *colorop) +{ +igt_assert (colorop->colorop); +igt_colorop_set_prop_value (colorop->colorop,IGT_COLOROP_BYPASS ,0 ); + +/* Set to desired value from kms_colorop_t */ +switch (colorop->type) { +case KMS_COLOROP_ENUMERATED_LUT1D : +switch (colorop->enumerated_lut1d_info.tf) { +case KMS_COLOROP_LUT1D_SRGB_EOTF : +igt_colorop_set_prop_enum (colorop->colorop,IGT_COLOROP_CURVE_1D_TYPE ,"sRGB EOTF" ); +break ; +case KMS_COLOROP_LUT1D_SRGB_INV_EOTF : +igt_colorop_set_prop_enum (colorop->colorop,IGT_COLOROP_CURVE_1D_TYPE ,"sRGB Inverse EOTF" ); +break ; +case KMS_COLOROP_LUT1D_PQ_EOTF : +case KMS_COLOROP_LUT1D_PQ_INV_EOTF : +default : +igt_fail (IGT_EXIT_FAILURE ); + } +break ; +case KMS_COLOROP_CUSTOM_LUT1D : +case KMS_COLOROP_CTM : +case KMS_COLOROP_LUT3D : +default : +igt_fail (IGT_EXIT_FAILURE ); + } +} + +static void set_color_pipeline (igt_display_t *display, +igt_plane_t *plane, +kms_colorop_t *colorops[], +igt_colorop_t *color_pipeline) +{ +igt_colorop_t *next; +int prop_val =0 ; +int i; + +igt_plane_set_color_pipeline (plane, color_pipeline); + +for (i =0 ; colorops[i]; i++) +set_colorop (display, colorops[i]); + +/* set unused ops in pipeline to bypass */ + next = color_pipeline; + i =0 ; +while (next) { +if (!colorops[i] || colorops[i]->colorop != next) +igt_colorop_set_prop_value (next,IGT_COLOROP_BYPASS ,1 ); +else + i++; + + prop_val =igt_colorop_get_prop (display, next, +IGT_COLOROP_NEXT ); + next =igt_find_colorop (display, prop_val); + } +} + +static void set_color_pipeline_bypass (igt_plane_t *plane) +{ +igt_plane_set_prop_enum (plane,IGT_PLANE_COLOR_PIPELINE ,"Bypass" ); +} + +static bool compare_with_bracket (igt_fb_t *in,igt_fb_t *out) +{ +if (is_vkms_device (in->fd)) +return igt_cmp_fb_pixels (in, out,1 ,1 ); + +/* +* By default we'll look for a [0, 0] bracket. We can then +* define it for each driver that implements support for this +* test. That way we can understand the precision of each +* driver better. +*/ +return igt_cmp_fb_pixels (in, out,0 ,0 ); +} + +#define DUMP_FBS 1 + +#define MAX_COLOROPS 3 +#define NUM_COLOROP_TESTS 3 +#define MAX_NAME_SIZE 256 + +static void apply_transforms (kms_colorop_t *colorops[],igt_fb_t *sw_transform_fb) +{ +int i; +igt_pixel_transform transforms[MAX_COLOROPS ]; + +for (i =0 ; colorops[i]; i++) + transforms[i] = colorops[i]->transform; + +igt_color_transform_pixels (sw_transform_fb, transforms, i); +} + +static void colorop_plane_test (igt_display_t *display, +kms_colorop_t *colorops[]) +{ +igt_colorop_t *color_pipeline =NULL ; +igt_output_t *output; +igt_plane_t *plane; +igt_fb_t input_fb; +igt_fb_t sw_transform_fb; +igt_fb_t output_fb; +drmModeModeInfo mode; +unsigned int fb_id; +igt_crc_t input_crc, output_crc; + + output =kms_writeback_get_output (display); +igt_require (output); + +if (output->use_override_mode) +memcpy (&mode, &output->override_mode,sizeof (mode)); +else +memcpy (&mode, &output->config.default_mode,sizeof (mode)); + +/* create input fb */ + plane =igt_output_get_plane_type (output,DRM_PLANE_TYPE_PRIMARY ); +igt_assert (plane); + + fb_id =igt_create_color_pattern_fb (display->drm_fd, + mode.hdisplay, mode.vdisplay, +DRM_FORMAT_XRGB8888 ,DRM_FORMAT_MOD_LINEAR , +0.2 ,0.2 ,0.2 , &input_fb); +igt_assert (fb_id >=0 ); +igt_plane_set_fb (plane, &input_fb); +#if DUMP_FBS +igt_dump_fb (display, &input_fb,"." ,"input" ); +#endif + +/* create output fb */ + fb_id =igt_create_fb (display->drm_fd, mode.hdisplay, mode.vdisplay, +DRM_FORMAT_XRGB8888 , +igt_fb_mod_to_tiling (0 ), + &output_fb); +igt_require (fb_id >0 ); + +igt_fb_get_fnv1a_crc (&input_fb, &input_crc); + +igt_require (igt_plane_has_prop (plane,IGT_PLANE_COLOR_PIPELINE )); + +/* reset color pipeline*/ + +set_color_pipeline_bypass (plane); + +/* Commit */ +igt_plane_set_fb (plane, &input_fb); +igt_output_set_writeback_fb (output, &output_fb); + +igt_display_commit_atomic (output->display, +DRM_MODE_ATOMIC_ALLOW_MODESET , +NULL ); +get_and_wait_out_fence (output); + +/* Compare input and output buffers. They should be equal here. */ +igt_fb_get_fnv1a_crc (&output_fb, &output_crc); + +igt_assert_crc_equal (&input_crc, &output_crc); + +/* create sw transformed buffer */ + +igt_copy_fb (display->drm_fd, &input_fb, &sw_transform_fb); +igt_assert (igt_cmp_fb_pixels (&input_fb, &sw_transform_fb,0 ,0 )); + +apply_transforms (colorops, &sw_transform_fb); +#if DUMP_FBS +igt_dump_fb (display, &sw_transform_fb,"." ,"sw_transform" ); +#endif +/* discover and set COLOR PIPELINE */ + +/* get COLOR_PIPELINE enum */ + color_pipeline =get_color_pipeline (display, plane, colorops); + +/* skip test if we can't find applicable pipeline */ +igt_skip_on (!color_pipeline); + +set_color_pipeline (display, plane, colorops, color_pipeline); + +igt_output_set_writeback_fb (output, &output_fb); + +/* commit COLOR_PIPELINE */ +igt_display_commit_atomic (display, +DRM_MODE_ATOMIC_ALLOW_MODESET , +NULL ); +get_and_wait_out_fence (output); +#if DUMP_FBS +igt_dump_fb (display, &output_fb,"." ,"output" ); +#endif + +/* compare sw transformed and KMS transformed FBs */ +igt_assert (compare_with_bracket (&sw_transform_fb, &output_fb)); + +/* reset color pipeline*/ +set_color_pipeline_bypass (plane); + +/* Commit */ +igt_plane_set_fb (plane, &input_fb); +igt_output_set_writeback_fb (output, &output_fb); + +igt_display_commit_atomic (output->display, +DRM_MODE_ATOMIC_ALLOW_MODESET , +NULL ); +get_and_wait_out_fence (output); + +/* cleanup */ +detach_crtc (display, output); +igt_remove_fb (display->drm_fd, &input_fb); +igt_remove_fb (display->drm_fd, &output_fb); +} + +igt_main +{ + +struct { +kms_colorop_t *colorops[MAX_COLOROPS ]; +const char *name; + } tests[] = { + { { &kms_colorop_srgb_eotf,NULL },"srgb_eotf" }, + { { &kms_colorop_srgb_inv_eotf,NULL },"srgb_inv_eotf" }, + { { &kms_colorop_srgb_eotf, &kms_colorop_srgb_inv_eotf,NULL },"srgb_eotf-srgb_inv_eotf" } + }; + +igt_display_t display; +int i, ret; + + igt_fixture { + display.drm_fd =drm_open_driver_master (DRIVER_ANY ); + +if (drmSetClientCap (display.drm_fd,DRM_CLIENT_CAP_ATOMIC ,1 ) ==0 ) + display.is_atomic =1 ; + + ret =drmSetClientCap (display.drm_fd,DRM_CLIENT_CAP_WRITEBACK_CONNECTORS ,1 ); + +igt_require_f (!ret,"error setting DRM_CLIENT_CAP_WRITEBACK_CONNECTORS\n" ); + +igt_display_require (&display, display.drm_fd); + +kmstest_set_vt_graphics_mode (); + +igt_display_require (&display, display.drm_fd); + +igt_require (display.is_atomic); + + } + +for (i =0 ; i <ARRAY_SIZE (tests); i++) { +igt_describe ("Check color ops on a plane" ); + igt_subtest_f("plane-%s", tests[i].name) +colorop_plane_test (&display, tests[i].colorops); + } + +igt_describe ("Tests getting and setting COLOR_PIPELINE property on plane" ); + igt_fixture { +igt_display_fini (&display); + } +}tests/kms_colorop.h new file +0
-0
tests/kms_colorop.h line 5
Quoted 5 lines
tests/kms_colorop.h new file +5
-0@@ -0,0 +1,88 @@ +/* SPDX-License-Identifier: MIT */ +/* +* Copyright 2023 Advanced Micro Devices, Inc. +* +* Permission is hereby granted, free of charge, to any person obtaining a
Same here, remove this text.
Regards,
Kamil
Quoted 98 lines
tests/kms_colorop.h new file +83
-0+* 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. +*/ + +#ifndef __KMS_COLOROP_H__ +#define __KMS_COLOROP_H__ + +#include "igt_color.h" + +typedef bool (*compare_fb_t )(igt_fb_t *in,igt_fb_t *out); + +typedef int (*transform_fb )(igt_fb_t *in); + +typedef int (*transform_pixel )(igt_pixel_t *pixel); + +/* Test version definitions */ +typedef enum kms_colorop_type { +KMS_COLOROP_ENUMERATED_LUT1D , +KMS_COLOROP_CUSTOM_LUT1D , +KMS_COLOROP_CTM , +KMS_COLOROP_LUT3D +}kms_colorop_type_t ; + +typedef enum kms_colorop_lut1d_tf { +KMS_COLOROP_LUT1D_SRGB_EOTF , +KMS_COLOROP_LUT1D_SRGB_INV_EOTF , +KMS_COLOROP_LUT1D_PQ_EOTF , +KMS_COLOROP_LUT1D_PQ_INV_EOTF , +}kms_colorop_lut1d_tf_t ; + +typedef struct kms_colorop_enumerated_lut1d_info { +kms_colorop_lut1d_tf_t tf; +}kms_colorop_enumerated_lut1d_info_t ; + +typedef struct kms_colorop { +kms_colorop_type_t type; + +union { +kms_colorop_enumerated_lut1d_info_t enumerated_lut1d_info; + }; + +const char *name; + +igt_pixel_transform transform; + +/* Mapped colorop */ +igt_colorop_t *colorop; + +}kms_colorop_t ; + +kms_colorop_t kms_colorop_srgb_eotf = { + .type =KMS_COLOROP_ENUMERATED_LUT1D , + .enumerated_lut1d_info = { + .tf =KMS_COLOROP_LUT1D_SRGB_EOTF + }, + .name ="srgb_eotf" , + .transform = &igt_color_srgb_eotf +}; + +kms_colorop_t kms_colorop_srgb_inv_eotf = { + .type =KMS_COLOROP_ENUMERATED_LUT1D , + .enumerated_lut1d_info = { + .tf =KMS_COLOROP_LUT1D_SRGB_INV_EOTF + }, + .name ="srgb_inv_eotf" , + .transform = &igt_color_srgb_inv_eotf +}; + +#endif /* __KMS_COLOROP_H__ */ tests/meson.build +1
-0@@ -26,6 +26,7 @@ test_progs = [ 'kms_bw', 'kms_color', 'kms_concurrent', + 'kms_colorop', 'kms_content_protection', 'kms_cursor_crc', 'kms_cursor_edge_walk',Signature · 1 line
2.43.0
Re: [PATCH V10 09/30] tests/kms_colorop: Add kms_colorop tests
Hi Alex,
Is it possible to move colorop basic func() likecan_use_colorop(), map_to_pipline(), etc. to lib?
Quoted 664 lines · Kamil Konieczny
Hi Alex,
Quoted 38 lines · Alex Hung
From: Harry Wentland <[email protected]>
This tests the color pipeline API, exposed via the COLOR PIPELINE plane property and
drm_coloropobjects.We introduce tests for:
- sRGB EOTF
- sRGB Inverse EOTF
- sRGB EOTF + sRGB Inverse EOTFThe last one is the holy grail of LUT testing. It tests that after applying an EOTF, followed by its inverse EOTF we arrive back at the original value. We can use this to test for precision loss in the pipeline.
All tests are tested via writeback. All transforms are done in SW (in floating point) and at the end the SW transformed buffer is compared with the KMS writeback output buffer. The two should match within a bracket of acceptable deviations. Since these deviations might look different for different KMS drivers we'll do this check on a driver-specific basis.
Signed-off-by Alex Hung <[email protected]>Signed-off-by Harry Wentland <[email protected]>--- tests/kms_colorop.c | 508 ++++++++++++++++++++++++++++++++++++++++++++ tests/kms_colorop.h | 88 ++++++++ tests/meson.build | 1 + 3 files changed, 597 insertions(+)create mode 100644
tests/kms_colorop.c
create mode 100644tests/kms_colorop.htests/kms_colorop.c new file +0
-0tests/kms_colorop.c line 5
Quoted 5 lines
tests/kms_colorop.c new file +5
-0@@ -0,0 +1,508 @@ +// SPDX-License-Identifier: MIT +/* +* Copyright 2023 Advanced Micro Devices, Inc. +* +* Permission is hereby granted, free of charge, to any person obtaining a Please remove this text as it is replaced by SPDX above.
Quoted 509 lines
tests/kms_colorop.c new file +503
-0+* 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 "igt_color.h" +#include "sw_sync.h" +#include "kms_colorop.h" + +/** +* TEST: kms colorop +* Category: Display +* Description: Test to validate the retrieving and setting of DRM colorops +* +* SUBTEST: plane-%s +* Description: Tests DRM colorop properties on a plane +* Driver requirement: amdgpu +* Functionality: kms_core +* Mega feature: General Display Features +* Test category: functionality test +* +* arg[1]: +* +* @srgb_eotf: sRGB EOTF +* @srgb_inv_eotf: sRGB Inverse EOTF +* @srgb_eotf-srgb_inv_eotf: sRGB EOTF -> sRGB Inverse EOTF +* +*/ + +/* TODO move to lib for kms_writeback and kms_colorop (and other future) use */ +static bool check_writeback_config (igt_display_t *display,igt_output_t *output, +drmModeModeInfo override_mode) +{ +igt_fb_t input_fb, output_fb; +igt_plane_t *plane; +uint32_t writeback_format =DRM_FORMAT_XRGB8888 ; +uint64_t modifier =DRM_FORMAT_MOD_LINEAR ; +int width, height, ret; + +igt_output_override_mode (output, &override_mode); + + width = override_mode.hdisplay; + height = override_mode.vdisplay; + + ret =igt_create_fb (display->drm_fd, width, height, +DRM_FORMAT_XRGB8888 , modifier, &input_fb); +igt_assert (ret >=0 ); + + ret =igt_create_fb (display->drm_fd, width, height, + writeback_format, modifier, &output_fb); +igt_assert (ret >=0 ); + + plane =igt_output_get_plane_type (output,DRM_PLANE_TYPE_PRIMARY ); +igt_plane_set_fb (plane, &input_fb); +igt_output_set_writeback_fb (output, &output_fb); + + ret =igt_display_try_commit_atomic (display,DRM_MODE_ATOMIC_TEST_ONLY | +DRM_MODE_ATOMIC_ALLOW_MODESET ,NULL ); +igt_plane_set_fb (plane,NULL ); +igt_remove_fb (display->drm_fd, &input_fb); +igt_remove_fb (display->drm_fd, &output_fb); + +return !ret; +} + +/* TODO move to lib for kms_writeback and kms_colorop (and other future) use */ +typedef struct { +bool builtin_mode; +bool custom_mode; +bool list_modes; +bool dump_check; +int mode_index; +drmModeModeInfo user_mode; +}data_t ; + +static data_t data; + +/* TODO move to lib for kms_writeback and kms_colorop (and other future) use */ +static igt_output_t *kms_writeback_get_output (igt_display_t *display) +{ +int i; +enum pipe pipe; + +drmModeModeInfo override_mode = { + .clock =25175 , + .hdisplay =640 , + .hsync_start =656 , + .hsync_end =752 , + .htotal =800 , + .hskew =0 , + .vdisplay =480 , + .vsync_start =490 , + .vsync_end =492 , + .vtotal =525 , + .vscan =0 , + .vrefresh =60 , + .flags =DRM_MODE_FLAG_NHSYNC |DRM_MODE_FLAG_NVSYNC , + .name = {"640x480-60" }, + }; + +for (i =0 ; i < display->n_outputs; i++) { +igt_output_t *output = &display->outputs[i]; + +if (output->config.connector->connector_type !=DRM_MODE_CONNECTOR_WRITEBACK ) +continue ; + +for_each_pipe (display, pipe) { +igt_output_set_pipe (output, pipe); + +if (data.custom_mode) + override_mode = data.user_mode; +if (data.builtin_mode) + override_mode = output->config.connector->modes[data.mode_index]; + +if (check_writeback_config (display, output, override_mode)) { +igt_debug ("Using connector %u:%s on pipe %d\n" , + output->config.connector->connector_id, + output->name, pipe); +return output; + } + } + +igt_debug ("We found %u:%s, but this test will not be able to use it.\n" , + output->config.connector->connector_id, output->name); + +/* Restore any connectors we don't use, so we don't trip on them later */ +kmstest_force_connector (display->drm_fd, output->config.connector,FORCE_CONNECTOR_UNSPECIFIED ); + } + +return NULL ; +} + +/* TODO move to lib for kms_writeback and kms_colorop (and other future) use */ +static uint64_t get_writeback_fb_id (igt_output_t *output) +{ +return igt_output_get_prop (output,IGT_CONNECTOR_WRITEBACK_FB_ID ); +} + +/* TODO move to lib for kms_writeback and kms_colorop (and other future) use */ +static void detach_crtc (igt_display_t *display,igt_output_t *output) +{ +if (get_writeback_fb_id (output) ==0 ) +return ; + +igt_output_set_pipe (output,PIPE_NONE ); +igt_display_commit2 (display,COMMIT_ATOMIC ); +} + +static void get_and_wait_out_fence (igt_output_t *output) +{ +int ret; + +igt_assert (output->writeback_out_fence_fd >=0 ); + + ret =sync_fence_wait (output->writeback_out_fence_fd,1000 ); +igt_assert_f (ret ==0 ,"sync_fence_wait failed: %s\n" ,strerror (-ret)); +close (output->writeback_out_fence_fd); + output->writeback_out_fence_fd =-1 ; +} + +static bool can_use_colorop (igt_display_t *display,igt_colorop_t *colorop,kms_colorop_t *desired) +{ +switch (desired->type) { +case KMS_COLOROP_ENUMERATED_LUT1D : +if (igt_colorop_get_prop (display, colorop,IGT_COLOROP_TYPE ) ==DRM_COLOROP_1D_CURVE ) +return true; +case KMS_COLOROP_CUSTOM_LUT1D : +case KMS_COLOROP_CTM : +case KMS_COLOROP_LUT3D : +default : +return false; + } +} + +/** +* Iterate color pipeline that begins with colorop and try to map +* colorops[] to it. +*/ +static bool map_to_pipeline (igt_display_t *display, +igt_colorop_t *colorop, +kms_colorop_t *colorops[]) +{ +igt_colorop_t *next = colorop; +kms_colorop_t *current_op; +int i =0 ; +int prop_val =0 ; + + current_op = colorops[i++]; +igt_require (current_op); + +while (next) { +if (can_use_colorop (display, next, current_op)) { + current_op->colorop = next; + current_op = colorops[i++]; +if (!current_op) +break ; + } + prop_val =igt_colorop_get_prop (display, next, +IGT_COLOROP_NEXT ); + next =igt_find_colorop (display, prop_val); + } + +if (current_op) { +/* we failed to map the pipeline */ + +/* clean up colorops[i].colorop mappings */ +for (i =0 , current_op = colorops[0 ]; current_op; current_op = colorops[i++]) + current_op->colorop =NULL ; + +return false; + } + +return true; +} + +static igt_colorop_t *get_color_pipeline (igt_display_t *display, +igt_plane_t *plane, +kms_colorop_t *colorops[]) +{ +igt_colorop_t *colorop =NULL ; +int i; + +/* go through all color pipelines */ +for (i =0 ; i < plane->num_color_pipelines; ++i) { +if (map_to_pipeline (display, plane->color_pipelines[i], colorops)) { + colorop = plane->color_pipelines[i]; +break ; + } + } + +return colorop; +} + +static void set_colorop (igt_display_t *display, +kms_colorop_t *colorop) +{ +igt_assert (colorop->colorop); +igt_colorop_set_prop_value (colorop->colorop,IGT_COLOROP_BYPASS ,0 ); + +/* Set to desired value from kms_colorop_t */ +switch (colorop->type) { +case KMS_COLOROP_ENUMERATED_LUT1D : +switch (colorop->enumerated_lut1d_info.tf) { +case KMS_COLOROP_LUT1D_SRGB_EOTF : +igt_colorop_set_prop_enum (colorop->colorop,IGT_COLOROP_CURVE_1D_TYPE ,"sRGB EOTF" ); +break ; +case KMS_COLOROP_LUT1D_SRGB_INV_EOTF : +igt_colorop_set_prop_enum (colorop->colorop,IGT_COLOROP_CURVE_1D_TYPE ,"sRGB Inverse EOTF" ); +break ; +case KMS_COLOROP_LUT1D_PQ_EOTF : +case KMS_COLOROP_LUT1D_PQ_INV_EOTF : +default : +igt_fail (IGT_EXIT_FAILURE ); + } +break ; +case KMS_COLOROP_CUSTOM_LUT1D : +case KMS_COLOROP_CTM : +case KMS_COLOROP_LUT3D : +default : +igt_fail (IGT_EXIT_FAILURE ); + } +} + +static void set_color_pipeline (igt_display_t *display, +igt_plane_t *plane, +kms_colorop_t *colorops[], +igt_colorop_t *color_pipeline) +{ +igt_colorop_t *next; +int prop_val =0 ; +int i; + +igt_plane_set_color_pipeline (plane, color_pipeline); + +for (i =0 ; colorops[i]; i++) +set_colorop (display, colorops[i]); + +/* set unused ops in pipeline to bypass */ + next = color_pipeline; + i =0 ; +while (next) { +if (!colorops[i] || colorops[i]->colorop != next) +igt_colorop_set_prop_value (next,IGT_COLOROP_BYPASS ,1 ); +else + i++; + + prop_val =igt_colorop_get_prop (display, next, +IGT_COLOROP_NEXT ); + next =igt_find_colorop (display, prop_val); + } +} + +static void set_color_pipeline_bypass (igt_plane_t *plane) +{ +igt_plane_set_prop_enum (plane,IGT_PLANE_COLOR_PIPELINE ,"Bypass" ); +} + +static bool compare_with_bracket (igt_fb_t *in,igt_fb_t *out) +{ +if (is_vkms_device (in->fd)) +return igt_cmp_fb_pixels (in, out,1 ,1 ); + +/* +* By default we'll look for a [0, 0] bracket. We can then +* define it for each driver that implements support for this +* test. That way we can understand the precision of each +* driver better. +*/ +return igt_cmp_fb_pixels (in, out,0 ,0 ); +} + +#define DUMP_FBS 1 + +#define MAX_COLOROPS 3 +#define NUM_COLOROP_TESTS 3 +#define MAX_NAME_SIZE 256 + +static void apply_transforms (kms_colorop_t *colorops[],igt_fb_t *sw_transform_fb) +{ +int i; +igt_pixel_transform transforms[MAX_COLOROPS ]; + +for (i =0 ; colorops[i]; i++) + transforms[i] = colorops[i]->transform; + +igt_color_transform_pixels (sw_transform_fb, transforms, i); +} + +static void colorop_plane_test (igt_display_t *display, +kms_colorop_t *colorops[]) +{ +igt_colorop_t *color_pipeline =NULL ; +igt_output_t *output; +igt_plane_t *plane; +igt_fb_t input_fb; +igt_fb_t sw_transform_fb; +igt_fb_t output_fb; +drmModeModeInfo mode; +unsigned int fb_id; +igt_crc_t input_crc, output_crc; + + output =kms_writeback_get_output (display); +igt_require (output); + +if (output->use_override_mode) +memcpy (&mode, &output->override_mode,sizeof (mode)); +else +memcpy (&mode, &output->config.default_mode,sizeof (mode)); + +/* create input fb */ + plane =igt_output_get_plane_type (output,DRM_PLANE_TYPE_PRIMARY ); +igt_assert (plane); + + fb_id =igt_create_color_pattern_fb (display->drm_fd, + mode.hdisplay, mode.vdisplay, +DRM_FORMAT_XRGB8888 ,DRM_FORMAT_MOD_LINEAR , +0.2 ,0.2 ,0.2 , &input_fb); +igt_assert (fb_id >=0 ); +igt_plane_set_fb (plane, &input_fb); +#if DUMP_FBS +igt_dump_fb (display, &input_fb,"." ,"input" ); +#endif + +/* create output fb */ + fb_id =igt_create_fb (display->drm_fd, mode.hdisplay, mode.vdisplay, +DRM_FORMAT_XRGB8888 , +igt_fb_mod_to_tiling (0 ), + &output_fb); +igt_require (fb_id >0 ); + +igt_fb_get_fnv1a_crc (&input_fb, &input_crc); + +igt_require (igt_plane_has_prop (plane,IGT_PLANE_COLOR_PIPELINE )); + +/* reset color pipeline*/ + +set_color_pipeline_bypass (plane); + +/* Commit */ +igt_plane_set_fb (plane, &input_fb); +igt_output_set_writeback_fb (output, &output_fb); + +igt_display_commit_atomic (output->display, +DRM_MODE_ATOMIC_ALLOW_MODESET , +NULL ); +get_and_wait_out_fence (output); + +/* Compare input and output buffers. They should be equal here. */ +igt_fb_get_fnv1a_crc (&output_fb, &output_crc); + +igt_assert_crc_equal (&input_crc, &output_crc); + +/* create sw transformed buffer */ + +igt_copy_fb (display->drm_fd, &input_fb, &sw_transform_fb); +igt_assert (igt_cmp_fb_pixels (&input_fb, &sw_transform_fb,0 ,0 )); + +apply_transforms (colorops, &sw_transform_fb); +#if DUMP_FBS +igt_dump_fb (display, &sw_transform_fb,"." ,"sw_transform" ); +#endif +/* discover and set COLOR PIPELINE */ + +/* get COLOR_PIPELINE enum */ + color_pipeline =get_color_pipeline (display, plane, colorops); + +/* skip test if we can't find applicable pipeline */ +igt_skip_on (!color_pipeline); + +set_color_pipeline (display, plane, colorops, color_pipeline); + +igt_output_set_writeback_fb (output, &output_fb); + +/* commit COLOR_PIPELINE */ +igt_display_commit_atomic (display, +DRM_MODE_ATOMIC_ALLOW_MODESET , +NULL ); +get_and_wait_out_fence (output); +#if DUMP_FBS +igt_dump_fb (display, &output_fb,"." ,"output" ); +#endif + +/* compare sw transformed and KMS transformed FBs */ +igt_assert (compare_with_bracket (&sw_transform_fb, &output_fb)); + +/* reset color pipeline*/ +set_color_pipeline_bypass (plane); + +/* Commit */ +igt_plane_set_fb (plane, &input_fb); +igt_output_set_writeback_fb (output, &output_fb); + +igt_display_commit_atomic (output->display, +DRM_MODE_ATOMIC_ALLOW_MODESET , +NULL ); +get_and_wait_out_fence (output); + +/* cleanup */ +detach_crtc (display, output); +igt_remove_fb (display->drm_fd, &input_fb); +igt_remove_fb (display->drm_fd, &output_fb); +} + +igt_main +{ + +struct { +kms_colorop_t *colorops[MAX_COLOROPS ]; +const char *name; + } tests[] = { + { { &kms_colorop_srgb_eotf,NULL },"srgb_eotf" }, + { { &kms_colorop_srgb_inv_eotf,NULL },"srgb_inv_eotf" }, + { { &kms_colorop_srgb_eotf, &kms_colorop_srgb_inv_eotf,NULL },"srgb_eotf-srgb_inv_eotf" } + }; + +igt_display_t display; +int i, ret; + + igt_fixture { + display.drm_fd =drm_open_driver_master (DRIVER_ANY ); + +if (drmSetClientCap (display.drm_fd,DRM_CLIENT_CAP_ATOMIC ,1 ) ==0 ) + display.is_atomic =1 ; + + ret =drmSetClientCap (display.drm_fd,DRM_CLIENT_CAP_WRITEBACK_CONNECTORS ,1 ); + +igt_require_f (!ret,"error setting DRM_CLIENT_CAP_WRITEBACK_CONNECTORS\n" ); + +igt_display_require (&display, display.drm_fd); + +kmstest_set_vt_graphics_mode (); + +igt_display_require (&display, display.drm_fd); + +igt_require (display.is_atomic); + + } + +for (i =0 ; i <ARRAY_SIZE (tests); i++) { +igt_describe ("Check color ops on a plane" ); + igt_subtest_f("plane-%s", tests[i].name) +colorop_plane_test (&display, tests[i].colorops); + } + +igt_describe ("Tests getting and setting COLOR_PIPELINE property on plane" ); + igt_fixture { +igt_display_fini (&display); + } +}tests/kms_colorop.h new file +0
-0tests/kms_colorop.h line 5
Quoted 5 lines
tests/kms_colorop.h new file +5
-0@@ -0,0 +1,88 @@ +/* SPDX-License-Identifier: MIT */ +/* +* Copyright 2023 Advanced Micro Devices, Inc. +* +* Permission is hereby granted, free of charge, to any person obtaining a Same here, remove this text.
Regards,
KamilQuoted 98 lines
tests/kms_colorop.h new file +83
-0+* 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. +*/ + +#ifndef __KMS_COLOROP_H__ +#define __KMS_COLOROP_H__ + +#include "igt_color.h" + +typedef bool (*compare_fb_t )(igt_fb_t *in,igt_fb_t *out); + +typedef int (*transform_fb )(igt_fb_t *in); + +typedef int (*transform_pixel )(igt_pixel_t *pixel); + +/* Test version definitions */ +typedef enum kms_colorop_type { +KMS_COLOROP_ENUMERATED_LUT1D , +KMS_COLOROP_CUSTOM_LUT1D , +KMS_COLOROP_CTM , +KMS_COLOROP_LUT3D +}kms_colorop_type_t ; + +typedef enum kms_colorop_lut1d_tf { +KMS_COLOROP_LUT1D_SRGB_EOTF , +KMS_COLOROP_LUT1D_SRGB_INV_EOTF , +KMS_COLOROP_LUT1D_PQ_EOTF , +KMS_COLOROP_LUT1D_PQ_INV_EOTF , +}kms_colorop_lut1d_tf_t ; + +typedef struct kms_colorop_enumerated_lut1d_info { +kms_colorop_lut1d_tf_t tf; +}kms_colorop_enumerated_lut1d_info_t ; + +typedef struct kms_colorop { +kms_colorop_type_t type; + +union { +kms_colorop_enumerated_lut1d_info_t enumerated_lut1d_info; + }; + +const char *name; + +igt_pixel_transform transform; + +/* Mapped colorop */ +igt_colorop_t *colorop; + +}kms_colorop_t ; + +kms_colorop_t kms_colorop_srgb_eotf = { + .type =KMS_COLOROP_ENUMERATED_LUT1D , + .enumerated_lut1d_info = { + .tf =KMS_COLOROP_LUT1D_SRGB_EOTF + }, + .name ="srgb_eotf" , + .transform = &igt_color_srgb_eotf +}; + +kms_colorop_t kms_colorop_srgb_inv_eotf = { + .type =KMS_COLOROP_ENUMERATED_LUT1D , + .enumerated_lut1d_info = { + .tf =KMS_COLOROP_LUT1D_SRGB_INV_EOTF + }, + .name ="srgb_inv_eotf" , + .transform = &igt_color_srgb_inv_eotf +}; + +#endif /* __KMS_COLOROP_H__ */ tests/meson.build +1
-0@@ -26,6 +26,7 @@ test_progs = [ 'kms_bw', 'kms_color', 'kms_concurrent', + 'kms_colorop', 'kms_content_protection', 'kms_cursor_crc', 'kms_cursor_edge_walk',Signature · 1 line
2.43.0
Re: [PATCH V10 09/30] tests/kms_colorop: Add kms_colorop tests
Quoted 4 lines · On 9/19/25 01:19, Sharma, Swati2 wrote:
Hi Alex,
Is it possible to move colorop basic
func()likecan_use_colorop(),map_to_pipline(), etc. to lib?
These two functions use kms_colorop_t which defined in tests/kms_colorop.h, and it is not available in lib/
If you can refactor them to lib, I am happy to review your patches.
It would be nice if more colorop tests can be added to kms_colorop though.
Quoted 720 lines · Kamil Konieczny
Quoted 717 lines
Hi Alex,
Quoted 43 lines · Alex Hung
From: Harry Wentland <[email protected]>
This tests the color pipeline API, exposed via the COLOR PIPELINE plane property and
drm_coloropobjects.We introduce tests for:
- sRGB EOTF
- sRGB Inverse EOTF
- sRGB EOTF + sRGB Inverse EOTFThe last one is the holy grail of LUT testing. It tests that after applying an EOTF, followed by its inverse EOTF we arrive back at the original value. We can use this to test for precision loss in the pipeline.
All tests are tested via writeback. All transforms are done in SW (in floating point) and at the end the SW transformed buffer is compared with the KMS writeback output buffer. The two should match within a bracket of acceptable deviations. Since these deviations might look different for different KMS drivers we'll do this check on a driver-specific basis.
Signed-off-by Alex Hung <[email protected]>Signed-off-by Harry Wentland <[email protected]>---
tests/kms_colorop.c| 508 ++++++++++++++++++++++++++++++++++++++++++++tests/kms_colorop.h| 88 ++++++++
tests/meson.build | 1 +3 files changed, 597 insertions(+)create mode 100644
tests/kms_colorop.c
create mode 100644tests/kms_colorop.htests/kms_colorop.c new file +5
-0@@ -0,0 +1,508 @@ +// SPDX-License-Identifier: MIT +/* +* Copyright 2023 Advanced Micro Devices, Inc. +* +* Permission is hereby granted, free of charge, to any person Quoted 1 line
obtaining a
Please remove this text as it is replaced by SPDX above.
Quoted 554 lines
+ * 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.
+ */tests/kms_colorop.c new file +10
-0+ +#include "igt.h" +#include "igt_color.h" +#include "sw_sync.h" +#include "kms_colorop.h" + +/** +* TEST: kms colorop +* Category: Display +* Description: Test to validate the retrieving and setting of DRM colorops
+ *
+ * SUBTEST: plane-%s
+ * Description: Tests DRM colorop properties on a plane
+ * Driver requirement: amdgpu
+ * Functionality:kms_core
+ * Mega feature: General Display Features
+ * Test category: functionality test
+ *
+ * arg[1]:
+ *
+ * @srgb_eotf: sRGB EOTF
+ * @srgb_inv_eotf: sRGB Inverse EOTF
+ * @srgb_eotf-srgb_inv_eotf: sRGB EOTF -> sRGB Inverse EOTF
+ *
+ */tests/kms_colorop.c new file +2
-0+ +/* TODO move to lib for kms_writeback and kms_colorop (and other future) use */
+static bool check_writeback_config(igt_display_t *display,igt_output_t*output,
+ drmModeModeInfooverride_mode)tests/kms_colorop.c new file +25
-0+{ + igt_fb_t input_fb, output_fb; + igt_plane_t *plane; + uint32_t writeback_format = DRM_FORMAT_XRGB8888; + uint64_t modifier = DRM_FORMAT_MOD_LINEAR; + int width, height, ret; + + igt_output_override_mode(output, &override_mode); + + width = override_mode.hdisplay; + height = override_mode.vdisplay; + + ret = igt_create_fb(display->drm_fd, width, height, + DRM_FORMAT_XRGB8888, modifier, &input_fb); + igt_assert(ret >= 0); + + ret = igt_create_fb(display->drm_fd, width, height, + writeback_format, modifier, &output_fb); + igt_assert(ret >= 0); + + plane = igt_output_get_plane_type(output, DRM_PLANE_TYPE_PRIMARY); + igt_plane_set_fb(plane, &input_fb); + igt_output_set_writeback_fb(output, &output_fb); + + ret = igt_display_try_commit_atomic(display,
DRM_MODE_ATOMIC_TEST_ONLY|
+DRM_MODE_ATOMIC_ALLOW_MODESET, NULL); +igt_plane_set_fb(plane, NULL);
+igt_remove_fb(display->drm_fd, &input_fb);
+igt_remove_fb(display->drm_fd, &output_fb);tests/kms_colorop.c new file +5
-0+ + return !ret; +} + +/* TODO move to lib for kms_writeback and kms_colorop (and other future) use */
tests/kms_colorop.c new file +12
-0+typedef struct { + bool builtin_mode; + bool custom_mode; + bool list_modes; + bool dump_check; + int mode_index; + drmModeModeInfo user_mode; +}data_t ; + +static data_t data; + +/* TODO move to lib for kms_writeback and kms_colorop (and other future) use */
tests/kms_colorop.c new file +26
-0+static igt_output_t *kms_writeback_get_output (igt_display_t *display) +{ + int i; + enum pipe pipe; + + drmModeModeInfo override_mode = { + .clock = 25175, + .hdisplay = 640, + .hsync_start = 656, + .hsync_end = 752, + .htotal = 800, + .hskew = 0, + .vdisplay = 480, + .vsync_start = 490, + .vsync_end = 492, + .vtotal = 525, + .vscan = 0, + .vrefresh = 60, + .flags = DRM_MODE_FLAG_NHSYNC | DRM_MODE_FLAG_NVSYNC, + .name = {"640x480-60"}, + }; + + for (i = 0; i < display->n_outputs; i++) { + igt_output_t *output = &display->outputs[i]; + + if (output->config.connector->connector_type !=
DRM_MODE_CONNECTOR_WRITEBACK)
+ continue;tests/kms_colorop.c new file +8
-0+ + for_each_pipe(display, pipe) { + igt_output_set_pipe(output, pipe); + + if (data.custom_mode) + override_mode = data.user_mode; + if (data.builtin_mode) + override_mode = output->config.connector-Quoted 1 line
modes[data.mode_index];
+
+ if (check_writeback_config(display, output, override_mode)) {
+ igt_debug("Using connector %u:%s on pipe %d\n", +output->config.connector->connector_id, +output->name, pipe);
+ return output;
+ }
+ }
+
+ igt_debug("We found %u:%s, but this test will not be able to use it.\n",
+output->config.connector->connector_id,output->name); +
+ /* Restore any connectors we don't use, so we don't trip on them later */
+ kmstest_force_connector(display->drm_fd, output-Quoted 1 line
config.connector,
FORCE_CONNECTOR_UNSPECIFIED);+ }
tests/kms_colorop.c new file +5
-0+ + return NULL; +} + +/* TODO move to lib for kms_writeback and kms_colorop (and other future) use */
tests/kms_colorop.c new file +6
-0+static uint64_t get_writeback_fb_id (igt_output_t *output) +{ + return igt_output_get_prop(output, IGT_CONNECTOR_WRITEBACK_FB_ID); +} + +/* TODO move to lib for kms_writeback and kms_colorop (and other future) use */
tests/kms_colorop.c new file +17
-0+static void detach_crtc (igt_display_t *display,igt_output_t *output) +{ + if (get_writeback_fb_id(output) == 0) + return; + + igt_output_set_pipe(output, PIPE_NONE); + igt_display_commit2(display, COMMIT_ATOMIC); +} + +static void get_and_wait_out_fence (igt_output_t *output) +{ + int ret; + + igt_assert(output->writeback_out_fence_fd >= 0); + + ret = sync_fence_wait(output->writeback_out_fence_fd, 1000); + igt_assert_f(ret == 0, "sync_fence_wait failed: %s\n",strerror(-ret));
+close(output->writeback_out_fence_fd);
+output->writeback_out_fence_fd= -1;tests/kms_colorop.c new file +3
-0+} + +static bool can_use_colorop(igt_display_t *display, igt_colorop_t*colorop,
kms_colorop_t*desired)
+{
+ switch (desired->type) {
+ caseKMS_COLOROP_ENUMERATED_LUT1D:
+ if (igt_colorop_get_prop(display, colorop, IGT_COLOROP_TYPE)==DRM_COLOROP_1D_CURVE)
+ return true;
+ caseKMS_COLOROP_CUSTOM_LUT1D:
+ caseKMS_COLOROP_CTM:
+ caseKMS_COLOROP_LUT3D:
+ default:
+ return false;
+ }tests/kms_colorop.c new file +35
-0+} + +/** +* Iterate color pipeline that begins with colorop and try to map +* colorops[] to it. +*/ +static bool map_to_pipeline (igt_display_t *display, + igt_colorop_t *colorop, + kms_colorop_t *colorops[]) +{ + igt_colorop_t *next = colorop; + kms_colorop_t *current_op; + int i = 0; + int prop_val = 0; + + current_op = colorops[i++]; + igt_require(current_op); + + while (next) { + if (can_use_colorop(display, next, current_op)) { + current_op->colorop = next; + current_op = colorops[i++]; + if (!current_op) + break; + } + prop_val = igt_colorop_get_prop(display, next, + IGT_COLOROP_NEXT); + next = igt_find_colorop(display, prop_val); + } + + if (current_op) { + /* we failed to map the pipeline */ + + /* clean up colorops[i].colorop mappings */ + for (i = 0, current_op = colorops[0]; current_op; current_op= colorops[i++])
+current_op->colorop= NULL;tests/kms_colorop.c new file +17
-0+ + return false; + } + + return true; +} + +static igt_colorop_t *get_color_pipeline (igt_display_t *display, + igt_plane_t *plane, + kms_colorop_t *colorops[]) +{ + igt_colorop_t *colorop = NULL; + int i; + + /* go through all color pipelines */ + for (i = 0; i < plane->num_color_pipelines; ++i) { + if (map_to_pipeline(display, plane->color_pipelines[i],colorops)) {
+ colorop = plane->color_pipelines[i];
+ break;
+ }
+ }tests/kms_colorop.c new file +9
-0+ + return colorop; +} + +static void set_colorop (igt_display_t *display, + kms_colorop_t *colorop) +{ + igt_assert(colorop->colorop); + igt_colorop_set_prop_value(colorop->colorop, IGT_COLOROP_BYPASS,0);
+
+ /* Set to desired value fromkms_colorop_t*/ + switch (colorop->type) {
+ caseKMS_COLOROP_ENUMERATED_LUT1D:
+ switch (colorop->enumerated_lut1d_info.tf) { + caseKMS_COLOROP_LUT1D_SRGB_EOTF:
+igt_colorop_set_prop_enum(colorop->colorop, IGT_COLOROP_CURVE_1D_TYPE, "sRGB EOTF");
+ break;
+ caseKMS_COLOROP_LUT1D_SRGB_INV_EOTF:
+igt_colorop_set_prop_enum(colorop->colorop, IGT_COLOROP_CURVE_1D_TYPE, "sRGB Inverse EOTF"); + break;
+ caseKMS_COLOROP_LUT1D_PQ_EOTF:
+ caseKMS_COLOROP_LUT1D_PQ_INV_EOTF:
+ default:
+igt_fail(IGT_EXIT_FAILURE);
+ }
+ break;
+ caseKMS_COLOROP_CUSTOM_LUT1D:
+ caseKMS_COLOROP_CTM:
+ caseKMS_COLOROP_LUT3D:
+ default:
+igt_fail(IGT_EXIT_FAILURE);
+ }tests/kms_colorop.c new file +57
-0+} + +static void set_color_pipeline (igt_display_t *display, + igt_plane_t *plane, + kms_colorop_t *colorops[], + igt_colorop_t *color_pipeline) +{ + igt_colorop_t *next; + int prop_val = 0; + int i; + + igt_plane_set_color_pipeline(plane, color_pipeline); + + for (i = 0; colorops[i]; i++) + set_colorop(display, colorops[i]); + + /* set unused ops in pipeline to bypass */ + next = color_pipeline; + i = 0; + while (next) { + if (!colorops[i] || colorops[i]->colorop != next) + igt_colorop_set_prop_value(next, IGT_COLOROP_BYPASS, 1); + else + i++; + + prop_val = igt_colorop_get_prop(display, next, + IGT_COLOROP_NEXT); + next = igt_find_colorop(display, prop_val); + } +} + +static void set_color_pipeline_bypass (igt_plane_t *plane) +{ + igt_plane_set_prop_enum(plane, IGT_PLANE_COLOR_PIPELINE, "Bypass"); +} + +static bool compare_with_bracket (igt_fb_t *in,igt_fb_t *out) +{ + if (is_vkms_device(in->fd)) + return igt_cmp_fb_pixels(in, out, 1, 1); + + /* + * By default we'll look for a [0, 0] bracket. We can then + * define it for each driver that implements support for this + * test. That way we can understand the precision of each + * driver better. + */ + return igt_cmp_fb_pixels(in, out, 0, 0); +} + +#define DUMP_FBS 1 + +#define MAX_COLOROPS 3 +#define NUM_COLOROP_TESTS 3 +#define MAX_NAME_SIZE 256 + +static void apply_transforms(kms_colorop_t *colorops[], igt_fb_t
*sw_transform_fb)tests/kms_colorop.c new file +47
-0+{ + int i; + igt_pixel_transform transforms[MAX_COLOROPS]; + + for (i = 0; colorops[i]; i++) + transforms[i] = colorops[i]->transform; + + igt_color_transform_pixels(sw_transform_fb, transforms, i); +} + +static void colorop_plane_test (igt_display_t *display, + kms_colorop_t *colorops[]) +{ + igt_colorop_t *color_pipeline = NULL; + igt_output_t *output; + igt_plane_t *plane; + igt_fb_t input_fb; + igt_fb_t sw_transform_fb; + igt_fb_t output_fb; + drmModeModeInfo mode; + unsigned int fb_id; + igt_crc_t input_crc, output_crc; + + output = kms_writeback_get_output(display); + igt_require(output); + + if (output->use_override_mode) + memcpy(&mode, &output->override_mode, sizeof(mode)); + else + memcpy(&mode, &output->config.default_mode, sizeof(mode)); + + /* create input fb */ + plane = igt_output_get_plane_type(output, DRM_PLANE_TYPE_PRIMARY); + igt_assert(plane); + + fb_id = igt_create_color_pattern_fb(display->drm_fd, + mode.hdisplay, mode.vdisplay, + DRM_FORMAT_XRGB8888, DRM_FORMAT_MOD_LINEAR, + 0.2, 0.2, 0.2, &input_fb); + igt_assert(fb_id >= 0); + igt_plane_set_fb(plane, &input_fb); +#if DUMP_FBS + igt_dump_fb(display, &input_fb, ".", "input"); +#endif + + /* create output fb */ + fb_id = igt_create_fb(display->drm_fd, mode.hdisplay,mode.vdisplay,
+DRM_FORMAT_XRGB8888,
+igt_fb_mod_to_tiling(0),
+&output_fb);
+igt_require(fb_id > 0);tests/kms_colorop.c new file +84
-0+ + igt_fb_get_fnv1a_crc(&input_fb, &input_crc); + + igt_require(igt_plane_has_prop(plane, IGT_PLANE_COLOR_PIPELINE)); + + /* reset color pipeline*/ + + set_color_pipeline_bypass(plane); + + /* Commit */ + igt_plane_set_fb(plane, &input_fb); + igt_output_set_writeback_fb(output, &output_fb); + + igt_display_commit_atomic(output->display, + DRM_MODE_ATOMIC_ALLOW_MODESET, + NULL); + get_and_wait_out_fence(output); + + /* Compare input and output buffers. They should be equal here. */ + igt_fb_get_fnv1a_crc(&output_fb, &output_crc); + + igt_assert_crc_equal(&input_crc, &output_crc); + + /* create sw transformed buffer */ + + igt_copy_fb(display->drm_fd, &input_fb, &sw_transform_fb); + igt_assert(igt_cmp_fb_pixels(&input_fb, &sw_transform_fb, 0, 0)); + + apply_transforms(colorops, &sw_transform_fb); +#if DUMP_FBS + igt_dump_fb(display, &sw_transform_fb, ".", "sw_transform"); +#endif + /* discover and set COLOR PIPELINE */ + + /* get COLOR_PIPELINE enum */ + color_pipeline = get_color_pipeline(display, plane, colorops); + + /* skip test if we can't find applicable pipeline */ + igt_skip_on(!color_pipeline); + + set_color_pipeline(display, plane, colorops, color_pipeline); + + igt_output_set_writeback_fb(output, &output_fb); + + /* commit COLOR_PIPELINE */ + igt_display_commit_atomic(display, + DRM_MODE_ATOMIC_ALLOW_MODESET, + NULL); + get_and_wait_out_fence(output); +#if DUMP_FBS + igt_dump_fb(display, &output_fb, ".", "output"); +#endif + + /* compare sw transformed and KMS transformed FBs */ + igt_assert(compare_with_bracket(&sw_transform_fb, &output_fb)); + + /* reset color pipeline*/ + set_color_pipeline_bypass(plane); + + /* Commit */ + igt_plane_set_fb(plane, &input_fb); + igt_output_set_writeback_fb(output, &output_fb); + + igt_display_commit_atomic(output->display, + DRM_MODE_ATOMIC_ALLOW_MODESET, + NULL); + get_and_wait_out_fence(output); + + /* cleanup */ + detach_crtc(display, output); + igt_remove_fb(display->drm_fd, &input_fb); + igt_remove_fb(display->drm_fd, &output_fb); +} + +igt_main +{ + + struct { + kms_colorop_t *colorops[MAX_COLOROPS]; + const char *name; + } tests[] = { + { { &kms_colorop_srgb_eotf, NULL }, "srgb_eotf" }, + { { &kms_colorop_srgb_inv_eotf, NULL }, "srgb_inv_eotf" }, + { { &kms_colorop_srgb_eotf, &kms_colorop_srgb_inv_eotf,NULL }, "srgb_eotf-srgb_inv_eotf" }
+ };tests/kms_colorop.c new file +8
-0+ + igt_display_t display; + int i, ret; + + igt_fixture { + display.drm_fd = drm_open_driver_master(DRIVER_ANY); + + if (drmSetClientCap(display.drm_fd, DRM_CLIENT_CAP_ATOMIC,1) == 0)
+ display.is_atomic = 1;
+
+ ret = drmSetClientCap(display.drm_fd,DRM_CLIENT_CAP_WRITEBACK_CONNECTORS, 1);
+
+ igt_require_f(!ret, "error setting
DRM_CLIENT_CAP_WRITEBACK_CONNECTORS\n");tests/kms_colorop.c new file +18
-0+ + igt_display_require(&display, display.drm_fd); + + kmstest_set_vt_graphics_mode(); + + igt_display_require(&display, display.drm_fd); + + igt_require(display.is_atomic); + + } + + for (i = 0; i < ARRAY_SIZE(tests); i++) { + igt_describe("Check color ops on a plane"); + igt_subtest_f("plane-%s", tests[i].name) + colorop_plane_test(&display, tests[i].colorops); + } + + igt_describe("Tests getting and setting COLOR_PIPELINE propertyon plane");
+igt_fixture{
+igt_display_fini(&display);
+ }tests/kms_colorop.c new file +1
-0+}tests/kms_colorop.h new file +5
-0@@ -0,0 +1,88 @@ +/* SPDX-License-Identifier: MIT */ +/* +* Copyright 2023 Advanced Micro Devices, Inc. +* +* Permission is hereby granted, free of charge, to any person Quoted 1 line
obtaining a
Same here, remove this text.
Regards,
KamilQuoted 109 lines
+ * 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.
+ */tests/kms_colorop.h new file +66
-0+ +#ifndef __KMS_COLOROP_H__ +#define __KMS_COLOROP_H__ + +#include "igt_color.h" + +typedef bool (*compare_fb_t )(igt_fb_t *in,igt_fb_t *out); + +typedef int (*transform_fb )(igt_fb_t *in); + +typedef int (*transform_pixel )(igt_pixel_t *pixel); + +/* Test version definitions */ +typedef enum kms_colorop_type { + KMS_COLOROP_ENUMERATED_LUT1D, + KMS_COLOROP_CUSTOM_LUT1D, + KMS_COLOROP_CTM, + KMS_COLOROP_LUT3D +}kms_colorop_type_t ; + +typedef enum kms_colorop_lut1d_tf { + KMS_COLOROP_LUT1D_SRGB_EOTF, + KMS_COLOROP_LUT1D_SRGB_INV_EOTF, + KMS_COLOROP_LUT1D_PQ_EOTF, + KMS_COLOROP_LUT1D_PQ_INV_EOTF, +}kms_colorop_lut1d_tf_t ; + +typedef struct kms_colorop_enumerated_lut1d_info { + kms_colorop_lut1d_tf_t tf; +}kms_colorop_enumerated_lut1d_info_t ; + +typedef struct kms_colorop { + kms_colorop_type_t type; + + union { + kms_colorop_enumerated_lut1d_info_t enumerated_lut1d_info; + }; + + const char *name; + + igt_pixel_transform transform; + + /* Mapped colorop */ + igt_colorop_t *colorop; + +}kms_colorop_t ; + +kms_colorop_t kms_colorop_srgb_eotf = { + .type = KMS_COLOROP_ENUMERATED_LUT1D, + .enumerated_lut1d_info = { + .tf = KMS_COLOROP_LUT1D_SRGB_EOTF + }, + .name = "srgb_eotf", + .transform = &igt_color_srgb_eotf +}; + +kms_colorop_t kms_colorop_srgb_inv_eotf = { + .type = KMS_COLOROP_ENUMERATED_LUT1D, + .enumerated_lut1d_info = { + .tf = KMS_COLOROP_LUT1D_SRGB_INV_EOTF + }, + .name = "srgb_inv_eotf", + .transform = &igt_color_srgb_inv_eotf +}; + +#endif /* __KMS_COLOROP_H__ */ tests/meson.build +1
-0@@ -26,6 +26,7 @@ test_progs = [ 'kms_bw', 'kms_color', 'kms_concurrent', + 'kms_colorop', 'kms_content_protection', 'kms_cursor_crc', 'kms_cursor_edge_walk',Signature · 1 line
2.43.0
Re: [PATCH V10 09/30] tests/kms_colorop: Add kms_colorop tests
Hi Alex
Quoted 11 lines · Alex Hung
Quoted 4 lines · On 9/19/25 01:19, Sharma, Swati2 wrote:
Hi Alex,
Is it possible to move colorop basic
func()likecan_use_colorop(),map_to_pipline(), etc. to lib?These two functions use
kms_colorop_twhich defined intests/kms_colorop.h, and it is not available inlib/If you can refactor them to lib, I am happy to review your patches.
I have added common func in lib as part of the series https://patchwork.freedesktop.org/patch/678255/?series=150455&rev=3
With these changes we can add colorop tests in kms_color too which is currently being used by Intel for colorop validation.
Quoted 2 lines
It would be nice if more colorop tests can be added to
kms_coloropthough.
Yes, sure. But since intel KMD is still working to enable writeback, we can't use kms_colorop for validation but as soon as WB is enabled from KMD, we will switch colorop validation to kms_colorop.
Quoted 729 lines
Quoted 728 lines · Kamil Konieczny
Quoted 725 lines
Hi Alex,
Quoted 44 lines · Alex Hung
From: Harry Wentland <[email protected]>
This tests the color pipeline API, exposed via the COLOR PIPELINE plane property and
drm_coloropobjects.We introduce tests for:
- sRGB EOTF
- sRGB Inverse EOTF
- sRGB EOTF + sRGB Inverse EOTFThe last one is the holy grail of LUT testing. It tests that after applying an EOTF, followed by its inverse EOTF we arrive back at the original value. We can use this to test for precision loss in the pipeline.
All tests are tested via writeback. All transforms are done in SW (in floating point) and at the end the SW transformed buffer is compared with the KMS writeback output buffer. The two should match within a bracket of acceptable deviations. Since these deviations might look different for different KMS drivers we'll do this check on a driver-specific basis.
Signed-off-by Alex Hung <[email protected]>Signed-off-by Harry Wentland <[email protected]>---
tests/kms_colorop.c| 508
++++++++++++++++++++++++++++++++++++++++++++
tests/kms_colorop.h| 88 ++++++++
tests/meson.build | 1 +3 files changed, 597 insertions(+)create mode 100644
tests/kms_colorop.c
create mode 100644tests/kms_colorop.htests/kms_colorop.c new file +5
-0@@ -0,0 +1,508 @@ +// SPDX-License-Identifier: MIT +/* +* Copyright 2023 Advanced Micro Devices, Inc. +* +* Permission is hereby granted, free of charge, to any person Quoted 1 line
obtaining a
Please remove this text as it is replaced by SPDX above.
Quoted 560 lines
+ * 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.
+ */tests/kms_colorop.c new file +10
-0+ +#include "igt.h" +#include "igt_color.h" +#include "sw_sync.h" +#include "kms_colorop.h" + +/** +* TEST: kms colorop +* Category: Display +* Description: Test to validate the retrieving and setting of DRM colorops
+ *
+ * SUBTEST: plane-%s
+ * Description: Tests DRM colorop properties on a plane
+ * Driver requirement: amdgpu
+ * Functionality:kms_core
+ * Mega feature: General Display Features
+ * Test category: functionality test
+ *
+ * arg[1]:
+ *
+ * @srgb_eotf: sRGB EOTF
+ * @srgb_inv_eotf: sRGB Inverse EOTF
+ * @srgb_eotf-srgb_inv_eotf: sRGB EOTF -> sRGB Inverse EOTF
+ *
+ */tests/kms_colorop.c new file +2
-0+ +/* TODO move to lib for kms_writeback and kms_colorop (and other future) use */
+static bool check_writeback_config(igt_display_t *display,igt_output_t*output,
+ drmModeModeInfooverride_mode)tests/kms_colorop.c new file +21
-0+{ + igt_fb_t input_fb, output_fb; + igt_plane_t *plane; + uint32_t writeback_format = DRM_FORMAT_XRGB8888; + uint64_t modifier = DRM_FORMAT_MOD_LINEAR; + int width, height, ret; + + igt_output_override_mode(output, &override_mode); + + width = override_mode.hdisplay; + height = override_mode.vdisplay; + + ret = igt_create_fb(display->drm_fd, width, height, + DRM_FORMAT_XRGB8888, modifier, &input_fb); + igt_assert(ret >= 0); + + ret = igt_create_fb(display->drm_fd, width, height, + writeback_format, modifier, &output_fb); + igt_assert(ret >= 0); + + plane = igt_output_get_plane_type(output,
DRM_PLANE_TYPE_PRIMARY);
+igt_plane_set_fb(plane, &input_fb);
+igt_output_set_writeback_fb(output, &output_fb); +
+ ret = igt_display_try_commit_atomic(display,DRM_MODE_ATOMIC_TEST_ONLY|
+DRM_MODE_ATOMIC_ALLOW_MODESET, NULL); +igt_plane_set_fb(plane, NULL);
+igt_remove_fb(display->drm_fd, &input_fb);
+igt_remove_fb(display->drm_fd, &output_fb);tests/kms_colorop.c new file +5
-0+ + return !ret; +} + +/* TODO move to lib for kms_writeback and kms_colorop (and other future) use */
tests/kms_colorop.c new file +12
-0+typedef struct { + bool builtin_mode; + bool custom_mode; + bool list_modes; + bool dump_check; + int mode_index; + drmModeModeInfo user_mode; +}data_t ; + +static data_t data; + +/* TODO move to lib for kms_writeback and kms_colorop (and other future) use */
tests/kms_colorop.c new file +26
-0+static igt_output_t *kms_writeback_get_output (igt_display_t *display) +{ + int i; + enum pipe pipe; + + drmModeModeInfo override_mode = { + .clock = 25175, + .hdisplay = 640, + .hsync_start = 656, + .hsync_end = 752, + .htotal = 800, + .hskew = 0, + .vdisplay = 480, + .vsync_start = 490, + .vsync_end = 492, + .vtotal = 525, + .vscan = 0, + .vrefresh = 60, + .flags = DRM_MODE_FLAG_NHSYNC | DRM_MODE_FLAG_NVSYNC, + .name = {"640x480-60"}, + }; + + for (i = 0; i < display->n_outputs; i++) { + igt_output_t *output = &display->outputs[i]; + + if (output->config.connector->connector_type !=
DRM_MODE_CONNECTOR_WRITEBACK)
+ continue;tests/kms_colorop.c new file +8
-0+ + for_each_pipe(display, pipe) { + igt_output_set_pipe(output, pipe); + + if (data.custom_mode) + override_mode = data.user_mode; + if (data.builtin_mode) + override_mode = output->config.connector-Quoted 1 line
modes[data.mode_index];
+
+ if (check_writeback_config(display, output, override_mode)) {
+ igt_debug("Using connector %u:%s on pipe %d\n",
+output->config.connector->connector_id,
+output->name, pipe);
+ return output;
+ }
+ }
+
+ igt_debug("We found %u:%s, but this test will not be able to use it.\n",
+output->config.connector->connector_id,output->name); +
+ /* Restore any connectors we don't use, so we don't trip on them later */
+ kmstest_force_connector(display->drm_fd, output-Quoted 1 line
config.connector,
FORCE_CONNECTOR_UNSPECIFIED);+ }
tests/kms_colorop.c new file +5
-0+ + return NULL; +} + +/* TODO move to lib for kms_writeback and kms_colorop (and other future) use */
tests/kms_colorop.c new file +3
-0+static uint64_t get_writeback_fb_id (igt_output_t *output) +{ + return igt_output_get_prop(output,
IGT_CONNECTOR_WRITEBACK_FB_ID);tests/kms_colorop.c new file +3
-0+} + +/* TODO move to lib for kms_writeback and kms_colorop (and other future) use */
tests/kms_colorop.c new file +17
-0+static void detach_crtc (igt_display_t *display,igt_output_t *output) +{ + if (get_writeback_fb_id(output) == 0) + return; + + igt_output_set_pipe(output, PIPE_NONE); + igt_display_commit2(display, COMMIT_ATOMIC); +} + +static void get_and_wait_out_fence (igt_output_t *output) +{ + int ret; + + igt_assert(output->writeback_out_fence_fd >= 0); + + ret = sync_fence_wait(output->writeback_out_fence_fd, 1000); + igt_assert_f(ret == 0, "sync_fence_wait failed: %s\n",strerror(-ret));
+close(output->writeback_out_fence_fd);
+output->writeback_out_fence_fd= -1;tests/kms_colorop.c new file +3
-0+} + +static bool can_use_colorop(igt_display_t *display, igt_colorop_t*colorop,
kms_colorop_t*desired)
+{
+ switch (desired->type) {
+ caseKMS_COLOROP_ENUMERATED_LUT1D:
+ if (igt_colorop_get_prop(display, colorop, IGT_COLOROP_TYPE)==DRM_COLOROP_1D_CURVE) + return true;
+ caseKMS_COLOROP_CUSTOM_LUT1D:
+ caseKMS_COLOROP_CTM:
+ caseKMS_COLOROP_LUT3D:
+ default:
+ return false;
+ }tests/kms_colorop.c new file +35
-0+} + +/** +* Iterate color pipeline that begins with colorop and try to map +* colorops[] to it. +*/ +static bool map_to_pipeline (igt_display_t *display, + igt_colorop_t *colorop, + kms_colorop_t *colorops[]) +{ + igt_colorop_t *next = colorop; + kms_colorop_t *current_op; + int i = 0; + int prop_val = 0; + + current_op = colorops[i++]; + igt_require(current_op); + + while (next) { + if (can_use_colorop(display, next, current_op)) { + current_op->colorop = next; + current_op = colorops[i++]; + if (!current_op) + break; + } + prop_val = igt_colorop_get_prop(display, next, + IGT_COLOROP_NEXT); + next = igt_find_colorop(display, prop_val); + } + + if (current_op) { + /* we failed to map the pipeline */ + + /* clean up colorops[i].colorop mappings */ + for (i = 0, current_op = colorops[0]; current_op;
current_op= colorops[i++])
+current_op->colorop= NULL;tests/kms_colorop.c new file +17
-0+ + return false; + } + + return true; +} + +static igt_colorop_t *get_color_pipeline (igt_display_t *display, + igt_plane_t *plane, + kms_colorop_t *colorops[]) +{ + igt_colorop_t *colorop = NULL; + int i; + + /* go through all color pipelines */ + for (i = 0; i < plane->num_color_pipelines; ++i) { + if (map_to_pipeline(display, plane->color_pipelines[i],colorops)) {
+ colorop = plane->color_pipelines[i];
+ break;
+ }
+ }tests/kms_colorop.c new file +9
-0+ + return colorop; +} + +static void set_colorop (igt_display_t *display, + kms_colorop_t *colorop) +{ + igt_assert(colorop->colorop); + igt_colorop_set_prop_value(colorop->colorop,
IGT_COLOROP_BYPASS, 0);
+
+ /* Set to desired value fromkms_colorop_t*/ + switch (colorop->type) {
+ caseKMS_COLOROP_ENUMERATED_LUT1D:
+ switch (colorop->enumerated_lut1d_info.tf) { + caseKMS_COLOROP_LUT1D_SRGB_EOTF:
+igt_colorop_set_prop_enum(colorop->colorop, IGT_COLOROP_CURVE_1D_TYPE, "sRGB EOTF");
+ break;
+ caseKMS_COLOROP_LUT1D_SRGB_INV_EOTF:
+igt_colorop_set_prop_enum(colorop->colorop, IGT_COLOROP_CURVE_1D_TYPE, "sRGB Inverse EOTF"); + break;
+ caseKMS_COLOROP_LUT1D_PQ_EOTF:
+ caseKMS_COLOROP_LUT1D_PQ_INV_EOTF:
+ default:
+igt_fail(IGT_EXIT_FAILURE);
+ }
+ break;
+ caseKMS_COLOROP_CUSTOM_LUT1D:
+ caseKMS_COLOROP_CTM:
+ caseKMS_COLOROP_LUT3D:
+ default:
+igt_fail(IGT_EXIT_FAILURE);
+ }tests/kms_colorop.c new file +34
-0+} + +static void set_color_pipeline (igt_display_t *display, + igt_plane_t *plane, + kms_colorop_t *colorops[], + igt_colorop_t *color_pipeline) +{ + igt_colorop_t *next; + int prop_val = 0; + int i; + + igt_plane_set_color_pipeline(plane, color_pipeline); + + for (i = 0; colorops[i]; i++) + set_colorop(display, colorops[i]); + + /* set unused ops in pipeline to bypass */ + next = color_pipeline; + i = 0; + while (next) { + if (!colorops[i] || colorops[i]->colorop != next) + igt_colorop_set_prop_value(next, IGT_COLOROP_BYPASS, 1); + else + i++; + + prop_val = igt_colorop_get_prop(display, next, + IGT_COLOROP_NEXT); + next = igt_find_colorop(display, prop_val); + } +} + +static void set_color_pipeline_bypass (igt_plane_t *plane) +{ + igt_plane_set_prop_enum(plane, IGT_PLANE_COLOR_PIPELINE,"Bypass");
tests/kms_colorop.c new file +23
-0+} + +static bool compare_with_bracket (igt_fb_t *in,igt_fb_t *out) +{ + if (is_vkms_device(in->fd)) + return igt_cmp_fb_pixels(in, out, 1, 1); + + /* + * By default we'll look for a [0, 0] bracket. We can then + * define it for each driver that implements support for this + * test. That way we can understand the precision of each + * driver better. + */ + return igt_cmp_fb_pixels(in, out, 0, 0); +} + +#define DUMP_FBS 1 + +#define MAX_COLOROPS 3 +#define NUM_COLOROP_TESTS 3 +#define MAX_NAME_SIZE 256 + +static void apply_transforms(kms_colorop_t *colorops[], igt_fb_t
*sw_transform_fb)tests/kms_colorop.c new file +33
-0+{ + int i; + igt_pixel_transform transforms[MAX_COLOROPS]; + + for (i = 0; colorops[i]; i++) + transforms[i] = colorops[i]->transform; + + igt_color_transform_pixels(sw_transform_fb, transforms, i); +} + +static void colorop_plane_test (igt_display_t *display, + kms_colorop_t *colorops[]) +{ + igt_colorop_t *color_pipeline = NULL; + igt_output_t *output; + igt_plane_t *plane; + igt_fb_t input_fb; + igt_fb_t sw_transform_fb; + igt_fb_t output_fb; + drmModeModeInfo mode; + unsigned int fb_id; + igt_crc_t input_crc, output_crc; + + output = kms_writeback_get_output(display); + igt_require(output); + + if (output->use_override_mode) + memcpy(&mode, &output->override_mode, sizeof(mode)); + else + memcpy(&mode, &output->config.default_mode, sizeof(mode)); + + /* create input fb */ + plane = igt_output_get_plane_type(output,
DRM_PLANE_TYPE_PRIMARY);
+igt_assert(plane);tests/kms_colorop.c new file +13
-0+ + fb_id = igt_create_color_pattern_fb(display->drm_fd, + mode.hdisplay, mode.vdisplay, + DRM_FORMAT_XRGB8888, DRM_FORMAT_MOD_LINEAR, + 0.2, 0.2, 0.2, &input_fb); + igt_assert(fb_id >= 0); + igt_plane_set_fb(plane, &input_fb); +#if DUMP_FBS + igt_dump_fb(display, &input_fb, ".", "input"); +#endif + + /* create output fb */ + fb_id = igt_create_fb(display->drm_fd, mode.hdisplay,mode.vdisplay,
+DRM_FORMAT_XRGB8888,
+igt_fb_mod_to_tiling(0),
+&output_fb);
+igt_require(fb_id > 0);tests/kms_colorop.c new file +19
-0+ + igt_fb_get_fnv1a_crc(&input_fb, &input_crc); + + igt_require(igt_plane_has_prop(plane, IGT_PLANE_COLOR_PIPELINE)); + + /* reset color pipeline*/ + + set_color_pipeline_bypass(plane); + + /* Commit */ + igt_plane_set_fb(plane, &input_fb); + igt_output_set_writeback_fb(output, &output_fb); + + igt_display_commit_atomic(output->display, + DRM_MODE_ATOMIC_ALLOW_MODESET, + NULL); + get_and_wait_out_fence(output); + + /* Compare input and output buffers. They should be equalhere. */
+igt_fb_get_fnv1a_crc(&output_fb, &output_crc);tests/kms_colorop.c new file +64
-0+ + igt_assert_crc_equal(&input_crc, &output_crc); + + /* create sw transformed buffer */ + + igt_copy_fb(display->drm_fd, &input_fb, &sw_transform_fb); + igt_assert(igt_cmp_fb_pixels(&input_fb, &sw_transform_fb, 0, 0)); + + apply_transforms(colorops, &sw_transform_fb); +#if DUMP_FBS + igt_dump_fb(display, &sw_transform_fb, ".", "sw_transform"); +#endif + /* discover and set COLOR PIPELINE */ + + /* get COLOR_PIPELINE enum */ + color_pipeline = get_color_pipeline(display, plane, colorops); + + /* skip test if we can't find applicable pipeline */ + igt_skip_on(!color_pipeline); + + set_color_pipeline(display, plane, colorops, color_pipeline); + + igt_output_set_writeback_fb(output, &output_fb); + + /* commit COLOR_PIPELINE */ + igt_display_commit_atomic(display, + DRM_MODE_ATOMIC_ALLOW_MODESET, + NULL); + get_and_wait_out_fence(output); +#if DUMP_FBS + igt_dump_fb(display, &output_fb, ".", "output"); +#endif + + /* compare sw transformed and KMS transformed FBs */ + igt_assert(compare_with_bracket(&sw_transform_fb, &output_fb)); + + /* reset color pipeline*/ + set_color_pipeline_bypass(plane); + + /* Commit */ + igt_plane_set_fb(plane, &input_fb); + igt_output_set_writeback_fb(output, &output_fb); + + igt_display_commit_atomic(output->display, + DRM_MODE_ATOMIC_ALLOW_MODESET, + NULL); + get_and_wait_out_fence(output); + + /* cleanup */ + detach_crtc(display, output); + igt_remove_fb(display->drm_fd, &input_fb); + igt_remove_fb(display->drm_fd, &output_fb); +} + +igt_main +{ + + struct { + kms_colorop_t *colorops[MAX_COLOROPS]; + const char *name; + } tests[] = { + { { &kms_colorop_srgb_eotf, NULL }, "srgb_eotf" }, + { { &kms_colorop_srgb_inv_eotf, NULL }, "srgb_inv_eotf" }, + { { &kms_colorop_srgb_eotf, &kms_colorop_srgb_inv_eotf,NULL }, "srgb_eotf-srgb_inv_eotf" }
+ };tests/kms_colorop.c new file +8
-0+ + igt_display_t display; + int i, ret; + + igt_fixture { + display.drm_fd = drm_open_driver_master(DRIVER_ANY); + + if (drmSetClientCap(display.drm_fd, DRM_CLIENT_CAP_ATOMIC,1) == 0)
+ display.is_atomic = 1;
+
+ ret = drmSetClientCap(display.drm_fd,DRM_CLIENT_CAP_WRITEBACK_CONNECTORS, 1);
+
+ igt_require_f(!ret, "error setting
DRM_CLIENT_CAP_WRITEBACK_CONNECTORS\n");tests/kms_colorop.c new file +18
-0+ + igt_display_require(&display, display.drm_fd); + + kmstest_set_vt_graphics_mode(); + + igt_display_require(&display, display.drm_fd); + + igt_require(display.is_atomic); + + } + + for (i = 0; i < ARRAY_SIZE(tests); i++) { + igt_describe("Check color ops on a plane"); + igt_subtest_f("plane-%s", tests[i].name) + colorop_plane_test(&display, tests[i].colorops); + } + + igt_describe("Tests getting and setting COLOR_PIPELINEproperty on plane");
+igt_fixture{
+igt_display_fini(&display);
+ }tests/kms_colorop.c new file +1
-0+}tests/kms_colorop.h new file +5
-0@@ -0,0 +1,88 @@ +/* SPDX-License-Identifier: MIT */ +/* +* Copyright 2023 Advanced Micro Devices, Inc. +* +* Permission is hereby granted, free of charge, to any person Quoted 1 line
obtaining a
Same here, remove this text.
Regards,
KamilQuoted 110 lines
+ * 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.
+ */tests/kms_colorop.h new file +66
-0+ +#ifndef __KMS_COLOROP_H__ +#define __KMS_COLOROP_H__ + +#include "igt_color.h" + +typedef bool (*compare_fb_t )(igt_fb_t *in,igt_fb_t *out); + +typedef int (*transform_fb )(igt_fb_t *in); + +typedef int (*transform_pixel )(igt_pixel_t *pixel); + +/* Test version definitions */ +typedef enum kms_colorop_type { + KMS_COLOROP_ENUMERATED_LUT1D, + KMS_COLOROP_CUSTOM_LUT1D, + KMS_COLOROP_CTM, + KMS_COLOROP_LUT3D +}kms_colorop_type_t ; + +typedef enum kms_colorop_lut1d_tf { + KMS_COLOROP_LUT1D_SRGB_EOTF, + KMS_COLOROP_LUT1D_SRGB_INV_EOTF, + KMS_COLOROP_LUT1D_PQ_EOTF, + KMS_COLOROP_LUT1D_PQ_INV_EOTF, +}kms_colorop_lut1d_tf_t ; + +typedef struct kms_colorop_enumerated_lut1d_info { + kms_colorop_lut1d_tf_t tf; +}kms_colorop_enumerated_lut1d_info_t ; + +typedef struct kms_colorop { + kms_colorop_type_t type; + + union { + kms_colorop_enumerated_lut1d_info_t enumerated_lut1d_info; + }; + + const char *name; + + igt_pixel_transform transform; + + /* Mapped colorop */ + igt_colorop_t *colorop; + +}kms_colorop_t ; + +kms_colorop_t kms_colorop_srgb_eotf = { + .type = KMS_COLOROP_ENUMERATED_LUT1D, + .enumerated_lut1d_info = { + .tf = KMS_COLOROP_LUT1D_SRGB_EOTF + }, + .name = "srgb_eotf", + .transform = &igt_color_srgb_eotf +}; + +kms_colorop_t kms_colorop_srgb_inv_eotf = { + .type = KMS_COLOROP_ENUMERATED_LUT1D, + .enumerated_lut1d_info = { + .tf = KMS_COLOROP_LUT1D_SRGB_INV_EOTF + }, + .name = "srgb_inv_eotf", + .transform = &igt_color_srgb_inv_eotf +}; + +#endif /* __KMS_COLOROP_H__ */ tests/meson.build +1
-0@@ -26,6 +26,7 @@ test_progs = [ 'kms_bw', 'kms_color', 'kms_concurrent', + 'kms_colorop', 'kms_content_protection', 'kms_cursor_crc', 'kms_cursor_edge_walk',Signature · 1 line
2.43.0
Re: [PATCH V10 09/30] tests/kms_colorop: Add kms_colorop tests
In reply to Alex HungQuoted 38 lines · Alex Hung
From: Harry Wentland <[email protected]>
This tests the color pipeline API, exposed via the COLOR PIPELINE plane property and
drm_coloropobjects.We introduce tests for:
- sRGB EOTF
- sRGB Inverse EOTF
- sRGB EOTF + sRGB Inverse EOTFThe last one is the holy grail of LUT testing. It tests that after applying an EOTF, followed by its inverse EOTF we arrive back at the original value. We can use this to test for precision loss in the pipeline.
All tests are tested via writeback. All transforms are done in SW (in floating point) and at the end the SW transformed buffer is compared with the KMS writeback output buffer. The two should match within a bracket of acceptable deviations. Since these deviations might look different for different KMS drivers we'll do this check on a driver-specific basis.
Signed-off-by Alex Hung <[email protected]>Signed-off-by Harry Wentland <[email protected]>---
tests/kms_colorop.c | 508
++++++++++++++++++++++++++++++++++++++++++++
tests/kms_colorop.h | 88 ++++++++
tests/meson.build | 1 +3 files changed, 597 insertions(+)create mode 100644
tests/kms_colorop.c
create mode 100644tests/kms_colorop.htests/kms_colorop.c new file +0
-0
[..]
Quoted 12 lines
+/* TODO move to lib for
kms_writebackandkms_colorop(and other future) use */tests/kms_colorop.c new file +3
-0+static uint64_t get_writeback_fb_id (igt_output_t *output) +{ + return igt_output_get_prop(output,
IGT_CONNECTOR_WRITEBACK_FB_ID);tests/kms_colorop.c new file +3
-0+} + +/* TODO move to lib for kms_writeback and kms_colorop (and other future) use */
+static voiddetach_crtc(igt_display_t *display, igt_output_t *output)
tests/kms_colorop.c line 162
Quoted 3 lines
tests/kms_colorop.c new file +3
-0+{ +if (get_writeback_fb_id (output) ==0 ) +return ;
Hi,
When running these tests on VKMS, I get fails for igt@kms_properties@colorop-properties-atomic@pipe-a-virtual-1 and igt@kms_properties@colorop-properties-legacy@pipe-a-virtual-1, with the splat:
``` (kms_properties:1152) igt_kms-CRITICAL: Test assertion failure function do_display_commit, file ../lib/igt_kms.c:4971: (kms_properties:1152) igt_kms-CRITICAL: Failed assertion: ret == 0 (kms_properties:1152) igt_kms-CRITICAL: Last errno: 22, Invalid argument (kms_properties:1152) igt_kms-CRITICAL: error: -22 != 0 (kms_properties:1152) igt_core-INFO: Stack trace: (kms_properties:1152) igt_core-INFO: #0 ../lib/igt_core.c:2075 __igt_fail_assert() (kms_properties:1152) igt_core-INFO: #1 ../lib/igt_kms.c:4971 do_display_commit() (kms_properties:1152) igt_core-INFO: #2 ../lib/igt_kms.c:5077 igt_display_commit2() (kms_properties:1152) igt_core-INFO: #3 ../tests/kms_properties.c:101 cleanup_pipe() (kms_properties:1152) igt_core-INFO: #4 ../tests/kms_properties.c:333 colorop_properties() (kms_properties:1152) igt_core-INFO: #5 ../tests/kms_properties.c:937 __igt_unique____real_main899() (kms_properties:1152) igt_core-INFO: #6 ../tests/kms_properties.c:899 main() (kms_properties:1152) igt_core-INFO: #7 [<unknown>+0xa165aca8] (kms_properties:1152) igt_core-INFO: #8 [__libc_start_main+0x85] (kms_properties:1152) igt_core-INFO: #9 [_start+0x21] ```
I noticed the failure didn't occur when running just these two tests, but it did if I ran the kms_colorop tests beforehand. Enabling DRM debug logs revealed:
``` [ 29.973065] faux_driver vkms: [drm:drm_atomic_helper_check_modeset] [CRTC:85:crtc-0] enabled/connectors mismatch (0/1) [ 29.973743] faux_driver vkms: [drm:drm_atomic_check_only] atomic driver check for 0000000001367eac failed: -22 ```
Meaning the connector_mask on the CRTC was being left set for the writeback connector from the colorop tests, resulting in that failure during cleanup of the kms_properties tests.
I've tracked it down to the early return based on the return of get_writeback_fb_id() above. The kernel documentation mentions the "WRITEBACK_FB_ID" property is "Write-only", and "will always read as zero", so it seems the check above equates to a
output->config.connector->connector_type ==DRM_MODE_CONNECTOR_WRITEBACK
ie. it will be true whenever the connector is a writeback, which is always the case for the colorop tests, meaning igt_output_set_pipe(... PIPE_NONE) will not be run after any of the colorop tests, so the connector_mask will never be unset, resulting in the failures later.
By removing this early return the tests pass on VKMS, so that's my suggestion.
Quoted 4 lines
tests/kms_colorop.c new file +4
-0+ +igt_output_set_pipe (output,PIPE_NONE ); +igt_display_commit2 (display,COMMIT_ATOMIC ); +}
[..]
Signature · 3 lines
Thanks, Nícolas
Re: [PATCH V10 09/30] tests/kms_colorop: Add kms_colorop tests
In reply to Alex HungQuoted 34 lines · Alex Hung
From: Harry Wentland <[email protected]>
This tests the color pipeline API, exposed via the COLOR PIPELINE plane property and
drm_coloropobjects.We introduce tests for:
- sRGB EOTF
- sRGB Inverse EOTF
- sRGB EOTF + sRGB Inverse EOTFThe last one is the holy grail of LUT testing. It tests that after applying an EOTF, followed by its inverse EOTF we arrive back at the original value. We can use this to test for precision loss in the pipeline.
All tests are tested via writeback. All transforms are done in SW (in floating point) and at the end the SW transformed buffer is compared with the KMS writeback output buffer. The two should match within a bracket of acceptable deviations. Since these deviations might look different for different KMS drivers we'll do this check on a driver-specific basis.
Signed-off-by Alex Hung <[email protected]>Signed-off-by Harry Wentland <[email protected]>---
tests/kms_colorop.c | 508
++++++++++++++++++++++++++++++++++++++++++++
tests/kms_colorop.h | 88 ++++++++
tests/meson.build | 1 +3 files changed, 597 insertions(+)create mode 100644
tests/kms_colorop.c
create mode 100644tests/kms_colorop.h
[..]
Quoted 48 lines
tests/kms_colorop.c new file +9
-0+igt_main +{ + +struct { +kms_colorop_t *colorops[MAX_COLOROPS ]; +const char *name; + } tests[] = { + { { &kms_colorop_srgb_eotf,NULL },"srgb_eotf" }, + { { &kms_colorop_srgb_inv_eotf,NULL },"
srgb_inv_eotf" },(quoted diff) +1
-0+ { { &kms_colorop_srgb_eotf,
&kms_colorop_srgb_inv_eotf, NULL }, "srgb_eotf-srgb_inv_eotf" }tests/kms_colorop.c new file +9
-0+ }; + +igt_display_t display; +int i, ret; + + igt_fixture { + display.drm_fd =drm_open_driver_master (DRIVER_ANY ); + + if (drmSetClientCap(display.drm_fd,
DRM_CLIENT_CAP_ATOMIC, 1) == 0)tests/kms_colorop.c new file +3
-0+ display.is_atomic =1 ; + + ret = drmSetClientCap(display.drm_fd,
DRM_CLIENT_CAP_WRITEBACK_CONNECTORS, 1);(quoted diff) +2
-0+ + igt_require_f(!ret, "error settingDRM_CLIENT_CAP_WRITEBACK_CONNECTORS\n");
tests/kms_colorop.c new file +15
-0+ +igt_display_require (&display, display.drm_fd); + +kmstest_set_vt_graphics_mode (); + +igt_display_require (&display, display.drm_fd); + +igt_require (display.is_atomic); + + } + +for (i =0 ; i <ARRAY_SIZE (tests); i++) { +igt_describe ("Check color ops on a plane" ); + igt_subtest_f("plane-%s", tests[i].name) + colorop_plane_test(&display,tests[i].colorops);
tests/kms_colorop.c new file +3
-0+ } + + igt_describe("Tests getting and setting COLOR_PIPELINE
Quoted 1 line
property on plane");
igt_describe() should precede an igt_subtest/igt_subtest_group not a fixture. In this case looks like this is a description for the entire binary though, so IGT_TEST_DESCRIPTION() should be used instead.
Quoted 4 lines
tests/kms_colorop.c new file +4
-0+ igt_fixture { +igt_display_fini (&display); + } +}
Signature · 3 lines
Thanks, Nícolas
Re: [PATCH V10 09/30] tests/kms_colorop: Add kms_colorop tests
Quoted 81 lines · Nícolas F. R. A. Prado
Quoted 34 lines · Alex Hung
From: Harry Wentland <[email protected]>
This tests the color pipeline API, exposed via the COLOR PIPELINE plane property and
drm_coloropobjects.We introduce tests for:
- sRGB EOTF
- sRGB Inverse EOTF
- sRGB EOTF + sRGB Inverse EOTFThe last one is the holy grail of LUT testing. It tests that after applying an EOTF, followed by its inverse EOTF we arrive back at the original value. We can use this to test for precision loss in the pipeline.
All tests are tested via writeback. All transforms are done in SW (in floating point) and at the end the SW transformed buffer is compared with the KMS writeback output buffer. The two should match within a bracket of acceptable deviations. Since these deviations might look different for different KMS drivers we'll do this check on a driver-specific basis.
Signed-off-by Alex Hung <[email protected]>Signed-off-by Harry Wentland <[email protected]>--- tests/kms_colorop.c | 508 ++++++++++++++++++++++++++++++++++++++++++++ tests/kms_colorop.h | 88 ++++++++ tests/meson.build | 1 + 3 files changed, 597 insertions(+)create mode 100644
tests/kms_colorop.c
create mode 100644tests/kms_colorop.h[..]
Quoted 45 lines
tests/kms_colorop.c new file +9
-0+igt_main +{ + +struct { +kms_colorop_t *colorops[MAX_COLOROPS ]; +const char *name; + } tests[] = { + { { &kms_colorop_srgb_eotf,NULL },"srgb_eotf" }, + { { &kms_colorop_srgb_inv_eotf,NULL },"
srgb_inv_eotf" },(quoted diff) +1
-0+ { { &kms_colorop_srgb_eotf,
&kms_colorop_srgb_inv_eotf, NULL }, "srgb_eotf-srgb_inv_eotf" }tests/kms_colorop.c new file +9
-0+ }; + +igt_display_t display; +int i, ret; + + igt_fixture { + display.drm_fd =drm_open_driver_master (DRIVER_ANY ); + + if (drmSetClientCap(display.drm_fd,
DRM_CLIENT_CAP_ATOMIC, 1) == 0)tests/kms_colorop.c new file +3
-0+ display.is_atomic =1 ; + + ret = drmSetClientCap(display.drm_fd,
DRM_CLIENT_CAP_WRITEBACK_CONNECTORS, 1);(quoted diff) +2
-0+ + igt_require_f(!ret, "error settingDRM_CLIENT_CAP_WRITEBACK_CONNECTORS\n");
tests/kms_colorop.c new file +15
-0+ +igt_display_require (&display, display.drm_fd); + +kmstest_set_vt_graphics_mode (); + +igt_display_require (&display, display.drm_fd); + +igt_require (display.is_atomic); + + } + +for (i =0 ; i <ARRAY_SIZE (tests); i++) { +igt_describe ("Check color ops on a plane" ); + igt_subtest_f("plane-%s", tests[i].name) + colorop_plane_test(&display,tests[i].colorops);
Quoted 9 lines
Quoted 4 lines
tests/kms_colorop.c new file +3
-0+ } + + igt_describe("Tests getting and setting COLOR_PIPELINEproperty on plane");
igt_describe()should precede an igt_subtest/igt_subtest_group not a fixture. In this case looks like this is a description for the entire binary though, soIGT_TEST_DESCRIPTION()should be used instead.
Thanks. The igt_describe is not needed and will be removed.
Quoted 5 lines
Quoted 4 lines
tests/kms_colorop.c new file +4
-0+ igt_fixture { +igt_display_fini (&display); + } +}
Re: [PATCH V10 09/30] tests/kms_colorop: Add kms_colorop tests
In reply to Alex HungLe 15/08/2025 à 06:06, Alex Hung a écrit :
Quoted 125 lines
From: Harry Wentland <[email protected]>
This tests the color pipeline API, exposed via the COLOR PIPELINE plane property and
drm_coloropobjects.We introduce tests for:
- sRGB EOTF
- sRGB Inverse EOTF
- sRGB EOTF + sRGB Inverse EOTFThe last one is the holy grail of LUT testing. It tests that after applying an EOTF, followed by its inverse EOTF we arrive back at the original value. We can use this to test for precision loss in the pipeline.
All tests are tested via writeback. All transforms are done in SW (in floating point) and at the end the SW transformed buffer is compared with the KMS writeback output buffer. The two should match within a bracket of acceptable deviations. Since these deviations might look different for different KMS drivers we'll do this check on a driver-specific basis.
Signed-off-by Alex Hung <[email protected]>Signed-off-by Harry Wentland <[email protected]>--- tests/kms_colorop.c | 508 ++++++++++++++++++++++++++++++++++++++++++++ tests/kms_colorop.h | 88 ++++++++ tests/meson.build | 1 + 3 files changed, 597 insertions(+)create mode 100644
tests/kms_colorop.c
create mode 100644tests/kms_colorop.htests/kms_colorop.c new file +87
-0@@ -0,0 +1,508 @@ +// SPDX-License-Identifier: MIT +/* +* Copyright 2023 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 "igt_color.h" +#include "sw_sync.h" +#include "kms_colorop.h" + +/** +* TEST: kms colorop +* Category: Display +* Description: Test to validate the retrieving and setting of DRM colorops +* +* SUBTEST: plane-%s +* Description: Tests DRM colorop properties on a plane +* Driver requirement: amdgpu +* Functionality: kms_core +* Mega feature: General Display Features +* Test category: functionality test +* +* arg[1]: +* +* @srgb_eotf: sRGB EOTF +* @srgb_inv_eotf: sRGB Inverse EOTF +* @srgb_eotf-srgb_inv_eotf: sRGB EOTF -> sRGB Inverse EOTF +* +*/ + +/* TODO move to lib for kms_writeback and kms_colorop (and other future) use */ +static bool check_writeback_config (igt_display_t *display,igt_output_t *output, +drmModeModeInfo override_mode) +{ +igt_fb_t input_fb, output_fb; +igt_plane_t *plane; +uint32_t writeback_format =DRM_FORMAT_XRGB8888 ; +uint64_t modifier =DRM_FORMAT_MOD_LINEAR ; +int width, height, ret; + +igt_output_override_mode (output, &override_mode); + + width = override_mode.hdisplay; + height = override_mode.vdisplay; + + ret =igt_create_fb (display->drm_fd, width, height, +DRM_FORMAT_XRGB8888 , modifier, &input_fb); +igt_assert (ret >=0 ); + + ret =igt_create_fb (display->drm_fd, width, height, + writeback_format, modifier, &output_fb); +igt_assert (ret >=0 ); + + plane =igt_output_get_plane_type (output,DRM_PLANE_TYPE_PRIMARY ); +igt_plane_set_fb (plane, &input_fb); +igt_output_set_writeback_fb (output, &output_fb); + + ret =igt_display_try_commit_atomic (display,DRM_MODE_ATOMIC_TEST_ONLY | +DRM_MODE_ATOMIC_ALLOW_MODESET ,NULL ); +igt_plane_set_fb (plane,NULL ); +igt_remove_fb (display->drm_fd, &input_fb); +igt_remove_fb (display->drm_fd, &output_fb); + +return !ret; +} + +/* TODO move to lib for kms_writeback and kms_colorop (and other future) use */ +typedef struct { + bool builtin_mode;
tests/kms_colorop.c line 97
Quoted 10 lines
tests/kms_colorop.c new file +10
-0+bool custom_mode; +bool list_modes; +bool dump_check; +int mode_index; +drmModeModeInfo user_mode; +} data_t; + +static data_t data; + +/* TODO move to lib for kms_writeback and kms_colorop (and other future) use */
Is it complex to do it in this series? I think it could be nice to avoid code duplication.
Quoted 61 lines
tests/kms_colorop.c new file +61
-0+static igt_output_t *kms_writeback_get_output (igt_display_t *display) +{ +int i; +enum pipe pipe; + +drmModeModeInfo override_mode = { + .clock =25175 , + .hdisplay =640 , + .hsync_start =656 , + .hsync_end =752 , + .htotal =800 , + .hskew =0 , + .vdisplay =480 , + .vsync_start =490 , + .vsync_end =492 , + .vtotal =525 , + .vscan =0 , + .vrefresh =60 , + .flags =DRM_MODE_FLAG_NHSYNC |DRM_MODE_FLAG_NVSYNC , + .name = {"640x480-60" }, + }; + +for (i =0 ; i < display->n_outputs; i++) { +igt_output_t *output = &display->outputs[i]; + +if (output->config.connector->connector_type !=DRM_MODE_CONNECTOR_WRITEBACK ) +continue ; + +for_each_pipe (display, pipe) { +igt_output_set_pipe (output, pipe); + +if (data.custom_mode) + override_mode = data.user_mode; +if (data.builtin_mode) + override_mode = output->config.connector->modes[data.mode_index]; + +if (check_writeback_config (display, output, override_mode)) { +igt_debug ("Using connector %u:%s on pipe %d\n" , + output->config.connector->connector_id, + output->name, pipe); +return output; + } + } + +igt_debug ("We found %u:%s, but this test will not be able to use it.\n" , + output->config.connector->connector_id, output->name); + +/* Restore any connectors we don't use, so we don't trip on them later */ +kmstest_force_connector (display->drm_fd, output->config.connector,FORCE_CONNECTOR_UNSPECIFIED ); + } + +return NULL ; +} + +/* TODO move to lib for kms_writeback and kms_colorop (and other future) use */ +static uint64_t get_writeback_fb_id (igt_output_t *output) +{ +return igt_output_get_prop (output,IGT_CONNECTOR_WRITEBACK_FB_ID ); +} + +/* TODO move to lib for kms_writeback and kms_colorop (and other future) use */
tests/kms_colorop.c line 168
Quoted 10 lines
tests/kms_colorop.c new file +10
-0+static void detach_crtc (igt_display_t *display,igt_output_t *output) +{ +if (get_writeback_fb_id (output) ==0 ) +return ; + +igt_output_set_pipe (output,PIPE_NONE ); +igt_display_commit2 (display,COMMIT_ATOMIC ); +} + +static void get_and_wait_out_fence (igt_output_t *output)
There is no /*TODO*/ here, but I look useful for other tests
Quoted 142 lines
tests/kms_colorop.c new file +142
-0+{ +int ret; + +igt_assert (output->writeback_out_fence_fd >=0 ); + + ret =sync_fence_wait (output->writeback_out_fence_fd,1000 ); +igt_assert_f (ret ==0 ,"sync_fence_wait failed: %s\n" ,strerror (-ret)); +close (output->writeback_out_fence_fd); + output->writeback_out_fence_fd =-1 ; +} + +static bool can_use_colorop (igt_display_t *display,igt_colorop_t *colorop,kms_colorop_t *desired) +{ +switch (desired->type) { +case KMS_COLOROP_ENUMERATED_LUT1D : +if (igt_colorop_get_prop (display, colorop,IGT_COLOROP_TYPE ) ==DRM_COLOROP_1D_CURVE ) +return true; +case KMS_COLOROP_CUSTOM_LUT1D : +case KMS_COLOROP_CTM : +case KMS_COLOROP_LUT3D : +default : +return false; + } +} + +/** +* Iterate color pipeline that begins with colorop and try to map +* colorops[] to it. +*/ +static bool map_to_pipeline (igt_display_t *display, +igt_colorop_t *colorop, +kms_colorop_t *colorops[]) +{ +igt_colorop_t *next = colorop; +kms_colorop_t *current_op; +int i =0 ; +int prop_val =0 ; + + current_op = colorops[i++]; +igt_require (current_op); + +while (next) { +if (can_use_colorop (display, next, current_op)) { + current_op->colorop = next; + current_op = colorops[i++]; +if (!current_op) +break ; + } + prop_val =igt_colorop_get_prop (display, next, +IGT_COLOROP_NEXT ); + next =igt_find_colorop (display, prop_val); + } + +if (current_op) { +/* we failed to map the pipeline */ + +/* clean up colorops[i].colorop mappings */ +for (i =0 , current_op = colorops[0 ]; current_op; current_op = colorops[i++]) + current_op->colorop =NULL ; + +return false; + } + +return true; +} + +static igt_colorop_t *get_color_pipeline (igt_display_t *display, +igt_plane_t *plane, +kms_colorop_t *colorops[]) +{ +igt_colorop_t *colorop =NULL ; +int i; + +/* go through all color pipelines */ +for (i =0 ; i < plane->num_color_pipelines; ++i) { +if (map_to_pipeline (display, plane->color_pipelines[i], colorops)) { + colorop = plane->color_pipelines[i]; +break ; + } + } + +return colorop; +} + +static void set_colorop (igt_display_t *display, +kms_colorop_t *colorop) +{ +igt_assert (colorop->colorop); +igt_colorop_set_prop_value (colorop->colorop,IGT_COLOROP_BYPASS ,0 ); + +/* Set to desired value from kms_colorop_t */ +switch (colorop->type) { +case KMS_COLOROP_ENUMERATED_LUT1D : +switch (colorop->enumerated_lut1d_info.tf) { +case KMS_COLOROP_LUT1D_SRGB_EOTF : +igt_colorop_set_prop_enum (colorop->colorop,IGT_COLOROP_CURVE_1D_TYPE ,"sRGB EOTF" ); +break ; +case KMS_COLOROP_LUT1D_SRGB_INV_EOTF : +igt_colorop_set_prop_enum (colorop->colorop,IGT_COLOROP_CURVE_1D_TYPE ,"sRGB Inverse EOTF" ); +break ; +case KMS_COLOROP_LUT1D_PQ_EOTF : +case KMS_COLOROP_LUT1D_PQ_INV_EOTF : +default : +igt_fail (IGT_EXIT_FAILURE ); + } +break ; +case KMS_COLOROP_CUSTOM_LUT1D : +case KMS_COLOROP_CTM : +case KMS_COLOROP_LUT3D : +default : +igt_fail (IGT_EXIT_FAILURE ); + } +} + +static void set_color_pipeline (igt_display_t *display, +igt_plane_t *plane, +kms_colorop_t *colorops[], +igt_colorop_t *color_pipeline) +{ +igt_colorop_t *next; +int prop_val =0 ; +int i; + +igt_plane_set_color_pipeline (plane, color_pipeline); + +for (i =0 ; colorops[i]; i++) +set_colorop (display, colorops[i]); + +/* set unused ops in pipeline to bypass */ + next = color_pipeline; + i =0 ; +while (next) { +if (!colorops[i] || colorops[i]->colorop != next) +igt_colorop_set_prop_value (next,IGT_COLOROP_BYPASS ,1 ); +else + i++; + + prop_val =igt_colorop_get_prop (display, next, +IGT_COLOROP_NEXT ); + next =igt_find_colorop (display, prop_val); + } +}
tests/kms_colorop.c line 320
Quoted 10 lines
tests/kms_colorop.c new file +10
-0+ +static void set_color_pipeline_bypass (igt_plane_t *plane) +{ +igt_plane_set_prop_enum (plane,IGT_PLANE_COLOR_PIPELINE ,"Bypass" ); +} + +static bool compare_with_bracket (igt_fb_t *in,igt_fb_t *out) +{ +if (is_vkms_device (in->fd)) +return igt_cmp_fb_pixels (in, out,1 ,1 );
Can you add a comment explaining why vkms is an exception and how the [1,1] bracket was choosen?
tests/kms_colorop.c line 331
Quoted 11 lines
tests/kms_colorop.c new file +11
-0+ +/* +* By default we'll look for a [0, 0] bracket. We can then +* define it for each driver that implements support for this +* test. That way we can understand the precision of each +* driver better. +*/ +return igt_cmp_fb_pixels (in, out,0 ,0 ); +} + +#define DUMP_FBS 1
Is it possible to toggle it at runtime? (see kms_writeback and igt_main_args)
Quoted 283 lines
tests/kms_colorop.c new file +177
-0+ +#define MAX_COLOROPS 3 +#define NUM_COLOROP_TESTS 3 +#define MAX_NAME_SIZE 256 + +static void apply_transforms (kms_colorop_t *colorops[],igt_fb_t *sw_transform_fb) +{ +int i; +igt_pixel_transform transforms[MAX_COLOROPS ]; + +for (i =0 ; colorops[i]; i++) + transforms[i] = colorops[i]->transform; + +igt_color_transform_pixels (sw_transform_fb, transforms, i); +} + +static void colorop_plane_test (igt_display_t *display, +kms_colorop_t *colorops[]) +{ +igt_colorop_t *color_pipeline =NULL ; +igt_output_t *output; +igt_plane_t *plane; +igt_fb_t input_fb; +igt_fb_t sw_transform_fb; +igt_fb_t output_fb; +drmModeModeInfo mode; +unsigned int fb_id; +igt_crc_t input_crc, output_crc; + + output =kms_writeback_get_output (display); +igt_require (output); + +if (output->use_override_mode) +memcpy (&mode, &output->override_mode,sizeof (mode)); +else +memcpy (&mode, &output->config.default_mode,sizeof (mode)); + +/* create input fb */ + plane =igt_output_get_plane_type (output,DRM_PLANE_TYPE_PRIMARY ); +igt_assert (plane); + + fb_id =igt_create_color_pattern_fb (display->drm_fd, + mode.hdisplay, mode.vdisplay, +DRM_FORMAT_XRGB8888 ,DRM_FORMAT_MOD_LINEAR , +0.2 ,0.2 ,0.2 , &input_fb); +igt_assert (fb_id >=0 ); +igt_plane_set_fb (plane, &input_fb); +#if DUMP_FBS +igt_dump_fb (display, &input_fb,"." ,"input" ); +#endif + +/* create output fb */ + fb_id =igt_create_fb (display->drm_fd, mode.hdisplay, mode.vdisplay, +DRM_FORMAT_XRGB8888 , +igt_fb_mod_to_tiling (0 ), + &output_fb); +igt_require (fb_id >0 ); + +igt_fb_get_fnv1a_crc (&input_fb, &input_crc); + +igt_require (igt_plane_has_prop (plane,IGT_PLANE_COLOR_PIPELINE )); + +/* reset color pipeline*/ + +set_color_pipeline_bypass (plane); + +/* Commit */ +igt_plane_set_fb (plane, &input_fb); +igt_output_set_writeback_fb (output, &output_fb); + +igt_display_commit_atomic (output->display, +DRM_MODE_ATOMIC_ALLOW_MODESET , +NULL ); +get_and_wait_out_fence (output); + +/* Compare input and output buffers. They should be equal here. */ +igt_fb_get_fnv1a_crc (&output_fb, &output_crc); + +igt_assert_crc_equal (&input_crc, &output_crc); + +/* create sw transformed buffer */ + +igt_copy_fb (display->drm_fd, &input_fb, &sw_transform_fb); +igt_assert (igt_cmp_fb_pixels (&input_fb, &sw_transform_fb,0 ,0 )); + +apply_transforms (colorops, &sw_transform_fb); +#if DUMP_FBS +igt_dump_fb (display, &sw_transform_fb,"." ,"sw_transform" ); +#endif +/* discover and set COLOR PIPELINE */ + +/* get COLOR_PIPELINE enum */ + color_pipeline =get_color_pipeline (display, plane, colorops); + +/* skip test if we can't find applicable pipeline */ +igt_skip_on (!color_pipeline); + +set_color_pipeline (display, plane, colorops, color_pipeline); + +igt_output_set_writeback_fb (output, &output_fb); + +/* commit COLOR_PIPELINE */ +igt_display_commit_atomic (display, +DRM_MODE_ATOMIC_ALLOW_MODESET , +NULL ); +get_and_wait_out_fence (output); +#if DUMP_FBS +igt_dump_fb (display, &output_fb,"." ,"output" ); +#endif + +/* compare sw transformed and KMS transformed FBs */ +igt_assert (compare_with_bracket (&sw_transform_fb, &output_fb)); + +/* reset color pipeline*/ +set_color_pipeline_bypass (plane); + +/* Commit */ +igt_plane_set_fb (plane, &input_fb); +igt_output_set_writeback_fb (output, &output_fb); + +igt_display_commit_atomic (output->display, +DRM_MODE_ATOMIC_ALLOW_MODESET , +NULL ); +get_and_wait_out_fence (output); + +/* cleanup */ +detach_crtc (display, output); +igt_remove_fb (display->drm_fd, &input_fb); +igt_remove_fb (display->drm_fd, &output_fb); +} + +igt_main +{ + +struct { +kms_colorop_t *colorops[MAX_COLOROPS ]; +const char *name; + } tests[] = { + { { &kms_colorop_srgb_eotf,NULL },"srgb_eotf" }, + { { &kms_colorop_srgb_inv_eotf,NULL },"srgb_inv_eotf" }, + { { &kms_colorop_srgb_eotf, &kms_colorop_srgb_inv_eotf,NULL },"srgb_eotf-srgb_inv_eotf" } + }; + +igt_display_t display; +int i, ret; + + igt_fixture { + display.drm_fd =drm_open_driver_master (DRIVER_ANY ); + +if (drmSetClientCap (display.drm_fd,DRM_CLIENT_CAP_ATOMIC ,1 ) ==0 ) + display.is_atomic =1 ; + + ret =drmSetClientCap (display.drm_fd,DRM_CLIENT_CAP_WRITEBACK_CONNECTORS ,1 ); + +igt_require_f (!ret,"error setting DRM_CLIENT_CAP_WRITEBACK_CONNECTORS\n" ); + +igt_display_require (&display, display.drm_fd); + +kmstest_set_vt_graphics_mode (); + +igt_display_require (&display, display.drm_fd); + +igt_require (display.is_atomic); + + } + +for (i =0 ; i <ARRAY_SIZE (tests); i++) { +igt_describe ("Check color ops on a plane" ); + igt_subtest_f("plane-%s", tests[i].name) +colorop_plane_test (&display, tests[i].colorops); + } + +igt_describe ("Tests getting and setting COLOR_PIPELINE property on plane" ); + igt_fixture { +igt_display_fini (&display); + } +}tests/kms_colorop.h new file +88
-0@@ -0,0 +1,88 @@ +/* SPDX-License-Identifier: MIT */ +/* +* Copyright 2023 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. +*/ + +#ifndef __KMS_COLOROP_H__ +#define __KMS_COLOROP_H__ + +#include "igt_color.h" + +typedef bool (*compare_fb_t )(igt_fb_t *in,igt_fb_t *out); + +typedef int (*transform_fb )(igt_fb_t *in); + +typedef int (*transform_pixel )(igt_pixel_t *pixel); + +/* Test version definitions */ +typedef enum kms_colorop_type { +KMS_COLOROP_ENUMERATED_LUT1D , +KMS_COLOROP_CUSTOM_LUT1D , +KMS_COLOROP_CTM , +KMS_COLOROP_LUT3D +}kms_colorop_type_t ; + +typedef enum kms_colorop_lut1d_tf { +KMS_COLOROP_LUT1D_SRGB_EOTF , +KMS_COLOROP_LUT1D_SRGB_INV_EOTF , +KMS_COLOROP_LUT1D_PQ_EOTF , +KMS_COLOROP_LUT1D_PQ_INV_EOTF , +}kms_colorop_lut1d_tf_t ; + +typedef struct kms_colorop_enumerated_lut1d_info { +kms_colorop_lut1d_tf_t tf; +}kms_colorop_enumerated_lut1d_info_t ; + +typedef struct kms_colorop { +kms_colorop_type_t type; + +union { +kms_colorop_enumerated_lut1d_info_t enumerated_lut1d_info; + }; + +const char *name; + +igt_pixel_transform transform; + +/* Mapped colorop */ +igt_colorop_t *colorop; + +}kms_colorop_t ; + +kms_colorop_t kms_colorop_srgb_eotf = { + .type =KMS_COLOROP_ENUMERATED_LUT1D , + .enumerated_lut1d_info = { + .tf =KMS_COLOROP_LUT1D_SRGB_EOTF + }, + .name ="srgb_eotf" , + .transform = &igt_color_srgb_eotf +}; + +kms_colorop_t kms_colorop_srgb_inv_eotf = { + .type =KMS_COLOROP_ENUMERATED_LUT1D , + .enumerated_lut1d_info = { + .tf =KMS_COLOROP_LUT1D_SRGB_INV_EOTF + }, + .name ="srgb_inv_eotf" , + .transform = &igt_color_srgb_inv_eotf +}; + +#endif /* __KMS_COLOROP_H__ */ tests/meson.build +1
-0@@ -26,6 +26,7 @@ test_progs = [ 'kms_bw', 'kms_color', 'kms_concurrent', + 'kms_colorop', 'kms_content_protection', 'kms_cursor_crc', 'kms_cursor_edge_walk',
Signature · 4 lines
-- Louis Chauvet, Bootlin Embedded Linux and Kernel engineering https://bootlin.com
Re: [PATCH V10 09/30] tests/kms_colorop: Add kms_colorop tests
Quoted 7 lines
tests/kms_colorop.c line 320
Quoted 4 lines
tests/kms_colorop.c new file +4
-0+static bool compare_with_bracket (igt_fb_t *in,igt_fb_t *out) +{ + if (is_vkms_device(in->fd)) + return igt_cmp_fb_pixels(in, out, 1, 1);Can you add a comment explaining why vkms is an exception and how the [1,1] bracket was choosen?
The idea was that each driver is best served by their own bracket. A later patch adds an even worse bracket for amdgpu.
If I remember right, this bracket was simply chosen experimentally, i.e., by trial and error.
Harry
Re: [PATCH V10 09/30] tests/kms_colorop: Add kms_colorop tests
Hi Harry,
Quoted 9 lines · Harry Wentland
Quoted 8 lines
tests/kms_colorop.c line 320
Quoted 4 lines
tests/kms_colorop.c new file +4
-0+static bool compare_with_bracket (igt_fb_t *in,igt_fb_t *out) +{ + if (is_vkms_device(in->fd)) + return igt_cmp_fb_pixels(in, out, 1, 1);Can you add a comment explaining why vkms is an exception and how the [1,1] bracket was choosen?
Quoted 5 lines
The idea was that each driver is best served by their own bracket. A later patch adds an even worse bracket for amdgpu.
If I remember right, this bracket was simply chosen experimentally, i.e., by trial and error.
This looks like worth to put in a comment.
Regards,
Kamil
Quoted 3 lines
Harry
Re: [PATCH V10 09/30] tests/kms_colorop: Add kms_colorop tests
In reply to Louis ChauvetQuoted 147 lines · Louis Chauvet
Le 15/08/2025 à 06:06, Alex Hung a écrit :
Quoted 144 lines
From: Harry Wentland <[email protected]>
This tests the color pipeline API, exposed via the COLOR PIPELINE plane property and
drm_coloropobjects.We introduce tests for:
- sRGB EOTF
- sRGB Inverse EOTF
- sRGB EOTF + sRGB Inverse EOTFThe last one is the holy grail of LUT testing. It tests that after applying an EOTF, followed by its inverse EOTF we arrive back at the original value. We can use this to test for precision loss in the pipeline.
All tests are tested via writeback. All transforms are done in SW (in floating point) and at the end the SW transformed buffer is compared with the KMS writeback output buffer. The two should match within a bracket of acceptable deviations. Since these deviations might look different for different KMS drivers we'll do this check on a driver-specific basis.
Signed-off-by Alex Hung <[email protected]>Signed-off-by Harry Wentland <[email protected]>---
tests/kms_colorop.c| 508 ++++++++++++++++++++++++++++++++++++++++++++tests/kms_colorop.h| 88 ++++++++
tests/meson.build | 1 +3 files changed, 597 insertions(+)create mode 100644
tests/kms_colorop.c
create mode 100644tests/kms_colorop.htests/kms_colorop.c new file +5
-0@@ -0,0 +1,508 @@ +// SPDX-License-Identifier: MIT +/* +* Copyright 2023 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.
+ */tests/kms_colorop.c new file +10
-0+ +#include "igt.h" +#include "igt_color.h" +#include "sw_sync.h" +#include "kms_colorop.h" + +/** +* TEST: kms colorop +* Category: Display +* Description: Test to validate the retrieving and setting of DRM colorops
+ *
+ * SUBTEST: plane-%s
+ * Description: Tests DRM colorop properties on a plane
+ * Driver requirement: amdgpu
+ * Functionality:kms_core
+ * Mega feature: General Display Features
+ * Test category: functionality test
+ *
+ * arg[1]:
+ *
+ * @srgb_eotf: sRGB EOTF
+ * @srgb_inv_eotf: sRGB Inverse EOTF
+ * @srgb_eotf-srgb_inv_eotf: sRGB EOTF -> sRGB Inverse EOTF
+ *
+ */tests/kms_colorop.c new file +2
-0+ +/* TODO move to lib for kms_writeback and kms_colorop (and other future) use */
+static bool check_writeback_config(igt_display_t *display,igt_output_t*output,
+ drmModeModeInfooverride_mode)tests/kms_colorop.c new file +25
-0+{ + igt_fb_t input_fb, output_fb; + igt_plane_t *plane; + uint32_t writeback_format = DRM_FORMAT_XRGB8888; + uint64_t modifier = DRM_FORMAT_MOD_LINEAR; + int width, height, ret; + + igt_output_override_mode(output, &override_mode); + + width = override_mode.hdisplay; + height = override_mode.vdisplay; + + ret = igt_create_fb(display->drm_fd, width, height, + DRM_FORMAT_XRGB8888, modifier, &input_fb); + igt_assert(ret >= 0); + + ret = igt_create_fb(display->drm_fd, width, height, + writeback_format, modifier, &output_fb); + igt_assert(ret >= 0); + + plane = igt_output_get_plane_type(output, DRM_PLANE_TYPE_PRIMARY); + igt_plane_set_fb(plane, &input_fb); + igt_output_set_writeback_fb(output, &output_fb); + + ret = igt_display_try_commit_atomic(display,
DRM_MODE_ATOMIC_TEST_ONLY|
+DRM_MODE_ATOMIC_ALLOW_MODESET, NULL); +igt_plane_set_fb(plane, NULL);
+igt_remove_fb(display->drm_fd, &input_fb);
+igt_remove_fb(display->drm_fd, &output_fb);tests/kms_colorop.c new file +5
-0+ + return !ret; +} + +/* TODO move to lib for kms_writeback and kms_colorop (and other future) use */
+typedef struct {
+ boolbuiltin_mode;
+ boolcustom_mode;
+ boollist_modes;
+ booldump_check;
+ intmode_index;
+ drmModeModeInfouser_mode;
Quoted 8 lines
Quoted 6 lines
tests/kms_colorop.c new file +5
-0+} data_t; + +static data_t data; + +/* TODO move to lib for kms_writeback and kms_colorop (and other future) use */
Is it complex to do it in this series? I think it could be nice to avoid code duplication.
Some functions evolved and cannot be shared with kms_writeback but some can be moved to lib. I will sort them out and remove or reduce the TODOs.
Quoted 236 lines
Quoted 70 lines
tests/kms_colorop.c new file +26
-0+static igt_output_t *kms_writeback_get_output (igt_display_t *display) +{ + int i; + enum pipe pipe; + + drmModeModeInfo override_mode = { + .clock = 25175, + .hdisplay = 640, + .hsync_start = 656, + .hsync_end = 752, + .htotal = 800, + .hskew = 0, + .vdisplay = 480, + .vsync_start = 490, + .vsync_end = 492, + .vtotal = 525, + .vscan = 0, + .vrefresh = 60, + .flags = DRM_MODE_FLAG_NHSYNC | DRM_MODE_FLAG_NVSYNC, + .name = {"640x480-60"}, + }; + + for (i = 0; i < display->n_outputs; i++) { + igt_output_t *output = &display->outputs[i]; + + if (output->config.connector->connector_type !=
DRM_MODE_CONNECTOR_WRITEBACK)
+ continue;tests/kms_colorop.c new file +8
-0+ + for_each_pipe(display, pipe) { + igt_output_set_pipe(output, pipe); + + if (data.custom_mode) + override_mode = data.user_mode; + if (data.builtin_mode) + override_mode = output->config.connector-Quoted 1 line
modes[data.mode_index];
+
+ if (check_writeback_config(display, output, override_mode)) {
+ igt_debug("Using connector %u:%s on pipe %d\n", +output->config.connector->connector_id, +output->name, pipe);
+ return output;
+ }
+ }
+
+ igt_debug("We found %u:%s, but this test will not be able to use it.\n",
+output->config.connector->connector_id,output->name); +
+ /* Restore any connectors we don't use, so we don't trip on them later */
+ kmstest_force_connector(display->drm_fd, output-Quoted 1 line
config.connector,
FORCE_CONNECTOR_UNSPECIFIED);+ }
tests/kms_colorop.c new file +5
-0+ + return NULL; +} + +/* TODO move to lib for kms_writeback and kms_colorop (and other future) use */
tests/kms_colorop.c new file +6
-0+static uint64_t get_writeback_fb_id (igt_output_t *output) +{ + return igt_output_get_prop(output, IGT_CONNECTOR_WRITEBACK_FB_ID); +} + +/* TODO move to lib for kms_writeback and kms_colorop (and other future) use */
tests/kms_colorop.c line 168
Quoted 10 lines
tests/kms_colorop.c new file +10
-0+static void detach_crtc (igt_display_t *display,igt_output_t *output) +{ + if (get_writeback_fb_id(output) == 0) + return; + + igt_output_set_pipe(output, PIPE_NONE); + igt_display_commit2(display, COMMIT_ATOMIC); +} + +static void get_and_wait_out_fence (igt_output_t *output)There is no /*TODO*/ here, but I look useful for other tests
Quoted 153 lines
tests/kms_colorop.c new file +7
-0+{ + int ret; + + igt_assert(output->writeback_out_fence_fd >= 0); + + ret = sync_fence_wait(output->writeback_out_fence_fd, 1000); + igt_assert_f(ret == 0, "sync_fence_wait failed: %s\n", strerror(-ret));
+close(output->writeback_out_fence_fd);
+output->writeback_out_fence_fd= -1;tests/kms_colorop.c new file +3
-0+} + +static bool can_use_colorop(igt_display_t *display, igt_colorop_t*colorop,
kms_colorop_t*desired)
+{
+ switch (desired->type) {
+ caseKMS_COLOROP_ENUMERATED_LUT1D:
+ if (igt_colorop_get_prop(display, colorop, IGT_COLOROP_TYPE)==DRM_COLOROP_1D_CURVE)
+ return true;
+ caseKMS_COLOROP_CUSTOM_LUT1D:
+ caseKMS_COLOROP_CTM:
+ caseKMS_COLOROP_LUT3D:
+ default:
+ return false;
+ }tests/kms_colorop.c new file +35
-0+} + +/** +* Iterate color pipeline that begins with colorop and try to map +* colorops[] to it. +*/ +static bool map_to_pipeline (igt_display_t *display, + igt_colorop_t *colorop, + kms_colorop_t *colorops[]) +{ + igt_colorop_t *next = colorop; + kms_colorop_t *current_op; + int i = 0; + int prop_val = 0; + + current_op = colorops[i++]; + igt_require(current_op); + + while (next) { + if (can_use_colorop(display, next, current_op)) { + current_op->colorop = next; + current_op = colorops[i++]; + if (!current_op) + break; + } + prop_val = igt_colorop_get_prop(display, next, + IGT_COLOROP_NEXT); + next = igt_find_colorop(display, prop_val); + } + + if (current_op) { + /* we failed to map the pipeline */ + + /* clean up colorops[i].colorop mappings */ + for (i = 0, current_op = colorops[0]; current_op; current_op= colorops[i++])
+current_op->colorop= NULL;tests/kms_colorop.c new file +17
-0+ + return false; + } + + return true; +} + +static igt_colorop_t *get_color_pipeline (igt_display_t *display, + igt_plane_t *plane, + kms_colorop_t *colorops[]) +{ + igt_colorop_t *colorop = NULL; + int i; + + /* go through all color pipelines */ + for (i = 0; i < plane->num_color_pipelines; ++i) { + if (map_to_pipeline(display, plane->color_pipelines[i],colorops)) {
+ colorop = plane->color_pipelines[i];
+ break;
+ }
+ }tests/kms_colorop.c new file +16
-0+ + return colorop; +} + +static void set_colorop (igt_display_t *display, + kms_colorop_t *colorop) +{ + igt_assert(colorop->colorop); + igt_colorop_set_prop_value(colorop->colorop, IGT_COLOROP_BYPASS, 0); + + /* Set to desired value from kms_colorop_t */ + switch (colorop->type) { + case KMS_COLOROP_ENUMERATED_LUT1D: + switch (colorop->enumerated_lut1d_info.tf) { + case KMS_COLOROP_LUT1D_SRGB_EOTF: + igt_colorop_set_prop_enum(colorop->colorop,
IGT_COLOROP_CURVE_1D_TYPE, "sRGB EOTF");
+ break;
+ caseKMS_COLOROP_LUT1D_SRGB_INV_EOTF:
+igt_colorop_set_prop_enum(colorop->colorop, IGT_COLOROP_CURVE_1D_TYPE, "sRGB Inverse EOTF"); + break;
+ caseKMS_COLOROP_LUT1D_PQ_EOTF:
+ caseKMS_COLOROP_LUT1D_PQ_INV_EOTF:
+ default:
+igt_fail(IGT_EXIT_FAILURE);
+ }
+ break;
+ caseKMS_COLOROP_CUSTOM_LUT1D:
+ caseKMS_COLOROP_CTM:
+ caseKMS_COLOROP_LUT3D:
+ default:
+igt_fail(IGT_EXIT_FAILURE);
+ }tests/kms_colorop.c new file +34
-0+} + +static void set_color_pipeline (igt_display_t *display, + igt_plane_t *plane, + kms_colorop_t *colorops[], + igt_colorop_t *color_pipeline) +{ + igt_colorop_t *next; + int prop_val = 0; + int i; + + igt_plane_set_color_pipeline(plane, color_pipeline); + + for (i = 0; colorops[i]; i++) + set_colorop(display, colorops[i]); + + /* set unused ops in pipeline to bypass */ + next = color_pipeline; + i = 0; + while (next) { + if (!colorops[i] || colorops[i]->colorop != next) + igt_colorop_set_prop_value(next, IGT_COLOROP_BYPASS, 1); + else + i++; + + prop_val = igt_colorop_get_prop(display, next, + IGT_COLOROP_NEXT); + next = igt_find_colorop(display, prop_val); + } +} + +static void set_color_pipeline_bypass (igt_plane_t *plane) +{ + igt_plane_set_prop_enum(plane, IGT_PLANE_COLOR_PIPELINE, "Bypass");
Quoted 8 lines
tests/kms_colorop.c line 320
Quoted 6 lines
tests/kms_colorop.c new file +6
-0+} + +static bool compare_with_bracket (igt_fb_t *in,igt_fb_t *out) +{ + if (is_vkms_device(in->fd)) + return igt_cmp_fb_pixels(in, out, 1, 1);Can you add a comment explaining why vkms is an exception and how the [1,1] bracket was choosen?
Will do according to Harry's comments, ex., chosen experimentally (by trial and error).
Quoted 15 lines
tests/kms_colorop.c line 331
Quoted 12 lines
tests/kms_colorop.c new file +11
-0+ + /* + * By default we'll look for a [0, 0] bracket. We can then + * define it for each driver that implements support for this + * test. That way we can understand the precision of each + * driver better. + */ + return igt_cmp_fb_pixels(in, out, 0, 0); +} + +#define DUMP_FBS 1Is it possible to toggle it at runtime? (see
kms_writebackandigt_main_args)
That's a good idea, and I plan to make default as 0 (no DUMP_FBS).
Quoted 299 lines
Quoted 298 lines
tests/kms_colorop.c new file +6
-0+ +#define MAX_COLOROPS 3 +#define NUM_COLOROP_TESTS 3 +#define MAX_NAME_SIZE 256 + +static void apply_transforms(kms_colorop_t *colorops[], igt_fb_t
*sw_transform_fb)tests/kms_colorop.c new file +135
-0+{ + int i; + igt_pixel_transform transforms[MAX_COLOROPS]; + + for (i = 0; colorops[i]; i++) + transforms[i] = colorops[i]->transform; + + igt_color_transform_pixels(sw_transform_fb, transforms, i); +} + +static void colorop_plane_test (igt_display_t *display, + kms_colorop_t *colorops[]) +{ + igt_colorop_t *color_pipeline = NULL; + igt_output_t *output; + igt_plane_t *plane; + igt_fb_t input_fb; + igt_fb_t sw_transform_fb; + igt_fb_t output_fb; + drmModeModeInfo mode; + unsigned int fb_id; + igt_crc_t input_crc, output_crc; + + output = kms_writeback_get_output(display); + igt_require(output); + + if (output->use_override_mode) + memcpy(&mode, &output->override_mode, sizeof(mode)); + else + memcpy(&mode, &output->config.default_mode, sizeof(mode)); + + /* create input fb */ + plane = igt_output_get_plane_type(output, DRM_PLANE_TYPE_PRIMARY); + igt_assert(plane); + + fb_id = igt_create_color_pattern_fb(display->drm_fd, + mode.hdisplay, mode.vdisplay, + DRM_FORMAT_XRGB8888, DRM_FORMAT_MOD_LINEAR, + 0.2, 0.2, 0.2, &input_fb); + igt_assert(fb_id >= 0); + igt_plane_set_fb(plane, &input_fb); +#if DUMP_FBS + igt_dump_fb(display, &input_fb, ".", "input"); +#endif + + /* create output fb */ + fb_id = igt_create_fb(display->drm_fd, mode.hdisplay, mode.vdisplay, + DRM_FORMAT_XRGB8888, + igt_fb_mod_to_tiling(0), + &output_fb); + igt_require(fb_id > 0); + + igt_fb_get_fnv1a_crc(&input_fb, &input_crc); + + igt_require(igt_plane_has_prop(plane, IGT_PLANE_COLOR_PIPELINE)); + + /* reset color pipeline*/ + + set_color_pipeline_bypass(plane); + + /* Commit */ + igt_plane_set_fb(plane, &input_fb); + igt_output_set_writeback_fb(output, &output_fb); + + igt_display_commit_atomic(output->display, + DRM_MODE_ATOMIC_ALLOW_MODESET, + NULL); + get_and_wait_out_fence(output); + + /* Compare input and output buffers. They should be equal here. */ + igt_fb_get_fnv1a_crc(&output_fb, &output_crc); + + igt_assert_crc_equal(&input_crc, &output_crc); + + /* create sw transformed buffer */ + + igt_copy_fb(display->drm_fd, &input_fb, &sw_transform_fb); + igt_assert(igt_cmp_fb_pixels(&input_fb, &sw_transform_fb, 0, 0)); + + apply_transforms(colorops, &sw_transform_fb); +#if DUMP_FBS + igt_dump_fb(display, &sw_transform_fb, ".", "sw_transform"); +#endif + /* discover and set COLOR PIPELINE */ + + /* get COLOR_PIPELINE enum */ + color_pipeline = get_color_pipeline(display, plane, colorops); + + /* skip test if we can't find applicable pipeline */ + igt_skip_on(!color_pipeline); + + set_color_pipeline(display, plane, colorops, color_pipeline); + + igt_output_set_writeback_fb(output, &output_fb); + + /* commit COLOR_PIPELINE */ + igt_display_commit_atomic(display, + DRM_MODE_ATOMIC_ALLOW_MODESET, + NULL); + get_and_wait_out_fence(output); +#if DUMP_FBS + igt_dump_fb(display, &output_fb, ".", "output"); +#endif + + /* compare sw transformed and KMS transformed FBs */ + igt_assert(compare_with_bracket(&sw_transform_fb, &output_fb)); + + /* reset color pipeline*/ + set_color_pipeline_bypass(plane); + + /* Commit */ + igt_plane_set_fb(plane, &input_fb); + igt_output_set_writeback_fb(output, &output_fb); + + igt_display_commit_atomic(output->display, + DRM_MODE_ATOMIC_ALLOW_MODESET, + NULL); + get_and_wait_out_fence(output); + + /* cleanup */ + detach_crtc(display, output); + igt_remove_fb(display->drm_fd, &input_fb); + igt_remove_fb(display->drm_fd, &output_fb); +} + +igt_main +{ + + struct { + kms_colorop_t *colorops[MAX_COLOROPS]; + const char *name; + } tests[] = { + { { &kms_colorop_srgb_eotf, NULL }, "srgb_eotf" }, + { { &kms_colorop_srgb_inv_eotf, NULL }, "srgb_inv_eotf" }, + { { &kms_colorop_srgb_eotf, &kms_colorop_srgb_inv_eotf,NULL }, "srgb_eotf-srgb_inv_eotf" }
+ };tests/kms_colorop.c new file +8
-0+ + igt_display_t display; + int i, ret; + + igt_fixture { + display.drm_fd = drm_open_driver_master(DRIVER_ANY); + + if (drmSetClientCap(display.drm_fd, DRM_CLIENT_CAP_ATOMIC, 1)== 0)
+ display.is_atomic = 1;
+
+ ret = drmSetClientCap(display.drm_fd,DRM_CLIENT_CAP_WRITEBACK_CONNECTORS, 1);
+
+ igt_require_f(!ret, "error setting
DRM_CLIENT_CAP_WRITEBACK_CONNECTORS\n");tests/kms_colorop.c new file +18
-0+ + igt_display_require(&display, display.drm_fd); + + kmstest_set_vt_graphics_mode(); + + igt_display_require(&display, display.drm_fd); + + igt_require(display.is_atomic); + + } + + for (i = 0; i < ARRAY_SIZE(tests); i++) { + igt_describe("Check color ops on a plane"); + igt_subtest_f("plane-%s", tests[i].name) + colorop_plane_test(&display, tests[i].colorops); + } + + igt_describe("Tests getting and setting COLOR_PIPELINE propertyon plane");
+igt_fixture{
+igt_display_fini(&display);
+ }tests/kms_colorop.c new file +1
-0+}tests/kms_colorop.h new file +5
-0@@ -0,0 +1,88 @@ +/* SPDX-License-Identifier: MIT */ +/* +* Copyright 2023 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.
+ */tests/kms_colorop.h new file +66
-0+ +#ifndef __KMS_COLOROP_H__ +#define __KMS_COLOROP_H__ + +#include "igt_color.h" + +typedef bool (*compare_fb_t )(igt_fb_t *in,igt_fb_t *out); + +typedef int (*transform_fb )(igt_fb_t *in); + +typedef int (*transform_pixel )(igt_pixel_t *pixel); + +/* Test version definitions */ +typedef enum kms_colorop_type { + KMS_COLOROP_ENUMERATED_LUT1D, + KMS_COLOROP_CUSTOM_LUT1D, + KMS_COLOROP_CTM, + KMS_COLOROP_LUT3D +}kms_colorop_type_t ; + +typedef enum kms_colorop_lut1d_tf { + KMS_COLOROP_LUT1D_SRGB_EOTF, + KMS_COLOROP_LUT1D_SRGB_INV_EOTF, + KMS_COLOROP_LUT1D_PQ_EOTF, + KMS_COLOROP_LUT1D_PQ_INV_EOTF, +}kms_colorop_lut1d_tf_t ; + +typedef struct kms_colorop_enumerated_lut1d_info { + kms_colorop_lut1d_tf_t tf; +}kms_colorop_enumerated_lut1d_info_t ; + +typedef struct kms_colorop { + kms_colorop_type_t type; + + union { + kms_colorop_enumerated_lut1d_info_t enumerated_lut1d_info; + }; + + const char *name; + + igt_pixel_transform transform; + + /* Mapped colorop */ + igt_colorop_t *colorop; + +}kms_colorop_t ; + +kms_colorop_t kms_colorop_srgb_eotf = { + .type = KMS_COLOROP_ENUMERATED_LUT1D, + .enumerated_lut1d_info = { + .tf = KMS_COLOROP_LUT1D_SRGB_EOTF + }, + .name = "srgb_eotf", + .transform = &igt_color_srgb_eotf +}; + +kms_colorop_t kms_colorop_srgb_inv_eotf = { + .type = KMS_COLOROP_ENUMERATED_LUT1D, + .enumerated_lut1d_info = { + .tf = KMS_COLOROP_LUT1D_SRGB_INV_EOTF + }, + .name = "srgb_inv_eotf", + .transform = &igt_color_srgb_inv_eotf +}; + +#endif /* __KMS_COLOROP_H__ */ tests/meson.build +1
-0@@ -26,6 +26,7 @@ test_progs = [ 'kms_bw', 'kms_color', 'kms_concurrent', + 'kms_colorop', 'kms_content_protection', 'kms_cursor_crc', 'kms_cursor_edge_walk',
PATCH v10 10/30 lib/igt_kms: Add support for DATA colorop property
In reply to Alex HungFrom: Harry Wentland <[email protected]>
Support DATA property in color pipeline API.
--- lib/igt_kms.c | 33 +++++++++++++++++++++++++++++++++ lib/igt_kms.h | 12 ++++++++---- 2 files changed, 41 insertions(+), 4 deletions(-)
lib/igt_kms.c +33 -0
@@ -710,6 +710,7 @@ const char * const igt_colorop_prop_names[IGT_NUM_COLOROP_PROPS] = { [IGT_COLOROP_TYPE] = "TYPE", [IGT_COLOROP_BYPASS] = "BYPASS", [IGT_COLOROP_CURVE_1D_TYPE] = "CURVE_1D_TYPE", + [IGT_COLOROP_DATA] = "DATA", [IGT_COLOROP_NEXT] = "NEXT", };
@@ -4463,6 +4464,38 @@ igt_plane_replace_prop_blob(igt_plane_t *plane, enum igt_atomic_plane_propertiesigt_plane_set_prop_changed (plane, prop); } +/** +* igt_colorop_replace_prop_blob: +* @plane: colorop to set property on. +* @prop: property for which the blob will be replaced. +* @ptr: Pointer to contents for the property. +* @length: Length of contents. +* +* This function will destroy the old property blob for the given property, +* and will create a new property blob with the values passed to this function. +* +* The new property blob will be committed when you call igt_display_commit(), +* igt_display_commit2() or igt_display_commit_atomic(). +*/ +void +igt_colorop_replace_prop_blob (igt_colorop_t *colorop,enum igt_atomic_colorop_properties prop,const void *ptr,size_t length) +{ +igt_display_t *display = colorop->plane->pipe->display; +uint64_t *blob = &colorop->values[prop]; +uint32_t blob_id =0 ; + +if (*blob !=0 ) +igt_assert (drmModeDestroyPropertyBlob (display->drm_fd, + *blob) ==0 ); + +if (length >0 ) +igt_assert (drmModeCreatePropertyBlob (display->drm_fd, + ptr, length, &blob_id) ==0 ); + + *blob = blob_id; +igt_colorop_set_prop_changed (colorop, prop); +} +/** * igt_colorop_try_prop_enum: * @colorop: Target colorop.
lib/igt_kms.h +8 -4
@@ -374,6 +374,7 @@ enum igt_atomic_colorop_properties {IGT_COLOROP_TYPE ,IGT_COLOROP_BYPASS ,IGT_COLOROP_CURVE_1D_TYPE , +IGT_COLOROP_DATA ,IGT_COLOROP_NEXT , IGT_NUM_COLOROP_PROPS };
@@ -886,12 +887,15 @@ extern void igt_plane_set_prop_enum(igt_plane_t *plane,enum igt_atomic_plane_properties prop, const char *val); - +extern void igt_plane_replace_prop_blob (igt_plane_t *plane, +enum igt_atomic_plane_properties prop, +const void *ptr,size_t length);extern bool igt_plane_is_valid_colorop (igt_plane_t *plane,igt_colorop_t *colorop);extern void igt_plane_set_color_pipeline (igt_plane_t *plane,igt_colorop_t *colorop); +/** * igt_colorop_has_prop: * @colorop: colorop to check.
@@ -933,9 +937,9 @@ extern void igt_colorop_set_prop_enum(igt_colorop_t *colorop,enum igt_atomic_colorop_properties prop, const char *val); -extern void igt_plane_replace_prop_blob (igt_plane_t *plane, -enum igt_atomic_plane_properties prop, -const void *ptr,size_t length); +extern void igt_colorop_replace_prop_blob (igt_colorop_t *colorop, +enum igt_atomic_colorop_properties prop, +const void *ptr,size_t length);extern bool igt_plane_check_prop_is_mutable (igt_plane_t *plane,enum igt_atomic_plane_properties igt_prop);
Signature · 1 line
2.43.0
PATCH v10 11/30 lib/igt_color: Add support for 3x4 matrices
In reply to Alex HungFrom: Harry Wentland <[email protected]>
Support 3x4 matrices in color pipeline API.
Also add a few matrices for testing.
--- lib/igt_color.c | 86 +++++++++++++++++++++++++++++++++++++++++++++++++ lib/igt_color.h | 54 +++++++++++++++++++++++++++++++ 2 files changed, 140 insertions(+)
lib/igt_color.c +86 -0
@@ -11,6 +11,7 @@#include <errno.h> #include <math.h> +#include "drmtest.h" #include "igt_color.h" #include "igt_core.h" #include "igt_x86.h"
@@ -76,6 +77,62 @@ void igt_color_srgb_eotf(igt_pixel_t *pixel) pixel->b =igt_color_tf_eval (&srgb_eotf, pixel->b); } +static void igt_color_apply_3x4_ctm (igt_pixel_t *pixel,const igt_matrix_3x4_t *matrix) +{ +igt_pixel_t result; + +memcpy (&result, pixel,sizeof (result)); + + result.r = matrix->m[0 ] * pixel->r + + matrix->m[1 ] * pixel->g + + matrix->m[2 ] * pixel->b + + matrix->m[3 ]; + + result.g = matrix->m[4 ] * pixel->r + + matrix->m[5 ] * pixel->g + + matrix->m[6 ] * pixel->b + + matrix->m[7 ]; + + result.b = matrix->m[8 ] * pixel->r + + matrix->m[9 ] * pixel->g + + matrix->m[10 ] * pixel->b + + matrix->m[11 ]; + +memcpy (pixel, &result,sizeof (result)); + +} + +void igt_color_ctm_3x4_50_desat (igt_pixel_t *pixel) +{ +/* apply a 50% desat matrix */ +igt_color_apply_3x4_ctm (pixel, &igt_matrix_3x4_50_desat); +} + +void igt_color_ctm_3x4_overdrive (igt_pixel_t *pixel) +{ +/* apply a 50% desat matrix */ +igt_color_apply_3x4_ctm (pixel, &igt_matrix_3x4_overdrive); +} + +void igt_color_ctm_3x4_oversaturate (igt_pixel_t *pixel) +{ +/* apply a 50% desat matrix */ +igt_color_apply_3x4_ctm (pixel, &igt_matrix_3x4_oversaturate); +} + +void igt_color_ctm_3x4_bt709_enc (igt_pixel_t *pixel) +{ +/* apply a 50% desat matrix */ +igt_color_apply_3x4_ctm (pixel, &igt_matrix_3x4_bt709_enc); +} + +void igt_color_ctm_3x4_bt709_dec (igt_pixel_t *pixel) +{ +/* apply a 50% desat matrix */ +igt_color_apply_3x4_ctm (pixel, &igt_matrix_3x4_bt709_dec); +} + +int igt_color_transform_pixels (igt_fb_t *fb,igt_pixel_transform transforms[],int num_transforms) {uint32_t *line =NULL ;
@@ -142,6 +199,11 @@ int igt_color_transform_pixels(igt_fb_t *fb, igt_pixel_transform transforms[], ifor (i =0 ; i < num_transforms; i++) transforms[i](&pixel); +/* clip */ + pixel.r =fmax (fmin (pixel.r,1.0 ),0.0 ); + pixel.g =fmax (fmin (pixel.g,1.0 ),0.0 ); + pixel.b =fmax (fmin (pixel.b,1.0 ),0.0 ); +/* de-normalize back to 8-bit */ pixel.r *= (0xff ); pixel.g *= (0xff );
@@ -244,3 +306,27 @@ void igt_dump_fb(igt_display_t *display, igt_fb_t *fb,igt_assert_eq (status,CAIRO_STATUS_SUCCESS );cairo_surface_destroy (fb_surface_out); } + +void igt_colorop_set_ctm_3x4 (igt_display_t *display, +igt_colorop_t *colorop, +const igt_matrix_3x4_t *matrix) +{ +struct drm_color_ctm_3x4 ctm; +int i; + +for (i =0 ; i <ARRAY_SIZE (ctm.matrix); i++) { +if (matrix->m[i] <0 ) { + ctm.matrix[i] = + (int64_t ) (-matrix->m[i] * + ((int64_t )1L <<32 )); + ctm.matrix[i] |=1ULL <<63 ; + }else { + ctm.matrix[i] = + (int64_t ) (matrix->m[i] * + ((int64_t )1L <<32 )); + } + } + +/* set blob property */ +igt_colorop_replace_prop_blob (colorop,IGT_COLOROP_DATA , &ctm,sizeof (ctm)); +}
lib/igt_color.h +54 -0
67 lines not on this page · raw message
Signature · 1 line
2.43.0
Re: [PATCH V10 11/30] lib/igt_color: Add support for 3x4 matrices
Quoted 133 lines · Alex Hung
From: Harry Wentland <[email protected]>
Support 3x4 matrices in color pipeline API.
Also add a few matrices for testing.
Signed-off-by Alex Hung <[email protected]>Signed-off-by Harry Wentland <[email protected]>--- lib/igt_color.c | 86 +++++++++++++++++++++++++++++++++++++++++++++++++ lib/igt_color.h | 54 +++++++++++++++++++++++++++++++ 2 files changed, 140 insertions(+)lib/igt_color.c +86
-0@@ -11,6 +11,7 @@#include <errno.h> #include <math.h> +#include "drmtest.h" #include "igt_color.h" #include "igt_core.h" #include "igt_x86.h" @@ -76,6 +77,62 @@ void igt_color_srgb_eotf(igt_pixel_t *pixel) pixel->b =igt_color_tf_eval (&srgb_eotf, pixel->b); } +static void igt_color_apply_3x4_ctm (igt_pixel_t *pixel,const igt_matrix_3x4_t *matrix) +{ +igt_pixel_t result; + +memcpy (&result, pixel,sizeof (result)); + + result.r = matrix->m[0 ] * pixel->r + + matrix->m[1 ] * pixel->g + + matrix->m[2 ] * pixel->b + + matrix->m[3 ]; + + result.g = matrix->m[4 ] * pixel->r + + matrix->m[5 ] * pixel->g + + matrix->m[6 ] * pixel->b + + matrix->m[7 ]; + + result.b = matrix->m[8 ] * pixel->r + + matrix->m[9 ] * pixel->g + + matrix->m[10 ] * pixel->b + + matrix->m[11 ]; + +memcpy (pixel, &result,sizeof (result)); + +} + +void igt_color_ctm_3x4_50_desat (igt_pixel_t *pixel) +{ +/* apply a 50% desat matrix */ +igt_color_apply_3x4_ctm (pixel, &igt_matrix_3x4_50_desat); +} + +void igt_color_ctm_3x4_overdrive (igt_pixel_t *pixel) +{ +/* apply a 50% desat matrix */ +igt_color_apply_3x4_ctm (pixel, &igt_matrix_3x4_overdrive); +} + +void igt_color_ctm_3x4_oversaturate (igt_pixel_t *pixel) +{ +/* apply a 50% desat matrix */ +igt_color_apply_3x4_ctm (pixel, &igt_matrix_3x4_oversaturate); +} + +void igt_color_ctm_3x4_bt709_enc (igt_pixel_t *pixel) +{ +/* apply a 50% desat matrix */ +igt_color_apply_3x4_ctm (pixel, &igt_matrix_3x4_bt709_enc); +} + +void igt_color_ctm_3x4_bt709_dec (igt_pixel_t *pixel) +{ +/* apply a 50% desat matrix */ +igt_color_apply_3x4_ctm (pixel, &igt_matrix_3x4_bt709_dec); +} + +int igt_color_transform_pixels (igt_fb_t *fb,igt_pixel_transform transforms[],int num_transforms) {uint32_t *line =NULL ;@@ -142,6 +199,11 @@ int igt_color_transform_pixels(igt_fb_t *fb, igt_pixel_transform transforms[], ifor (i =0 ; i < num_transforms; i++) transforms[i](&pixel); +/* clip */ + pixel.r =fmax (fmin (pixel.r,1.0 ),0.0 ); + pixel.g =fmax (fmin (pixel.g,1.0 ),0.0 ); + pixel.b =fmax (fmin (pixel.b,1.0 ),0.0 ); +/* de-normalize back to 8-bit */ pixel.r *= (0xff ); pixel.g *= (0xff );@@ -244,3 +306,27 @@ void igt_dump_fb(igt_display_t *display, igt_fb_t *fb,igt_assert_eq (status,CAIRO_STATUS_SUCCESS );cairo_surface_destroy (fb_surface_out); } + +void igt_colorop_set_ctm_3x4 (igt_display_t *display, +igt_colorop_t *colorop, +const igt_matrix_3x4_t *matrix) +{ +struct drm_color_ctm_3x4 ctm; +int i; + +for (i =0 ; i <ARRAY_SIZE (ctm.matrix); i++) { +if (matrix->m[i] <0 ) { + ctm.matrix[i] = + (int64_t ) (-matrix->m[i] * + ((int64_t )1L <<32 )); + ctm.matrix[i] |=1ULL <<63 ; + }else { + ctm.matrix[i] = + (int64_t ) (matrix->m[i] * + ((int64_t )1L <<32 )); + } + } + +/* set blob property */ +igt_colorop_replace_prop_blob (colorop,IGT_COLOROP_DATA , &ctm,sizeof (ctm)); +}lib/igt_color.h +0
-0
lib/igt_color.h typedef struct igt_pixel { · line 37
Quoted 9 lines
lib/igt_color.h +6
-0@@ -29,6 +29,47 @@ typedef struct igt_pixel {float b; } igt_pixel_t; +typedef struct igt_matrix_3x4 { + /* + * out matrix in + * |R| |0 1 2 3 | | R | + * |G| = |4 5 6 7 | x | G | + * |B| |8 9 10 12| | B |
Typo here? 11 instead of 12 above
PATCH v10 12/30 tests/kms_colorop: Add 3x4 CTM tests
In reply to Alex HungFrom: Harry Wentland <[email protected]>
Add 3x4 CTM test for color pipeline API.
--- tests/kms_colorop.c | 42 +++++++++++++++++++++++++++++------------- tests/kms_colorop.h | 39 ++++++++++++++++++++++++++++++++++++++- 2 files changed, 67 insertions(+), 14 deletions(-)
tests/kms_colorop.c +29 -13
@@ -40,9 +40,16 @@* * arg[1]: * -* @srgb_eotf: sRGB EOTF -* @srgb_inv_eotf: sRGB Inverse EOTF -* @srgb_eotf-srgb_inv_eotf: sRGB EOTF -> sRGB Inverse EOTF +* @srgb_eotf: sRGB EOTF +* @srgb_inv_eotf: sRGB Inverse EOTF +* @srgb_eotf-srgb_inv_eotf: sRGB EOTF -> sRGB Inverse EOTF +* @ctm_3x4_50_desat: 3x4 matrix doing a 50% desaturation +* @ctm_3x4_overdrive: 3x4 matrix overdring all values by 50% +* @ctm_3x4_oversaturate: 3x4 matrix oversaturating values +* @ctm_3x4_bt709_enc: BT709 encoding matrix +* @ctm_3x4_bt709_dec: BT709 decoding matrix +* @ctm_3x4_bt709_enc_dec: BT709 encoding matrix, followed by decoding matrix +* @ctm_3x4_bt709_dec_enc: BT709 decoding matrix, followed by encoding matrix * */
@@ -181,10 +188,10 @@ static bool can_use_colorop(igt_display_t *display, igt_colorop_t *colorop, kms_ {switch (desired->type) {case KMS_COLOROP_ENUMERATED_LUT1D : -if (igt_colorop_get_prop (display, colorop,IGT_COLOROP_TYPE ) ==DRM_COLOROP_1D_CURVE ) -return true; +return (igt_colorop_get_prop (display, colorop,IGT_COLOROP_TYPE ) ==DRM_COLOROP_1D_CURVE ); +case KMS_COLOROP_CTM_3X4 : +return (igt_colorop_get_prop (display, colorop,IGT_COLOROP_TYPE ) ==DRM_COLOROP_CTM_3X4 );case KMS_COLOROP_CUSTOM_LUT1D : -case KMS_COLOROP_CTM :case KMS_COLOROP_LUT3D :default :return false;
@@ -204,13 +211,15 @@ static bool map_to_pipeline(igt_display_t *display,int i =0 ;int prop_val =0 ; - current_op = colorops[i++]; + current_op = colorops[i]; + i++;igt_require (current_op);while (next) {if (can_use_colorop (display, next, current_op)) { current_op->colorop = next; - current_op = colorops[i++]; + current_op = colorops[i]; + i++;if (!current_op)break ; }
@@ -272,8 +281,10 @@ static void set_colorop(igt_display_t *display,igt_fail (IGT_EXIT_FAILURE ); }break ; +case KMS_COLOROP_CTM_3X4 : +igt_colorop_set_ctm_3x4 (display, colorop->colorop, colorop->matrix_3x4); +break ;case KMS_COLOROP_CUSTOM_LUT1D : -case KMS_COLOROP_CTM :case KMS_COLOROP_LUT3D :default :igt_fail (IGT_EXIT_FAILURE );
@@ -330,9 +341,7 @@ static bool compare_with_bracket(igt_fb_t *in, igt_fb_t *out)#define DUMP_FBS 1 -#define MAX_COLOROPS 3 -#define NUM_COLOROP_TESTS 3 -#define MAX_NAME_SIZE 256 +#define MAX_COLOROPS 5static void apply_transforms (kms_colorop_t *colorops[],igt_fb_t *sw_transform_fb) {
@@ -469,7 +478,14 @@ igt_main } tests[] = { { { &kms_colorop_srgb_eotf, NULL }, "srgb_eotf" }, { { &kms_colorop_srgb_inv_eotf, NULL }, "srgb_inv_eotf" }, - { { &kms_colorop_srgb_eotf, &kms_colorop_srgb_inv_eotf, NULL }, "srgb_eotf-srgb_inv_eotf" } + { { &kms_colorop_srgb_eotf, &kms_colorop_srgb_inv_eotf, NULL }, "srgb_eotf-srgb_inv_eotf" }, + { { &kms_colorop_ctm_3x4_50_desat, NULL }, "ctm_3x4_50_desat" }, + { { &kms_colorop_ctm_3x4_overdrive, NULL }, "ctm_3x4_overdrive" }, + { { &kms_colorop_ctm_3x4_oversaturate, NULL }, "ctm_3x4_oversaturate" }, + { { &kms_colorop_ctm_3x4_bt709_enc, NULL }, "ctm_3x4_bt709_enc" }, + { { &kms_colorop_ctm_3x4_bt709_dec, NULL }, "ctm_3x4_bt709_dec" }, + { { &kms_colorop_ctm_3x4_bt709_enc, &kms_colorop_ctm_3x4_bt709_dec, NULL }, "ctm_3x4_bt709_enc_dec" }, + { { &kms_colorop_ctm_3x4_bt709_dec, &kms_colorop_ctm_3x4_bt709_enc, NULL }, "ctm_3x4_bt709_dec_enc" }, }; igt_display_t display;
tests/kms_colorop.h +38 -1
@@ -36,7 +36,7 @@ typedef int (*transform_pixel)(igt_pixel_t *pixel);typedef enum kms_colorop_type {KMS_COLOROP_ENUMERATED_LUT1D ,KMS_COLOROP_CUSTOM_LUT1D , -KMS_COLOROP_CTM , +KMS_COLOROP_CTM_3X4 ,KMS_COLOROP_LUT3D }kms_colorop_type_t ;
@@ -56,6 +56,7 @@ typedef struct kms_colorop {union {kms_colorop_enumerated_lut1d_info_t enumerated_lut1d_info; +const igt_matrix_3x4_t *matrix_3x4; };const char *name;
@@ -85,4 +86,40 @@ kms_colorop_t kms_colorop_srgb_inv_eotf = { .transform = &igt_color_srgb_inv_eotf }; +kms_colorop_t kms_colorop_ctm_3x4_50_desat = { + .type =KMS_COLOROP_CTM_3X4 , + .matrix_3x4 = &igt_matrix_3x4_50_desat, + .name ="ctm_3x4_50_desat" , + .transform = &igt_color_ctm_3x4_50_desat +}; + +kms_colorop_t kms_colorop_ctm_3x4_overdrive = { + .type =KMS_COLOROP_CTM_3X4 , + .matrix_3x4 = &igt_matrix_3x4_overdrive, + .name ="ctm_3x4_overdrive" , + .transform = &igt_color_ctm_3x4_overdrive +}; + +kms_colorop_t kms_colorop_ctm_3x4_oversaturate = { + .type =KMS_COLOROP_CTM_3X4 , + .matrix_3x4 = &igt_matrix_3x4_oversaturate, + .name ="ctm_3x4_oversaturate" , + .transform = &igt_color_ctm_3x4_oversaturate +}; + +kms_colorop_t kms_colorop_ctm_3x4_bt709_enc = { + .type =KMS_COLOROP_CTM_3X4 , + .matrix_3x4 = &igt_matrix_3x4_bt709_enc, + .name ="ctm_3x4_bt709_enc" , + .transform = &igt_color_ctm_3x4_bt709_enc +}; + +kms_colorop_t kms_colorop_ctm_3x4_bt709_dec = { + .type =KMS_COLOROP_CTM_3X4 , + .matrix_3x4 = &igt_matrix_3x4_bt709_dec, + .name ="ctm_3x4_bt709_dec" , + .transform = &igt_color_ctm_3x4_bt709_dec +}; + +#endif /* __KMS_COLOROP_H__ */
Signature · 1 line
2.43.0
PATCH v10 13/30 tests/kms_colorop: Add bypass test
In reply to Alex HungFrom: Harry Wentland <[email protected]>
We want to test that setting the color pipeline to bypass yields the expected results.
--- tests/kms_colorop.c | 66 +++++++++++++++++++++++++++++++-------------- 1 file changed, 46 insertions(+), 20 deletions(-)
tests/kms_colorop.c +46 -20
@@ -31,7 +31,7 @@* Category: Display * Description: Test to validate the retrieving and setting of DRM colorops * -* SUBTEST: plane-%s +* SUBTEST: plane-%s-%s * Description: Tests DRM colorop properties on a plane * Driver requirement: amdgpu * Functionality: kms_core
@@ -40,6 +40,11 @@* * arg[1]: * +* @XR24-XR24: XRGB8888 framebuffer and writeback buffer +* +* arg[2]: +* +* @bypass: Bypass Color Pipeline * @srgb_eotf: sRGB EOTF * @srgb_inv_eotf: sRGB Inverse EOTF * @srgb_eotf-srgb_inv_eotf: sRGB EOTF -> sRGB Inverse EOTF
@@ -55,11 +60,12 @@/* TODO move to lib for kms_writeback and kms_colorop (and other future) use */ static bool check_writeback_config (igt_display_t *display,igt_output_t *output, -drmModeModeInfo override_mode) +drmModeModeInfo override_mode,__u32 fourcc_in, +__u32 fourcc_out) {igt_fb_t input_fb, output_fb;igt_plane_t *plane; -uint32_t writeback_format =DRM_FORMAT_XRGB8888 ; +uint32_t writeback_format = fourcc_out;uint64_t modifier =DRM_FORMAT_MOD_LINEAR ;int width, height, ret;
@@ -69,7 +75,7 @@ static bool check_writeback_config(igt_display_t *display, igt_output_t *output, height = override_mode.vdisplay; ret =igt_create_fb (display->drm_fd, width, height, -DRM_FORMAT_XRGB8888 , modifier, &input_fb); + fourcc_in, modifier, &input_fb);igt_assert (ret >=0 ); ret = igt_create_fb(display->drm_fd, width, height,
@@ -102,7 +108,7 @@ typedef struct {static data_t data;/* TODO move to lib for kms_writeback and kms_colorop (and other future) use */ -static igt_output_t *kms_writeback_get_output (igt_display_t *display) +static igt_output_t *kms_writeback_get_output (igt_display_t *display,__u32 fourcc_in,__u32 fourcc_out) {int i;enum pipe pipe;
@@ -138,7 +144,7 @@ static igt_output_t *kms_writeback_get_output(igt_display_t *display)if (data.builtin_mode) override_mode = output->config.connector->modes[data.mode_index]; -if (check_writeback_config (display, output, override_mode)) { +if (check_writeback_config (display, output, override_mode, fourcc_in, fourcc_out)) {igt_debug ("Using connector %u:%s on pipe %d\n" , output->config.connector->connector_id, output->name, pipe);
@@ -355,6 +361,8 @@ static void apply_transforms(kms_colorop_t *colorops[], igt_fb_t *sw_transform_f }static void colorop_plane_test (igt_display_t *display, +__u32 fourcc_in, +__u32 fourcc_out,kms_colorop_t *colorops[]) {igt_colorop_t *color_pipeline =NULL ;
@@ -367,7 +375,7 @@ static void colorop_plane_test(igt_display_t *display,unsigned int fb_id;igt_crc_t input_crc, output_crc; - output =kms_writeback_get_output (display); + output =kms_writeback_get_output (display, fourcc_in, fourcc_out);igt_require (output);if (output->use_override_mode)
@@ -381,7 +389,7 @@ static void colorop_plane_test(igt_display_t *display, fb_id =igt_create_color_pattern_fb (display->drm_fd, mode.hdisplay, mode.vdisplay, -DRM_FORMAT_XRGB8888 ,DRM_FORMAT_MOD_LINEAR , + fourcc_in,DRM_FORMAT_MOD_LINEAR ,0.2 ,0.2 ,0.2 , &input_fb);igt_assert (fb_id >=0 );igt_plane_set_fb (plane, &input_fb);
@@ -391,7 +399,7 @@ static void colorop_plane_test(igt_display_t *display,/* create output fb */ fb_id =igt_create_fb (display->drm_fd, mode.hdisplay, mode.vdisplay, -DRM_FORMAT_XRGB8888 , + fourcc_in,igt_fb_mod_to_tiling (0 ), &output_fb);igt_require (fb_id >0 );
@@ -429,13 +437,18 @@ static void colorop_plane_test(igt_display_t *display,#endif /* discover and set COLOR PIPELINE */ -/* get COLOR_PIPELINE enum */ - color_pipeline =get_color_pipeline (display, plane, colorops); +if (!colorops[0 ]) { +/* bypass test */ +set_color_pipeline_bypass (plane); + }else { +/* get COLOR_PIPELINE enum */ + color_pipeline =get_color_pipeline (display, plane, colorops); -/* skip test if we can't find applicable pipeline */ -igt_skip_on (!color_pipeline); +/* skip test if we can't find applicable pipeline */ +igt_skip_on (!color_pipeline); -set_color_pipeline (display, plane, colorops, color_pipeline); +set_color_pipeline (display, plane, colorops, color_pipeline); + }igt_output_set_writeback_fb (output, &output_fb);
@@ -476,6 +489,7 @@ igt_mainkms_colorop_t *colorops[MAX_COLOROPS ];const char *name; } tests[] = { + { { NULL }, "bypass" }, { { &kms_colorop_srgb_eotf, NULL }, "srgb_eotf" }, { { &kms_colorop_srgb_inv_eotf, NULL }, "srgb_inv_eotf" }, { { &kms_colorop_srgb_eotf, &kms_colorop_srgb_inv_eotf, NULL }, "srgb_eotf-srgb_inv_eotf" },
@@ -488,8 +502,16 @@ igt_main { { &kms_colorop_ctm_3x4_bt709_dec, &kms_colorop_ctm_3x4_bt709_enc, NULL }, "ctm_3x4_bt709_dec_enc" }, }; + struct { + __u32 fourcc_in; + __u32 fourcc_out; + const char *name; + } formats[] = { + { DRM_FORMAT_XRGB8888, DRM_FORMAT_XRGB8888, "XR24-XR24" }, + }; + igt_display_t display; - int i, ret; + int i, j, ret; igt_fixture { display.drm_fd = drm_open_driver_master(DRIVER_ANY);
@@ -511,12 +533,16 @@ igt_main } -for (i =0 ; i <ARRAY_SIZE (tests); i++) { -igt_describe ("Check color ops on a plane" ); - igt_subtest_f("plane-%s", tests[i].name) -colorop_plane_test (&display, tests[i].colorops); +for (j =0 ; j <ARRAY_SIZE (formats); j++) { +for (i =0 ; i <ARRAY_SIZE (tests); i++) { +igt_describe ("Check color ops on a plane" ); + igt_subtest_f("plane-%s-%s", formats[j].name, tests[i].name) +colorop_plane_test (&display, + formats[j].fourcc_in, + formats[j].fourcc_out, + tests[i].colorops); + } } -igt_describe ("Tests getting and setting COLOR_PIPELINE property on plane" ); igt_fixture {igt_display_fini (&display);
Signature · 1 line
2.43.0
PATCH v10 14/30 tests/kms_colorop: Add 10bpc test
In reply to Alex HungFrom: Harry Wentland <[email protected]>
Support DRM_FORMAT_XRGB2101010 color format, and skip if it is not supported.
--- tests/kms_colorop.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-)
tests/kms_colorop.c +6 -1
@@ -41,6 +41,7 @@* arg[1]: * * @XR24-XR24: XRGB8888 framebuffer and writeback buffer +* @XR30-XR30: XRGB2101010 framebuffer and writeback buffer * * arg[2]: *
@@ -74,6 +75,10 @@ static bool check_writeback_config(igt_display_t *display, igt_output_t *output, width = override_mode.hdisplay; height = override_mode.vdisplay; + plane =igt_output_get_plane_type (output,DRM_PLANE_TYPE_PRIMARY ); +igt_skip_on_f (!igt_plane_has_format_mod (plane, fourcc_in,DRM_FORMAT_MOD_LINEAR ), +"plane doesn't support fourcc format %x\n" , fourcc_in); + ret =igt_create_fb (display->drm_fd, width, height, fourcc_in, modifier, &input_fb);igt_assert (ret >=0 );
@@ -82,7 +87,6 @@ static bool check_writeback_config(igt_display_t *display, igt_output_t *output, writeback_format, modifier, &output_fb);igt_assert (ret >=0 ); - plane =igt_output_get_plane_type (output,DRM_PLANE_TYPE_PRIMARY );igt_plane_set_fb (plane, &input_fb);igt_output_set_writeback_fb (output, &output_fb);
@@ -508,6 +512,7 @@ igt_mainconst char *name; } formats[] = { { DRM_FORMAT_XRGB8888, DRM_FORMAT_XRGB8888, "XR24-XR24" }, + { DRM_FORMAT_XRGB2101010, DRM_FORMAT_XRGB2101010, "XR30-XR30" }, }; igt_display_t display;
Signature · 1 line
2.43.0
PATCH v10 15/30 tests/kms_colorop: Skip if writeback does not support fourcc
In reply to Alex HungFrom: Harry Wentland <[email protected]>
Writeback is used by kms_colorop so skip tests if it doesn't support specific color formats.
--- tests/kms_colorop.c | 15 +++++++++++++++ 1 file changed, 15 insertions(+)
tests/kms_colorop.c +15 -0
@@ -69,6 +69,10 @@ static bool check_writeback_config(igt_display_t *display, igt_output_t *output,uint32_t writeback_format = fourcc_out;uint64_t modifier =DRM_FORMAT_MOD_LINEAR ;int width, height, ret; +drmModePropertyBlobRes *wb_formats_blob; +int i; +__u32 *format; +bool found_format = false;igt_output_override_mode (output, &override_mode);
@@ -83,6 +87,17 @@ static bool check_writeback_config(igt_display_t *display, igt_output_t *output, fourcc_in, modifier, &input_fb);igt_assert (ret >=0 ); +/* check writeback formats */ + wb_formats_blob =igt_get_writeback_formats_blob (output); + format = wb_formats_blob->data; + +for (i =0 ; i < wb_formats_blob->length /4 ; i++) +if (fourcc_out == format[i]) + found_format = true; + +igt_skip_on_f (!found_format, +"writeback doesn't support fourcc format %x\n" , fourcc_out); + ret =igt_create_fb (display->drm_fd, width, height, writeback_format, modifier, &output_fb);igt_assert (ret >=0 );
Signature · 1 line
2.43.0
PATCH v10 16/30 lib/igt_fb: Allow any non-planar format for igt_copy_fb
In reply to Alex HungFrom: Harry Wentland <[email protected]>
The function is able to handle any non-planar format. It's been tested for XRGB8888 and XRGB2101010 so far but should work for a wider range of formats.
--- lib/igt_fb.c | 4 -- tests/kms_colorop.c | 138 +++++++++++++++++++++++++------------------- 2 files changed, 78 insertions(+), 64 deletions(-)
lib/igt_fb.c +0 -4
@@ -2182,10 +2182,6 @@ unsigned int igt_copy_fb(int fd, struct igt_fb *src, struct igt_fb *fb)if (src->num_planes !=1 )return -EINVAL ; -/* TODO expand for other formats */ -if (src->drm_format !=DRM_FORMAT_XRGB8888 ) -return -EINVAL ; - fb_id =igt_create_fb (fd, src->width, src->height, src->drm_format, src->modifier, fb);
tests/kms_colorop.c +78 -60
208 lines not on this page · raw message
Signature · 1 line
2.43.0
Re: [PATCH V10 16/30] lib/igt_fb: Allow any non-planar format for igt_copy_fb
Hi Alex,
Quoted 10 lines · Alex Hung
From: Harry Wentland <[email protected]>
The function is able to handle any non-planar format. It's been tested for XRGB8888 and XRGB2101010 so far but should work for a wider range of formats.
Signed-off-by Alex Hung <[email protected]>Signed-off-by Harry Wentland <[email protected]>--- lib/igt_fb.c | 4 --
Please split this patch into lib change and test. Also imho lib change could be squashed into first igt_copy_fb()
+cc Karthik
Regards,
Kamil
Quoted 238 lines
tests/kms_colorop.c | 138 +++++++++++++++++++++++++------------------- 2 files changed, 78 insertions(+), 64 deletions(-)lib/igt_fb.c +0
-4@@ -2182,10 +2182,6 @@ unsigned int igt_copy_fb(int fd, struct igt_fb *src, struct igt_fb *fb)if (src->num_planes !=1 )return -EINVAL ; -/* TODO expand for other formats */ -if (src->drm_format !=DRM_FORMAT_XRGB8888 ) -return -EINVAL ; - fb_id =igt_create_fb (fd, src->width, src->height, src->drm_format, src->modifier, fb);tests/kms_colorop.c +78
-60@@ -380,60 +380,28 @@ static void apply_transforms(kms_colorop_t *colorops[], igt_fb_t *sw_transform_f }static void colorop_plane_test (igt_display_t *display, +igt_output_t *output, +igt_plane_t *plane, +igt_fb_t *input_fb, +igt_fb_t *output_fb,__u32 fourcc_in,__u32 fourcc_out,kms_colorop_t *colorops[]) {igt_colorop_t *color_pipeline =NULL ; -igt_output_t *output; -igt_plane_t *plane; -igt_fb_t input_fb;igt_fb_t sw_transform_fb; -igt_fb_t output_fb; -drmModeModeInfo mode; -unsigned int fb_id;igt_crc_t input_crc, output_crc; +int res; - output =kms_writeback_get_output (display, fourcc_in, fourcc_out); -igt_require (output); - -if (output->use_override_mode) -memcpy (&mode, &output->override_mode,sizeof (mode)); -else -memcpy (&mode, &output->config.default_mode,sizeof (mode)); - -/* create input fb */ - plane =igt_output_get_plane_type (output,DRM_PLANE_TYPE_PRIMARY ); -igt_assert (plane); - - fb_id =igt_create_color_pattern_fb (display->drm_fd, - mode.hdisplay, mode.vdisplay, - fourcc_in,DRM_FORMAT_MOD_LINEAR , -0.2 ,0.2 ,0.2 , &input_fb); -igt_assert (fb_id >=0 ); -igt_plane_set_fb (plane, &input_fb); -#if DUMP_FBS -igt_dump_fb (display, &input_fb,"." ,"input" ); -#endif - -/* create output fb */ - fb_id =igt_create_fb (display->drm_fd, mode.hdisplay, mode.vdisplay, - fourcc_in, -igt_fb_mod_to_tiling (0 ), - &output_fb); -igt_require (fb_id >0 ); - -igt_fb_get_fnv1a_crc (&input_fb, &input_crc); - -igt_require (igt_plane_has_prop (plane,IGT_PLANE_COLOR_PIPELINE )); +igt_fb_get_fnv1a_crc (input_fb, &input_crc);/* reset color pipeline*/ set_color_pipeline_bypass (plane);/* Commit */ -igt_plane_set_fb (plane, &input_fb); -igt_output_set_writeback_fb (output, &output_fb); +igt_plane_set_fb (plane, input_fb); +igt_output_set_writeback_fb (output, output_fb); igt_display_commit_atomic(output->display, DRM_MODE_ATOMIC_ALLOW_MODESET,@@ -441,14 +409,15 @@ static void colorop_plane_test(igt_display_t *display,get_and_wait_out_fence (output);/* Compare input and output buffers. They should be equal here. */ -igt_fb_get_fnv1a_crc (&output_fb, &output_crc); +igt_fb_get_fnv1a_crc (output_fb, &output_crc);igt_assert_crc_equal (&input_crc, &output_crc);/* create sw transformed buffer */ + res =igt_copy_fb (display->drm_fd, input_fb, &sw_transform_fb); +igt_assert_lte (0 , res); -igt_copy_fb (display->drm_fd, &input_fb, &sw_transform_fb); -igt_assert (igt_cmp_fb_pixels (&input_fb, &sw_transform_fb,0 ,0 )); +igt_assert (igt_cmp_fb_pixels (input_fb, &sw_transform_fb,0 ,0 ));apply_transforms (colorops, &sw_transform_fb);#if DUMP_FBS @@ -469,7 +438,7 @@ static void colorop_plane_test(igt_display_t *display,set_color_pipeline (display, plane, colorops, color_pipeline); } -igt_output_set_writeback_fb (output, &output_fb); +igt_output_set_writeback_fb (output, output_fb);/* commit COLOR_PIPELINE */ igt_display_commit_atomic(display,@@ -477,28 +446,24 @@ static void colorop_plane_test(igt_display_t *display, NULL);get_and_wait_out_fence (output);#if DUMP_FBS -igt_dump_fb (display, &output_fb,"." ,"output" ); +igt_dump_fb (display, output_fb,"." ,"output" );#endif /* compare sw transformed and KMS transformed FBs */ -igt_assert (compare_with_bracket (&sw_transform_fb, &output_fb)); +igt_assert (compare_with_bracket (&sw_transform_fb, output_fb));/* reset color pipeline*/ set_color_pipeline_bypass (plane);/* Commit */ -igt_plane_set_fb (plane, &input_fb); -igt_output_set_writeback_fb (output, &output_fb); +igt_plane_set_fb (plane, input_fb); +igt_output_set_writeback_fb (output, output_fb);igt_display_commit_atomic (output->display,DRM_MODE_ATOMIC_ALLOW_MODESET ,NULL );get_and_wait_out_fence (output); -/* cleanup */ -detach_crtc (display, output); -igt_remove_fb (display->drm_fd, &input_fb); -igt_remove_fb (display->drm_fd, &output_fb); } igt_main@@ -550,21 +515,74 @@ igt_mainigt_display_require (&display, display.drm_fd);igt_require (display.is_atomic); - }for (j =0 ; j <ARRAY_SIZE (formats); j++) { -for (i =0 ; i <ARRAY_SIZE (tests); i++) { -igt_describe ("Check color ops on a plane" ); - igt_subtest_f("plane-%s-%s", formats[j].name, tests[i].name) -colorop_plane_test (&display, - formats[j].fourcc_in, - formats[j].fourcc_out, - tests[i].colorops); +igt_output_t *output; +igt_plane_t *plane; +igt_fb_t input_fb, output_fb; +unsigned int fb_id; +drmModeModeInfo mode; + + igt_subtest_group { + igt_fixture { + output =kms_writeback_get_output (&display, + formats[j].fourcc_in, + formats[j].fourcc_out); +igt_require (output); + +if (output->use_override_mode) +memcpy (&mode, &output->override_mode,sizeof (mode)); +else +memcpy (&mode, &output->config.default_mode,sizeof (mode)); + +/* create input fb */ + plane =igt_output_get_plane_type (output,DRM_PLANE_TYPE_PRIMARY ); +igt_assert (plane); +igt_require (igt_plane_has_prop (plane,IGT_PLANE_COLOR_PIPELINE )); + + fb_id =igt_create_color_pattern_fb (display.drm_fd, + mode.hdisplay, mode.vdisplay, + formats[j].fourcc_in,DRM_FORMAT_MOD_LINEAR , +0.2 ,0.2 ,0.2 , &input_fb); +igt_assert (fb_id >=0 ); +igt_plane_set_fb (plane, &input_fb); +#if DUMP_FBS +igt_dump_fb (&display, &input_fb,"." ,"input" ); +#endif + +/* create output fb */ + fb_id =igt_create_fb (display.drm_fd, mode.hdisplay, mode.vdisplay, + formats[j].fourcc_in, +igt_fb_mod_to_tiling (0 ), + &output_fb); +igt_require (fb_id >0 ); + } + +for (i =0 ; i <ARRAY_SIZE (tests); i++) { +igt_describe ("Check color ops on a plane" ); + igt_subtest_f("plane-%s-%s", formats[j].name, tests[i].name) +colorop_plane_test (&display, + output, + plane, + &input_fb, + &output_fb, + formats[j].fourcc_in, + formats[j].fourcc_out, + tests[i].colorops); + } + + igt_fixture { +detach_crtc (&display, output); +igt_remove_fb (display.drm_fd, &input_fb); +igt_remove_fb (display.drm_fd, &output_fb); + + } } }igt_describe ("Tests getting and setting COLOR_PIPELINE property on plane" ); igt_fixture {igt_display_fini (&display); +drm_close_driver (display.drm_fd); } }Signature · 1 line
2.43.0
Re: [PATCH V10 16/30] lib/igt_fb: Allow any non-planar format for igt_copy_fb
Hi Alex,
Quoted 8 lines · Kamil Konieczny
Hi Alex,
Quoted 6 lines · Alex Hung
From: Harry Wentland <[email protected]>
The function is able to handle any non-planar format. It's been tested for XRGB8888 and XRGB2101010 so far but should work for a wider range of formats.
Quoted 8 lines
Quoted 4 lines
Signed-off-by Alex Hung <[email protected]>Signed-off-by Harry Wentland <[email protected]>--- lib/igt_fb.c | 4 --Please split this patch into lib change and test. Also imho lib change could be squashed into first
igt_copy_fb()+cc Karthik
Yes I agree with both the changes suggested above.
Regards,Karthik.B.S
Quoted 242 lines
Regards,
KamilQuoted 238 lines
tests/kms_colorop.c | 138 +++++++++++++++++++++++++------------------- 2 files changed, 78 insertions(+), 64 deletions(-)lib/igt_fb.c +0
-4@@ -2182,10 +2182,6 @@ unsigned int igt_copy_fb(int fd, struct igt_fb *src, struct igt_fb *fb)if (src->num_planes !=1 )return -EINVAL ; -/* TODO expand for other formats */ -if (src->drm_format !=DRM_FORMAT_XRGB8888 ) -return -EINVAL ; - fb_id =igt_create_fb (fd, src->width, src->height, src->drm_format, src->modifier, fb);tests/kms_colorop.c +78
-60@@ -380,60 +380,28 @@ static void apply_transforms(kms_colorop_t *colorops[], igt_fb_t *sw_transform_f }static void colorop_plane_test (igt_display_t *display, +igt_output_t *output, +igt_plane_t *plane, +igt_fb_t *input_fb, +igt_fb_t *output_fb,__u32 fourcc_in,__u32 fourcc_out,kms_colorop_t *colorops[]) {igt_colorop_t *color_pipeline =NULL ; -igt_output_t *output; -igt_plane_t *plane; -igt_fb_t input_fb;igt_fb_t sw_transform_fb; -igt_fb_t output_fb; -drmModeModeInfo mode; -unsigned int fb_id;igt_crc_t input_crc, output_crc; +int res; - output =kms_writeback_get_output (display, fourcc_in, fourcc_out); -igt_require (output); - -if (output->use_override_mode) -memcpy (&mode, &output->override_mode,sizeof (mode)); -else -memcpy (&mode, &output->config.default_mode,sizeof (mode)); - -/* create input fb */ - plane =igt_output_get_plane_type (output,DRM_PLANE_TYPE_PRIMARY ); -igt_assert (plane); - - fb_id =igt_create_color_pattern_fb (display->drm_fd, - mode.hdisplay, mode.vdisplay, - fourcc_in,DRM_FORMAT_MOD_LINEAR , -0.2 ,0.2 ,0.2 , &input_fb); -igt_assert (fb_id >=0 ); -igt_plane_set_fb (plane, &input_fb); -#if DUMP_FBS -igt_dump_fb (display, &input_fb,"." ,"input" ); -#endif - -/* create output fb */ - fb_id =igt_create_fb (display->drm_fd, mode.hdisplay, mode.vdisplay, - fourcc_in, -igt_fb_mod_to_tiling (0 ), - &output_fb); -igt_require (fb_id >0 ); - -igt_fb_get_fnv1a_crc (&input_fb, &input_crc); - -igt_require (igt_plane_has_prop (plane,IGT_PLANE_COLOR_PIPELINE )); +igt_fb_get_fnv1a_crc (input_fb, &input_crc);/* reset color pipeline*/ set_color_pipeline_bypass (plane);/* Commit */ -igt_plane_set_fb (plane, &input_fb); -igt_output_set_writeback_fb (output, &output_fb); +igt_plane_set_fb (plane, input_fb); +igt_output_set_writeback_fb (output, output_fb); igt_display_commit_atomic(output->display, DRM_MODE_ATOMIC_ALLOW_MODESET,@@ -441,14 +409,15 @@ static void colorop_plane_test(igt_display_t *display,get_and_wait_out_fence (output);/* Compare input and output buffers. They should be equal here. */ -igt_fb_get_fnv1a_crc (&output_fb, &output_crc); +igt_fb_get_fnv1a_crc (output_fb, &output_crc);igt_assert_crc_equal (&input_crc, &output_crc);/* create sw transformed buffer */ + res =igt_copy_fb (display->drm_fd, input_fb, &sw_transform_fb); +igt_assert_lte (0 , res); -igt_copy_fb (display->drm_fd, &input_fb, &sw_transform_fb); -igt_assert (igt_cmp_fb_pixels (&input_fb, &sw_transform_fb,0 ,0 )); +igt_assert (igt_cmp_fb_pixels (input_fb, &sw_transform_fb,0 ,0 ));apply_transforms (colorops, &sw_transform_fb);#if DUMP_FBS @@ -469,7 +438,7 @@ static void colorop_plane_test(igt_display_t *display,set_color_pipeline (display, plane, colorops, color_pipeline); } -igt_output_set_writeback_fb (output, &output_fb); +igt_output_set_writeback_fb (output, output_fb);/* commit COLOR_PIPELINE */ igt_display_commit_atomic(display,@@ -477,28 +446,24 @@ static void colorop_plane_test(igt_display_t *display, NULL);get_and_wait_out_fence (output);#if DUMP_FBS -igt_dump_fb (display, &output_fb,"." ,"output" ); +igt_dump_fb (display, output_fb,"." ,"output" );#endif /* compare sw transformed and KMS transformed FBs */ -igt_assert (compare_with_bracket (&sw_transform_fb, &output_fb)); +igt_assert (compare_with_bracket (&sw_transform_fb, output_fb));/* reset color pipeline*/ set_color_pipeline_bypass (plane);/* Commit */ -igt_plane_set_fb (plane, &input_fb); -igt_output_set_writeback_fb (output, &output_fb); +igt_plane_set_fb (plane, input_fb); +igt_output_set_writeback_fb (output, output_fb);igt_display_commit_atomic (output->display,DRM_MODE_ATOMIC_ALLOW_MODESET ,NULL );get_and_wait_out_fence (output); -/* cleanup */ -detach_crtc (display, output); -igt_remove_fb (display->drm_fd, &input_fb); -igt_remove_fb (display->drm_fd, &output_fb); } igt_main@@ -550,21 +515,74 @@ igt_mainigt_display_require (&display, display.drm_fd);igt_require (display.is_atomic); - }for (j =0 ; j <ARRAY_SIZE (formats); j++) { -for (i =0 ; i <ARRAY_SIZE (tests); i++) { -igt_describe ("Check color ops on a plane" ); - igt_subtest_f("plane-%s-%s", formats[j].name, tests[i].name) -colorop_plane_test (&display, - formats[j].fourcc_in, - formats[j].fourcc_out, - tests[i].colorops); +igt_output_t *output; +igt_plane_t *plane; +igt_fb_t input_fb, output_fb; +unsigned int fb_id; +drmModeModeInfo mode; + + igt_subtest_group { + igt_fixture { + output =kms_writeback_get_output (&display, + formats[j].fourcc_in, + formats[j].fourcc_out); +igt_require (output); + +if (output->use_override_mode) +memcpy (&mode, &output->override_mode,sizeof (mode)); +else +memcpy (&mode, &output->config.default_mode,sizeof (mode)); + +/* create input fb */ + plane =igt_output_get_plane_type (output,DRM_PLANE_TYPE_PRIMARY ); +igt_assert (plane); +igt_require (igt_plane_has_prop (plane,IGT_PLANE_COLOR_PIPELINE )); + + fb_id =igt_create_color_pattern_fb (display.drm_fd, + mode.hdisplay, mode.vdisplay, + formats[j].fourcc_in,DRM_FORMAT_MOD_LINEAR , +0.2 ,0.2 ,0.2 , &input_fb); +igt_assert (fb_id >=0 ); +igt_plane_set_fb (plane, &input_fb); +#if DUMP_FBS +igt_dump_fb (&display, &input_fb,"." ,"input" ); +#endif + +/* create output fb */ + fb_id =igt_create_fb (display.drm_fd, mode.hdisplay, mode.vdisplay, + formats[j].fourcc_in, +igt_fb_mod_to_tiling (0 ), + &output_fb); +igt_require (fb_id >0 ); + } + +for (i =0 ; i <ARRAY_SIZE (tests); i++) { +igt_describe ("Check color ops on a plane" ); + igt_subtest_f("plane-%s-%s", formats[j].name, tests[i].name) +colorop_plane_test (&display, + output, + plane, + &input_fb, + &output_fb, + formats[j].fourcc_in, + formats[j].fourcc_out, + tests[i].colorops); + } + + igt_fixture { +detach_crtc (&display, output); +igt_remove_fb (display.drm_fd, &input_fb); +igt_remove_fb (display.drm_fd, &output_fb); + + } } }igt_describe ("Tests getting and setting COLOR_PIPELINE property on plane" ); igt_fixture {igt_display_fini (&display); +drm_close_driver (display.drm_fd); } }Signature · 1 line
2.43.0
Re: [PATCH V10 16/30] lib/igt_fb: Allow any non-planar format for igt_copy_fb
Quoted 15 lines · Karthik B S
Hi Alex,
Quoted 12 lines · Kamil Konieczny
Hi Alex,
Quoted 10 lines · Alex Hung
From: Harry Wentland <[email protected]>
The function is able to handle any non-planar format. It's been tested for XRGB8888 and XRGB2101010 so far but should work for a wider range of formats.
Signed-off-by Alex Hung <[email protected]>Signed-off-by Harry Wentland <[email protected]>---
lib/igt_fb.c | 4 --
Quoted 6 lines
Quoted 4 lines
Please split this patch into lib change and test. Also imho lib change could be squashed into first
igt_copy_fb()+cc Karthik
Yes I agree with both the changes suggested above.
Thanks. I will move changes in igt_fb.c to where igt_copy_fb was introduced.
Quoted 237 lines
Regards,
Karthik.B.SQuoted 234 lines
Regards,
KamilQuoted 230 lines
tests/kms_colorop.c| 138 +++++++++++++++++++++++++-------------------2 files changed, 78 insertions(+), 64 deletions(-)lib/igt_fb.c +0
-4@@ -2182,10 +2182,6 @@ unsigned int igt_copy_fb(int fd, struct igt_fb *src, struct igt_fb *fb) if (src->num_planes != 1) return -EINVAL; - /* TODO expand for other formats */ - if (src->drm_format != DRM_FORMAT_XRGB8888) - return -EINVAL; -
fb_id= igt_create_fb(fd,src->width,src->height, src-Quoted 1 line
drm_format,
src->modifier, fb);tests/kms_colorop.c +17
-52@@ -380,60 +380,28 @@ static void apply_transforms(kms_colorop_t *colorops[], igt_fb_t *sw_transform_f } static void colorop_plane_test(igt_display_t *display, + igt_output_t *output, + igt_plane_t *plane, + igt_fb_t *input_fb, + igt_fb_t *output_fb, __u32 fourcc_in, __u32 fourcc_out, kms_colorop_t *colorops[]) { igt_colorop_t *color_pipeline = NULL; - igt_output_t *output; - igt_plane_t *plane; - igt_fb_t input_fb; igt_fb_t sw_transform_fb; - igt_fb_t output_fb; - drmModeModeInfo mode; - unsigned int fb_id; igt_crc_t input_crc, output_crc; + int res; - output = kms_writeback_get_output(display, fourcc_in, fourcc_out); - igt_require(output); - - if (output->use_override_mode) - memcpy(&mode, &output->override_mode, sizeof(mode)); - else - memcpy(&mode, &output->config.default_mode, sizeof(mode)); - - /* create input fb */ - plane = igt_output_get_plane_type(output, DRM_PLANE_TYPE_PRIMARY); - igt_assert(plane); - - fb_id = igt_create_color_pattern_fb(display->drm_fd, - mode.hdisplay, mode.vdisplay, - fourcc_in, DRM_FORMAT_MOD_LINEAR, - 0.2, 0.2, 0.2, &input_fb); - igt_assert(fb_id >= 0); - igt_plane_set_fb(plane, &input_fb); -#if DUMP_FBS - igt_dump_fb(display, &input_fb, ".", "input"); -#endif - - /* create output fb */ - fb_id = igt_create_fb(display->drm_fd, mode.hdisplay, mode.vdisplay, - fourcc_in, - igt_fb_mod_to_tiling(0), - &output_fb); - igt_require(fb_id > 0); - - igt_fb_get_fnv1a_crc(&input_fb, &input_crc); - - igt_require(igt_plane_has_prop(plane, IGT_PLANE_COLOR_PIPELINE)); + igt_fb_get_fnv1a_crc(input_fb, &input_crc); /* reset color pipeline*/ set_color_pipeline_bypass(plane); /* Commit */ - igt_plane_set_fb(plane, &input_fb); - igt_output_set_writeback_fb(output, &output_fb); + igt_plane_set_fb(plane, input_fb); + igt_output_set_writeback_fb(output, output_fb); igt_display_commit_atomic(output->display, DRM_MODE_ATOMIC_ALLOW_MODESET,@@ -441,14 +409,15 @@ static void colorop_plane_test(igt_display_t *display, get_and_wait_out_fence(output); /* Compare input and output buffers. They should be equal here. */ - igt_fb_get_fnv1a_crc(&output_fb, &output_crc); + igt_fb_get_fnv1a_crc(output_fb, &output_crc); igt_assert_crc_equal(&input_crc, &output_crc); /* create sw transformed buffer */ + res = igt_copy_fb(display->drm_fd, input_fb, &sw_transform_fb); + igt_assert_lte(0, res); - igt_copy_fb(display->drm_fd, &input_fb, &sw_transform_fb); - igt_assert(igt_cmp_fb_pixels(&input_fb, &sw_transform_fb, 0, 0)); + igt_assert(igt_cmp_fb_pixels(input_fb, &sw_transform_fb, 0, 0)); apply_transforms(colorops, &sw_transform_fb); #if DUMP_FBS@@ -469,7 +438,7 @@ static void colorop_plane_test(igt_display_t *display, set_color_pipeline(display, plane, colorops, color_pipeline); } - igt_output_set_writeback_fb(output, &output_fb); + igt_output_set_writeback_fb(output, output_fb); /* commit COLOR_PIPELINE */ igt_display_commit_atomic(display,@@ -477,28 +446,24 @@ static void colorop_plane_test(igt_display_t *display, NULL); get_and_wait_out_fence(output); #if DUMP_FBS - igt_dump_fb(display, &output_fb, ".", "output"); + igt_dump_fb(display, output_fb, ".", "output"); #endif /* compare sw transformed and KMS transformed FBs */ - igt_assert(compare_with_bracket(&sw_transform_fb, &output_fb)); + igt_assert(compare_with_bracket(&sw_transform_fb, output_fb)); /* reset color pipeline*/ set_color_pipeline_bypass(plane); /* Commit */ - igt_plane_set_fb(plane, &input_fb); - igt_output_set_writeback_fb(output, &output_fb); + igt_plane_set_fb(plane, input_fb); + igt_output_set_writeback_fb(output, output_fb); igt_display_commit_atomic(output->display, DRM_MODE_ATOMIC_ALLOW_MODESET, NULL); get_and_wait_out_fence(output); - /* cleanup */ - detach_crtc(display, output); - igt_remove_fb(display->drm_fd, &input_fb); - igt_remove_fb(display->drm_fd, &output_fb); }
igt_maintests/kms_colorop.c +60
-8@@ -550,21 +515,74 @@ igt_main igt_display_require(&display, display.drm_fd); igt_require(display.is_atomic); - } for (j = 0; j < ARRAY_SIZE(formats); j++) { - for (i = 0; i < ARRAY_SIZE(tests); i++) { - igt_describe("Check color ops on a plane"); - igt_subtest_f("plane-%s-%s", formats[j].name, tests[i].name) - colorop_plane_test(&display, - formats[j].fourcc_in, - formats[j].fourcc_out, - tests[i].colorops); + igt_output_t *output; + igt_plane_t *plane; + igt_fb_t input_fb, output_fb; + unsigned int fb_id; + drmModeModeInfo mode; + + igt_subtest_group { + igt_fixture { + output = kms_writeback_get_output(&display, + formats[j].fourcc_in, + formats[j].fourcc_out); + igt_require(output); + + if (output->use_override_mode) + memcpy(&mode, &output->override_mode,sizeof (mode)); + else + memcpy(&mode, &output->config.default_mode,sizeof (mode)); + + /* create input fb */ + plane = igt_output_get_plane_type(output,DRM_PLANE_TYPE_PRIMARY ); + igt_assert(plane); + igt_require(igt_plane_has_prop(plane,IGT_PLANE_COLOR_PIPELINE )); + + fb_id = igt_create_color_pattern_fb(display.drm_fd, + mode.hdisplay, mode.vdisplay, + formats[j].fourcc_in,DRM_FORMAT_MOD_LINEAR , + 0.2, 0.2, 0.2, &input_fb); + igt_assert(fb_id >= 0); + igt_plane_set_fb(plane, &input_fb); +#if DUMP_FBS + igt_dump_fb(&display, &input_fb, ".", "input"); +#endif + + /* create output fb */ + fb_id = igt_create_fb(display.drm_fd, mode.hdisplay, mode.vdisplay, + formats[j].fourcc_in, + igt_fb_mod_to_tiling(0), + &output_fb); + igt_require(fb_id > 0); + } + + for (i = 0; i < ARRAY_SIZE(tests); i++) { + igt_describe("Check color ops on a plane"); + igt_subtest_f("plane-%s-%s", formats[j].name, tests[i].name) + colorop_plane_test(&display, + output, + plane, + &input_fb, + &output_fb, + formats[j].fourcc_in, + formats[j].fourcc_out, + tests[i].colorops); + } + + igt_fixture { + detach_crtc(&display, output); + igt_remove_fb(display.drm_fd, &input_fb); + igt_remove_fb(display.drm_fd, &output_fb); + + } }}
igt_describe("Tests getting and setting COLOR_PIPELINE property on plane");igt_fixture{
igt_display_fini(&display);
+drm_close_driver(display.drm_fd);
}
}Signature · 1 line
2.43.0
PATCH v10 17/30 lib/igt_color: Support color transform for XRGB2101010
In reply to Alex HungFrom: Harry Wentland <[email protected]>
Support color format XRGB2101010.
--- lib/igt_color.c | 113 +++++++++++++++++++++++++++----------------- tests/kms_colorop.c | 3 ++ 2 files changed, 73 insertions(+), 43 deletions(-)
lib/igt_color.c +70 -43
@@ -132,6 +132,74 @@ void igt_color_ctm_3x4_bt709_dec(igt_pixel_t *pixel)igt_color_apply_3x4_ctm (pixel, &igt_matrix_3x4_bt709_dec); } +static void +igt_color_fourcc_to_pixel (uint32_t raw_pixel,uint32_t drm_format,igt_pixel_t *pixel) +{ +if (drm_format ==DRM_FORMAT_XRGB8888 ) { + raw_pixel &=0x00ffffff ; + + pixel->r = (raw_pixel &0x00ff0000 ) >>16 ; + pixel->g = (raw_pixel &0x0000ff00 ) >>8 ; + pixel->b = (raw_pixel &0x000000ff ); + +/* normalize for 8-bit */ + pixel->r /= (0xff ); + pixel->g /= (0xff ); + pixel->b /= (0xff ); + }else if (drm_format ==DRM_FORMAT_XRGB2101010 ) { + raw_pixel &=0x3fffffff ; + + pixel->r = (raw_pixel &0x3ff00000 ) >>20 ; + pixel->g = (raw_pixel &0x000ffc00 ) >>10 ; + pixel->b = (raw_pixel &0x000003ff ); + +/* normalize for 10-bit */ + pixel->r /= (0x3ff ); + pixel->g /= (0x3ff ); + pixel->b /= (0x3ff ); + }else { +igt_skip ("pixel format support not implemented" ); + } +} + +static uint32_t +igt_color_pixel_to_fourc (uint32_t drm_format,igt_pixel_t *pixel) +{ +uint32_t raw_pixel; + +/* clip */ + pixel->r =fmax (fmin (pixel->r,1.0 ),0.0 ); + pixel->g =fmax (fmin (pixel->g,1.0 ),0.0 ); + pixel->b =fmax (fmin (pixel->b,1.0 ),0.0 ); + +if (drm_format ==DRM_FORMAT_XRGB8888 ) { +/* de-normalize back to 8-bit */ + pixel->r *= (0xff ); + pixel->g *= (0xff ); + pixel->b *= (0xff ); + +/* re-pack pixel into FB*/ + raw_pixel =0x0 ; + raw_pixel |= ((uint8_t )(lround (pixel->r) &0xff )) <<16 ; + raw_pixel |= ((uint8_t )(lround (pixel->g) &0xff )) <<8 ; + raw_pixel |= ((uint8_t )(lround (pixel->b) &0xff )); + }else if (drm_format ==DRM_FORMAT_XRGB2101010 ) { +/* de-normalize back to 10-bit */ + pixel->r *= (0x3ff ); + pixel->g *= (0x3ff ); + pixel->b *= (0x3ff ); + +/* re-pack pixel into FB*/ + raw_pixel =0x0 ; + raw_pixel |= (lround (pixel->r) &0x3ff ) <<20 ; + raw_pixel |= (lround (pixel->g) &0x3ff ) <<10 ; + raw_pixel |= (lround (pixel->b) &0x3ff ); + }else { +igt_skip ("pixel format support not implemented" ); + } + +return raw_pixel; +}int igt_color_transform_pixels (igt_fb_t *fb,igt_pixel_transform transforms[],int num_transforms) {
@@ -144,10 +212,6 @@ int igt_color_transform_pixels(igt_fb_t *fb, igt_pixel_transform transforms[], iif (fb->num_planes !=1 )return -EINVAL ; -/* TODO expand for other formats */ -if (fb->drm_format !=DRM_FORMAT_XRGB8888 ) -return -EINVAL ; - ptr =igt_fb_map_buffer (fb->fd, fb);igt_assert (ptr); map = ptr;
@@ -173,51 +237,14 @@ int igt_color_transform_pixels(igt_fb_t *fb, igt_pixel_transform transforms[], iigt_pixel_t pixel;int i; - raw_pixel &=0x00ffffff ; - -/* -* unpack pixel into igt_pixel_t -* -* only for XRGB8888 for now -* -* TODO add "generic" mechanism for unpacking -* other FB formats -*/ - pixel.r = (raw_pixel &0x00ff0000 ) >>16 ; - pixel.g = (raw_pixel &0x0000ff00 ) >>8 ; - pixel.b = (raw_pixel &0x000000ff ); - -/* normalize for 8-bit */ - pixel.r /= (0xff ); - pixel.g /= (0xff ); - pixel.b /= (0xff ); - -/* TODO use read_rgb from igt_fb? */ +igt_color_fourcc_to_pixel (raw_pixel, fb->drm_format, &pixel);/* run transform on pixel */ -for (i =0 ; i < num_transforms; i++) transforms[i](&pixel); -/* clip */ - pixel.r =fmax (fmin (pixel.r,1.0 ),0.0 ); - pixel.g =fmax (fmin (pixel.g,1.0 ),0.0 ); - pixel.b =fmax (fmin (pixel.b,1.0 ),0.0 ); - -/* de-normalize back to 8-bit */ - pixel.r *= (0xff ); - pixel.g *= (0xff ); - pixel.b *= (0xff ); - -/* re-pack pixel into FB*/ - raw_pixel =0x0 ; - raw_pixel |= ((uint8_t )(lround (pixel.r) &0xff )) <<16 ; - raw_pixel |= ((uint8_t )(lround (pixel.g) &0xff )) <<8 ; - raw_pixel |= ((uint8_t )(lround (pixel.b) &0xff )); -/* TODO use write_rgb from igt_fb? */ -/* write back to line */ - line[x] =cpu_to_le32 (raw_pixel); + line[x] =cpu_to_le32 (igt_color_pixel_to_fourc (fb->drm_format, &pixel)); }/* copy line back to fb buffer */
tests/kms_colorop.c +3 -0
@@ -355,6 +355,9 @@ static bool compare_with_bracket(igt_fb_t *in, igt_fb_t *out)if (is_vkms_device (in->fd))return igt_cmp_fb_pixels (in, out,1 ,1 ); +if (is_amdgpu_device (in->fd)) +return igt_cmp_fb_pixels (in, out,13 ,13 ); +/* * By default we'll look for a [0, 0] bracket. We can then * define it for each driver that implements support for this
Signature · 1 line
2.43.0
Re: [PATCH V10 17/30] lib/igt_color: Support color transform for XRGB2101010
Quoted 41 lines · Alex Hung
From: Harry Wentland <[email protected]>
Support color format XRGB2101010.
Signed-off-by Alex Hung <[email protected]>Signed-off-by Harry Wentland <[email protected]>--- lib/igt_color.c | 113 +++++++++++++++++++++++++++----------------- tests/kms_colorop.c | 3 ++ 2 files changed, 73 insertions(+), 43 deletions(-)lib/igt_color.c +22
-0@@ -132,6 +132,74 @@ void igt_color_ctm_3x4_bt709_dec(igt_pixel_t *pixel)igt_color_apply_3x4_ctm (pixel, &igt_matrix_3x4_bt709_dec); } +static void +igt_color_fourcc_to_pixel (uint32_t raw_pixel,uint32_t drm_format,igt_pixel_t *pixel) +{ +if (drm_format ==DRM_FORMAT_XRGB8888 ) { + raw_pixel &=0x00ffffff ; + + pixel->r = (raw_pixel &0x00ff0000 ) >>16 ; + pixel->g = (raw_pixel &0x0000ff00 ) >>8 ; + pixel->b = (raw_pixel &0x000000ff ); + +/* normalize for 8-bit */ + pixel->r /= (0xff ); + pixel->g /= (0xff ); + pixel->b /= (0xff ); + }else if (drm_format ==DRM_FORMAT_XRGB2101010 ) { + raw_pixel &=0x3fffffff ; + + pixel->r = (raw_pixel &0x3ff00000 ) >>20 ; + pixel->g = (raw_pixel &0x000ffc00 ) >>10 ; + pixel->b = (raw_pixel &0x000003ff ); + +/* normalize for 10-bit */
lib/igt_color.c void igt_color_ctm_3x4_bt709_dec(igt_pixel_t *pixel) · line 166
Quoted 10 lines
lib/igt_color.c +10
-0+ pixel->r /= (0x3ff ); + pixel->g /= (0x3ff ); + pixel->b /= (0x3ff ); + }else { +igt_skip ("pixel format support not implemented" ); + } +} + +static uint32_t +igt_color_pixel_to_fourc (uint32_t drm_format,igt_pixel_t *pixel)
Maybe rename this to fourcc?
PATCH v10 18/30 lib/igt_color: Add PQ variants for 0-1 and 0-125 range
In reply to Alex HungFrom: Harry Wentland <[email protected]>
Add PQ SW transforms. The most obvious to do the PQ EOTF is to transform [0.0, 1.0] non-linear values to [0.0, 1.0] linear values, and same in the inverse. So we add transforms that do this.
Some HW (like AMD's) has scaling baked into the PQ EOTF and will scale [0.0, 1.0] non-linear values to [0.0, 125.0] linear values when applying the PQ EOTF. The inverse will take [0.0, 125.0] linear values and output [0.0, 1.0] linear values. We're adding a transform that can handle this variant as well.
--- lib/igt_color.c | 79 +++++++++++++++++++++++++++++++++++++++++++------ lib/igt_color.h | 13 ++++++++ 2 files changed, 83 insertions(+), 9 deletions(-)
lib/igt_color.c +70 -9
@@ -22,6 +22,13 @@ static float clamp(float val, float min, float max)return ((val < min) ? min : ((val > max) ? max : val)); } +static void igt_color_multiply (igt_pixel_t *pixel,float multiplier) +{ + pixel->r *= multiplier; + pixel->g *= multiplier; + pixel->b *= multiplier; +} +static float igt_color_tf_eval_unclamped (const struct igt_color_tf *fn,float x) {if (x < fn->d)
@@ -57,24 +64,78 @@ static void tf_inverse(const struct igt_color_tf *fn, struct igt_color_tf *inv) } } -void igt_color_srgb_inv_eotf (igt_pixel_t *pixel) +static float pq_eval (const struct igt_color_tf_pq *pq,float x) { -struct igt_color_tf inv; +return powf (fmaxf (pq->A + pq->B *powf (x, pq->C),0 ) + / (pq->D + pq->E *powf (x, pq->C)), + pq->F); +} -tf_inverse (&srgb_eotf, &inv); +static void pq_inv (struct igt_color_tf_pq *inv) +{ + inv->A = -pq_eotf.A; + inv->B = pq_eotf.D; + inv->C =1.0f / pq_eotf.F; + inv->D = pq_eotf.B; + inv->E = -pq_eotf.E; + inv->F =1.0f / pq_eotf.C; +} - pixel->r =igt_color_tf_eval (&inv, pixel->r); - pixel->g =igt_color_tf_eval (&inv, pixel->g); - pixel->b =igt_color_tf_eval (&inv, pixel->b); +static void igt_color_tf (igt_pixel_t *pixel,const struct igt_color_tf *tf) +{ + pixel->r =igt_color_tf_eval (tf, pixel->r); + pixel->g =igt_color_tf_eval (tf, pixel->g); + pixel->b =igt_color_tf_eval (tf, pixel->b); } +static void igt_color_inv_tf (igt_pixel_t *pixel,const struct igt_color_tf *tf) +{ +struct igt_color_tf inv; + +tf_inverse (tf, &inv); +igt_color_tf (pixel, &inv); +} +static void tf_pq (igt_pixel_t *pixel,const struct igt_color_tf_pq *pq) +{ + pixel->r =pq_eval (pq, pixel->r); + pixel->g =pq_eval (pq, pixel->g); + pixel->b =pq_eval (pq, pixel->b); +}void igt_color_srgb_eotf (igt_pixel_t *pixel) { - pixel->r =igt_color_tf_eval (&srgb_eotf, pixel->r); - pixel->g =igt_color_tf_eval (&srgb_eotf, pixel->g); - pixel->b =igt_color_tf_eval (&srgb_eotf, pixel->b); +igt_color_tf (pixel, &srgb_eotf); +} + +void igt_color_srgb_inv_eotf (igt_pixel_t *pixel) +{ +igt_color_inv_tf (pixel, &srgb_eotf); +} + +void igt_color_pq_eotf (igt_pixel_t *pixel) +{ +tf_pq (pixel, &pq_eotf); +} + +void igt_color_pq_inv_eotf (igt_pixel_t *pixel) +{ +struct igt_color_tf_pq inv; + +pq_inv (&inv); +tf_pq (pixel, &inv); +} + +void igt_color_pq_125_eotf (igt_pixel_t *pixel) +{ +igt_color_pq_eotf (pixel); +igt_color_multiply (pixel,125.0f ); +} + +void igt_color_pq_125_inv_eotf (igt_pixel_t *pixel) +{ +igt_color_multiply (pixel,1 /125.0f ); +igt_color_pq_inv_eotf (pixel); }static void igt_color_apply_3x4_ctm (igt_pixel_t *pixel,const igt_matrix_3x4_t *matrix)
lib/igt_color.h +13 -0
@@ -21,8 +21,15 @@ struct igt_color_tf {float g, a, b, c, d, e, f; }; +struct igt_color_tf_pq { +float A, B, C, D, E, F, G; +}; + +const struct igt_color_tf srgb_eotf = {2.4f , (float )(1 /1.055 ), (float )(0.055 /1.055 ), (float )(1 /12.92 ),0.04045f ,0 ,0 }; +const struct igt_color_tf_pq pq_eotf = {-107 /128.0f ,1.0f ,32 /2523.0f ,2413 /128.0f ,-2392 /128.0f ,8192 /1305.0f }; + typedef struct igt_pixel { float r; float g;
@@ -91,6 +98,12 @@ void igt_colorop_set_ctm_3x4(igt_display_t *display,void igt_color_srgb_inv_eotf (igt_pixel_t *pixel);void igt_color_srgb_eotf (igt_pixel_t *pixel); +void igt_color_pq_inv_eotf (igt_pixel_t *pixel); +void igt_color_pq_eotf (igt_pixel_t *pixel); + +void igt_color_pq_125_inv_eotf (igt_pixel_t *pixel); +void igt_color_pq_125_eotf (igt_pixel_t *pixel); +void igt_color_ctm_3x4_50_desat (igt_pixel_t *pixel);void igt_color_ctm_3x4_overdrive (igt_pixel_t *pixel);void igt_color_ctm_3x4_oversaturate (igt_pixel_t *pixel);
Signature · 1 line
2.43.0
PATCH v10 19/30 tests/kms_colorop: Add tests for PQ variants
In reply to Alex HungFrom: Harry Wentland <[email protected]>
Add tests exercising the PQ EOTF and its inverse, both for the [0.0, 1.0] variant as well as the [0.0, 125.0] scaled variant.
--- tests/kms_colorop.c | 32 ++++++++++++++----------- tests/kms_colorop.h | 57 +++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 76 insertions(+), 13 deletions(-)
tests/kms_colorop.c +19 -13
@@ -49,6 +49,13 @@* @srgb_eotf: sRGB EOTF * @srgb_inv_eotf: sRGB Inverse EOTF * @srgb_eotf-srgb_inv_eotf: sRGB EOTF -> sRGB Inverse EOTF +* @pq_eotf: PQ EOTF +* @pq_inv_eotf: PQ Inverse EOTF +* @pq_eotf-pq_inv_eotf: PQ EOTF -> PQ Inverse EOTF +* @pq_125_eotf: PQ EOTF for [0.0, 125.0] optical range +* @pq_125_inv_eotf: PQ Inverse EOTF for [0.0, 125.0] optical range +* @pq_125_eotf-pq_125_inv_eotf: PQ EOTF -> PQ Inverse EOTF with [0.0, 125.0] optical range +* @pq_125_eotf-pq_125_inv_eotf-pq_125_eotf: PQ EOTF -> PQ Inverse EOTF -> PQ EOTF with [0.0, 125.0] optical range * @ctm_3x4_50_desat: 3x4 matrix doing a 50% desaturation * @ctm_3x4_overdrive: 3x4 matrix overdring all values by 50% * @ctm_3x4_oversaturate: 3x4 matrix oversaturating values
@@ -213,7 +220,10 @@ static bool can_use_colorop(igt_display_t *display, igt_colorop_t *colorop, kms_ {switch (desired->type) {case KMS_COLOROP_ENUMERATED_LUT1D : -return (igt_colorop_get_prop (display, colorop,IGT_COLOROP_TYPE ) ==DRM_COLOROP_1D_CURVE ); +if (igt_colorop_get_prop (display, colorop,IGT_COLOROP_TYPE ) ==DRM_COLOROP_1D_CURVE && +igt_colorop_try_prop_enum (colorop,IGT_COLOROP_CURVE_1D_TYPE , kms_colorop_lut1d_tf_names[desired->enumerated_lut1d_info.tf])) +return true; +return false;case KMS_COLOROP_CTM_3X4 :return (igt_colorop_get_prop (display, colorop,IGT_COLOROP_TYPE ) ==DRM_COLOROP_CTM_3X4 );case KMS_COLOROP_CUSTOM_LUT1D :
@@ -293,18 +303,7 @@ static void set_colorop(igt_display_t *display,/* Set to desired value from kms_colorop_t */ switch (colorop->type) {case KMS_COLOROP_ENUMERATED_LUT1D : -switch (colorop->enumerated_lut1d_info.tf) { -case KMS_COLOROP_LUT1D_SRGB_EOTF : -igt_colorop_set_prop_enum (colorop->colorop,IGT_COLOROP_CURVE_1D_TYPE ,"sRGB EOTF" ); -break ; -case KMS_COLOROP_LUT1D_SRGB_INV_EOTF : -igt_colorop_set_prop_enum (colorop->colorop,IGT_COLOROP_CURVE_1D_TYPE ,"sRGB Inverse EOTF" ); -break ; -case KMS_COLOROP_LUT1D_PQ_EOTF : -case KMS_COLOROP_LUT1D_PQ_INV_EOTF : -default : -igt_fail (IGT_EXIT_FAILURE ); - } +igt_colorop_set_prop_enum (colorop->colorop,IGT_COLOROP_CURVE_1D_TYPE , kms_colorop_lut1d_tf_names[colorop->enumerated_lut1d_info.tf]);break ;case KMS_COLOROP_CTM_3X4 :igt_colorop_set_ctm_3x4 (display, colorop->colorop, colorop->matrix_3x4);
@@ -480,6 +479,13 @@ igt_main { { &kms_colorop_srgb_eotf, NULL }, "srgb_eotf" }, { { &kms_colorop_srgb_inv_eotf, NULL }, "srgb_inv_eotf" }, { { &kms_colorop_srgb_eotf, &kms_colorop_srgb_inv_eotf, NULL }, "srgb_eotf-srgb_inv_eotf" }, + { { &kms_colorop_pq_eotf, NULL }, "pq_eotf" }, + { { &kms_colorop_pq_inv_eotf, NULL }, "pq_inv_eotf" }, + { { &kms_colorop_pq_eotf, &kms_colorop_pq_inv_eotf, NULL }, "pq_eotf-pq_inv_eotf" }, + { { &kms_colorop_pq_125_eotf, NULL }, "pq_125_eotf" }, + { { &kms_colorop_pq_125_inv_eotf, NULL }, "pq_125_inv_eotf" }, + { { &kms_colorop_pq_125_eotf, &kms_colorop_pq_125_inv_eotf, NULL }, "pq_125_eotf-pq_125_inv_eotf" }, + { { &kms_colorop_pq_125_eotf, &kms_colorop_pq_125_inv_eotf, &kms_colorop_pq_125_eotf_2, NULL }, "pq_125_eotf-pq_125_inv_eotf-pq_125_eotf" }, { { &kms_colorop_ctm_3x4_50_desat, NULL }, "ctm_3x4_50_desat" }, { { &kms_colorop_ctm_3x4_overdrive, NULL }, "ctm_3x4_overdrive" }, { { &kms_colorop_ctm_3x4_oversaturate, NULL }, "ctm_3x4_oversaturate" },
tests/kms_colorop.h +57 -0
71 lines not on this page · raw message
Signature · 1 line
2.43.0
PATCH v10 20/30 tests/kms_colorop: Add a TF sRGB test
In reply to Alex HungAdd test for EOTF -> Inverse EOTF -> EOTF
--- tests/kms_colorop.c | 40 +++++++++++++++++++++------------------- tests/kms_colorop.h | 9 +++++++++ 2 files changed, 30 insertions(+), 19 deletions(-)
tests/kms_colorop.c +21 -19
@@ -40,29 +40,30 @@* * arg[1]: * -* @XR24-XR24: XRGB8888 framebuffer and writeback buffer -* @XR30-XR30: XRGB2101010 framebuffer and writeback buffer +* @XR24-XR24: XRGB8888 framebuffer and writeback buffer +* @XR30-XR30: XRGB2101010 framebuffer and writeback buffer * * arg[2]: * -* @bypass: Bypass Color Pipeline -* @srgb_eotf: sRGB EOTF -* @srgb_inv_eotf: sRGB Inverse EOTF -* @srgb_eotf-srgb_inv_eotf: sRGB EOTF -> sRGB Inverse EOTF -* @pq_eotf: PQ EOTF -* @pq_inv_eotf: PQ Inverse EOTF -* @pq_eotf-pq_inv_eotf: PQ EOTF -> PQ Inverse EOTF -* @pq_125_eotf: PQ EOTF for [0.0, 125.0] optical range -* @pq_125_inv_eotf: PQ Inverse EOTF for [0.0, 125.0] optical range -* @pq_125_eotf-pq_125_inv_eotf: PQ EOTF -> PQ Inverse EOTF with [0.0, 125.0] optical range +* @bypass: Bypass Color Pipeline +* @srgb_eotf: sRGB EOTF +* @srgb_inv_eotf: sRGB Inverse EOTF +* @srgb_eotf-srgb_inv_eotf: sRGB EOTF -> sRGB Inverse EOTF +* @srgb_eotf-srgb_inv_eotf-srgb_eotf: sRGB EOTF -> sRGB Inverse EOTF -> sRGB EOTF +* @pq_eotf: PQ EOTF +* @pq_inv_eotf: PQ Inverse EOTF +* @pq_eotf-pq_inv_eotf: PQ EOTF -> PQ Inverse EOTF +* @pq_125_eotf: PQ EOTF for [0.0, 125.0] optical range +* @pq_125_inv_eotf: PQ Inverse EOTF for [0.0, 125.0] optical range +* @pq_125_eotf-pq_125_inv_eotf: PQ EOTF -> PQ Inverse EOTF with [0.0, 125.0] optical range * @pq_125_eotf-pq_125_inv_eotf-pq_125_eotf: PQ EOTF -> PQ Inverse EOTF -> PQ EOTF with [0.0, 125.0] optical range -* @ctm_3x4_50_desat: 3x4 matrix doing a 50% desaturation -* @ctm_3x4_overdrive: 3x4 matrix overdring all values by 50% -* @ctm_3x4_oversaturate: 3x4 matrix oversaturating values -* @ctm_3x4_bt709_enc: BT709 encoding matrix -* @ctm_3x4_bt709_dec: BT709 decoding matrix -* @ctm_3x4_bt709_enc_dec: BT709 encoding matrix, followed by decoding matrix -* @ctm_3x4_bt709_dec_enc: BT709 decoding matrix, followed by encoding matrix +* @ctm_3x4_50_desat: 3x4 matrix doing a 50% desaturation +* @ctm_3x4_overdrive: 3x4 matrix overdring all values by 50% +* @ctm_3x4_oversaturate: 3x4 matrix oversaturating values +* @ctm_3x4_bt709_enc: BT709 encoding matrix +* @ctm_3x4_bt709_dec: BT709 decoding matrix +* @ctm_3x4_bt709_enc_dec: BT709 encoding matrix, followed by decoding matrix +* @ctm_3x4_bt709_dec_enc: BT709 decoding matrix, followed by encoding matrix * */
@@ -479,6 +480,7 @@ igt_main { { &kms_colorop_srgb_eotf, NULL }, "srgb_eotf" }, { { &kms_colorop_srgb_inv_eotf, NULL }, "srgb_inv_eotf" }, { { &kms_colorop_srgb_eotf, &kms_colorop_srgb_inv_eotf, NULL }, "srgb_eotf-srgb_inv_eotf" }, + { { &kms_colorop_srgb_eotf, &kms_colorop_srgb_inv_eotf, &kms_colorop_srgb_eotf_2, NULL }, "srgb_eotf-srgb_inv_eotf-srgb_eotf" }, { { &kms_colorop_pq_eotf, NULL }, "pq_eotf" }, { { &kms_colorop_pq_inv_eotf, NULL }, "pq_inv_eotf" }, { { &kms_colorop_pq_eotf, &kms_colorop_pq_inv_eotf, NULL }, "pq_eotf-pq_inv_eotf" },
tests/kms_colorop.h +9 -0
@@ -89,6 +89,15 @@ kms_colorop_t kms_colorop_srgb_eotf = { .transform = &igt_color_srgb_eotf }; +kms_colorop_t kms_colorop_srgb_eotf_2 = { + .type =KMS_COLOROP_ENUMERATED_LUT1D , + .enumerated_lut1d_info = { + .tf =KMS_COLOROP_LUT1D_SRGB_EOTF + }, + .name ="srgb_eotf" , + .transform = &igt_color_srgb_eotf +}; +kms_colorop_t kms_colorop_srgb_inv_eotf = { .type =KMS_COLOROP_ENUMERATED_LUT1D , .enumerated_lut1d_info = {
Signature · 1 line
2.43.0
PATCH v10 21/30 lib/igt_color: add BT2020/BT709 transfer functions
In reply to Alex HungFrom: Harry Wentland <[email protected]>
BT.709 and BT.2020 transfer functions are identical, the only difference beind that BT.2020 is defined with a higher precision for 10 and 12 bpc encodings.
These transfer functions are defined as OETFs, not EOTFs, so we create functions for them as OETF and its inverse.
--- lib/igt_color.c | 10 ++++++++++ lib/igt_color.h | 4 ++++ 2 files changed, 14 insertions(+)
lib/igt_color.c +10 -0
@@ -113,6 +113,16 @@ void igt_color_srgb_inv_eotf(igt_pixel_t *pixel)igt_color_inv_tf (pixel, &srgb_eotf); } +void igt_color_bt2020_inv_oetf (igt_pixel_t *pixel) +{ +igt_color_tf (pixel, &bt2020_inv_oetf); +} + +void igt_color_bt2020_oetf (igt_pixel_t *pixel) +{ +igt_color_inv_tf (pixel, &bt2020_inv_oetf); +} +void igt_color_pq_eotf (igt_pixel_t *pixel) {tf_pq (pixel, &pq_eotf);
lib/igt_color.h +4 -0
@@ -27,6 +27,7 @@ struct igt_color_tf_pq {const struct igt_color_tf srgb_eotf = {2.4f , (float )(1 /1.055 ), (float )(0.055 /1.055 ), (float )(1 /12.92 ),0.04045f ,0 ,0 }; +const struct igt_color_tf bt2020_inv_oetf = {(float )(1 /0.45f ), (float )(1 /1.0993f ), (float )(0.0993f /1.0993f ), (float )(1 /4.5f ), (float )(0.081 ),0 ,0 };const struct igt_color_tf_pq pq_eotf = {-107 /128.0f ,1.0f ,32 /2523.0f ,2413 /128.0f ,-2392 /128.0f ,8192 /1305.0f };
@@ -104,6 +105,9 @@ void igt_color_pq_eotf(igt_pixel_t *pixel);void igt_color_pq_125_inv_eotf (igt_pixel_t *pixel);void igt_color_pq_125_eotf (igt_pixel_t *pixel); +void igt_color_bt2020_inv_oetf (igt_pixel_t *pixel); +void igt_color_bt2020_oetf (igt_pixel_t *pixel); +void igt_color_ctm_3x4_50_desat (igt_pixel_t *pixel);void igt_color_ctm_3x4_overdrive (igt_pixel_t *pixel);void igt_color_ctm_3x4_oversaturate (igt_pixel_t *pixel);
Signature · 1 line
2.43.0
PATCH v10 22/30 tests/kms_colorop: Add TF BT2020/BT709 tests
In reply to Alex HungFrom: Harry Wentland <[email protected]>
Add tests for OETF, Inverse OEFT and INVERSE OETF -> OETF.
--- tests/kms_colorop.c | 6 ++++++ tests/kms_colorop.h | 22 ++++++++++++++++++++++ 2 files changed, 28 insertions(+)
tests/kms_colorop.c +6 -0
@@ -50,6 +50,9 @@* @srgb_inv_eotf: sRGB Inverse EOTF * @srgb_eotf-srgb_inv_eotf: sRGB EOTF -> sRGB Inverse EOTF * @srgb_eotf-srgb_inv_eotf-srgb_eotf: sRGB EOTF -> sRGB Inverse EOTF -> sRGB EOTF +* @bt2020_inv_oetf: BT.2020 Inverse OETF +* @bt2020_oetf: BT.2020 OETF +* @bt2020_inv_oetf-bt2020_oetf: BT.2020 Inverse OETF > BT.2020 OETF * @pq_eotf: PQ EOTF * @pq_inv_eotf: PQ Inverse EOTF * @pq_eotf-pq_inv_eotf: PQ EOTF -> PQ Inverse EOTF
@@ -481,6 +484,9 @@ igt_main { { &kms_colorop_srgb_inv_eotf, NULL }, "srgb_inv_eotf" }, { { &kms_colorop_srgb_eotf, &kms_colorop_srgb_inv_eotf, NULL }, "srgb_eotf-srgb_inv_eotf" }, { { &kms_colorop_srgb_eotf, &kms_colorop_srgb_inv_eotf, &kms_colorop_srgb_eotf_2, NULL }, "srgb_eotf-srgb_inv_eotf-srgb_eotf" }, + { { &kms_colorop_bt2020_inv_oetf, NULL }, "bt2020_inv_oetf" }, + { { &kms_colorop_bt2020_oetf, NULL }, "bt2020_oetf" }, + { { &kms_colorop_bt2020_inv_oetf, &kms_colorop_bt2020_oetf, NULL }, "bt2020_inv_oetf-bt2020_oetf" }, { { &kms_colorop_pq_eotf, NULL }, "pq_eotf" }, { { &kms_colorop_pq_inv_eotf, NULL }, "pq_inv_eotf" }, { { &kms_colorop_pq_eotf, &kms_colorop_pq_inv_eotf, NULL }, "pq_eotf-pq_inv_eotf" },
tests/kms_colorop.h +22 -0
@@ -43,6 +43,8 @@ typedef enum kms_colorop_type { typedef enum kms_colorop_lut1d_tf { KMS_COLOROP_LUT1D_SRGB_EOTF, KMS_COLOROP_LUT1D_SRGB_INV_EOTF, + KMS_COLOROP_LUT1D_BT2020_INV_OETF, + KMS_COLOROP_LUT1D_BT2020_OETF, KMS_COLOROP_LUT1D_PQ_EOTF, KMS_COLOROP_LUT1D_PQ_INV_EOTF, KMS_COLOROP_LUT1D_PQ_125_EOTF,
@@ -53,6 +55,8 @@ typedef enum kms_colorop_lut1d_tf {const char *const kms_colorop_lut1d_tf_names[KMS_COLOROP_LUT1D_NUM_ENUMS ] = { [KMS_COLOROP_LUT1D_SRGB_EOTF ] ="sRGB EOTF" , [KMS_COLOROP_LUT1D_SRGB_INV_EOTF ] ="sRGB Inverse EOTF" , + [KMS_COLOROP_LUT1D_BT2020_INV_OETF ] ="BT.2020 Inverse OETF" , + [KMS_COLOROP_LUT1D_BT2020_OETF ] ="BT.2020 OETF" , [KMS_COLOROP_LUT1D_PQ_EOTF ] ="PQ EOTF" , [KMS_COLOROP_LUT1D_PQ_INV_EOTF ] ="PQ Inverse EOTF" , [KMS_COLOROP_LUT1D_PQ_125_EOTF ] ="PQ 125 EOTF" ,
@@ -107,6 +111,24 @@ kms_colorop_t kms_colorop_srgb_inv_eotf = { .transform = &igt_color_srgb_inv_eotf }; +kms_colorop_t kms_colorop_bt2020_inv_oetf = { + .type =KMS_COLOROP_ENUMERATED_LUT1D , + .enumerated_lut1d_info = { + .tf =KMS_COLOROP_LUT1D_BT2020_INV_OETF + }, + .name ="bt2020_inv_oetf" , + .transform = &igt_color_bt2020_inv_oetf +}; + +kms_colorop_t kms_colorop_bt2020_oetf = { + .type =KMS_COLOROP_ENUMERATED_LUT1D , + .enumerated_lut1d_info = { + .tf =KMS_COLOROP_LUT1D_BT2020_OETF + }, + .name ="bt2020_oetf" , + .transform = &igt_color_bt2020_oetf +}; +kms_colorop_t kms_colorop_pq_eotf = { .type =KMS_COLOROP_ENUMERATED_LUT1D , .enumerated_lut1d_info = {
Signature · 1 line
2.43.0
PATCH v10 23/30 lib/igt_color: Add 1D LUT color transformation support
In reply to Alex HungAdd definitions and functions for setting 1D LUT on a drm_colorop.
Add support for the SIZE prop of a colorop, as that's required for understanding the size of the LUT to construct.
--- include/drm-uapi/drm_mode.h | 12 ++++++++++++ lib/igt_color.c | 8 ++++++++ lib/igt_color.h | 20 ++++++++++++++++++++ lib/igt_kms.c | 1 + lib/igt_kms.h | 1 + 5 files changed, 42 insertions(+)
include/drm-uapi/drm_mode.h +12 -0
@@ -874,6 +874,18 @@ struct drm_color_lut {__u16 reserved; }; +/* +* struct drm_color_lut32 +* +* 32-bit per channel color LUT entry, similar to drm_color_lut. +*/ +struct drm_color_lut32 { +__u32 red; +__u32 green; +__u32 blue; +__u32 reserved; +}; +enum drm_colorop_type {DRM_COLOROP_1D_CURVE ,DRM_COLOROP_1D_LUT ,
lib/igt_color.c +8 -0
@@ -428,3 +428,11 @@ void igt_colorop_set_ctm_3x4(igt_display_t *display,/* set blob property */ igt_colorop_replace_prop_blob (colorop,IGT_COLOROP_DATA , &ctm,sizeof (ctm)); } + +void igt_colorop_set_custom_1dlut (igt_display_t *display, +igt_colorop_t *colorop, +const igt_1dlut_t *lut1d, +const size_t lut_size) +{ +igt_colorop_replace_prop_blob (colorop,IGT_COLOROP_DATA , lut1d, lut_size); +}
lib/igt_color.h +20 -0
@@ -17,6 +17,8 @@#include "igt_fb.h" #include "igt_kms.h" +#define MAX_COLOR_LUT_ENTRIES 4096 +struct igt_color_tf {float g, a, b, c, d, e, f; };
@@ -37,6 +39,17 @@ typedef struct igt_pixel {float b; } igt_pixel_t; +typedef struct igt_1dlut { +struct drm_color_lut32 lut[MAX_COLOR_LUT_ENTRIES ]; +}igt_1dlut_t ; + +igt_1dlut_t igt_1dlut_srgb_inv_eotf = { { +} }; + + +igt_1dlut_t igt_1dlut_srgb_eotf = { { +} }; + typedef struct igt_matrix_3x4 { /* * out matrix in
@@ -94,11 +107,18 @@ void igt_colorop_set_ctm_3x4(igt_display_t *display,igt_colorop_t *colorop, const igt_matrix_3x4_t *matrix); +void igt_colorop_set_custom_1dlut (igt_display_t *display, +igt_colorop_t *colorop, +const igt_1dlut_t *lut1d, +const size_t lut_size); +/* transformations */ void igt_color_srgb_inv_eotf (igt_pixel_t *pixel);void igt_color_srgb_eotf (igt_pixel_t *pixel); +void igt_color_srgb_inv_eotf_custom_lut (igt_pixel_t *pixel); +void igt_color_pq_inv_eotf (igt_pixel_t *pixel);void igt_color_pq_eotf (igt_pixel_t *pixel);
lib/igt_kms.c +1 -0
@@ -710,6 +710,7 @@ const char * const igt_colorop_prop_names[IGT_NUM_COLOROP_PROPS] = { [IGT_COLOROP_TYPE] = "TYPE", [IGT_COLOROP_BYPASS] = "BYPASS", [IGT_COLOROP_CURVE_1D_TYPE] = "CURVE_1D_TYPE", + [IGT_COLOROP_SIZE] = "SIZE", [IGT_COLOROP_DATA] = "DATA", [IGT_COLOROP_NEXT] = "NEXT", };
lib/igt_kms.h +1 -0
@@ -374,6 +374,7 @@ enum igt_atomic_colorop_properties {IGT_COLOROP_TYPE ,IGT_COLOROP_BYPASS ,IGT_COLOROP_CURVE_1D_TYPE , +IGT_COLOROP_SIZE ,IGT_COLOROP_DATA ,IGT_COLOROP_NEXT ,IGT_NUM_COLOROP_PROPS
Signature · 1 line
2.43.0
Re: [PATCH V10 23/30] lib/igt_color: Add 1D LUT color transformation support
Quoted 94 lines · Alex Hung
Add definitions and functions for setting 1D LUT on a
drm_colorop.Add support for the SIZE prop of a colorop, as that's required for understanding the size of the LUT to construct.
Signed-off-by Alex Hung <[email protected]>Co-developed-by Harry Wentland <[email protected]>Signed-off-by Harry Wentland <[email protected]>--- include/drm-uapi/drm_mode.h | 12 ++++++++++++ lib/igt_color.c | 8 ++++++++ lib/igt_color.h | 20 ++++++++++++++++++++ lib/igt_kms.c | 1 + lib/igt_kms.h | 1 + 5 files changed, 42 insertions(+)include/drm-uapi/drm_mode.h +12
-0@@ -874,6 +874,18 @@ struct drm_color_lut {__u16 reserved; }; +/* +* struct drm_color_lut32 +* +* 32-bit per channel color LUT entry, similar to drm_color_lut. +*/ +struct drm_color_lut32 { +__u32 red; +__u32 green; +__u32 blue; +__u32 reserved; +}; +enum drm_colorop_type {DRM_COLOROP_1D_CURVE ,DRM_COLOROP_1D_LUT ,lib/igt_color.c +8
-0@@ -428,3 +428,11 @@ void igt_colorop_set_ctm_3x4(igt_display_t *display,/* set blob property */ igt_colorop_replace_prop_blob (colorop,IGT_COLOROP_DATA , &ctm,sizeof (ctm)); } + +void igt_colorop_set_custom_1dlut (igt_display_t *display, +igt_colorop_t *colorop, +const igt_1dlut_t *lut1d, +const size_t lut_size) +{ +igt_colorop_replace_prop_blob (colorop,IGT_COLOROP_DATA , lut1d, lut_size); +}lib/igt_color.h +15
-0@@ -17,6 +17,8 @@#include "igt_fb.h" #include "igt_kms.h" +#define MAX_COLOR_LUT_ENTRIES 4096 +struct igt_color_tf {float g, a, b, c, d, e, f; };@@ -37,6 +39,17 @@ typedef struct igt_pixel {float b; } igt_pixel_t; +typedef struct igt_1dlut { +struct drm_color_lut32 lut[MAX_COLOR_LUT_ENTRIES ]; +}igt_1dlut_t ; + +igt_1dlut_t igt_1dlut_srgb_inv_eotf = { { +} }; + + +igt_1dlut_t igt_1dlut_srgb_eotf = { { +} }; + typedef struct igt_matrix_3x4 { /* * out matrix in@@ -94,11 +107,18 @@ void igt_colorop_set_ctm_3x4(igt_display_t *display,igt_colorop_t *colorop, const igt_matrix_3x4_t *matrix); +void igt_colorop_set_custom_1dlut(igt_display_t *display, + igt_colorop_t *colorop,
lib/igt_color.h void igt_colorop_set_ctm_3x4(igt_display_t *display, · line 121
Quoted 10 lines
lib/igt_color.h +5
-0+const igt_1dlut_t *lut1d, + const size_t lut_size); +/* transformations */ void igt_color_srgb_inv_eotf (igt_pixel_t *pixel);void igt_color_srgb_eotf (igt_pixel_t *pixel); +void igt_color_srgb_inv_eotf_custom_lut (igt_pixel_t *pixel); +
This is missing implementation. Maybe remove for now ?
Quoted 27 lines
lib/igt_color.h +0
-0void igt_color_pq_inv_eotf (igt_pixel_t *pixel);void igt_color_pq_eotf (igt_pixel_t *pixel);lib/igt_kms.c +1
-0@@ -710,6 +710,7 @@ const char * const igt_colorop_prop_names[IGT_NUM_COLOROP_PROPS] = { [IGT_COLOROP_TYPE] = "TYPE", [IGT_COLOROP_BYPASS] = "BYPASS", [IGT_COLOROP_CURVE_1D_TYPE] = "CURVE_1D_TYPE", + [IGT_COLOROP_SIZE] = "SIZE", [IGT_COLOROP_DATA] = "DATA", [IGT_COLOROP_NEXT] = "NEXT", };lib/igt_kms.h +1
-0@@ -374,6 +374,7 @@ enum igt_atomic_colorop_properties {IGT_COLOROP_TYPE ,IGT_COLOROP_BYPASS ,IGT_COLOROP_CURVE_1D_TYPE , +IGT_COLOROP_SIZE ,IGT_COLOROP_DATA ,IGT_COLOROP_NEXT ,IGT_NUM_COLOROP_PROPS
PATCH v10 24/30 test/kms_colorop: Add tests that exercise the 1D LUT colorops
In reply to Alex HungWe'll use the sRGB EOTF and its inverse for convenience.
--- tests/kms_colorop.c | 35 +++++++++++++++++++++++++++++++++++ tests/kms_colorop.h | 15 +++++++++++++++ 2 files changed, 50 insertions(+)
tests/kms_colorop.c +35 -0
@@ -50,6 +50,8 @@* @srgb_inv_eotf: sRGB Inverse EOTF * @srgb_eotf-srgb_inv_eotf: sRGB EOTF -> sRGB Inverse EOTF * @srgb_eotf-srgb_inv_eotf-srgb_eotf: sRGB EOTF -> sRGB Inverse EOTF -> sRGB EOTF +* @srgb_inv_eotf_lut: sRGB Inverse EOTF Custom LUT +* @srgb_inv_eotf_lut-srgb_eotf_lut: sRGB Inverse EOTF Custom LUT -> sRGB EOTF Custom LUT * @bt2020_inv_oetf: BT.2020 Inverse OETF * @bt2020_oetf: BT.2020 OETF * @bt2020_inv_oetf-bt2020_oetf: BT.2020 Inverse OETF > BT.2020 OETF
@@ -231,6 +233,9 @@ static bool can_use_colorop(igt_display_t *display, igt_colorop_t *colorop, kms_case KMS_COLOROP_CTM_3X4 :return (igt_colorop_get_prop (display, colorop,IGT_COLOROP_TYPE ) ==DRM_COLOROP_CTM_3X4 );case KMS_COLOROP_CUSTOM_LUT1D : +if (igt_colorop_get_prop (display, colorop,IGT_COLOROP_TYPE ) ==DRM_COLOROP_1D_LUT ) +return true; +return false;case KMS_COLOROP_LUT3D :default :return false;
@@ -298,9 +303,33 @@ static igt_colorop_t *get_color_pipeline(igt_display_t *display,return colorop; } +static void fill_custom_1dlut (igt_display_t *display,kms_colorop_t *colorop) +{ +uint64_t lut_size =igt_colorop_get_prop (display, colorop->colorop,IGT_COLOROP_SIZE ); +igt_pixel_t pixel; +float index; +int i; + +for (i =0 ; i < lut_size; i++) { + index = i / (float ) lut_size; + + pixel.r = index; + pixel.g = index; + pixel.b = index; + + colorop->transform (&pixel); + + colorop->lut1d->lut[i].red = pixel.r *UINT_MAX ; + colorop->lut1d->lut[i].green = pixel.g *UINT_MAX ; + colorop->lut1d->lut[i].blue = pixel.b *UINT_MAX ; + } +} +static void set_colorop (igt_display_t *display,kms_colorop_t *colorop) { +uint64_t lut_size =0 ; +igt_assert (colorop->colorop);igt_colorop_set_prop_value (colorop->colorop,IGT_COLOROP_BYPASS ,0 );
@@ -313,6 +342,10 @@ static void set_colorop(igt_display_t *display,igt_colorop_set_ctm_3x4 (display, colorop->colorop, colorop->matrix_3x4);break ;case KMS_COLOROP_CUSTOM_LUT1D : +fill_custom_1dlut (display, colorop); + lut_size =igt_colorop_get_prop (display, colorop->colorop,IGT_COLOROP_SIZE ); +igt_colorop_set_custom_1dlut (display, colorop->colorop, colorop->lut1d, lut_size *sizeof (struct drm_color_lut32 )); +break ;case KMS_COLOROP_LUT3D :default :igt_fail (IGT_EXIT_FAILURE );
@@ -484,6 +517,8 @@ igt_main { { &kms_colorop_srgb_inv_eotf, NULL }, "srgb_inv_eotf" }, { { &kms_colorop_srgb_eotf, &kms_colorop_srgb_inv_eotf, NULL }, "srgb_eotf-srgb_inv_eotf" }, { { &kms_colorop_srgb_eotf, &kms_colorop_srgb_inv_eotf, &kms_colorop_srgb_eotf_2, NULL }, "srgb_eotf-srgb_inv_eotf-srgb_eotf" }, + { { &kms_colorop_srgb_inv_eotf_lut, NULL }, "srgb_inv_eotf_lut" }, + { { &kms_colorop_srgb_inv_eotf_lut, &kms_colorop_srgb_eotf_lut, NULL }, "srgb_inv_eotf_lut-srgb_eotf_lut" }, { { &kms_colorop_bt2020_inv_oetf, NULL }, "bt2020_inv_oetf" }, { { &kms_colorop_bt2020_oetf, NULL }, "bt2020_oetf" }, { { &kms_colorop_bt2020_inv_oetf, &kms_colorop_bt2020_oetf, NULL }, "bt2020_inv_oetf-bt2020_oetf" },
tests/kms_colorop.h +15 -0
@@ -72,6 +72,7 @@ typedef struct kms_colorop {union {kms_colorop_enumerated_lut1d_info_t enumerated_lut1d_info; +igt_1dlut_t *lut1d;const igt_matrix_3x4_t *matrix_3x4; };
@@ -111,6 +112,20 @@ kms_colorop_t kms_colorop_srgb_inv_eotf = { .transform = &igt_color_srgb_inv_eotf }; +kms_colorop_t kms_colorop_srgb_inv_eotf_lut = { + .type =KMS_COLOROP_CUSTOM_LUT1D , + .lut1d = &igt_1dlut_srgb_inv_eotf, + .name ="srgb_inv_eotf_lut" , + .transform = &igt_color_srgb_inv_eotf +}; + +kms_colorop_t kms_colorop_srgb_eotf_lut = { + .type =KMS_COLOROP_CUSTOM_LUT1D , + .lut1d = &igt_1dlut_srgb_eotf, + .name ="srgb_eotf_lut" , + .transform = &igt_color_srgb_eotf +}; +kms_colorop_t kms_colorop_bt2020_inv_oetf = { .type =KMS_COLOROP_ENUMERATED_LUT1D , .enumerated_lut1d_info = {
Signature · 1 line
2.43.0
PATCH v10 25/30 tests/kms_colorop: Add multiplier tests
In reply to Alex HungThis includes multiply_125 (125.0f) and multiply_inv_125 (1/125.0f).
--- include/drm-uapi/drm_mode.h | 1 + lib/igt_color.c | 10 ++++++++++ lib/igt_color.h | 3 +++ lib/igt_kms.c | 1 + lib/igt_kms.h | 1 + tests/kms_colorop.c | 11 +++++++++++ tests/kms_colorop.h | 15 +++++++++++++++ 7 files changed, 42 insertions(+)
include/drm-uapi/drm_mode.h +1 -0
@@ -890,6 +890,7 @@ enum drm_colorop_type {DRM_COLOROP_1D_CURVE ,DRM_COLOROP_1D_LUT ,DRM_COLOROP_CTM_3X4 , + DRM_COLOROP_MULTIPLIER, };/**
lib/igt_color.c +10 -0
@@ -203,6 +203,16 @@ void igt_color_ctm_3x4_bt709_dec(igt_pixel_t *pixel)igt_color_apply_3x4_ctm (pixel, &igt_matrix_3x4_bt709_dec); } +void igt_color_multiply_125 (igt_pixel_t *pixel) +{ +igt_color_multiply (pixel,125.0f ); +} + +void igt_color_multiply_inv_125 (igt_pixel_t *pixel) +{ +igt_color_multiply (pixel,1 /125.0f ); +} +static void igt_color_fourcc_to_pixel (uint32_t raw_pixel,uint32_t drm_format,igt_pixel_t *pixel) {
lib/igt_color.h +3 -0
@@ -133,4 +133,7 @@ void igt_color_ctm_3x4_overdrive(igt_pixel_t *pixel);void igt_color_ctm_3x4_oversaturate (igt_pixel_t *pixel);void igt_color_ctm_3x4_bt709_dec (igt_pixel_t *pixel);void igt_color_ctm_3x4_bt709_enc (igt_pixel_t *pixel); + +void igt_color_multiply_125 (igt_pixel_t *pixel); +void igt_color_multiply_inv_125 (igt_pixel_t *pixel);#endif
lib/igt_kms.c +1 -0
@@ -712,6 +712,7 @@ const char * const igt_colorop_prop_names[IGT_NUM_COLOROP_PROPS] = { [IGT_COLOROP_CURVE_1D_TYPE] = "CURVE_1D_TYPE", [IGT_COLOROP_SIZE] = "SIZE", [IGT_COLOROP_DATA] = "DATA", + [IGT_COLOROP_MULTIPLIER] = "MULTIPLIER", [IGT_COLOROP_NEXT] = "NEXT", };
lib/igt_kms.h +1 -0
@@ -376,6 +376,7 @@ enum igt_atomic_colorop_properties {IGT_COLOROP_CURVE_1D_TYPE ,IGT_COLOROP_SIZE ,IGT_COLOROP_DATA , +IGT_COLOROP_MULTIPLIER ,IGT_COLOROP_NEXT , IGT_NUM_COLOROP_PROPS };
tests/kms_colorop.c +11 -0
@@ -69,6 +69,8 @@* @ctm_3x4_bt709_dec: BT709 decoding matrix * @ctm_3x4_bt709_enc_dec: BT709 encoding matrix, followed by decoding matrix * @ctm_3x4_bt709_dec_enc: BT709 decoding matrix, followed by encoding matrix +* @multiply_125: Multiplier by 125 +* @multiply_inv_125: Multiplier by inverse of 125 * */
@@ -236,6 +238,8 @@ static bool can_use_colorop(igt_display_t *display, igt_colorop_t *colorop, kms_if (igt_colorop_get_prop (display, colorop,IGT_COLOROP_TYPE ) ==DRM_COLOROP_1D_LUT )return true;return false; +case KMS_COLOROP_MULTIPLIER : +return (igt_colorop_get_prop (display, colorop,IGT_COLOROP_TYPE ) ==DRM_COLOROP_MULTIPLIER );case KMS_COLOROP_LUT3D :default :return false;
@@ -329,6 +333,7 @@ static void set_colorop(igt_display_t *display, kms_colorop_t *colorop) {uint64_t lut_size =0 ; +uint64_t mult =1 ;igt_assert (colorop->colorop);igt_colorop_set_prop_value (colorop->colorop,IGT_COLOROP_BYPASS ,0 );
@@ -346,6 +351,10 @@ static void set_colorop(igt_display_t *display, lut_size =igt_colorop_get_prop (display, colorop->colorop,IGT_COLOROP_SIZE );igt_colorop_set_custom_1dlut (display, colorop->colorop, colorop->lut1d, lut_size *sizeof (struct drm_color_lut32 ));break ; +case KMS_COLOROP_MULTIPLIER : + mult = colorop->multiplier * (mult <<32 );/* convert double to fixed number */ +igt_colorop_set_prop_value (colorop->colorop,IGT_COLOROP_MULTIPLIER , mult); +break ;case KMS_COLOROP_LUT3D :default :igt_fail (IGT_EXIT_FAILURE );
@@ -536,6 +545,8 @@ igt_main { { &kms_colorop_ctm_3x4_bt709_dec, NULL }, "ctm_3x4_bt709_dec" }, { { &kms_colorop_ctm_3x4_bt709_enc, &kms_colorop_ctm_3x4_bt709_dec, NULL }, "ctm_3x4_bt709_enc_dec" }, { { &kms_colorop_ctm_3x4_bt709_dec, &kms_colorop_ctm_3x4_bt709_enc, NULL }, "ctm_3x4_bt709_dec_enc" }, + { { &kms_colorop_multiply_125, NULL }, "multiply_125" }, + { { &kms_colorop_multiply_inv_125, NULL }, "multiply_inv_125" }, }; struct {
tests/kms_colorop.h +15 -0
@@ -37,6 +37,7 @@ typedef enum kms_colorop_type {KMS_COLOROP_ENUMERATED_LUT1D ,KMS_COLOROP_CUSTOM_LUT1D ,KMS_COLOROP_CTM_3X4 , +KMS_COLOROP_MULTIPLIER , KMS_COLOROP_LUT3D } kms_colorop_type_t;
@@ -74,6 +75,7 @@ typedef struct kms_colorop {kms_colorop_enumerated_lut1d_info_t enumerated_lut1d_info;igt_1dlut_t *lut1d;const igt_matrix_3x4_t *matrix_3x4; +double multiplier; };const char *name;
@@ -224,5 +226,18 @@ kms_colorop_t kms_colorop_ctm_3x4_bt709_dec = { .transform = &igt_color_ctm_3x4_bt709_dec }; +kms_colorop_t kms_colorop_multiply_125 = { + .type =KMS_COLOROP_MULTIPLIER , + .multiplier =125.0f , + .name ="multiply_125" , + .transform = &igt_color_multiply_125 +}; + +kms_colorop_t kms_colorop_multiply_inv_125 = { + .type =KMS_COLOROP_MULTIPLIER , + .multiplier =1 /125.0f , + .name ="multiply_inv_125" , + .transform = &igt_color_multiply_inv_125 +};#endif /* __KMS_COLOROP_H__ */
Signature · 1 line
2.43.0
PATCH v10 26/30 scripts/convert_3dlut.py Convert a 3D LUT to igt_3dlut_t array for 3D LUT API
In reply to Alex HungThis script converts a 17x17x17 3D LUT in a txt file to the following (i.e. 4913 entries):
{ .red = 0.000000, .green = 0.000000, .blue = 0.000000 },
{ .red = 0.175580, .green = 0.003419, .blue = 0.006838 },
{ .red = 0.338706, .green = 0.015140, .blue = 0.012454 },
...The text file should contains 3 column (RGB) in following form:
0000 0000 0000 0255 0307 0606 0225 0306 0893 ...
--- scripts/convert_3dlut.py | 94 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 94 insertions(+) create mode 100755 scripts/convert_3dlut.py
scripts/convert_3dlut.py new file +94 -0
@@ -0,0 +1,94 @@ +#!/usr/bin/env python3 +# SPDX-License-Identifier: (GPL-2.0 OR MIT) + +## Copyright (C) 2024 Advanced Micro Devices, Inc. ## +## Author: Alex Hung <[email protected]> ## + +import sys, os, argparse +import numpy as np +import pprint + +import pprint + +class Color: + def __init__(self, r, g, b): + self.r = r + self.g = g + self.b = b + def __str__(self): + r = self.r + g = self.g + b = self.b + rgb = "\t{ " + ".red = {0:05f}, .green = {1:05f}, .blue = {2:05f}".format(r, g, b) + " }," + return rgb + +def print_lut(ind, lut): + for i, v in enumerate(lut): + if (i - ind) % (17 * 17) == 0: + print(str(i) + " " + v) + #print(v) + +def parse_lut_file(file_path, max_value=4095): + lut = [] + + try: + with open(file_path, "r") as file: + for line in file: + values = line.strip().split() # Split values by spaces or tabs + if len(values) == 3: + r, g, b = map(float, values) # Convert to floats + r = r / max_value + g = g / max_value + b = b / max_value + color = Color(r, g, b) + lut.append(color) + else: + print(f"Skipping invalid line: '{line.strip()}'") + except FileNotFoundError: + print(f"File '{file_path}' not found.") + + return lut + +def fill_3d_array(lut, size=17): + lut3d = np.zeros((size, size, size), dtype=object) + + for i in range(size): + for j in range(size): + for k in range(size): + index = i * (size ** 2) + j * size + k + color = lut[index] + lut3d[i][j][k] = color + return lut3d + +def print_3d_array_rgb(lut3d, size=17): + for i in range(size): + for j in range(size): + for k in range(size): + print(lut3d[i][j][k]) + +def print_3d_array_bgr(lut3d, size=17): + for i in range(size): + for j in range(size): + for k in range(size): + print(lut3d[k][j][i]) + +def main(): + + parser = argparse.ArgumentParser(description='Convert integer values in a 3D LUT file to IGT format.') + parser.add_argument("-f", "--input", help="3D LUT file", required=True) + parser.add_argument("-t", "--traversal", help="traversal order", required=True) + args = parser.parse_args() + + lut = parse_lut_file(args.input) + lut3d = fill_3d_array(lut) + + if args.traversal.lower() == "rgb": + print_3d_array_rgb(lut3d) + elif args.traversal.lower() == "bgr": + print_3d_array_bgr(lut3d) + + return 0 + +if __name__ == "__main__": + ret = main() + sys.exit(ret)
Signature · 1 line
2.43.0
PATCH v10 27/30 tests/kms_colorop: Add a 3D LUT subtest
In reply to Alex HungThis includes a subtests 3dlut_17_12_rgb.
--- include/drm-uapi/drm_mode.h | 18 + lib/igt_color.c | 186 ++ lib/igt_color.h | 10 + lib/igt_color_lut.h | 4946 +++++++++++++++++++++++++++++++++++ lib/igt_kms.c | 2 + lib/igt_kms.h | 2 + tests/kms_colorop.c | 35 +- tests/kms_colorop.h | 19 + 8 files changed, 5217 insertions(+), 1 deletion(-) create mode 100644 lib/igt_color_lut.h
include/drm-uapi/drm_mode.h +18 -0
@@ -891,6 +891,24 @@ enum drm_colorop_type {DRM_COLOROP_1D_LUT ,DRM_COLOROP_CTM_3X4 ,DRM_COLOROP_MULTIPLIER , + DRM_COLOROP_3D_LUT, +}; + +enum drm_colorop_interpolation_type { +DRM_COLOROP_TETRAHEDRAL , +}; + +/** +* enum drm_colorop_lut3d_interpolation_type - type of 3DLUT interpolation +* +*/ +enum drm_colorop_lut3d_interpolation_type { +/** +* @DRM_COLOROP_LUT3D_INTERPOLATION_TETRAHEDRAL: +* +* Tetrahedral 3DLUT interpolation +*/ +DRM_COLOROP_LUT3D_INTERPOLATION_TETRAHEDRAL , };/**
lib/igt_color.c +186 -0
195 lines not on this page · raw message
lib/igt_color.h +10 -0
@@ -16,6 +16,7 @@#include "igt_fb.h" #include "igt_kms.h" +#include "igt_color_lut.h" #define MAX_COLOR_LUT_ENTRIES 4096
@@ -112,6 +113,12 @@ void igt_colorop_set_custom_1dlut(igt_display_t *display,const igt_1dlut_t *lut1d, const size_t lut_size); +void igt_colorop_set_3dlut (igt_display_t *display, +igt_colorop_t *colorop, +const igt_3dlut_norm_t *lut3d, +const size_t lut_size); + +/* transformations */ void igt_color_srgb_inv_eotf (igt_pixel_t *pixel);
@@ -136,4 +143,7 @@ void igt_color_ctm_3x4_bt709_enc(igt_pixel_t *pixel);void igt_color_multiply_125 (igt_pixel_t *pixel);void igt_color_multiply_inv_125 (igt_pixel_t *pixel); +void igt_color_3dlut_17_12_rgb (igt_pixel_t *pixel); +void igt_color_3dlut_17_12_bgr (igt_pixel_t *pixel); +#endif
lib/igt_color_lut.h new file +4946 -0
2,755 lines not on this page · raw message
The rest of this diff is not shown. View the raw message.
Signature · 1 line
2.43.0
Part of the diff is not shown here. View the raw message.
Re: [PATCH V10 27/30] tests/kms_colorop: Add a 3D LUT subtest
Quoted 304 lines · Alex Hung
This includes a subtests 3dlut_17_12_rgb.
Signed-off-by Alex Hung <[email protected]>--- include/drm-uapi/drm_mode.h | 18 + lib/igt_color.c | 186 ++ lib/igt_color.h | 10 + lib/igt_color_lut.h | 4946 +++++++++++++++++++++++++++++++++++ lib/igt_kms.c | 2 + lib/igt_kms.h | 2 + tests/kms_colorop.c | 35 +- tests/kms_colorop.h | 19 + 8 files changed, 5217 insertions(+), 1 deletion(-)create mode 100644
lib/igt_color_lut.hinclude/drm-uapi/drm_mode.h +18
-0@@ -891,6 +891,24 @@ enum drm_colorop_type {DRM_COLOROP_1D_LUT ,DRM_COLOROP_CTM_3X4 ,DRM_COLOROP_MULTIPLIER , + DRM_COLOROP_3D_LUT, +}; + +enum drm_colorop_interpolation_type { +DRM_COLOROP_TETRAHEDRAL , +}; + +/** +* enum drm_colorop_lut3d_interpolation_type - type of 3DLUT interpolation +* +*/ +enum drm_colorop_lut3d_interpolation_type { +/** +* @DRM_COLOROP_LUT3D_INTERPOLATION_TETRAHEDRAL: +* +* Tetrahedral 3DLUT interpolation +*/ +DRM_COLOROP_LUT3D_INTERPOLATION_TETRAHEDRAL , };/** lib/igt_color.c +186
-0@@ -213,6 +213,184 @@ void igt_color_multiply_inv_125(igt_pixel_t *pixel)igt_color_multiply (pixel,1 /125.0f ); } +static int +igt_get_lut3d_index_blue_fast (int r,int g,int b,long dim,int components) +{ +return components * (b + (int )dim * (g + (int )dim * r)); +} + +/* algorithm from https://github.com/AcademySoftwareFoundation/OpenColorIO/blob/main/src/OpenColorIO/ops/lut3d/Lut3DOpCPU.cpp#L422 */ +static void igt_color_3dlut_tetrahedral (igt_pixel_t *pixel,igt_3dlut_t *lut3d,long m_dim) +{ +int n000, n100, n010, n001, n110, n101, n011, n111; +float m_step = (float ) m_dim -1.0f ; +const float dimMinusOne = (float ) m_dim -1.f ; +float *m_optLut = (float *) lut3d->lut; +float idx[3 ]; +float out[3 ]; +int indexLow[3 ]; +int indexHigh[3 ]; +float fx, fy, fz; + + idx[0 ] = pixel->b * m_step; + idx[1 ] = pixel->g * m_step; + idx[2 ] = pixel->r * m_step; + +// NaNs become 0. + idx[0 ] =clamp (idx[0 ],0.f , dimMinusOne); + idx[1 ] =clamp (idx[1 ],0.f , dimMinusOne); + idx[2 ] =clamp (idx[2 ],0.f , dimMinusOne); + + indexLow[0 ] =floor (idx[0 ]); + indexLow[1 ] =floor (idx[1 ]); + indexLow[2 ] =floor (idx[2 ]); + +// When the idx is exactly equal to an index (e.g. 0,1,2...) +// then the computation of highIdx is wrong. However, +// the delta is then equal to zero (e.g. idx-lowIdx), +// so the highIdx has no impact. + indexHigh[0 ] =ceil (idx[0 ]); + indexHigh[1 ] =ceil (idx[1 ]); + indexHigh[2 ] =ceil (idx[2 ]); + + fx = idx[0 ] - (float ) indexLow[0 ]; + fy = idx[1 ] - (float ) indexLow[1 ]; + fz = idx[2 ] - (float ) indexLow[2 ]; + +// Compute index into LUT for surrounding corners + n000 =igt_get_lut3d_index_blue_fast (indexLow[0 ], indexLow[1 ], indexLow[2 ], m_dim,3 ); + n100 =igt_get_lut3d_index_blue_fast (indexHigh[0 ], indexLow[1 ], indexLow[2 ], m_dim,3 ); + n010 =igt_get_lut3d_index_blue_fast (indexLow[0 ], indexHigh[1 ], indexLow[2 ], m_dim,3 ); + n001 =igt_get_lut3d_index_blue_fast (indexLow[0 ], indexLow[1 ], indexHigh[2 ], m_dim,3 ); + n110 =igt_get_lut3d_index_blue_fast (indexHigh[0 ], indexHigh[1 ], indexLow[2 ], m_dim,3 ); + n101 =igt_get_lut3d_index_blue_fast (indexHigh[0 ], indexLow[1 ], indexHigh[2 ], m_dim,3 ); + n011 =igt_get_lut3d_index_blue_fast (indexLow[0 ], indexHigh[1 ], indexHigh[2 ], m_dim,3 ); + n111 =igt_get_lut3d_index_blue_fast (indexHigh[0 ], indexHigh[1 ], indexHigh[2 ], m_dim,3 ); + +if (fx > fy) { +if (fy > fz) { + out[0 ] = + (1 - fx) * m_optLut[n000] + + (fx - fy) * m_optLut[n100] + + (fy - fz) * m_optLut[n110] + + (fz) * m_optLut[n111]; + + out[1 ] = + (1 - fx) * m_optLut[n000 +1 ] + + (fx - fy) * m_optLut[n100 +1 ] + + (fy - fz) * m_optLut[n110 +1 ] + + (fz) * m_optLut[n111 +1 ]; + + out[2 ] = + (1 - fx) * m_optLut[n000 +2 ] + + (fx - fy) * m_optLut[n100 +2 ] + + (fy - fz) * m_optLut[n110 +2 ] + + (fz) * m_optLut[n111 +2 ]; + }else if (fx > fz) { + out[0 ] = + (1 - fx) * m_optLut[n000] + + (fx - fz) * m_optLut[n100] + + (fz - fy) * m_optLut[n101] + + (fy) * m_optLut[n111]; + + out[1 ] = + (1 - fx) * m_optLut[n000 +1 ] + + (fx - fz) * m_optLut[n100 +1 ] + + (fz - fy) * m_optLut[n101 +1 ] + + (fy) * m_optLut[n111 +1 ]; + + out[2 ] = + (1 - fx) * m_optLut[n000 +2 ] + + (fx - fz) * m_optLut[n100 +2 ] + + (fz - fy) * m_optLut[n101 +2 ] + + (fy) * m_optLut[n111 +2 ]; + }else { + out[0 ] = + (1 - fz) * m_optLut[n000] + + (fz - fx) * m_optLut[n001] + + (fx - fy) * m_optLut[n101] + + (fy) * m_optLut[n111]; + + out[1 ] = + (1 - fz) * m_optLut[n000 +1 ] + + (fz - fx) * m_optLut[n001 +1 ] + + (fx - fy) * m_optLut[n101 +1 ] + + (fy) * m_optLut[n111 +1 ]; + + out[2 ] = + (1 - fz) * m_optLut[n000 +2 ] + + (fz - fx) * m_optLut[n001 +2 ] + + (fx - fy) * m_optLut[n101 +2 ] + + (fy) * m_optLut[n111 +2 ]; + } + }else { +if (fz > fy) { + out[0 ] = + (1 - fz) * m_optLut[n000] + + (fz - fy) * m_optLut[n001] + + (fy - fx) * m_optLut[n011] + + (fx) * m_optLut[n111]; + + out[1 ] = + (1 - fz) * m_optLut[n000 +1 ] + + (fz - fy) * m_optLut[n001 +1 ] + + (fy - fx) * m_optLut[n011 +1 ] + + (fx) * m_optLut[n111 +1 ]; + + out[2 ] = + (1 - fz) * m_optLut[n000 +2 ] + + (fz - fy) * m_optLut[n001 +2 ] + + (fy - fx) * m_optLut[n011 +2 ] + + (fx) * m_optLut[n111 +2 ]; + }else if (fz > fx) { + out[0 ] = + (1 - fy) * m_optLut[n000] + + (fy - fz) * m_optLut[n010] + + (fz - fx) * m_optLut[n011] + + (fx) * m_optLut[n111]; + + out[1 ] = + (1 - fy) * m_optLut[n000 +1 ] + + (fy - fz) * m_optLut[n010 +1 ] + + (fz - fx) * m_optLut[n011 +1 ] + + (fx) * m_optLut[n111 +1 ]; + + out[2 ] = + (1 - fy) * m_optLut[n000 +2 ] + + (fy - fz) * m_optLut[n010 +2 ] + + (fz - fx) * m_optLut[n011 +2 ] + + (fx) * m_optLut[n111 +2 ]; + }else { + out[0 ] = + (1 - fy) * m_optLut[n000] + + (fy - fx) * m_optLut[n010] + + (fx - fz) * m_optLut[n110] + + (fz) * m_optLut[n111]; + + out[1 ] = + (1 - fy) * m_optLut[n000 +1 ] + + (fy - fx) * m_optLut[n010 +1 ] + + (fx - fz) * m_optLut[n110 +1 ] + + (fz) * m_optLut[n111 +1 ]; + + out[2 ] = + (1 - fy) * m_optLut[n000 +2 ] + + (fy - fx) * m_optLut[n010 +2 ] + + (fx - fz) * m_optLut[n110 +2 ] + + (fz) * m_optLut[n111 +2 ]; + } + } + + pixel->r = out[0 ]; + pixel->g = out[1 ]; + pixel->b = out[2 ]; +} + +void igt_color_3dlut_17_12_rgb (igt_pixel_t *pixel) +{ +igt_color_3dlut_tetrahedral (pixel, &igt_3dlut_17_rgb,17 ); +} +static void igt_color_fourcc_to_pixel (uint32_t raw_pixel,uint32_t drm_format,igt_pixel_t *pixel) {@@ -446,3 +624,11 @@ void igt_colorop_set_custom_1dlut(igt_display_t *display, {igt_colorop_replace_prop_blob (colorop,IGT_COLOROP_DATA , lut1d, lut_size); } + +void igt_colorop_set_3dlut (igt_display_t *display, +igt_colorop_t *colorop, +const igt_3dlut_norm_t *lut3d, +const size_t lut_size) +{ +igt_colorop_replace_prop_blob (colorop,IGT_COLOROP_DATA , lut3d, lut_size); +}lib/igt_color.h +10
-0@@ -16,6 +16,7 @@#include "igt_fb.h" #include "igt_kms.h" +#include "igt_color_lut.h" #define MAX_COLOR_LUT_ENTRIES 4096@@ -112,6 +113,12 @@ void igt_colorop_set_custom_1dlut(igt_display_t *display,const igt_1dlut_t *lut1d, const size_t lut_size); +void igt_colorop_set_3dlut (igt_display_t *display, +igt_colorop_t *colorop, +const igt_3dlut_norm_t *lut3d, +const size_t lut_size); + +/* transformations */ void igt_color_srgb_inv_eotf (igt_pixel_t *pixel);@@ -136,4 +143,7 @@ void igt_color_ctm_3x4_bt709_enc(igt_pixel_t *pixel);void igt_color_multiply_125 (igt_pixel_t *pixel);void igt_color_multiply_inv_125 (igt_pixel_t *pixel); +void igt_color_3dlut_17_12_rgb (igt_pixel_t *pixel); +void igt_color_3dlut_17_12_bgr (igt_pixel_t *pixel); +#endif lib/igt_color_lut.h new file +20
-0@@ -0,0 +1,4946 @@ +/* SPDX-License-Identifier: MIT */ +/* +* Copyright 2024 Advanced Micro Devices, Inc. +* +*/ + +#ifndef __IGT_COLOR_LUT_H__ +#define __IGT_COLOR_LUT_H__ + +#include "drm_mode.h" + +typedef struct igt_3dlut_norm { +struct drm_color_lut32 lut[4913 ]; +}igt_3dlut_norm_t ; + +struct igt_color_lut_float { +float red; +float green; +float blue; +};
lib/igt_color_lut.h line 30
Quoted 10 lines
lib/igt_color_lut.h new file +10
-0+ +typedef struct igt_3dlut { +struct igt_color_lut_float lut[4913 ]; +}igt_3dlut_t ; + +/* +* A 3D LUT table with 17x17x17 entries for Traversal order RGB. +* It can be generated by scripts/convert_3dlut.py +*/ +igt_3dlut_t igt_3dlut_17_rgb = { {
This is pretty big, and assuming this doesn't need to be changed, perhaps make it const so that it goes to .rodata
Quoted 14 lines
lib/igt_color_lut.h new file +14
-0+ { .red = 0.000000, .green = 0.000000, .blue = 0.000000 }, + { .red = 0.175580, .green = 0.003419, .blue = 0.006838 }, + { .red = 0.338706, .green = 0.015140, .blue = 0.012454 }, + { .red = 0.492552, .green = 0.015629, .blue = 0.012454 }, + { .red = 0.641026, .green = 0.023687, .blue = 0.013187 }, + { .red = 0.734310, .green = 0.049817, .blue = 0.013675 }, + { .red = 0.809035, .green = 0.063736, .blue = 0.006105 }, + { .red = 0.884982, .green = 0.063492, .blue = 0.019048 }, + { .red = 0.963370, .green = 0.056899, .blue = 0.028571 }, + { .red = 0.993407, .green = 0.080586, .blue = 0.044689 }, + { .red = 0.999267, .green = 0.099145, .blue = 0.054457 }, + { .red = 0.999267, .green = 0.110623, .blue = 0.060317 }, + { .red = 0.999267, .green = 0.116972, .blue = 0.064225 }, + { .red = 0.999267, .green = 0.121612, .blue = 0.066422 },
< snip >
Re: [PATCH V10 27/30] tests/kms_colorop: Add a 3D LUT subtest
In reply to Alex HungQuoted 20 lines · Alex Hung
This includes a subtests 3dlut_17_12_rgb.
Signed-off-by Alex Hung<[email protected]>--- include/drm-uapi/drm_mode.h | 18 + lib/igt_color.c | 186 ++ lib/igt_color.h | 10 + lib/igt_color_lut.h | 4946 +++++++++++++++++++++++++++++++++++ lib/igt_kms.c | 2 + lib/igt_kms.h | 2 + tests/kms_colorop.c | 35 +- tests/kms_colorop.h | 19 + 8 files changed, 5217 insertions(+), 1 deletion(-)create mode 100644
lib/igt_color_lut.hinclude/drm-uapi/drm_mode.h +0
-0
include/drm-uapi/drm_mode.h enum drm_colorop_type { · line 900
Quoted 10 lines
include/drm-uapi/drm_mode.h +7
-0@@ -891,6 +891,24 @@ enum drm_colorop_type {DRM_COLOROP_1D_LUT ,DRM_COLOROP_CTM_3X4 ,DRM_COLOROP_MULTIPLIER , + DRM_COLOROP_3D_LUT, +}; + +enum drm_colorop_interpolation_type { +DRM_COLOROP_TETRAHEDRAL , +}; +
This doesnt seem to be used anywhere, so drop?
PATCH v10 28/30 drm-uapi: Update kernel doc for drm_colorop_type
In reply to Alex HungSync up with kernel documents.
--- include/drm-uapi/drm_mode.h | 44 +++++++++++++++++++++++++++++++++++++ 1 file changed, 44 insertions(+)
include/drm-uapi/drm_mode.h +44 -0
@@ -886,11 +886,55 @@ struct drm_color_lut32 {__u32 reserved; }; +/** +* enum drm_colorop_type - Type of color operation +* +* +* drm_colorops can be of many different types. Each type behaves differently +* and defines a different set of properties. This enum defines all types and +* gives a high-level description. +*/ enum drm_colorop_type { +/** +* @DRM_COLOROP_1D_CURVE: +* +* A 1D curve that is being applied to all color channels. The +* curve is specified via tha CURVE_1D_TYPE colorop property. +*/ DRM_COLOROP_1D_CURVE , + +/** +* @DRM_COLOROP_1D_LUT: +* +* A simple 1D LUT of uniformly spaced &drm_color_lut32 entries, +* packed into a blob via the DATA property. The driver's expected +* LUT size is advertised via the SIZE property. +*/ DRM_COLOROP_1D_LUT , + +/** +* @DRM_COLOROP_CTM_3X4: +* +* A 3x4 matrix. Its values are specified via the +* &drm_color_ctm_3x4 struct provided via the DATA property. +*/ DRM_COLOROP_CTM_3X4 , + +/** +* @DRM_COLOROP_MULTIPLIER: +* +* A simple multiplier, applied to all color values. The +* multiplier is specified as a S31.32 via the MULTIPLIER +* property. +*/ DRM_COLOROP_MULTIPLIER , +/** +* @DRM_COLOROP_3D_LUT: +* +* A 3D LUT of &drm_color_lut entries, +* packed into a blob via the DATA property. The driver's expected +* LUT size is advertised via the SIZE property. +*/ DRM_COLOROP_3D_LUT , };
Signature · 1 line
2.43.0
Re: [PATCH V10 28/30] drm-uapi: Update kernel doc for drm_colorop_type
Hi Alex,
On 2025-08-14 at 22:06:57 -0600, Alex Hung wrote:
please improve subject, imho add 'drm_mode' prefix:
[PATCH V10 28/30] drm-uapi/drm_mode: Update kernel doc for drm_colorop_type
Quoted 1 line
Sync up with kernel documents.
Provide kernel commit here, link to lore.kernel.org also could be added.
Or look into history and do similar commit:
git log -- include/drm-uapi/drm_mode.h
Regards,
Kamil
Quoted 69 lines
Signed-off-by Alex Hung <[email protected]>--- include/drm-uapi/drm_mode.h | 44 +++++++++++++++++++++++++++++++++++++ 1 file changed, 44 insertions(+)include/drm-uapi/drm_mode.h +44
-0@@ -886,11 +886,55 @@ struct drm_color_lut32 {__u32 reserved; }; +/** +* enum drm_colorop_type - Type of color operation +* +* +* drm_colorops can be of many different types. Each type behaves differently +* and defines a different set of properties. This enum defines all types and +* gives a high-level description. +*/ enum drm_colorop_type { +/** +* @DRM_COLOROP_1D_CURVE: +* +* A 1D curve that is being applied to all color channels. The +* curve is specified via tha CURVE_1D_TYPE colorop property. +*/ DRM_COLOROP_1D_CURVE , + +/** +* @DRM_COLOROP_1D_LUT: +* +* A simple 1D LUT of uniformly spaced &drm_color_lut32 entries, +* packed into a blob via the DATA property. The driver's expected +* LUT size is advertised via the SIZE property. +*/ DRM_COLOROP_1D_LUT , + +/** +* @DRM_COLOROP_CTM_3X4: +* +* A 3x4 matrix. Its values are specified via the +* &drm_color_ctm_3x4 struct provided via the DATA property. +*/ DRM_COLOROP_CTM_3X4 , + +/** +* @DRM_COLOROP_MULTIPLIER: +* +* A simple multiplier, applied to all color values. The +* multiplier is specified as a S31.32 via the MULTIPLIER +* property. +*/ DRM_COLOROP_MULTIPLIER , +/** +* @DRM_COLOROP_3D_LUT: +* +* A 3D LUT of &drm_color_lut entries, +* packed into a blob via the DATA property. The driver's expected +* LUT size is advertised via the SIZE property. +*/ DRM_COLOROP_3D_LUT , };Signature · 1 line
2.43.0
Re: [PATCH V10 28/30] drm-uapi: Update kernel doc for drm_colorop_type
Quoted 5 lines · Kamil Konieczny
Hi Alex,
On 2025-08-14 at 22:06:57 -0600, Alex Hung wrote:please improve subject, imho add '
drm_mode' prefix:
Quoted 8 lines
[PATCH V10 28/30] drm-uapi/drm_mode: Update kernel doc for
drm_colorop_typeQuoted 1 line
Sync up with kernel documents.
Provide kernel commit here, link to lore.kernel.org also could be added.
Or look into history and do similar commit:
git log --include/drm-uapi/drm_mode.h
I will move the doc to where where each enum drm_colorop_type is introduced and then drop this patch, since it makes more sense.
Quoted 73 lines
Regards,
KamilQuoted 69 lines
Signed-off-by Alex Hung <[email protected]>--- include/drm-uapi/drm_mode.h | 44 +++++++++++++++++++++++++++++++++++++ 1 file changed, 44 insertions(+)include/drm-uapi/drm_mode.h +44
-0@@ -886,11 +886,55 @@ struct drm_color_lut32 {__u32 reserved; }; +/** +* enum drm_colorop_type - Type of color operation +* +* +* drm_colorops can be of many different types. Each type behaves differently +* and defines a different set of properties. This enum defines all types and +* gives a high-level description. +*/ enum drm_colorop_type { +/** +* @DRM_COLOROP_1D_CURVE: +* +* A 1D curve that is being applied to all color channels. The +* curve is specified via tha CURVE_1D_TYPE colorop property. +*/ DRM_COLOROP_1D_CURVE , + +/** +* @DRM_COLOROP_1D_LUT: +* +* A simple 1D LUT of uniformly spaced &drm_color_lut32 entries, +* packed into a blob via the DATA property. The driver's expected +* LUT size is advertised via the SIZE property. +*/ DRM_COLOROP_1D_LUT , + +/** +* @DRM_COLOROP_CTM_3X4: +* +* A 3x4 matrix. Its values are specified via the +* &drm_color_ctm_3x4 struct provided via the DATA property. +*/ DRM_COLOROP_CTM_3X4 , + +/** +* @DRM_COLOROP_MULTIPLIER: +* +* A simple multiplier, applied to all color values. The +* multiplier is specified as a S31.32 via the MULTIPLIER +* property. +*/ DRM_COLOROP_MULTIPLIER , +/** +* @DRM_COLOROP_3D_LUT: +* +* A 3D LUT of &drm_color_lut entries, +* packed into a blob via the DATA property. The driver's expected +* LUT size is advertised via the SIZE property. +*/ DRM_COLOROP_3D_LUT , };Signature · 1 line
2.43.0
PATCH v10 29/30 drm-uapi: Sync up definition with kernel colorop implementation
In reply to Alex HungAdd drm_colorop_lut1d_interpolation_type to IGT.
--- include/drm-uapi/drm_mode.h | 13 +++++++++++++ 1 file changed, 13 insertions(+)
include/drm-uapi/drm_mode.h +13 -0
@@ -968,6 +968,19 @@ struct drm_plane_size_hint {__u16 height; }; +/** +* enum drm_colorop_lut1d_interpolation_type - type of interpolation for 1D LUTs +*/ +enum drm_colorop_lut1d_interpolation_type { +/** +* @DRM_COLOROP_LUT1D_INTERPOLATION_LINEAR: +* +* Linear interpolation. Values between points of the LUT will be +* linearly interpolated. +*/ +DRM_COLOROP_LUT1D_INTERPOLATION_LINEAR , +}; +/** * struct hdr_metadata_infoframe - HDR Metadata Infoframe Data. *
Signature · 1 line
2.43.0
PATCH v10 30/30 tests/kms_colorop: Add a colorop uniqueness subtest
In reply to Alex HungA colorop should have unique ID.
--- tests/kms_colorop.c | 50 +++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 50 insertions(+)
tests/kms_colorop.c +50 -0
@@ -26,11 +26,16 @@#include "sw_sync.h" #include "kms_colorop.h" +#include <glib.h> +/** * TEST: kms colorop * Category: Display * Description: Test to validate the retrieving and setting of DRM colorops * +* SUBTEST: check_plane_colorop_ids +* Description: Verify that all igt_colorop_t IDs are unique across planes +* * SUBTEST: plane-%s-%s * Description: Tests DRM colorop properties on a plane * Driver requirement: amdgpu
@@ -546,6 +551,47 @@ static void colorop_plane_test(igt_display_t *display, } +static void check_plane_colorop_ids (igt_display_t *display) +{ +igt_plane_t *plane; +int colorop_idx; +igt_colorop_t *next; +int prop_val =0 , pipe =0 ; + +/* Use hash tables to track drm_planes and unique IDs */ +GHashTable *plane_set =g_hash_table_new (g_direct_hash, g_direct_equal); +GHashTable *id_set =g_hash_table_new (g_direct_hash, g_direct_equal); + +for_each_pipe (display, pipe) { +for_each_plane_on_pipe (display, pipe, plane) { +/* Skip when a drm_plane is already scanned */ +if (g_hash_table_contains (plane_set,GINT_TO_POINTER (plane->drm_plane->plane_id))) +continue ; + +g_hash_table_add (plane_set,GINT_TO_POINTER (plane->drm_plane->plane_id)); + +for (colorop_idx =0 ; colorop_idx < plane->num_color_pipelines; colorop_idx++) { + next = plane->color_pipelines[colorop_idx]; +while (next) { +/* Check if the ID already exists in the set */ +if (g_hash_table_contains (id_set,GINT_TO_POINTER (next->id))) { +igt_fail_on_f (true,"Duplicate colorop ID %u found on plane %d\n" , + next->id, plane->drm_plane->plane_id); + } + +g_hash_table_add (id_set,GINT_TO_POINTER (next->id)); + prop_val =igt_colorop_get_prop (display, next,IGT_COLOROP_NEXT ); + next =igt_find_colorop (display, prop_val); + } + } + } + } + +g_hash_table_destroy (id_set); +g_hash_table_destroy (plane_set); +igt_info ("All igt_colorop_t IDs are unique across planes\n" ); +} + igt_main {
@@ -613,6 +659,10 @@ igt_mainigt_require (display.is_atomic); } + igt_subtest_f("check_plane_colorop_ids") { +check_plane_colorop_ids (&display); + } +for (j =0 ; j <ARRAY_SIZE (formats); j++) {igt_output_t *output;igt_plane_t *plane;
Signature · 1 line
2.43.0
Patchwork
CI✓ i915.CI.BAT: success for IGT tests for the KMS Color Pipeline API (rev10)
In reply to Alex Hung== Series Details ==
== Series Details ==
Series: IGT tests for the KMS Color Pipeline API (rev10)
URL : https://patchwork.freedesktop.org/series/123448/
State : success
== Summary ==
CI Bug Log - changes from IGT_8494 -> IGTPW_13586
====================================================
Summary
-------
**SUCCESS**
No regressions found.
External URL: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_13586/index.html
Participating hosts (43 -> 42)
------------------------------
Missing (1): fi-snb-2520m
Known issues
------------
Here are the changes found in IGTPW_13586 that come from known issues:
### IGT changes ###
#### Issues hit ####
* igt@core_hotunplug@unbind-rebind:
- bat-rplp-1: [PASS][1] -> [ABORT][2] ([i915#14804])
[1]: https://intel-gfx-ci.01.org/tree/drm-tip/IGT_8494/bat-rplp-1/igt@[email protected]
[2]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_13586/bat-rplp-1/igt@[email protected]
* igt@dmabuf@all-tests@dma_fence_chain:
- fi-bsw-n3050: [PASS][3] -> [ABORT][4] ([i915#12904]) +1 other test abort
[3]: https://intel-gfx-ci.01.org/tree/drm-tip/IGT_8494/fi-bsw-n3050/igt@dmabuf@all-tests@dma_fence_chain.html
[4]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_13586/fi-bsw-n3050/igt@dmabuf@all-tests@dma_fence_chain.html
* igt@gem_lmem_swapping@basic:
- bat-arls-5: NOTRUN -> [SKIP][5] ([i915#10213] / [i915#11671]) +3 other tests skip
[5]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_13586/bat-arls-5/igt@[email protected]
* igt@gem_lmem_swapping@parallel-random-engines:
- bat-arls-6: NOTRUN -> [SKIP][6] ([i915#10213] / [i915#11671]) +3 other tests skip
[6]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_13586/bat-arls-6/igt@[email protected]
- bat-jsl-1: NOTRUN -> [SKIP][7] ([i915#4613]) +3 other tests skip
[7]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_13586/bat-jsl-1/igt@[email protected]
- bat-arlh-3: NOTRUN -> [SKIP][8] ([i915#11671]) +3 other tests skip
[8]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_13586/bat-arlh-3/igt@[email protected]
- fi-glk-j4005: NOTRUN -> [SKIP][9] ([i915#4613]) +3 other tests skip
[9]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_13586/fi-glk-j4005/igt@[email protected]
* igt@i915_selftest@live@guc_multi_lrc:
- bat-dg2-11: [PASS][10] -> [ABORT][11] ([i915#14201])
[10]: https://intel-gfx-ci.01.org/tree/drm-tip/IGT_8494/bat-dg2-11/igt@i915_selftest@live@guc_multi_lrc.html
[11]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_13586/bat-dg2-11/igt@i915_selftest@live@guc_multi_lrc.html
* igt@i915_selftest@live@workarounds:
- bat-arls-5: NOTRUN -> [DMESG-FAIL][12] ([i915#12061]) +1 other test dmesg-fail
[12]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_13586/bat-arls-5/igt@i915_selftest@[email protected]
- bat-dg2-9: [PASS][13] -> [DMESG-FAIL][14] ([i915#12061]) +1 other test dmesg-fail
[13]: https://intel-gfx-ci.01.org/tree/drm-tip/IGT_8494/bat-dg2-9/igt@i915_selftest@[email protected]
[14]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_13586/bat-dg2-9/igt@i915_selftest@[email protected]
- bat-arls-6: NOTRUN -> [DMESG-FAIL][15] ([i915#12061]) +1 other test dmesg-fail
[15]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_13586/bat-arls-6/igt@i915_selftest@[email protected]
* igt@kms_psr@psr-primary-page-flip:
- fi-glk-j4005: NOTRUN -> [SKIP][16] +6 other tests skip
[16]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_13586/fi-glk-j4005/igt@[email protected]
#### Possible fixes ####
* igt@core_hotunplug@unbind-rebind:
- bat-arls-6: [ABORT][17] ([i915#14804]) -> [PASS][18]
[17]: https://intel-gfx-ci.01.org/tree/drm-tip/IGT_8494/bat-arls-6/igt@[email protected]
[18]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_13586/bat-arls-6/igt@[email protected]
- bat-jsl-1: [ABORT][19] ([i915#14804]) -> [PASS][20]
[19]: https://intel-gfx-ci.01.org/tree/drm-tip/IGT_8494/bat-jsl-1/igt@[email protected]
[20]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_13586/bat-jsl-1/igt@[email protected]
- bat-arls-5: [ABORT][21] ([i915#14804]) -> [PASS][22]
[21]: https://intel-gfx-ci.01.org/tree/drm-tip/IGT_8494/bat-arls-5/igt@[email protected]
[22]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_13586/bat-arls-5/igt@[email protected]
* igt@dmabuf@all-tests@dma_fence_chain:
- fi-bsw-nick: [ABORT][23] ([i915#12904]) -> [PASS][24] +1 other test pass
[23]: https://intel-gfx-ci.01.org/tree/drm-tip/IGT_8494/fi-bsw-nick/igt@dmabuf@all-tests@dma_fence_chain.html
[24]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_13586/fi-bsw-nick/igt@dmabuf@all-tests@dma_fence_chain.html
* igt@i915_module_load@reload:
- bat-arlh-3: [ABORT][25] ([i915#14804]) -> [PASS][26]
[25]: https://intel-gfx-ci.01.org/tree/drm-tip/IGT_8494/bat-arlh-3/igt@[email protected]
[26]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_13586/bat-arlh-3/igt@[email protected]
* igt@i915_selftest@live:
- bat-dg2-8: [DMESG-FAIL][27] ([i915#12061]) -> [PASS][28] +1 other test pass
[27]: https://intel-gfx-ci.01.org/tree/drm-tip/IGT_8494/bat-dg2-8/igt@[email protected]
[28]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_13586/bat-dg2-8/igt@[email protected]
* igt@i915_selftest@live@workarounds:
- bat-mtlp-6: [DMESG-FAIL][29] ([i915#12061]) -> [PASS][30] +1 other test pass
[29]: https://intel-gfx-ci.01.org/tree/drm-tip/IGT_8494/bat-mtlp-6/igt@i915_selftest@[email protected]
[30]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_13586/bat-mtlp-6/igt@i915_selftest@[email protected]
- bat-mtlp-9: [DMESG-FAIL][31] ([i915#12061]) -> [PASS][32] +1 other test pass
[31]: https://intel-gfx-ci.01.org/tree/drm-tip/IGT_8494/bat-mtlp-9/igt@i915_selftest@[email protected]
[32]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_13586/bat-mtlp-9/igt@i915_selftest@[email protected]
* igt@kms_flip@basic-flip-vs-dpms@b-hdmi-a2:
- fi-glk-j4005: [ABORT][33] ([i915#14804]) -> [PASS][34] +1 other test pass
[33]: https://intel-gfx-ci.01.org/tree/drm-tip/IGT_8494/fi-glk-j4005/igt@kms_flip@[email protected]
[34]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_13586/fi-glk-j4005/igt@kms_flip@[email protected]
#### Warnings ####
* igt@i915_selftest@live:
- bat-dg2-11: [DMESG-FAIL][35] ([i915#12061]) -> [ABORT][36] ([i915#12061])
[35]: https://intel-gfx-ci.01.org/tree/drm-tip/IGT_8494/bat-dg2-11/igt@[email protected]
[36]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_13586/bat-dg2-11/igt@[email protected]
[i915#10213]: https://gitlab.freedesktop.org/drm/i915/kernel/-/issues/10213
[i915#11671]: https://gitlab.freedesktop.org/drm/i915/kernel/-/issues/11671
[i915#12061]: https://gitlab.freedesktop.org/drm/i915/kernel/-/issues/12061
[i915#12904]: https://gitlab.freedesktop.org/drm/i915/kernel/-/issues/12904
[i915#14201]: https://gitlab.freedesktop.org/drm/i915/kernel/-/issues/14201
[i915#14804]: https://gitlab.freedesktop.org/drm/i915/kernel/-/issues/14804
[i915#4613]: https://gitlab.freedesktop.org/drm/i915/kernel/-/issues/4613
Build changes
-------------
* CI: CI-20190529 -> None
* IGT: IGT_8494 -> IGTPW_13586
* Linux: CI_DRM_17000 -> CI_DRM_17004
CI-20190529: 20190529
CI_DRM_17000: 7f1ecbbddf3bf50bf5338e86514bf77c32eb4edb @ git://anongit.freedesktop.org/gfx-ci/linux
CI_DRM_17004: 90b26f76462c96e29198988df41d6bd86d92c656 @ git://anongit.freedesktop.org/gfx-ci/linux
IGTPW_13586: 12c4cafd059541b6bd4dd2e4347bafda874323dd @ https://gitlab.freedesktop.org/drm/igt-gpu-tools.git
IGT_8494: 8494
== Logs ==
For more details see: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_13586/index.html
Patchwork
CI✓ Xe.CI.BAT: success for IGT tests for the KMS Color Pipeline API (rev10)
In reply to Alex Hung== Series Details ==
== Series Details ==
Series: IGT tests for the KMS Color Pipeline API (rev10)
URL : https://patchwork.freedesktop.org/series/123448/
State : success
== Summary ==
CI Bug Log - changes from XEIGT_8494_BAT -> XEIGTPW_13586_BAT
====================================================
Summary
-------
**SUCCESS**
No regressions found.
Participating hosts (9 -> 9)
------------------------------
No changes in participating hosts
Known issues
------------
Here are the changes found in XEIGTPW_13586_BAT that come from known issues:
### IGT changes ###
#### Possible fixes ####
* igt@kms_flip@basic-plain-flip@b-edp1:
- bat-adlp-7: [DMESG-WARN][1] ([Intel XE#4543]) -> [PASS][2] +1 other test pass
[1]: https://intel-gfx-ci.01.org/tree/intel-xe/IGT_8494/bat-adlp-7/igt@kms_flip@[email protected]
[2]: https://intel-gfx-ci.01.org/tree/intel-xe/IGTPW_13586/bat-adlp-7/igt@kms_flip@[email protected]
* igt@xe_vm@bind-execqueues-independent:
- {bat-ptl-1}: [FAIL][3] ([Intel XE#5783]) -> [PASS][4]
[3]: https://intel-gfx-ci.01.org/tree/intel-xe/IGT_8494/bat-ptl-1/igt@[email protected]
[4]: https://intel-gfx-ci.01.org/tree/intel-xe/IGTPW_13586/bat-ptl-1/igt@[email protected]
- {bat-ptl-2}: [FAIL][5] ([Intel XE#5783]) -> [PASS][6]
[5]: https://intel-gfx-ci.01.org/tree/intel-xe/IGT_8494/bat-ptl-2/igt@[email protected]
[6]: https://intel-gfx-ci.01.org/tree/intel-xe/IGTPW_13586/bat-ptl-2/igt@[email protected]
{name}: This element is suppressed. This means it is ignored when computing
the status of the difference (SUCCESS, WARNING, or FAILURE).
[Intel XE#4543]: https://gitlab.freedesktop.org/drm/xe/kernel/issues/4543
[Intel XE#5783]: https://gitlab.freedesktop.org/drm/xe/kernel/issues/5783
Build changes
-------------
* IGT: IGT_8494 -> IGTPW_13586
* Linux: xe-3545-7f1ecbbddf3bf50bf5338e86514bf77c32eb4edb -> xe-3549-90b26f76462c96e29198988df41d6bd86d92c656
IGTPW_13586: 12c4cafd059541b6bd4dd2e4347bafda874323dd @ https://gitlab.freedesktop.org/drm/igt-gpu-tools.git
IGT_8494: 8494
xe-3545-7f1ecbbddf3bf50bf5338e86514bf77c32eb4edb: 7f1ecbbddf3bf50bf5338e86514bf77c32eb4edb xe-3549-90b26f76462c96e29198988df41d6bd86d92c656: 90b26f76462c96e29198988df41d6bd86d92c656
== Logs ==
For more details see: https://intel-gfx-ci.01.org/tree/intel-xe/IGTPW_13586/index.html