All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v2] drm/i915: Allow optimized platform checks
@ 2017-09-27 16:41 Tvrtko Ursulin
  2017-09-27 17:03 ` Chris Wilson
                   ` (4 more replies)
  0 siblings, 5 replies; 7+ messages in thread
From: Tvrtko Ursulin @ 2017-09-27 16:41 UTC (permalink / raw)
  To: Intel-gfx; +Cc: Jani Nikula

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

If we store the platform as a bitmask, and convert the
IS_PLATFORM macro to use it, we allow the compiler to
merge the IS_PLATFORM(a) || IS_PLATFORM(b) || ... checks
into a single conditional.

As a secondary benefit this saves almost 1k of text:

    text           data     bss     dec     hex filename
-1460254          60014    3656 1523924  1740d4 drivers/gpu/drm/i915/i915.ko
+1459260          60026    3656 1522942  173cfe drivers/gpu/drm/i915/i915.ko

v2: Removed the infamous -1.

Signed-off-by: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
Cc: Jani Nikula <jani.nikula@intel.com>
---
 drivers/gpu/drm/i915/i915_drv.c | 4 ++++
 drivers/gpu/drm/i915/i915_drv.h | 3 ++-
 2 files changed, 6 insertions(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/i915/i915_drv.c b/drivers/gpu/drm/i915/i915_drv.c
index 03bbe23e4df8..187c0fad1b79 100644
--- a/drivers/gpu/drm/i915/i915_drv.c
+++ b/drivers/gpu/drm/i915/i915_drv.c
@@ -870,6 +870,10 @@ static int i915_driver_init_early(struct drm_i915_private *dev_priv,
 	memcpy(device_info, match_info, sizeof(*device_info));
 	device_info->device_id = dev_priv->drm.pdev->device;
 
+	BUILD_BUG_ON(INTEL_MAX_PLATFORMS >
+		     sizeof(device_info->platform_mask) * BITS_PER_BYTE);
+	device_info->platform_mask = BIT(device_info->platform);
+
 	BUG_ON(device_info->gen > sizeof(device_info->gen_mask) * BITS_PER_BYTE);
 	device_info->gen_mask = BIT(device_info->gen - 1);
 
diff --git a/drivers/gpu/drm/i915/i915_drv.h b/drivers/gpu/drm/i915/i915_drv.h
index bda91db3fc46..3a6a34882427 100644
--- a/drivers/gpu/drm/i915/i915_drv.h
+++ b/drivers/gpu/drm/i915/i915_drv.h
@@ -861,6 +861,7 @@ struct intel_device_info {
 	u8 ring_mask; /* Rings supported by the HW */
 
 	enum intel_platform platform;
+	u32 platform_mask;
 
 	u32 display_mmio_offset;
 
@@ -2986,7 +2987,7 @@ intel_info(const struct drm_i915_private *dev_priv)
 #define IS_REVID(p, since, until) \
 	(INTEL_REVID(p) >= (since) && INTEL_REVID(p) <= (until))
 
-#define IS_PLATFORM(dev_priv, p) ((dev_priv)->info.platform == (p))
+#define IS_PLATFORM(dev_priv, p) ((dev_priv)->info.platform_mask & BIT(p))
 
 #define IS_I830(dev_priv)	IS_PLATFORM(dev_priv, INTEL_I830)
 #define IS_I845G(dev_priv)	IS_PLATFORM(dev_priv, INTEL_I845G)
-- 
2.9.5

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

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

* Re: [PATCH v2] drm/i915: Allow optimized platform checks
  2017-09-27 16:41 [PATCH v2] drm/i915: Allow optimized platform checks Tvrtko Ursulin
@ 2017-09-27 17:03 ` Chris Wilson
  2017-09-27 17:07 ` ✓ Fi.CI.BAT: success for " Patchwork
                   ` (3 subsequent siblings)
  4 siblings, 0 replies; 7+ messages in thread
From: Chris Wilson @ 2017-09-27 17:03 UTC (permalink / raw)
  To: Tvrtko Ursulin, Intel-gfx; +Cc: Jani Nikula

Quoting Tvrtko Ursulin (2017-09-27 17:41:38)
> From: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
> 
> If we store the platform as a bitmask, and convert the
> IS_PLATFORM macro to use it, we allow the compiler to
> merge the IS_PLATFORM(a) || IS_PLATFORM(b) || ... checks
> into a single conditional.
> 
> As a secondary benefit this saves almost 1k of text:
> 
>     text           data     bss     dec     hex filename
> -1460254          60014    3656 1523924  1740d4 drivers/gpu/drm/i915/i915.ko
> +1459260          60026    3656 1522942  173cfe drivers/gpu/drm/i915/i915.ko
> 
> v2: Removed the infamous -1.
> 
> Signed-off-by: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
> Cc: Jani Nikula <jani.nikula@intel.com>

I checked a few of our IS_*() to make sure we were not storing any
inside a local int which may cause a few surprises (but unlikely if they
are ever used outside of boolean contxt).

Reviewed-by: Chris Wilson <chris@chris-wilson.co.uk>
-Chris
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

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

* ✓ Fi.CI.BAT: success for drm/i915: Allow optimized platform checks
  2017-09-27 16:41 [PATCH v2] drm/i915: Allow optimized platform checks Tvrtko Ursulin
  2017-09-27 17:03 ` Chris Wilson
@ 2017-09-27 17:07 ` Patchwork
  2017-09-28 11:49   ` Tvrtko Ursulin
  2017-09-27 21:25 ` ✓ Fi.CI.IGT: " Patchwork
                   ` (2 subsequent siblings)
  4 siblings, 1 reply; 7+ messages in thread
From: Patchwork @ 2017-09-27 17:07 UTC (permalink / raw)
  To: Tvrtko Ursulin; +Cc: intel-gfx

== Series Details ==

Series: drm/i915: Allow optimized platform checks
URL   : https://patchwork.freedesktop.org/series/30982/
State : success

== Summary ==

Series 30982v1 drm/i915: Allow optimized platform checks
https://patchwork.freedesktop.org/api/1.0/series/30982/revisions/1/mbox/

Test drv_module_reload:
        Subgroup basic-reload:
                dmesg-warn -> PASS       (fi-glk-1) fdo#102777

fdo#102777 https://bugs.freedesktop.org/show_bug.cgi?id=102777

fi-bdw-5557u     total:289  pass:268  dwarn:0   dfail:0   fail:0   skip:21  time:440s
fi-bdw-gvtdvm    total:289  pass:265  dwarn:0   dfail:0   fail:0   skip:24  time:479s
fi-blb-e6850     total:289  pass:224  dwarn:1   dfail:0   fail:0   skip:64  time:419s
fi-bsw-n3050     total:289  pass:243  dwarn:0   dfail:0   fail:0   skip:46  time:519s
fi-bwr-2160      total:289  pass:184  dwarn:0   dfail:0   fail:0   skip:105 time:282s
fi-bxt-j4205     total:289  pass:260  dwarn:0   dfail:0   fail:0   skip:29  time:499s
fi-byt-j1900     total:289  pass:254  dwarn:1   dfail:0   fail:0   skip:34  time:492s
fi-cfl-s         total:289  pass:223  dwarn:34  dfail:0   fail:0   skip:32  time:544s
fi-cnl-y         total:289  pass:258  dwarn:0   dfail:0   fail:4   skip:27  time:637s
fi-elk-e7500     total:289  pass:230  dwarn:0   dfail:0   fail:0   skip:59  time:420s
fi-glk-1         total:289  pass:260  dwarn:0   dfail:0   fail:0   skip:29  time:568s
fi-hsw-4770      total:289  pass:263  dwarn:0   dfail:0   fail:0   skip:26  time:424s
fi-hsw-4770r     total:289  pass:263  dwarn:0   dfail:0   fail:0   skip:26  time:405s
fi-ilk-650       total:289  pass:229  dwarn:0   dfail:0   fail:0   skip:60  time:437s
fi-ivb-3520m     total:289  pass:261  dwarn:0   dfail:0   fail:0   skip:28  time:493s
fi-ivb-3770      total:289  pass:261  dwarn:0   dfail:0   fail:0   skip:28  time:468s
fi-kbl-7500u     total:289  pass:264  dwarn:1   dfail:0   fail:0   skip:24  time:471s
fi-kbl-7560u     total:289  pass:270  dwarn:0   dfail:0   fail:0   skip:19  time:584s
fi-kbl-r         total:289  pass:262  dwarn:0   dfail:0   fail:0   skip:27  time:593s
fi-pnv-d510      total:289  pass:223  dwarn:1   dfail:0   fail:0   skip:65  time:546s
fi-skl-6260u     total:289  pass:269  dwarn:0   dfail:0   fail:0   skip:20  time:446s
fi-skl-6700k     total:289  pass:265  dwarn:0   dfail:0   fail:0   skip:24  time:745s
fi-skl-6770hq    total:289  pass:269  dwarn:0   dfail:0   fail:0   skip:20  time:485s
fi-skl-gvtdvm    total:289  pass:266  dwarn:0   dfail:0   fail:0   skip:23  time:473s
fi-snb-2520m     total:289  pass:251  dwarn:0   dfail:0   fail:0   skip:38  time:567s
fi-snb-2600      total:289  pass:250  dwarn:0   dfail:0   fail:0   skip:39  time:410s

aa884e1abdf2ffb7db8c524fc6269280734e5145 drm-tip: 2017y-09m-27d-15h-39m-07s UTC integration manifest
6ef30a4343e1 drm/i915: Allow optimized platform checks

== Logs ==

For more details see: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_5834/
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

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

* ✓ Fi.CI.IGT: success for drm/i915: Allow optimized platform checks
  2017-09-27 16:41 [PATCH v2] drm/i915: Allow optimized platform checks Tvrtko Ursulin
  2017-09-27 17:03 ` Chris Wilson
  2017-09-27 17:07 ` ✓ Fi.CI.BAT: success for " Patchwork
@ 2017-09-27 21:25 ` Patchwork
  2017-09-28  7:34 ` [PATCH v2] " Jani Nikula
  2017-09-29  8:59 ` Joonas Lahtinen
  4 siblings, 0 replies; 7+ messages in thread
From: Patchwork @ 2017-09-27 21:25 UTC (permalink / raw)
  To: Tvrtko Ursulin; +Cc: intel-gfx

== Series Details ==

Series: drm/i915: Allow optimized platform checks
URL   : https://patchwork.freedesktop.org/series/30982/
State : success

== Summary ==

Test kms_flip:
        Subgroup flip-vs-wf_vblank-interruptible:
                fail       -> PASS       (shard-hsw)
Test perf:
        Subgroup polling:
                fail       -> PASS       (shard-hsw) fdo#102252

fdo#102252 https://bugs.freedesktop.org/show_bug.cgi?id=102252

shard-hsw        total:2429 pass:1332 dwarn:4   dfail:0   fail:10  skip:1083 time:9928s

== Logs ==

For more details see: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_5834/shards.html
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

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

* Re: [PATCH v2] drm/i915: Allow optimized platform checks
  2017-09-27 16:41 [PATCH v2] drm/i915: Allow optimized platform checks Tvrtko Ursulin
                   ` (2 preceding siblings ...)
  2017-09-27 21:25 ` ✓ Fi.CI.IGT: " Patchwork
@ 2017-09-28  7:34 ` Jani Nikula
  2017-09-29  8:59 ` Joonas Lahtinen
  4 siblings, 0 replies; 7+ messages in thread
From: Jani Nikula @ 2017-09-28  7:34 UTC (permalink / raw)
  To: Tvrtko Ursulin, Intel-gfx

On Wed, 27 Sep 2017, Tvrtko Ursulin <tursulin@ursulin.net> wrote:
> From: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
>
> If we store the platform as a bitmask, and convert the
> IS_PLATFORM macro to use it, we allow the compiler to
> merge the IS_PLATFORM(a) || IS_PLATFORM(b) || ... checks
> into a single conditional.
>
> As a secondary benefit this saves almost 1k of text:
>
>     text           data     bss     dec     hex filename
> -1460254          60014    3656 1523924  1740d4 drivers/gpu/drm/i915/i915.ko
> +1459260          60026    3656 1522942  173cfe drivers/gpu/drm/i915/i915.ko
>
> v2: Removed the infamous -1.
>
> Signed-off-by: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
> Cc: Jani Nikula <jani.nikula@intel.com>

Acked-by: Jani Nikula <jani.nikula@intel.com>

> ---
>  drivers/gpu/drm/i915/i915_drv.c | 4 ++++
>  drivers/gpu/drm/i915/i915_drv.h | 3 ++-
>  2 files changed, 6 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/gpu/drm/i915/i915_drv.c b/drivers/gpu/drm/i915/i915_drv.c
> index 03bbe23e4df8..187c0fad1b79 100644
> --- a/drivers/gpu/drm/i915/i915_drv.c
> +++ b/drivers/gpu/drm/i915/i915_drv.c
> @@ -870,6 +870,10 @@ static int i915_driver_init_early(struct drm_i915_private *dev_priv,
>  	memcpy(device_info, match_info, sizeof(*device_info));
>  	device_info->device_id = dev_priv->drm.pdev->device;
>  
> +	BUILD_BUG_ON(INTEL_MAX_PLATFORMS >
> +		     sizeof(device_info->platform_mask) * BITS_PER_BYTE);
> +	device_info->platform_mask = BIT(device_info->platform);
> +
>  	BUG_ON(device_info->gen > sizeof(device_info->gen_mask) * BITS_PER_BYTE);
>  	device_info->gen_mask = BIT(device_info->gen - 1);
>  
> diff --git a/drivers/gpu/drm/i915/i915_drv.h b/drivers/gpu/drm/i915/i915_drv.h
> index bda91db3fc46..3a6a34882427 100644
> --- a/drivers/gpu/drm/i915/i915_drv.h
> +++ b/drivers/gpu/drm/i915/i915_drv.h
> @@ -861,6 +861,7 @@ struct intel_device_info {
>  	u8 ring_mask; /* Rings supported by the HW */
>  
>  	enum intel_platform platform;
> +	u32 platform_mask;
>  
>  	u32 display_mmio_offset;
>  
> @@ -2986,7 +2987,7 @@ intel_info(const struct drm_i915_private *dev_priv)
>  #define IS_REVID(p, since, until) \
>  	(INTEL_REVID(p) >= (since) && INTEL_REVID(p) <= (until))
>  
> -#define IS_PLATFORM(dev_priv, p) ((dev_priv)->info.platform == (p))
> +#define IS_PLATFORM(dev_priv, p) ((dev_priv)->info.platform_mask & BIT(p))
>  
>  #define IS_I830(dev_priv)	IS_PLATFORM(dev_priv, INTEL_I830)
>  #define IS_I845G(dev_priv)	IS_PLATFORM(dev_priv, INTEL_I845G)

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

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

* Re: ✓ Fi.CI.BAT: success for drm/i915: Allow optimized platform checks
  2017-09-27 17:07 ` ✓ Fi.CI.BAT: success for " Patchwork
@ 2017-09-28 11:49   ` Tvrtko Ursulin
  0 siblings, 0 replies; 7+ messages in thread
From: Tvrtko Ursulin @ 2017-09-28 11:49 UTC (permalink / raw)
  To: intel-gfx, Patchwork, Tvrtko Ursulin


On 27/09/2017 18:07, Patchwork wrote:
> == Series Details ==
> 
> Series: drm/i915: Allow optimized platform checks
> URL   : https://patchwork.freedesktop.org/series/30982/
> State : success
> 
> == Summary ==
> 
> Series 30982v1 drm/i915: Allow optimized platform checks
> https://patchwork.freedesktop.org/api/1.0/series/30982/revisions/1/mbox/
> 
> Test drv_module_reload:
>          Subgroup basic-reload:
>                  dmesg-warn -> PASS       (fi-glk-1) fdo#102777
> 
> fdo#102777 https://bugs.freedesktop.org/show_bug.cgi?id=102777
> 
> fi-bdw-5557u     total:289  pass:268  dwarn:0   dfail:0   fail:0   skip:21  time:440s
> fi-bdw-gvtdvm    total:289  pass:265  dwarn:0   dfail:0   fail:0   skip:24  time:479s
> fi-blb-e6850     total:289  pass:224  dwarn:1   dfail:0   fail:0   skip:64  time:419s
> fi-bsw-n3050     total:289  pass:243  dwarn:0   dfail:0   fail:0   skip:46  time:519s
> fi-bwr-2160      total:289  pass:184  dwarn:0   dfail:0   fail:0   skip:105 time:282s
> fi-bxt-j4205     total:289  pass:260  dwarn:0   dfail:0   fail:0   skip:29  time:499s
> fi-byt-j1900     total:289  pass:254  dwarn:1   dfail:0   fail:0   skip:34  time:492s
> fi-cfl-s         total:289  pass:223  dwarn:34  dfail:0   fail:0   skip:32  time:544s
> fi-cnl-y         total:289  pass:258  dwarn:0   dfail:0   fail:4   skip:27  time:637s
> fi-elk-e7500     total:289  pass:230  dwarn:0   dfail:0   fail:0   skip:59  time:420s
> fi-glk-1         total:289  pass:260  dwarn:0   dfail:0   fail:0   skip:29  time:568s
> fi-hsw-4770      total:289  pass:263  dwarn:0   dfail:0   fail:0   skip:26  time:424s
> fi-hsw-4770r     total:289  pass:263  dwarn:0   dfail:0   fail:0   skip:26  time:405s
> fi-ilk-650       total:289  pass:229  dwarn:0   dfail:0   fail:0   skip:60  time:437s
> fi-ivb-3520m     total:289  pass:261  dwarn:0   dfail:0   fail:0   skip:28  time:493s
> fi-ivb-3770      total:289  pass:261  dwarn:0   dfail:0   fail:0   skip:28  time:468s
> fi-kbl-7500u     total:289  pass:264  dwarn:1   dfail:0   fail:0   skip:24  time:471s
> fi-kbl-7560u     total:289  pass:270  dwarn:0   dfail:0   fail:0   skip:19  time:584s
> fi-kbl-r         total:289  pass:262  dwarn:0   dfail:0   fail:0   skip:27  time:593s
> fi-pnv-d510      total:289  pass:223  dwarn:1   dfail:0   fail:0   skip:65  time:546s
> fi-skl-6260u     total:289  pass:269  dwarn:0   dfail:0   fail:0   skip:20  time:446s
> fi-skl-6700k     total:289  pass:265  dwarn:0   dfail:0   fail:0   skip:24  time:745s
> fi-skl-6770hq    total:289  pass:269  dwarn:0   dfail:0   fail:0   skip:20  time:485s
> fi-skl-gvtdvm    total:289  pass:266  dwarn:0   dfail:0   fail:0   skip:23  time:473s
> fi-snb-2520m     total:289  pass:251  dwarn:0   dfail:0   fail:0   skip:38  time:567s
> fi-snb-2600      total:289  pass:250  dwarn:0   dfail:0   fail:0   skip:39  time:410s
> 
> aa884e1abdf2ffb7db8c524fc6269280734e5145 drm-tip: 2017y-09m-27d-15h-39m-07s UTC integration manifest
> 6ef30a4343e1 drm/i915: Allow optimized platform checks

Pushed, thanks for the review and acks.

Regards,

Tvrtko

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

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

* Re: [PATCH v2] drm/i915: Allow optimized platform checks
  2017-09-27 16:41 [PATCH v2] drm/i915: Allow optimized platform checks Tvrtko Ursulin
                   ` (3 preceding siblings ...)
  2017-09-28  7:34 ` [PATCH v2] " Jani Nikula
@ 2017-09-29  8:59 ` Joonas Lahtinen
  4 siblings, 0 replies; 7+ messages in thread
From: Joonas Lahtinen @ 2017-09-29  8:59 UTC (permalink / raw)
  To: Tvrtko Ursulin, Intel-gfx; +Cc: Jani Nikula

On Wed, 2017-09-27 at 17:41 +0100, Tvrtko Ursulin wrote:
> From: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
> 
> If we store the platform as a bitmask, and convert the
> IS_PLATFORM macro to use it, we allow the compiler to
> merge the IS_PLATFORM(a) || IS_PLATFORM(b) || ... checks
> into a single conditional.
> 
> As a secondary benefit this saves almost 1k of text:
> 
>     text           data     bss     dec     hex filename
> -1460254          60014    3656 1523924  1740d4 drivers/gpu/drm/i915/i915.ko
> +1459260          60026    3656 1522942  173cfe drivers/gpu/drm/i915/i915.ko
> 
> v2: Removed the infamous -1.
> 
> Signed-off-by: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
> Cc: Jani Nikula <jani.nikula@intel.com>

<SNIP>

> @@ -2986,7 +2987,7 @@ intel_info(const struct drm_i915_private *dev_priv)
>  #define IS_REVID(p, since, until) \
>  	(INTEL_REVID(p) >= (since) && INTEL_REVID(p) <= (until))
>  
> -#define IS_PLATFORM(dev_priv, p) ((dev_priv)->info.platform == (p))
> +#define IS_PLATFORM(dev_priv, p) ((dev_priv)->info.platform_mask & BIT(p))

|| BUILD_BUG_ON_ZERO(__builtin_constant_p(p))

To enforce it?

Regards, Joonas
-- 
Joonas Lahtinen
Open Source Technology Center
Intel Corporation
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

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

end of thread, other threads:[~2017-09-29  8:59 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-09-27 16:41 [PATCH v2] drm/i915: Allow optimized platform checks Tvrtko Ursulin
2017-09-27 17:03 ` Chris Wilson
2017-09-27 17:07 ` ✓ Fi.CI.BAT: success for " Patchwork
2017-09-28 11:49   ` Tvrtko Ursulin
2017-09-27 21:25 ` ✓ Fi.CI.IGT: " Patchwork
2017-09-28  7:34 ` [PATCH v2] " Jani Nikula
2017-09-29  8:59 ` Joonas Lahtinen

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.