From patchwork Thu Jul 11 07:54:55 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Laurent Pinchart X-Patchwork-Id: 2826051 Return-Path: X-Original-To: patchwork-dri-devel@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 838929F968 for ; Thu, 11 Jul 2013 07:54:57 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 457CF20119 for ; Thu, 11 Jul 2013 07:54:56 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) by mail.kernel.org (Postfix) with ESMTP id 2D0B620115 for ; Thu, 11 Jul 2013 07:54:51 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 22196E5D75 for ; Thu, 11 Jul 2013 00:54:51 -0700 (PDT) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from perceval.ideasonboard.com (perceval.ideasonboard.com [95.142.166.194]) by gabe.freedesktop.org (Postfix) with ESMTP id 9EC01E5D75 for ; Thu, 11 Jul 2013 00:54:38 -0700 (PDT) Received: from avalon.localnet (unknown [193.120.41.115]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id 89C0B35A4A; Thu, 11 Jul 2013 09:54:25 +0200 (CEST) From: Laurent Pinchart To: Daniel Vetter Subject: Re: [PATCH] drm: don't call ->firstopen for KMS drivers Date: Thu, 11 Jul 2013 09:54:55 +0200 Message-ID: <2771673.RHCmxbM7cy@avalon> User-Agent: KMail/4.10.2 (Linux/3.8.13-gentoo; KDE/4.10.2; x86_64; ; ) In-Reply-To: <1373480264-10243-1-git-send-email-daniel.vetter@ffwll.ch> References: <1373458333-5988-14-git-send-email-daniel.vetter@ffwll.ch> <1373480264-10243-1-git-send-email-daniel.vetter@ffwll.ch> MIME-Version: 1.0 Cc: DRI Development X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: dri-devel-bounces+patchwork-dri-devel=patchwork.kernel.org@lists.freedesktop.org Errors-To: dri-devel-bounces+patchwork-dri-devel=patchwork.kernel.org@lists.freedesktop.org X-Spam-Status: No, score=-3.7 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_MED, RCVD_IN_SORBS_WEB,RP_MATCHES_RCVD,UNPARSEABLE_RELAY autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Hi Daniel, On Wednesday 10 July 2013 20:17:44 Daniel Vetter wrote: > It has way too much potential for driver writers to do stupid things > like delayed hw setup because the load sequence is somehow racy (e.g. > the imx driver in staging). So don't call it for modesetting drivers, > which reduces the complexity of the drm core -> driver interface a > notch. > > v2: Don't forget to update DocBook. > > Cc: Laurent Pinchart > Signed-off-by: Daniel Vetter > --- > Documentation/DocBook/drm.tmpl | 2 ++ > drivers/gpu/drm/drm_fops.c | 3 ++- > 2 files changed, 4 insertions(+), 1 deletion(-) > > diff --git a/Documentation/DocBook/drm.tmpl b/Documentation/DocBook/drm.tmpl > index 4d54ac8..0e8a5a3 100644 > --- a/Documentation/DocBook/drm.tmpl > +++ b/Documentation/DocBook/drm.tmpl > @@ -2423,6 +2423,8 @@ void (*postclose) (struct drm_device *, struct > drm_file *); > The firstopen method is called by the DRM > core when an application opens a device that has no other opened file > handle. > + Not that this callback is only called for legacy ums drm drivers, not > + for drm drivers that implement modesetting in the kernel. > Similarly the lastclose method is called when > the last application holding a file handle opened on the device closes > it. Both methods are mostly used for UMS (User Mode Setting) drivers to What about > diff --git a/drivers/gpu/drm/drm_fops.c b/drivers/gpu/drm/drm_fops.c > index 57e3014..fcde7d4 100644 > --- a/drivers/gpu/drm/drm_fops.c > +++ b/drivers/gpu/drm/drm_fops.c > @@ -51,7 +51,8 @@ static int drm_setup(struct drm_device * dev) > int i; > int ret; > > - if (dev->driver->firstopen) { > + if (dev->driver->firstopen && > + !drm_core_check_feature(dev, DRIVER_MODESET)) { > ret = dev->driver->firstopen(dev); > if (ret != 0) > return ret; diff --git a/Documentation/DocBook/drm.tmpl b/Documentation/DocBook/drm.tmpl index 7d1278e..afa8d40 100644 --- a/Documentation/DocBook/drm.tmpl +++ b/Documentation/DocBook/drm.tmpl @@ -2422,18 +2422,18 @@ void (*postclose) (struct drm_device *, struct drm_file *); The firstopen method is called by the DRM core - when an application opens a device that has no other opened file handle. - Similarly the lastclose method is called when - the last application holding a file handle opened on the device closes - it. Both methods are mostly used for UMS (User Mode Setting) drivers to - acquire and release device resources which should be done in the - load and unload - methods for KMS drivers. + for legacy UMS (User Mode Setting) drivers only when an application + opens a device that has no other opened file handle. UMS drivers can + implement it to acquire device resources. KMS drivers can't use the + method and must acquire resources in the load + method instead. - Note that the lastclose method is also called - at module unload time or, for hot-pluggable devices, when the device is - unplugged. The firstopen and + Similarly the lastclose method is called when + the last application holding a file handle opened on the device closes + it, for both UMS and KMS drivers. Additionally, the method is also + called at module unload time or, for hot-pluggable devices, when the + device is unplugged. The firstopen and lastclose calls can thus be unbalanced.