xref: /linux/drivers/gpu/drm/amd/display/dc/dml2_0/dml21/src/dml2_core/dml2_core_factory.c (revision e6a8a000cfe6a1106c17ab4a47eb6dd21596968c)
1 // SPDX-License-Identifier: MIT
2 //
3 // Copyright 2024 Advanced Micro Devices, Inc.
4 
5 #include "dml2_core_factory.h"
6 #include "dml2_core_dcn4.h"
7 #include "dml2_external_lib_deps.h"
8 
dml2_core_create(enum dml2_project_id project_id,struct dml2_core_instance * out)9 bool dml2_core_create(enum dml2_project_id project_id, struct dml2_core_instance *out)
10 {
11 	bool result = false;
12 
13 	if (!out)
14 		return false;
15 
16 	memset(out, 0, sizeof(struct dml2_core_instance));
17 
18 	out->project_id = project_id;
19 
20 	switch (project_id) {
21 	case dml2_project_dcn4x_stage1:
22 		result = false;
23 		break;
24 	case dml2_project_dcn4x_stage2:
25 	case dml2_project_dcn4x_stage2_auto_drr_svp:
26 		out->initialize = &core_dcn4_initialize;
27 		out->mode_support = &core_dcn4_mode_support;
28 		out->mode_programming = &core_dcn4_mode_programming;
29 		out->populate_informative = &core_dcn4_populate_informative;
30 		out->calculate_mcache_allocation = &core_dcn4_calculate_mcache_allocation;
31 		result = true;
32 		break;
33 	case dml2_project_invalid:
34 	default:
35 		break;
36 	}
37 
38 	return result;
39 }
40