[PATCH 31/81] drm/amd/display: Add validate_context to atomic_state

sunpeng.li at amd.com sunpeng.li at amd.com
Tue Jul 25 13:53:51 UTC 2017


From: Harry Wentland <harry.wentland at amd.com>

Change-Id: I702516607ad0682339d41bba627e7f1674d4b050
Signed-off-by: Harry Wentland <harry.wentland at amd.com>
Reviewed-by: Tony Cheng <Tony.Cheng at amd.com>
Acked-by: Harry Wentland <Harry.Wentland at amd.com>
---
 .../gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_types.c    | 18 ++----------------
 .../gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_types.h    |  2 +-
 2 files changed, 3 insertions(+), 17 deletions(-)

diff --git a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_types.c b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_types.c
index b0734bb..396fd31 100644
--- a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_types.c
+++ b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_types.c
@@ -3145,7 +3145,6 @@ int amdgpu_dm_atomic_check(struct drm_device *dev,
 	struct amdgpu_device *adev = dev->dev_private;
 	struct dc *dc = adev->dm.dc;
 	bool need_to_validate = false;
-	struct validate_context *context;
 	struct drm_connector *connector;
 	struct drm_connector_state *conn_state;
 	/*
@@ -3380,10 +3379,9 @@ int amdgpu_dm_atomic_check(struct drm_device *dev,
 		}
 	}
 
-	context = dc_get_validate_context(dc, dm_state->set, dm_state->set_count);
-
-	if (need_to_validate == false || dm_state->set_count == 0 || context) {
+	dm_state->context = dc_get_validate_context(dc, dm_state->set, dm_state->set_count);
 
+	if (need_to_validate == false || dm_state->set_count == 0 || dm_state->context) {
 		ret = 0;
 		/*
 		 * For full updates case when
@@ -3399,18 +3397,6 @@ int amdgpu_dm_atomic_check(struct drm_device *dev,
 
 	}
 
-	if (context) {
-		dc_resource_validate_ctx_destruct(context);
-		dm_free(context);
-	}
-
-	for (i = 0; i < dm_state->set_count; i++)
-		for (j = 0; j < dm_state->set[i].surface_count; j++)
-			dc_surface_release(dm_state->set[i].surfaces[j]);
-
-	for (i = 0; i < new_stream_count; i++)
-		dc_stream_release(new_streams[i]);
-
 	if (ret != 0) {
 		if (ret == -EDEADLK)
 			DRM_DEBUG_KMS("Atomic check stopped due to to deadlock.\n");
diff --git a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_types.h b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_types.h
index a7adf8d..1e444cb 100644
--- a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_types.h
+++ b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_types.h
@@ -55,7 +55,7 @@ struct dm_atomic_state {
 
 	struct dc_validation_set set[MAX_STREAMS];
 	int set_count;
-
+	struct validate_context *context;
 };
 
 #define to_dm_atomic_state(x) container_of(x, struct dm_atomic_state, base)
-- 
2.7.4



More information about the amd-gfx mailing list