[<prev] [next>] [day] [month] [year] [list]
Message-ID: <87702f79-36f4-278e-ef98-279543d71318@tronnes.org>
Date: Mon, 17 Oct 2022 12:36:14 +0200
From: Noralf Trønnes <noralf@...nnes.org>
To: Maxime Ripard <maxime@...no.tech>,
Karol Herbst <kherbst@...hat.com>,
Jani Nikula <jani.nikula@...ux.intel.com>,
Tvrtko Ursulin <tvrtko.ursulin@...ux.intel.com>,
Daniel Vetter <daniel@...ll.ch>,
Maarten Lankhorst <maarten.lankhorst@...ux.intel.com>,
David Airlie <airlied@...ux.ie>,
Joonas Lahtinen <joonas.lahtinen@...ux.intel.com>,
Lyude Paul <lyude@...hat.com>,
Maxime Ripard <mripard@...nel.org>,
Emma Anholt <emma@...olt.net>, Chen-Yu Tsai <wens@...e.org>,
Samuel Holland <samuel@...lland.org>,
Ben Skeggs <bskeggs@...hat.com>,
Thomas Zimmermann <tzimmermann@...e.de>,
Rodrigo Vivi <rodrigo.vivi@...el.com>,
Jernej Skrabec <jernej.skrabec@...il.com>
Cc: Dom Cobley <dom@...pberrypi.com>, linux-sunxi@...ts.linux.dev,
Dave Stevenson <dave.stevenson@...pberrypi.com>,
intel-gfx@...ts.freedesktop.org, linux-kernel@...r.kernel.org,
nouveau@...ts.freedesktop.org,
Geert Uytterhoeven <geert@...ux-m68k.org>,
linux-arm-kernel@...ts.infradead.org,
Mateusz Kwiatkowski <kfyatek+publicgit@...il.com>,
dri-devel@...ts.freedesktop.org,
Hans de Goede <hdegoede@...hat.com>,
Phil Elwell <phil@...pberrypi.com>,
Noralf Trønnes <noralf@...nnes.org>
Subject: Re: [PATCH v5 16/22] drm/atomic-helper: Add a TV properties reset
helper
Den 13.10.2022 15.19, skrev Maxime Ripard:
> The drm_tv_create_properties() function will create a bunch of properties,
> but it's up to each and every driver using that function to properly reset
> the state of these properties leading to inconsistent behaviours.
>
> Let's create a helper that will take care of it.
>
> Reviewed-by: Noralf Trønnes <noralf@...nnes.org>
> Signed-off-by: Maxime Ripard <maxime@...no.tech>
> ---
> drivers/gpu/drm/drm_atomic_state_helper.c | 75 +++++++++++++++++++++++++++++++
> include/drm/drm_atomic_state_helper.h | 1 +
> 2 files changed, 76 insertions(+)
>
> diff --git a/drivers/gpu/drm/drm_atomic_state_helper.c b/drivers/gpu/drm/drm_atomic_state_helper.c
> index dfb57217253b..0373c3dc824b 100644
> --- a/drivers/gpu/drm/drm_atomic_state_helper.c
> +++ b/drivers/gpu/drm/drm_atomic_state_helper.c
> @@ -481,6 +481,81 @@ void drm_atomic_helper_connector_tv_margins_reset(struct drm_connector *connecto
> }
> EXPORT_SYMBOL(drm_atomic_helper_connector_tv_margins_reset);
>
> +/**
> + * drm_atomic_helper_connector_tv_reset - Resets Analog TV connector properties
> + * @connector: DRM connector
> + *
> + * Resets the analog TV properties attached to a connector
> + */
> +void drm_atomic_helper_connector_tv_reset(struct drm_connector *connector)
> +{
> + struct drm_device *dev = connector->dev;
> + struct drm_cmdline_mode *cmdline = &connector->cmdline_mode;
> + struct drm_connector_state *state = connector->state;
> + struct drm_property *prop;
> + uint64_t val;
> +
> + prop = dev->mode_config.tv_mode_property;
> + if (prop)
> + if (!drm_object_property_get_default_value(&connector->base,
> + prop, &val))
> + state->tv.mode = val;
> +
> + if (cmdline->tv_mode)
> + state->tv.mode = cmdline->tv_mode;
This can't set ntsc now that the none value is gone.
But we need a tv_mode_specified flag as mentioned in the other patch.
Noralf.
> +
> + prop = dev->mode_config.tv_select_subconnector_property;
> + if (prop)
> + if (!drm_object_property_get_default_value(&connector->base,
> + prop, &val))
> + state->tv.select_subconnector = val;
> +
> + prop = dev->mode_config.tv_subconnector_property;
> + if (prop)
> + if (!drm_object_property_get_default_value(&connector->base,
> + prop, &val))
> + state->tv.subconnector = val;
> +
> + prop = dev->mode_config.tv_brightness_property;
> + if (prop)
> + if (!drm_object_property_get_default_value(&connector->base,
> + prop, &val))
> + state->tv.brightness = val;
> +
> + prop = dev->mode_config.tv_contrast_property;
> + if (prop)
> + if (!drm_object_property_get_default_value(&connector->base,
> + prop, &val))
> + state->tv.contrast = val;
> +
> + prop = dev->mode_config.tv_flicker_reduction_property;
> + if (prop)
> + if (!drm_object_property_get_default_value(&connector->base,
> + prop, &val))
> + state->tv.flicker_reduction = val;
> +
> + prop = dev->mode_config.tv_overscan_property;
> + if (prop)
> + if (!drm_object_property_get_default_value(&connector->base,
> + prop, &val))
> + state->tv.overscan = val;
> +
> + prop = dev->mode_config.tv_saturation_property;
> + if (prop)
> + if (!drm_object_property_get_default_value(&connector->base,
> + prop, &val))
> + state->tv.saturation = val;
> +
> + prop = dev->mode_config.tv_hue_property;
> + if (prop)
> + if (!drm_object_property_get_default_value(&connector->base,
> + prop, &val))
> + state->tv.hue = val;
> +
> + drm_atomic_helper_connector_tv_margins_reset(connector);
> +}
> +EXPORT_SYMBOL(drm_atomic_helper_connector_tv_reset);
> +
> /**
> * __drm_atomic_helper_connector_duplicate_state - copy atomic connector state
> * @connector: connector object
> diff --git a/include/drm/drm_atomic_state_helper.h b/include/drm/drm_atomic_state_helper.h
> index 192766656b88..c8fbce795ee7 100644
> --- a/include/drm/drm_atomic_state_helper.h
> +++ b/include/drm/drm_atomic_state_helper.h
> @@ -70,6 +70,7 @@ void __drm_atomic_helper_connector_state_reset(struct drm_connector_state *conn_
> void __drm_atomic_helper_connector_reset(struct drm_connector *connector,
> struct drm_connector_state *conn_state);
> void drm_atomic_helper_connector_reset(struct drm_connector *connector);
> +void drm_atomic_helper_connector_tv_reset(struct drm_connector *connector);
> void drm_atomic_helper_connector_tv_margins_reset(struct drm_connector *connector);
> void
> __drm_atomic_helper_connector_duplicate_state(struct drm_connector *connector,
>
Powered by blists - more mailing lists