summaryrefslogtreecommitdiff
path: root/drivers/gpu/drm/vkms/vkms_plane.c
diff options
context:
space:
mode:
authorHaneen Mohammed <hamohammed.sa@gmail.com>2018-07-24 19:30:22 +0300
committerSean Paul <seanpaul@chromium.org>2018-07-30 13:03:13 -0400
commitd7734b74095dfa103747a82a63ae8bd71dcbf24e (patch)
tree5aa87c7eb6ad647a45ed0e77d3945eabb2acac7b /drivers/gpu/drm/vkms/vkms_plane.c
parent8ce1bb0b5337db4be801eea234f959104323f959 (diff)
drm/vkms: Add atomic_helper_check_plane_state
Call atomic_helper_check_plane_state to clip plane coordinates. Signed-off-by: Haneen Mohammed <hamohammed.sa@gmail.com> Reviewed-by: Sean Paul <seanpaul@chromium.org> Signed-off-by: Sean Paul <seanpaul@chromium.org> Link: https://patchwork.freedesktop.org/patch/msgid/b8c1bfed8b5720cc4794ace41cf49af66c99a48c.1532446182.git.hamohammed.sa@gmail.com
Diffstat (limited to 'drivers/gpu/drm/vkms/vkms_plane.c')
-rw-r--r--drivers/gpu/drm/vkms/vkms_plane.c29
1 files changed, 29 insertions, 0 deletions
diff --git a/drivers/gpu/drm/vkms/vkms_plane.c b/drivers/gpu/drm/vkms/vkms_plane.c
index 5611e7cf5fc9..8191940844e5 100644
--- a/drivers/gpu/drm/vkms/vkms_plane.c
+++ b/drivers/gpu/drm/vkms/vkms_plane.c
@@ -8,6 +8,7 @@
#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>
@@ -25,6 +26,33 @@ static void vkms_primary_plane_update(struct drm_plane *plane,
{
}
+static int vkms_plane_atomic_check(struct drm_plane *plane,
+ struct drm_plane_state *state)
+{
+ struct drm_crtc_state *crtc_state;
+ int ret;
+
+ 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);
+
+ ret = drm_atomic_helper_check_plane_state(state, crtc_state,
+ DRM_PLANE_HELPER_NO_SCALING,
+ DRM_PLANE_HELPER_NO_SCALING,
+ false, true);
+ if (ret != 0)
+ return ret;
+
+ /* for now primary plane must be visible and full screen */
+ if (!state->visible)
+ return -EINVAL;
+
+ return 0;
+}
+
static int vkms_prepare_fb(struct drm_plane *plane,
struct drm_plane_state *state)
{
@@ -58,6 +86,7 @@ static void vkms_cleanup_fb(struct drm_plane *plane,
static const struct drm_plane_helper_funcs vkms_primary_helper_funcs = {
.atomic_update = vkms_primary_plane_update,
+ .atomic_check = vkms_plane_atomic_check,
.prepare_fb = vkms_prepare_fb,
.cleanup_fb = vkms_cleanup_fb,
};