amdgpu/dc/dml: Consolidate redundant CFLAGS
PATCH v2 1/2 amdgpu/dc/dml: Consolidate redundant CFLAGS
Use subdir-ccflags instead of specifying the same flags for every source file.
---
Changes in v2:
- added 'Reviewed-by: Guenter Roeck <[email protected]>' tag
drivers/gpu/drm/amd/display/dc/dml/Makefile | 10 +--------- 1 file changed, 1 insertion(+), 9 deletions(-)
drivers/gpu/drm/amd/display/dc/dml/Makefile +1 -9
@@ -24,15 +24,7 @@ # It provides the general basic services required by other DAL # subcomponents. -CFLAGS_display_mode_vba.o := -mhard-float -msse -mpreferred-stack-boundary=4 -CFLAGS_display_mode_lib.o := -mhard-float -msse -mpreferred-stack-boundary=4 -CFLAGS_display_pipe_clocks.o := -mhard-float -msse -mpreferred-stack-boundary=4 -CFLAGS_display_rq_dlg_calc.o := -mhard-float -msse -mpreferred-stack-boundary=4 -CFLAGS_dml1_display_rq_dlg_calc.o := -mhard-float -msse -mpreferred-stack-boundary=4 -CFLAGS_display_rq_dlg_helpers.o := -mhard-float -msse -mpreferred-stack-boundary=4 -CFLAGS_soc_bounding_box.o := -mhard-float -msse -mpreferred-stack-boundary=4 -CFLAGS_dml_common_defs.o := -mhard-float -msse -mpreferred-stack-boundary=4 - +subdir-ccflags-y += -mhard-float -msse -mpreferred-stack-boundary=4 DML = display_mode_lib.o display_rq_dlg_calc.o \ display_rq_dlg_helpers.o dml1_display_rq_dlg_calc.o \
Signature · 6 lines
2.16.0.rc1.238.g530d649a79-goog _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
PATCH v2 2/2 amdgpu/dc/dml: Support clang option for stack alignment
DML uses the compiler option -mpreferred-stack-boundary=4 to configure a stack alignment of 16 bytes. Clang uses the option -mstack-alignment instead, which expects as parameter the alignment in bytes, and not a power of two like -mpreferred-stack-boundary.
Probe for both compiler options and use the correct one, similar to what is done in arch/x86/Makefile.
---
Changes in v2:
- use consistent syntax and formatting for assignment of cc_stack_align
drivers/gpu/drm/amd/display/dc/dml/Makefile | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-)
drivers/gpu/drm/amd/display/dc/dml/Makefile +7 -1
@@ -24,7 +24,13 @@ # It provides the general basic services required by other DAL # subcomponents. -subdir-ccflags-y += -mhard-float -msse -mpreferred-stack-boundary=4 +ifneq ($(call cc-option, -mpreferred-stack-boundary=4),) + cc_stack_align := -mpreferred-stack-boundary=4 +else ifneq ($(call cc-option, -mstack-alignment=16),) + cc_stack_align := -mstack-alignment=16 +endif + +subdir-ccflags-y += -mhard-float -msse $(cc_stack_align) DML = display_mode_lib.o display_rq_dlg_calc.o \ display_rq_dlg_helpers.o dml1_display_rq_dlg_calc.o \
Signature · 6 lines
2.16.0.rc1.238.g530d649a79-goog _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
Re: [PATCH v2 2/2] amdgpu/dc/dml: Support clang option for stack alignment
Quoted 10 lines · Matthias Kaehlcke
DML uses the compiler option -mpreferred-stack-boundary=4 to configure a stack alignment of 16 bytes. Clang uses the option -mstack-alignment instead, which expects as parameter the alignment in bytes, and not a power of two like -mpreferred-stack-boundary.
Probe for both compiler options and use the correct one, similar to what is done in
arch/x86/Makefile.Reported-by Guenter Roeck <[email protected]>Signed-off-by Matthias Kaehlcke <[email protected]>
Guenter
Quoted 29 lines
---
Changes in v2:
- use consistent syntax and formatting for assignment ofcc_stack_aligndrivers/gpu/drm/amd/display/dc/dml/Makefile | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-)drivers/gpu/drm/amd/display/dc/dml/Makefile +7
-2@@ -24,7 +24,13 @@ # It provides the general basic services required by other DAL # subcomponents. -subdir-ccflags-y += -mhard-float -msse -mpreferred-stack-boundary=4 +ifneq ($(call cc-option, -mpreferred-stack-boundary=4),) + cc_stack_align := -mpreferred-stack-boundary=4 +else ifneq ($(call cc-option, -mstack-alignment=16),) + cc_stack_align := -mstack-alignment=16 +endif + +subdir-ccflags-y += -mhard-float -msse $(cc_stack_align) DML = display_mode_lib.o display_rq_dlg_calc.o \ display_rq_dlg_helpers.o dml1_display_rq_dlg_calc.o \ --2.16.0.rc1.238.g530d649a79-goog
Harry Wentland
maintainerQuoted 20 lines · Matthias Kaehlcke
Use subdir-ccflags instead of specifying the same flags for every source file.
Signed-off-by Matthias Kaehlcke <[email protected]>Reviewed-by Guenter Roeck <[email protected]>---
Changes in v2:
- added 'Reviewed-by: Guenter Roeck <[email protected]>' tagdrivers/gpu/drm/amd/display/dc/dml/Makefile | 10 +--------- 1 file changed, 1 insertion(+), 9 deletions(-)drivers/gpu/drm/amd/display/dc/dml/Makefile +0
-0@@ -24,15 +24,7 @@ # It provides the general basic services required by other DAL # subcomponents.
drivers/gpu/drm/amd/display/dc/dml/Makefile line 27
Quoted 10 lines
drivers/gpu/drm/amd/display/dc/dml/Makefile +1
-9-CFLAGS_display_mode_vba.o := -mhard-float -msse -mpreferred-stack-boundary=4 -CFLAGS_display_mode_lib.o := -mhard-float -msse -mpreferred-stack-boundary=4 -CFLAGS_display_pipe_clocks.o := -mhard-float -msse -mpreferred-stack-boundary=4 -CFLAGS_display_rq_dlg_calc.o := -mhard-float -msse -mpreferred-stack-boundary=4 -CFLAGS_dml1_display_rq_dlg_calc.o := -mhard-float -msse -mpreferred-stack-boundary=4 -CFLAGS_display_rq_dlg_helpers.o := -mhard-float -msse -mpreferred-stack-boundary=4 -CFLAGS_soc_bounding_box.o := -mhard-float -msse -mpreferred-stack-boundary=4 -CFLAGS_dml_common_defs.o := -mhard-float -msse -mpreferred-stack-boundary=4 - +subdir-ccflags-y += -mhard-float -msse -mpreferred-stack-boundary=4
Are you sure this will only apply to dc/dml?
The way the amdgpu build is setup I've seen this flag apply to all of amdgpu, even if specified in a subdirectories build file. The reason being that amdgpu/Makefile recursively includes all other Makefiles in the module.
According to kbuild/makefiles.txt this will have effect for the kbuild file where it's present and all subdirectories:
https://www.kernel.org/doc/Documentation/kbuild/makefiles.txt:
Quoted 9 lines
drivers/gpu/drm/amd/display/dc/dml/Makefile +0
-0subdir-ccflags-y, subdir-asflags-y The two flags listed above are similar to ccflags-y and asflags-y. The difference is that the subdir- variants have effect for the kbuildfile where they are present and all subdirectories. Options specified using subdir-* are added to the commandline before the options specified using the non-subdir variants.
Example:
subdir-ccflags-y := -Werror
For your 2nd patch you probably want to make a dml_cflags variable that's set different for clang and gcc, and then still set it for all files in DML individually.
You'll probably also have to do the same for dc/calcs/Makefile.
Thanks for finding a good solution for supporting clang. It's been on my list but I haven't had time to find the right flag yet.
Harry
Quoted 4 lines
DML = display_mode_lib.o display_rq_dlg_calc.o \
display_rq_dlg_helpers.o dml1_display_rq_dlg_calc.o \
_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
El Thu, Feb 08, 2018 at 09:33:53AM -0500 Harry Wentland ha dit:
Quoted 34 lines · Matthias Kaehlcke
Quoted 20 lines
Use subdir-ccflags instead of specifying the same flags for every source file.
Signed-off-by Matthias Kaehlcke <[email protected]>Reviewed-by Guenter Roeck <[email protected]>---
Changes in v2:
- added 'Reviewed-by: Guenter Roeck <[email protected]>' tagdrivers/gpu/drm/amd/display/dc/dml/Makefile | 10 +--------- 1 file changed, 1 insertion(+), 9 deletions(-)drivers/gpu/drm/amd/display/dc/dml/Makefile +0
-0@@ -24,15 +24,7 @@ # It provides the general basic services required by other DAL # subcomponents.drivers/gpu/drm/amd/display/dc/dml/Makefile line 27
Quoted 10 lines
drivers/gpu/drm/amd/display/dc/dml/Makefile +1
-9-CFLAGS_display_mode_vba.o := -mhard-float -msse -mpreferred-stack-boundary=4 -CFLAGS_display_mode_lib.o := -mhard-float -msse -mpreferred-stack-boundary=4 -CFLAGS_display_pipe_clocks.o := -mhard-float -msse -mpreferred-stack-boundary=4 -CFLAGS_display_rq_dlg_calc.o := -mhard-float -msse -mpreferred-stack-boundary=4 -CFLAGS_dml1_display_rq_dlg_calc.o := -mhard-float -msse -mpreferred-stack-boundary=4 -CFLAGS_display_rq_dlg_helpers.o := -mhard-float -msse -mpreferred-stack-boundary=4 -CFLAGS_soc_bounding_box.o := -mhard-float -msse -mpreferred-stack-boundary=4 -CFLAGS_dml_common_defs.o := -mhard-float -msse -mpreferred-stack-boundary=4 - +subdir-ccflags-y += -mhard-float -msse -mpreferred-stack-boundary=4Are you sure this will only apply to dc/dml?
Quoted 14 lines
The way the amdgpu build is setup I've seen this flag apply to all of amdgpu, even if specified in a subdirectories build file. The reason being that amdgpu/Makefile recursively includes all other Makefiles in the module.
According to
kbuild/makefiles.txtthis will have effect for the kbuild file where it's present and all subdirectories:https://www.kernel.org/doc/Documentation/kbuild/makefiles.txt:
Quoted 9 lines
drivers/gpu/drm/amd/display/dc/dml/Makefile +0
-0subdir-ccflags-y, subdir-asflags-y The two flags listed above are similar to ccflags-y and asflags-y. The difference is that the subdir- variants have effect for the kbuildfile where they are present and all subdirectories. Options specified using subdir-* are added to the commandline before the options specified using the non-subdir variants.
Example:
subdir-ccflags-y := -Werror
Thanks, I didn't realize the recursive inclusion from amdgpu/Makefile, in this case using subdir-ccflags-y indeed isn't a good idea.
Quoted 3 lines
For your 2nd patch you probably want to make a
dml_cflagsvariable that's set different for clang and gcc, and then still set it for all files in DML individually.
Yep, that was my first impulse and then I remembered subdir-ccflags-y. Will go back to that.
Quoted 1 line
You'll probably also have to do the same for dc/calcs/Makefile.
Thanks for the heads up!