drm/amd/display: Pass init_data into DCN resource creation
authorHarry Wentland <harry.wentland@amd.com>
Wed, 13 Feb 2019 21:20:27 +0000 (16:20 -0500)
committerAlex Deucher <alexander.deucher@amd.com>
Thu, 28 Mar 2019 03:41:40 +0000 (22:41 -0500)
[WHY]
The resource constructor currently needs num_virtual_links from
init_data but will need access to other items provided by DM.

[HOW]
Pass init_data into DCN create_resource_pool functions.

Signed-off-by: Harry Wentland <harry.wentland@amd.com>
Reviewed-by: Nicholas Kazlauskas <Nicholas.Kazlauskas@amd.com>
Acked-by: Bhawanpreet Lakha <Bhawanpreet.Lakha@amd.com>
Acked-by: Hersen Wu <hersenxs.wu@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
drivers/gpu/drm/amd/display/dc/core/dc.c
drivers/gpu/drm/amd/display/dc/core/dc_resource.c
drivers/gpu/drm/amd/display/dc/dcn10/dcn10_resource.c
drivers/gpu/drm/amd/display/dc/dcn10/dcn10_resource.h
drivers/gpu/drm/amd/display/dc/inc/resource.h

index 699e1ee750359436e937a95a1e519f3221ab8a2f..c7415772e2808a1f178efe14d278e5fafd7e7718 100644 (file)
@@ -735,11 +735,7 @@ static bool construct(struct dc *dc,
                goto fail;
        }
 
-       dc->res_pool = dc_create_resource_pool(
-                       dc,
-                       init_params->num_virtual_links,
-                       dc_version,
-                       init_params->asic_id);
+       dc->res_pool = dc_create_resource_pool(dc, init_params, dc_version);
        if (!dc->res_pool)
                goto fail;
 
index 4a651d7dd0522c9487543e973cbbe82aa81fca9c..42ef04230ea2aacf4966ccd32a85ed9ef95cad6d 100644 (file)
@@ -106,44 +106,43 @@ enum dce_version resource_parse_asic_id(struct hw_asic_id asic_id)
        return dc_version;
 }
 
-struct resource_pool *dc_create_resource_pool(
-                               struct dc  *dc,
-                               int num_virtual_links,
-                               enum dce_version dc_version,
-                               struct hw_asic_id asic_id)
+struct resource_pool *dc_create_resource_pool(struct dc  *dc,
+                                             const struct dc_init_data *init_data,
+                                             enum dce_version dc_version)
 {
        struct resource_pool *res_pool = NULL;
 
        switch (dc_version) {
        case DCE_VERSION_8_0:
                res_pool = dce80_create_resource_pool(
-                       num_virtual_links, dc);
+                               init_data->num_virtual_links, dc);
                break;
        case DCE_VERSION_8_1:
                res_pool = dce81_create_resource_pool(
-                       num_virtual_links, dc);
+                               init_data->num_virtual_links, dc);
                break;
        case DCE_VERSION_8_3:
                res_pool = dce83_create_resource_pool(
-                       num_virtual_links, dc);
+                               init_data->num_virtual_links, dc);
                break;
        case DCE_VERSION_10_0:
                res_pool = dce100_create_resource_pool(
-                               num_virtual_links, dc);
+                               init_data->num_virtual_links, dc);
                break;
        case DCE_VERSION_11_0:
                res_pool = dce110_create_resource_pool(
-                       num_virtual_links, dc, asic_id);
+                               init_data->num_virtual_links, dc,
+                               init_data->asic_id);
                break;
        case DCE_VERSION_11_2:
        case DCE_VERSION_11_22:
                res_pool = dce112_create_resource_pool(
-                       num_virtual_links, dc);
+                               init_data->num_virtual_links, dc);
                break;
        case DCE_VERSION_12_0:
        case DCE_VERSION_12_1:
                res_pool = dce120_create_resource_pool(
-                       num_virtual_links, dc);
+                               init_data->num_virtual_links, dc);
                break;
 
 #if defined(CONFIG_DRM_AMD_DC_DCN1_0)
@@ -151,8 +150,7 @@ struct resource_pool *dc_create_resource_pool(
 #if defined(CONFIG_DRM_AMD_DC_DCN1_01)
        case DCN_VERSION_1_01:
 #endif
-               res_pool = dcn10_create_resource_pool(
-                               num_virtual_links, dc);
+               res_pool = dcn10_create_resource_pool(init_data, dc);
                break;
 #endif
 
index 29f8893e44b61c6a083e16c7c45c0ad92b9086f6..7c37836bb9cc0796c82fbe91ab3d43c271e80f44 100644 (file)
@@ -1528,7 +1528,7 @@ fail:
 }
 
 struct resource_pool *dcn10_create_resource_pool(
-               uint8_t num_virtual_links,
+               const struct dc_init_data *init_data,
                struct dc *dc)
 {
        struct dcn10_resource_pool *pool =
@@ -1537,7 +1537,7 @@ struct resource_pool *dcn10_create_resource_pool(
        if (!pool)
                return NULL;
 
-       if (construct(num_virtual_links, dc, pool))
+       if (construct(init_data->num_virtual_links, dc, pool))
                return &pool->base;
 
        BREAK_TO_DEBUGGER();
index 8f71225bc61bb4f2b58123b98e38ef40f90bf86e..999c684a0b3671b3049bb4b117c02834b2a72d5f 100644 (file)
@@ -39,7 +39,7 @@ struct dcn10_resource_pool {
        struct resource_pool base;
 };
 struct resource_pool *dcn10_create_resource_pool(
-               uint8_t num_virtual_links,
+               const struct dc_init_data *init_data,
                struct dc *dc);
 
 
index 028c63061767659d2fc6195514cb23d0a13731c1..0a70254d204f8f33bc25490e3a88218fd28217f4 100644 (file)
@@ -70,11 +70,9 @@ bool resource_construct(
        struct resource_pool *pool,
        const struct resource_create_funcs *create_funcs);
 
-struct resource_pool *dc_create_resource_pool(
-                               struct dc *dc,
-                               int num_virtual_links,
-                               enum dce_version dc_version,
-                               struct hw_asic_id asic_id);
+struct resource_pool *dc_create_resource_pool(struct dc  *dc,
+                                             const struct dc_init_data *init_data,
+                                             enum dce_version dc_version);
 
 void dc_destroy_resource_pool(struct dc *dc);