All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Kulkarni, Vandita" <vandita.kulkarni@intel.com>
To: "Patnana, Venkata Sai" <venkata.sai.patnana@intel.com>,
	"igt-dev@lists.freedesktop.org" <igt-dev@lists.freedesktop.org>
Cc: "Latvala, Petri" <petri.latvala@intel.com>
Subject: Re: [igt-dev] [PATCH i-g-t v3 1/4] tests/kms_dp_dsc: Add a subtest to force DSC output BPP
Date: Mon, 19 Jul 2021 05:58:58 +0000	[thread overview]
Message-ID: <fb907301dc7a4fdeba667fe3f7006dd5@intel.com> (raw)
In-Reply-To: <20210709151628.10799-1-venkata.sai.patnana@intel.com>

It would have been easier to review if version changes were mentioned in the commit message, otherwise
LGTM
Reviewed-by: Vandita Kulkarni <Vandita.kulkarni@intel.com>

> -----Original Message-----
> From: Patnana, Venkata Sai <venkata.sai.patnana@intel.com>
> Sent: Friday, July 9, 2021 8:46 PM
> To: igt-dev@lists.freedesktop.org
> Cc: Patnana, Venkata Sai <venkata.sai.patnana@intel.com>; Srivatsa, Anusha
> <anusha.srivatsa@intel.com>; B S, Karthik <karthik.b.s@intel.com>; Kulkarni,
> Vandita <vandita.kulkarni@intel.com>; Navare, Manasi D
> <manasi.d.navare@intel.com>; Latvala, Petri <petri.latvala@intel.com>
> Subject: [PATCH i-g-t v3 1/4] tests/kms_dp_dsc: Add a subtest to force DSC
> output BPP
> 
> From: Patnana Venkata Sai <venkata.sai.patnana@intel.com>
> 
> This subtest uses the accepted DSC BPPs and tries to force a modeset by
> setting a certain BPP as the output BPP for a connector.
> 
> Signed-off-by: Anusha Srivatsa <anusha.srivatsa@intel.com>
> Signed-off-by: Karthik B S <karthik.b.s@intel.com>
> Cc: Karthik B S <karthik.b.s@intel.com>
> Cc: Vandita Kulkarni <vandita.kulkarni@intel.com>
> Cc: Navare Manasi D <manasi.d.navare@intel.com>
> Signed-off-by: Petri Latvala <petri.latvala@intel.com>
> Signed-off-by: Patnana Venkata Sai <venkata.sai.patnana@intel.com>
> ---
>  tests/kms_dp_dsc.c | 206 ++++++++++++++++++++++++++++----------------
> -
>  1 file changed, 130 insertions(+), 76 deletions(-)
> 
> diff --git a/tests/kms_dp_dsc.c b/tests/kms_dp_dsc.c index
> 3fb9852e9e..7e913d0de7 100644
> --- a/tests/kms_dp_dsc.c
> +++ b/tests/kms_dp_dsc.c
> @@ -44,23 +44,26 @@
>  #include <fcntl.h>
>  #include <termios.h>
> 
> +/* currently dsc compression is verifying on 8bpc frame only */ #define
> +XRGB8888_DRM_FORMAT_MIN_BPP 8
> +
>  enum dsc_test_type
>  {
> -	test_basic_dsc_enable
> +	test_basic_dsc_enable,
> +	test_dsc_compression_bpp
>  };
> 
>  typedef struct {
>  	int drm_fd;
>  	int debugfs_fd;
> -	uint32_t id;
> +	uint32_t devid;
>  	igt_display_t display;
>  	struct igt_fb fb_test_pattern;
>  	igt_output_t *output;
>  	int mode_valid;
> -	drmModeModeInfo *mode;
> -	drmModeConnector *connector;
>  	drmModeEncoder *encoder;
>  	int crtc;
> +	int compression_bpp;
>  	enum pipe pipe;
>  	char conn_name[128];
>  } data_t;
> @@ -121,6 +124,22 @@ static void force_dp_dsc_enable(data_t *data)
>  	igt_assert_f(ret > 0, "debugfs_write failed");  }
> 
> +static void force_dp_dsc_set_bpp(data_t *data) {
> +	int ret;
> +	char file_name[128] = {0};
> +	char buffer[20];
> +
> +	sprintf(buffer, "%d", data->compression_bpp);
> +	strcpy(file_name, data->conn_name);
> +	strcat(file_name, "/i915_dsc_bpp");
> +	igt_debug("Forcing DSC BPP to %d on %s\n",
> +		  data->compression_bpp, data->conn_name);
> +	ret = igt_sysfs_write(data->debugfs_fd, file_name,
> +			      buffer, sizeof(buffer));
> +	igt_assert_f(ret > 0, "debugfs_write failed"); }
> +
>  static bool is_force_dsc_enabled(data_t *data)  {
>  	char file_name[128] = {0};
> @@ -165,6 +184,7 @@ static void test_cleanup(data_t *data)
>  		primary = igt_output_get_plane_type(data->output,
> 
> DRM_PLANE_TYPE_PRIMARY);
>  		igt_plane_set_fb(primary, NULL);
> +		igt_output_set_pipe(data->output, PIPE_NONE);
>  		igt_display_commit(&data->display);
>  	}
>  }
> @@ -174,6 +194,37 @@ static void kms_dp_dsc_exit_handler(int sig)
>  	restore_force_dsc_en();
>  }
> 
> +static bool check_dsc_on_connector(data_t *data, uint32_t drmConnector)
> +{
> +	drmModeConnector *connector;
> +	igt_output_t *output;
> +
> +	connector = drmModeGetConnectorCurrent(data->drm_fd,
> +					       drmConnector);
> +	if (connector->connection != DRM_MODE_CONNECTED ||
> +	    ((connector->connector_type != DRM_MODE_CONNECTOR_eDP)
> &&
> +	    (connector->connector_type !=
> DRM_MODE_CONNECTOR_DisplayPort)))
> +		return false;
> +
> +	output = igt_output_from_connector(&data->display, connector);
> +	sprintf(data->conn_name, "%s-%d",
> +		kmstest_connector_type_str(connector->connector_type),
> +		connector->connector_type_id);
> +
> +	if (!is_dp_dsc_supported(data)) {
> +		igt_debug("DSC not supported on connector %s\n",
> +			  data->conn_name);
> +		return false;
> +	}
> +	if (connector->connector_type ==
> DRM_MODE_CONNECTOR_DisplayPort &&
> +	    !is_dp_fec_supported(data)) {
> +		igt_debug("DSC cannot be enabled without FEC on %s\n",
> +			  data->conn_name);
> +		return false;
> +	}
> +	data->output = output;
> +	return true;
> +}
> 
>  /*
>   * Re-probe connectors and do a modeset with DSC @@ -181,54 +232,57
> @@ static void kms_dp_dsc_exit_handler(int sig)
>   */
>  static void update_display(data_t *data, enum dsc_test_type test_type)  {
> +	bool enabled;
>  	igt_plane_t *primary;
> -	data->connector = data->output->config.connector;
> 
>  	/* Disable the output first */
>  	igt_output_set_pipe(data->output, PIPE_NONE);
>  	igt_display_commit(&data->display);
> 
> -	if (test_type == test_basic_dsc_enable) {
> -		bool enabled;
> +	igt_debug("DSC is supported on %s\n", data->conn_name);
> +	save_force_dsc_en(data);
> +	force_dp_dsc_enable(data);
> +	if (test_type == test_dsc_compression_bpp) {
> +		igt_debug("Trying to set BPP to %d\n", data-
> >compression_bpp);
> +		force_dp_dsc_set_bpp(data);
> +	}
> 
> -		igt_debug("DSC is supported on %s\n", data->conn_name);
> -		save_force_dsc_en(data);
> -		force_dp_dsc_enable(data);
> +	igt_output_set_pipe(data->output, data->pipe);
> +	primary = igt_output_get_plane_type(data->output,
> +					    DRM_PLANE_TYPE_PRIMARY);
> 
> -		igt_output_set_pipe(data->output, data->pipe);
> -		primary = igt_output_get_plane_type(data->output,
> -
> DRM_PLANE_TYPE_PRIMARY);
> +	/* Now set the output to the desired mode */
> +	igt_plane_set_fb(primary, &data->fb_test_pattern);
> +	igt_display_commit(&data->display);
> 
> -		/* Now set the output to the desired mode */
> -		igt_plane_set_fb(primary, &data->fb_test_pattern);
> -		igt_display_commit(&data->display);
> +	/*
> +	 * Until we have CRC check support, manually check if RGB test
> +	 * pattern has no corruption.
> +	 */
> +	manual("RGB test pattern without corruption");
> 
> -		/*
> -		 * Until we have CRC check support, manually check if RGB
> test
> -		 * pattern has no corruption.
> -		 */
> -		manual("RGB test pattern without corruption");
> -
> -		enabled = is_dp_dsc_enabled(data);
> -		restore_force_dsc_en();
> -
> -		igt_assert_f(enabled,
> -			     "Default DSC enable failed on Connector: %s Pipe:
> %s\n",
> -			     data->conn_name,
> -			     kmstest_pipe_name(data->pipe));
> -	} else {
> -		igt_assert(!"Unknown test type\n");
> +	enabled = is_dp_dsc_enabled(data);
> +	restore_force_dsc_en();
> +	if (test_type == test_dsc_compression_bpp) {
> +		igt_debug("Rest compression BPP \n");
> +		data->compression_bpp = 0;
> +		force_dp_dsc_set_bpp(data);
>  	}
> +
> +	igt_assert_f(enabled,
> +		     "Default DSC enable failed on Connector: %s Pipe: %s\n",
> +		     data->conn_name,
> +		     kmstest_pipe_name(data->pipe));
>  }
> 
> -static void run_test(data_t *data, igt_output_t *output,
> -		     enum dsc_test_type test_type)
> +static void run_test(data_t *data, enum dsc_test_type test_type)
>  {
>  	enum pipe pipe;
> +	char test_name[10];
> +	drmModeModeInfo *mode = igt_output_get_mode(data->output);
> 
> -	data->mode = igt_output_get_mode(output);
> -	igt_create_pattern_fb(data->drm_fd, data->mode->hdisplay,
> -			      data->mode->vdisplay,
> +	igt_create_pattern_fb(data->drm_fd, mode->hdisplay,
> +			      mode->vdisplay,
>  			      DRM_FORMAT_XRGB8888,
>  			      LOCAL_DRM_FORMAT_MOD_NONE,
>  			      &data->fb_test_pattern);
> @@ -237,19 +291,26 @@ static void run_test(data_t *data, igt_output_t
> *output,
>  		if (is_i915_device(data->drm_fd)) {
>  			uint32_t devid = intel_get_drm_devid(data-
> >drm_fd);
> 
> -			if (output->config.connector->connector_type ==
> DRM_MODE_CONNECTOR_DisplayPort &&
> +			if (data->output->config.connector->connector_type
> ==
> +DRM_MODE_CONNECTOR_DisplayPort &&
>  			    pipe == PIPE_A && IS_GEN11(devid)) {
>  				igt_debug("DSC not supported on Pipe A on
> external DP in Gen11 platforms\n");
>  				continue;
>  			}
>  		}
> 
> -		if (igt_pipe_connector_valid(pipe, output)) {
> +		snprintf(test_name, sizeof(test_name), "-%dbpp", data-
> >compression_bpp);
> +		if (igt_pipe_connector_valid(pipe, data->output)) {
>  			data->pipe = pipe;
> -			data->output = output;
> -			update_display(data, test_type);
> -			test_cleanup(data);
> +
> +			igt_dynamic_f("%s-pipe-%s%s", data->output-
> >name,
> +					kmstest_pipe_name(pipe),
> +					(test_type ==
> test_dsc_compression_bpp) ?
> +					 test_name : "")
> +				update_display(data, test_type);
>  		}
> +
> +		if (test_type == test_dsc_compression_bpp)
> +			break;
>  	}
> 
>  	igt_remove_fb(data->drm_fd, &data->fb_test_pattern); @@ -
> 258,59 +319,52 @@ static void run_test(data_t *data, igt_output_t *output,
> igt_main  {
>  	data_t data = {};
> -	igt_output_t *output;
>  	drmModeRes *res;
>  	drmModeConnector *connector = NULL;
> -	int i, test_conn_cnt, test_cnt;
> -	int tests[] = {DRM_MODE_CONNECTOR_eDP,
> DRM_MODE_CONNECTOR_DisplayPort};
> -
> +	int i, j;
>  	igt_fixture {
>  		data.drm_fd = drm_open_driver_master(DRIVER_ANY);
> +		igt_require_intel(data.drm_fd);
> +		data.devid = intel_get_drm_devid(data.drm_fd);
>  		data.debugfs_fd = igt_debugfs_dir(data.drm_fd);
>  		kmstest_set_vt_graphics_mode();
>  		igt_install_exit_handler(kms_dp_dsc_exit_handler);
>  		igt_display_require(&data.display, data.drm_fd);
>  		igt_require(res = drmModeGetResources(data.drm_fd));
>  	}
> +	igt_subtest_with_dynamic("basic-dsc-enable") {
> +		for (j = 0; j < res->count_connectors; j++) {
> +			if (!check_dsc_on_connector(&data, res-
> >connectors[j]))
> +				continue;
> +			run_test(&data, test_basic_dsc_enable);
> +		}
> +	}
> +	/* currently we are validating compression bpp on XRGB8888 format
> only */
> +	igt_subtest_with_dynamic("XRGB8888-dsc-compression") {
> +		uint32_t bpp_list[] = {
> +			XRGB8888_DRM_FORMAT_MIN_BPP,
> +			(XRGB8888_DRM_FORMAT_MIN_BPP  +
> +			 (XRGB8888_DRM_FORMAT_MIN_BPP * 3) - 1) / 2,
> +			(XRGB8888_DRM_FORMAT_MIN_BPP * 3) - 1
> +		};
> +
> +		igt_require(intel_display_ver(data.devid) >= 13);
> +
> +		for (j = 0; j < res->count_connectors; j++) {
> +			if (!check_dsc_on_connector(&data, res-
> >connectors[j]))
> +				continue;
> 
> -	for (test_cnt = 0; test_cnt < ARRAY_SIZE(tests); test_cnt++) {
> -		igt_describe("Validate display stream compression
> functionality if supported on "
> -			       "DP/eDP connector");
> -		igt_subtest_f("basic-dsc-enable-%s",
> -			      kmstest_connector_type_str(tests[test_cnt])) {
> -			test_conn_cnt = 0;
> -			for (i = 0; i < res->count_connectors; i++) {
> -				connector =
> drmModeGetConnectorCurrent(data.drm_fd,
> -								       res-
> >connectors[i]);
> -				if (connector->connection !=
> DRM_MODE_CONNECTED ||
> -				    connector->connector_type !=
> -				    tests[test_cnt])
> -					continue;
> -				output =
> igt_output_from_connector(&data.display, connector);
> -				sprintf(data.conn_name, "%s-%d",
> -
> 	kmstest_connector_type_str(connector->connector_type),
> -					connector->connector_type_id);
> -				if(!is_dp_dsc_supported(&data)) {
> -					igt_debug("DSC not supported on
> connector %s \n",
> -						  data.conn_name);
> -					continue;
> -				}
> -				if (connector->connector_type ==
> DRM_MODE_CONNECTOR_DisplayPort &&
> -				    !is_dp_fec_supported(&data)) {
> -					igt_debug("DSC cannot be enabled
> without FEC on %s\n",
> -						  data.conn_name);
> -					continue;
> -				}
> -				test_conn_cnt++;
> -				run_test(&data, output,
> test_basic_dsc_enable);
> +			for (i = 0; i < ARRAY_SIZE(bpp_list); i++) {
> +				data.compression_bpp = bpp_list[i];
> +				run_test(&data,
> test_dsc_compression_bpp);
>  			}
> -			igt_skip_on(test_conn_cnt == 0);
>  		}
>  	}
> 
>  	igt_fixture {
>  		if (connector)
>  			drmModeFreeConnector(connector);
> +		test_cleanup(&data);
>  		drmModeFreeResources(res);
>  		close(data.debugfs_fd);
>  		close(data.drm_fd);
> --
> 2.25.1

_______________________________________________
igt-dev mailing list
igt-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/igt-dev

  reply	other threads:[~2021-07-19  5:59 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-07-08 16:48 [igt-dev] [PATCH i-g-t 0/4] VDSC ADLP related patches venkata.sai.patnana
2021-07-08 16:48 ` [igt-dev] [PATCH i-g-t v2 1/4] tests/kms_dp_dsc: Add a subtest to force DSC output BPP venkata.sai.patnana
2021-07-09 15:16   ` [igt-dev] [PATCH i-g-t v3 " venkata.sai.patnana
2021-07-19  5:58     ` Kulkarni, Vandita [this message]
2021-07-08 16:49 ` [igt-dev] [PATCH i-g-t 2/4] lib: Add helper functions to read/write dsc debugfs venkata.sai.patnana
2021-07-08 16:49 ` [igt-dev] [PATCH i-g-t 3/4] tests/kms_dp_dsc: Use " venkata.sai.patnana
2021-07-08 16:49 ` [igt-dev] [PATCH i-g-t 4/4] tests/kms_invalid_dotclock: Modify the test for bigjoiner venkata.sai.patnana
2021-07-08 20:48 ` [igt-dev] ✓ Fi.CI.BAT: success for VDSC ADLP related patches (rev2) Patchwork
2021-07-09  8:52 ` [igt-dev] ✓ Fi.CI.IGT: " Patchwork
2021-07-09 16:39 ` [igt-dev] ✓ Fi.CI.BAT: success for VDSC ADLP related patches (rev3) Patchwork
2021-07-10 10:15 ` [igt-dev] ✓ Fi.CI.IGT: " Patchwork

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=fb907301dc7a4fdeba667fe3f7006dd5@intel.com \
    --to=vandita.kulkarni@intel.com \
    --cc=igt-dev@lists.freedesktop.org \
    --cc=petri.latvala@intel.com \
    --cc=venkata.sai.patnana@intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.