* [PATCH] drm/amdgpu/display: make various arrays static, makes object smaller
@ 2019-10-07 21:58 Colin King
2019-10-08 13:56 ` Harry Wentland
0 siblings, 1 reply; 4+ messages in thread
From: Colin King @ 2019-10-07 21:58 UTC (permalink / raw)
To: Harry Wentland, Leo Li, Alex Deucher, Christian König,
David Zhou, David Airlie, Daniel Vetter, amd-gfx, dri-devel
Cc: kernel-janitors, linux-kernel
From: Colin Ian King <colin.king@canonical.com>
Don't populate the arrays on the stack but instead make them
static. Makes the object code smaller by 158 bytes.
Before:
text data bss dec hex filename
32468 2072 0 34540 86ec display/dc/bios/bios_parser.o
22198 1088 0 23286 5af6 display/dc/bios/bios_parser2.o
22278 1076 0 23354 5b3a display/dc/dce/dce_mem_input.o
81180
After:
text data bss dec hex filename
32341 2136 0 34477 86ad display/dc/bios/bios_parser.o
22070 1184 0 23254 5ad6 display/dc/bios/bios_parser2.o
22119 1172 0 23291 5afb display/dc/dce/dce_mem_input.o
(gcc version 9.2.1, amd64)
Signed-off-by: Colin Ian King <colin.king@canonical.com>
---
drivers/gpu/drm/amd/display/dc/bios/bios_parser.c | 2 +-
drivers/gpu/drm/amd/display/dc/bios/bios_parser2.c | 2 +-
drivers/gpu/drm/amd/display/dc/dce/dce_mem_input.c | 2 +-
3 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/drivers/gpu/drm/amd/display/dc/bios/bios_parser.c b/drivers/gpu/drm/amd/display/dc/bios/bios_parser.c
index 221e0f56389f..65ab225cf542 100644
--- a/drivers/gpu/drm/amd/display/dc/bios/bios_parser.c
+++ b/drivers/gpu/drm/amd/display/dc/bios/bios_parser.c
@@ -2745,7 +2745,7 @@ static enum bp_result bios_get_board_layout_info(
struct bios_parser *bp;
enum bp_result record_result;
- const unsigned int slot_index_to_vbios_id[MAX_BOARD_SLOTS] = {
+ static const unsigned int slot_index_to_vbios_id[MAX_BOARD_SLOTS] = {
GENERICOBJECT_BRACKET_LAYOUT_ENUM_ID1,
GENERICOBJECT_BRACKET_LAYOUT_ENUM_ID2,
0, 0
diff --git a/drivers/gpu/drm/amd/display/dc/bios/bios_parser2.c b/drivers/gpu/drm/amd/display/dc/bios/bios_parser2.c
index dff65c0fe82f..809c4a89b899 100644
--- a/drivers/gpu/drm/amd/display/dc/bios/bios_parser2.c
+++ b/drivers/gpu/drm/amd/display/dc/bios/bios_parser2.c
@@ -1832,7 +1832,7 @@ static enum bp_result bios_get_board_layout_info(
struct bios_parser *bp;
enum bp_result record_result;
- const unsigned int slot_index_to_vbios_id[MAX_BOARD_SLOTS] = {
+ static const unsigned int slot_index_to_vbios_id[MAX_BOARD_SLOTS] = {
GENERICOBJECT_BRACKET_LAYOUT_ENUM_ID1,
GENERICOBJECT_BRACKET_LAYOUT_ENUM_ID2,
0, 0
diff --git a/drivers/gpu/drm/amd/display/dc/dce/dce_mem_input.c b/drivers/gpu/drm/amd/display/dc/dce/dce_mem_input.c
index 8aa937f496c4..ed0031d5e021 100644
--- a/drivers/gpu/drm/amd/display/dc/dce/dce_mem_input.c
+++ b/drivers/gpu/drm/amd/display/dc/dce/dce_mem_input.c
@@ -395,7 +395,7 @@ static void program_size_and_rotation(
{
const struct rect *in_rect = &plane_size->surface_size;
struct rect hw_rect = plane_size->surface_size;
- const uint32_t rotation_angles[ROTATION_ANGLE_COUNT] = {
+ static const uint32_t rotation_angles[ROTATION_ANGLE_COUNT] = {
[ROTATION_ANGLE_0] = 0,
[ROTATION_ANGLE_90] = 1,
[ROTATION_ANGLE_180] = 2,
--
2.20.1
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH] drm/amdgpu/display: make various arrays static, makes object smaller
2019-10-07 21:58 [PATCH] drm/amdgpu/display: make various arrays static, makes object smaller Colin King
@ 2019-10-08 13:56 ` Harry Wentland
2019-10-08 14:00 ` Joe Perches
0 siblings, 1 reply; 4+ messages in thread
From: Harry Wentland @ 2019-10-08 13:56 UTC (permalink / raw)
To: Colin King, Wentland, Harry, Li, Sun peng (Leo),
Deucher, Alexander, Koenig, Christian, Zhou, David(ChunMing),
David Airlie, Daniel Vetter, amd-gfx, dri-devel
Cc: kernel-janitors, linux-kernel
On 2019-10-07 5:58 p.m., Colin King wrote:
> From: Colin Ian King <colin.king@canonical.com>
>
> Don't populate the arrays on the stack but instead make them
> static. Makes the object code smaller by 158 bytes.
>
> Before:
> text data bss dec hex filename
> 32468 2072 0 34540 86ec display/dc/bios/bios_parser.o
> 22198 1088 0 23286 5af6 display/dc/bios/bios_parser2.o
> 22278 1076 0 23354 5b3a display/dc/dce/dce_mem_input.o
>
> 81180
> After:
> text data bss dec hex filename
> 32341 2136 0 34477 86ad display/dc/bios/bios_parser.o
> 22070 1184 0 23254 5ad6 display/dc/bios/bios_parser2.o
> 22119 1172 0 23291 5afb display/dc/dce/dce_mem_input.o
>
> (gcc version 9.2.1, amd64)
>
> Signed-off-by: Colin Ian King <colin.king@canonical.com>
> ---
> drivers/gpu/drm/amd/display/dc/bios/bios_parser.c | 2 +-
> drivers/gpu/drm/amd/display/dc/bios/bios_parser2.c | 2 +-
> drivers/gpu/drm/amd/display/dc/dce/dce_mem_input.c | 2 +-
> 3 files changed, 3 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/gpu/drm/amd/display/dc/bios/bios_parser.c b/drivers/gpu/drm/amd/display/dc/bios/bios_parser.c
> index 221e0f56389f..65ab225cf542 100644
> --- a/drivers/gpu/drm/amd/display/dc/bios/bios_parser.c
> +++ b/drivers/gpu/drm/amd/display/dc/bios/bios_parser.c
> @@ -2745,7 +2745,7 @@ static enum bp_result bios_get_board_layout_info(
> struct bios_parser *bp;
> enum bp_result record_result;
>
> - const unsigned int slot_index_to_vbios_id[MAX_BOARD_SLOTS] = {
> + static const unsigned int slot_index_to_vbios_id[MAX_BOARD_SLOTS] = {
Won't this break the multi-GPU case where you'll have multiple driver
instances with different layout?
Harry
> GENERICOBJECT_BRACKET_LAYOUT_ENUM_ID1,
> GENERICOBJECT_BRACKET_LAYOUT_ENUM_ID2,
> 0, 0
> diff --git a/drivers/gpu/drm/amd/display/dc/bios/bios_parser2.c b/drivers/gpu/drm/amd/display/dc/bios/bios_parser2.c
> index dff65c0fe82f..809c4a89b899 100644
> --- a/drivers/gpu/drm/amd/display/dc/bios/bios_parser2.c
> +++ b/drivers/gpu/drm/amd/display/dc/bios/bios_parser2.c
> @@ -1832,7 +1832,7 @@ static enum bp_result bios_get_board_layout_info(
> struct bios_parser *bp;
> enum bp_result record_result;
>
> - const unsigned int slot_index_to_vbios_id[MAX_BOARD_SLOTS] = {
> + static const unsigned int slot_index_to_vbios_id[MAX_BOARD_SLOTS] = {
> GENERICOBJECT_BRACKET_LAYOUT_ENUM_ID1,
> GENERICOBJECT_BRACKET_LAYOUT_ENUM_ID2,
> 0, 0
> diff --git a/drivers/gpu/drm/amd/display/dc/dce/dce_mem_input.c b/drivers/gpu/drm/amd/display/dc/dce/dce_mem_input.c
> index 8aa937f496c4..ed0031d5e021 100644
> --- a/drivers/gpu/drm/amd/display/dc/dce/dce_mem_input.c
> +++ b/drivers/gpu/drm/amd/display/dc/dce/dce_mem_input.c
> @@ -395,7 +395,7 @@ static void program_size_and_rotation(
> {
> const struct rect *in_rect = &plane_size->surface_size;
> struct rect hw_rect = plane_size->surface_size;
> - const uint32_t rotation_angles[ROTATION_ANGLE_COUNT] = {
> + static const uint32_t rotation_angles[ROTATION_ANGLE_COUNT] = {
> [ROTATION_ANGLE_0] = 0,
> [ROTATION_ANGLE_90] = 1,
> [ROTATION_ANGLE_180] = 2,
>
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] drm/amdgpu/display: make various arrays static, makes object smaller
2019-10-08 13:56 ` Harry Wentland
@ 2019-10-08 14:00 ` Joe Perches
2019-10-08 14:20 ` Harry Wentland
0 siblings, 1 reply; 4+ messages in thread
From: Joe Perches @ 2019-10-08 14:00 UTC (permalink / raw)
To: Harry Wentland, Colin King, Wentland, Harry, Li, Sun peng (Leo),
Deucher, Alexander, Koenig, Christian, Zhou, David(ChunMing),
David Airlie, Daniel Vetter, amd-gfx, dri-devel
Cc: kernel-janitors, linux-kernel
On Tue, 2019-10-08 at 13:56 +0000, Harry Wentland wrote:
[]
> > diff --git a/drivers/gpu/drm/amd/display/dc/bios/bios_parser.c b/drivers/gpu/drm/amd/display/dc/bios/bios_parser.c
> []
> > @@ -2745,7 +2745,7 @@ static enum bp_result bios_get_board_layout_info(
> > struct bios_parser *bp;
> > enum bp_result record_result;
> >
> > - const unsigned int slot_index_to_vbios_id[MAX_BOARD_SLOTS] = {
> > + static const unsigned int slot_index_to_vbios_id[MAX_BOARD_SLOTS] = {
>
> Won't this break the multi-GPU case where you'll have multiple driver
> instances with different layout?
As the array is read-only, how could that happen?
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] drm/amdgpu/display: make various arrays static, makes object smaller
2019-10-08 14:00 ` Joe Perches
@ 2019-10-08 14:20 ` Harry Wentland
0 siblings, 0 replies; 4+ messages in thread
From: Harry Wentland @ 2019-10-08 14:20 UTC (permalink / raw)
To: Joe Perches, Colin King, Wentland, Harry, Li, Sun peng (Leo),
Deucher, Alexander, Koenig, Christian, Zhou, David(ChunMing),
David Airlie, Daniel Vetter, amd-gfx, dri-devel
Cc: kernel-janitors, linux-kernel
On 2019-10-08 10:00 a.m., Joe Perches wrote:
> On Tue, 2019-10-08 at 13:56 +0000, Harry Wentland wrote:
> []
>>> diff --git a/drivers/gpu/drm/amd/display/dc/bios/bios_parser.c b/drivers/gpu/drm/amd/display/dc/bios/bios_parser.c
>> []
>>> @@ -2745,7 +2745,7 @@ static enum bp_result bios_get_board_layout_info(
>>> struct bios_parser *bp;
>>> enum bp_result record_result;
>>>
>>> - const unsigned int slot_index_to_vbios_id[MAX_BOARD_SLOTS] = {
>>> + static const unsigned int slot_index_to_vbios_id[MAX_BOARD_SLOTS] = {
>>
>> Won't this break the multi-GPU case where you'll have multiple driver
>> instances with different layout?
>
> As the array is read-only, how could that happen?
>
You're right.
Patch is
Reviewed-by: Harry Wentland <harry.wentland@amd.com>
Harry
>
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2019-10-08 14:20 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-10-07 21:58 [PATCH] drm/amdgpu/display: make various arrays static, makes object smaller Colin King
2019-10-08 13:56 ` Harry Wentland
2019-10-08 14:00 ` Joe Perches
2019-10-08 14:20 ` Harry Wentland
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).