From: Andrey Grodzovsky <andrey.grodzov...@amd.com>

Use per surface validation hook.

Change-Id: I33c8964b9e73f551608c73044fb1a487582d6adf
Signed-off-by: Andrey Grodzovsky <andrey.grodzov...@amd.com>
Reviewed-by: Tony Cheng <tony.ch...@amd.com>
Acked-by: Harry Wentland <harry.wentl...@amd.com>
---
 drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c | 17 +++++++++++++++++
 1 file changed, 17 insertions(+)

diff --git a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c 
b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
index 1b4e88d6386a..6a3ca95b9622 100644
--- a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
+++ b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
@@ -3291,9 +3291,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,
 };
 
 /*
-- 
2.11.0

_______________________________________________
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

Reply via email to