aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--drivers/gpu/drm/amd/display/dc/core/dc_resource.c46
-rw-r--r--drivers/gpu/drm/amd/display/dc/dce110/dce110_hw_sequencer.c4
-rw-r--r--drivers/gpu/drm/amd/display/dc/inc/resource.h5
3 files changed, 40 insertions, 15 deletions
diff --git a/drivers/gpu/drm/amd/display/dc/core/dc_resource.c b/drivers/gpu/drm/amd/display/dc/core/dc_resource.c
index 964ba1af7b07..1644f2a946b0 100644
--- a/drivers/gpu/drm/amd/display/dc/core/dc_resource.c
+++ b/drivers/gpu/drm/amd/display/dc/core/dc_resource.c
@@ -268,24 +268,30 @@ bool resource_construct(
268 268
269 return true; 269 return true;
270} 270}
271static int find_matching_clock_source(
272 const struct resource_pool *pool,
273 struct clock_source *clock_source)
274{
275
276 int i;
271 277
278 for (i = 0; i < pool->clk_src_count; i++) {
279 if (pool->clock_sources[i] == clock_source)
280 return i;
281 }
282 return -1;
283}
272 284
273void resource_unreference_clock_source( 285void resource_unreference_clock_source(
274 struct resource_context *res_ctx, 286 struct resource_context *res_ctx,
275 const struct resource_pool *pool, 287 const struct resource_pool *pool,
276 struct clock_source *clock_source) 288 struct clock_source *clock_source)
277{ 289{
278 int i; 290 int i = find_matching_clock_source(pool, clock_source);
279
280 for (i = 0; i < pool->clk_src_count; i++) {
281 if (pool->clock_sources[i] != clock_source)
282 continue;
283 291
292 if (i > -1)
284 res_ctx->clock_source_ref_count[i]--; 293 res_ctx->clock_source_ref_count[i]--;
285 294
286 break;
287 }
288
289 if (pool->dp_clock_source == clock_source) 295 if (pool->dp_clock_source == clock_source)
290 res_ctx->dp_clock_source_ref_count--; 296 res_ctx->dp_clock_source_ref_count--;
291} 297}
@@ -295,19 +301,31 @@ void resource_reference_clock_source(
295 const struct resource_pool *pool, 301 const struct resource_pool *pool,
296 struct clock_source *clock_source) 302 struct clock_source *clock_source)
297{ 303{
298 int i; 304 int i = find_matching_clock_source(pool, clock_source);
299 for (i = 0; i < pool->clk_src_count; i++) {
300 if (pool->clock_sources[i] != clock_source)
301 continue;
302 305
306 if (i > -1)
303 res_ctx->clock_source_ref_count[i]++; 307 res_ctx->clock_source_ref_count[i]++;
304 break;
305 }
306 308
307 if (pool->dp_clock_source == clock_source) 309 if (pool->dp_clock_source == clock_source)
308 res_ctx->dp_clock_source_ref_count++; 310 res_ctx->dp_clock_source_ref_count++;
309} 311}
310 312
313int resource_get_clock_source_reference(
314 struct resource_context *res_ctx,
315 const struct resource_pool *pool,
316 struct clock_source *clock_source)
317{
318 int i = find_matching_clock_source(pool, clock_source);
319
320 if (i > -1)
321 return res_ctx->clock_source_ref_count[i];
322
323 if (pool->dp_clock_source == clock_source)
324 return res_ctx->dp_clock_source_ref_count;
325
326 return -1;
327}
328
311bool resource_are_streams_timing_synchronizable( 329bool resource_are_streams_timing_synchronizable(
312 struct dc_stream_state *stream1, 330 struct dc_stream_state *stream1,
313 struct dc_stream_state *stream2) 331 struct dc_stream_state *stream2)
diff --git a/drivers/gpu/drm/amd/display/dc/dce110/dce110_hw_sequencer.c b/drivers/gpu/drm/amd/display/dc/dce110/dce110_hw_sequencer.c
index 1d98e3678b04..5450d4d38e8a 100644
--- a/drivers/gpu/drm/amd/display/dc/dce110/dce110_hw_sequencer.c
+++ b/drivers/gpu/drm/amd/display/dc/dce110/dce110_hw_sequencer.c
@@ -1908,7 +1908,9 @@ static void dce110_reset_hw_ctx_wrap(
1908 pipe_ctx_old->plane_res.mi->funcs->free_mem_input( 1908 pipe_ctx_old->plane_res.mi->funcs->free_mem_input(
1909 pipe_ctx_old->plane_res.mi, dc->current_state->stream_count); 1909 pipe_ctx_old->plane_res.mi, dc->current_state->stream_count);
1910 1910
1911 if (old_clk) 1911 if (old_clk && 0 == resource_get_clock_source_reference(&context->res_ctx,
1912 dc->res_pool,
1913 old_clk))
1912 old_clk->funcs->cs_power_down(old_clk); 1914 old_clk->funcs->cs_power_down(old_clk);
1913 1915
1914 dc->hwss.disable_plane(dc, pipe_ctx_old); 1916 dc->hwss.disable_plane(dc, pipe_ctx_old);
diff --git a/drivers/gpu/drm/amd/display/dc/inc/resource.h b/drivers/gpu/drm/amd/display/dc/inc/resource.h
index e92facbd038f..5b321008b0b5 100644
--- a/drivers/gpu/drm/amd/display/dc/inc/resource.h
+++ b/drivers/gpu/drm/amd/display/dc/inc/resource.h
@@ -103,6 +103,11 @@ void resource_reference_clock_source(
103 const struct resource_pool *pool, 103 const struct resource_pool *pool,
104 struct clock_source *clock_source); 104 struct clock_source *clock_source);
105 105
106int resource_get_clock_source_reference(
107 struct resource_context *res_ctx,
108 const struct resource_pool *pool,
109 struct clock_source *clock_source);
110
106bool resource_are_streams_timing_synchronizable( 111bool resource_are_streams_timing_synchronizable(
107 struct dc_stream_state *stream1, 112 struct dc_stream_state *stream1,
108 struct dc_stream_state *stream2); 113 struct dc_stream_state *stream2);