dri-devel.lists.freedesktop.org archive mirror
 help / color / mirror / Atom feed
From: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
To: Daniel Vetter <daniel.vetter@ffwll.ch>
Cc: DRI Development <dri-devel@lists.freedesktop.org>
Subject: Re: [PATCH] drm: don't call ->firstopen for KMS drivers
Date: Thu, 11 Jul 2013 09:54:55 +0200	[thread overview]
Message-ID: <2771673.RHCmxbM7cy@avalon> (raw)
In-Reply-To: <1373480264-10243-1-git-send-email-daniel.vetter@ffwll.ch>

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 <laurent.pinchart@ideasonboard.com>
> Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
> ---
>  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 *);</synopsis> <para>
>          The <methodname>firstopen</methodname> 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 <methodname>lastclose</methodname> 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/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 *);</synopsis>
       </abstract>
       <para>
         The <methodname>firstopen</methodname> method is called by the DRM core
-	when an application opens a device that has no other opened file handle.
-	Similarly the <methodname>lastclose</methodname> 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
-	<methodname>load</methodname> and <methodname>unload</methodname>
-	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 <methodname>load</methodname>
+	method instead.
       </para>
       <para>
-        Note that the <methodname>lastclose</methodname> method is also called
-	at module unload time or, for hot-pluggable devices, when the device is
-	unplugged. The <methodname>firstopen</methodname> and
+	Similarly the <methodname>lastclose</methodname> 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 <methodname>firstopen</methodname> and
 	<methodname>lastclose</methodname> calls can thus be unbalanced.
       </para>
       <para>

> 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;

-- 
Regards,

Laurent Pinchart

  reply	other threads:[~2013-07-11  7:54 UTC|newest]

Thread overview: 70+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-07-10 12:11 [PATCH 00/39] clean out drm cruft and hide it better for kms drivers Daniel Vetter
2013-07-10 12:11 ` [PATCH 01/39] drm: remove drm_modctx ioctl and use drm_noop instead Daniel Vetter
2013-07-10 12:11 ` [PATCH 02/39] drm: kill dev->context_wait Daniel Vetter
2013-07-10 12:11 ` [PATCH 03/39] drm: remove dev->last_switch Daniel Vetter
2013-07-10 12:11 ` [PATCH 04/39] drm: kill dev->interrupt_flag and dev->dma_flag Daniel Vetter
2013-07-10 12:11 ` [PATCH 05/39] drm: kill dev->ctx_start and dev->lck_start Daniel Vetter
2013-07-10 12:11 ` [PATCH 06/39] drm/radoen: kill radeon_dma_ioctl_kms Daniel Vetter
2013-07-10 12:11 ` [PATCH 07/39] drm: kill dev->buf_readers and dev->buf_writers Daniel Vetter
2013-07-10 12:11 ` [PATCH 08/39] drm: remove redundant clears from drm_setup Daniel Vetter
2013-07-10 13:28   ` David Herrmann
2013-07-10 15:19     ` Daniel Vetter
2013-07-10 12:11 ` [PATCH 09/39] drm/omap: kill firstopen callback Daniel Vetter
2013-07-10 12:11 ` [PATCH 10/39] drm/radeon: kill firstopen callback for kms driver Daniel Vetter
2013-07-10 12:11 ` [PATCH 11/39] drm/imx: kill firstopen callback Daniel Vetter
2013-07-10 12:11 ` [PATCH 12/39] drm/vmwgfx: remove ->firstopen callback Daniel Vetter
2013-07-10 12:11 ` [PATCH 13/39] drm: don't call ->firstopen for KMS drivers Daniel Vetter
2013-07-10 18:17   ` [PATCH] " Daniel Vetter
2013-07-11  7:54     ` Laurent Pinchart [this message]
2013-07-11 10:19       ` Daniel Vetter
2013-07-13 14:45         ` Daniel Vetter
2013-07-22  9:02           ` Laurent Pinchart
2013-07-10 12:11 ` [PATCH 14/39] drm: kill dev->driver->set_version Daniel Vetter
2013-07-10 12:11 ` [PATCH 15/39] drm/radeon: remove DRIVER_HAS_DMA/SG/PCI_DMA from the kms driver Daniel Vetter
2013-07-10 12:11 ` [PATCH 16/39] drm: fold in drm_sg_alloc into the ioctl Daniel Vetter
2013-07-10 12:11 ` [PATCH 17/39] drm: hide legacy sg cleanup better from common code Daniel Vetter
2013-07-10 12:11 ` [PATCH 18/39] drm: disallow legacy sg ioctls for modesetting drivers Daniel Vetter
2013-07-10 12:11 ` [PATCH 19/39] drm: mark dma setup/teardown as legacy systems Daniel Vetter
2013-07-10 12:11 ` [PATCH 20/39] drm/nouveau: drop DRIVER_PCI_DMA and DRIVER_SG Daniel Vetter
2013-07-10 12:11 ` [PATCH 21/39] drm: disallow legacy dma ioctls for modesetting drivers Daniel Vetter
2013-07-10 12:11 ` [PATCH 22/39] drm: move drm_getsarea into drm_bufs.c Daniel Vetter
2013-07-10 12:11 ` [PATCH 23/39] drm/bufs: s/drm_order/order_base_2/ Daniel Vetter
2013-07-10 12:11 ` [PATCH 24/39] drm/r128: s/drm_order/order_base_2/ Daniel Vetter
2013-07-10 12:11 ` [PATCH 25/39] drm/radeon: s/drm_order/order_base_2/ Daniel Vetter
2013-07-10 12:12 ` [PATCH 26/39] drm: remove drm_order Daniel Vetter
2013-07-10 12:12 ` [PATCH 27/39] drm: mark context support as a legacy subsystem Daniel Vetter
2013-07-10 12:12 ` [PATCH 28/39] drm/vmwgfx: remove redundant clearing of driver->dma_quiescent Daniel Vetter
2013-07-10 12:12 ` [PATCH 29/39] drm: remove FASYNC support Daniel Vetter
2013-07-10 14:57   ` [PATCH] " Daniel Vetter
2013-07-10 15:24     ` Daniel Vetter
2013-07-10 15:25     ` Daniel Vetter
2013-07-11  0:26       ` Laurent Pinchart
2013-07-10 12:12 ` [PATCH 30/39] drm: rip out DRIVER_FB_DMA and related code Daniel Vetter
2013-07-10 12:12 ` [PATCH 31/39] drm: rip out a few unused DRIVER flags Daniel Vetter
2013-07-10 12:12 ` [PATCH 32/39] drm: remove a bunch of unused #defines from drmP.h Daniel Vetter
2013-07-10 12:12 ` [PATCH 33/39] drm: rip out drm_core_has_MTRR checks Daniel Vetter
2013-07-10 13:51   ` David Herrmann
2013-07-10 15:22     ` Daniel Vetter
2013-07-10 15:41       ` David Herrmann
2013-07-10 15:59         ` Daniel Vetter
2013-07-10 16:13           ` [PATCH 1/2] " Daniel Vetter
2013-07-10 16:13             ` [PATCH 2/2] drm/docs: rip out removed driver flags documentation Daniel Vetter
2013-07-10 16:27           ` [PATCH 33/39] drm: rip out drm_core_has_MTRR checks Andy Lutomirski
2013-07-10 16:41             ` Daniel Vetter
2013-07-10 12:12 ` [PATCH 34/39] drm: remove the dma_ioctl special-case Daniel Vetter
2013-07-10 14:34   ` David Herrmann
2013-07-10 14:59     ` [PATCH] " Daniel Vetter
2013-07-10 12:12 ` [PATCH 35/39] drm/memory: don't export agp helpers Daniel Vetter
2013-07-10 12:12 ` [PATCH 36/39] drm: hollow-out GET_CLIENT ioctl Daniel Vetter
2013-07-16 12:33   ` Daniel Vetter
2013-07-16 13:14     ` [PATCH] " Daniel Vetter
2013-07-16 13:30       ` Chris Wilson
2013-07-17 13:52       ` David Herrmann
2013-07-10 12:12 ` [PATCH 37/39] drm: no-op out GET_STATS ioctl Daniel Vetter
2013-07-10 12:12 ` [PATCH 38/39] drm: fix locking in gem debugfs/procfs file Daniel Vetter
2013-07-10 12:12 ` [PATCH 39/39] drm: remove procfs code, take 2 Daniel Vetter
2013-07-10 20:44   ` [PATCH] " Daniel Vetter
2013-07-10 15:32 ` [PATCH 00/39] clean out drm cruft and hide it better for kms drivers David Herrmann
2013-07-10 15:51 ` [PATCH 1/2] drm: rip out dev->last_checked Daniel Vetter
2013-07-10 15:51   ` [PATCH 2/2] drm: move dev data clearing from drm_setup to lastclose Daniel Vetter
2013-07-11 14:09 ` [PATCH 00/39] clean out drm cruft and hide it better for kms drivers Alex Deucher

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=2771673.RHCmxbM7cy@avalon \
    --to=laurent.pinchart@ideasonboard.com \
    --cc=daniel.vetter@ffwll.ch \
    --cc=dri-devel@lists.freedesktop.org \
    /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;
as well as URLs for NNTP newsgroup(s).