Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1523506
| From | Daniel Vetter <daniel@ffwll.ch> |
|---|---|
| Newsgroups | linux.kernel |
| Subject | Re: [Intel-gfx] [PATCH v11 3/4] drm/i915: Use new CRC debugfs API |
| Date | 2016-11-16 15:20 +0100 |
| Message-ID | <sE9e9-42d-5@gated-at.bofh.it> (permalink) |
| References | (4 earlier) <sDHhU-2vk-27@gated-at.bofh.it> <sE7vI-2KY-15@gated-at.bofh.it> <sE7YJ-2Un-7@gated-at.bofh.it> <sE94t-3Rs-3@gated-at.bofh.it> <sE94u-3Rs-23@gated-at.bofh.it> |
| Organization | linux.* mail to news gateway |
On Wed, Nov 16, 2016 at 04:08:30PM +0200, Jani Nikula wrote:
> On Wed, 16 Nov 2016, Tomeu Vizoso <tomeu.vizoso@collabora.com> wrote:
> > On 16 November 2016 at 13:58, Jani Nikula <jani.nikula@linux.intel.com> wrote:
> >> On Wed, 16 Nov 2016, Tomeu Vizoso <tomeu.vizoso@collabora.com> wrote:
> >>> On 15 November 2016 at 09:27, Jani Nikula <jani.nikula@linux.intel.com> wrote:
> >>>> On Tue, 15 Nov 2016, David Weinehall <tao@kernel.org> wrote:
> >>>>> On Mon, Nov 14, 2016 at 12:44:25PM +0200, Jani Nikula wrote:
> >>>>>> On Thu, 06 Oct 2016, Tomeu Vizoso <tomeu.vizoso@collabora.com> wrote:
> >>>>>> > diff --git a/drivers/gpu/drm/i915/intel_display.c b/drivers/gpu/drm/i915/intel_display.c
> >>>>>> > index 23a6c7213eca..7412a05fa5d9 100644
> >>>>>> > --- a/drivers/gpu/drm/i915/intel_display.c
> >>>>>> > +++ b/drivers/gpu/drm/i915/intel_display.c
> >>>>>> > @@ -14636,6 +14636,7 @@ static const struct drm_crtc_funcs intel_crtc_funcs = {
> >>>>>> > .page_flip = intel_crtc_page_flip,
> >>>>>> > .atomic_duplicate_state = intel_crtc_duplicate_state,
> >>>>>> > .atomic_destroy_state = intel_crtc_destroy_state,
> >>>>>> > + .set_crc_source = intel_crtc_set_crc_source,
> >>>>>> > };
> >>>>>> >
> >>>>>> > /**
> >>>>>> > diff --git a/drivers/gpu/drm/i915/intel_drv.h b/drivers/gpu/drm/i915/intel_drv.h
> >>>>>> > index 737261b09110..31894b7c6517 100644
> >>>>>> > --- a/drivers/gpu/drm/i915/intel_drv.h
> >>>>>> > +++ b/drivers/gpu/drm/i915/intel_drv.h
> >>>>>> > @@ -1844,6 +1844,14 @@ void intel_color_load_luts(struct drm_crtc_state *crtc_state);
> >>>>>> > /* intel_pipe_crc.c */
> >>>>>> > int intel_pipe_crc_create(struct drm_minor *minor);
> >>>>>> > void intel_pipe_crc_cleanup(struct drm_minor *minor);
> >>>>>> > +#ifdef CONFIG_DEBUG_FS
> >>>>>> > +int intel_crtc_set_crc_source(struct drm_crtc *crtc, const char *source_name,
> >>>>>> > + size_t *values_cnt);
> >>>>>> > +#else
> >>>>>> > +static inline int intel_crtc_set_crc_source(struct drm_crtc *crtc,
> >>>>>> > + const char *source_name,
> >>>>>> > + size_t *values_cnt) { return 0; }
> >>>>>> > +#endif
> >>>>>>
> >>>>>> "inline" here doesn't work because it's used as a function pointer.
> >>>>>>
> >>>>>> Is it better to have a function that returns 0 for .set_crc_source, or
> >>>>>> to set .set_crc_source to NULL when CONFIG_DEBUG_FS=n?
> >>>>>
> >>>>> I'd say that whenever we have a function pointer we should have a dummy
> >>>>> function without side-effects for this kind of things.
> >>>>
> >>>> Whoever calls .set_crc_source could do smarter things depending on the
> >>>> hook not being there vs. just silently plunging on.
> >>>
> >>> In this specific case, when CONFIG_DEBUG_FS=n it doesn't make any
> >>> sense to call that callback, so I think we should have a dummy
> >>> implementation to avoid adding an ifdef to the .c.
> >>
> >> We don't want the ifdef to the .c file, but we could do
> >>
> >> #ifdef CONFIG_DEBUG_FS
> >> int intel_crtc_set_crc_source(struct drm_crtc *crtc, const char *source_name,
> >> size_t *values_cnt);
> >> #else
> >> #define intel_crtc_set_crc_source NULL
> >> #endif
> >
> > Sounds good to me, and though I don't have any objections, wonder why
> > this isn't a common idiom in the DRM subsystem. I was able to find
> > only one instance: drm_compat_ioctl.
>
> Heh, and it was I who suggested that too. Maybe get a second opinion. ;)
Personally I like drm_compat_ioctl, we should spread it far&wide.
-Daniel
--
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch
Back to linux.kernel | Previous | Next — Previous in thread | Find similar | Unroll thread
Re: [PATCH v11 3/4] drm/i915: Use new CRC debugfs API Jani Nikula <jani.nikula@linux.intel.com> - 2016-11-14 11:50 +0100
Re: [Intel-gfx] [PATCH v11 3/4] drm/i915: Use new CRC debugfs API David Weinehall <tao@kernel.org> - 2016-11-15 08:20 +0100
Re: [Intel-gfx] [PATCH v11 3/4] drm/i915: Use new CRC debugfs API Jani Nikula <jani.nikula@linux.intel.com> - 2016-11-15 09:30 +0100
Re: [Intel-gfx] [PATCH v11 3/4] drm/i915: Use new CRC debugfs API Tomeu Vizoso <tomeu.vizoso@collabora.com> - 2016-11-16 13:30 +0100
Re: [Intel-gfx] [PATCH v11 3/4] drm/i915: Use new CRC debugfs API Jani Nikula <jani.nikula@linux.intel.com> - 2016-11-16 14:00 +0100
Re: [Intel-gfx] [PATCH v11 3/4] drm/i915: Use new CRC debugfs API Tomeu Vizoso <tomeu.vizoso@collabora.com> - 2016-11-16 15:10 +0100
Re: [Intel-gfx] [PATCH v11 3/4] drm/i915: Use new CRC debugfs API Jani Nikula <jani.nikula@linux.intel.com> - 2016-11-16 15:10 +0100
Re: [Intel-gfx] [PATCH v11 3/4] drm/i915: Use new CRC debugfs API Daniel Vetter <daniel@ffwll.ch> - 2016-11-16 15:20 +0100
csiph-web