Re: [PATCH v3 10/12] tests/kms_colorop: Keep CRTC active between YUV tests with temp FB

Alex Hung <[email protected]> Sat, 25 Jul 2026 01:19:17 -0600
Newsgroups org.freedesktop.lists.igt-dev
Message-ID <[email protected]>
This can be squashed with the previous patch.

On 6/23/26 11:57, Harry Wentland wrote:
> Move output_fb creation to fixture and introduce temp_fb to keep the
> plane/CRTC active between YUV subtests. This prevents the "framebuffer
> without CRTC" error that occurred when removing input_fb caused IGT to
> disable the CRTC, leaving the writeback connector detached but with FB
> still set.
> 
> Each YUV test now:
> - Creates input_fb with specific encoding/range
> - Runs test
> - Switches plane to temp_fb (commits to hardware)
> - Removes input_fb safely
> 
> Assisted-by: Claude:claude-opus-4-6
> Signed-off-by: Harry Wentland <[email protected]>
> ---
>   tests/kms_colorop.c | 21 +++++++++++++++++----
>   1 file changed, 17 insertions(+), 4 deletions(-)
> 
> diff --git a/tests/kms_colorop.c b/tests/kms_colorop.c
> index 1d30d2538574..4e8b2563ea4e 100644
> --- a/tests/kms_colorop.c
> +++ b/tests/kms_colorop.c
> @@ -585,7 +585,7 @@ int igt_main_args("d", long_options, help_str, opt_handler, NULL)
>   	for (j = 0; j < ARRAY_SIZE(formats_yuv); j++) {
>   		igt_output_t *output;
>   		igt_plane_t *plane;
> -		igt_fb_t output_fb;
> +		igt_fb_t temp_fb, output_fb;
>   		unsigned int fb_id;
>   		drmModeModeInfo mode;
>   
> @@ -605,7 +605,14 @@ int igt_main_args("d", long_options, help_str, opt_handler, NULL)
>   				igt_assert(plane);
>   				igt_require(igt_plane_has_prop(plane, IGT_PLANE_COLOR_PIPELINE));
>   
> -				/* create output fb */
> +				/* Create temp fb to keep plane active between tests */
> +				fb_id = igt_create_fb(display.drm_fd, mode.hdisplay, mode.vdisplay,
> +							formats_yuv[j].fourcc_in,
> +							igt_fb_mod_to_tiling(0),
> +							&temp_fb);
> +				igt_require(fb_id > 0);
> +
> +				/* Create output fb shared across tests */
>   				fb_id = igt_create_fb(display.drm_fd, mode.hdisplay, mode.vdisplay,
>   							formats_yuv[j].fourcc_out,
>   							igt_fb_mod_to_tiling(0),
> @@ -613,7 +620,7 @@ int igt_main_args("d", long_options, help_str, opt_handler, NULL)
>   				igt_require(fb_id > 0);
>   			}
>   
> -			/* Run YUV tests - create input_fb per test with correct encoding/range */
> +			/* Run YUV tests - create input_fb per test */
>   			for (i = 0; i < ARRAY_SIZE(tests_yuv); i++) {
>   				igt_describe("Check YUV CSC colorop");
>   				igt_subtest_f("plane-%s-%s", formats_yuv[j].name, tests_yuv[i].name) {
> @@ -648,14 +655,20 @@ int igt_main_args("d", long_options, help_str, opt_handler, NULL)
>   							formats_yuv[j].fourcc_out,
>   							tests_yuv[i].colorops);
>   
> +					/* Switch plane back to temp_fb to keep CRTC active */
> +					igt_plane_set_fb(plane, &temp_fb);
> +					igt_display_commit_atomic(&display,
> +								DRM_MODE_ATOMIC_ALLOW_MODESET,
> +								NULL);
> +
>   					igt_remove_fb(display.drm_fd, &input_fb);
>   				}
>   			}
>   
>   			igt_fixture() {
>   				igt_detach_crtc(&display, output);
> +				igt_remove_fb(display.drm_fd, &temp_fb);
>   				igt_remove_fb(display.drm_fd, &output_fb);
> -
>   			}
>   		}
>   	}