From: Liu Ying <gnuiyl@gmail.com>
To: dri-devel@lists.freedesktop.org
Cc: Russell King <rmk+kernel@arm.linux.org.uk>
Subject: [PATCH 03/14] drm: imx: ipuv3 plane: Check different types of plane separately
Date: Tue, 24 May 2016 18:10:42 +0800 [thread overview]
Message-ID: <1464084653-16684-4-git-send-email-gnuiyl@gmail.com> (raw)
In-Reply-To: <1464084653-16684-1-git-send-email-gnuiyl@gmail.com>
The IPUv3 primary plane doesn't support partial off screen.
So, this patch separates plane check logics for primary plane and overlay
plane and adds more limitations on the primary plane.
Signed-off-by: Liu Ying <gnuiyl@gmail.com>
---
drivers/gpu/drm/imx/ipuv3-plane.c | 72 ++++++++++++++++++++++-----------------
1 file changed, 41 insertions(+), 31 deletions(-)
diff --git a/drivers/gpu/drm/imx/ipuv3-plane.c b/drivers/gpu/drm/imx/ipuv3-plane.c
index e6ec8eb..8f91b2e 100644
--- a/drivers/gpu/drm/imx/ipuv3-plane.c
+++ b/drivers/gpu/drm/imx/ipuv3-plane.c
@@ -190,44 +190,54 @@ int ipu_plane_mode_set(struct ipu_plane *ipu_plane, struct drm_crtc *crtc,
uint32_t src_x, uint32_t src_y,
uint32_t src_w, uint32_t src_h, bool interlaced)
{
- struct device *dev = ipu_plane->base.dev->dev;
+ struct drm_plane plane = ipu_plane->base;
+ struct device *dev = plane.dev->dev;
int ret;
/* no scaling */
if (src_w != crtc_w || src_h != crtc_h)
return -EINVAL;
- /* clip to crtc bounds */
- if (crtc_x < 0) {
- if (-crtc_x > crtc_w)
+ if (plane.type == DRM_PLANE_TYPE_PRIMARY) {
+ /* full plane doesn't support partial off screen */
+ if (crtc_x || crtc_y || crtc_w != mode->hdisplay ||
+ crtc_h != mode->vdisplay)
return -EINVAL;
- src_x += -crtc_x;
- src_w -= -crtc_x;
- crtc_w -= -crtc_x;
- crtc_x = 0;
- }
- if (crtc_y < 0) {
- if (-crtc_y > crtc_h)
- return -EINVAL;
- src_y += -crtc_y;
- src_h -= -crtc_y;
- crtc_h -= -crtc_y;
- crtc_y = 0;
- }
- if (crtc_x + crtc_w > mode->hdisplay) {
- if (crtc_x > mode->hdisplay)
- return -EINVAL;
- crtc_w = mode->hdisplay - crtc_x;
- src_w = crtc_w;
- }
- if (crtc_y + crtc_h > mode->vdisplay) {
- if (crtc_y > mode->vdisplay)
+
+ /* full plane minimum width is 13 pixels */
+ if (crtc_w < 13)
return -EINVAL;
- crtc_h = mode->vdisplay - crtc_y;
- src_h = crtc_h;
- }
- /* full plane minimum width is 13 pixels */
- if (crtc_w < 13 && (ipu_plane->dp_flow != IPU_DP_FLOW_SYNC_FG))
+ } else if (plane.type == DRM_PLANE_TYPE_OVERLAY) {
+ /* clip to crtc bounds */
+ if (crtc_x < 0) {
+ if (-crtc_x > crtc_w)
+ return -EINVAL;
+ src_x += -crtc_x;
+ src_w -= -crtc_x;
+ crtc_w -= -crtc_x;
+ crtc_x = 0;
+ }
+ if (crtc_y < 0) {
+ if (-crtc_y > crtc_h)
+ return -EINVAL;
+ src_y += -crtc_y;
+ src_h -= -crtc_y;
+ crtc_h -= -crtc_y;
+ crtc_y = 0;
+ }
+ if (crtc_x + crtc_w > mode->hdisplay) {
+ if (crtc_x > mode->hdisplay)
+ return -EINVAL;
+ crtc_w = mode->hdisplay - crtc_x;
+ src_w = crtc_w;
+ }
+ if (crtc_y + crtc_h > mode->vdisplay) {
+ if (crtc_y > mode->vdisplay)
+ return -EINVAL;
+ crtc_h = mode->vdisplay - crtc_y;
+ src_h = crtc_h;
+ }
+ } else
return -EINVAL;
if (crtc_h < 2)
return -EINVAL;
@@ -238,7 +248,7 @@ int ipu_plane_mode_set(struct ipu_plane *ipu_plane, struct drm_crtc *crtc,
*/
if (ipu_plane->enabled) {
if (src_w != ipu_plane->w || src_h != ipu_plane->h ||
- fb->pixel_format != ipu_plane->base.fb->pixel_format)
+ fb->pixel_format != plane.fb->pixel_format)
return -EINVAL;
return ipu_plane_set_base(ipu_plane, fb, src_x, src_y);
--
2.7.4
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel
next prev parent reply other threads:[~2016-05-24 10:45 UTC|newest]
Thread overview: 37+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-05-24 10:10 [PATCH 00/14] imx drm atomic mode setting conversion Liu Ying
2016-05-24 10:10 ` [PATCH 01/14] drm/imx: ipuv3-plane: Constify ipu_plane_funcs Liu Ying
2016-05-24 10:10 ` [PATCH 02/14] drm/imx: plane: Don't set plane->crtc in ipu_plane_update() Liu Ying
2016-05-24 10:10 ` Liu Ying [this message]
2016-05-24 14:20 ` [PATCH 03/14] drm: imx: ipuv3 plane: Check different types of plane separately Philipp Zabel
2016-05-25 9:21 ` Ying Liu
2016-05-26 3:34 ` Ying Liu
2016-05-24 10:10 ` [PATCH 04/14] gpu: ipu-v3: ipu-dmfc: Use static DMFC FIFO allocation mechanism Liu Ying
2016-05-24 14:23 ` Philipp Zabel
2016-05-25 10:01 ` Ying Liu
2016-05-24 10:10 ` [PATCH 05/14] drm/crtc_helper: Disable and reenable primary plane in drm_helper_crtc_mode_set Liu Ying
2016-05-24 10:57 ` Daniel Vetter
2016-05-25 9:37 ` Ying Liu
2016-05-25 10:30 ` Daniel Vetter
2016-05-26 3:02 ` Ying Liu
2016-05-26 7:58 ` Daniel Vetter
2016-05-26 8:03 ` Daniel Vetter
2016-05-24 10:10 ` [PATCH 06/14] drm/imx: atomic phase 1: Use transitional atomic CRTC and plane helpers Liu Ying
2016-05-24 14:23 ` Philipp Zabel
2016-05-25 8:50 ` Ying Liu
2016-05-24 10:10 ` [PATCH 07/14] drm/imx: atomic phase 2 step 1: Wire up state ->reset, ->duplicate and ->destroy Liu Ying
2016-05-24 14:23 ` Philipp Zabel
2016-05-25 8:44 ` Ying Liu
2016-05-24 10:10 ` [PATCH 08/14] drm/imx: atomic phase 2 step 2: Track plane_state->fb correctly in ->page_flip Liu Ying
2016-05-24 10:10 ` [PATCH 09/14] drm/imx: atomic phase 3 step 1: Atomic updates for planes Liu Ying
2016-05-24 10:10 ` [PATCH 10/14] drm/atomic-helper: Disable planes when suspending Liu Ying
2016-05-24 11:00 ` Daniel Vetter
2016-05-25 9:30 ` Ying Liu
2016-05-25 10:32 ` Daniel Vetter
2016-05-24 10:10 ` [PATCH 11/14] drm/imx: atomic phase 3 step 2: Use atomic configuration Liu Ying
2016-05-24 10:10 ` [PATCH 12/14] drm/imx: atomic phase 3 step 3: Legacy callback fixups Liu Ying
2016-05-24 10:10 ` [PATCH 13/14] drm/imx: atomic phase 3 step 4: Use generic atomic page flip Liu Ying
2016-05-24 11:11 ` Daniel Vetter
2016-05-25 9:25 ` Ying Liu
2016-05-24 10:10 ` [PATCH 14/14] drm/imx: atomic phase 3 step 5: Advertise DRIVER_ATOMIC Liu Ying
2016-05-24 14:19 ` [PATCH 00/14] imx drm atomic mode setting conversion Philipp Zabel
2016-05-25 9:24 ` Ying Liu
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=1464084653-16684-4-git-send-email-gnuiyl@gmail.com \
--to=gnuiyl@gmail.com \
--cc=dri-devel@lists.freedesktop.org \
--cc=rmk+kernel@arm.linux.org.uk \
/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