@@ -1875,19 +1875,57 @@ static bool init_soc_bounding_box(struct dc *dc,
1875
1875
return true;
1876
1876
}
1877
1877
1878
- bool dcn30_build_params_mpc_split (struct pipe_ctx * primary_pipe )
1878
+ static bool dcn30_split_stream_for_mpc_or_odm (
1879
+ const struct dc * dc ,
1880
+ struct resource_context * res_ctx ,
1881
+ struct pipe_ctx * pri_pipe ,
1882
+ struct pipe_ctx * sec_pipe ,
1883
+ bool odm )
1879
1884
{
1880
- struct pipe_ctx * current_pipe = primary_pipe ;
1885
+ int pipe_idx = sec_pipe -> pipe_idx ;
1886
+ const struct resource_pool * pool = dc -> res_pool ;
1887
+
1888
+ * sec_pipe = * pri_pipe ;
1889
+
1890
+ sec_pipe -> pipe_idx = pipe_idx ;
1891
+ sec_pipe -> plane_res .mi = pool -> mis [pipe_idx ];
1892
+ sec_pipe -> plane_res .hubp = pool -> hubps [pipe_idx ];
1893
+ sec_pipe -> plane_res .ipp = pool -> ipps [pipe_idx ];
1894
+ sec_pipe -> plane_res .xfm = pool -> transforms [pipe_idx ];
1895
+ sec_pipe -> plane_res .dpp = pool -> dpps [pipe_idx ];
1896
+ sec_pipe -> plane_res .mpcc_inst = pool -> dpps [pipe_idx ]-> inst ;
1897
+ sec_pipe -> stream_res .dsc = NULL ;
1898
+ if (odm ) {
1899
+ if (pri_pipe -> next_odm_pipe ) {
1900
+ ASSERT (pri_pipe -> next_odm_pipe != sec_pipe );
1901
+ sec_pipe -> next_odm_pipe = pri_pipe -> next_odm_pipe ;
1902
+ sec_pipe -> next_odm_pipe -> prev_odm_pipe = sec_pipe ;
1903
+ }
1904
+ pri_pipe -> next_odm_pipe = sec_pipe ;
1905
+ sec_pipe -> prev_odm_pipe = pri_pipe ;
1906
+ ASSERT (sec_pipe -> top_pipe == NULL );
1907
+
1908
+ sec_pipe -> stream_res .opp = pool -> opps [pipe_idx ];
1909
+ if (sec_pipe -> stream -> timing .flags .DSC == 1 ) {
1910
+ dcn20_acquire_dsc (dc , res_ctx , & sec_pipe -> stream_res .dsc , pipe_idx );
1911
+ ASSERT (sec_pipe -> stream_res .dsc );
1912
+ if (sec_pipe -> stream_res .dsc == NULL )
1913
+ return false;
1914
+ }
1915
+ } else {
1916
+ if (pri_pipe -> bottom_pipe ) {
1917
+ ASSERT (pri_pipe -> bottom_pipe != sec_pipe );
1918
+ sec_pipe -> bottom_pipe = pri_pipe -> bottom_pipe ;
1919
+ sec_pipe -> bottom_pipe -> top_pipe = sec_pipe ;
1920
+ }
1921
+ pri_pipe -> bottom_pipe = sec_pipe ;
1922
+ sec_pipe -> top_pipe = pri_pipe ;
1881
1923
1882
- while (current_pipe ) {
1883
- if (!resource_build_scaling_params (current_pipe ))
1884
- return false;
1885
- current_pipe = current_pipe -> bottom_pipe ;
1924
+ ASSERT (pri_pipe -> plane_state );
1886
1925
}
1887
1926
1888
1927
return true;
1889
1928
}
1890
-
1891
1929
static bool dcn30_fast_validate_bw (
1892
1930
struct dc * dc ,
1893
1931
struct dc_state * context ,
@@ -1945,7 +1983,7 @@ static bool dcn30_fast_validate_bw(
1945
1983
continue ;
1946
1984
1947
1985
/* We only support full screen mpo with ODM */
1948
- if (vba -> ODMCombineEnabled [pipe_idx ] != dm_odm_combine_mode_disabled
1986
+ if (vba -> ODMCombineEnabled [vba -> pipe_plane [ pipe_idx ] ] != dm_odm_combine_mode_disabled
1949
1987
&& pipe -> plane_state && mpo_pipe
1950
1988
&& memcmp (& mpo_pipe -> plane_res .scl_data .recout ,
1951
1989
& pipe -> plane_res .scl_data .recout ,
@@ -1966,10 +2004,13 @@ static bool dcn30_fast_validate_bw(
1966
2004
if (!merge [i ])
1967
2005
continue ;
1968
2006
1969
- /* if ODM merge we ignore mpc tree, mpo pipes will have their own flags
1970
- */
2007
+ /* if ODM merge we ignore mpc tree, mpo pipes will have their own flags */
1971
2008
if (pipe -> prev_odm_pipe ) {
1972
2009
/*split off odm pipe*/
2010
+ pipe -> prev_odm_pipe -> next_odm_pipe = pipe -> next_odm_pipe ;
2011
+ if (pipe -> next_odm_pipe )
2012
+ pipe -> next_odm_pipe -> prev_odm_pipe = pipe -> prev_odm_pipe ;
2013
+
1973
2014
pipe -> bottom_pipe = NULL ;
1974
2015
pipe -> next_odm_pipe = NULL ;
1975
2016
pipe -> plane_state = NULL ;
@@ -1980,15 +2021,11 @@ static bool dcn30_fast_validate_bw(
1980
2021
dcn20_release_dsc (& context -> res_ctx , dc -> res_pool , & pipe -> stream_res .dsc );
1981
2022
memset (& pipe -> plane_res , 0 , sizeof (pipe -> plane_res ));
1982
2023
memset (& pipe -> stream_res , 0 , sizeof (pipe -> stream_res ));
1983
- } else if (pipe -> next_odm_pipe ) {
1984
- /*initial odm pipe*/
1985
- pipe -> next_odm_pipe = NULL ;
1986
- } else {
2024
+ } else if (pipe -> top_pipe && pipe -> top_pipe -> plane_state == pipe -> plane_state ) {
1987
2025
struct pipe_ctx * top_pipe = pipe -> top_pipe ;
1988
2026
struct pipe_ctx * bottom_pipe = pipe -> bottom_pipe ;
1989
2027
1990
- if (top_pipe )
1991
- top_pipe -> bottom_pipe = bottom_pipe ;
2028
+ top_pipe -> bottom_pipe = bottom_pipe ;
1992
2029
if (bottom_pipe )
1993
2030
bottom_pipe -> top_pipe = top_pipe ;
1994
2031
@@ -1998,141 +2035,77 @@ static bool dcn30_fast_validate_bw(
1998
2035
pipe -> stream = NULL ;
1999
2036
memset (& pipe -> plane_res , 0 , sizeof (pipe -> plane_res ));
2000
2037
memset (& pipe -> stream_res , 0 , sizeof (pipe -> stream_res ));
2001
- }
2038
+ } else
2039
+ ASSERT (0 ); /* Should never try to merge master pipe */
2002
2040
2003
2041
}
2004
2042
2005
- for (i = 0 ; i < dc -> res_pool -> pipe_count ; i ++ ) {
2006
- struct pipe_ctx * pipe = & context -> res_ctx .pipe_ctx [i ];
2007
-
2008
- if (pipe -> plane_state ) {
2009
- if (!resource_build_scaling_params (pipe ))
2010
- goto validate_fail ;
2011
- }
2012
- }
2013
-
2014
2043
for (i = 0 , pipe_idx = -1 ; i < dc -> res_pool -> pipe_count ; i ++ ) {
2015
2044
struct pipe_ctx * pipe = & context -> res_ctx .pipe_ctx [i ];
2016
2045
struct pipe_ctx * hsplit_pipe = NULL ;
2046
+ bool odm ;
2017
2047
2018
2048
if (!pipe -> stream || newly_split [i ])
2019
2049
continue ;
2020
2050
2021
2051
pipe_idx ++ ;
2052
+ odm = vba -> ODMCombineEnabled [vba -> pipe_plane [pipe_idx ]] != dm_odm_combine_mode_disabled ;
2022
2053
2023
- if (!pipe -> top_pipe && !pipe -> plane_state && split [i ] != 0
2024
- && vba -> ODMCombineEnabled [pipe_idx ] != dm_odm_combine_mode_disabled ) {
2054
+ if (!pipe -> plane_state && !odm )
2055
+ continue ;
2056
+
2057
+ if (split [i ]) {
2025
2058
hsplit_pipe = find_idle_secondary_pipe (& context -> res_ctx , dc -> res_pool , pipe );
2026
2059
ASSERT (hsplit_pipe );
2027
2060
if (!hsplit_pipe )
2028
2061
goto validate_fail ;
2029
- if (!dcn20_split_stream_for_odm (
2062
+
2063
+ if (!dcn30_split_stream_for_mpc_or_odm (
2030
2064
dc , & context -> res_ctx ,
2031
- pipe , hsplit_pipe ))
2065
+ pipe , hsplit_pipe , odm ))
2032
2066
goto validate_fail ;
2067
+
2033
2068
newly_split [hsplit_pipe -> pipe_idx ] = true;
2034
- if (vba -> ODMCombineEnabled [pipe_idx ] == dm_odm_combine_mode_4to1 ) {
2035
- struct pipe_ctx * pipe_4to1 = find_idle_secondary_pipe (& context -> res_ctx , dc -> res_pool , pipe );
2036
-
2037
- ASSERT (pipe_4to1 );
2038
- if (!dcn20_split_stream_for_odm (
2039
- dc , & context -> res_ctx ,
2040
- pipe , pipe_4to1 ))
2041
- goto validate_fail ;
2042
- newly_split [pipe_4to1 -> pipe_idx ] = true;
2043
-
2044
- pipe_4to1 = find_idle_secondary_pipe (& context -> res_ctx , dc -> res_pool , pipe );
2045
- ASSERT (pipe_4to1 );
2046
- if (!dcn20_split_stream_for_odm (
2047
- dc , & context -> res_ctx ,
2048
- hsplit_pipe , pipe_4to1 ))
2049
- goto validate_fail ;
2050
- newly_split [pipe_4to1 -> pipe_idx ] = true;
2051
- }
2052
- dcn20_build_mapped_resource (dc , context , pipe -> stream );
2053
2069
repopulate_pipes = true;
2054
2070
}
2071
+ if (split [i ] == 4 ) {
2072
+ struct pipe_ctx * pipe_4to1 = find_idle_secondary_pipe (& context -> res_ctx , dc -> res_pool , pipe );
2055
2073
2056
- if (!pipe -> plane_state )
2057
- continue ;
2058
-
2059
- if (split [i ] == 2 ) {
2060
- hsplit_pipe = find_idle_secondary_pipe (& context -> res_ctx , dc -> res_pool , pipe );
2061
- ASSERT (hsplit_pipe );
2062
- if (!hsplit_pipe )
2074
+ ASSERT (pipe_4to1 );
2075
+ if (!pipe_4to1 )
2063
2076
goto validate_fail ;
2077
+ if (!dcn30_split_stream_for_mpc_or_odm (
2078
+ dc , & context -> res_ctx ,
2079
+ pipe , pipe_4to1 , odm ))
2080
+ goto validate_fail ;
2081
+ newly_split [pipe_4to1 -> pipe_idx ] = true;
2064
2082
2065
- if (vba -> ODMCombineEnabled [pipe_idx ] != dm_odm_combine_mode_disabled ) {
2066
- if (!dcn20_split_stream_for_odm (
2067
- dc , & context -> res_ctx ,
2068
- pipe , hsplit_pipe ))
2069
- goto validate_fail ;
2070
- if (vba -> ODMCombineEnabled [pipe_idx ] == dm_odm_combine_mode_4to1 ) {
2071
- struct pipe_ctx * pipe_4to1 = find_idle_secondary_pipe (& context -> res_ctx , dc -> res_pool , pipe );
2072
-
2073
- ASSERT (pipe_4to1 );
2074
- if (!pipe_4to1 )
2075
- goto validate_fail ;
2076
- if (!dcn20_split_stream_for_odm (
2077
- dc , & context -> res_ctx ,
2078
- pipe , pipe_4to1 ))
2079
- goto validate_fail ;
2080
- newly_split [pipe_4to1 -> pipe_idx ] = true;
2081
-
2082
- pipe_4to1 = find_idle_secondary_pipe (& context -> res_ctx , dc -> res_pool , pipe );
2083
- ASSERT (pipe_4to1 );
2084
- if (!pipe_4to1 )
2085
- goto validate_fail ;
2086
- if (!dcn20_split_stream_for_odm (
2087
- dc , & context -> res_ctx ,
2088
- hsplit_pipe , pipe_4to1 ))
2089
- goto validate_fail ;
2090
- newly_split [pipe_4to1 -> pipe_idx ] = true;
2091
- }
2092
- dcn20_build_mapped_resource (dc , context , pipe -> stream );
2093
- } else {
2094
- /* Going from 2 pipe split to 4 pipe split case */
2095
- if (dcn20_find_previous_split_count (pipe ) == 2 ) {
2096
- dcn20_split_stream_for_mpc (
2097
- & context -> res_ctx , dc -> res_pool ,
2098
- pipe , hsplit_pipe );
2099
- newly_split [hsplit_pipe -> pipe_idx ] = true;
2100
- hsplit_pipe = find_idle_secondary_pipe (& context -> res_ctx , dc -> res_pool , pipe );
2101
- dcn20_split_stream_for_mpc (
2102
- & context -> res_ctx , dc -> res_pool ,
2103
- pipe , hsplit_pipe );
2104
- if (!dcn30_build_params_mpc_split (pipe ))
2105
- goto validate_fail ;
2106
- } else {
2107
- dcn20_split_stream_for_mpc (
2108
- & context -> res_ctx , dc -> res_pool ,
2109
- pipe , hsplit_pipe );
2110
- if (!resource_build_scaling_params (pipe ) || !resource_build_scaling_params (hsplit_pipe ))
2111
- goto validate_fail ;
2112
- }
2113
- }
2114
- newly_split [hsplit_pipe -> pipe_idx ] = true;
2115
- repopulate_pipes = true;
2083
+ pipe_4to1 = find_idle_secondary_pipe (& context -> res_ctx , dc -> res_pool , pipe );
2084
+ ASSERT (pipe_4to1 );
2085
+ if (!pipe_4to1 )
2086
+ goto validate_fail ;
2087
+ if (!dcn30_split_stream_for_mpc_or_odm (
2088
+ dc , & context -> res_ctx ,
2089
+ hsplit_pipe , pipe_4to1 , odm ))
2090
+ goto validate_fail ;
2091
+ newly_split [pipe_4to1 -> pipe_idx ] = true;
2116
2092
}
2117
- if (split [i ] == 4 ) {
2118
- struct pipe_ctx * pipe_4to1 ;
2093
+ if (odm )
2094
+ dcn20_build_mapped_resource (dc , context , pipe -> stream );
2095
+ }
2119
2096
2120
- hsplit_pipe = find_idle_secondary_pipe (& context -> res_ctx , dc -> res_pool , pipe );
2121
- for (i = 0 ; i < 3 ; i ++ ) {
2122
- pipe_4to1 = find_idle_secondary_pipe (& context -> res_ctx , dc -> res_pool , pipe );
2123
- ASSERT (pipe_4to1 );
2124
- dcn20_split_stream_for_mpc (& context -> res_ctx , dc -> res_pool , pipe , pipe_4to1 );
2125
- newly_split [pipe_4to1 -> pipe_idx ] = true;
2126
- }
2127
- if (!dcn30_build_params_mpc_split (pipe ))
2097
+ for (i = 0 ; i < dc -> res_pool -> pipe_count ; i ++ ) {
2098
+ struct pipe_ctx * pipe = & context -> res_ctx .pipe_ctx [i ];
2099
+
2100
+ if (pipe -> plane_state ) {
2101
+ if (!resource_build_scaling_params (pipe ))
2128
2102
goto validate_fail ;
2129
- repopulate_pipes = true;
2130
2103
}
2131
2104
}
2105
+
2132
2106
/* Actual dsc count per stream dsc validation*/
2133
2107
if (!dcn20_validate_dsc (dc , context )) {
2134
- context -> bw_ctx .dml .vba .ValidationStatus [context -> bw_ctx .dml .vba .soc .num_states ] =
2135
- DML_FAIL_DSC_VALIDATION_FAILURE ;
2108
+ vba -> ValidationStatus [vba -> soc .num_states ] = DML_FAIL_DSC_VALIDATION_FAILURE ;
2136
2109
goto validate_fail ;
2137
2110
}
2138
2111
0 commit comments