summaryrefslogtreecommitdiff
path: root/drivers/gpu/drm/amd/display/dc/dce80
diff options
context:
space:
mode:
authorAndrey Grodzovsky <Andrey.Grodzovsky@amd.com>2017-07-31 11:29:25 -0400
committerAlex Deucher <alexander.deucher@amd.com>2017-09-26 18:16:46 -0400
commit1dc904974eb7deef924650adc5af542878ce2040 (patch)
tree95442b52c0623207b322a7694674e5937acb00a6 /drivers/gpu/drm/amd/display/dc/dce80
parenta185048ca88ce143f980f2b819f034cfc09a5377 (diff)
drm/amd/display: Per stream validate_context build v2.
Until now new context would start as empty, then populated with exsisting pipes + new. Now we start with duplication of existing context and then add/delete from the context pipes as needed. This allows to do a per stream resource population, start discarding dc_validation_set and by this brings DC closer to to DRM. v2: Add some fixes and rebase. Signed-off-by: Andrey Grodzovsky <Andrey.Grodzovsky@amd.com> Reviewed-by: Tony Cheng <Tony.Cheng@amd.com> Acked-by: Harry Wentland <Harry.Wentland@amd.com> Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
Diffstat (limited to 'drivers/gpu/drm/amd/display/dc/dce80')
-rw-r--r--drivers/gpu/drm/amd/display/dc/dce80/dce80_resource.c79
1 files changed, 17 insertions, 62 deletions
diff --git a/drivers/gpu/drm/amd/display/dc/dce80/dce80_resource.c b/drivers/gpu/drm/amd/display/dc/dce80/dce80_resource.c
index 838bfdaee009..ac3f42a44030 100644
--- a/drivers/gpu/drm/amd/display/dc/dce80/dce80_resource.c
+++ b/drivers/gpu/drm/amd/display/dc/dce80/dce80_resource.c
@@ -686,35 +686,20 @@ static void destruct(struct dce110_resource_pool *pool)
static enum dc_status build_mapped_resource(
const struct dc *dc,
struct validate_context *context,
- struct validate_context *old_context)
+ struct dc_stream_state *stream)
{
enum dc_status status = DC_OK;
- uint8_t i, j;
+ struct pipe_ctx *pipe_ctx = resource_get_head_pipe_for_stream(&context->res_ctx, stream);
- for (i = 0; i < context->stream_count; i++) {
- struct dc_stream_state *stream = context->streams[i];
+ if (!pipe_ctx)
+ return DC_ERROR_UNEXPECTED;
- if (old_context && resource_is_stream_unchanged(old_context, stream))
- continue;
-
- for (j = 0; j < MAX_PIPES; j++) {
- struct pipe_ctx *pipe_ctx =
- &context->res_ctx.pipe_ctx[j];
-
- if (context->res_ctx.pipe_ctx[j].stream != stream)
- continue;
-
- status = dce110_resource_build_pipe_hw_param(pipe_ctx);
+ status = dce110_resource_build_pipe_hw_param(pipe_ctx);
- if (status != DC_OK)
- return status;
+ if (status != DC_OK)
+ return status;
- resource_build_info_frame(pipe_ctx);
-
- /* do not need to validate non root pipes */
- break;
- }
- }
+ resource_build_info_frame(pipe_ctx);
return DC_OK;
}
@@ -751,47 +736,17 @@ static bool dce80_validate_surface_sets(
return true;
}
-enum dc_status dce80_validate_with_context(
+enum dc_status dce80_validate_global(
struct dc *dc,
const struct dc_validation_set set[],
int set_count,
- struct validate_context *context,
- struct validate_context *old_context)
+ struct validate_context *old_context,
+ struct validate_context *context)
{
- struct dc_context *dc_ctx = dc->ctx;
- enum dc_status result = DC_ERROR_UNEXPECTED;
- int i;
-
if (!dce80_validate_surface_sets(set, set_count))
return DC_FAIL_SURFACE_VALIDATE;
- for (i = 0; i < set_count; i++) {
- context->streams[i] = set[i].stream;
- dc_stream_retain(context->streams[i]);
- context->stream_count++;
- }
-
- result = resource_map_pool_resources(dc, context, old_context);
-
- if (result == DC_OK)
- result = resource_map_clock_resources(dc, context, old_context);
-
- if (!resource_validate_attach_surfaces(set, set_count,
- old_context, context, dc->res_pool)) {
- DC_ERROR("Failed to attach surface to stream!\n");
- return DC_FAIL_ATTACH_SURFACES;
- }
-
- if (result == DC_OK)
- result = build_mapped_resource(dc, context, old_context);
-
- if (result == DC_OK)
- result = resource_build_scaling_params_for_context(dc, context);
-
- if (result == DC_OK)
- result = dce80_validate_bandwidth(dc, context);
-
- return result;
+ return DC_OK;
}
enum dc_status dce80_validate_guaranteed(
@@ -805,13 +760,13 @@ enum dc_status dce80_validate_guaranteed(
dc_stream_retain(context->streams[0]);
context->stream_count++;
- result = resource_map_pool_resources(dc, context, NULL);
+ result = resource_map_pool_resources(dc, context, dc_stream);
if (result == DC_OK)
- result = resource_map_clock_resources(dc, context, NULL);
+ result = resource_map_clock_resources(dc, context, dc_stream);
if (result == DC_OK)
- result = build_mapped_resource(dc, context, NULL);
+ result = build_mapped_resource(dc, context, dc_stream);
if (result == DC_OK) {
validate_guaranteed_copy_streams(
@@ -837,10 +792,10 @@ static void dce80_destroy_resource_pool(struct resource_pool **pool)
static const struct resource_funcs dce80_res_pool_funcs = {
.destroy = dce80_destroy_resource_pool,
.link_enc_create = dce80_link_encoder_create,
- .validate_with_context = dce80_validate_with_context,
.validate_guaranteed = dce80_validate_guaranteed,
.validate_bandwidth = dce80_validate_bandwidth,
- .validate_plane = dce100_validate_plane
+ .validate_plane = dce100_validate_plane,
+ .validate_global = dce80_validate_global
};
static bool dce80_construct(