public inbox for intel-gfx@lists.freedesktop.org
 help / color / mirror / Atom feed
* [PATCH 0/3] Claw back the IS_<platform> optimisation
@ 2016-12-08  9:49 Tvrtko Ursulin
  2016-12-08  9:49 ` [PATCH 1/3] drm/i915: Introduct i915_platforms.h Tvrtko Ursulin
                   ` (4 more replies)
  0 siblings, 5 replies; 18+ messages in thread
From: Tvrtko Ursulin @ 2016-12-08  9:49 UTC (permalink / raw)
  To: Intel-gfx; +Cc: Jani Nikula

From: Tvrtko Ursulin <tvrtko.ursulin@intel.com>

Reorganise the IS_<platform> code a bit inspired by the pre-processor
code generation as used by Chris in the self test patches.

This avoids some source code duplication and makes maintenance easier.

In the last patch try to claw back the multiple IS_<platform> optimisation,
as the commit message says:

    If we use only power of two values for the platform enum
    values we can let the compiler optimize some common
    checks to a single conditional.

    For example code like this:

        if (IS_VALLEYVIEW(dev_priv) || IS_CHERRYVIEW(dev_priv))

    Goes from this:

       5c3c5:       8b 83 d8 06 00 00       mov    0x6d8(%rbx),%eax
       5c3cb:       83 f8 12                cmp    $0x12,%eax
       5c3ce:       0f 84 f3 00 00 00       je     5c4c7 <fw_domain_init+0x1a7>
       5c3d4:       83 f8 15                cmp    $0x15,%eax
       5c3d7:       0f 84 ea 00 00 00       je     5c4c7 <fw_domain_init+0x1a7>

    To this:

       5c1d5:       f7 83 d8 06 00 00 00    testl  $0x240000,0x6d8(%rbx)
       5c1dc:       00 24 00
       5c1df:       0f 85 da 00 00 00       jne    5c2bf <fw_domain_init+0x18f>

    It is not much but there is value in this that as long as we
    have to have conditions like the above sprinkled troughout the
    code, we can at least have the generate binary a bit smarter.

    Until we get to more than 32 platforms there is no downside
    to this approach.

Patch series saves 1890 bytes of binary:

   text    data     bss     dec     hex filename
1103970   26273     580 1130823  114147 i915.ko.0
1102080   26273     580 1128933  1139e5 i915.ko.1

Tvrtko Ursulin (3):
  drm/i915: Introduct i915_platforms.h
  drm/i915: Generate all IS_<platform> macros
  drm/i915: Number the platform enum strategically

 drivers/gpu/drm/i915/i915_drv.h          | 69 +++++++++-----------------------
 drivers/gpu/drm/i915/i915_platforms.h    | 34 ++++++++++++++++
 drivers/gpu/drm/i915/intel_device_info.c | 38 ++++--------------
 3 files changed, 61 insertions(+), 80 deletions(-)
 create mode 100644 drivers/gpu/drm/i915/i915_platforms.h

-- 
2.7.4

_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply	[flat|nested] 18+ messages in thread

end of thread, other threads:[~2016-12-08 15:15 UTC | newest]

Thread overview: 18+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-12-08  9:49 [PATCH 0/3] Claw back the IS_<platform> optimisation Tvrtko Ursulin
2016-12-08  9:49 ` [PATCH 1/3] drm/i915: Introduct i915_platforms.h Tvrtko Ursulin
2016-12-08 10:41   ` Jani Nikula
2016-12-08 13:16     ` Joonas Lahtinen
2016-12-08 13:21       ` Tvrtko Ursulin
2016-12-08  9:49 ` [PATCH 2/3] drm/i915: Generate all IS_<platform> macros Tvrtko Ursulin
2016-12-08 10:46   ` Jani Nikula
2016-12-08 13:26     ` Tvrtko Ursulin
2016-12-08 13:37       ` Jani Nikula
2016-12-08 13:40         ` Jani Nikula
2016-12-08 13:42         ` Tvrtko Ursulin
2016-12-08 14:00           ` Jani Nikula
2016-12-08 14:10             ` Tvrtko Ursulin
2016-12-08  9:49 ` [PATCH 3/3] drm/i915: Number the platform enum strategically Tvrtko Ursulin
2016-12-08 10:04   ` Chris Wilson
2016-12-08 13:38     ` [PATCH v2] " Tvrtko Ursulin
2016-12-08 11:54 ` ✓ Fi.CI.BAT: success for Claw back the IS_<platform> optimisation Patchwork
2016-12-08 15:15 ` ✗ Fi.CI.BAT: warning for Claw back the IS_<platform> optimisation (rev2) Patchwork

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox