2019-10-07 15:44:40

by Colin King

[permalink] [raw]
Subject: [PATCH] drm/i915: make array hw_engine_mask static, makes object smaller

From: Colin Ian King <[email protected]>

Don't populate the array hw_engine_mask on the stack but instead make it
static. Makes the object code smaller by 316 bytes.

Before:
text data bss dec hex filename
34004 4388 320 38712 9738 gpu/drm/i915/gt/intel_reset.o

After:
text data bss dec hex filename
33528 4548 320 38396 95fc gpu/drm/i915/gt/intel_reset.o

(gcc version 9.2.1, amd64)

Signed-off-by: Colin Ian King <[email protected]>
---
drivers/gpu/drm/i915/gt/intel_reset.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/gpu/drm/i915/gt/intel_reset.c b/drivers/gpu/drm/i915/gt/intel_reset.c
index eeb3bd0c4d69..db58ca9bee3a 100644
--- a/drivers/gpu/drm/i915/gt/intel_reset.c
+++ b/drivers/gpu/drm/i915/gt/intel_reset.c
@@ -285,7 +285,7 @@ static int gen6_reset_engines(struct intel_gt *gt,
unsigned int retry)
{
struct intel_engine_cs *engine;
- const u32 hw_engine_mask[] = {
+ static const u32 hw_engine_mask[] = {
[RCS0] = GEN6_GRDOM_RENDER,
[BCS0] = GEN6_GRDOM_BLT,
[VCS0] = GEN6_GRDOM_MEDIA,
@@ -408,7 +408,7 @@ static int gen11_reset_engines(struct intel_gt *gt,
intel_engine_mask_t engine_mask,
unsigned int retry)
{
- const u32 hw_engine_mask[] = {
+ static const u32 hw_engine_mask[] = {
[RCS0] = GEN11_GRDOM_RENDER,
[BCS0] = GEN11_GRDOM_BLT,
[VCS0] = GEN11_GRDOM_MEDIA,
--
2.20.1


2019-10-07 16:23:37

by Chris Wilson

[permalink] [raw]
Subject: Re: [PATCH] drm/i915: make array hw_engine_mask static, makes object smaller

Quoting Colin King (2019-10-07 16:41:51)
> From: Colin Ian King <[email protected]>
>
> Don't populate the array hw_engine_mask on the stack but instead make it
> static. Makes the object code smaller by 316 bytes.
>
> Before:
> text data bss dec hex filename
> 34004 4388 320 38712 9738 gpu/drm/i915/gt/intel_reset.o
>
> After:
> text data bss dec hex filename
> 33528 4548 320 38396 95fc gpu/drm/i915/gt/intel_reset.o
>
> (gcc version 9.2.1, amd64)
>
> Signed-off-by: Colin Ian King <[email protected]>
Reviewed-by: Chris Wilson <[email protected]>
-Chris

2019-10-07 21:52:03

by Chris Wilson

[permalink] [raw]
Subject: Re: [PATCH] drm/i915: make array hw_engine_mask static, makes object smaller

Quoting Chris Wilson (2019-10-07 17:22:52)
> Quoting Colin King (2019-10-07 16:41:51)
> > From: Colin Ian King <[email protected]>
> >
> > Don't populate the array hw_engine_mask on the stack but instead make it
> > static. Makes the object code smaller by 316 bytes.
> >
> > Before:
> > text data bss dec hex filename
> > 34004 4388 320 38712 9738 gpu/drm/i915/gt/intel_reset.o
> >
> > After:
> > text data bss dec hex filename
> > 33528 4548 320 38396 95fc gpu/drm/i915/gt/intel_reset.o
> >
> > (gcc version 9.2.1, amd64)
> >
> > Signed-off-by: Colin Ian King <[email protected]>
> Reviewed-by: Chris Wilson <[email protected]>

And pushed, thanks for the patch.
-Chris