[PATCH i-g-t 2/2] lib/igt_drm_fdinfo: Mandatory drm-fields first

Kamil Konieczny kamil.konieczny at linux.intel.com
Thu Feb 1 12:45:00 UTC 2024


Hi Lucas,
On 2024-01-31 at 16:46:25 -0800, Lucas De Marchi wrote:
> drm-driver and drm-client-id are 2 keys that should be on any driver's
> implementation of fdinfo. Move them earlier so it's clear what the
> "good" tracking is doing.
> 
> Signed-off-by: Lucas De Marchi <lucas.demarchi at intel.com>

Reviewed-by: Kamil Konieczny <kamil.konieczny at linux.intel.com>

> ---
>  lib/igt_drm_fdinfo.c | 5 +++--
>  1 file changed, 3 insertions(+), 2 deletions(-)
> 
> diff --git a/lib/igt_drm_fdinfo.c b/lib/igt_drm_fdinfo.c
> index 5c0ccf624..17cac4009 100644
> --- a/lib/igt_drm_fdinfo.c
> +++ b/lib/igt_drm_fdinfo.c
> @@ -233,12 +233,13 @@ __igt_parse_drm_fdinfo(int dir, const char *fd, struct drm_client_fdinfo *info,
>  		if ((v = find_kv(l, "drm-driver", strlen("drm-driver")))) {
>  			strncpy(info->driver, v, sizeof(info->driver) - 1);
>  			good++;
> -		} else if ((v = find_kv(l, "drm-pdev", strlen("drm-pdev")))) {
> -			strncpy(info->pdev, v, sizeof(info->pdev) - 1);
>  		}  else if ((v = find_kv(l, "drm-client-id",
>  					 strlen("drm-client-id")))) {
>  			info->id = atol(v);
>  			good++;
> +		} else if ((v = find_kv(l, "drm-pdev", strlen("drm-pdev")))) {
> +			/* optional */
> +			strncpy(info->pdev, v, sizeof(info->pdev) - 1);
>  		} else if (!strncmp(l, "drm-engine-capacity-", 20)) {
>  			idx = parse_engine(l, info,
>  					   strlen("drm-engine-capacity-"),
> -- 
> 2.43.0
> 


More information about the igt-dev mailing list