forked from torvalds/linux
Permalink
Show file tree
Hide file tree
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
drm/amd/display: Introduce FPU directory inside DC
The display core files rely on FPU operation, which requires to be compiled with special flags. Ideally, we don't want these FPU operations spread around the DC code; nevertheless, it happens in the current source. This commit introduces a new directory named fpu_operations that intends to centralize all files that require the FPU compilation flag. As part of this new component, this patch also moves one of the functions that require FPU access to a single shared file. Notice that this is the first part of the work, and it does not fix the FPU issue yet; we still need other patches for achieving the complete isolation of this file. Change since V1: - Update documentation and rebase. Signed-off-by: Rodrigo Siqueira <Rodrigo.Siqueira@amd.com>
- Loading branch information
1 parent
7fef2ed
commit 8975773a97624f08fef020c0266181cf0eb859e4
Showing
7 changed files
with
183 additions
and
39 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -37,6 +37,7 @@ DC_LIBS += dcn303 | ||
| DC_LIBS += dcn31 | ||
| endif | ||
|
|
||
| DC_LIBS += fpu_operations | ||
| DC_LIBS += dce120 | ||
|
|
||
| DC_LIBS += dce112 | ||
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,58 @@ | ||
| # SPDX-License-Identifier: MIT | ||
| # | ||
| # Copyright 2021 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. | ||
| # | ||
| # | ||
| # Makefile for fpu operations component. | ||
| # | ||
|
|
||
| FPU_OPERATIONS = dcn2x.o | ||
|
|
||
| ifdef CONFIG_X86 | ||
| fpu_ccflags := -mhard-float -msse | ||
| endif | ||
|
|
||
| ifdef CONFIG_PPC64 | ||
| fpu_ccflags := -mhard-float -maltivec | ||
| endif | ||
|
|
||
| ifdef CONFIG_CC_IS_GCC | ||
| ifeq ($(call cc-ifversion, -lt, 0701, y), y) | ||
| IS_OLD_GCC = 1 | ||
| endif | ||
| endif | ||
|
|
||
| ifdef CONFIG_X86 | ||
| ifdef IS_OLD_GCC | ||
| # Stack alignment mismatch, proceed with caution. | ||
| # GCC < 7.1 cannot compile code using `double` and -mpreferred-stack-boundary=3 | ||
| # (8B stack alignment). | ||
| fpu_ccflags := -mpreferred-stack-boundary=4 | ||
| else | ||
| fpu_ccflags := -msse2 | ||
| endif | ||
| endif | ||
|
|
||
| CFLAGS_$(AMDDALPATH)/dc/fpu_operations/dcn2x.o += $(fpu_ccflags) | ||
|
|
||
| AMD_DAL_FPU_OPERATIONS = $(addprefix $(AMDDALPATH)/dc/fpu_operations/,$(FPU_OPERATIONS)) | ||
|
|
||
| AMD_DISPLAY_FILES += $(AMD_DAL_FPU_OPERATIONS) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,87 @@ | ||
| // SPDX-License-Identifier: MIT | ||
| /* | ||
| * Copyright 2021 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 | ||
| * | ||
| */ | ||
|
|
||
| #include "resource.h" | ||
|
|
||
| /** | ||
| * DOC: DCN2x FPU manipulation Overview | ||
| * | ||
| * The DCN architecture relies on FPU operations, which require special | ||
| * compilation flags and the use of kernel_fpu_begin/end functions; ideally, we | ||
| * want to avoid spreading FPU access across multiple files. With this idea in | ||
| * mind, this file aims to centralize all DCN20 and DCN2.1 (DCN2x) functions | ||
| * that require FPU access in a single place. Code in this file follows the | ||
| * following code pattern: | ||
| * | ||
| * 1. Functions that use FPU operations should be isolated in static functions. | ||
| * 2. The FPU functions should have the noinline attribute to ensure anything | ||
| * that deals with FP register is contained within this call. | ||
| * 3. All function that needs to be accessed outside this file requires a | ||
| * public interface that not uses any FPU reference. | ||
| */ | ||
|
|
||
| static noinline void _dcn20_populate_dml_writeback_from_context(struct dc *dc, | ||
| struct resource_context *res_ctx, display_e2e_pipe_params_st *pipes) | ||
| { | ||
| int pipe_cnt, i; | ||
|
|
||
| for (i = 0, pipe_cnt = 0; i < dc->res_pool->pipe_count; i++) { | ||
| struct dc_writeback_info *wb_info = &res_ctx->pipe_ctx[i].stream->writeback_info[0]; | ||
|
|
||
| if (!res_ctx->pipe_ctx[i].stream) | ||
| continue; | ||
|
|
||
| /* Set writeback information */ | ||
| pipes[pipe_cnt].dout.wb_enable = (wb_info->wb_enabled == true) ? 1 : 0; | ||
| pipes[pipe_cnt].dout.num_active_wb++; | ||
| pipes[pipe_cnt].dout.wb.wb_src_height = wb_info->dwb_params.cnv_params.crop_height; | ||
| pipes[pipe_cnt].dout.wb.wb_src_width = wb_info->dwb_params.cnv_params.crop_width; | ||
| pipes[pipe_cnt].dout.wb.wb_dst_width = wb_info->dwb_params.dest_width; | ||
| pipes[pipe_cnt].dout.wb.wb_dst_height = wb_info->dwb_params.dest_height; | ||
| pipes[pipe_cnt].dout.wb.wb_htaps_luma = 1; | ||
| pipes[pipe_cnt].dout.wb.wb_vtaps_luma = 1; | ||
| pipes[pipe_cnt].dout.wb.wb_htaps_chroma = wb_info->dwb_params.scaler_taps.h_taps_c; | ||
| pipes[pipe_cnt].dout.wb.wb_vtaps_chroma = wb_info->dwb_params.scaler_taps.v_taps_c; | ||
| pipes[pipe_cnt].dout.wb.wb_hratio = 1.0; | ||
| pipes[pipe_cnt].dout.wb.wb_vratio = 1.0; | ||
| if (wb_info->dwb_params.out_format == dwb_scaler_mode_yuv420) { | ||
| if (wb_info->dwb_params.output_depth == DWB_OUTPUT_PIXEL_DEPTH_8BPC) | ||
| pipes[pipe_cnt].dout.wb.wb_pixel_format = dm_420_8; | ||
| else | ||
| pipes[pipe_cnt].dout.wb.wb_pixel_format = dm_420_10; | ||
| } else { | ||
| pipes[pipe_cnt].dout.wb.wb_pixel_format = dm_444_32; | ||
| } | ||
|
|
||
| pipe_cnt++; | ||
| } | ||
| } | ||
|
|
||
| void dcn20_populate_dml_writeback_from_context(struct dc *dc, | ||
| struct resource_context *res_ctx, display_e2e_pipe_params_st *pipes) | ||
| { | ||
| _dcn20_populate_dml_writeback_from_context(dc, res_ctx, pipes); | ||
| } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,33 @@ | ||
| /* SPDX-License-Identifier: MIT */ | ||
| /* | ||
| * Copyright 2021 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 __DCN2X_H__ | ||
| #define __DCN2X_H__ | ||
|
|
||
| void dcn20_populate_dml_writeback_from_context(struct dc *dc, | ||
| struct resource_context *res_ctx, display_e2e_pipe_params_st *pipes); | ||
|
|
||
| #endif /* __DCN2X_H__ */ |