[PATCH 3/4] drm/vkms: Add atomic_helper_check_plane_state
Haneen Mohammed
hamohammed.sa at gmail.com
Mon Jul 9 15:47:34 UTC 2018
Call atomic_helper_check_plane_state to clip plane coordinates.
Signed-off-by: Haneen Mohammed <hamohammed.sa at gmail.com>
---
drivers/gpu/drm/vkms/vkms_plane.c | 18 ++++++++++++++++--
1 file changed, 16 insertions(+), 2 deletions(-)
diff --git a/drivers/gpu/drm/vkms/vkms_plane.c b/drivers/gpu/drm/vkms/vkms_plane.c
index f464eb0e05dd..bf37aebac0fb 100644
--- a/drivers/gpu/drm/vkms/vkms_plane.c
+++ b/drivers/gpu/drm/vkms/vkms_plane.c
@@ -7,9 +7,10 @@
*/
#include "vkms_drv.h"
-#include <drm/drm_plane_helper.h>
+#include <drm/drm_atomic.h>
#include <drm/drm_atomic_helper.h>
#include <drm/drm_gem_framebuffer_helper.h>
+#include <drm/drm_plane_helper.h>
static const struct drm_plane_funcs vkms_plane_funcs = {
.update_plane = drm_atomic_helper_update_plane,
@@ -23,7 +24,20 @@ static const struct drm_plane_funcs vkms_plane_funcs = {
static int vkms_plane_atomic_check(struct drm_plane *plane,
struct drm_plane_state *state)
{
- return 0;
+ struct drm_crtc_state *crtc_state;
+
+ if (!state->fb || !state->crtc)
+ return 0;
+
+ crtc_state = drm_atomic_get_crtc_state(state->state, state->crtc);
+
+ if (IS_ERR(crtc_state))
+ return PTR_ERR(crtc_state);
+
+ return drm_atomic_helper_check_plane_state(state, crtc_state,
+ DRM_PLANE_HELPER_NO_SCALING,
+ DRM_PLANE_HELPER_NO_SCALING,
+ false, true);
}
static void vkms_primary_plane_update(struct drm_plane *plane,
--
2.17.1
More information about the dri-devel
mailing list