drm/amd/display: Add fast_validate parameter
authorJoshua Aberback <joshua.aberback@amd.com>
Mon, 1 Apr 2019 19:18:29 +0000 (15:18 -0400)
committerAlex Deucher <alexander.deucher@amd.com>
Mon, 15 Apr 2019 05:22:11 +0000 (00:22 -0500)
Add a fast_validate parameter in dc_validate_global_state for future use

Signed-off-by: Joshua Aberback <joshua.aberback@amd.com>
Reviewed-by: Tony Cheng <Tony.Cheng@amd.com>
Acked-by: Bhawanpreet Lakha <Bhawanpreet Lakha@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
drivers/gpu/drm/amd/display/dc/calcs/dcn_calcs.c
drivers/gpu/drm/amd/display/dc/core/dc_resource.c
drivers/gpu/drm/amd/display/dc/dc.h
drivers/gpu/drm/amd/display/dc/dce100/dce100_resource.c
drivers/gpu/drm/amd/display/dc/dce110/dce110_resource.c
drivers/gpu/drm/amd/display/dc/dce112/dce112_resource.c
drivers/gpu/drm/amd/display/dc/dce112/dce112_resource.h
drivers/gpu/drm/amd/display/dc/dce80/dce80_resource.c
drivers/gpu/drm/amd/display/dc/inc/core_types.h
drivers/gpu/drm/amd/display/dc/inc/dcn_calcs.h

index 42e643c9b6bc89f127eb34a2219ada60ab04aba2..054681113d7109338697cd3263b47c14ac5f5ad6 100644 (file)
@@ -6647,7 +6647,7 @@ static int amdgpu_dm_atomic_check(struct drm_device *dev,
                if (ret)
                        goto fail;
 
-               if (dc_validate_global_state(dc, dm_state->context) != DC_OK) {
+               if (dc_validate_global_state(dc, dm_state->context, false) != DC_OK) {
                        ret = -EINVAL;
                        goto fail;
                }
index 8843361e842d5b06befc3972382436ea60bf418a..d7aece82e4fe78bc480cdfcfdede2ef7b644ad23 100644 (file)
@@ -701,7 +701,8 @@ static void hack_bounding_box(struct dcn_bw_internal_vars *v,
 
 bool dcn_validate_bandwidth(
                struct dc *dc,
-               struct dc_state *context)
+               struct dc_state *context,
+               bool fast_validate)
 {
        const struct resource_pool *pool = dc->res_pool;
        struct dcn_bw_internal_vars *v = &context->dcn_bw_vars;
@@ -1013,8 +1014,9 @@ bool dcn_validate_bandwidth(
                mode_support_and_system_configuration(v);
        }
 
-       if (v->voltage_level != 5) {
+       if (v->voltage_level != number_of_states_plus_one && !fast_validate) {
                float bw_consumed = v->total_bandwidth_consumed_gbyte_per_second;
+
                if (bw_consumed < v->fabric_and_dram_bandwidth_vmin0p65)
                        bw_consumed = v->fabric_and_dram_bandwidth_vmin0p65;
                else if (bw_consumed < v->fabric_and_dram_bandwidth_vmid0p72)
index 3830e6ce13558bac96d34bd684c40c19eacfe5bd..eac7186e4f0841fdb771dd722b59dc7e819afb16 100644 (file)
@@ -2067,12 +2067,14 @@ void dc_resource_state_construct(
  * Checks HW resource availability and bandwidth requirement.
  * @dc: dc struct for this driver
  * @new_ctx: state to be validated
+ * @fast_validate: set to true if only yes/no to support matters
  *
  * Return: DC_OK if the result can be programmed.  Otherwise, an error code.
  */
 enum dc_status dc_validate_global_state(
                struct dc *dc,
-               struct dc_state *new_ctx)
+               struct dc_state *new_ctx,
+               bool fast_validate)
 {
        enum dc_status result = DC_ERROR_UNEXPECTED;
        int i, j;
@@ -2127,7 +2129,7 @@ enum dc_status dc_validate_global_state(
        result = resource_build_scaling_params_for_context(dc, new_ctx);
 
        if (result == DC_OK)
-               if (!dc->res_pool->funcs->validate_bandwidth(dc, new_ctx))
+               if (!dc->res_pool->funcs->validate_bandwidth(dc, new_ctx, fast_validate))
                        result = DC_FAIL_BANDWIDTH_VALIDATE;
 
        return result;
index c0b1defde65ee2fb2ecb02c90931c932a6038a83..978ce365b4a7d174fae5a8ad2ad304e70aaa79f2 100644 (file)
@@ -658,9 +658,14 @@ enum dc_status dc_validate_plane(struct dc *dc, const struct dc_plane_state *pla
 
 void get_clock_requirements_for_state(struct dc_state *state, struct AsicStateEx *info);
 
+/*
+ * fast_validate: we return after determining if we can support the new state,
+ * but before we populate the programming info
+ */
 enum dc_status dc_validate_global_state(
                struct dc *dc,
-               struct dc_state *new_ctx);
+               struct dc_state *new_ctx,
+               bool fast_validate);
 
 
 void dc_resource_state_construct(
index f38ea29b33771db39d15bb2783a5873b3b31b4e7..e938bf9986d38fa4e2e91243a1d93363d8407ccc 100644 (file)
@@ -778,7 +778,8 @@ static enum dc_status build_mapped_resource(
 
 bool dce100_validate_bandwidth(
        struct dc  *dc,
-       struct dc_state *context)
+       struct dc_state *context,
+       bool fast_validate)
 {
        int i;
        bool at_least_one_pipe = false;
index d5ebc453871185cd9d832a2d325969f054519ccd..dcd04e9ea76bda85bc44db181cbf62ae163966c6 100644 (file)
@@ -903,7 +903,8 @@ static enum dc_status build_mapped_resource(
 
 static bool dce110_validate_bandwidth(
        struct dc *dc,
-       struct dc_state *context)
+       struct dc_state *context,
+       bool fast_validate)
 {
        bool result = false;
 
index afbc82b87982cd78ded19a9f4b63aaf1e530e85c..a480b15f688591603dc5ad0212cfa8603232b019 100644 (file)
@@ -826,7 +826,8 @@ static enum dc_status build_mapped_resource(
 
 bool dce112_validate_bandwidth(
        struct dc *dc,
-       struct dc_state *context)
+       struct dc_state *context,
+       bool fast_validate)
 {
        bool result = false;
 
index 95a4033962196e96995069b202102ca9450c412a..1f57ebc6f9b440f69c0d778eb6735aad2b3085dd 100644 (file)
@@ -44,7 +44,8 @@ enum dc_status dce112_validate_with_context(
 
 bool dce112_validate_bandwidth(
        struct dc *dc,
-       struct dc_state *context);
+       struct dc_state *context,
+       bool fast_validate);
 
 enum dc_status dce112_add_stream_to_ctx(
                struct dc *dc,
index 9569f3af12a3eb9074debd512312a9aa33a88f0f..27d0cc39496386a15db49e334c8c17919af58b02 100644 (file)
@@ -812,7 +812,8 @@ static void destruct(struct dce110_resource_pool *pool)
 
 bool dce80_validate_bandwidth(
        struct dc *dc,
-       struct dc_state *context)
+       struct dc_state *context,
+       bool fast_validate)
 {
        int i;
        bool at_least_one_pipe = false;
index 827541e34ee2a97343cd08dd9f6975fd2382e7b4..88a82a23d259087e27a795b1eb470ee5c2339765 100644 (file)
@@ -97,7 +97,8 @@ struct resource_funcs {
                        const struct encoder_init_data *init);
        bool (*validate_bandwidth)(
                                        struct dc *dc,
-                                       struct dc_state *context);
+                                       struct dc_state *context,
+                                       bool fast_validate);
 
        enum dc_status (*validate_global)(
                struct dc *dc,
index 86ec3f69c7652ac06bfca24e53a36a09d2368fad..263c09630c06dcc96e3c2a2e21e8e34971d23ed9 100644 (file)
@@ -621,7 +621,8 @@ extern const struct dcn_ip_params dcn10_ip_defaults;
 
 bool dcn_validate_bandwidth(
                struct dc *dc,
-               struct dc_state *context);
+               struct dc_state *context,
+               bool fast_validate);
 
 unsigned int dcn_find_dcfclk_suits_all(
        const struct dc *dc,