From: Philipp Zabel Subject: [PATCH 4/4] imx-drm: ipuv3-plane: fix plane updates for active planes Date: Tue, 29 Jul 2014 11:57:09 +0200 Message-ID: <1406627829-29596-4-git-send-email-p.zabel@pengutronix.de> References: <1406627829-29596-1-git-send-email-p.zabel@pengutronix.de> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: Received: from metis.ext.pengutronix.de (metis.ext.pengutronix.de [92.198.50.35]) by gabe.freedesktop.org (Postfix) with ESMTP id BF4DE6E11A for ; Tue, 29 Jul 2014 02:57:39 -0700 (PDT) In-Reply-To: <1406627829-29596-1-git-send-email-p.zabel@pengutronix.de> List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" To: Russell King Cc: Fabio Estevam , devel@driverdev.osuosl.org, kernel@pengutronix.de, Greg Kroah-Hartman , dri-devel@lists.freedesktop.org List-Id: dri-devel@lists.freedesktop.org While the DMA channel is running, it is not allowed to change anything but the inactive (double) buffer base address, so resizing a plane or changing to a frame buffer with different pixel format is not possible. Signed-off-by: Philipp Zabel --- drivers/staging/imx-drm/ipuv3-plane.c | 15 +++++++++++++++ drivers/staging/imx-drm/ipuv3-plane.h | 2 ++ 2 files changed, 17 insertions(+) diff --git a/drivers/staging/imx-drm/ipuv3-plane.c b/drivers/staging/imx-drm/ipuv3-plane.c index 9fdab14..3dfcdfd 100644 --- a/drivers/staging/imx-drm/ipuv3-plane.c +++ b/drivers/staging/imx-drm/ipuv3-plane.c @@ -145,6 +145,18 @@ int ipu_plane_mode_set(struct ipu_plane *ipu_plane, struct drm_crtc *crtc, if (crtc_h < 2) return -EINVAL; + /* + * since we cannot touch active IDMAC channels, we do not support + * resizing the enabled plane or changing its format + */ + if (ipu_plane->enabled) { + if (src_w != ipu_plane->w || src_h != ipu_plane->h || + fb->pixel_format != ipu_plane->base.fb->pixel_format) + return -EINVAL; + + return ipu_plane_set_base(ipu_plane, fb, src_x, src_y); + } + switch (ipu_plane->dp_flow) { case IPU_DP_FLOW_SYNC_BG: ret = ipu_dp_setup_channel(ipu_plane->dp, @@ -205,6 +217,9 @@ int ipu_plane_mode_set(struct ipu_plane *ipu_plane, struct drm_crtc *crtc, if (ret < 0) return ret; + ipu_plane->w = src_w; + ipu_plane->h = src_h; + return 0; } diff --git a/drivers/staging/imx-drm/ipuv3-plane.h b/drivers/staging/imx-drm/ipuv3-plane.h index c0aae5b..af125fb 100644 --- a/drivers/staging/imx-drm/ipuv3-plane.h +++ b/drivers/staging/imx-drm/ipuv3-plane.h @@ -26,6 +26,8 @@ struct ipu_plane { int x; int y; + int w; + int h; bool enabled; }; -- 2.0.1