[PATCH 04/17] drm/amd/display: changing the dc_update_surfaces_and_stream
Harry Wentland
harry.wentland at amd.com
Wed Mar 22 17:04:51 UTC 2017
From: Leon Elazar <leon.elazar at amd.com>
1. Adding the ability to update the stream parameters during FULL_UPDATE type
Change-Id: I0ac40a858bdd0d03df7011d8bd9c110226a44945
Signed-off-by: Leon Elazar <leon.elazar at amd.com>
Acked-by: Harry Wentland <Harry.Wentland at amd.com>
Reviewed-by: Tony Cheng <Tony.Cheng at amd.com>
---
drivers/gpu/drm/amd/display/dc/core/dc.c | 129 +++++++++++++++----------------
drivers/gpu/drm/amd/display/dc/dc.h | 1 +
2 files changed, 65 insertions(+), 65 deletions(-)
diff --git a/drivers/gpu/drm/amd/display/dc/core/dc.c b/drivers/gpu/drm/amd/display/dc/core/dc.c
index 228ef6b310e0..26f227ddd025 100644
--- a/drivers/gpu/drm/amd/display/dc/core/dc.c
+++ b/drivers/gpu/drm/amd/display/dc/core/dc.c
@@ -1245,6 +1245,7 @@ enum surface_update_type dc_check_update_surfaces_for_stream(
struct dc *dc,
struct dc_surface_update *updates,
int surface_count,
+ struct dc_stream_update *stream_update,
const struct dc_stream_status *stream_status)
{
struct core_dc *core_dc = DC_TO_CORE(dc);
@@ -1254,6 +1255,9 @@ enum surface_update_type dc_check_update_surfaces_for_stream(
if (stream_status->surface_count != surface_count)
return UPDATE_TYPE_FULL;
+ if (stream_update)
+ return UPDATE_TYPE_FULL;
+
for (i = 0 ; i < surface_count; i++) {
enum surface_update_type type =
det_surface_update(core_dc, &updates[i]);
@@ -1268,39 +1272,27 @@ enum surface_update_type dc_check_update_surfaces_for_stream(
return overall_type;
}
-void dc_update_surfaces_and_stream(struct dc *dc,
+void dc_update_surfaces_for_stream(struct dc *dc,
struct dc_surface_update *surface_updates, int surface_count,
- const struct dc_stream *dc_stream,
- struct dc_stream_update *stream_update)
+ const struct dc_stream *dc_stream)
{
- const struct dc_stream_status *stream_status;
-
- stream_status = dc_stream_get_status(dc_stream);
- ASSERT(stream_status);
- if (!stream_status)
- return; /* Cannot update stream that is not committed */
-
- if (stream_update) {
- dc->stream_funcs.stream_update_scaling(dc, dc_stream,
- &stream_update->src, &stream_update->dst);
- }
-
- dc_update_surfaces_for_stream(dc, surface_updates,
- surface_count, dc_stream);
+ dc_update_surfaces_and_stream(dc, surface_updates, surface_count,
+ dc_stream, NULL);
}
enum surface_update_type update_surface_trace_level = UPDATE_TYPE_FULL;
-void dc_update_surfaces_for_stream(struct dc *dc,
- struct dc_surface_update *updates, int surface_count,
- const struct dc_stream *dc_stream)
+void dc_update_surfaces_and_stream(struct dc *dc,
+ struct dc_surface_update *srf_updates, int surface_count,
+ const struct dc_stream *dc_stream,
+ struct dc_stream_update *stream_update)
{
struct core_dc *core_dc = DC_TO_CORE(dc);
struct validate_context *context;
int i, j;
-
enum surface_update_type update_type;
const struct dc_stream_status *stream_status;
+ struct core_stream *stream = DC_STREAM_TO_CORE(dc_stream);
stream_status = dc_stream_get_status(dc_stream);
ASSERT(stream_status);
@@ -1308,16 +1300,16 @@ void dc_update_surfaces_for_stream(struct dc *dc,
return; /* Cannot commit surface to stream that is not committed */
update_type = dc_check_update_surfaces_for_stream(
- dc, updates, surface_count, stream_status);
+ dc, srf_updates, surface_count, stream_update, stream_status);
if (update_type >= update_surface_trace_level)
- update_surface_trace(dc, updates, surface_count);
+ update_surface_trace(dc, srf_updates, surface_count);
if (update_type >= UPDATE_TYPE_FULL) {
const struct dc_surface *new_surfaces[MAX_SURFACES] = { 0 };
for (i = 0; i < surface_count; i++)
- new_surfaces[i] = updates[i].surface;
+ new_surfaces[i] = srf_updates[i].surface;
/* initialize scratch memory for building context */
context = core_dc->temp_flip_context;
@@ -1333,47 +1325,54 @@ void dc_update_surfaces_for_stream(struct dc *dc,
} else {
context = core_dc->current_context;
}
+
+ /* update current stream with the new updates */
+ if (stream_update) {
+ stream->public.src = stream_update->src;
+ stream->public.dst = stream_update->dst;
+ }
+
+ /* save update parameters into surface */
for (i = 0; i < surface_count; i++) {
- /* save update param into surface */
- struct core_surface *surface = DC_SURFACE_TO_CORE(updates[i].surface);
- struct core_stream *stream = DC_STREAM_TO_CORE(dc_stream);
+ struct core_surface *surface =
+ DC_SURFACE_TO_CORE(srf_updates[i].surface);
- if (updates[i].flip_addr) {
- surface->public.address = updates[i].flip_addr->address;
+ if (srf_updates[i].flip_addr) {
+ surface->public.address = srf_updates[i].flip_addr->address;
surface->public.flip_immediate =
- updates[i].flip_addr->flip_immediate;
+ srf_updates[i].flip_addr->flip_immediate;
}
- if (updates[i].scaling_info) {
+ if (srf_updates[i].scaling_info) {
surface->public.scaling_quality =
- updates[i].scaling_info->scaling_quality;
+ srf_updates[i].scaling_info->scaling_quality;
surface->public.dst_rect =
- updates[i].scaling_info->dst_rect;
+ srf_updates[i].scaling_info->dst_rect;
surface->public.src_rect =
- updates[i].scaling_info->src_rect;
+ srf_updates[i].scaling_info->src_rect;
surface->public.clip_rect =
- updates[i].scaling_info->clip_rect;
+ srf_updates[i].scaling_info->clip_rect;
}
- if (updates[i].plane_info) {
+ if (srf_updates[i].plane_info) {
surface->public.color_space =
- updates[i].plane_info->color_space;
+ srf_updates[i].plane_info->color_space;
surface->public.format =
- updates[i].plane_info->format;
+ srf_updates[i].plane_info->format;
surface->public.plane_size =
- updates[i].plane_info->plane_size;
+ srf_updates[i].plane_info->plane_size;
surface->public.rotation =
- updates[i].plane_info->rotation;
+ srf_updates[i].plane_info->rotation;
surface->public.horizontal_mirror =
- updates[i].plane_info->horizontal_mirror;
+ srf_updates[i].plane_info->horizontal_mirror;
surface->public.stereo_format =
- updates[i].plane_info->stereo_format;
+ srf_updates[i].plane_info->stereo_format;
surface->public.tiling_info =
- updates[i].plane_info->tiling_info;
+ srf_updates[i].plane_info->tiling_info;
surface->public.visible =
- updates[i].plane_info->visible;
+ srf_updates[i].plane_info->visible;
surface->public.dcc =
- updates[i].plane_info->dcc;
+ srf_updates[i].plane_info->dcc;
}
/* not sure if we still need this */
@@ -1388,40 +1387,40 @@ void dc_update_surfaces_for_stream(struct dc *dc,
}
}
- if (updates[i].gamma &&
- updates[i].gamma != surface->public.gamma_correction) {
+ if (srf_updates[i].gamma &&
+ srf_updates[i].gamma != surface->public.gamma_correction) {
if (surface->public.gamma_correction != NULL)
dc_gamma_release(&surface->public.
gamma_correction);
- dc_gamma_retain(updates[i].gamma);
+ dc_gamma_retain(srf_updates[i].gamma);
surface->public.gamma_correction =
- updates[i].gamma;
+ srf_updates[i].gamma;
}
- if (updates[i].in_transfer_func &&
- updates[i].in_transfer_func != surface->public.in_transfer_func) {
+ if (srf_updates[i].in_transfer_func &&
+ srf_updates[i].in_transfer_func != surface->public.in_transfer_func) {
if (surface->public.in_transfer_func != NULL)
dc_transfer_func_release(
surface->public.
in_transfer_func);
dc_transfer_func_retain(
- updates[i].in_transfer_func);
+ srf_updates[i].in_transfer_func);
surface->public.in_transfer_func =
- updates[i].in_transfer_func;
+ srf_updates[i].in_transfer_func;
}
- if (updates[i].out_transfer_func &&
- updates[i].out_transfer_func != dc_stream->out_transfer_func) {
+ if (srf_updates[i].out_transfer_func &&
+ srf_updates[i].out_transfer_func != dc_stream->out_transfer_func) {
if (dc_stream->out_transfer_func != NULL)
dc_transfer_func_release(dc_stream->out_transfer_func);
- dc_transfer_func_retain(updates[i].out_transfer_func);
- stream->public.out_transfer_func = updates[i].out_transfer_func;
+ dc_transfer_func_retain(srf_updates[i].out_transfer_func);
+ stream->public.out_transfer_func = srf_updates[i].out_transfer_func;
}
- if (updates[i].hdr_static_metadata)
+ if (srf_updates[i].hdr_static_metadata)
surface->public.hdr_static_ctx =
- *(updates[i].hdr_static_metadata);
+ *(srf_updates[i].hdr_static_metadata);
}
if (update_type == UPDATE_TYPE_FULL &&
@@ -1434,7 +1433,7 @@ void dc_update_surfaces_for_stream(struct dc *dc,
core_dc->hwss.apply_ctx_for_surface(core_dc, NULL, context);
for (i = 0; i < surface_count; i++) {
- struct core_surface *surface = DC_SURFACE_TO_CORE(updates[i].surface);
+ struct core_surface *surface = DC_SURFACE_TO_CORE(srf_updates[i].surface);
for (j = 0; j < context->res_ctx.pool->pipe_count; j++) {
struct pipe_ctx *pipe_ctx = &context->res_ctx.pipe_ctx[j];
@@ -1460,7 +1459,7 @@ void dc_update_surfaces_for_stream(struct dc *dc,
true);
}
- if (updates[i].flip_addr)
+ if (srf_updates[i].flip_addr)
core_dc->hwss.update_plane_addr(core_dc, pipe_ctx);
if (update_type == UPDATE_TYPE_FAST)
@@ -1471,18 +1470,18 @@ void dc_update_surfaces_for_stream(struct dc *dc,
is_new_pipe_surface = false;
if (is_new_pipe_surface ||
- updates[i].in_transfer_func)
+ srf_updates[i].in_transfer_func)
core_dc->hwss.set_input_transfer_func(
pipe_ctx, pipe_ctx->surface);
if (is_new_pipe_surface ||
- updates[i].out_transfer_func)
+ srf_updates[i].out_transfer_func)
core_dc->hwss.set_output_transfer_func(
pipe_ctx,
pipe_ctx->surface,
pipe_ctx->stream);
- if (updates[i].hdr_static_metadata) {
+ if (srf_updates[i].hdr_static_metadata) {
resource_build_info_frame(pipe_ctx);
core_dc->hwss.update_info_frame(pipe_ctx);
}
@@ -1493,7 +1492,7 @@ void dc_update_surfaces_for_stream(struct dc *dc,
struct pipe_ctx *pipe_ctx = &context->res_ctx.pipe_ctx[i];
for (j = 0; j < surface_count; j++) {
- if (updates[j].surface == &pipe_ctx->surface->public) {
+ if (srf_updates[j].surface == &pipe_ctx->surface->public) {
if (!pipe_ctx->tg->funcs->is_blanked(pipe_ctx->tg)) {
core_dc->hwss.pipe_control_lock(
core_dc,
diff --git a/drivers/gpu/drm/amd/display/dc/dc.h b/drivers/gpu/drm/amd/display/dc/dc.h
index b1bff597c0f7..8b033ba5df6e 100644
--- a/drivers/gpu/drm/amd/display/dc/dc.h
+++ b/drivers/gpu/drm/amd/display/dc/dc.h
@@ -556,6 +556,7 @@ enum surface_update_type dc_check_update_surfaces_for_stream(
struct dc *dc,
struct dc_surface_update *updates,
int surface_count,
+ struct dc_stream_update *stream_update,
const struct dc_stream_status *stream_status);
/*******************************************************************************
--
2.11.0
More information about the amd-gfx
mailing list