From: Harry Wentland <[email protected]>

[WHAT]
It calls DC_FP_START/END and shouldn't be living inside an
FPU compilation unit.

Reviewed-by: Austin Zheng <[email protected]>
Signed-off-by: Harry Wentland <[email protected]>
Signed-off-by: Alex Hung <[email protected]>
---
 .../gpu/drm/amd/display/dc/dml2_0/Makefile    |  2 +-
 .../drm/amd/display/dc/dml2_0/dml2_wrapper.c  | 36 +++++++++++++++++++
 .../drm/amd/display/dc/dml2_0/dml2_wrapper.h  |  7 ++++
 .../amd/display/dc/dml2_0/dml2_wrapper_fpu.c  | 34 ++----------------
 4 files changed, 47 insertions(+), 32 deletions(-)
 create mode 100644 drivers/gpu/drm/amd/display/dc/dml2_0/dml2_wrapper.c

diff --git a/drivers/gpu/drm/amd/display/dc/dml2_0/Makefile 
b/drivers/gpu/drm/amd/display/dc/dml2_0/Makefile
index a112931007b1..631ea04059a8 100644
--- a/drivers/gpu/drm/amd/display/dc/dml2_0/Makefile
+++ b/drivers/gpu/drm/amd/display/dc/dml2_0/Makefile
@@ -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
index 000000000000..b665bd4569a5
--- /dev/null
+++ b/drivers/gpu/drm/amd/display/dc/dml2_0/dml2_wrapper.c
@@ -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;
+}
diff --git a/drivers/gpu/drm/amd/display/dc/dml2_0/dml2_wrapper.h 
b/drivers/gpu/drm/amd/display/dc/dml2_0/dml2_wrapper.h
index c384e141cebc..ee6051737204 100644
--- a/drivers/gpu/drm/amd/display/dc/dml2_0/dml2_wrapper.h
+++ b/drivers/gpu/drm/amd/display/dc/dml2_0/dml2_wrapper.h
@@ -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_
+
diff --git a/drivers/gpu/drm/amd/display/dc/dml2_0/dml2_wrapper_fpu.c 
b/drivers/gpu/drm/amd/display/dc/dml2_0/dml2_wrapper_fpu.c
index 9deb03a18ccc..e1a41bf5e546 100644
--- a/drivers/gpu/drm/amd/display/dc/dml2_0/dml2_wrapper_fpu.c
+++ b/drivers/gpu/drm/amd/display/dc/dml2_0/dml2_wrapper_fpu.c
@@ -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));
-- 
2.43.0

Reply via email to