drm/amd/display/dc: Refactor remove duplications
Subsystems (3)
RFC PATCH 1/1 drm/amd/display/dc: Refactor remove duplications
From: LipArcanjo <[email protected]>
All dce command_table_helper's shares a copy-pasted collection of copy-pasted functions, which are: phy_id_to_atom, clock_source_id_to_atom_phy_clk_src_id, and engine_bp_to_atom.
This patch removes the multiple copy-pasted by creating a common command table and make the command_table_helper's calls the functions implemented by the common instead.
The changes were not tested on actual hardware. I am only able to verify that the changes keep the code compileable.
--- drivers/gpu/drm/amd/display/dc/bios/Makefile | 6 + .../bios/dce110/command_table_helper_dce110.c | 104 +------------- .../dce112/command_table_helper2_dce112.c | 104 +------------- .../bios/dce112/command_table_helper_dce112.c | 104 +------------- .../bios/dce60/command_table_helper_dce60.c | 106 +------------- .../bios/dce80/command_table_helper_dce80.c | 106 +------------- .../command_table_helper_dce_common.c | 133 ++++++++++++++++++ .../command_table_helper_dce_common.h | 37 +++++ 8 files changed, 183 insertions(+), 517 deletions(-) create mode 100644 drivers/gpu/drm/amd/display/dc/bios/dce_common/command_table_helper_dce_common.c create mode 100644 drivers/gpu/drm/amd/display/dc/bios/dce_common/command_table_helper_dce_common.h
drivers/gpu/drm/amd/display/dc/bios/Makefile +6 -0
@@ -27,6 +27,7 @@ BIOS = bios_parser.o bios_parser_interface.o bios_parser_helper.o command_table BIOS += command_table2.o command_table_helper2.o bios_parser2.o + AMD_DAL_BIOS = $(addprefix $(AMDDALPATH)/dc/bios/,$(BIOS)) AMD_DISPLAY_FILES += $(AMD_DAL_BIOS)
@@ -55,3 +56,8 @@ AMD_DISPLAY_FILES += $(AMDDALPATH)/dc/bios/dce110/command_table_helper_dce110.o AMD_DISPLAY_FILES += $(AMDDALPATH)/dc/bios/dce112/command_table_helper_dce112.o AMD_DISPLAY_FILES += $(AMDDALPATH)/dc/bios/dce112/command_table_helper2_dce112.o + +############################################################################### +# DCE COMMON +############################################################################### +AMD_DISPLAY_FILES += $(AMDDALPATH)/dc/bios/dce_common/command_table_helper_dce_common.o
drivers/gpu/drm/amd/display/dc/bios/dce110/command_table_helper_dce110.c +1 -103
122 lines not on this page · raw message
drivers/gpu/drm/amd/display/dc/bios/dce112/command_table_helper2_dce112.c +1 -103
122 lines not on this page · raw message
drivers/gpu/drm/amd/display/dc/bios/dce112/command_table_helper_dce112.c +1 -103
122 lines not on this page · raw message
drivers/gpu/drm/amd/display/dc/bios/dce60/command_table_helper_dce60.c +2 -104
130 lines not on this page · raw message
drivers/gpu/drm/amd/display/dc/bios/dce80/command_table_helper_dce80.c +2 -104
130 lines not on this page · raw message
drivers/gpu/drm/amd/display/dc/bios/dce_common/command_table_helper_dce_common.c new file +133 -0
133 lines not on this page · raw message
drivers/gpu/drm/amd/display/dc/bios/dce_common/command_table_helper_dce_common.h new file +37 -0
@@ -0,0 +1,37 @@ +/* +* Copyright 2012-15 Advanced Micro Devices, Inc. +* +* Permission is hereby granted, free of charge, to any person obtaining a +* copy of this software and associated documentation files (the "Software"), +* to deal in the Software without restriction, including without limitation +* the rights to use, copy, modify, merge, publish, distribute, sublicense, +* and/or sell copies of the Software, and to permit persons to whom the +* Software is furnished to do so, subject to the following conditions: +* +* The above copyright notice and this permission notice shall be included in +* all copies or substantial portions of the Software. +* +* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL +* THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR +* OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, +* ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR +* OTHER DEALINGS IN THE SOFTWARE. +* +* Authors: AMD +* +*/ + +#ifndef __DAL_COMMAND_TABLE_HELPER_DCE_COMMON_H__ +#define __DAL_COMMAND_TABLE_HELPER_DCE_COMMON_H__ + + +uint8_t phy_id_to_atom (enum transmitter t); + +uint8_t clock_source_id_to_atom_phy_clk_src_id ( +enum clock_source_id id); + +bool engine_bp_to_atom (enum engine_id id,uint32_t *atom_engine_id); + +#endif
Signature · 1 line
2.43.0