Thank you for your contribution! Sashiko AI review found 2 potential
issues to consider:
- [Medium] drm/vkms: incomplete colorspace validation in
  valid_connector_colorspaces()
- [Low] drm/vkms: malformed kernel-doc parameter syntax in
  vkms_connector_init()
--

commit 2738e3373c723cbcc39db7e98d237f52472fa93d
Author: Louis Chauvet <[email protected]>

drm/vkms: Introduce config for connector supported colorspace

This commit adds connector colorspace configuration to VKMS and attaches
the corresponding DRM colorspace and HDR output metadata properties on
HDMI, DisplayPort, and eDP connectors.

> diff --git a/drivers/gpu/drm/vkms/vkms_config.c 
> b/drivers/gpu/drm/vkms/vkms_config.c
> index b415d4bf6edb0..fa4ca256b4b91 100644
> --- a/drivers/gpu/drm/vkms/vkms_config.c
> +++ b/drivers/gpu/drm/vkms/vkms_config.c
> @@ -466,6 +466,38 @@ static bool valid_connector_possible_encoders(const 
> struct vkms_config *config)
>       return true;
>  }
>  
> +static bool valid_connector_colorspaces(const struct vkms_config *config)
> +{
> +     struct drm_device *dev = config->dev ? &config->dev->drm : NULL;
> +     struct vkms_config_connector *connector_cfg;
> +
> +     vkms_config_for_each_connector(config, connector_cfg) {
> +             u32 colorspaces = 
> vkms_config_connector_get_supported_colorspaces(connector_cfg);
> +
> +             if (!colorspaces)
> +                     continue;
> +
> +             switch (connector_cfg->type) {
> +             case DRM_MODE_CONNECTOR_HDMIA:
> +             case DRM_MODE_CONNECTOR_HDMIB:
> +             case DRM_MODE_CONNECTOR_DisplayPort:
> +             case DRM_MODE_CONNECTOR_eDP:
> +                     break;
> +             default:
> +                     drm_info(dev,
> +                              "Colorspaces are only supported on HDMI, 
> DisplayPort and eDP connectors\n");
> +                     return false;
> +             }
> +
> +             if (colorspaces & ~(BIT(DRM_MODE_COLORIMETRY_COUNT) - 1)) {
> +                     drm_info(dev, "Colorspace value contains invalid 
> bits\n");
> +                     return false;
> +             }
> +     }
> +
> +     return true;
> +}

[Severity: Medium]
Can valid_connector_colorspaces() accept a colorspaces mask that later
causes vkms_connector_init() to fail with -EINVAL?

drm_mode_create_hdmi_colorspace_property() and
drm_mode_create_dp_colorspace_property() mask a non-zero
supported_colorspaces argument with hdmi_colorspaces or dp_colorspaces
before calling drm_mode_create_colorspace_property(), which rejects a
zero mask with -EINVAL.  Neither mask includes
BIT(DRM_MODE_COLORIMETRY_DEFAULT), and each excludes values specific to
the other connector type (such as DRM_MODE_COLORIMETRY_RGB_WIDE_FIXED on
HDMI or DRM_MODE_COLORIMETRY_SMPTE_170M_YCC on DP).  If only excluded
bits are set, vkms_config_is_valid() succeeds, but vkms_connector_init()
fails and aborts device creation; if valid and excluded bits are mixed,
vkms_config_show() reports the unsupported bits in debugfs even though
DRM strips them from the property.

> diff --git a/drivers/gpu/drm/vkms/vkms_connector.c 
> b/drivers/gpu/drm/vkms/vkms_connector.c
> index 7264ca84f910f..552d767c3976e 100644
> --- a/drivers/gpu/drm/vkms/vkms_connector.c
> +++ b/drivers/gpu/drm/vkms/vkms_connector.c
> @@ -76,6 +76,53 @@ static void vkms_connector_static_cfg_release(struct 
> drm_device *dev, void *res)
>       vkms_config_connector_put(connector->cfg);
>  }
>  
> +/**
> + * vkms_connector_init - Common initialization for all vkms connectors
> + *
> + * @connector - Already allocated connector
> + * @connector_cfg - Configuration to apply
> + *
> + * Returns: 0 on success, errno on error;
> + */
> +static int __must_check vkms_connector_init(struct vkms_connector *connector,
> +                                         struct vkms_config_connector 
> *connector_cfg)

[Severity: Low]
This kernel-doc comment uses hyphens instead of colons after @connector
and @connector_cfg, which causes scripts/kernel-doc (W=1) to warn that
both function parameters are not described.

-- 
Sashiko AI review ยท 
https://sashiko.dev/#/patchset/[email protected]?part=34

Reply via email to