dri-devel Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
To: Tomi Valkeinen <tomi.valkeinen@ti.com>
Cc: dri-devel@lists.freedesktop.org
Subject: Re: [PATCH v3 11/20] drm: omapdrm: Check DSS manager state in the enable/disable helpers
Date: Wed, 14 Dec 2016 01:56:38 +0200	[thread overview]
Message-ID: <2390512.WaE717KKOY@avalon> (raw)
In-Reply-To: <34e6e0c3-fb88-ece8-5114-8d254c582846@ti.com>

Hi Tomi,

On Tuesday 13 Dec 2016 10:15:35 Tomi Valkeinen wrote:
> On 13/12/16 01:07, Laurent Pinchart wrote:
> > On Tuesday 20 Sep 2016 16:57:59 Tomi Valkeinen wrote:
> >> On 19/09/16 15:27, Laurent Pinchart wrote:
> >>> The omapdrm DSS manager enable/disable operations check the DSS manager
> >>> state to avoid double enabling/disabling. Move that code to the DSS
> >>> manager to decrease the dependency of the DRM layer to the DSS layer.
> >>> 
> >>> Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
> >>> ---
> >>>  drivers/gpu/drm/omapdrm/dss/dispc.c  | 1 -
> >>>  drivers/gpu/drm/omapdrm/dss/output.c | 6 ++++++
> >>>  drivers/gpu/drm/omapdrm/omap_crtc.c  | 3 ---
> >>>  3 files changed, 6 insertions(+), 4 deletions(-)
> >>> 
> >>> diff --git a/drivers/gpu/drm/omapdrm/dss/dispc.c
> >>> b/drivers/gpu/drm/omapdrm/dss/dispc.c index 535240fba671..ab150bf21dd8
> >>> 100644
> >>> --- a/drivers/gpu/drm/omapdrm/dss/dispc.c
> >>> +++ b/drivers/gpu/drm/omapdrm/dss/dispc.c
> >>> @@ -2911,7 +2911,6 @@ bool dispc_mgr_is_enabled(enum omap_channel
> >>> channel)
> >>>  {
> >>>  	return !!mgr_fld_read(channel, DISPC_MGR_FLD_ENABLE);
> >>>  }
> >>> -EXPORT_SYMBOL(dispc_mgr_is_enabled);
> >>> 
> >>>  void dispc_wb_enable(bool enable)
> >>>  {
> >>> diff --git a/drivers/gpu/drm/omapdrm/dss/output.c
> >>> b/drivers/gpu/drm/omapdrm/dss/output.c index 24f859488201..f0be621895fa
> >>> 100644
> >>> --- a/drivers/gpu/drm/omapdrm/dss/output.c
> >>> +++ b/drivers/gpu/drm/omapdrm/dss/output.c
> >>> @@ -217,12 +217,18 @@ EXPORT_SYMBOL(dss_mgr_set_lcd_config);
> >>>  int dss_mgr_enable(enum omap_channel channel)
> >>>  {
> >>> +	if (dispc_mgr_is_enabled(channel))
> >>> +		return 0;
> >>> +
> >>>  	return dss_mgr_ops->enable(channel);
> >>>  }
> 
> Looking at this again, I think this is not correct. The functions in
> output.c are just trampolines basically. They just pass the calls to
> omapdrm. Let's not add any logic there.

I can't wait to clean all this up and get rid of them :-)

> Also, the above could even cause a crash, as the HW is not necessarily
> enabled before the ->enable() is called.
> 
> >>>  EXPORT_SYMBOL(dss_mgr_enable);
> >>>  
> >>>  void dss_mgr_disable(enum omap_channel channel)
> >>>  {
> >>> +	if (!dispc_mgr_is_enabled(channel))
> >>> +		return;
> >>> +
> >>>  	dss_mgr_ops->disable(channel);
> >>>  }
> >>>  EXPORT_SYMBOL(dss_mgr_disable);
> >>> diff --git a/drivers/gpu/drm/omapdrm/omap_crtc.c
> >>> b/drivers/gpu/drm/omapdrm/omap_crtc.c index 4b7e16786e1e..a0c26592fc69
> >>> 100644
> >>> --- a/drivers/gpu/drm/omapdrm/omap_crtc.c
> >>> +++ b/drivers/gpu/drm/omapdrm/omap_crtc.c
> >>> @@ -141,9 +141,6 @@ static void omap_crtc_set_enabled(struct drm_crtc
> >>> *crtc, bool enable)
> >>>  		return;
> >>>  	}
> >>> 
> >>> -	if (dispc_mgr_is_enabled(channel) == enable)
> >>> -		return;
> >>> -
> >>>  	if (omap_crtc->channel == OMAP_DSS_CHANNEL_DIGIT) {
> >>>  		/*
> >>>  		 * Digit output produces some sync lost interrupts during the
> >> 
> >> With this change omap_crtc_set_enabled() will do extra work if the
> >> output is already enabled/disabled, and, if I'm not mistaken, will do
> >> omap_irq_wait() there which might lead to issues.
> > 
> > That's correct, but the DRM core nowadays should really guarantee that
> > CRTCs won't be enabled or disabled multiple times.
> 
> Ok. So we could probably add a dev_warn() there, as getting that state
> wrong might cause issues that are difficult to debug. It would be best
> to check the HW state, but if you want to remove the call to dispc, I
> guess just checking omap_crtc->enabled is good enough.

I'll do that. I don't like reading back the hardware state when it's supposed 
to match the software state. If there's a mismatch then there's a bug, and if 
they always match, it's pointless.

> The comment for omap_crtc_set_enabled talks about suspend/resume.
> Perhaps at some point it was called from suspend/resume, even for crtcs
> that were already disabled, which would explain the need for the check.

-- 
Regards,

Laurent Pinchart

_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

  reply	other threads:[~2016-12-13 23:56 UTC|newest]

Thread overview: 46+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-09-19 12:27 [PATCH v3 00/20] OMAP DRM fixes and improvements Laurent Pinchart
2016-09-19 12:27 ` [PATCH v3 01/20] drm: omapdrm: fb: Limit number of planes per framebuffer to two Laurent Pinchart
2016-09-19 12:27 ` [PATCH v3 02/20] drm: omapdrm: fb: Use format information provided by the DRM core Laurent Pinchart
2016-09-20 12:47   ` Tomi Valkeinen
2016-12-12 21:41     ` Laurent Pinchart
2016-09-19 12:27 ` [PATCH v3 03/20] drm: omapdrm: fb: Simplify objects lookup when creating framebuffer Laurent Pinchart
2016-09-19 12:27 ` [PATCH v3 04/20] drm: omapdrm: fb: Simplify mode command checks " Laurent Pinchart
2016-09-20 12:55   ` Tomi Valkeinen
2016-09-19 12:27 ` [PATCH v3 05/20] drm: omapdrm: fb: Turn framebuffer creation error messages into debug Laurent Pinchart
2016-09-19 12:27 ` [PATCH v3 06/20] drm: omapdrm: Handle FIFO underflow IRQs internally Laurent Pinchart
2016-09-20 13:17   ` Tomi Valkeinen
2016-09-20 13:27   ` Tomi Valkeinen
2016-12-12 21:59     ` Laurent Pinchart
2016-09-19 12:27 ` [PATCH v3 07/20] drm: omapdrm: Handle CRTC error IRQs directly Laurent Pinchart
2016-09-19 12:27 ` [PATCH v3 08/20] drm: omapdrm: Handle OCP error IRQ directly Laurent Pinchart
2016-09-20 13:34   ` Tomi Valkeinen
2016-12-12 22:09     ` Laurent Pinchart
2016-09-19 12:27 ` [PATCH v3 09/20] drm: omapdrm: Replace DSS manager state check with omapdrm CRTC state Laurent Pinchart
2016-09-20 13:44   ` Tomi Valkeinen
2016-12-12 22:16     ` Laurent Pinchart
2016-09-19 12:27 ` [PATCH v3 10/20] drm: omapdrm: Only commit planes on active CRTCs Laurent Pinchart
2016-09-20 13:51   ` Tomi Valkeinen
2016-12-12 22:53     ` Laurent Pinchart
2016-12-13  7:58       ` Tomi Valkeinen
2016-12-13 13:12         ` Laurent Pinchart
2016-09-19 12:27 ` [PATCH v3 11/20] drm: omapdrm: Check DSS manager state in the enable/disable helpers Laurent Pinchart
2016-09-20 13:57   ` Tomi Valkeinen
2016-12-12 23:07     ` Laurent Pinchart
2016-12-13  8:15       ` Tomi Valkeinen
2016-12-13 23:56         ` Laurent Pinchart [this message]
2016-09-19 12:27 ` [PATCH v3 12/20] drm: omapdrm: Prevent processing the same event multiple times Laurent Pinchart
2016-09-27 12:24   ` Tomi Valkeinen
2016-12-12 10:29     ` Laurent Pinchart
2016-09-27 15:05   ` Daniel Kurtz
2016-12-12 10:21     ` Laurent Pinchart
2016-09-19 12:27 ` [PATCH v3 13/20] drm: omapdrm: Use a spinlock to protect the CRTC pending flag Laurent Pinchart
2016-09-27 12:27   ` Tomi Valkeinen
2016-09-19 12:27 ` [PATCH v3 14/20] drm: omapdrm: Keep vblank interrupt enabled while CRTC is active Laurent Pinchart
2016-09-19 12:27 ` [PATCH v3 15/20] drm: omapdrm: Don't expose the omap_irq_(un)register() functions Laurent Pinchart
2016-09-19 12:27 ` [PATCH v3 16/20] drm: omapdrm: Remove unused parameter from omap_drm_irq handler Laurent Pinchart
2016-09-19 12:27 ` [PATCH v3 17/20] drm: omapdrm: Don't call DISPC power handling in IRQ wait functions Laurent Pinchart
2016-09-19 12:27 ` [PATCH v3 18/20] drm: omapdrm: Make pipe2vbl function static Laurent Pinchart
2016-12-12 10:41   ` Tomi Valkeinen
2016-12-12 23:17     ` Laurent Pinchart
2016-09-19 12:27 ` [PATCH v3 19/20] drm: omapdrm: Simplify IRQ wait implementation Laurent Pinchart
2016-09-19 12:27 ` [PATCH v3 20/20] drm: omapdrm: Remove global variables Laurent Pinchart

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=2390512.WaE717KKOY@avalon \
    --to=laurent.pinchart@ideasonboard.com \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=tomi.valkeinen@ti.com \
    /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