Commit 69249b47 authored by Harry Wentland's avatar Harry Wentland Committed by Alex Deucher
Browse files

drm/amd/display: Move dml2_validate to the non-FPU dml2_wrapper



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

Reviewed-by: default avatarAustin Zheng <austin.zheng@amd.com>
Signed-off-by: default avatarHarry Wentland <harry.wentland@amd.com>
Signed-off-by: default avatarAlex Hung <alex.hung@amd.com>
Tested-by: default avatarDan Wheeler <daniel.wheeler@amd.com>
Signed-off-by: default avatarAlex Deucher <alexander.deucher@amd.com>
parent 20f311b6
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -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

+36 −0
Original line number Diff line number Diff line
// 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;
}
+7 −0
Original line number Diff line number Diff line
@@ -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_
+3 −31
Original line number Diff line number Diff line
@@ -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));