*dc = NULL;
}
-static bool is_validation_required(
- const struct core_dc *dc,
- const struct dc_validation_set set[],
- int set_count)
-{
- const struct validate_context *context = dc->current_context;
- int i, j;
-
- if (context->stream_count != set_count)
- return true;
-
- for (i = 0; i < set_count; i++) {
-
- if (set[i].surface_count != context->stream_status[i].surface_count)
- return true;
- if (!is_stream_unchanged(DC_STREAM_TO_CORE(set[i].stream), context->streams[i]))
- return true;
-
- for (j = 0; j < set[i].surface_count; j++) {
- struct dc_surface temp_surf = { 0 };
-
- temp_surf = *context->stream_status[i].surfaces[j];
- temp_surf.clip_rect = set[i].surfaces[j]->clip_rect;
- temp_surf.dst_rect.x = set[i].surfaces[j]->dst_rect.x;
- temp_surf.dst_rect.y = set[i].surfaces[j]->dst_rect.y;
-
- if (memcmp(&temp_surf, set[i].surfaces[j], sizeof(temp_surf)) != 0)
- return true;
- }
- }
-
- return false;
-}
-
struct validate_context *dc_get_validate_context(
const struct dc *dc,
const struct dc_validation_set set[],
if(context == NULL)
goto context_alloc_fail;
- if (!is_validation_required(core_dc, set, set_count)) {
- dc_resource_validate_ctx_copy_construct(core_dc->current_context, context);
- return context;
- }
-
result = core_dc->res_pool->funcs->validate_with_context(
- core_dc, set, set_count, context);
+ core_dc, set, set_count, context, NULL);
context_alloc_fail:
if (result != DC_OK) {
if (context == NULL)
goto context_alloc_fail;
- result = core_dc->res_pool->funcs->validate_with_context(core_dc, set, stream_count, context);
+ result = core_dc->res_pool->funcs->validate_with_context(
+ core_dc, set, stream_count, context, core_dc->current_context);
if (result != DC_OK){
dm_logger_write(core_dc->ctx->logger, LOG_ERROR,
"%s: Context validation failed! dc_status:%d\n",
int i, j;
for (i = 0; i < set_count; i++) {
- for (j = 0; j < old_context->stream_count; j++)
+ for (j = 0; old_context && j < old_context->stream_count; j++)
if (is_stream_unchanged(
old_context->streams[j],
context->streams[i])) {
return normalized_pix_clk;
}
-static void calculate_phy_pix_clks(
- const struct core_dc *dc,
- struct validate_context *context)
+static void calculate_phy_pix_clks(struct validate_context *context)
{
int i;
enum dc_status resource_map_pool_resources(
const struct core_dc *dc,
- struct validate_context *context)
+ struct validate_context *context,
+ struct validate_context *old_context)
{
const struct resource_pool *pool = dc->res_pool;
int i, j;
- calculate_phy_pix_clks(dc, context);
+ calculate_phy_pix_clks(context);
- for (i = 0; i < context->stream_count; i++) {
+ for (i = 0; old_context && i < context->stream_count; i++) {
struct core_stream *stream = context->streams[i];
- if (!resource_is_stream_unchanged(dc->current_context, stream)) {
- if (stream != NULL && dc->current_context->streams[i] != NULL) {
+ if (!resource_is_stream_unchanged(old_context, stream)) {
+ if (stream != NULL && old_context->streams[i] != NULL) {
stream->bit_depth_params =
- dc->current_context->streams[i]->bit_depth_params;
- stream->clamping = dc->current_context->streams[i]->clamping;
+ old_context->streams[i]->bit_depth_params;
+ stream->clamping = old_context->streams[i]->clamping;
continue;
}
}
struct pipe_ctx *pipe_ctx =
&context->res_ctx.pipe_ctx[j];
const struct pipe_ctx *old_pipe_ctx =
- &dc->current_context->res_ctx.pipe_ctx[j];
+ &old_context->res_ctx.pipe_ctx[j];
if (!are_stream_backends_same(old_pipe_ctx->stream, stream))
continue;
struct pipe_ctx *pipe_ctx = NULL;
int pipe_idx = -1;
- if (resource_is_stream_unchanged(dc->current_context, stream))
+ if (old_context && resource_is_stream_unchanged(old_context, stream))
continue;
/* acquire new resources */
pipe_idx = acquire_first_free_pipe(
enum dc_status resource_map_clock_resources(
const struct core_dc *dc,
- struct validate_context *context)
+ struct validate_context *context,
+ struct validate_context *old_context)
{
int i, j;
const struct resource_pool *pool = dc->res_pool;
for (i = 0; i < context->stream_count; i++) {
const struct core_stream *stream = context->streams[i];
- if (resource_is_stream_unchanged(dc->current_context, stream))
+ if (old_context && resource_is_stream_unchanged(old_context, stream))
continue;
for (j = 0; j < MAX_PIPES; j++) {
static enum dc_status validate_mapped_resource(
const struct core_dc *dc,
- struct validate_context *context)
+ struct validate_context *context,
+ struct validate_context *old_context)
{
enum dc_status status = DC_OK;
uint8_t i, j;
struct core_stream *stream = context->streams[i];
struct core_link *link = stream->sink->link;
- if (resource_is_stream_unchanged(dc->current_context, stream))
+ if (old_context && resource_is_stream_unchanged(old_context, stream))
continue;
for (j = 0; j < MAX_PIPES; j++) {
const struct core_dc *dc,
const struct dc_validation_set set[],
int set_count,
- struct validate_context *context)
+ struct validate_context *context,
+ struct validate_context *old_context)
{
struct dc_context *dc_ctx = dc->ctx;
enum dc_status result = DC_ERROR_UNEXPECTED;
context->stream_count++;
}
- result = resource_map_pool_resources(dc, context);
+ result = resource_map_pool_resources(dc, context, old_context);
if (result == DC_OK)
- result = resource_map_clock_resources(dc, context);
+ result = resource_map_clock_resources(dc, context, old_context);
if (!resource_validate_attach_surfaces(set, set_count,
- dc->current_context, context, dc->res_pool)) {
+ 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 = validate_mapped_resource(dc, context);
+ result = validate_mapped_resource(dc, context, old_context);
if (result == DC_OK)
result = resource_build_scaling_params_for_context(dc, context);
dc_stream_retain(&context->streams[0]->public);
context->stream_count++;
- result = resource_map_pool_resources(dc, context);
+ result = resource_map_pool_resources(dc, context, NULL);
if (result == DC_OK)
- result = resource_map_clock_resources(dc, context);
+ result = resource_map_clock_resources(dc, context, NULL);
if (result == DC_OK)
- result = validate_mapped_resource(dc, context);
+ result = validate_mapped_resource(dc, context, NULL);
if (result == DC_OK) {
validate_guaranteed_copy_streams(
static enum dc_status validate_mapped_resource(
const struct core_dc *dc,
- struct validate_context *context)
+ struct validate_context *context,
+ struct validate_context *old_context)
{
enum dc_status status = DC_OK;
uint8_t i, j;
struct core_stream *stream = context->streams[i];
struct core_link *link = stream->sink->link;
- if (resource_is_stream_unchanged(dc->current_context, stream))
+ if (old_context && resource_is_stream_unchanged(old_context, stream))
continue;
for (j = 0; j < MAX_PIPES; j++) {
const struct core_dc *dc,
const struct dc_validation_set set[],
int set_count,
- struct validate_context *context)
+ struct validate_context *context,
+ struct validate_context *old_context)
{
struct dc_context *dc_ctx = dc->ctx;
enum dc_status result = DC_ERROR_UNEXPECTED;
context->stream_count++;
}
- result = resource_map_pool_resources(dc, context);
+ result = resource_map_pool_resources(dc, context, old_context);
if (result == DC_OK)
- result = resource_map_clock_resources(dc, context);
+ result = resource_map_clock_resources(dc, context, old_context);
if (!resource_validate_attach_surfaces(set, set_count,
- dc->current_context, context, dc->res_pool)) {
+ 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 = validate_mapped_resource(dc, context);
+ result = validate_mapped_resource(dc, context, old_context);
if (result == DC_OK)
result = resource_build_scaling_params_for_context(dc, context);
dc_stream_retain(&context->streams[0]->public);
context->stream_count++;
- result = resource_map_pool_resources(dc, context);
+ result = resource_map_pool_resources(dc, context, NULL);
if (result == DC_OK)
- result = resource_map_clock_resources(dc, context);
+ result = resource_map_clock_resources(dc, context, NULL);
if (result == DC_OK)
- result = validate_mapped_resource(dc, context);
+ result = validate_mapped_resource(dc, context, NULL);
if (result == DC_OK) {
validate_guaranteed_copy_streams(
static enum dc_status validate_mapped_resource(
const struct core_dc *dc,
- struct validate_context *context)
+ struct validate_context *context,
+ struct validate_context *old_context)
{
enum dc_status status = DC_OK;
uint8_t i, j;
struct core_stream *stream = context->streams[i];
struct core_link *link = stream->sink->link;
- if (resource_is_stream_unchanged(dc->current_context, stream))
+ if (old_context && resource_is_stream_unchanged(old_context, stream))
continue;
for (j = 0; j < MAX_PIPES; j++) {
enum dc_status resource_map_phy_clock_resources(
const struct core_dc *dc,
- struct validate_context *context)
+ struct validate_context *context,
+ struct validate_context *old_context)
{
uint8_t i, j;
for (i = 0; i < context->stream_count; i++) {
struct core_stream *stream = context->streams[i];
- if (resource_is_stream_unchanged(dc->current_context, stream))
+ if (old_context && resource_is_stream_unchanged(old_context, stream))
continue;
for (j = 0; j < MAX_PIPES; j++) {
const struct core_dc *dc,
const struct dc_validation_set set[],
int set_count,
- struct validate_context *context)
+ struct validate_context *context,
+ struct validate_context *old_context)
{
struct dc_context *dc_ctx = dc->ctx;
enum dc_status result = DC_ERROR_UNEXPECTED;
context->stream_count++;
}
- result = resource_map_pool_resources(dc, context);
+ result = resource_map_pool_resources(dc, context, old_context);
if (result == DC_OK)
- result = resource_map_phy_clock_resources(dc, context);
+ result = resource_map_phy_clock_resources(dc, context, old_context);
if (!resource_validate_attach_surfaces(set, set_count,
- dc->current_context, context, dc->res_pool)) {
+ 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 = validate_mapped_resource(dc, context);
+ result = validate_mapped_resource(dc, context, old_context);
if (result == DC_OK)
result = resource_build_scaling_params_for_context(dc, context);
dc_stream_retain(&context->streams[0]->public);
context->stream_count++;
- result = resource_map_pool_resources(dc, context);
+ result = resource_map_pool_resources(dc, context, NULL);
if (result == DC_OK)
- result = resource_map_phy_clock_resources(dc, context);
+ result = resource_map_phy_clock_resources(dc, context, NULL);
if (result == DC_OK)
- result = validate_mapped_resource(dc, context);
+ result = validate_mapped_resource(dc, context, NULL);
if (result == DC_OK) {
validate_guaranteed_copy_streams(
const struct core_dc *dc,
const struct dc_validation_set set[],
int set_count,
- struct validate_context *context);
+ struct validate_context *context,
+ struct validate_context *old_context);
enum dc_status dce112_validate_guaranteed(
const struct core_dc *dc,
static enum dc_status validate_mapped_resource(
const struct core_dc *dc,
- struct validate_context *context)
+ struct validate_context *context,
+ struct validate_context *old_context)
{
enum dc_status status = DC_OK;
uint8_t i, j;
struct core_stream *stream = context->streams[i];
struct core_link *link = stream->sink->link;
- if (resource_is_stream_unchanged(dc->current_context, stream))
+ if (old_context && resource_is_stream_unchanged(old_context, stream))
continue;
for (j = 0; j < MAX_PIPES; j++) {
const struct core_dc *dc,
const struct dc_validation_set set[],
int set_count,
- struct validate_context *context)
+ struct validate_context *context,
+ struct validate_context *old_context)
{
struct dc_context *dc_ctx = dc->ctx;
enum dc_status result = DC_ERROR_UNEXPECTED;
context->stream_count++;
}
- result = resource_map_pool_resources(dc, context);
+ result = resource_map_pool_resources(dc, context, old_context);
if (result == DC_OK)
- result = resource_map_clock_resources(dc, context);
+ result = resource_map_clock_resources(dc, context, old_context);
if (!resource_validate_attach_surfaces(set, set_count,
- dc->current_context, context, dc->res_pool)) {
+ 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 = validate_mapped_resource(dc, context);
+ result = validate_mapped_resource(dc, context, old_context);
if (result == DC_OK)
result = resource_build_scaling_params_for_context(dc, context);
dc_stream_retain(&context->streams[0]->public);
context->stream_count++;
- result = resource_map_pool_resources(dc, context);
+ result = resource_map_pool_resources(dc, context, NULL);
if (result == DC_OK)
- result = resource_map_clock_resources(dc, context);
+ result = resource_map_clock_resources(dc, context, NULL);
if (result == DC_OK)
- result = validate_mapped_resource(dc, context);
+ result = validate_mapped_resource(dc, context, NULL);
if (result == DC_OK) {
validate_guaranteed_copy_streams(
static enum dc_status validate_mapped_resource(
const struct core_dc *dc,
- struct validate_context *context)
+ struct validate_context *context,
+ struct validate_context *old_context)
{
enum dc_status status = DC_OK;
uint8_t i, j;
struct core_stream *stream = context->streams[i];
struct core_link *link = stream->sink->link;
- if (resource_is_stream_unchanged(dc->current_context, stream)) {
- if (stream != NULL && dc->current_context->streams[i] != NULL) {
+ if (old_context && resource_is_stream_unchanged(old_context, stream)) {
+ if (stream != NULL && old_context->streams[i] != NULL) {
/* todo: shouldn't have to copy missing parameter here */
resource_build_bit_depth_reduction_params(stream,
&stream->bit_depth_params);
const struct core_dc *dc,
const struct dc_validation_set set[],
int set_count,
- struct validate_context *context)
+ struct validate_context *context,
+ struct validate_context *old_context)
{
enum dc_status result = DC_OK;
int i;
context->stream_count++;
}
- result = resource_map_pool_resources(dc, context);
+ result = resource_map_pool_resources(dc, context, old_context);
if (result != DC_OK)
return result;
- result = resource_map_phy_clock_resources(dc, context);
+ result = resource_map_phy_clock_resources(dc, context, old_context);
if (result != DC_OK)
return result;
- result = validate_mapped_resource(dc, context);
+ result = validate_mapped_resource(dc, context, old_context);
if (result != DC_OK)
return result;
if (!resource_validate_attach_surfaces(set, set_count,
- dc->current_context, context, dc->res_pool))
+ old_context, context, dc->res_pool))
return DC_FAIL_ATTACH_SURFACES;
result = resource_build_scaling_params_for_context(dc, context);
dc_stream_retain(&context->streams[0]->public);
context->stream_count++;
- result = resource_map_pool_resources(dc, context);
+ result = resource_map_pool_resources(dc, context, NULL);
if (result == DC_OK)
- result = resource_map_phy_clock_resources(dc, context);
+ result = resource_map_phy_clock_resources(dc, context, NULL);
if (result == DC_OK)
- result = validate_mapped_resource(dc, context);
+ result = validate_mapped_resource(dc, context, NULL);
if (result == DC_OK) {
validate_guaranteed_copy_streams(
const struct core_dc *dc,
const struct dc_validation_set set[],
int set_count,
- struct validate_context *context);
+ struct validate_context *context,
+ struct validate_context *old_context);
enum dc_status (*validate_guaranteed)(
const struct core_dc *dc,
enum dc_status resource_map_pool_resources(
const struct core_dc *dc,
- struct validate_context *context);
+ struct validate_context *context,
+ struct validate_context *old_context);
bool resource_build_scaling_params(struct pipe_ctx *pipe_ctx);
enum dc_status resource_map_clock_resources(
const struct core_dc *dc,
- struct validate_context *context);
+ struct validate_context *context,
+ struct validate_context *old_context);
enum dc_status resource_map_phy_clock_resources(
const struct core_dc *dc,
- struct validate_context *context);
+ struct validate_context *context,
+ struct validate_context *old_context);
bool pipe_need_reprogram(
struct pipe_ctx *pipe_ctx_old,