[Intel-gfx] [PATCH v2 09/41] drm/connector: Add TV standard property
Noralf Trønnes
noralf at tronnes.org
Mon Sep 5 10:18:21 UTC 2022
Den 29.08.2022 15.11, skrev Maxime Ripard:
> The TV mode property has been around for a while now to select and get the
>
> current TV mode output on an analog TV connector.
>
>
>
> Despite that property name being generic, its content isn't and has been
>
> driver-specific which makes it hard to build any generic behaviour on top
>
> of it, both in kernel and user-space.
>
>
>
> Let's create a new bitmask tv norm property, that can contain any of the
>
> analog TV standards currently supported by kernel drivers. Each driver can
>
> then pass in a bitmask of the modes it supports.
>
>
>
> We'll then be able to phase out the older tv mode property.
>
>
>
> Signed-off-by: Maxime Ripard <maxime at cerno.tech>
>
>
>
> diff --git a/drivers/gpu/drm/drm_connector.c b/drivers/gpu/drm/drm_connector.c
> +/**
>
> + * drm_mode_create_tv_properties - create TV specific connector properties
>
> + * @dev: DRM device
>
> + * @supported_tv_modes: Bitmask of TV modes supported (See DRM_MODE_TV_MODE_*)
>
> +
>
> + * Called by a driver's TV initialization routine, this function creates
>
> + * the TV specific connector properties for a given device. Caller is
>
> + * responsible for allocating a list of format names and passing them to
>
> + * this routine.
>
> + *
>
> + * Returns:
>
> + * 0 on success or a negative error code on failure.
>
> + */
>
> +int drm_mode_create_tv_properties(struct drm_device *dev,
>
> + unsigned int supported_tv_modes)
>
> +{
>
> + struct drm_prop_enum_list tv_mode_list[DRM_MODE_TV_MODE_MAX];
>
> + struct drm_property *tv_mode;
>
> + unsigned int i, len = 0;
>
> +
>
Can you add a check here like in the legacy version:
if (dev->mode_config.tv_mode_property)
return 0;
This way it's possible to call this multiple times. Like in drm/gud
during connector init if there are multiple TV connectors or if a device
with multiple IP blocks should show up.
Noralf.
> + for (i = 0; i < DRM_MODE_TV_MODE_MAX; i++) {
>
> + if (!(supported_tv_modes & BIT(i)))
>
> + continue;
>
> +
>
> + tv_mode_list[len].type = i;
>
> + tv_mode_list[len].name = drm_get_tv_mode_name(i);
>
> + len++;
>
> + }
>
> +
>
> + tv_mode = drm_property_create_enum(dev, 0, "TV mode",
>
> + tv_mode_list, len);
>
> + if (!tv_mode)
>
> + return -ENOMEM;
>
> +
>
> + dev->mode_config.tv_mode_property = tv_mode;
>
> +
>
> + return drm_mode_create_tv_properties_legacy(dev, 0, NULL);
>
> +}
>
> +EXPORT_SYMBOL(drm_mode_create_tv_properties);
>
More information about the Intel-gfx
mailing list