From: Dave Gordon <david.s.gordon@intel.com>
To: Tvrtko Ursulin <tvrtko.ursulin@linux.intel.com>,
intel-gfx@lists.freedesktop.org
Subject: Re: [PATCH] drm/i915: prefer INTEL_GEN(dev_priv) to INTEL_INFO(dev)->gen
Date: Mon, 13 Jun 2016 15:59:03 +0100 [thread overview]
Message-ID: <575ECA37.3080204@intel.com> (raw)
In-Reply-To: <575E7CAC.8090205@linux.intel.com>
On 13/06/16 10:28, Tvrtko Ursulin wrote:
>
> On 10/06/16 18:35, Dave Gordon wrote:
>> More Coccinellery ...
>>
>> Wherever we find "INTEL_INFO(dev)->gen", and have a suitable
>> "dev_priv" in scope, replace it with "INTEL_GEN(dev_priv)".
>> At this time, we've found 189 instances, and each replacement
>> saves one memory cycle at runtime and two bytes of codespace
>> (~360 bytes total text size reduction).
>>
>> @dev_priv_param@
>> function FUNC;
>> idexpression struct drm_device *DEV;
>> identifier DEV_PRIV;
>> @@
>> FUNC(..., struct drm_i915_private *DEV_PRIV, ...)
>> {
>> <...
>> - INTEL_INFO(DEV)->gen
>> + INTEL_GEN(DEV_PRIV)
>> ...>
>> }
>>
>> @dev_priv_local@
>> idexpression struct drm_device *DEV;
>> identifier DEV_PRIV;
>> expression E;
>> @@
>> {
>> ...
>> (
>> struct drm_i915_private *DEV_PRIV;
>> |
>> struct drm_i915_private *DEV_PRIV = E;
>> )
>> <...
>> - INTEL_INFO(DEV)->gen
>> + INTEL_GEN(DEV_PRIV)
>> ...>
>> }
>>
>> Plus manual deletion of one now-unused local "dev".
>>
>> Signed-off-by: Dave Gordon <david.s.gordon@intel.com>
>> ---
>> drivers/gpu/drm/i915/i915_debugfs.c | 52 +++++++-------
>> drivers/gpu/drm/i915/i915_dma.c | 16 ++---
>> drivers/gpu/drm/i915/i915_drv.c | 2 +-
>> drivers/gpu/drm/i915/i915_gem.c | 4 +-
>> drivers/gpu/drm/i915/i915_gem_execbuffer.c | 8 +--
>> drivers/gpu/drm/i915/i915_gem_fence.c | 8 +--
>> drivers/gpu/drm/i915/i915_gem_gtt.c | 12 ++--
>> drivers/gpu/drm/i915/i915_gem_stolen.c | 6 +-
>> drivers/gpu/drm/i915/i915_gpu_error.c | 14 ++--
>> drivers/gpu/drm/i915/i915_irq.c | 12 ++--
>> drivers/gpu/drm/i915/i915_suspend.c | 20 +++---
>> drivers/gpu/drm/i915/intel_color.c | 2 +-
>> drivers/gpu/drm/i915/intel_crt.c | 6 +-
>> drivers/gpu/drm/i915/intel_ddi.c | 4 +-
>> drivers/gpu/drm/i915/intel_display.c | 111 ++++++++++++++---------------
>> drivers/gpu/drm/i915/intel_dp.c | 20 +++---
>> drivers/gpu/drm/i915/intel_dpll_mgr.c | 2 +-
>> drivers/gpu/drm/i915/intel_lvds.c | 4 +-
>> drivers/gpu/drm/i915/intel_pm.c | 18 ++---
>> drivers/gpu/drm/i915/intel_psr.c | 4 +-
>> drivers/gpu/drm/i915/intel_sdvo.c | 8 +--
>> drivers/gpu/drm/i915/intel_tv.c | 2 +-
>> 22 files changed, 167 insertions(+), 168 deletions(-)
[snip]
>> @@ -553,7 +553,7 @@ void i915_gem_restore_fences(struct drm_device *dev)
>> uint32_t swizzle_x = I915_BIT_6_SWIZZLE_UNKNOWN;
>> uint32_t swizzle_y = I915_BIT_6_SWIZZLE_UNKNOWN;
>>
>> - if (INTEL_INFO(dev)->gen >= 8 || IS_VALLEYVIEW(dev)) {
>> + if (INTEL_GEN(dev_priv) >= 8 || IS_VALLEYVIEW(dev)) {
>
> While we are churning :), could looks for both dev_priv and dev in the
> same condition like here and tidy those.
[snip]
> A few instances of the small comment I made above, which I think would
> be a good opportunity. Otherwise all looks OK.
>
> Reviewed-by: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
>
> But needs more acks, since last time we discussed this conclusion was it
> was too much disruption for the benefit.
>
> Regards,
> Tvrtko
Yes, that's why this was a minimal set for replacement of one specific
but very common idiom that has a definite benefit. At the other extreme,
I have a Cocci patch to replace *all* INTEL_INFO()->gen with INTEL_GEN()
and then replace the 'dev' parameter to INTEL_INFO(), INTEL_GEN() and
all the IS_X() macros wherever possible; but that really is a lot of
churn for proportionately less benefit. Or we could pick replacements on
a file-by-file basis rather than according to which macro they use. Or
maybe one patch each for the big targets (debugfs.c, display.c) and
another one that does all the files where there are only a few lines of
changes.
Opinions, anybody?
.Dave.
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
next prev parent reply other threads:[~2016-06-13 14:59 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-06-10 17:35 [PATCH] drm/i915: prefer INTEL_GEN(dev_priv) to INTEL_INFO(dev)->gen Dave Gordon
2016-06-11 6:13 ` ✗ Ro.CI.BAT: warning for " Patchwork
2016-06-13 9:28 ` [PATCH] " Tvrtko Ursulin
2016-06-13 14:59 ` Dave Gordon [this message]
-- strict thread matches above, loose matches on Subject: below --
2016-09-09 21:37 Dave Gordon
2016-09-09 21:58 ` Chris Wilson
2016-09-09 22:43 ` Dave Gordon
2016-09-13 9:10 ` Jani Nikula
2016-09-14 12:32 ` Dave Gordon
2016-09-14 12:37 ` Dave Gordon
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=575ECA37.3080204@intel.com \
--to=david.s.gordon@intel.com \
--cc=intel-gfx@lists.freedesktop.org \
--cc=tvrtko.ursulin@linux.intel.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox