From: Daniel Vetter Subject: Re: commit b5dc0d108cd3c0b50ddcb6f6c54be1bea4c39e01 breaks imx-drm support Date: Tue, 27 Aug 2013 10:08:42 +0200 Message-ID: <20130827080842.GG26909@phenom.ffwll.local> References: <21020.22888.634949.367118@ipc1.ka-ro> Mime-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable Return-path: Received: from mail-ee0-f52.google.com (mail-ee0-f52.google.com [74.125.83.52]) by gabe.freedesktop.org (Postfix) with ESMTP id 32840E5E08 for ; Tue, 27 Aug 2013 01:08:32 -0700 (PDT) Received: by mail-ee0-f52.google.com with SMTP id c41so2068403eek.39 for ; Tue, 27 Aug 2013 01:08:31 -0700 (PDT) Content-Disposition: inline In-Reply-To: <21020.22888.634949.367118@ipc1.ka-ro> List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: dri-devel-bounces+sf-dri-devel=m.gmane.org@lists.freedesktop.org Errors-To: dri-devel-bounces+sf-dri-devel=m.gmane.org@lists.freedesktop.org To: Lothar =?iso-8859-1?Q?Wa=DFmann?= Cc: Greg Kroah-Hartman , DRI Development , Dave Airlie List-Id: dri-devel@lists.freedesktop.org On Tue, Aug 27, 2013 at 9:46 AM, Lothar Wa=DFmann = wrote: > the function imx_drm_driver_load() must have been called before > calling imx_drm_add_crtc(), but the following hunk in the commit: > @@ -446,6 +434,9 @@ static int imx_drm_driver_load(struct drm_device *drm= , unsigned long flags) > */ > imxdrm->drm->vblank_disable_allowed =3D 1; > > + if (!imx_drm_device_get()) > + ret =3D -EINVAL; > + > ret =3D 0; > > err_init: > > makes imx_drm_add_crtc() bail out at: > > if (imxdrm->references) { > ret =3D -EBUSY; > goto err_busy; > } > > Thus it is not possible to register any CRTCs. Ok I've now read around a bit in the imx core and I think my call to rip this out was right ;-) If I understand stuff correctly you have a main driver plus a bunch of encoder/crtc modules and you expect that everything gets loaded and then only when the kms driver is first opened. The current drm core just doesn't support hotplugging of encoder/crtc objects after driver init has completed. If you try to do that it'll go down in flames due to all the races involved. So as a stopgap measuret I sugges you rip out the imxdrm->references trickery since it won't actually protect you from anything truly nasty happening. And I wouldn't worry about module unloading and refcounting for now since core drm is terminally broken in that area already anyway. Then we can move ahead and how to really fix this init ordering. So I think we have another TODO here: Cheers, Daniel --- diff --git a/drivers/staging/imx-drm/TODO b/drivers/staging/imx-drm/TODO index f806415..f8ef245 100644 --- a/drivers/staging/imx-drm/TODO +++ b/drivers/staging/imx-drm/TODO @@ -6,6 +6,11 @@ TODO: - Factor out more code to common helper functions - decide where to put the base driver. It is not specific to a subsystem and would be used by DRM/KMS and media/V4L2 +- Fix up the driver load sequence to make sure all submodules for encoders= /crtcs + are fully loaded before the drm driver is registered. Might require a co= re drm + rework to break away the drm core init sequence from its midlayer drug a= nd + assorted control inversion issues. Or we restructure imx to just built in + everything, dunno. Requested by Daniel Vetter = Missing features (not necessarily for moving out of staging): = -- = Daniel Vetter Software Engineer, Intel Corporation +41 (0) 79 365 57 48 - http://blog.ffwll.ch