[igt-dev] [PATCH i-g-t 2/3] lib/igt_kms: add get_num_scalers()
Juha-Pekka Heikkila
juhapekka.heikkila at gmail.com
Fri Oct 13 12:06:26 UTC 2023
On 13.10.2023 13.23, Swati Sharma wrote:
> Add get_num_scalers(), which will return no. of scalers/CRTC.
>
> Signed-off-by: Swati Sharma <swati2.sharma at intel.com>
> ---
> lib/igt_kms.c | 39 +++++++++++++++++++++++++++++++++++++++
> lib/igt_kms.h | 1 +
> 2 files changed, 40 insertions(+)
>
> diff --git a/lib/igt_kms.c b/lib/igt_kms.c
> index 8dc0edc89..666a69495 100644
> --- a/lib/igt_kms.c
> +++ b/lib/igt_kms.c
> @@ -6084,3 +6084,42 @@ int igt_get_dp_mst_connector_id(igt_output_t *output)
>
> return connector_id;
> }
> +
> +/**
> + * get_num_scalers:
> + * @drm_fd: drm file descriptor
> + * @pipe: display pipe
> + *
> + * Returns: num_scalers supported/pipe.
> + */
> +int get_num_scalers(int drm_fd, enum pipe pipe)
> +{
> + char buf[8120];
> + char *start_loc1, *start_loc2;
> + int dir, res;
> + int num_scalers = 0;
> + char dest[20] = ":pipe ";
> +
> + strcat(dest, kmstest_pipe_name(pipe));
> +
> + if (is_intel_device(drm_fd) &&
> + intel_display_ver(intel_get_drm_devid(drm_fd)) >= 9) {
> +
> + dir = igt_debugfs_dir(drm_fd);
> + igt_assert(dir >= 0);
> +
> + res = igt_debugfs_simple_read(dir, "i915_display_info", buf, sizeof(buf));
> + close(dir);
> + igt_require(res > 0);
> +
> + start_loc1 = strstr(buf, dest);
> + printf("start_loc1=%s\n", start_loc1);
this printf I think doesn't belong here. Otherwise patch look ok.
> +
> + if ((start_loc1 = strstr(buf, dest))) {
> + igt_assert(start_loc2 = strstr(start_loc1, "num_scalers="));
> + igt_assert_eq(sscanf(start_loc2, "num_scalers=%d", &num_scalers), 1);
> + }
> + }
> +
> + return num_scalers;
> +}
> diff --git a/lib/igt_kms.h b/lib/igt_kms.h
> index 4bcaf3f73..356620dc6 100644
> --- a/lib/igt_kms.h
> +++ b/lib/igt_kms.h
> @@ -1016,5 +1016,6 @@ bool igt_parse_mode_string(const char *mode_string, drmModeModeInfo *mode);
> bool i915_pipe_output_combo_valid(igt_display_t *display);
> bool igt_check_output_is_dp_mst(igt_output_t *output);
> int igt_get_dp_mst_connector_id(igt_output_t *output);
> +int get_num_scalers(int drm_fd, enum pipe pipe);
>
> #endif /* __IGT_KMS_H__ */
More information about the igt-dev
mailing list