]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
drm/amd/display: Move dml2_validate to the non-FPU dml2_wrapper
authorHarry Wentland <harry.wentland@amd.com>
Thu, 30 Oct 2025 18:26:57 +0000 (14:26 -0400)
committerAlex Deucher <alexander.deucher@amd.com>
Mon, 8 Dec 2025 18:56:37 +0000 (13:56 -0500)
[WHAT]
It calls DC_FP_START/END and shouldn't be living inside an
FPU compilation unit.

Reviewed-by: Austin Zheng <austin.zheng@amd.com>
Signed-off-by: Harry Wentland <harry.wentland@amd.com>
Signed-off-by: Alex Hung <alex.hung@amd.com>
Tested-by: Dan Wheeler <daniel.wheeler@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
drivers/gpu/drm/amd/display/dc/dml2_0/Makefile
drivers/gpu/drm/amd/display/dc/dml2_0/dml2_wrapper.c [new file with mode: 0644]
drivers/gpu/drm/amd/display/dc/dml2_0/dml2_wrapper.h
drivers/gpu/drm/amd/display/dc/dml2_0/dml2_wrapper_fpu.c

index a112931007b10d3fd57d6f8521db71d72be0c4bc..631ea04059a8849dbfc456ac3e7e2d4ddb464173 100644 (file)
@@ -73,7 +73,7 @@ CFLAGS_REMOVE_$(AMDDALPATH)/dc/dml2_0/dml2_mall_phantom.o := $(dml2_rcflags)
 CFLAGS_REMOVE_$(AMDDALPATH)/dc/dml2_0/dml_display_rq_dlg_calc.o := $(dml2_rcflags)
 CFLAGS_REMOVE_$(AMDDALPATH)/dc/dml2_0/dml2_dc_resource_mgmt.o := $(dml2_rcflags)
 
-DML2 = display_mode_core.o display_mode_util.o dml2_wrapper_fpu.o \
+DML2 = display_mode_core.o display_mode_util.o dml2_wrapper_fpu.o dml2_wrapper.o \
                dml2_utils.o dml2_policy.o dml2_translation_helper.o dml2_dc_resource_mgmt.o dml2_mall_phantom.o \
                dml_display_rq_dlg_calc.o
 
diff --git a/drivers/gpu/drm/amd/display/dc/dml2_0/dml2_wrapper.c b/drivers/gpu/drm/amd/display/dc/dml2_0/dml2_wrapper.c
new file mode 100644 (file)
index 0000000..b665bd4
--- /dev/null
@@ -0,0 +1,36 @@
+// SPDX-License-Identifier: MIT
+/*
+ * Copyright 2025 Advanced Micro Devices, Inc.
+ *
+ * Authors: AMD
+ */
+
+#include "dml2_internal_types.h"
+
+bool dml2_validate(const struct dc *in_dc, struct dc_state *context, struct dml2_context *dml2,
+       enum dc_validate_mode validate_mode)
+{
+       bool out = false;
+
+       if (!dml2)
+               return false;
+       dml2_apply_debug_options(in_dc, dml2);
+
+       /* DML2.1 validation path */
+       if (dml2->architecture == dml2_architecture_21) {
+               out = dml21_validate(in_dc, context, dml2, validate_mode);
+               return out;
+       }
+
+       DC_FP_START();
+
+       /* Use dml_validate_only for DC_VALIDATE_MODE_ONLY and DC_VALIDATE_MODE_AND_STATE_INDEX path */
+       if (validate_mode != DC_VALIDATE_MODE_AND_PROGRAMMING)
+               out = dml2_validate_only(context, validate_mode);
+       else
+               out = dml2_validate_and_build_resource(in_dc, context, validate_mode);
+
+       DC_FP_END();
+
+       return out;
+}
index c384e141cebc8f750ca7451ca5b5016780a1598f..ee6051737204c4d7f58b72d3127c8bd5fd92cc4f 100644 (file)
@@ -306,4 +306,11 @@ bool dml2_validate(const struct dc *in_dc,
 void dml2_extract_dram_and_fclk_change_support(struct dml2_context *dml2,
        unsigned int *fclk_change_support, unsigned int *dram_clk_change_support);
 void dml2_prepare_mcache_programming(struct dc *in_dc, struct dc_state *context, struct dml2_context *dml2);
+
+void dml2_apply_debug_options(const struct dc *dc, struct dml2_context *dml2);
+bool dml2_validate_only(struct dc_state *context, enum dc_validate_mode validate_mode);
+bool dml2_validate_and_build_resource(const struct dc *in_dc, struct dc_state *context,
+               enum dc_validate_mode validate_mode);
+
 #endif //_DML2_WRAPPER_H_
+
index 9deb03a18ccc8326ead109392e260ef4c5a4e008..e1a41bf5e546b364cac08bb745d3d8fa66fcfda3 100644 (file)
@@ -395,7 +395,7 @@ static bool call_dml_mode_support_and_programming(struct dc_state *context, enum
        return result;
 }
 
-static bool dml2_validate_and_build_resource(const struct dc *in_dc, struct dc_state *context,
+bool dml2_validate_and_build_resource(const struct dc *in_dc, struct dc_state *context,
                enum dc_validate_mode validate_mode)
 {
        struct dml2_context *dml2 = context->bw_ctx.dml2;
@@ -505,7 +505,7 @@ static bool dml2_validate_and_build_resource(const struct dc *in_dc, struct dc_s
        return result;
 }
 
-static bool dml2_validate_only(struct dc_state *context, enum dc_validate_mode validate_mode)
+bool dml2_validate_only(struct dc_state *context, enum dc_validate_mode validate_mode)
 {
        struct dml2_context *dml2;
        unsigned int result = 0;
@@ -538,41 +538,13 @@ static bool dml2_validate_only(struct dc_state *context, enum dc_validate_mode v
        return result == 1;
 }
 
-static void dml2_apply_debug_options(const struct dc *dc, struct dml2_context *dml2)
+void dml2_apply_debug_options(const struct dc *dc, struct dml2_context *dml2)
 {
        if (dc->debug.override_odm_optimization) {
                dml2->config.minimize_dispclk_using_odm = dc->debug.minimize_dispclk_using_odm;
        }
 }
 
-bool dml2_validate(const struct dc *in_dc, struct dc_state *context, struct dml2_context *dml2,
-       enum dc_validate_mode validate_mode)
-{
-       bool out = false;
-
-       if (!dml2)
-               return false;
-       dml2_apply_debug_options(in_dc, dml2);
-
-       /* DML2.1 validation path */
-       if (dml2->architecture == dml2_architecture_21) {
-               out = dml21_validate(in_dc, context, dml2, validate_mode);
-               return out;
-       }
-
-       DC_FP_START();
-
-       /* Use dml_validate_only for DC_VALIDATE_MODE_ONLY and DC_VALIDATE_MODE_AND_STATE_INDEX path */
-       if (validate_mode != DC_VALIDATE_MODE_AND_PROGRAMMING)
-               out = dml2_validate_only(context, validate_mode);
-       else
-               out = dml2_validate_and_build_resource(in_dc, context, validate_mode);
-
-       DC_FP_END();
-
-       return out;
-}
-
 static inline struct dml2_context *dml2_allocate_memory(void)
 {
        return (struct dml2_context *) vzalloc(sizeof(struct dml2_context));