All of lore.kernel.org
 help / color / mirror / Atom feed
From: Daniel Vetter <daniel.vetter@ffwll.ch>
To: Thomas Zimmermann <tzimmermann@suse.de>
Cc: David Airlie <airlied@linux.ie>,
	Daniel Vetter <daniel.vetter@intel.com>,
	Intel Graphics Development <intel-gfx@lists.freedesktop.org>,
	DRI Development <dri-devel@lists.freedesktop.org>
Subject: Re: [PATCH 2/5] drm: Compile out legacy chunks from struct drm_device
Date: Mon, 26 Oct 2020 10:17:33 +0100	[thread overview]
Message-ID: <CAKMK7uE-DG1t5mftzE_wPfmhLvw4UTQeROUMu+fTbHWtyVUXkw@mail.gmail.com> (raw)
In-Reply-To: <f31b5607-cfd8-4ab7-3b37-a5cb36509420@suse.de>

On Mon, Oct 26, 2020 at 9:37 AM Thomas Zimmermann <tzimmermann@suse.de> wrote:
>
> Hi
>
> Am 23.10.20 um 14:28 schrieb Daniel Vetter:
> > This means some very few #ifdef in code, but it allows us to
> > enlist the compiler to make sure this stuff isn't used anymore.
> >
> > More important, only legacy drivers change drm_device (for the
> > legacy_dev_list shadow attach management), therefore this is
> > prep to allow modern drivers to have a const driver struct. Which
> > is nice, because there's a ton of function pointers in there.
> >
> > Signed-off-by: Daniel Vetter <daniel.vetter@intel.com>
> > Cc: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
> > Cc: Maxime Ripard <mripard@kernel.org>
> > Cc: Thomas Zimmermann <tzimmermann@suse.de>
> > Cc: David Airlie <airlied@linux.ie>
> > Cc: Daniel Vetter <daniel@ffwll.ch>
> > Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
>
> Review-by: Thomas Zimmermann <tzimmermann@suse.de>
>
> Sort of related: the implementation for KMS and UMS devices is more and
> more distinct from each other. Did you ever consider going for separate
> legacy helpers instead of mixing-in all these ifdefs?

I think we could split out drm_pci_legacy.c. Everything else is
already split out into separate files and made optional at the
Makefile level, it's really only in oddball places around the shared
drm_device where there's any #ifdef at all.
-Daniel

>
> Best regards
> Thomas
>
> > ---
> >  drivers/gpu/drm/drm_file.c   |  2 ++
> >  drivers/gpu/drm/drm_vblank.c | 15 ++++++++++++---
> >  include/drm/drm_drv.h        |  2 ++
> >  3 files changed, 16 insertions(+), 3 deletions(-)
> >
> > diff --git a/drivers/gpu/drm/drm_file.c b/drivers/gpu/drm/drm_file.c
> > index 0ac4566ae3f4..b50380fa80ce 100644
> > --- a/drivers/gpu/drm/drm_file.c
> > +++ b/drivers/gpu/drm/drm_file.c
> > @@ -258,9 +258,11 @@ void drm_file_free(struct drm_file *file)
> >                 (long)old_encode_dev(file->minor->kdev->devt),
> >                 atomic_read(&dev->open_count));
> >
> > +#ifdef CONFIG_DRM_LEGACY
> >       if (drm_core_check_feature(dev, DRIVER_LEGACY) &&
> >           dev->driver->preclose)
> >               dev->driver->preclose(dev, file);
> > +#endif
> >
> >       if (drm_core_check_feature(dev, DRIVER_LEGACY))
> >               drm_legacy_lock_release(dev, file->filp);
> > diff --git a/drivers/gpu/drm/drm_vblank.c b/drivers/gpu/drm/drm_vblank.c
> > index ba7e741764aa..15e5ea436434 100644
> > --- a/drivers/gpu/drm/drm_vblank.c
> > +++ b/drivers/gpu/drm/drm_vblank.c
> > @@ -210,9 +210,12 @@ static u32 __get_vblank_counter(struct drm_device *dev, unsigned int pipe)
> >
> >               if (crtc->funcs->get_vblank_counter)
> >                       return crtc->funcs->get_vblank_counter(crtc);
> > -     } else if (dev->driver->get_vblank_counter) {
> > +     }
> > +#ifdef CONFIG_DRM_LEGACY
> > +     else if (dev->driver->get_vblank_counter) {
> >               return dev->driver->get_vblank_counter(dev, pipe);
> >       }
> > +#endif
> >
> >       return drm_vblank_no_hw_counter(dev, pipe);
> >  }
> > @@ -430,9 +433,12 @@ static void __disable_vblank(struct drm_device *dev, unsigned int pipe)
> >
> >               if (crtc->funcs->disable_vblank)
> >                       crtc->funcs->disable_vblank(crtc);
> > -     } else {
> > +     }
> > +#ifdef CONFIG_DRM_LEGACY
> > +     else {
> >               dev->driver->disable_vblank(dev, pipe);
> >       }
> > +#endif
> >  }
> >
> >  /*
> > @@ -1097,9 +1103,12 @@ static int __enable_vblank(struct drm_device *dev, unsigned int pipe)
> >
> >               if (crtc->funcs->enable_vblank)
> >                       return crtc->funcs->enable_vblank(crtc);
> > -     } else if (dev->driver->enable_vblank) {
> > +     }
> > +#ifdef CONFIG_DRM_LEGACY
> > +     else if (dev->driver->enable_vblank) {
> >               return dev->driver->enable_vblank(dev, pipe);
> >       }
> > +#endif
> >
> >       return -EINVAL;
> >  }
> > diff --git a/include/drm/drm_drv.h b/include/drm/drm_drv.h
> > index c6d17550efc9..7af220226a25 100644
> > --- a/include/drm/drm_drv.h
> > +++ b/include/drm/drm_drv.h
> > @@ -498,6 +498,7 @@ struct drm_driver {
> >        */
> >       const struct file_operations *fops;
> >
> > +#ifdef CONFIG_DRM_LEGACY
> >       /* Everything below here is for legacy driver, never use! */
> >       /* private: */
> >
> > @@ -512,6 +513,7 @@ struct drm_driver {
> >       int (*enable_vblank)(struct drm_device *dev, unsigned int pipe);
> >       void (*disable_vblank)(struct drm_device *dev, unsigned int pipe);
> >       int dev_priv_size;
> > +#endif
> >  };
> >
> >  void *__devm_drm_dev_alloc(struct device *parent, struct drm_driver *driver,
> >
>
> --
> Thomas Zimmermann
> Graphics Driver Developer
> SUSE Software Solutions Germany GmbH
> Maxfeldstr. 5, 90409 Nürnberg, Germany
> (HRB 36809, AG Nürnberg)
> Geschäftsführer: Felix Imendörffer



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

WARNING: multiple messages have this Message-ID (diff)
From: Daniel Vetter <daniel.vetter@ffwll.ch>
To: Thomas Zimmermann <tzimmermann@suse.de>
Cc: David Airlie <airlied@linux.ie>,
	Daniel Vetter <daniel.vetter@intel.com>,
	Intel Graphics Development <intel-gfx@lists.freedesktop.org>,
	DRI Development <dri-devel@lists.freedesktop.org>
Subject: Re: [Intel-gfx] [PATCH 2/5] drm: Compile out legacy chunks from struct drm_device
Date: Mon, 26 Oct 2020 10:17:33 +0100	[thread overview]
Message-ID: <CAKMK7uE-DG1t5mftzE_wPfmhLvw4UTQeROUMu+fTbHWtyVUXkw@mail.gmail.com> (raw)
In-Reply-To: <f31b5607-cfd8-4ab7-3b37-a5cb36509420@suse.de>

On Mon, Oct 26, 2020 at 9:37 AM Thomas Zimmermann <tzimmermann@suse.de> wrote:
>
> Hi
>
> Am 23.10.20 um 14:28 schrieb Daniel Vetter:
> > This means some very few #ifdef in code, but it allows us to
> > enlist the compiler to make sure this stuff isn't used anymore.
> >
> > More important, only legacy drivers change drm_device (for the
> > legacy_dev_list shadow attach management), therefore this is
> > prep to allow modern drivers to have a const driver struct. Which
> > is nice, because there's a ton of function pointers in there.
> >
> > Signed-off-by: Daniel Vetter <daniel.vetter@intel.com>
> > Cc: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
> > Cc: Maxime Ripard <mripard@kernel.org>
> > Cc: Thomas Zimmermann <tzimmermann@suse.de>
> > Cc: David Airlie <airlied@linux.ie>
> > Cc: Daniel Vetter <daniel@ffwll.ch>
> > Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
>
> Review-by: Thomas Zimmermann <tzimmermann@suse.de>
>
> Sort of related: the implementation for KMS and UMS devices is more and
> more distinct from each other. Did you ever consider going for separate
> legacy helpers instead of mixing-in all these ifdefs?

I think we could split out drm_pci_legacy.c. Everything else is
already split out into separate files and made optional at the
Makefile level, it's really only in oddball places around the shared
drm_device where there's any #ifdef at all.
-Daniel

>
> Best regards
> Thomas
>
> > ---
> >  drivers/gpu/drm/drm_file.c   |  2 ++
> >  drivers/gpu/drm/drm_vblank.c | 15 ++++++++++++---
> >  include/drm/drm_drv.h        |  2 ++
> >  3 files changed, 16 insertions(+), 3 deletions(-)
> >
> > diff --git a/drivers/gpu/drm/drm_file.c b/drivers/gpu/drm/drm_file.c
> > index 0ac4566ae3f4..b50380fa80ce 100644
> > --- a/drivers/gpu/drm/drm_file.c
> > +++ b/drivers/gpu/drm/drm_file.c
> > @@ -258,9 +258,11 @@ void drm_file_free(struct drm_file *file)
> >                 (long)old_encode_dev(file->minor->kdev->devt),
> >                 atomic_read(&dev->open_count));
> >
> > +#ifdef CONFIG_DRM_LEGACY
> >       if (drm_core_check_feature(dev, DRIVER_LEGACY) &&
> >           dev->driver->preclose)
> >               dev->driver->preclose(dev, file);
> > +#endif
> >
> >       if (drm_core_check_feature(dev, DRIVER_LEGACY))
> >               drm_legacy_lock_release(dev, file->filp);
> > diff --git a/drivers/gpu/drm/drm_vblank.c b/drivers/gpu/drm/drm_vblank.c
> > index ba7e741764aa..15e5ea436434 100644
> > --- a/drivers/gpu/drm/drm_vblank.c
> > +++ b/drivers/gpu/drm/drm_vblank.c
> > @@ -210,9 +210,12 @@ static u32 __get_vblank_counter(struct drm_device *dev, unsigned int pipe)
> >
> >               if (crtc->funcs->get_vblank_counter)
> >                       return crtc->funcs->get_vblank_counter(crtc);
> > -     } else if (dev->driver->get_vblank_counter) {
> > +     }
> > +#ifdef CONFIG_DRM_LEGACY
> > +     else if (dev->driver->get_vblank_counter) {
> >               return dev->driver->get_vblank_counter(dev, pipe);
> >       }
> > +#endif
> >
> >       return drm_vblank_no_hw_counter(dev, pipe);
> >  }
> > @@ -430,9 +433,12 @@ static void __disable_vblank(struct drm_device *dev, unsigned int pipe)
> >
> >               if (crtc->funcs->disable_vblank)
> >                       crtc->funcs->disable_vblank(crtc);
> > -     } else {
> > +     }
> > +#ifdef CONFIG_DRM_LEGACY
> > +     else {
> >               dev->driver->disable_vblank(dev, pipe);
> >       }
> > +#endif
> >  }
> >
> >  /*
> > @@ -1097,9 +1103,12 @@ static int __enable_vblank(struct drm_device *dev, unsigned int pipe)
> >
> >               if (crtc->funcs->enable_vblank)
> >                       return crtc->funcs->enable_vblank(crtc);
> > -     } else if (dev->driver->enable_vblank) {
> > +     }
> > +#ifdef CONFIG_DRM_LEGACY
> > +     else if (dev->driver->enable_vblank) {
> >               return dev->driver->enable_vblank(dev, pipe);
> >       }
> > +#endif
> >
> >       return -EINVAL;
> >  }
> > diff --git a/include/drm/drm_drv.h b/include/drm/drm_drv.h
> > index c6d17550efc9..7af220226a25 100644
> > --- a/include/drm/drm_drv.h
> > +++ b/include/drm/drm_drv.h
> > @@ -498,6 +498,7 @@ struct drm_driver {
> >        */
> >       const struct file_operations *fops;
> >
> > +#ifdef CONFIG_DRM_LEGACY
> >       /* Everything below here is for legacy driver, never use! */
> >       /* private: */
> >
> > @@ -512,6 +513,7 @@ struct drm_driver {
> >       int (*enable_vblank)(struct drm_device *dev, unsigned int pipe);
> >       void (*disable_vblank)(struct drm_device *dev, unsigned int pipe);
> >       int dev_priv_size;
> > +#endif
> >  };
> >
> >  void *__devm_drm_dev_alloc(struct device *parent, struct drm_driver *driver,
> >
>
> --
> Thomas Zimmermann
> Graphics Driver Developer
> SUSE Software Solutions Germany GmbH
> Maxfeldstr. 5, 90409 Nürnberg, Germany
> (HRB 36809, AG Nürnberg)
> Geschäftsführer: Felix Imendörffer



-- 
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:[~2020-10-26  9:17 UTC|newest]

Thread overview: 65+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-10-23 12:28 [PATCH 1/5] drm/radeon: Stop changing the drm_driver struct Daniel Vetter
2020-10-23 12:28 ` Daniel Vetter
2020-10-23 12:28 ` [Intel-gfx] " Daniel Vetter
2020-10-23 12:28 ` [PATCH 2/5] drm: Compile out legacy chunks from struct drm_device Daniel Vetter
2020-10-23 12:28   ` [Intel-gfx] " Daniel Vetter
2020-10-23 15:10   ` Maxime Ripard
2020-10-23 15:10     ` [Intel-gfx] " Maxime Ripard
2020-10-25 22:08   ` Sam Ravnborg
2020-10-25 22:08     ` [Intel-gfx] " Sam Ravnborg
2020-10-26  8:37   ` Thomas Zimmermann
2020-10-26  8:37     ` [Intel-gfx] " Thomas Zimmermann
2020-10-26  9:17     ` Daniel Vetter [this message]
2020-10-26  9:17       ` Daniel Vetter
2020-10-23 12:28 ` [PATCH 3/5] drm/amdgpu: Paper over the drm_driver mangling for virt Daniel Vetter
2020-10-23 12:28   ` [Intel-gfx] " Daniel Vetter
2020-10-23 12:28 ` [PATCH 4/5] drm: Allow const struct drm_driver Daniel Vetter
2020-10-23 12:28   ` [Intel-gfx] " Daniel Vetter
2020-10-23 15:11   ` Maxime Ripard
2020-10-23 15:11     ` [Intel-gfx] " Maxime Ripard
2020-10-25 21:44   ` Sam Ravnborg
2020-10-25 21:44     ` [Intel-gfx] " Sam Ravnborg
2020-10-26  8:40   ` Thomas Zimmermann
2020-10-26  8:40     ` [Intel-gfx] " Thomas Zimmermann
2020-10-23 12:28 ` [PATCH 5/5] drm/<drivers>: Constify " Daniel Vetter
2020-10-23 12:28   ` [Intel-gfx] " Daniel Vetter
2020-10-23 12:28   ` Daniel Vetter
2020-10-23 12:28   ` Daniel Vetter
2020-10-23 15:13   ` Maxime Ripard
2020-10-23 15:13     ` [Intel-gfx] " Maxime Ripard
2020-10-23 15:13     ` Maxime Ripard
2020-10-23 15:22   ` kernel test robot
2020-10-23 15:22     ` [Intel-gfx] " kernel test robot
2020-10-23 15:22     ` kernel test robot
2020-10-23 15:22     ` kernel test robot
2020-10-23 15:22     ` kernel test robot
     [not found]   ` <20201023122811.2374118-5-daniel.vetter-/w4YWyX8dFk@public.gmane.org>
2020-10-23 16:04     ` [PATCH] " Daniel Vetter
2020-10-23 16:04       ` [Intel-gfx] " Daniel Vetter
2020-10-23 16:04       ` Daniel Vetter
2020-10-23 16:04       ` Daniel Vetter
     [not found]       ` <20201023160444.2465340-1-daniel.vetter-/w4YWyX8dFk@public.gmane.org>
2020-10-25 22:23         ` Sam Ravnborg
2020-10-25 22:23           ` [Intel-gfx] " Sam Ravnborg
2020-10-25 22:23           ` Sam Ravnborg
2020-10-25 22:23           ` Sam Ravnborg
     [not found]           ` <20201025222303.GC13779-uyr5N9Q2VtJg9hUCZPvPmw@public.gmane.org>
2020-10-25 23:04             ` Daniel Vetter
2020-10-25 23:04               ` [Intel-gfx] " Daniel Vetter
2020-10-25 23:04               ` Daniel Vetter
2020-10-25 23:04               ` Daniel Vetter
2020-10-26  8:43     ` [PATCH 5/5] " Thomas Zimmermann
2020-10-26  8:43       ` [Intel-gfx] " Thomas Zimmermann
2020-10-26  8:43       ` Thomas Zimmermann
2020-10-26  8:43       ` Thomas Zimmermann
2020-10-26  9:14       ` Daniel Vetter
2020-10-26  9:14         ` [Intel-gfx] " Daniel Vetter
2020-10-26  9:14         ` Daniel Vetter
2020-10-26  9:14         ` Daniel Vetter
2020-10-23 13:39 ` [Intel-gfx] ✗ Fi.CI.CHECKPATCH: warning for series starting with [1/5] drm/radeon: Stop changing the drm_driver struct Patchwork
2020-10-23 13:42 ` [Intel-gfx] ✗ Fi.CI.SPARSE: " Patchwork
2020-10-23 14:05 ` [Intel-gfx] ✓ Fi.CI.BAT: success " Patchwork
2020-10-23 16:32 ` [Intel-gfx] ✗ Fi.CI.CHECKPATCH: warning for series starting with [1/5] drm/radeon: Stop changing the drm_driver struct (rev2) Patchwork
2020-10-23 16:34 ` [Intel-gfx] ✗ Fi.CI.SPARSE: " Patchwork
2020-10-23 16:57 ` [Intel-gfx] ✓ Fi.CI.BAT: success " Patchwork
2020-10-23 17:11 ` [Intel-gfx] ✗ Fi.CI.IGT: failure for series starting with [1/5] drm/radeon: Stop changing the drm_driver struct Patchwork
2020-10-23 20:37 ` [Intel-gfx] ✓ Fi.CI.IGT: success for series starting with [1/5] drm/radeon: Stop changing the drm_driver struct (rev2) Patchwork
2020-10-30 10:11 [PATCH 1/5] drm/radeon: Stop changing the drm_driver struct Daniel Vetter
2020-10-30 10:11 ` [PATCH 2/5] drm: Compile out legacy chunks from struct drm_device Daniel Vetter
2020-10-30 18:22   ` 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=CAKMK7uE-DG1t5mftzE_wPfmhLvw4UTQeROUMu+fTbHWtyVUXkw@mail.gmail.com \
    --to=daniel.vetter@ffwll.ch \
    --cc=airlied@linux.ie \
    --cc=daniel.vetter@intel.com \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=intel-gfx@lists.freedesktop.org \
    --cc=tzimmermann@suse.de \
    /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.