All of lore.kernel.org
 help / color / mirror / Atom feed
From: Daniel Vetter <daniel@ffwll.ch>
To: Sean Paul <seanpaul@chromium.org>
Cc: Daniel Vetter <daniel.vetter@ffwll.ch>,
	Intel Graphics Development <intel-gfx@lists.freedesktop.org>,
	DRI Development <dri-devel@lists.freedesktop.org>,
	Daniel Vetter <daniel.vetter@intel.com>
Subject: Re: [PATCH 22/24] drm: Nerf the preclose callback for modern drivers
Date: Tue, 14 Mar 2017 14:50:27 +0100	[thread overview]
Message-ID: <20170314135027.cnq32zxfgc2ab2ol@phenom.ffwll.local> (raw)
In-Reply-To: <20170313192920.GS20329@art_vandelay>

On Mon, Mar 13, 2017 at 03:29:20PM -0400, Sean Paul wrote:
> On Wed, Mar 08, 2017 at 03:12:55PM +0100, Daniel Vetter wrote:
> > With all drivers converted there's only legacy dri1 drivers using it.
> > Not going to touch those, instead just hide it like we've done with
> > other dri1 driver hooks like firstopen.
> > 
> > In all this I didn't find any real reason why we'd needed 2 hooks, and
> > having symmetry between open and close just appeases my OCD better.
> > Yeah, someone else could do an s/postclose/close/, but that's for
> > someone who understands cocci. And maybe after this series is reviewed
> > and landed, to avoid patch-regen churn.
> > 
> > Signed-off-by: Daniel Vetter <daniel.vetter@intel.com>
> > ---
> >  drivers/gpu/drm/drm_file.c |  8 ++++----
> >  include/drm/drm_drv.h      | 23 ++---------------------
> >  2 files changed, 6 insertions(+), 25 deletions(-)
> > 
> > diff --git a/drivers/gpu/drm/drm_file.c b/drivers/gpu/drm/drm_file.c
> > index a8813a1115dc..f8483fc6d3d7 100644
> > --- a/drivers/gpu/drm/drm_file.c
> > +++ b/drivers/gpu/drm/drm_file.c
> > @@ -350,9 +350,8 @@ void drm_lastclose(struct drm_device * dev)
> >   *
> >   * This function must be used by drivers as their &file_operations.release
> >   * method. It frees any resources associated with the open file, and calls the
> > - * &drm_driver.preclose and &drm_driver.lastclose driver callbacks. If this is
> > - * the last open file for the DRM device also proceeds to call the
> > - * &drm_driver.lastclose driver callback.
> > + * &drm_driver.lastclose driver callback. If this is the last open file for the
> 
> s/lastclose/postclose/
> 
> Once that's fixed,
> 
> Reviewed-by: Sean Paul <seanpaul@chromium.org>

Fixed locally and will include it when I'm resending the entire pile with
the stragglers filled out.
-Daniel

> 
> > + * DRM device also proceeds to call the &drm_driver.lastclose driver callback.
> >   *
> >   * RETURNS:
> >   *
> > @@ -372,7 +371,8 @@ int drm_release(struct inode *inode, struct file *filp)
> >  	list_del(&file_priv->lhead);
> >  	mutex_unlock(&dev->filelist_mutex);
> >  
> > -	if (dev->driver->preclose)
> > +	if (drm_core_check_feature(dev, DRIVER_LEGACY) &&
> > +	    dev->driver->preclose)
> >  		dev->driver->preclose(dev, file_priv);
> >  
> >  	/* ========================================================
> > diff --git a/include/drm/drm_drv.h b/include/drm/drm_drv.h
> > index 8f900fb30275..fde343e0d581 100644
> > --- a/include/drm/drm_drv.h
> > +++ b/include/drm/drm_drv.h
> > @@ -104,23 +104,6 @@ struct drm_driver {
> >  	int (*open) (struct drm_device *, struct drm_file *);
> >  
> >  	/**
> > -	 * @preclose:
> > -	 *
> > -	 * One of the driver callbacks when a new &struct drm_file is closed.
> > -	 * Useful for tearing down driver-private data structures allocated in
> > -	 * @open like buffer allocators, execution contexts or similar things.
> > -	 *
> > -	 * Since the display/modeset side of DRM can only be owned by exactly
> > -	 * one &struct drm_file (see &drm_file.is_master and &drm_device.master)
> > -	 * there should never be a need to tear down any modeset related
> > -	 * resources in this callback. Doing so would be a driver design bug.
> > -	 *
> > -	 * FIXME: It is not really clear why there's both @preclose and
> > -	 * @postclose. Without a really good reason, use @postclose only.
> > -	 */
> > -	void (*preclose) (struct drm_device *, struct drm_file *file_priv);
> > -
> > -	/**
> >  	 * @postclose:
> >  	 *
> >  	 * One of the driver callbacks when a new &struct drm_file is closed.
> > @@ -131,9 +114,6 @@ struct drm_driver {
> >  	 * one &struct drm_file (see &drm_file.is_master and &drm_device.master)
> >  	 * there should never be a need to tear down any modeset related
> >  	 * resources in this callback. Doing so would be a driver design bug.
> > -	 *
> > -	 * FIXME: It is not really clear why there's both @preclose and
> > -	 * @postclose. Without a really good reason, use @postclose only.
> >  	 */
> >  	void (*postclose) (struct drm_device *, struct drm_file *);
> >  
> > @@ -150,7 +130,7 @@ struct drm_driver {
> >  	 * state changes, e.g. in conjunction with the :ref:`vga_switcheroo`
> >  	 * infrastructure.
> >  	 *
> > -	 * This is called after @preclose and @postclose have been called.
> > +	 * This is called after @postclose hook has been called.
> >  	 *
> >  	 * NOTE:
> >  	 *
> > @@ -516,6 +496,7 @@ struct drm_driver {
> >  	/* List of devices hanging off this driver with stealth attach. */
> >  	struct list_head legacy_dev_list;
> >  	int (*firstopen) (struct drm_device *);
> > +	void (*preclose) (struct drm_device *, struct drm_file *file_priv);
> >  	int (*dma_ioctl) (struct drm_device *dev, void *data, struct drm_file *file_priv);
> >  	int (*dma_quiescent) (struct drm_device *);
> >  	int (*context_dtor) (struct drm_device *dev, int context);
> > -- 
> > 2.11.0
> > 
> > _______________________________________________
> > Intel-gfx mailing list
> > Intel-gfx@lists.freedesktop.org
> > https://lists.freedesktop.org/mailman/listinfo/intel-gfx

-- 
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

  reply	other threads:[~2017-03-14 13:50 UTC|newest]

Thread overview: 72+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-03-08 14:12 [PATCH 00/24] more docs and header splits Daniel Vetter
2017-03-08 14:12 ` [PATCH 01/24] drm/doc: Add todo about connector_list_iter Daniel Vetter
2017-03-08 15:12   ` [Intel-gfx] " Sean Paul
2017-03-08 14:12 ` [PATCH 02/24] drm: Extract drm_prime.h Daniel Vetter
2017-03-08 14:57   ` Gustavo Padovan
2017-03-13 16:42   ` Sean Paul
2017-03-14  9:12     ` [Intel-gfx] " Daniel Vetter
2017-03-14 15:42       ` Sean Paul
2017-03-08 14:12 ` [PATCH 03/24] drm: Move drm_lock_data out of drmP.h Daniel Vetter
2017-03-08 14:58   ` Gustavo Padovan
2017-03-08 14:12 ` [PATCH 04/24] drm: Extract drm_pci.h Daniel Vetter
2017-03-08 14:59   ` [Intel-gfx] " Gustavo Padovan
2017-03-08 14:12 ` [PATCH 05/24] drm: Remove drmP.h include from drm_kms_helper_common.c Daniel Vetter
2017-03-08 15:00   ` [Intel-gfx] " Gustavo Padovan
2017-03-08 14:12 ` [PATCH 06/24] drm/doc: document fallback behaviour for atomic events Daniel Vetter
2017-03-08 14:57   ` Laurent Pinchart
2017-03-08 14:12 ` [PATCH 07/24] drm: rename drm_fops.c to drm_file.c Daniel Vetter
2017-03-08 15:02   ` [Intel-gfx] " Gustavo Padovan
2017-03-08 14:12 ` [PATCH 08/24] drm: Remove DRM_MINOR_CNT Daniel Vetter
2017-03-08 14:14   ` David Herrmann
2017-03-13 16:56   ` Sean Paul
2017-03-08 14:12 ` [PATCH 09/24] drm: Extract drm_file.h Daniel Vetter
2017-03-08 15:05   ` Gustavo Padovan
2017-03-09 10:52     ` Daniel Vetter
2017-03-08 14:12 ` [PATCH 10/24] drm: Remove drm_pending_event->pid Daniel Vetter
2017-03-13 17:05   ` [Intel-gfx] " Sean Paul
2017-03-14 13:20     ` Daniel Vetter
2017-03-08 14:12 ` [PATCH 11/24] drm/doc: Document drm_file.[hc] Daniel Vetter
2017-03-13 17:53   ` Sean Paul
2017-03-14 13:25     ` Daniel Vetter
2017-03-14 13:27     ` Daniel Vetter
2017-03-08 14:12 ` [PATCH 12/24] drm/i915: Merge pre/postclose hooks Daniel Vetter
2017-03-08 15:07   ` Chris Wilson
2017-03-08 15:45     ` Daniel Vetter
2017-03-14 13:38       ` Daniel Vetter
2017-03-08 14:12 ` [PATCH 13/24] drm/msm: switch to postclose Daniel Vetter
2017-03-13 18:59   ` Sean Paul
2017-03-08 14:12 ` [PATCH 16/24] drm/tegra: " Daniel Vetter
     [not found]   ` <20170308141257.12119-17-daniel.vetter-/w4YWyX8dFk@public.gmane.org>
2017-03-13 19:10     ` Sean Paul
2017-03-08 14:12 ` [PATCH 17/24] drm/vgem: " Daniel Vetter
2017-03-13 19:11   ` Sean Paul
2017-03-14 13:27     ` Daniel Vetter
2017-03-08 14:12 ` [PATCH 18/24] drm/etnaviv: " Daniel Vetter
2017-03-08 16:09   ` Lucas Stach
2017-03-08 18:15     ` Daniel Vetter
2017-03-09 10:03       ` Lucas Stach
     [not found] ` <20170308141257.12119-1-daniel.vetter-/w4YWyX8dFk@public.gmane.org>
2017-03-08 14:12   ` [PATCH 14/24] drm/nouveau: Merge pre/postclose hooks Daniel Vetter
     [not found]     ` <20170308141257.12119-15-daniel.vetter-/w4YWyX8dFk@public.gmane.org>
2017-03-13 19:07       ` Sean Paul
2017-03-08 14:12   ` [PATCH 15/24] drm/radeon: " Daniel Vetter
     [not found]     ` <20170308141257.12119-16-daniel.vetter-/w4YWyX8dFk@public.gmane.org>
2017-03-08 14:25       ` Christian König
     [not found]         ` <79dc5480-6354-2379-8a7a-a2c099209256-5C7GfCeVMHo@public.gmane.org>
2017-03-09  3:58           ` Alex Deucher
2017-03-08 14:12   ` [PATCH 19/24] drm/amdgpu: " Daniel Vetter
2017-03-08 14:12 ` [PATCH 20/24] drm/exynos: " Daniel Vetter
2017-03-13 19:18   ` [Intel-gfx] " Sean Paul
2017-03-14 13:28     ` Daniel Vetter
2017-03-15  0:54       ` Inki Dae
2017-03-15  9:09         ` [Intel-gfx] " Inki Dae
2017-03-15  9:52           ` Daniel Vetter
2017-03-08 14:12 ` [PATCH 21/24] drm/msm: Simplify vblank event delivery Daniel Vetter
2017-03-13 19:26   ` Sean Paul
2017-03-08 14:12 ` [PATCH 22/24] drm: Nerf the preclose callback for modern drivers Daniel Vetter
2017-03-09 10:48   ` Daniel Vetter
2017-03-13 19:29   ` [Intel-gfx] " Sean Paul
2017-03-14 13:50     ` Daniel Vetter [this message]
2017-03-08 14:12 ` [PATCH 23/24] drm: Create DEFINE_DRM_GEM_CMA_FOPS and roll it out to drivers Daniel Vetter
2017-03-13 17:11   ` Liviu Dudau
2017-03-13 19:31   ` [Intel-gfx] " Sean Paul
2017-03-13 19:33     ` Sean Paul
2017-03-08 14:12 ` [PATCH 24/24] drm/gem: Add DEFINE_DRM_GEM_FOPS Daniel Vetter
2017-03-13 19:35   ` Sean Paul
2017-03-14 13:31     ` Daniel Vetter
2017-03-08 17:52 ` ✓ Fi.CI.BAT: success for more docs and header splits Patchwork

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=20170314135027.cnq32zxfgc2ab2ol@phenom.ffwll.local \
    --to=daniel@ffwll.ch \
    --cc=daniel.vetter@ffwll.ch \
    --cc=daniel.vetter@intel.com \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=intel-gfx@lists.freedesktop.org \
    --cc=seanpaul@chromium.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.