Received: by 2002:a25:8b12:0:0:0:0:0 with SMTP id i18csp642876ybl; Wed, 14 Aug 2019 03:50:23 -0700 (PDT) X-Google-Smtp-Source: APXvYqwxew3PruiCoDOaXyT5dZRuQz8sLuO4qrBPJNL3ZisUevSk1sSO7rPa031GdDgSXE7pAFhf X-Received: by 2002:aa7:8257:: with SMTP id e23mr2221084pfn.160.1565779823401; Wed, 14 Aug 2019 03:50:23 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1565779823; cv=none; d=google.com; s=arc-20160816; b=rtDNpJOuQab4nMZaWb8U34Lp+bGmbtQAEafVe9/3lu00TFmxBbO1dMns6leU1Ix9Vq BYsj9y+3Vn1fM410LOiOGq1gi1vlkYIFvUU32Gx39rgguzLDlqdGbg9FS8q819SB3OXQ yOKIilhRIZuJQbsMavZmFFpQ2m6rtqnlLYm9Kbfxm17SwHjxIqpSj4Y6iBU/Ou+/EUwM n6o+TCjvYPsg/RrtaOyJlpF6+jNyCQC/X0h0ulZztcODMFTq8fJdxg6u0CuDP1H/7YmO 95WPcYzWNkiVQxYY2zEFATGh1i/f1Rw0G+Dl8ykPBnponsNFCwYuFXyULjv0re0glXnB icnQ== 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=POWFAcde2Fvzzp+za9sza9qEEp3Df8fc413/xvS/SJrVxzFq6pej90XB+rag8MPBiW YEvkN/IYTYy4SkyiPESM/U+BMR7tqDDGTQWhC6bdnAuFkTgNOKFsOoK6JAluG1GsYDWG XMvTqWi/OMTUTmbPWtWNxA02C2y+kfwNWbEigghXXa0vHw+u5dMTT8ju5CsKFMKSazOb L3LCR3Wovzub/s+BXFQnPFeOeo1CsGXTPUxdGHOyLkoXtqMuk3in7WiqvfPQ81hud2M+ ilq04Lcb6EHgggvuHVy8Ln73JR6+lRBKQ4QFxUgSqv1RabfozGVuXhuRY2OdS7KTuKH8 0QxA== 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 y30si18054444pga.143.2019.08.14.03.50.07; Wed, 14 Aug 2019 03:50:23 -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 S1728051AbfHNKtT (ORCPT + 99 others); Wed, 14 Aug 2019 06:49:19 -0400 Received: from inva021.nxp.com ([92.121.34.21]:52454 "EHLO inva021.nxp.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727883AbfHNKtO (ORCPT ); Wed, 14 Aug 2019 06:49:14 -0400 Received: from inva021.nxp.com (localhost [127.0.0.1]) by inva021.eu-rdc02.nxp.com (Postfix) with ESMTP id B0D7E200184; Wed, 14 Aug 2019 12:49:12 +0200 (CEST) Received: from inva024.eu-rdc02.nxp.com (inva024.eu-rdc02.nxp.com [134.27.226.22]) by inva021.eu-rdc02.nxp.com (Postfix) with ESMTP id A427B200012; Wed, 14 Aug 2019 12:49:12 +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 A91DD2060E; Wed, 14 Aug 2019 12:49:11 +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 v2 15/15] drm/mxsfb: Add support for live pixel format change Date: Wed, 14 Aug 2019 13:48:51 +0300 Message-Id: <1565779731-1300-16-git-send-email-robert.chiras@nxp.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1565779731-1300-1-git-send-email-robert.chiras@nxp.com> References: <1565779731-1300-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