From: David Herrmann <dh.herrmann@gmail.com>
To: Daniel Vetter <daniel.vetter@ffwll.ch>
Cc: DRI Development <dri-devel@lists.freedesktop.org>
Subject: Re: [PATCH 25/25] drm: move dev data clearing from drm_setup to lastclose
Date: Tue, 13 Aug 2013 20:12:05 +0200 [thread overview]
Message-ID: <CANq1E4TmQaf9U1JBu9P7wZCn0s1OUvELvNBVA5ukdNkydbj7gw@mail.gmail.com> (raw)
In-Reply-To: <1375969295-18929-26-git-send-email-daniel.vetter@ffwll.ch>
Hi
On Thu, Aug 8, 2013 at 3:41 PM, Daniel Vetter <daniel.vetter@ffwll.ch> wrote:
> We kzalloc this structure, and for real kms devices we should never
> loose track of things really.
>
> But ums/legacy drivers rely on the drm core to clean up a bit of cruft
> between lastclose and firstopen (i.e. when X is being restarted), so
> keep this around. But give it a clear drm_legacy_ prefix and
> conditionalize the code on !DRIVER_MODESET.
>
> Cc: David Herrmann <dh.herrmann@gmail.com>
> Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Reviewed-by: David Herrmann <dh.herrmann@gmail.com>
Regards
David
> ---
> drivers/gpu/drm/drm_drv.c | 27 +++++++++++++++++++++++++++
> drivers/gpu/drm/drm_fops.c | 27 +++------------------------
> 2 files changed, 30 insertions(+), 24 deletions(-)
>
> diff --git a/drivers/gpu/drm/drm_drv.c b/drivers/gpu/drm/drm_drv.c
> index a845f31..3b8d044 100644
> --- a/drivers/gpu/drm/drm_drv.c
> +++ b/drivers/gpu/drm/drm_drv.c
> @@ -171,6 +171,31 @@ static const struct drm_ioctl_desc drm_ioctls[] = {
> #define DRM_CORE_IOCTL_COUNT ARRAY_SIZE( drm_ioctls )
>
> /**
> + * drm_legacy_dev_reinit
> + *
> + * Reinitializes a legacy/ums drm device in it's lastclose function.
> + */
> +static void drm_legacy_dev_reinit(struct drm_device *dev)
> +{
> + int i;
> +
> + if (drm_core_check_feature(dev, DRIVER_MODESET))
> + return;
> +
> + atomic_set(&dev->ioctl_count, 0);
> + atomic_set(&dev->vma_count, 0);
> +
> + for (i = 0; i < ARRAY_SIZE(dev->counts); i++)
> + atomic_set(&dev->counts[i], 0);
> +
> + dev->sigdata.lock = NULL;
> +
> + dev->context_flag = 0;
> + dev->last_context = 0;
> + dev->if_version = 0;
> +}
> +
> +/**
> * Take down the DRM device.
> *
> * \param dev DRM device structure.
> @@ -209,6 +234,8 @@ int drm_lastclose(struct drm_device * dev)
> dev->dev_mapping = NULL;
> mutex_unlock(&dev->struct_mutex);
>
> + drm_legacy_dev_reinit(dev);
> +
> DRM_DEBUG("lastclose completed\n");
> return 0;
> }
> diff --git a/drivers/gpu/drm/drm_fops.c b/drivers/gpu/drm/drm_fops.c
> index 5679971..59f4592 100644
> --- a/drivers/gpu/drm/drm_fops.c
> +++ b/drivers/gpu/drm/drm_fops.c
> @@ -48,7 +48,6 @@ static int drm_open_helper(struct inode *inode, struct file *filp,
>
> static int drm_setup(struct drm_device * dev)
> {
> - int i;
> int ret;
>
> if (dev->driver->firstopen &&
> @@ -58,32 +57,12 @@ static int drm_setup(struct drm_device * dev)
> return ret;
> }
>
> - atomic_set(&dev->ioctl_count, 0);
> - atomic_set(&dev->vma_count, 0);
> -
> - i = drm_legacy_dma_setup(dev);
> - if (i < 0)
> - return i;
> -
> - for (i = 0; i < ARRAY_SIZE(dev->counts); i++)
> - atomic_set(&dev->counts[i], 0);
> -
> - dev->sigdata.lock = NULL;
> + ret = drm_legacy_dma_setup(dev);
> + if (ret < 0)
> + return ret;
>
> - dev->context_flag = 0;
> - dev->last_context = 0;
> - dev->if_version = 0;
>
> DRM_DEBUG("\n");
> -
> - /*
> - * The kernel's context could be created here, but is now created
> - * in drm_dma_enqueue. This is more resource-efficient for
> - * hardware that does not do DMA, but may mean that
> - * drm_select_queue fails between the time the interrupt is
> - * initialized and the time the queues are initialized.
> - */
> -
> return 0;
> }
>
> --
> 1.8.3.2
>
prev parent reply other threads:[~2013-08-13 18:12 UTC|newest]
Thread overview: 40+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-08-08 13:41 [PATCH 00/25] drm cruft removal Daniel Vetter
2013-08-08 13:41 ` [PATCH 01/25] drm/omap: kill firstopen callback Daniel Vetter
2013-08-08 14:04 ` Rob Clark
2013-08-08 13:41 ` [PATCH 02/25] drm/radeon: kill firstopen callback for kms driver Daniel Vetter
2013-08-08 13:41 ` [PATCH 03/25] drm/imx: kill firstopen callback Daniel Vetter
2013-08-12 22:23 ` Greg Kroah-Hartman
2013-08-08 13:41 ` [PATCH 04/25] drm/vmwgfx: remove ->firstopen callback Daniel Vetter
2013-08-08 13:41 ` [PATCH 05/25] drm: don't call ->firstopen for KMS drivers Daniel Vetter
2013-08-08 13:41 ` [PATCH 06/25] drm: kill dev->driver->set_version Daniel Vetter
2013-08-08 14:10 ` Rob Clark
2013-08-08 13:41 ` [PATCH 07/25] drm: hide legacy sg cleanup better from common code Daniel Vetter
2013-08-08 13:41 ` [PATCH 08/25] drm: disallow legacy sg ioctls for modesetting drivers Daniel Vetter
2013-08-08 13:41 ` [PATCH 09/25] drm: mark dma setup/teardown as legacy systems Daniel Vetter
2013-08-08 13:41 ` [PATCH 10/25] drm: disallow legacy dma ioctls for modesetting drivers Daniel Vetter
2013-08-08 13:41 ` [PATCH 11/25] drm: mark context support as a legacy subsystem Daniel Vetter
2013-08-08 13:41 ` [PATCH 12/25] drm/vmwgfx: remove redundant clearing of driver->dma_quiescent Daniel Vetter
2013-08-08 13:41 ` [PATCH 13/25] drm: remove FASYNC support Daniel Vetter
2013-08-13 19:26 ` David Herrmann
2013-08-08 13:41 ` [PATCH 14/25] drm: rip out DRIVER_FB_DMA and related code Daniel Vetter
2013-08-08 13:41 ` [PATCH 15/25] drm: rip out a few unused DRIVER flags Daniel Vetter
2013-08-08 13:41 ` [PATCH 16/25] drm: remove a bunch of unused #defines from drmP.h Daniel Vetter
2013-08-08 13:41 ` [PATCH 17/25] drm: rip out drm_core_has_MTRR checks Daniel Vetter
2013-08-09 18:12 ` Andy Lutomirski
2013-08-09 18:36 ` Daniel Vetter
2013-08-09 18:39 ` Andy Lutomirski
2013-08-09 18:47 ` Daniel Vetter
2013-08-09 18:48 ` Andy Lutomirski
2013-08-15 12:44 ` David Herrmann
2013-08-08 13:41 ` [PATCH 18/25] drm/docs: rip out removed driver flags documentation Daniel Vetter
2013-08-08 13:41 ` [PATCH 19/25] drm: remove the dma_ioctl special-case Daniel Vetter
2013-08-13 18:05 ` David Herrmann
2013-08-08 13:41 ` [PATCH 20/25] drm/memory: don't export agp helpers Daniel Vetter
2013-08-08 13:41 ` [PATCH 21/25] drm: hollow-out GET_CLIENT ioctl Daniel Vetter
2013-08-08 13:41 ` [PATCH 22/25] drm: no-op out GET_STATS ioctl Daniel Vetter
2013-08-08 15:55 ` Eric Anholt
2013-08-09 9:05 ` Daniel Vetter
2013-08-08 13:41 ` [PATCH 23/25] drm: fix locking in gem debugfs/procfs file Daniel Vetter
2013-08-08 13:41 ` [PATCH 24/25] drm: remove procfs code, take 2 Daniel Vetter
2013-08-08 13:41 ` [PATCH 25/25] drm: move dev data clearing from drm_setup to lastclose Daniel Vetter
2013-08-13 18:12 ` David Herrmann [this message]
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=CANq1E4TmQaf9U1JBu9P7wZCn0s1OUvELvNBVA5ukdNkydbj7gw@mail.gmail.com \
--to=dh.herrmann@gmail.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).