mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Simona Vetter <simona.vetter@ffwll.ch>
To: Maxime Ripard <mripard@kernel.org>,
	Maarten Lankhorst <maarten.lankhorst@linux.intel.com>,
	Thomas Zimmermann <tzimmermann@suse.de>,
	David Airlie <airlied@gmail.com>, Simona Vetter <simona@ffwll.ch>,
	Andrzej Hajda <andrzej.hajda@intel.com>,
	Neil Armstrong <neil.armstrong@linaro.org>,
	Robert Foss <rfoss@kernel.org>,
	Laurent Pinchart <Laurent.pinchart@ideasonboard.com>,
	Jonas Karlman <jonas@kwiboo.se>,
	Jernej Skrabec <jernej.skrabec@gmail.com>,
	Jyri Sarha <jyri.sarha@iki.fi>,
	Tomi Valkeinen <tomi.valkeinen@ideasonboard.com>,
	Devarsh Thakkar <devarsht@ti.com>,
	dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH v2 11/28] drm/atomic_sro: Create kernel parameter to force or disable readout
Date: Tue, 9 Jun 2026 16:59:27 +0200	[thread overview]
Message-ID: <aigqT02UoGI9SJtn@phenom.ffwll.local> (raw)
In-Reply-To: <ag7jmuHUd7qqzXBu@phenom.ffwll.local>

On Thu, May 21, 2026 at 12:51:06PM +0200, Simona Vetter wrote:
> On Thu, Apr 23, 2026 at 12:18:24PM +0200, Maxime Ripard wrote:
> > The hardware state readout is useful, but might need to be disabled
> > in case of bugs, or its checks relaxed during development when not
> > all hooks are implemented yet.
> > 
> > Add a module parameter to control the readout behavior: it can be
> > disabled entirely, or the checks for missing compare or readout hooks
> > can be skipped independently.
> > 
> > Suggested-by: Simona Vetter <simona@ffwll.ch>
> > Signed-off-by: Maxime Ripard <mripard@kernel.org>
> > ---
> >  drivers/gpu/drm/drm_atomic_sro.c | 36 ++++++++++++++++++++++++++++++++++++
> >  include/drm/drm_atomic_sro.h     |  2 ++
> >  2 files changed, 38 insertions(+)
> > 
> > diff --git a/drivers/gpu/drm/drm_atomic_sro.c b/drivers/gpu/drm/drm_atomic_sro.c
> > index 177b97d451f5..a46f06e75c4e 100644
> > --- a/drivers/gpu/drm/drm_atomic_sro.c
> > +++ b/drivers/gpu/drm/drm_atomic_sro.c
> > @@ -11,10 +11,46 @@
> >  #include <linux/module.h>
> >  
> >  #include "drm_internal.h"
> >  #include "drm_crtc_internal.h"
> >  
> > +enum drm_atomic_readout_status {
> > +	DRM_ATOMIC_READOUT_DISABLED = 0,
> > +	DRM_ATOMIC_READOUT_ENABLED,
> > +	DRM_ATOMIC_READOUT_SKIP_MISSING_COMPARE,
> > +	DRM_ATOMIC_READOUT_SKIP_MISSING_READOUT,
> > +};
> > +
> > +static unsigned int atomic_readout = DRM_ATOMIC_READOUT_ENABLED;
> > +module_param_unsafe(atomic_readout, uint, 0);
> 
> Default is actually 0 here. I agree with the docs that it should be 1,
> since drivers have an explicit opt-in through setting the main entry point
> in drm_mode_config_funcs.
> 
> I was also pondering whether we should have a compare-only mode, but the
> issue is that once you build a driver on readout being a thing, that could
> blow up. So I think that should be left as a per-driver tunable.
> 
> That's also why this must be a unsafe debug option, it might actually
> break the driver.

Maxime pointed out that this makes non sense because the default is
already enabled, and yes I got confused. So strike that, but maybe think
whether 0600 as permissions makes more sense, because that's the bit that
confused me.

Either way, this hunk here also looks good as-is.
-Sima

> 
> > +MODULE_PARM_DESC(atomic_readout,
> > +		 "Enable Hardware State Readout (0 = disabled, 1 = enabled, 2 = ignore missing compares, 3 = ignore missing readouts and compares, default = 1)");
> > +
> > +/**
> > + * drm_atomic_sro_device_can_readout - check if a device supports hardware state readout
> > + * @dev: DRM device to check
> > + *
> > + * Verifies that the device is an atomic driver, that readout is
> > + * enabled, and that all KMS objects implement the relevant hooks.
> > + *
> > + * RETURNS:
> > + *
> > + * True if the device supports full hardware state readout, false
> > + * otherwise.
> > + */
> > +bool drm_atomic_sro_device_can_readout(struct drm_device *dev)
> > +{
> > +	if (!drm_core_check_feature(dev, DRIVER_ATOMIC))
> 
> I think this should be drm_drv_uses_atomic_modeset() since it's an
> internal check, not an uapi check.
> 
> With the two issues addressed:
> 
> Reviewed-by: Simona Vetter <simona.vetter@ffwll.ch>
> 
> > +		return false;
> > +
> > +	if (atomic_readout == DRM_ATOMIC_READOUT_DISABLED)
> > +		return false;
> > +
> > +	return true;
> > +}
> > +EXPORT_SYMBOL(drm_atomic_sro_device_can_readout);
> > +
> >  struct __drm_atomic_sro_plane {
> >  	struct drm_plane *ptr;
> >  	struct drm_plane_state *state;
> >  };
> >  
> > diff --git a/include/drm/drm_atomic_sro.h b/include/drm/drm_atomic_sro.h
> > index 5a9333a05796..6e5262384c71 100644
> > --- a/include/drm/drm_atomic_sro.h
> > +++ b/include/drm/drm_atomic_sro.h
> > @@ -13,10 +13,12 @@ struct drm_plane;
> >  struct drm_plane_state;
> >  struct drm_printer;
> >  struct drm_private_obj;
> >  struct drm_private_state;
> >  
> > +bool drm_atomic_sro_device_can_readout(struct drm_device *dev);
> > +
> >  struct drm_atomic_sro_state *drm_atomic_sro_state_alloc(struct drm_device *dev);
> >  void drm_atomic_sro_state_free(struct drm_atomic_sro_state *state);
> >  void drm_atomic_sro_state_print(const struct drm_atomic_sro_state *state,
> >  				struct drm_printer *p);
> >  
> > 
> > -- 
> > 2.53.0
> > 
> 
> -- 
> Simona Vetter
> Software Engineer
> http://blog.ffwll.ch

-- 
Simona Vetter
Software Engineer
http://blog.ffwll.ch

  reply	other threads:[~2026-06-09 14:59 UTC|newest]

Thread overview: 35+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-04-23 10:18 [PATCH v2 00/28] drm: Implement state readout support Maxime Ripard
2026-04-23 10:18 ` [PATCH v2 01/28] drm/atomic: Fix unused but set warning in state iterator macros Maxime Ripard
2026-05-21  9:51   ` Simona Vetter
2026-04-23 10:18 ` [PATCH v2 02/28] drm/atomic_helper: Skip over NULL private_obj pointers Maxime Ripard
2026-05-21  9:49   ` Simona Vetter
2026-04-23 10:18 ` [PATCH v2 03/28] drm/atomic_state_helper: Remove memset in __drm_atomic_helper_bridge_reset() Maxime Ripard
2026-04-23 10:18 ` [PATCH v2 04/28] drm/atomic: Convert drm_priv_to_bridge_state to container_of_const Maxime Ripard
2026-04-23 10:18 ` [PATCH v2 05/28] drm/atomic: Add drm_private_obj name Maxime Ripard
2026-04-23 10:18 ` [PATCH v2 06/28] drm/bridge: Add drm_private_obj_is_bridge() Maxime Ripard
2026-04-23 10:18 ` [PATCH v2 07/28] drm/bridge: Implement atomic_print_state Maxime Ripard
2026-04-24 14:13   ` Jani Nikula
2026-04-23 10:18 ` [PATCH v2 08/28] drm/atomic: Export drm_atomic_*_print_state Maxime Ripard
2026-04-23 10:18 ` [PATCH v2 09/28] drm/atomic: Only call atomic_destroy_state on a !NULL pointer Maxime Ripard
2026-04-23 10:18 ` [PATCH v2 10/28] drm/atomic_sro: Create drm_atomic_sro_state container Maxime Ripard
2026-04-23 10:18 ` [PATCH v2 11/28] drm/atomic_sro: Create kernel parameter to force or disable readout Maxime Ripard
2026-05-21 10:51   ` Simona Vetter
2026-06-09 14:59     ` Simona Vetter [this message]
2026-04-23 10:18 ` [PATCH v2 12/28] drm/atomic_sro: Add atomic state readout infrastructure Maxime Ripard
2026-04-23 10:18 ` [PATCH v2 13/28] drm/atomic_sro: Add function to install state into drm objects Maxime Ripard
2026-04-23 10:18 ` [PATCH v2 14/28] drm/atomic_sro: Create documentation Maxime Ripard
2026-04-23 10:18 ` [PATCH v2 15/28] drm/bridge: Handle bridges with hardware state readout Maxime Ripard
2026-04-23 10:18 ` [PATCH v2 16/28] drm/mode_config: Read out hardware state in drm_mode_config_create_state Maxime Ripard
2026-04-23 10:18 ` [PATCH v2 17/28] drm/atomic_sro: Provide helpers to implement hardware state readout Maxime Ripard
2026-04-23 10:18 ` [PATCH v2 18/28] drm/atomic_helper: Pass nonblock to commit_tail Maxime Ripard
2026-04-23 10:18 ` [PATCH v2 19/28] drm/atomic_helper: Compare actual and readout states once the commit is done Maxime Ripard
2026-04-23 10:18 ` [PATCH v2 20/28] drm/atomic_state_helper: Provide comparison macros Maxime Ripard
2026-04-23 10:18 ` [PATCH v2 21/28] drm/atomic_state_helper: Provide atomic_compare_state helpers Maxime Ripard
2026-04-23 10:18 ` [PATCH v2 22/28] drm/encoder: Create atomic_sro_get_current_crtc hook Maxime Ripard
2026-04-23 10:18 ` [PATCH v2 23/28] drm/bridge: display-connector: Implement readout support Maxime Ripard
2026-04-23 10:18 ` [PATCH v2 24/28] drm/bridge_connector: Implement hw readout for connector Maxime Ripard
2026-04-23 10:18 ` [PATCH v2 25/28] drm/tidss: dispc: Improve mode checking logs Maxime Ripard
2026-04-23 10:18 ` [PATCH v2 26/28] drm/tidss: Implement readout support Maxime Ripard
2026-04-23 10:18 ` [PATCH v2 27/28] drm/tidss: encoder: Implement atomic_sro_get_current_crtc Maxime Ripard
2026-04-23 10:18 ` [PATCH v2 28/28] drm/bridge: sii902x: Implement hw state readout Maxime Ripard
  -- strict thread matches above, loose matches on Subject: below --
2026-04-23 10:06 [PATCH v2 00/28] drm: Implement state readout support Maxime Ripard
2026-04-23 10:06 ` [PATCH v2 11/28] drm/atomic_sro: Create kernel parameter to force or disable readout Maxime Ripard

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=aigqT02UoGI9SJtn@phenom.ffwll.local \
    --to=simona.vetter@ffwll.ch \
    --cc=Laurent.pinchart@ideasonboard.com \
    --cc=airlied@gmail.com \
    --cc=andrzej.hajda@intel.com \
    --cc=devarsht@ti.com \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=jernej.skrabec@gmail.com \
    --cc=jonas@kwiboo.se \
    --cc=jyri.sarha@iki.fi \
    --cc=linux-kernel@vger.kernel.org \
    --cc=maarten.lankhorst@linux.intel.com \
    --cc=mripard@kernel.org \
    --cc=neil.armstrong@linaro.org \
    --cc=rfoss@kernel.org \
    --cc=simona@ffwll.ch \
    --cc=tomi.valkeinen@ideasonboard.com \
    --cc=tzimmermann@suse.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

Powered by JetHome