drm/amd/display: Implement plane atomic_check.
authorAndrey Grodzovsky <Andrey.Grodzovsky@amd.com>
Wed, 26 Jul 2017 19:52:28 +0000 (15:52 -0400)
committerAlex Deucher <alexander.deucher@amd.com>
Tue, 26 Sep 2017 22:15:57 +0000 (18:15 -0400)
Use per surface validation hook.

Signed-off-by: Andrey Grodzovsky <Andrey.Grodzovsky@amd.com>
Reviewed-by: Tony Cheng <Tony.Cheng@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.c

index dfb04c5776ad845f795202d3e8275a08ad26d96a..baa788ba6f55ded8c22ffde48dc88e7742ccd574 100644 (file)
@@ -3141,9 +3141,26 @@ int dm_create_validation_set_for_connector(struct drm_connector *connector,
        return MODE_OK;
 }
 
+int dm_plane_atomic_check(struct drm_plane *plane,
+                           struct drm_plane_state *state)
+{
+       struct amdgpu_device *adev = plane->dev->dev_private;
+       struct dc *dc = adev->dm.dc;
+       struct dm_plane_state *dm_plane_state = to_dm_plane_state(state);
+
+       if (!dm_plane_state->surface)
+               return true;
+
+       if (dc_validate_surface(dc, dm_plane_state->surface))
+               return 0;
+
+       return -EINVAL;
+}
+
 static const struct drm_plane_helper_funcs dm_plane_helper_funcs = {
        .prepare_fb = dm_plane_helper_prepare_fb,
        .cleanup_fb = dm_plane_helper_cleanup_fb,
+       .atomic_check = dm_plane_atomic_check,
 };
 
 /*