]> git.proxmox.com Git - mirror_ubuntu-bionic-kernel.git/commitdiff
drm/amd/display: Do not release state objects on atomic check fail
authorLeo (Sunpeng) Li <sunpeng.li@amd.com>
Tue, 18 Jul 2017 22:33:23 +0000 (18:33 -0400)
committerAlex Deucher <alexander.deucher@amd.com>
Tue, 26 Sep 2017 22:15:18 +0000 (18:15 -0400)
In any drm ioctl call, drm_atomic_state_clear() is called at the end to
destroy the states; even if atomic check fails. Therefore, releasing
states on atomic check failure is incorrect.

Signed-off-by: Leo (Sunpeng) Li <sunpeng.li@amd.com>
Reviewed-by: Andrey Grodzovsky <Andrey.Grodzovsky@amd.com>
Acked-by: Harry Wentland <Harry.Wentland@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_types.c

index af4de578dadb9d12c2fefaf67612e87869831bb0..44d85b77e252a8c30a182c08e7b8197a4833f48b 100644 (file)
@@ -2989,7 +2989,7 @@ int amdgpu_dm_atomic_check(struct drm_device *dev,
                                conn_state = drm_atomic_get_connector_state(state, &aconnector->base);
                                if (IS_ERR(conn_state)) {
                                        ret = PTR_ERR_OR_ZERO(conn_state);
-                                       goto fail_crtcs;
+                                       goto fail;
                                }
 
                                dm_conn_state = to_dm_connector_state(conn_state);
@@ -3048,7 +3048,7 @@ int amdgpu_dm_atomic_check(struct drm_device *dev,
 
                        ret = drm_atomic_add_affected_planes(state, crtc);
                        if (ret)
-                               goto fail_crtcs;
+                               goto fail;
                }
        }
 
@@ -3110,7 +3110,7 @@ int amdgpu_dm_atomic_check(struct drm_device *dev,
                                        crtc_state,
                                        false);
                                if (ret)
-                                       goto fail_planes;
+                                       goto fail;
 
 
                                if (dm_plane_state->surface)
@@ -3142,13 +3142,12 @@ int amdgpu_dm_atomic_check(struct drm_device *dev,
 
                ret = do_aquire_global_lock(dev, state);
                if (ret)
-                       goto fail_planes;
-
+                       goto fail;
                WARN_ON(dm_state->context);
                dm_state->context = dc_get_validate_context(dc, set, set_count);
                if (!dm_state->context) {
                        ret = -EINVAL;
-                       goto fail_planes;
+                       goto fail;
                }
        }
 
@@ -3156,15 +3155,7 @@ int amdgpu_dm_atomic_check(struct drm_device *dev,
        WARN_ON(ret);
        return ret;
 
-fail_planes:
-       for (i = 0; i < set_count; i++)
-               for (j = 0; j < set[i].surface_count; j++)
-                       dc_surface_release(set[i].surfaces[j]);
-
-fail_crtcs:
-       for (i = 0; i < set_count; i++)
-               dc_stream_release(set[i].stream);
-
+fail:
        if (ret == -EDEADLK)
                DRM_DEBUG_KMS("Atomic check stopped due to to deadlock.\n");
        else if (ret == -EINTR || ret == -EAGAIN || ret == -ERESTARTSYS)