Received: by 2002:a25:8b12:0:0:0:0:0 with SMTP id i18csp663162ybl; Wed, 21 Aug 2019 03:44:54 -0700 (PDT) X-Google-Smtp-Source: APXvYqxiJbcHb5YuaIl0KbqLdX9yWb6QCONu1NJvFe8jh4TLACzOnrsvCmqkEk/CNqUBPyl6ZOJM X-Received: by 2002:a17:90a:5803:: with SMTP id h3mr4559747pji.133.1566384293956; Wed, 21 Aug 2019 03:44:53 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1566384293; cv=none; d=google.com; s=arc-20160816; b=LsXwS6wOXDwo+FCeeF/XQdtBG1j9kR2fX3QG9DX3Ks4RgZBA2EBtd/KRUrZrp+5FYj XamAQ9AT2thDTKEAKMRocdVjeefJDoNDu6CJF/tLCJVV667zOR4wIUdLtR5hXT8buOtk jdYJCzlem56nS5gHnToA+c8gAwgET/BgMo0zqKV8Va0TWyCxpsZ0hFt47Jmh/eZL0F34 6OxrisVVlyxKdj/0h2gUQ+KXhDOcpaIL8t+huAQVMYHOKCBzhPiukQUEREBTSiYAyYK4 SQuPragyVLcLvwepgay2A54BwnDuHcMYr0rWhv8xab2UgwAzk3pszx5lPWMdPfEi7mAE 830Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from; bh=VfNnr+kXQ87sE/q8V2PBBR6bhP17qVmLrOUxpsm587c=; b=QL4QD/3D92es6ZWEteqboisKfMzSv3mUsL3Rx0EbJ+iZXJxQlvFui3Q614TeyKADWW qvF12IFhtKzDqD95wwbmsrmOipWrq9uK37ib/HjmtORfIf6mDcIxj6GKWNCqjb90tnFf uQECWE3Hsk5J8QvVSJ2lNjhh7vV7UCvdkW6fSdlIjXelSVaF9vemSUVx3qgDaA9AyvE3 TuclYvu2ErWPzuaolxrbocVftj/JaFxiCZUlgsipqmHlVM8WRnKg9KXnXrXcTVbeDgLk 1TPPPjUn0UmFdAyoR/GlufihFG2cjC9tOJuw8rX+U2y0Hg4yJ9m6Tn1SnVndt+jL5lNf vS2g== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=nxp.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id v24si14403957plo.244.2019.08.21.03.44.39; Wed, 21 Aug 2019 03:44:53 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=nxp.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728050AbfHUKQb (ORCPT + 99 others); Wed, 21 Aug 2019 06:16:31 -0400 Received: from inva020.nxp.com ([92.121.34.13]:45022 "EHLO inva020.nxp.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727984AbfHUKQ3 (ORCPT ); Wed, 21 Aug 2019 06:16:29 -0400 Received: from inva020.nxp.com (localhost [127.0.0.1]) by inva020.eu-rdc02.nxp.com (Postfix) with ESMTP id 4D7641A01DF; Wed, 21 Aug 2019 12:16:27 +0200 (CEST) Received: from inva024.eu-rdc02.nxp.com (inva024.eu-rdc02.nxp.com [134.27.226.22]) by inva020.eu-rdc02.nxp.com (Postfix) with ESMTP id 410131A0045; Wed, 21 Aug 2019 12:16:27 +0200 (CEST) Received: from fsr-ub1664-120.ea.freescale.net (fsr-ub1664-120.ea.freescale.net [10.171.82.81]) by inva024.eu-rdc02.nxp.com (Postfix) with ESMTP id 91F8C205D3; Wed, 21 Aug 2019 12:16:26 +0200 (CEST) From: Robert Chiras To: =?UTF-8?q?Guido=20G=C3=BCnther?= , Marek Vasut , Stefan Agner , David Airlie , Daniel Vetter , Rob Herring , Mark Rutland , Shawn Guo , Sascha Hauer , Fabio Estevam Cc: Pengutronix Kernel Team , NXP Linux Team , dri-devel@lists.freedesktop.org, devicetree@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Subject: [PATCH v3 15/15] drm/mxsfb: Add support for live pixel format change Date: Wed, 21 Aug 2019 13:15:55 +0300 Message-Id: <1566382555-12102-16-git-send-email-robert.chiras@nxp.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1566382555-12102-1-git-send-email-robert.chiras@nxp.com> References: <1566382555-12102-1-git-send-email-robert.chiras@nxp.com> X-Virus-Scanned: ClamAV using ClamSMTP Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org This IP requires full stop and re-start when changing display timings, but we can change the pixel format while running. Signed-off-by: Robert Chiras --- drivers/gpu/drm/mxsfb/mxsfb_crtc.c | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/drivers/gpu/drm/mxsfb/mxsfb_crtc.c b/drivers/gpu/drm/mxsfb/mxsfb_crtc.c index 317575e..5607fc0 100644 --- a/drivers/gpu/drm/mxsfb/mxsfb_crtc.c +++ b/drivers/gpu/drm/mxsfb/mxsfb_crtc.c @@ -494,6 +494,7 @@ void mxsfb_plane_atomic_update(struct mxsfb_drm_private *mxsfb, struct drm_crtc *crtc = &pipe->crtc; struct drm_plane_state *new_state = pipe->plane.state; struct drm_framebuffer *fb = pipe->plane.state->fb; + struct drm_framebuffer *old_fb = state->fb; struct drm_pending_vblank_event *event; u32 fb_addr, src_off, src_w, stride, cpp = 0; @@ -510,7 +511,7 @@ void mxsfb_plane_atomic_update(struct mxsfb_drm_private *mxsfb, } spin_unlock_irq(&crtc->dev->event_lock); - if (!fb) + if (!fb || !old_fb) return; fb_addr = mxsfb_get_fb_paddr(mxsfb); @@ -533,4 +534,17 @@ void mxsfb_plane_atomic_update(struct mxsfb_drm_private *mxsfb, src_w = new_state->src_w >> 16; mxsfb_set_fb_hcrop(mxsfb, src_w, stride); } + + if (old_fb->format->format != fb->format->format) { + struct drm_format_name_buf old_fmt_buf; + struct drm_format_name_buf new_fmt_buf; + + DRM_DEV_DEBUG_DRIVER(crtc->dev->dev, + "Switching pixel format: %s -> %s\n", + drm_get_format_name(old_fb->format->format, + &old_fmt_buf), + drm_get_format_name(fb->format->format, + &new_fmt_buf)); + mxsfb_set_pixel_fmt(mxsfb, true); + } } -- 2.7.4