All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jani Nikula <jani.nikula@linux.intel.com>
To: Tomeu Vizoso <tomeu.vizoso@collabora.com>
Cc: David Airlie <airlied@linux.ie>,
	Intel Graphics Development <intel-gfx@lists.freedesktop.org>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	"dri-devel@lists.freedesktop.org"
	<dri-devel@lists.freedesktop.org>,
	Thierry Reding <thierry.reding@gmail.com>,
	Daniel Vetter <daniel.vetter@intel.com>
Subject: Re: [PATCH v11 3/4] drm/i915: Use new CRC debugfs API
Date: Wed, 16 Nov 2016 16:08:30 +0200	[thread overview]
Message-ID: <87eg2b1pr5.fsf@intel.com> (raw)
In-Reply-To: <CAAObsKA4OKw8qtJJ6++QaSw_4bwKXMP4z2HS2OKmBHqbAoj9JQ@mail.gmail.com>

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

BR,
Jani.

>
> Regards,
>
> Tomeu

-- 
Jani Nikula, Intel Open Source Technology Center
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

WARNING: multiple messages have this Message-ID (diff)
From: Jani Nikula <jani.nikula@linux.intel.com>
To: Tomeu Vizoso <tomeu.vizoso@collabora.com>
Cc: David Airlie <airlied@linux.ie>,
	Intel Graphics Development <intel-gfx@lists.freedesktop.org>,
	"linux-kernel\@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	"dri-devel\@lists.freedesktop.org"
	<dri-devel@lists.freedesktop.org>,
	Thierry Reding <thierry.reding@gmail.com>,
	Daniel Vetter <daniel.vetter@intel.com>
Subject: Re: [Intel-gfx] [PATCH v11 3/4] drm/i915: Use new CRC debugfs API
Date: Wed, 16 Nov 2016 16:08:30 +0200	[thread overview]
Message-ID: <87eg2b1pr5.fsf@intel.com> (raw)
In-Reply-To: <CAAObsKA4OKw8qtJJ6++QaSw_4bwKXMP4z2HS2OKmBHqbAoj9JQ@mail.gmail.com>

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

BR,
Jani.

>
> Regards,
>
> Tomeu

-- 
Jani Nikula, Intel Open Source Technology Center

  reply	other threads:[~2016-11-16 14:08 UTC|newest]

Thread overview: 30+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-10-06 15:21 [PATCH v11 0/4] New debugfs API for capturing CRC of frames Tomeu Vizoso
2016-10-06 15:21 ` [PATCH v11 1/4] drm/i915/debugfs: Move out pipe CRC code Tomeu Vizoso
2016-10-06 15:21 ` [PATCH v11 2/4] drm: Add API for capturing frame CRCs Tomeu Vizoso
2016-10-06 15:21   ` Tomeu Vizoso
2016-10-10 11:28   ` Tomeu Vizoso
2016-10-10 11:28     ` Tomeu Vizoso
2016-10-10 13:12   ` Emil Velikov
2016-10-10 13:12     ` Emil Velikov
2016-10-11 10:12     ` Benjamin Gaignard
2016-10-11 10:12       ` Benjamin Gaignard
2016-10-17 14:47   ` Daniel Vetter
2016-10-06 15:21 ` [PATCH v11 3/4] drm/i915: Use new CRC debugfs API Tomeu Vizoso
2016-10-06 15:21   ` Tomeu Vizoso
2016-11-14 10:44   ` Jani Nikula
2016-11-14 10:44     ` Jani Nikula
2016-11-15  7:16     ` [Intel-gfx] " David Weinehall
2016-11-15  8:27       ` Jani Nikula
2016-11-15  8:27         ` [Intel-gfx] " Jani Nikula
2016-11-16 12:24         ` Tomeu Vizoso
2016-11-16 12:24           ` [Intel-gfx] " Tomeu Vizoso
2016-11-16 12:58           ` Jani Nikula
2016-11-16 12:58             ` [Intel-gfx] " Jani Nikula
2016-11-16 14:04             ` Tomeu Vizoso
2016-11-16 14:04               ` [Intel-gfx] " Tomeu Vizoso
2016-11-16 14:08               ` Jani Nikula [this message]
2016-11-16 14:08                 ` Jani Nikula
2016-11-16 14:13                 ` Daniel Vetter
2016-11-16 14:13                   ` [Intel-gfx] " Daniel Vetter
2016-10-06 15:21 ` [PATCH v11 4/4] drm/i915: Put "cooked" vlank counters in frame CRC lines Tomeu Vizoso
2016-10-06 15:21   ` Tomeu Vizoso

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=87eg2b1pr5.fsf@intel.com \
    --to=jani.nikula@linux.intel.com \
    --cc=airlied@linux.ie \
    --cc=daniel.vetter@intel.com \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=intel-gfx@lists.freedesktop.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=thierry.reding@gmail.com \
    --cc=tomeu.vizoso@collabora.com \
    /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.