dri-devel.lists.freedesktop.org archive mirror
 help / color / mirror / Atom feed
From: Haneen Mohammed <hamohammed.sa@gmail.com>
To: dri-devel@lists.freedesktop.org
Cc: hamohammed.sa@gmail.com, rodrigosiqueiramelo@gmail.com
Subject: [PATCH 3/4] drm/vkms: Add atomic_helper_check_plane_state
Date: Mon, 9 Jul 2018 18:47:34 +0300	[thread overview]
Message-ID: <b2c7db2bc349891546beb883dbb9e4e9bc2251ce.1531149873.git.hamohammed.sa@gmail.com> (raw)
In-Reply-To: <cover.1531149873.git.hamohammed.sa@gmail.com>

Call atomic_helper_check_plane_state to clip plane coordinates.

Signed-off-by: Haneen Mohammed <hamohammed.sa@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

_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

  parent reply	other threads:[~2018-07-09 15:47 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-07-09 15:42 [PATCH 0/4] Add infrastructure needed for CRC support Haneen Mohammed
2018-07-09 15:44 ` [PATCH 1/4] drm/vkms: Add functions to map GEM backing storage Haneen Mohammed
2018-07-10  8:00   ` Daniel Vetter
2018-07-10  8:12   ` Chris Wilson
2018-07-10 15:12     ` Haneen Mohammed
2018-07-09 15:46 ` [PATCH 2/4] drm/vkms: map/unmap buffers in [prepare/cleanup]_fb hooks Haneen Mohammed
2018-07-10  8:04   ` Daniel Vetter
2018-07-09 15:47 ` Haneen Mohammed [this message]
2018-07-10  8:07   ` [PATCH 3/4] drm/vkms: Add atomic_helper_check_plane_state Daniel Vetter
2018-07-09 15:48 ` [PATCH 4/4] drm/vkms: subclass CRTC state Haneen Mohammed
2018-07-10  8:10   ` Daniel Vetter
2018-07-10 15:13     ` Haneen Mohammed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=b2c7db2bc349891546beb883dbb9e4e9bc2251ce.1531149873.git.hamohammed.sa@gmail.com \
    --to=hamohammed.sa@gmail.com \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=rodrigosiqueiramelo@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).