[PATCH 069/120] drm/amd/display: Add stateless surface validation to validate_resources

Harry Wentland harry.wentland at amd.com
Wed Aug 9 15:01:55 UTC 2017


From: Andrey Grodzovsky <Andrey.Grodzovsky at amd.com>

Change-Id: Id92988383ccc6c072b25571cbfa72cd23f247e8d
Signed-off-by: Andrey Grodzovsky <Andrey.Grodzovsky at amd.com>
Reviewed-by: Tony Cheng <Tony.Cheng at amd.com>
Acked-by: Harry Wentland <Harry.Wentland at amd.com>
---
 drivers/gpu/drm/amd/display/dc/core/dc.c | 21 +++++++++++++++++++++
 1 file changed, 21 insertions(+)

diff --git a/drivers/gpu/drm/amd/display/dc/core/dc.c b/drivers/gpu/drm/amd/display/dc/core/dc.c
index 1c0d21840cba..83b8b196cc1e 100644
--- a/drivers/gpu/drm/amd/display/dc/core/dc.c
+++ b/drivers/gpu/drm/amd/display/dc/core/dc.c
@@ -675,6 +675,21 @@ static bool validate_streams (
 	return true;
 }
 
+static bool validate_surfaces(
+		const struct dc *dc,
+		const struct dc_validation_set set[],
+		int set_count)
+{
+	int i, j;
+
+	for (i = 0; i < set_count; i++)
+		for (j = 0; j < set[i].surface_count; j++)
+			if (!dc_validate_surface(dc, set[i].surfaces[j]))
+				return false;
+
+	return true;
+}
+
 struct validate_context *dc_get_validate_context(
 		const struct dc *dc,
 		const struct dc_validation_set set[],
@@ -726,6 +741,9 @@ bool dc_validate_resources(
 	if (!validate_streams(dc, set, set_count))
 		return false;
 
+	if (!validate_surfaces(dc, set, set_count))
+		return false;
+
 	context = dm_alloc(sizeof(struct validate_context));
 	if (context == NULL)
 		goto context_alloc_fail;
@@ -1065,6 +1083,9 @@ bool dc_commit_streams(
 	if (!validate_streams(dc, set, stream_count))
 		return false;
 
+	if (!validate_surfaces(dc, set, stream_count))
+		return false;
+
 	context = dm_alloc(sizeof(struct validate_context));
 	if (context == NULL)
 		goto context_alloc_fail;
-- 
2.11.0



More information about the amd-gfx mailing list