lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <575e58c3-a32f-54a6-6203-7a7e5a289a66@tronnes.org>
Date:   Tue, 30 Aug 2022 20:49:22 +0200
From:   Noralf Trønnes <noralf@...nnes.org>
To:     Maxime Ripard <maxime@...no.tech>,
        Maxime Ripard <mripard@...nel.org>,
        Ben Skeggs <bskeggs@...hat.com>,
        David Airlie <airlied@...ux.ie>, Chen-Yu Tsai <wens@...e.org>,
        Thomas Zimmermann <tzimmermann@...e.de>,
        Jani Nikula <jani.nikula@...ux.intel.com>,
        Lyude Paul <lyude@...hat.com>,
        Philipp Zabel <p.zabel@...gutronix.de>,
        Maarten Lankhorst <maarten.lankhorst@...ux.intel.com>,
        Rodrigo Vivi <rodrigo.vivi@...el.com>,
        Tvrtko Ursulin <tvrtko.ursulin@...ux.intel.com>,
        Jernej Skrabec <jernej.skrabec@...il.com>,
        Samuel Holland <samuel@...lland.org>,
        Karol Herbst <kherbst@...hat.com>,
        Emma Anholt <emma@...olt.net>, Daniel Vetter <daniel@...ll.ch>,
        Joonas Lahtinen <joonas.lahtinen@...ux.intel.com>
Cc:     Hans de Goede <hdegoede@...hat.com>,
        linux-arm-kernel@...ts.infradead.org,
        Phil Elwell <phil@...pberrypi.com>,
        intel-gfx@...ts.freedesktop.org,
        Dave Stevenson <dave.stevenson@...pberrypi.com>,
        dri-devel@...ts.freedesktop.org, Dom Cobley <dom@...pberrypi.com>,
        linux-kernel@...r.kernel.org, nouveau@...ts.freedesktop.org,
        linux-sunxi@...ts.linux.dev,
        Mateusz Kwiatkowski <kfyatek+publicgit@...il.com>,
        Geert Uytterhoeven <geert@...ux-m68k.org>,
        Noralf Trønnes <noralf@...nnes.org>
Subject: Re: [PATCH v2 23/41] drm/atomic-helper: Add an analog TV atomic_check
 implementation



Den 29.08.2022 15.11, skrev Maxime Ripard:
> The analog TV connector drivers share some atomic_check logic, and the new
> 
> TV standard property have created a bunch of new constraints that needs to
> 
> be shared across drivers too.
> 
> 
> 
> Let's create an atomic_check helper for those use cases.
> 
> 
> 
> Signed-off-by: Maxime Ripard <maxime@...no.tech>
> 
> 
> 
> diff --git a/drivers/gpu/drm/drm_atomic_state_helper.c b/drivers/gpu/drm/drm_atomic_state_helper.c
> 
> index 0373c3dc824b..d64733c6aae3 100644
> 
> --- a/drivers/gpu/drm/drm_atomic_state_helper.c
> 
> +++ b/drivers/gpu/drm/drm_atomic_state_helper.c
> 
> @@ -556,6 +556,42 @@ void drm_atomic_helper_connector_tv_reset(struct drm_connector *connector)
> 
>  }
> 
>  EXPORT_SYMBOL(drm_atomic_helper_connector_tv_reset);
> 
>  
> 
> +/**
> 
> + * @drm_atomic_helper_connector_tv_check: Validate an analog TV connector state
> 
> + * @connector: DRM Connector
> 
> + * @state: the DRM State object
> 
> + *
> 
> + * Checks the state object to see if the requested state is valid for an
> 
> + * analog TV connector.
> 
> + *
> 
> + * Returns:
> 
> + * Zero for success, a negative error code on error.
> 
> + */
> 
> +int drm_atomic_helper_connector_tv_check(struct drm_connector *connector,
> 
> +					 struct drm_atomic_state *state)
> 
> +{
> 
> +	struct drm_connector_state *old_conn_state =
> 
> +		drm_atomic_get_old_connector_state(state, connector);
> 
> +	struct drm_connector_state *new_conn_state =
> 
> +		drm_atomic_get_new_connector_state(state, connector);
> 
> +	struct drm_crtc_state *crtc_state;
> 
> +	struct drm_crtc *crtc;
> 
> +
> 
> +	crtc = new_conn_state->crtc;
> 
> +	if (!crtc)
> 
> +		return 0;
> 
> +
> 
> +	crtc_state = drm_atomic_get_new_crtc_state(state, crtc);
> 
> +	if (!crtc_state)
> 
> +		return -EINVAL;
> 
> +
> 
> +	if (old_conn_state->tv.mode != new_conn_state->tv.mode)
> 
> +		crtc_state->mode_changed = true;
> 

If you can expand this check then I can use it in gud:

	if (old_conn_state->tv.margins.left != new_conn_state->tv.margins.left ||
	    old_conn_state->tv.margins.right != new_conn_state->tv.margins.right ||
	    old_conn_state->tv.margins.top != new_conn_state->tv.margins.top ||
	    old_conn_state->tv.margins.bottom !=
new_conn_state->tv.margins.bottom ||
	    old_conn_state->tv.mode != new_conn_state->tv.mode ||
	    old_conn_state->tv.brightness != new_conn_state->tv.brightness ||
	    old_conn_state->tv.contrast != new_conn_state->tv.contrast ||
	    old_conn_state->tv.flicker_reduction !=
new_conn_state->tv.flicker_reduction ||
	    old_conn_state->tv.overscan != new_conn_state->tv.overscan ||
	    old_conn_state->tv.saturation != new_conn_state->tv.saturation ||
	    old_conn_state->tv.hue != new_conn_state->tv.hue)
		crtc_state->connectors_changed = true;

With that considered:

Reviewed-by: Noralf Trønnes <noralf@...nnes.org>

> +
> 
> +	return 0;
> 
> +}
> 
> +EXPORT_SYMBOL(drm_atomic_helper_connector_tv_check);
> 
> +
> 
>  /**
> 
>   * __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 c8fbce795ee7..b9740edb2658 100644
> 
> --- a/include/drm/drm_atomic_state_helper.h
> 
> +++ b/include/drm/drm_atomic_state_helper.h
> 
> @@ -26,6 +26,7 @@
> 
>  
> 
>  #include <linux/types.h>
> 
>  
> 
> +struct drm_atomic_state;
> 
>  struct drm_bridge;
> 
>  struct drm_bridge_state;
> 
>  struct drm_crtc;
> 
> @@ -71,6 +72,8 @@ 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);
> 
> +int drm_atomic_helper_connector_tv_check(struct drm_connector *connector,
> 
> +					 struct drm_atomic_state *state);
> 
>  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

Powered by Openwall GNU/*/Linux Powered by OpenVZ