From patchwork Wed Feb 28 11:25:58 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tomi Valkeinen X-Patchwork-Id: 129948 Delivered-To: patch@linaro.org Received: by 10.46.66.2 with SMTP id p2csp908277lja; Wed, 28 Feb 2018 03:27:21 -0800 (PST) X-Google-Smtp-Source: AG47ELt0fjGz1LiK2u2fbzYPH/XNFn2cQAmU0n1LCvPhR3oZJn4A9FVvB1TE+iwBh7WjrPpUv6ln X-Received: by 2002:a17:902:20eb:: with SMTP id v40-v6mr2060778plg.360.1519817241277; Wed, 28 Feb 2018 03:27:21 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1519817241; cv=none; d=google.com; s=arc-20160816; b=PRqazT4w/OdxqJKJS78Hnioc3GKztTE56Vpa3DghmJU6O6OqZh/Jag8c+xKMEp79wH VoZsCaQvS8MxJC1sNE9FW31+8YcZkFNX74P16RyiP8Qqul7P4rj2WPfx0hHWaR4b1drE oBycb1L8BNoQ/fnqfryju97W/0z3fLu6WQedEbTWP4qXqr578duwiyQbHhNDbWqpXP/I 7B0Uzi1o1tFIvzDOH9aUElCFFq5zKST35Th2wCfuVV6dl+dYJIPkESO7iMGOW5cDV3Vq 8WK5XZei8j1hwiLgjjWak2GdLpeOXKKq2wvz4gPgKLH0DpfC4LdV7rcEwlsdRQ3WtpdZ EFNA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:cc:list-subscribe :list-help:list-post:list-archive:list-unsubscribe:list-id :precedence:mime-version:references:in-reply-to:message-id:date :subject:to:from:dkim-signature:delivered-to :arc-authentication-results; bh=Fty4E14tAgvth6dGmT1eKO60zqBir8VfgwOUiDXqStM=; b=1En7RymhDTvT7qv498Mk0RfxXS0lDTfw858DwbGfWraZDyDyLixsW1rRZ+7GFWSZaN 1IUt5szZhNEZgKsSmdNNVK0icO1rKj4RvTVxi83c49ClVS8+p8de9nDjfcpnlbOf1wzm WUZ2hNB/Wh5uVupAbV5AYwoT838WsJ/Ai3oWfvZ7lMkzEEomSqZxrvzZOvDw95NqosTq vXmhKPvH7REMQYuHXaC444FBrQmwfAbaUtJenTupLEuYliwTaB49PzdHq6475LvhbiOi IglRNZUSA22ubnKDwpVEhCwFmt3w9IVQiY6D6la0GW/ywQXNrk//R844BBF3cQ6gxt3k 4ZAQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@ti.com header.s=ti-com-17Q1 header.b=dwoGt80E; spf=pass (google.com: best guess record for domain of dri-devel-bounces@lists.freedesktop.org designates 131.252.210.177 as permitted sender) smtp.mailfrom=dri-devel-bounces@lists.freedesktop.org; dmarc=fail (p=QUARANTINE sp=NONE dis=NONE) header.from=ti.com Return-Path: Received: from gabe.freedesktop.org (gabe.freedesktop.org. [131.252.210.177]) by mx.google.com with ESMTPS id p1si918941pgc.280.2018.02.28.03.27.21 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Wed, 28 Feb 2018 03:27:21 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of dri-devel-bounces@lists.freedesktop.org designates 131.252.210.177 as permitted sender) client-ip=131.252.210.177; Authentication-Results: mx.google.com; dkim=neutral (body hash did not verify) header.i=@ti.com header.s=ti-com-17Q1 header.b=dwoGt80E; spf=pass (google.com: best guess record for domain of dri-devel-bounces@lists.freedesktop.org designates 131.252.210.177 as permitted sender) smtp.mailfrom=dri-devel-bounces@lists.freedesktop.org; dmarc=fail (p=QUARANTINE sp=NONE dis=NONE) header.from=ti.com Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 9D89E6E91C; Wed, 28 Feb 2018 11:27:19 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from lelnx194.ext.ti.com (lelnx194.ext.ti.com [198.47.27.80]) by gabe.freedesktop.org (Postfix) with ESMTPS id 9AF646E092 for ; Wed, 28 Feb 2018 11:27:17 +0000 (UTC) Received: from dlelxv90.itg.ti.com ([172.17.2.17]) by lelnx194.ext.ti.com (8.15.1/8.15.1) with ESMTP id w1SBRFMF004149; Wed, 28 Feb 2018 05:27:15 -0600 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ti.com; s=ti-com-17Q1; t=1519817235; bh=joxRxt8RvGGK2WtUY0f89WEIRpK6lujjYbTFsQwaZbM=; h=From:To:CC:Subject:Date:In-Reply-To:References; b=dwoGt80EDCsXi7nyyJdu3DWfgsMLXVCkP0FqYv5GDJEjbfMGXrrpy1i1zNh1r09a8 xI9sHumtEPzxMZH96cHXnrhz9wVy9hgYrZLGkKmlzho78xTNM/KofCWncIJGYYKYVw IqQ7lljwYUstutokmfTYhFvOYEyKF0jhTVz8gMfE= Received: from DLEE110.ent.ti.com (dlee110.ent.ti.com [157.170.170.21]) by dlelxv90.itg.ti.com (8.14.3/8.13.8) with ESMTP id w1SBRFGF031240; Wed, 28 Feb 2018 05:27:15 -0600 Received: from DLEE104.ent.ti.com (157.170.170.34) by DLEE110.ent.ti.com (157.170.170.21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1261.35; Wed, 28 Feb 2018 05:27:14 -0600 Received: from dflp32.itg.ti.com (10.64.6.15) by DLEE104.ent.ti.com (157.170.170.34) with Microsoft SMTP Server (version=TLS1_0, cipher=TLS_RSA_WITH_AES_256_CBC_SHA) id 15.1.1261.35 via Frontend Transport; Wed, 28 Feb 2018 05:27:14 -0600 Received: from deskari.ti.com (ileax41-snat.itg.ti.com [10.172.224.153]) by dflp32.itg.ti.com (8.14.3/8.13.8) with ESMTP id w1SBRAfK024563; Wed, 28 Feb 2018 05:27:13 -0600 From: Tomi Valkeinen To: , Laurent Pinchart Subject: [PATCHv2 01/17] drm/omap: fix omap_fbdev_free() when omap_fbdev_create() wasn't called Date: Wed, 28 Feb 2018 13:25:58 +0200 Message-ID: <1519817174-20714-2-git-send-email-tomi.valkeinen@ti.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1519817174-20714-1-git-send-email-tomi.valkeinen@ti.com> References: <1519817174-20714-1-git-send-email-tomi.valkeinen@ti.com> MIME-Version: 1.0 X-EXCLAIMER-MD-CONFIG: e1e8a2fd-e40a-4ac6-ac9b-f7e9cc9ee180 X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Peter Ujfalusi , Tomi Valkeinen , Jyri Sarha Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" If we have no crtcs/connectors, fbdev init goes fine, but omap_fbdev_create() is never called. This means that omap_fbdev->bo is NULL and omap_fbdev_free() crashes. Add a check to omap_fbdev_free() to handle the NULL case. Signed-off-by: Tomi Valkeinen Reviewed-by: Laurent Pinchart Reviewed-by: Sebastian Reichel --- drivers/gpu/drm/omapdrm/omap_fbdev.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/gpu/drm/omapdrm/omap_fbdev.c b/drivers/gpu/drm/omapdrm/omap_fbdev.c index 1ace63e2ff22..632ebcf2165f 100644 --- a/drivers/gpu/drm/omapdrm/omap_fbdev.c +++ b/drivers/gpu/drm/omapdrm/omap_fbdev.c @@ -303,7 +303,8 @@ void omap_fbdev_free(struct drm_device *dev) fbdev = to_omap_fbdev(priv->fbdev); /* unpin the GEM object pinned in omap_fbdev_create() */ - omap_gem_unpin(fbdev->bo); + if (fbdev->bo) + omap_gem_unpin(fbdev->bo); /* this will free the backing object */ if (fbdev->fb) From patchwork Wed Feb 28 11:25:59 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tomi Valkeinen X-Patchwork-Id: 129949 Delivered-To: patch@linaro.org Received: by 10.46.66.2 with SMTP id p2csp908296lja; Wed, 28 Feb 2018 03:27:24 -0800 (PST) X-Google-Smtp-Source: AH8x225q/dRwnBcBWbfitwhXSwDPICIAZXBbenM29XqPaE97WNn82Uw+a73qqCki+SfRu9yokd3l X-Received: by 10.101.102.83 with SMTP id z19mr13669019pgv.75.1519817243965; Wed, 28 Feb 2018 03:27:23 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1519817243; cv=none; d=google.com; s=arc-20160816; b=l3giBTq7ByRgeoNjWxYmAAEd3KvoUJgUvv2KGZHnZmhKi2XHXeW4SkEByxXx2T3nRE VJfr2DZIvmDlzh/5f6YOf01xLyCPUku3UT0FvXgHF1i7EhYGlhmxprKlrfoaCi3onfsS LQdp4iup00Pdbgpr2Ph1bC1d43YDkDtaj20qChqGnXZuy9T4bTNtZH/C3n/fZXhLeGdb 5zNk5VM6vN2oJhO23VrYaSBpnUpNaVDxdLseD36WVdGcKh4lXzeUp1kA1JeN/7yhBztS /sApFByGjESfepzTJ5f/wRgZ+b+pUwwNFxuty64erjDdOc318utarGHzNruR54nxu3VB SFUA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:cc:list-subscribe :list-help:list-post:list-archive:list-unsubscribe:list-id :precedence:mime-version:references:in-reply-to:message-id:date :subject:to:from:dkim-signature:delivered-to :arc-authentication-results; bh=pTpaBuSDe9Z61TgP1Q7kcOHiuzuJlXwQ/PPKHPbPK1M=; b=SSBgt98Km5afNzEw+XWgZKuBvfBnpQh07Hk7GJHIh5VIafvUI2H1RTARNXEq2ZDP5f XpsdrCISTCZDsY8JvzzHhcXKWuR5NhnGUga/YSXzGE5WInTGN139k/mzviTLW8CKF1g4 i9Pi9eDEA94fiQ870SCmKj+vBhjoCFB4i7DRkGcBwZdGY3dnqvzDBRRyvTKNo2E66yH7 BIamu9lIWNKC/SqfBdXvuG2SqJyvSESphPguQkV0WloNRZX03PLW6aUxDAKIQ+FpFdJw qcdeWgB+Y4Laqcs+2s1iu6dviDuCOjDGWGyvTjySwYeBT+UW1xUO22bM/FJuY7NoKMf3 CFNw== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@ti.com header.s=ti-com-17Q1 header.b=OxvVqR0T; spf=pass (google.com: best guess record for domain of dri-devel-bounces@lists.freedesktop.org designates 131.252.210.177 as permitted sender) smtp.mailfrom=dri-devel-bounces@lists.freedesktop.org; dmarc=fail (p=QUARANTINE sp=NONE dis=NONE) header.from=ti.com Return-Path: Received: from gabe.freedesktop.org (gabe.freedesktop.org. [131.252.210.177]) by mx.google.com with ESMTPS id n18si1111941pfj.58.2018.02.28.03.27.23 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Wed, 28 Feb 2018 03:27:23 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of dri-devel-bounces@lists.freedesktop.org designates 131.252.210.177 as permitted sender) client-ip=131.252.210.177; Authentication-Results: mx.google.com; dkim=neutral (body hash did not verify) header.i=@ti.com header.s=ti-com-17Q1 header.b=OxvVqR0T; spf=pass (google.com: best guess record for domain of dri-devel-bounces@lists.freedesktop.org designates 131.252.210.177 as permitted sender) smtp.mailfrom=dri-devel-bounces@lists.freedesktop.org; dmarc=fail (p=QUARANTINE sp=NONE dis=NONE) header.from=ti.com Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 89ABD6E932; Wed, 28 Feb 2018 11:27:22 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from fllnx210.ext.ti.com (fllnx210.ext.ti.com [198.47.19.17]) by gabe.freedesktop.org (Postfix) with ESMTPS id 653D16E91C for ; Wed, 28 Feb 2018 11:27:19 +0000 (UTC) Received: from dlelxv90.itg.ti.com ([172.17.2.17]) by fllnx210.ext.ti.com (8.15.1/8.15.1) with ESMTP id w1SBRGXc022633; Wed, 28 Feb 2018 05:27:16 -0600 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ti.com; s=ti-com-17Q1; t=1519817236; bh=q3s8UvUGhwHyoGixXaAQxgK1VCfv0+/cZ8/7aoyZnCc=; h=From:To:CC:Subject:Date:In-Reply-To:References; b=OxvVqR0TRlP9luSiNyNKGP4wn2E2jkZ0GYt2BryLLDEKojuvOD5ekiubz6p32K8wD ZXzvDtlcPtKzphwPo8kfE4r7TwPHtLjywUgPqJxzkvh/6a/Bn2hgzyY8sO7nZgpxL1 SyNhVyA99uVfA0P9dE0Kdb0FrWZU+iunUe0DxSIk= Received: from DFLE113.ent.ti.com (dfle113.ent.ti.com [10.64.6.34]) by dlelxv90.itg.ti.com (8.14.3/8.13.8) with ESMTP id w1SBRGRx031282; Wed, 28 Feb 2018 05:27:16 -0600 Received: from DFLE114.ent.ti.com (10.64.6.35) by DFLE113.ent.ti.com (10.64.6.34) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1261.35; Wed, 28 Feb 2018 05:27:16 -0600 Received: from dflp32.itg.ti.com (10.64.6.15) by DFLE114.ent.ti.com (10.64.6.35) with Microsoft SMTP Server (version=TLS1_0, cipher=TLS_RSA_WITH_AES_256_CBC_SHA) id 15.1.1261.35 via Frontend Transport; Wed, 28 Feb 2018 05:27:16 -0600 Received: from deskari.ti.com (ileax41-snat.itg.ti.com [10.172.224.153]) by dflp32.itg.ti.com (8.14.3/8.13.8) with ESMTP id w1SBRAfL024563; Wed, 28 Feb 2018 05:27:15 -0600 From: Tomi Valkeinen To: , Laurent Pinchart Subject: [PATCHv2 02/17] drm/omap: cleanup fbdev init/free Date: Wed, 28 Feb 2018 13:25:59 +0200 Message-ID: <1519817174-20714-3-git-send-email-tomi.valkeinen@ti.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1519817174-20714-1-git-send-email-tomi.valkeinen@ti.com> References: <1519817174-20714-1-git-send-email-tomi.valkeinen@ti.com> MIME-Version: 1.0 X-EXCLAIMER-MD-CONFIG: e1e8a2fd-e40a-4ac6-ac9b-f7e9cc9ee180 X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Peter Ujfalusi , Tomi Valkeinen , Jyri Sarha Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" omap_fbdev_init() and omap_fbdev_free() use priv->fbdev directly. However, omap_fbdev_init() returns the fbdev, and omap_drv.c also assigns the return value to priv->fbdev. This is slightly confusing. Clean this up by removing the omap_fbdev_init() return value, as we don't care whether fbdev init succeeded or not. Also change omap_drv.c to call omap_fbdev_free() always, and omap_fbdev_free() does the check if fbdev was initialized. While at it, rename omap_fbdev_free() to omap_fbdev_fini() to better match the "init" counterpart. Signed-off-by: Tomi Valkeinen Reviewed-by: Laurent Pinchart Reviewed-by: Sebastian Reichel --- drivers/gpu/drm/omapdrm/omap_drv.c | 9 ++++----- drivers/gpu/drm/omapdrm/omap_fbdev.c | 18 ++++++++---------- drivers/gpu/drm/omapdrm/omap_fbdev.h | 9 ++++----- 3 files changed, 16 insertions(+), 20 deletions(-) diff --git a/drivers/gpu/drm/omapdrm/omap_drv.c b/drivers/gpu/drm/omapdrm/omap_drv.c index 65a567dcf3ab..4f48b908bdc6 100644 --- a/drivers/gpu/drm/omapdrm/omap_drv.c +++ b/drivers/gpu/drm/omapdrm/omap_drv.c @@ -570,7 +570,7 @@ static int omapdrm_init(struct omap_drm_private *priv, struct device *dev) for (i = 0; i < priv->num_crtcs; i++) drm_crtc_vblank_off(priv->crtcs[i]); - priv->fbdev = omap_fbdev_init(ddev); + omap_fbdev_init(ddev); drm_kms_helper_poll_init(ddev); omap_modeset_enable_external_hpd(); @@ -588,8 +588,8 @@ static int omapdrm_init(struct omap_drm_private *priv, struct device *dev) err_cleanup_helpers: omap_modeset_disable_external_hpd(); drm_kms_helper_poll_fini(ddev); - if (priv->fbdev) - omap_fbdev_free(ddev); + + omap_fbdev_fini(ddev); err_cleanup_modeset: drm_mode_config_cleanup(ddev); omap_drm_irq_uninstall(ddev); @@ -615,8 +615,7 @@ static void omapdrm_cleanup(struct omap_drm_private *priv) omap_modeset_disable_external_hpd(); drm_kms_helper_poll_fini(ddev); - if (priv->fbdev) - omap_fbdev_free(ddev); + omap_fbdev_fini(ddev); drm_atomic_helper_shutdown(ddev); diff --git a/drivers/gpu/drm/omapdrm/omap_fbdev.c b/drivers/gpu/drm/omapdrm/omap_fbdev.c index 632ebcf2165f..be94480326d7 100644 --- a/drivers/gpu/drm/omapdrm/omap_fbdev.c +++ b/drivers/gpu/drm/omapdrm/omap_fbdev.c @@ -242,7 +242,7 @@ static struct drm_fb_helper *get_fb(struct fb_info *fbi) } /* initialize fbdev helper */ -struct drm_fb_helper *omap_fbdev_init(struct drm_device *dev) +void omap_fbdev_init(struct drm_device *dev) { struct omap_drm_private *priv = dev->dev_private; struct omap_fbdev *fbdev = NULL; @@ -260,10 +260,8 @@ struct drm_fb_helper *omap_fbdev_init(struct drm_device *dev) drm_fb_helper_prepare(dev, helper, &omap_fb_helper_funcs); ret = drm_fb_helper_init(dev, helper, priv->num_connectors); - if (ret) { - dev_err(dev->dev, "could not init fbdev: ret=%d\n", ret); + if (ret) goto fail; - } ret = drm_fb_helper_single_add_all_connectors(helper); if (ret) @@ -275,7 +273,7 @@ struct drm_fb_helper *omap_fbdev_init(struct drm_device *dev) priv->fbdev = helper; - return helper; + return; fini: drm_fb_helper_fini(helper); @@ -283,12 +281,9 @@ struct drm_fb_helper *omap_fbdev_init(struct drm_device *dev) kfree(fbdev); dev_warn(dev->dev, "omap_fbdev_init failed\n"); - /* well, limp along without an fbdev.. maybe X11 will work? */ - - return NULL; } -void omap_fbdev_free(struct drm_device *dev) +void omap_fbdev_fini(struct drm_device *dev) { struct omap_drm_private *priv = dev->dev_private; struct drm_fb_helper *helper = priv->fbdev; @@ -296,11 +291,14 @@ void omap_fbdev_free(struct drm_device *dev) DBG(); + if (!helper) + return; + drm_fb_helper_unregister_fbi(helper); drm_fb_helper_fini(helper); - fbdev = to_omap_fbdev(priv->fbdev); + fbdev = to_omap_fbdev(helper); /* unpin the GEM object pinned in omap_fbdev_create() */ if (fbdev->bo) diff --git a/drivers/gpu/drm/omapdrm/omap_fbdev.h b/drivers/gpu/drm/omapdrm/omap_fbdev.h index 1f5ba0996a1a..7dfd843f73f1 100644 --- a/drivers/gpu/drm/omapdrm/omap_fbdev.h +++ b/drivers/gpu/drm/omapdrm/omap_fbdev.h @@ -24,14 +24,13 @@ struct drm_device; struct drm_fb_helper; #ifdef CONFIG_DRM_FBDEV_EMULATION -struct drm_fb_helper *omap_fbdev_init(struct drm_device *dev); -void omap_fbdev_free(struct drm_device *dev); +void omap_fbdev_init(struct drm_device *dev); +void omap_fbdev_fini(struct drm_device *dev); #else -static inline struct drm_fb_helper *omap_fbdev_init(struct drm_device *dev) +static inline void omap_fbdev_init(struct drm_device *dev) { - return NULL; } -static inline void omap_fbdev_free(struct drm_device *dev) +static inline void omap_fbdev_fini(struct drm_device *dev) { } #endif From patchwork Wed Feb 28 11:26:00 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tomi Valkeinen X-Patchwork-Id: 129954 Delivered-To: patch@linaro.org Received: by 10.46.66.2 with SMTP id p2csp908789lja; Wed, 28 Feb 2018 03:27:56 -0800 (PST) X-Google-Smtp-Source: AH8x227xXaalucmQkog3m/dxJ/8JX+raMsGqo9+o58vxfViJj5WPVDATpqJRuaPxIUwtGTrNpwAz X-Received: by 10.98.36.25 with SMTP id r25mr17552470pfj.106.1519817276459; Wed, 28 Feb 2018 03:27:56 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1519817276; cv=none; d=google.com; s=arc-20160816; b=M21jMXU9N/fcWcMGSFzWR4GwxKY/PSsdoNbGNOX578BognyQRLgkADyzGqcDQtiOZn ML9S/TMpQCanFTgMvqeBdNqA2+Fv6845L6AeGuepZ493GvQo6BJcPZ1JUd1pIx5JFX3b JDUPkZvGGPs1rmJ0SrR2PE3CtlFI7WQgyzcvaHhozDwCNyY8jyLGLSNOtVyC+FaIClra wY7tKP7Fhwg/xTUxa43QaPSqgFPz5Xf4PBjfSv2a1I2KJAgN+5e54Ve2djfpwuEdAXs/ pGhu/LeBDAZAftDkl4NRK+sau4AEBrh7zlIf61yoJZRyaURjztI6ptGVeoeLGcLgQ4KV v6Sg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:cc:list-subscribe :list-help:list-post:list-archive:list-unsubscribe:list-id :precedence:mime-version:references:in-reply-to:message-id:date :subject:to:from:dkim-signature:delivered-to :arc-authentication-results; bh=TAikGPWqdIR/2tK5ABChytXxxZGaUIg18tEDn33wo3k=; b=fzHXes4SGlhRDGxzgRPvjQnKrwKu4lLUOi6XllbBtYhpMALZqqAMB6MXzjdhso6Btc 4TImGPFruix17N8H8eACmIuSdMll77AfOiz5jbZ5CIOGI/i5mbVad3i88KUJlQdjJP3Z B0GA4eXbm/9QEqK6gVqJpd7pee19ST0zDwqVuzfoJbgvjwB8Wov95wFAiw856/fsuTUz iqTBuXyerFLgOhx8ShPhqtt6LEDSKqANWvVAJAkXynnOBD0lsEgKTiJf8t15iRYu5ZjD LHciC3ygRjkRhi8s3IUKCy93AMlQ7UgMrSqlQTylo1RPwasvm8xlQPGYZDVuzKbOmj3p h04A== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@ti.com header.s=ti-com-17Q1 header.b=smGZ4acm; spf=pass (google.com: best guess record for domain of dri-devel-bounces@lists.freedesktop.org designates 131.252.210.177 as permitted sender) smtp.mailfrom=dri-devel-bounces@lists.freedesktop.org; dmarc=fail (p=QUARANTINE sp=NONE dis=NONE) header.from=ti.com Return-Path: Received: from gabe.freedesktop.org (gabe.freedesktop.org. [131.252.210.177]) by mx.google.com with ESMTPS id m7-v6si1170025pln.711.2018.02.28.03.27.56 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Wed, 28 Feb 2018 03:27:56 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of dri-devel-bounces@lists.freedesktop.org designates 131.252.210.177 as permitted sender) client-ip=131.252.210.177; Authentication-Results: mx.google.com; dkim=neutral (body hash did not verify) header.i=@ti.com header.s=ti-com-17Q1 header.b=smGZ4acm; spf=pass (google.com: best guess record for domain of dri-devel-bounces@lists.freedesktop.org designates 131.252.210.177 as permitted sender) smtp.mailfrom=dri-devel-bounces@lists.freedesktop.org; dmarc=fail (p=QUARANTINE sp=NONE dis=NONE) header.from=ti.com Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 7B99F6E949; Wed, 28 Feb 2018 11:27:24 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from fllnx210.ext.ti.com (fllnx210.ext.ti.com [198.47.19.17]) by gabe.freedesktop.org (Postfix) with ESMTPS id 2C9BD6E932 for ; Wed, 28 Feb 2018 11:27:21 +0000 (UTC) Received: from dflxv15.itg.ti.com ([128.247.5.124]) by fllnx210.ext.ti.com (8.15.1/8.15.1) with ESMTP id w1SBRJS4022672; Wed, 28 Feb 2018 05:27:19 -0600 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ti.com; s=ti-com-17Q1; t=1519817239; bh=NijU3khfKFvANNKOBu7MRHgFcjGtSAgk7jJsOCBA0AM=; h=From:To:CC:Subject:Date:In-Reply-To:References; b=smGZ4acmsppj+OQ7p94sBMktc7wWsiLdc0nqkD2Yk2YbMqqh32la/oS1XInMqf3rr dWHKj14zTPCD+k/dxhc9Y/SRmh3FnY5Y+Au+3XKx9oLYuPDKyJhef+NQm0ZVe6HFe8 cN+Up0ZkWbntcF2+88hitv67gz6zLKxevf7xrR1E= Received: from DFLE115.ent.ti.com (dfle115.ent.ti.com [10.64.6.36]) by dflxv15.itg.ti.com (8.14.3/8.13.8) with ESMTP id w1SBRJrd021187; Wed, 28 Feb 2018 05:27:19 -0600 Received: from DFLE110.ent.ti.com (10.64.6.31) by DFLE115.ent.ti.com (10.64.6.36) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1261.35; Wed, 28 Feb 2018 05:27:18 -0600 Received: from dflp32.itg.ti.com (10.64.6.15) by DFLE110.ent.ti.com (10.64.6.31) with Microsoft SMTP Server (version=TLS1_0, cipher=TLS_RSA_WITH_AES_256_CBC_SHA) id 15.1.1261.35 via Frontend Transport; Wed, 28 Feb 2018 05:27:18 -0600 Received: from deskari.ti.com (ileax41-snat.itg.ti.com [10.172.224.153]) by dflp32.itg.ti.com (8.14.3/8.13.8) with ESMTP id w1SBRAfM024563; Wed, 28 Feb 2018 05:27:16 -0600 From: Tomi Valkeinen To: , Laurent Pinchart Subject: [PATCHv2 03/17] drm/omap: Init fbdev emulation only when we have displays Date: Wed, 28 Feb 2018 13:26:00 +0200 Message-ID: <1519817174-20714-4-git-send-email-tomi.valkeinen@ti.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1519817174-20714-1-git-send-email-tomi.valkeinen@ti.com> References: <1519817174-20714-1-git-send-email-tomi.valkeinen@ti.com> MIME-Version: 1.0 X-EXCLAIMER-MD-CONFIG: e1e8a2fd-e40a-4ac6-ac9b-f7e9cc9ee180 X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Peter Ujfalusi , Tomi Valkeinen , Jyri Sarha Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" From: Peter Ujfalusi Do not try to init the fbdev if either num_crtcs or num_connectors is 0. In this case we do not have display so the fbdev init would fail anyways. Signed-off-by: Peter Ujfalusi Signed-off-by: Tomi Valkeinen Reviewed-by: Laurent Pinchart Reviewed-by: Sebastian Reichel --- drivers/gpu/drm/omapdrm/omap_fbdev.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/drivers/gpu/drm/omapdrm/omap_fbdev.c b/drivers/gpu/drm/omapdrm/omap_fbdev.c index be94480326d7..0f66c74a54b0 100644 --- a/drivers/gpu/drm/omapdrm/omap_fbdev.c +++ b/drivers/gpu/drm/omapdrm/omap_fbdev.c @@ -249,6 +249,9 @@ void omap_fbdev_init(struct drm_device *dev) struct drm_fb_helper *helper; int ret = 0; + if (!priv->num_crtcs || !priv->num_connectors) + return; + fbdev = kzalloc(sizeof(*fbdev), GFP_KERNEL); if (!fbdev) goto fail; From patchwork Wed Feb 28 11:26:01 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tomi Valkeinen X-Patchwork-Id: 129951 Delivered-To: patch@linaro.org Received: by 10.46.66.2 with SMTP id p2csp908375lja; Wed, 28 Feb 2018 03:27:28 -0800 (PST) X-Google-Smtp-Source: AH8x227KRsZX0G1g+r1b4wBgaIM+O9kfgh9ozKykBd4ug4IGKgoZxuXdSCNgwsponcGq7pdBMmlS X-Received: by 2002:a17:902:a504:: with SMTP id s4-v6mr18124597plq.43.1519817248448; Wed, 28 Feb 2018 03:27:28 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1519817248; cv=none; d=google.com; s=arc-20160816; b=PaS7/GDXME8lrlh2lLqfZWIh0mMEDOsOO0HdXnYctdYzY6yrRVkJVrcWTJCutwCSiB kgNZIaEc7aIIr61Xcvr1q4zKyAqAV6prsh+KuMoaXPaP2M+7YsXvM+JV26hyy5OrFzlF DpduG7UwTCmoe2ewknmrzNBSCzirUewjMmXIruYX/DQegZ/nQPLlstPt0zf+3ktEURgi 6lfzO/IlwdvNbYSW8iiCzrQJjt6n2h+cwRFLIeLCt6RcXYRg3iHAX4UkcZM2LPQdZfzN Vc2/cUMCpWEy9erlkxs29CM7lRFO9POXpLxcVKR9YeS3OoB+c4Ip8ionorRsOV3i3Pga qqaQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:cc:list-subscribe :list-help:list-post:list-archive:list-unsubscribe:list-id :precedence:mime-version:references:in-reply-to:message-id:date :subject:to:from:dkim-signature:delivered-to :arc-authentication-results; bh=IURT7dWMv971UMOe7PeheOyQ86niUnKQeZ2yYLO5VKA=; b=EZ1x5WfKr/Ik/JMRBsTxCaupCIgahajDA2ZZLI0aYMpsQwMjiiP7d+VBBvP6ZEEP4q lmsF3sobpKlCRuUY4IQdzKJAX+iJX9+3od7boW1ZxPnsP3gMxPIaLzMCRaDMwmHJwQO+ bgPah9RmCk8UzBiyaKjXhocnigKyFVbqbKHsG6D/PNzxxL47Bk3YR1tFX5IT8T+l6+Ma yztnd7TE1B0GravsYEhFvRIdaq831N3KRg65bMwZi6WrG731BjYhu/8lz/yQ6nPJi+8I FXT7U1C4eH/LAzKgqa0y//pkZ0KKXECUH4HzfgE2ObttJZ/RANy8o8zvwPWlQUBUd5hH 5WjQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@ti.com header.s=ti-com-17Q1 header.b=fKDeDKsw; spf=pass (google.com: best guess record for domain of dri-devel-bounces@lists.freedesktop.org designates 131.252.210.177 as permitted sender) smtp.mailfrom=dri-devel-bounces@lists.freedesktop.org; dmarc=fail (p=QUARANTINE sp=NONE dis=NONE) header.from=ti.com Return-Path: Received: from gabe.freedesktop.org (gabe.freedesktop.org. [131.252.210.177]) by mx.google.com with ESMTPS id y7si916062pgv.128.2018.02.28.03.27.28 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Wed, 28 Feb 2018 03:27:28 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of dri-devel-bounces@lists.freedesktop.org designates 131.252.210.177 as permitted sender) client-ip=131.252.210.177; Authentication-Results: mx.google.com; dkim=neutral (body hash did not verify) header.i=@ti.com header.s=ti-com-17Q1 header.b=fKDeDKsw; spf=pass (google.com: best guess record for domain of dri-devel-bounces@lists.freedesktop.org designates 131.252.210.177 as permitted sender) smtp.mailfrom=dri-devel-bounces@lists.freedesktop.org; dmarc=fail (p=QUARANTINE sp=NONE dis=NONE) header.from=ti.com Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 412936E94C; Wed, 28 Feb 2018 11:27:25 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from fllnx210.ext.ti.com (fllnx210.ext.ti.com [198.47.19.17]) by gabe.freedesktop.org (Postfix) with ESMTPS id CA0516E944 for ; Wed, 28 Feb 2018 11:27:22 +0000 (UTC) Received: from dflxv15.itg.ti.com ([128.247.5.124]) by fllnx210.ext.ti.com (8.15.1/8.15.1) with ESMTP id w1SBRKqH022742; Wed, 28 Feb 2018 05:27:20 -0600 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ti.com; s=ti-com-17Q1; t=1519817240; bh=i+PHKG2uwsQ7b9ii7UX4dqXmq8VcypMwQsMFRRHFcJI=; h=From:To:CC:Subject:Date:In-Reply-To:References; b=fKDeDKswAR8SKe+zDYNYdg0aqPq52gUF/2QHiF3mrZgqcUS9tEtZRT1YtkbP1AYKu +7kFLHboU0fwVFuZjNVDg0Mj4yZVqN+g/KD5a4Fc3MuYY9qoNERaXzFsbTb5iPqRi/ fWDIcB/mGUmAoKeXpq7pZMAPQxxRDUYErRXrcWro= Received: from DLEE110.ent.ti.com (dlee110.ent.ti.com [157.170.170.21]) by dflxv15.itg.ti.com (8.14.3/8.13.8) with ESMTP id w1SBRKEh021208; Wed, 28 Feb 2018 05:27:20 -0600 Received: from DLEE110.ent.ti.com (157.170.170.21) by DLEE110.ent.ti.com (157.170.170.21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1261.35; Wed, 28 Feb 2018 05:27:20 -0600 Received: from dflp32.itg.ti.com (10.64.6.15) by DLEE110.ent.ti.com (157.170.170.21) with Microsoft SMTP Server (version=TLS1_0, cipher=TLS_RSA_WITH_AES_256_CBC_SHA) id 15.1.1261.35 via Frontend Transport; Wed, 28 Feb 2018 05:27:20 -0600 Received: from deskari.ti.com (ileax41-snat.itg.ti.com [10.172.224.153]) by dflp32.itg.ti.com (8.14.3/8.13.8) with ESMTP id w1SBRAfN024563; Wed, 28 Feb 2018 05:27:18 -0600 From: Tomi Valkeinen To: , Laurent Pinchart Subject: [PATCHv2 04/17] drm/omap: add HPD support to connector-dvi Date: Wed, 28 Feb 2018 13:26:01 +0200 Message-ID: <1519817174-20714-5-git-send-email-tomi.valkeinen@ti.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1519817174-20714-1-git-send-email-tomi.valkeinen@ti.com> References: <1519817174-20714-1-git-send-email-tomi.valkeinen@ti.com> MIME-Version: 1.0 X-EXCLAIMER-MD-CONFIG: e1e8a2fd-e40a-4ac6-ac9b-f7e9cc9ee180 X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Peter Ujfalusi , Tomi Valkeinen , Jyri Sarha Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" Add HPD support to the DVI connector driver. The code is almost identical to the HPD code in the HDMI connector driver. Signed-off-by: Tomi Valkeinen Reviewed-by: Laurent Pinchart Reviewed-by: Sebastian Reichel --- drivers/gpu/drm/omapdrm/displays/connector-dvi.c | 118 +++++++++++++++++++++++ 1 file changed, 118 insertions(+) diff --git a/drivers/gpu/drm/omapdrm/displays/connector-dvi.c b/drivers/gpu/drm/omapdrm/displays/connector-dvi.c index 391d80364346..6d8cbd9e2110 100644 --- a/drivers/gpu/drm/omapdrm/displays/connector-dvi.c +++ b/drivers/gpu/drm/omapdrm/displays/connector-dvi.c @@ -9,6 +9,7 @@ * the Free Software Foundation. */ +#include #include #include #include @@ -44,6 +45,14 @@ struct panel_drv_data { struct videomode vm; struct i2c_adapter *i2c_adapter; + + struct gpio_desc *hpd_gpio; + + void (*hpd_cb)(void *cb_data, enum drm_connector_status status); + void *hpd_cb_data; + bool hpd_enabled; + /* mutex for hpd fields above */ + struct mutex hpd_lock; }; #define to_panel_data(x) container_of(x, struct panel_drv_data, dssdev) @@ -189,6 +198,9 @@ static int dvic_read_edid(struct omap_dss_device *dssdev, struct panel_drv_data *ddata = to_panel_data(dssdev); int r, l, bytes_read; + if (ddata->hpd_gpio && !gpiod_get_value_cansleep(ddata->hpd_gpio)) + return -ENODEV; + if (!ddata->i2c_adapter) return -ENODEV; @@ -220,6 +232,9 @@ static bool dvic_detect(struct omap_dss_device *dssdev) unsigned char out; int r; + if (ddata->hpd_gpio) + return gpiod_get_value_cansleep(ddata->hpd_gpio); + if (!ddata->i2c_adapter) return true; @@ -228,6 +243,60 @@ static bool dvic_detect(struct omap_dss_device *dssdev) return r == 0; } +static int dvic_register_hpd_cb(struct omap_dss_device *dssdev, + void (*cb)(void *cb_data, + enum drm_connector_status status), + void *cb_data) +{ + struct panel_drv_data *ddata = to_panel_data(dssdev); + + if (!ddata->hpd_gpio) + return -ENOTSUPP; + + mutex_lock(&ddata->hpd_lock); + ddata->hpd_cb = cb; + ddata->hpd_cb_data = cb_data; + mutex_unlock(&ddata->hpd_lock); + return 0; +} + +static void dvic_unregister_hpd_cb(struct omap_dss_device *dssdev) +{ + struct panel_drv_data *ddata = to_panel_data(dssdev); + + if (!ddata->hpd_gpio) + return; + + mutex_lock(&ddata->hpd_lock); + ddata->hpd_cb = NULL; + ddata->hpd_cb_data = NULL; + mutex_unlock(&ddata->hpd_lock); +} + +static void dvic_enable_hpd(struct omap_dss_device *dssdev) +{ + struct panel_drv_data *ddata = to_panel_data(dssdev); + + if (!ddata->hpd_gpio) + return; + + mutex_lock(&ddata->hpd_lock); + ddata->hpd_enabled = true; + mutex_unlock(&ddata->hpd_lock); +} + +static void dvic_disable_hpd(struct omap_dss_device *dssdev) +{ + struct panel_drv_data *ddata = to_panel_data(dssdev); + + if (!ddata->hpd_gpio) + return; + + mutex_lock(&ddata->hpd_lock); + ddata->hpd_enabled = false; + mutex_unlock(&ddata->hpd_lock); +} + static struct omap_dss_driver dvic_driver = { .connect = dvic_connect, .disconnect = dvic_disconnect, @@ -241,14 +310,60 @@ static struct omap_dss_driver dvic_driver = { .read_edid = dvic_read_edid, .detect = dvic_detect, + + .register_hpd_cb = dvic_register_hpd_cb, + .unregister_hpd_cb = dvic_unregister_hpd_cb, + .enable_hpd = dvic_enable_hpd, + .disable_hpd = dvic_disable_hpd, }; +static irqreturn_t dvic_hpd_isr(int irq, void *data) +{ + struct panel_drv_data *ddata = data; + + mutex_lock(&ddata->hpd_lock); + if (ddata->hpd_enabled && ddata->hpd_cb) { + enum drm_connector_status status; + + if (dvic_detect(&ddata->dssdev)) + status = connector_status_connected; + else + status = connector_status_disconnected; + + ddata->hpd_cb(ddata->hpd_cb_data, status); + } + mutex_unlock(&ddata->hpd_lock); + + return IRQ_HANDLED; +} + static int dvic_probe_of(struct platform_device *pdev) { struct panel_drv_data *ddata = platform_get_drvdata(pdev); struct device_node *node = pdev->dev.of_node; struct device_node *adapter_node; struct i2c_adapter *adapter; + struct gpio_desc *gpio; + int r; + + gpio = devm_gpiod_get_optional(&pdev->dev, "hpd", GPIOD_IN); + if (IS_ERR(gpio)) { + dev_err(&pdev->dev, "failed to parse HPD gpio\n"); + return PTR_ERR(gpio); + } + + ddata->hpd_gpio = gpio; + + mutex_init(&ddata->hpd_lock); + + if (ddata->hpd_gpio) { + r = devm_request_threaded_irq(&pdev->dev, + gpiod_to_irq(ddata->hpd_gpio), NULL, dvic_hpd_isr, + IRQF_TRIGGER_RISING | IRQF_TRIGGER_FALLING | IRQF_ONESHOT, + "DVI HPD", ddata); + if (r) + return r; + } adapter_node = of_parse_phandle(node, "ddc-i2c-bus", 0); if (adapter_node) { @@ -300,6 +415,7 @@ static int dvic_probe(struct platform_device *pdev) err_reg: i2c_put_adapter(ddata->i2c_adapter); + mutex_destroy(&ddata->hpd_lock); return r; } @@ -316,6 +432,8 @@ static int __exit dvic_remove(struct platform_device *pdev) i2c_put_adapter(ddata->i2c_adapter); + mutex_destroy(&ddata->hpd_lock); + return 0; } From patchwork Wed Feb 28 11:26:03 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tomi Valkeinen X-Patchwork-Id: 129957 Delivered-To: patch@linaro.org Received: by 10.46.66.2 with SMTP id p2csp908997lja; Wed, 28 Feb 2018 03:28:10 -0800 (PST) X-Google-Smtp-Source: AH8x2254P+DD3cehsXTmwRTRpo2+xv198i1FD0T5MiulmdzymiatZPiYBDlZNmKztaK1xbTy6NC2 X-Received: by 10.99.39.131 with SMTP id n125mr13924798pgn.292.1519817290740; Wed, 28 Feb 2018 03:28:10 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1519817290; cv=none; d=google.com; s=arc-20160816; b=rxHCSsAjbVVLD27AHa66dtUpKZ6ZYvcCAJHW8nkCp1yPwOEKDHUlOn2aqmgYpKZnwT 80fl+1gzi5DcIt02eDfLK4JHPvmZNgoWaVKbakKVA0UmraN8EkBdYMIaOoZkgPY/REHL aNvHjMHZ9EH5/Xfn4LLeawmehK5N8Cg7uhpir0meRjGs3cDp3NY1XKPW/PXswyrguRZE HKQN3SplJmhdcUlay5I84UxvNY29pTDU6wC7rrjSnl1kosypkcUcrMPQ1U1W9mSvVAgQ IBt1/rKM3w07DxaS2hG4tyKTgYwCGVvl07J9KRslvNBThygkt6O8LS9UcVbgVGxcOdBx gsQg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:cc:list-subscribe :list-help:list-post:list-archive:list-unsubscribe:list-id :precedence:mime-version:references:in-reply-to:message-id:date :subject:to:from:dkim-signature:delivered-to :arc-authentication-results; bh=KcRL4M2F6jJ7cBNklSjoE235Q4u5gENYpgSWvBGwGSU=; b=xoZJinIK7lYeDmzQWXmNm/ndWeV1NNCDPM8n9cg4SnKSQ0KJooFR5gNIdA0LdF/U7f jTGGcZwAPsTGEPCwjvAnvwRk9TNtRmwqznxakc+UCveZyf2SVWp7Cfv7aT5RCTyrFlmJ wUv28hfHBu1gaZzJykIdBUS7p3aNToAw6nNyZBrRDK0cFLj2YCLoyu1XFss1Hpy11vwk rnDG+ncHOkGvt8d8oVSliOqv3nmaSkw2kkbEdb6tI0XyWokVE3scAVnyq4vwvXOR8CN3 4c9qNRI5QqQAi1sEtDzvkhhia3YSRpKsdoylCD/i/Pd/hfLrx7IiCFbiKnSy2nzwJu+m +c4A== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@ti.com header.s=ti-com-17Q1 header.b=WPiIh+bI; spf=pass (google.com: best guess record for domain of dri-devel-bounces@lists.freedesktop.org designates 131.252.210.177 as permitted sender) smtp.mailfrom=dri-devel-bounces@lists.freedesktop.org; dmarc=fail (p=QUARANTINE sp=NONE dis=NONE) header.from=ti.com Return-Path: Received: from gabe.freedesktop.org (gabe.freedesktop.org. [131.252.210.177]) by mx.google.com with ESMTPS id k10si914391pgs.544.2018.02.28.03.28.10 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Wed, 28 Feb 2018 03:28:10 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of dri-devel-bounces@lists.freedesktop.org designates 131.252.210.177 as permitted sender) client-ip=131.252.210.177; Authentication-Results: mx.google.com; dkim=neutral (body hash did not verify) header.i=@ti.com header.s=ti-com-17Q1 header.b=WPiIh+bI; spf=pass (google.com: best guess record for domain of dri-devel-bounces@lists.freedesktop.org designates 131.252.210.177 as permitted sender) smtp.mailfrom=dri-devel-bounces@lists.freedesktop.org; dmarc=fail (p=QUARANTINE sp=NONE dis=NONE) header.from=ti.com Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id DE2AA6E955; Wed, 28 Feb 2018 11:27:29 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from lelnx193.ext.ti.com (lelnx193.ext.ti.com [198.47.27.77]) by gabe.freedesktop.org (Postfix) with ESMTPS id 1D6E56E950 for ; Wed, 28 Feb 2018 11:27:27 +0000 (UTC) Received: from dflxv15.itg.ti.com ([128.247.5.124]) by lelnx193.ext.ti.com (8.15.1/8.15.1) with ESMTP id w1SBRObF008369; Wed, 28 Feb 2018 05:27:24 -0600 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ti.com; s=ti-com-17Q1; t=1519817244; bh=090HOc65j6lthrFK5phRca1PQDuL/OWeOgwSqYCjSF8=; h=From:To:CC:Subject:Date:In-Reply-To:References; b=WPiIh+bIQHwKE3lWRhT6rCPFfBKuEixr7TgaBZZPaqwS/w3P15HIiOW7/bEulsfnt qSGGQULMhH3Mil8M4Ss9UBHWEkcgsgytL5ySxU79olUFaACtri8/5O0Upr6kLUklpD /oFc9kH4G0gLGYfzs8VMGS0VCPUXXN98l/+EWRTI= Received: from DFLE102.ent.ti.com (dfle102.ent.ti.com [10.64.6.23]) by dflxv15.itg.ti.com (8.14.3/8.13.8) with ESMTP id w1SBROJG021257; Wed, 28 Feb 2018 05:27:24 -0600 Received: from DFLE103.ent.ti.com (10.64.6.24) by DFLE102.ent.ti.com (10.64.6.23) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1261.35; Wed, 28 Feb 2018 05:27:24 -0600 Received: from dflp32.itg.ti.com (10.64.6.15) by DFLE103.ent.ti.com (10.64.6.24) with Microsoft SMTP Server (version=TLS1_0, cipher=TLS_RSA_WITH_AES_256_CBC_SHA) id 15.1.1261.35 via Frontend Transport; Wed, 28 Feb 2018 05:27:24 -0600 Received: from deskari.ti.com (ileax41-snat.itg.ti.com [10.172.224.153]) by dflp32.itg.ti.com (8.14.3/8.13.8) with ESMTP id w1SBRAfP024563; Wed, 28 Feb 2018 05:27:22 -0600 From: Tomi Valkeinen To: , Laurent Pinchart Subject: [PATCHv2 06/17] drm/omap: remove leftover enums Date: Wed, 28 Feb 2018 13:26:03 +0200 Message-ID: <1519817174-20714-7-git-send-email-tomi.valkeinen@ti.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1519817174-20714-1-git-send-email-tomi.valkeinen@ti.com> References: <1519817174-20714-1-git-send-email-tomi.valkeinen@ti.com> MIME-Version: 1.0 X-EXCLAIMER-MD-CONFIG: e1e8a2fd-e40a-4ac6-ac9b-f7e9cc9ee180 X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Peter Ujfalusi , Tomi Valkeinen , Jyri Sarha Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" A few enums are not used anywhere, so remove them. Signed-off-by: Tomi Valkeinen Reviewed-by: Laurent Pinchart Reviewed-by: Sebastian Reichel --- drivers/gpu/drm/omapdrm/dss/omapdss.h | 15 --------------- 1 file changed, 15 deletions(-) diff --git a/drivers/gpu/drm/omapdrm/dss/omapdss.h b/drivers/gpu/drm/omapdrm/dss/omapdss.h index a4f71e082c1c..162f36fa3431 100644 --- a/drivers/gpu/drm/omapdrm/dss/omapdss.h +++ b/drivers/gpu/drm/omapdrm/dss/omapdss.h @@ -163,21 +163,6 @@ enum omap_overlay_caps { OMAP_DSS_OVL_CAP_REPLICATION = 1 << 5, }; -enum omap_dss_clk_source { - OMAP_DSS_CLK_SRC_FCK = 0, /* OMAP2/3: DSS1_ALWON_FCLK - * OMAP4: DSS_FCLK */ - OMAP_DSS_CLK_SRC_DSI_PLL_HSDIV_DISPC, /* OMAP3: DSI1_PLL_FCLK - * OMAP4: PLL1_CLK1 */ - OMAP_DSS_CLK_SRC_DSI_PLL_HSDIV_DSI, /* OMAP3: DSI2_PLL_FCLK - * OMAP4: PLL1_CLK2 */ - OMAP_DSS_CLK_SRC_DSI2_PLL_HSDIV_DISPC, /* OMAP4: PLL2_CLK1 */ - OMAP_DSS_CLK_SRC_DSI2_PLL_HSDIV_DSI, /* OMAP4: PLL2_CLK2 */ -}; - -enum omap_hdmi_flags { - OMAP_HDMI_SDA_SCL_EXTERNAL_PULLUP = 1 << 0, -}; - enum omap_dss_output_id { OMAP_DSS_OUTPUT_DPI = 1 << 0, OMAP_DSS_OUTPUT_DBI = 1 << 1, From patchwork Wed Feb 28 11:26:04 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tomi Valkeinen X-Patchwork-Id: 129952 Delivered-To: patch@linaro.org Received: by 10.46.66.2 with SMTP id p2csp908464lja; Wed, 28 Feb 2018 03:27:34 -0800 (PST) X-Google-Smtp-Source: AH8x224WSq/NRD3mjYiqeUsZg5IXGWyW5uV6munMlgMoIB70ttTpocnztiS1QFcQcy4hX1IMM/jl X-Received: by 2002:a17:902:594c:: with SMTP id e12-v6mr17946613plj.323.1519817254560; Wed, 28 Feb 2018 03:27:34 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1519817254; cv=none; d=google.com; s=arc-20160816; b=flq9ResAoOZyRHhxogdDAcglKNXLI0w1E06I72bzrgW6QWoUgGsj8GeUTnobXAbb7i qSZdbS44wXu28/ASA/SUTkzqVxqeSFGiwWmrddbkaCsFHWck7CzvjBcidqHxCDnUVvEc 1s6lX/C4IGHqHS20u/T5RQmj9t9gOBpJnyCa+ECHSf6UdtBlXdAcuRC2g+hlxytJNQ3T OnyDw/TPgWS84DO81qG5ROMKIDxu7HGMOwom5wYuEhKvvdziAewGOPQjAuBGMnijbMyU Ce52GDRYvyziBzu8NVTCmlo60oRCP8eTYDTRRsj0DZyCbSUhiwDMPG91Gy5V/KxfRgFA D3kA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:cc:list-subscribe :list-help:list-post:list-archive:list-unsubscribe:list-id :precedence:mime-version:references:in-reply-to:message-id:date :subject:to:from:dkim-signature:delivered-to :arc-authentication-results; bh=sbz1w/mVCgO+TCS+FD5BuUy6QgmxIY2NDqNXkLlBuBs=; b=hkz8cZOqs324RJ23O9+pXD8sSaQ4XYMEUXUFMTfmxffmxjf/W/c8uhtIjqlNDD8wHe Uzh/dZRlG2d/hfNPV3kQJFSdacgqn100nYhV7cG/zfpaJZTb2T3MfJyJCARiFh2IKFM+ zXY49gsOhtTztZipogaiATeJNhokGlVbX44pxLo6euu2+OIzUTlXTg6r0l3RYI5KtEZN tGcep/+uvuRoT/geb/6g5t7b4DlnA6YhRWPVuVSZLY3iYsjj8+Grm87a820Fg7K+R2O8 mcKQNvM78Sy+KoqI1e0izdZbgBfZtz6WfE1tmSDdzZKyZj89WHbV2agM2C8oO8Kr03Vg 9YEw== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@ti.com header.s=ti-com-17Q1 header.b=Gbcy2sQt; spf=pass (google.com: best guess record for domain of dri-devel-bounces@lists.freedesktop.org designates 131.252.210.177 as permitted sender) smtp.mailfrom=dri-devel-bounces@lists.freedesktop.org; dmarc=fail (p=QUARANTINE sp=NONE dis=NONE) header.from=ti.com Return-Path: Received: from gabe.freedesktop.org (gabe.freedesktop.org. [131.252.210.177]) by mx.google.com with ESMTPS id v1si1093822pfg.288.2018.02.28.03.27.34 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Wed, 28 Feb 2018 03:27:34 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of dri-devel-bounces@lists.freedesktop.org designates 131.252.210.177 as permitted sender) client-ip=131.252.210.177; Authentication-Results: mx.google.com; dkim=neutral (body hash did not verify) header.i=@ti.com header.s=ti-com-17Q1 header.b=Gbcy2sQt; spf=pass (google.com: best guess record for domain of dri-devel-bounces@lists.freedesktop.org designates 131.252.210.177 as permitted sender) smtp.mailfrom=dri-devel-bounces@lists.freedesktop.org; dmarc=fail (p=QUARANTINE sp=NONE dis=NONE) header.from=ti.com Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 5EB126E954; Wed, 28 Feb 2018 11:27:29 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from lelnx194.ext.ti.com (lelnx194.ext.ti.com [198.47.27.80]) by gabe.freedesktop.org (Postfix) with ESMTPS id 9076F6E954 for ; Wed, 28 Feb 2018 11:27:28 +0000 (UTC) Received: from dlelxv90.itg.ti.com ([172.17.2.17]) by lelnx194.ext.ti.com (8.15.1/8.15.1) with ESMTP id w1SBRQie004169; Wed, 28 Feb 2018 05:27:26 -0600 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ti.com; s=ti-com-17Q1; t=1519817246; bh=it4Z3P/dPgBbgZlvEx36Lfan6wRX0hISp2rrmVg7FyM=; h=From:To:CC:Subject:Date:In-Reply-To:References; b=Gbcy2sQthoLK7Hm6M10RwD+RytBFCmTxuLzGA5j+/4LuIsQJ0gVDcCdkgIyHoZR1L Qutpiu1M9ea26gO1UXDYkyPhU8lDWdTf1xJ68O5S0YJQ0tY8SsTchJ50Vql8mGXGR6 gF8lYMs4CzAHNFWEsu1ig1pz1hcUFSlHeeQBnLZk= Received: from DFLE115.ent.ti.com (dfle115.ent.ti.com [10.64.6.36]) by dlelxv90.itg.ti.com (8.14.3/8.13.8) with ESMTP id w1SBRQTv031454; Wed, 28 Feb 2018 05:27:26 -0600 Received: from DFLE110.ent.ti.com (10.64.6.31) by DFLE115.ent.ti.com (10.64.6.36) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1261.35; Wed, 28 Feb 2018 05:27:25 -0600 Received: from dflp32.itg.ti.com (10.64.6.15) by DFLE110.ent.ti.com (10.64.6.31) with Microsoft SMTP Server (version=TLS1_0, cipher=TLS_RSA_WITH_AES_256_CBC_SHA) id 15.1.1261.35 via Frontend Transport; Wed, 28 Feb 2018 05:27:26 -0600 Received: from deskari.ti.com (ileax41-snat.itg.ti.com [10.172.224.153]) by dflp32.itg.ti.com (8.14.3/8.13.8) with ESMTP id w1SBRAfQ024563; Wed, 28 Feb 2018 05:27:24 -0600 From: Tomi Valkeinen To: , Laurent Pinchart Subject: [PATCHv2 07/17] drm/omap: dispc: disp_wb_setup to check return code Date: Wed, 28 Feb 2018 13:26:04 +0200 Message-ID: <1519817174-20714-8-git-send-email-tomi.valkeinen@ti.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1519817174-20714-1-git-send-email-tomi.valkeinen@ti.com> References: <1519817174-20714-1-git-send-email-tomi.valkeinen@ti.com> MIME-Version: 1.0 X-EXCLAIMER-MD-CONFIG: e1e8a2fd-e40a-4ac6-ac9b-f7e9cc9ee180 X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Peter Ujfalusi , Tomi Valkeinen , Jyri Sarha Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" From: Benoit Parrot When dispc_wb_setup() calls dispc_ovl_setup_common() it does not check for failure but instead keeps on partially setting up WB. This causes the WB H/W to be partially initialized and yield unexpected behavior. Make sure return code is successful before proceeding. Signed-off-by: Benoit Parrot Signed-off-by: Tomi Valkeinen Reviewed-by: Laurent Pinchart Reviewed-by: Sebastian Reichel --- drivers/gpu/drm/omapdrm/dss/dispc.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/drivers/gpu/drm/omapdrm/dss/dispc.c b/drivers/gpu/drm/omapdrm/dss/dispc.c index d2d95c76a313..f0f729fc4ca2 100644 --- a/drivers/gpu/drm/omapdrm/dss/dispc.c +++ b/drivers/gpu/drm/omapdrm/dss/dispc.c @@ -2783,6 +2783,8 @@ int dispc_wb_setup(struct dispc_device *dispc, wi->height, wi->fourcc, wi->rotation, zorder, wi->pre_mult_alpha, global_alpha, wi->rotation_type, replication, vm, mem_to_mem); + if (r) + return r; switch (wi->fourcc) { case DRM_FORMAT_RGB565: @@ -2823,7 +2825,7 @@ int dispc_wb_setup(struct dispc_device *dispc, REG_FLD_MOD(dispc, DISPC_OVL_ATTRIBUTES2(plane), wbdelay, 7, 0); } - return r; + return 0; } static int dispc_ovl_enable(struct dispc_device *dispc, From patchwork Wed Feb 28 11:26:05 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tomi Valkeinen X-Patchwork-Id: 129958 Delivered-To: patch@linaro.org Received: by 10.46.66.2 with SMTP id p2csp909115lja; Wed, 28 Feb 2018 03:28:21 -0800 (PST) X-Google-Smtp-Source: AH8x225SiPQS1QydUOpH46KFBFvnjWYaHe9d7apiRRC4VHbC4n/8EKszwk/zubKKSF+Y2F2GSph8 X-Received: by 10.99.179.77 with SMTP id x13mr14076589pgt.148.1519817301070; Wed, 28 Feb 2018 03:28:21 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1519817301; cv=none; d=google.com; s=arc-20160816; b=hPfigSZWww//0sZg72F4saiCGlOjW/NR8riiIcTsD6cbfgD6kvBROB7vVLg9Tukjr9 IVyKIQGiXuT6g1V0VdRH0xGGYVh3Hhr0FRAqcjOpGfRUIrqPxQLPdNGKz64pLfOuMgUP T0qiq4CzTXLtkw1BGdx5Rf9JS0uJw/2lowbA1lzdphcXEnQVOuZ653qdBG6OWoH/pPkS 65Clo1JrMVEfiAoNnPPVQqM7GUoPvpxw/e5gZmKSy7NWBhiaXMi+1bf9hvmXqbiOyFCR Ith0ExyvNZRbd4C5rOZ0ZD3XPgWDVb2HpZbRPfpncJ5LDiMiF+3n8QbCOYEYG7g/IaEI LZIQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:cc:list-subscribe :list-help:list-post:list-archive:list-unsubscribe:list-id :precedence:mime-version:references:in-reply-to:message-id:date :subject:to:from:dkim-signature:delivered-to :arc-authentication-results; bh=12YLMq0R+QxBArZPwFWjOX5M8SlY8LPhKykbmwOBanQ=; b=qeSICVc0KM052F251lGetHPpoALzeHsoHCClYAeDIL9sYoQxd4YHTBqzQFPquas3/e z12pLbLLlV03NyYwO/dJP0pDEN89/Aw2XvvZLF1HJttI3ksKC8y8aAwq9YyhFOC/Xu0W e1HpI6SnzDbTfHEw3C2SnYaud1PaCVN6DGM0MbNpPSXOTtMm/5S3TTRniO3lFlHkAmpq tF8pMtn3LRHX3T5neGgO7QJ0xZS5oNm4we5Y2g4gVUZ8HE1GFZYpTkyyAH8OsSkFm+YR 2KJTK8+sUOpaQV/bCj5ZHO454lnmkwPKly1ir4BG+FGCHoCqGecfPVMi4wujSKIl31ca qNKg== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@ti.com header.s=ti-com-17Q1 header.b=jhrqyVXI; spf=pass (google.com: best guess record for domain of dri-devel-bounces@lists.freedesktop.org designates 131.252.210.177 as permitted sender) smtp.mailfrom=dri-devel-bounces@lists.freedesktop.org; dmarc=fail (p=QUARANTINE sp=NONE dis=NONE) header.from=ti.com Return-Path: Received: from gabe.freedesktop.org (gabe.freedesktop.org. [131.252.210.177]) by mx.google.com with ESMTPS id i4-v6si1152600plk.771.2018.02.28.03.28.20 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Wed, 28 Feb 2018 03:28:21 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of dri-devel-bounces@lists.freedesktop.org designates 131.252.210.177 as permitted sender) client-ip=131.252.210.177; Authentication-Results: mx.google.com; dkim=neutral (body hash did not verify) header.i=@ti.com header.s=ti-com-17Q1 header.b=jhrqyVXI; spf=pass (google.com: best guess record for domain of dri-devel-bounces@lists.freedesktop.org designates 131.252.210.177 as permitted sender) smtp.mailfrom=dri-devel-bounces@lists.freedesktop.org; dmarc=fail (p=QUARANTINE sp=NONE dis=NONE) header.from=ti.com Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 5AE7D6E95C; Wed, 28 Feb 2018 11:27:34 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from lelnx193.ext.ti.com (lelnx193.ext.ti.com [198.47.27.77]) by gabe.freedesktop.org (Postfix) with ESMTPS id 8AA8E6E958 for ; Wed, 28 Feb 2018 11:27:30 +0000 (UTC) Received: from dlelxv90.itg.ti.com ([172.17.2.17]) by lelnx193.ext.ti.com (8.15.1/8.15.1) with ESMTP id w1SBRStE008373; Wed, 28 Feb 2018 05:27:28 -0600 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ti.com; s=ti-com-17Q1; t=1519817248; bh=5PPcMp5sE8vXit39QkFgBEd4RhvO8OSO8wEK6L6VMZs=; h=From:To:CC:Subject:Date:In-Reply-To:References; b=jhrqyVXIvpxb21Vqx6/jrWCDTBy8YTlHPhUhWgPZP+QUpMV8XhbSlltSpbVzGkE2g o7b7KDgfLZxii6XCFfHKu5jdPlJou5tOXLphSyf7l8Gqv8MliNSSF804M/cnrHLCtl CVgiLj8nMDzshNsVUtC7eMu8/8LOtdkjiIFuVZsg= Received: from DFLE112.ent.ti.com (dfle112.ent.ti.com [10.64.6.33]) by dlelxv90.itg.ti.com (8.14.3/8.13.8) with ESMTP id w1SBRSeM031475; Wed, 28 Feb 2018 05:27:28 -0600 Received: from DFLE113.ent.ti.com (10.64.6.34) by DFLE112.ent.ti.com (10.64.6.33) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1261.35; Wed, 28 Feb 2018 05:27:27 -0600 Received: from dflp32.itg.ti.com (10.64.6.15) by DFLE113.ent.ti.com (10.64.6.34) with Microsoft SMTP Server (version=TLS1_0, cipher=TLS_RSA_WITH_AES_256_CBC_SHA) id 15.1.1261.35 via Frontend Transport; Wed, 28 Feb 2018 05:27:27 -0600 Received: from deskari.ti.com (ileax41-snat.itg.ti.com [10.172.224.153]) by dflp32.itg.ti.com (8.14.3/8.13.8) with ESMTP id w1SBRAfR024563; Wed, 28 Feb 2018 05:27:26 -0600 From: Tomi Valkeinen To: , Laurent Pinchart Subject: [PATCHv2 08/17] drm/omap: Add pclk setting case when channel is DSS_WB Date: Wed, 28 Feb 2018 13:26:05 +0200 Message-ID: <1519817174-20714-9-git-send-email-tomi.valkeinen@ti.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1519817174-20714-1-git-send-email-tomi.valkeinen@ti.com> References: <1519817174-20714-1-git-send-email-tomi.valkeinen@ti.com> MIME-Version: 1.0 X-EXCLAIMER-MD-CONFIG: e1e8a2fd-e40a-4ac6-ac9b-f7e9cc9ee180 X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Peter Ujfalusi , Tomi Valkeinen , Jyri Sarha Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" From: Benoit Parrot In dispc_set_ovl_common() we need to initialize pclk to a valid value when we use WB in capture mode (i.e. mem_2_mem is false). Otherwise dispc_ovl_calc_scaling() fails. Signed-off-by: Benoit Parrot Signed-off-by: Tomi Valkeinen --- drivers/gpu/drm/omapdrm/dss/dispc.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/drivers/gpu/drm/omapdrm/dss/dispc.c b/drivers/gpu/drm/omapdrm/dss/dispc.c index f0f729fc4ca2..3ad56b30c90a 100644 --- a/drivers/gpu/drm/omapdrm/dss/dispc.c +++ b/drivers/gpu/drm/omapdrm/dss/dispc.c @@ -2590,6 +2590,10 @@ static int dispc_ovl_setup_common(struct dispc_device *dispc, unsigned long pclk = dispc_plane_pclk_rate(dispc, plane); unsigned long lclk = dispc_plane_lclk_rate(dispc, plane); + /* when setting up WB, dispc_plane_pclk_rate() returns 0 */ + if (plane == OMAP_DSS_WB) + pclk = vm->pixelclock; + if (paddr == 0 && rotation_type != OMAP_DSS_ROT_TILER) return -EINVAL; From patchwork Wed Feb 28 11:26:06 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tomi Valkeinen X-Patchwork-Id: 129960 Delivered-To: patch@linaro.org Received: by 10.46.66.2 with SMTP id p2csp909173lja; Wed, 28 Feb 2018 03:28:26 -0800 (PST) X-Google-Smtp-Source: AH8x225E/RoiJz2H2txv3wSgswmd67tHSZxrwbpJmBI+MTs5xAZdYYzKVNeZee2nzjxdEOIi7Cqy X-Received: by 10.99.136.195 with SMTP id l186mr14373890pgd.427.1519817306729; Wed, 28 Feb 2018 03:28:26 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1519817306; cv=none; d=google.com; s=arc-20160816; b=QpZd64dza2C+JJ+xXE45A3RopR4D1I3SqgzniVCOJNX3HlPr3aF0eSx7QiVgModj0t wuo95rozPHradi54K0tybBypUBlmnDWWaixcLNZocbTgwkO+VnrwUMEMroegNKp8H8CQ Z95KcNPn5iKgd4VhnzXHvOjc71ZJM9K0ZIZIHujTvL9VqI5u1fDs5rgTGE+LINwNzilA 3k4P2DkEdf9RXYZSusrvg36TegAJ0a9Qte4JZtvPR94W4+0clr21W56LJtCRpRhRQTnV oFEmxNgLxYhg/OUqCzThnpAQqsaOiobOF7lviWruxPUmwUSdGkfo/ejTOA3sfMVWGj0x BKHw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:cc:list-subscribe :list-help:list-post:list-archive:list-unsubscribe:list-id :precedence:mime-version:references:in-reply-to:message-id:date :subject:to:from:dkim-signature:delivered-to :arc-authentication-results; bh=Ek8ZHLpNwAhpbxlYLYiKjw755y5v4/POkU76WGzKmwU=; b=uDXHmSqz9PcZutA7sxn0PQ27uZSJAu4XiYACZ1Jir6Cf4gaSuwqtXB0lofHAkwdwcj r8rJ1PBfvtRbgtUJnzzYDAv6jHW7TX4F2FEAuWsWTfi9eZuehRq92nbcvEnkTCmxaLr/ cU5zbkPTJWT0GysfbB1rL/DMp/a449QnKY/3SME2HEvWw4P4Velx9080mAfH2VcVWpBO oWdIFvl1y0Ke/HSq2ovajDrLdSzkGvl0eSKotx2uHMJVHofYaK+lWo0qbt0KYxpmk14S xLUlN7QaoC9nY8tkCZc2vKZmNZRG5aPKftt/neiwuRLOEll5r2J2Lx862K90rtU3TT8g ENoQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@ti.com header.s=ti-com-17Q1 header.b=Bv7dldBs; spf=pass (google.com: best guess record for domain of dri-devel-bounces@lists.freedesktop.org designates 131.252.210.177 as permitted sender) smtp.mailfrom=dri-devel-bounces@lists.freedesktop.org; dmarc=fail (p=QUARANTINE sp=NONE dis=NONE) header.from=ti.com Return-Path: Received: from gabe.freedesktop.org (gabe.freedesktop.org. [131.252.210.177]) by mx.google.com with ESMTPS id t132si911651pgc.238.2018.02.28.03.28.26 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Wed, 28 Feb 2018 03:28:26 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of dri-devel-bounces@lists.freedesktop.org designates 131.252.210.177 as permitted sender) client-ip=131.252.210.177; Authentication-Results: mx.google.com; dkim=neutral (body hash did not verify) header.i=@ti.com header.s=ti-com-17Q1 header.b=Bv7dldBs; spf=pass (google.com: best guess record for domain of dri-devel-bounces@lists.freedesktop.org designates 131.252.210.177 as permitted sender) smtp.mailfrom=dri-devel-bounces@lists.freedesktop.org; dmarc=fail (p=QUARANTINE sp=NONE dis=NONE) header.from=ti.com Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 7ED6B6E95E; Wed, 28 Feb 2018 11:27:35 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from lelnx193.ext.ti.com (lelnx193.ext.ti.com [198.47.27.77]) by gabe.freedesktop.org (Postfix) with ESMTPS id 6B0D66E95B for ; Wed, 28 Feb 2018 11:27:32 +0000 (UTC) Received: from dflxv15.itg.ti.com ([128.247.5.124]) by lelnx193.ext.ti.com (8.15.1/8.15.1) with ESMTP id w1SBRUXT008384; Wed, 28 Feb 2018 05:27:30 -0600 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ti.com; s=ti-com-17Q1; t=1519817250; bh=OKtVOhqffUKgNp4lXeFYtcUhG8/RH348ZxUpuTvO4ns=; h=From:To:CC:Subject:Date:In-Reply-To:References; b=Bv7dldBscYsrWSItUVuq1FoyQDF39p1Z/QiwhfB592IkEEi7Dg5/MSSXP5JLNJ3NV FPvRg7zEvmSTJQW8t61qpxqmFxsTtfk6frbYECSIg9+k80rypjT4nYaImc4zQwNLsd gnLIGgTwcfv3B3Aq58yf7VbHrRQ5AoeGpFaJkouk= Received: from DLEE106.ent.ti.com (dlee106.ent.ti.com [157.170.170.36]) by dflxv15.itg.ti.com (8.14.3/8.13.8) with ESMTP id w1SBRUXm021288; Wed, 28 Feb 2018 05:27:30 -0600 Received: from DLEE102.ent.ti.com (157.170.170.32) by DLEE106.ent.ti.com (157.170.170.36) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1261.35; Wed, 28 Feb 2018 05:27:29 -0600 Received: from dflp32.itg.ti.com (10.64.6.15) by DLEE102.ent.ti.com (157.170.170.32) with Microsoft SMTP Server (version=TLS1_0, cipher=TLS_RSA_WITH_AES_256_CBC_SHA) id 15.1.1261.35 via Frontend Transport; Wed, 28 Feb 2018 05:27:29 -0600 Received: from deskari.ti.com (ileax41-snat.itg.ti.com [10.172.224.153]) by dflp32.itg.ti.com (8.14.3/8.13.8) with ESMTP id w1SBRAfS024563; Wed, 28 Feb 2018 05:27:28 -0600 From: Tomi Valkeinen To: , Laurent Pinchart Subject: [PATCHv2 09/17] drm/omap: set WB channel-in in wb_setup() Date: Wed, 28 Feb 2018 13:26:06 +0200 Message-ID: <1519817174-20714-10-git-send-email-tomi.valkeinen@ti.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1519817174-20714-1-git-send-email-tomi.valkeinen@ti.com> References: <1519817174-20714-1-git-send-email-tomi.valkeinen@ti.com> MIME-Version: 1.0 X-EXCLAIMER-MD-CONFIG: e1e8a2fd-e40a-4ac6-ac9b-f7e9cc9ee180 X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Peter Ujfalusi , Tomi Valkeinen , Jyri Sarha Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" We need to know the WB channel-in in wb_setup() to be able to configure WB properly for capture mode. At the moment channel-in is set separately. This patch moves channel-in to wb_setup(). Signed-off-by: Tomi Valkeinen --- drivers/gpu/drm/omapdrm/dss/dispc.c | 12 +++--------- drivers/gpu/drm/omapdrm/dss/dss.h | 3 ++- 2 files changed, 5 insertions(+), 10 deletions(-) diff --git a/drivers/gpu/drm/omapdrm/dss/dispc.c b/drivers/gpu/drm/omapdrm/dss/dispc.c index 3ad56b30c90a..ccfafce1ea89 100644 --- a/drivers/gpu/drm/omapdrm/dss/dispc.c +++ b/drivers/gpu/drm/omapdrm/dss/dispc.c @@ -1234,14 +1234,6 @@ static enum omap_channel dispc_ovl_get_channel_out(struct dispc_device *dispc, } } -void dispc_wb_set_channel_in(struct dispc_device *dispc, - enum dss_writeback_channel channel) -{ - enum omap_plane_id plane = OMAP_DSS_WB; - - REG_FLD_MOD(dispc, DISPC_OVL_ATTRIBUTES(plane), channel, 18, 16); -} - static void dispc_ovl_set_burst_size(struct dispc_device *dispc, enum omap_plane_id plane, enum omap_burst_size burst_size) @@ -2764,7 +2756,8 @@ static int dispc_ovl_setup(struct dispc_device *dispc, int dispc_wb_setup(struct dispc_device *dispc, const struct omap_dss_writeback_info *wi, - bool mem_to_mem, const struct videomode *vm) + bool mem_to_mem, const struct videomode *vm, + enum dss_writeback_channel channel_in) { int r; u32 l; @@ -2809,6 +2802,7 @@ int dispc_wb_setup(struct dispc_device *dispc, /* setup extra DISPC_WB_ATTRIBUTES */ l = dispc_read_reg(dispc, DISPC_OVL_ATTRIBUTES(plane)); l = FLD_MOD(l, truncation, 10, 10); /* TRUNCATIONENABLE */ + l = FLD_MOD(l, channel_in, 18, 16); /* CHANNELIN */ l = FLD_MOD(l, mem_to_mem, 19, 19); /* WRITEBACKMODE */ if (mem_to_mem) l = FLD_MOD(l, 1, 26, 24); /* CAPTUREMODE */ diff --git a/drivers/gpu/drm/omapdrm/dss/dss.h b/drivers/gpu/drm/omapdrm/dss/dss.h index 6f6fd3d1b159..c56c3c59bf18 100644 --- a/drivers/gpu/drm/omapdrm/dss/dss.h +++ b/drivers/gpu/drm/omapdrm/dss/dss.h @@ -455,7 +455,8 @@ void dispc_wb_set_channel_in(struct dispc_device *dispc, enum dss_writeback_channel channel); int dispc_wb_setup(struct dispc_device *dispc, const struct omap_dss_writeback_info *wi, - bool mem_to_mem, const struct videomode *vm); + bool mem_to_mem, const struct videomode *vm, + enum dss_writeback_channel channel_in); #ifdef CONFIG_OMAP2_DSS_COLLECT_IRQ_STATS static inline void dss_collect_irq_stats(u32 irqstatus, unsigned int *irq_arr) From patchwork Wed Feb 28 11:26:07 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tomi Valkeinen X-Patchwork-Id: 129962 Delivered-To: patch@linaro.org Received: by 10.46.66.2 with SMTP id p2csp909246lja; Wed, 28 Feb 2018 03:28:30 -0800 (PST) X-Google-Smtp-Source: AG47ELu3ibfFCfrXGMNit50ClEO3ELDXLTJbEVEMHtlMhyoYnivGcEEN+ZOq5fjh3Nwd76mddN6S X-Received: by 2002:a17:902:b416:: with SMTP id x22-v6mr5404524plr.279.1519817310696; Wed, 28 Feb 2018 03:28:30 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1519817310; cv=none; d=google.com; s=arc-20160816; b=hJ+iloFGl1c82a/Ze8jz6xmZvbAS3Vpep3xKNnAr8ra+UnIUwS0CXyycO7+3NHtJdi 7wpbO5iFGhlVYGACnFs4HHnUNIAzTN80z4NY7jsXGw9Q0pV7lDaY+IrltgRPD/ARcmZK u2wg8TWIyibxWJIcblz0kCADt7Rjbzr0V8sPamN3i7Wf6w5vQNxGUIs7XPrSs15n0Xj2 67gsAs042K9EoUzPhXn2vdaXrIEQTlJ9TsOzQhusZeJcvUp2vfvjGrmPxHO7hXmXrMvA 09VUP/OaLeZpjijQq5tdUgnecwp/qWMintdbqV0ooXupuNJbo/LGcVTTcTRwNMGYiCbs TVTg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:cc:list-subscribe :list-help:list-post:list-archive:list-unsubscribe:list-id :precedence:mime-version:references:in-reply-to:message-id:date :subject:to:from:dkim-signature:delivered-to :arc-authentication-results; bh=QL/1WuhL7BGELRP0lzjfrJK72qm79rBK59qTJxvFbQg=; b=fAJO/HZDMWcbb7eC55Jp9OpcNyU+k+/4YJ+Bj50soMWqU4TXjzNBGBPTk3IrHeYbiR sW/yvHHFgErEn1rOtRRQ0K6eyCCbQuB6iru705DrTVosvSxDz3EW06NVWwVVYIakzWHc jUpogL4Ub+sgs0lgL2hpSIWZ1RwuH5vafF9BaX+B2UoRfQjCzpAhMI40NxRJU/3XqBGR EbanEDFFA3HmxWajN9X4RgOlx1G0tGrIu02RqwM4oCbfXsVWHUND5o+g741tOBrI7eqZ 5Iod+2WN6sjR7lu1edaj0xTIkrL4M2kDshYXC3/wr5fHuabg0ojbqbin4EYlxDaSPsU2 EZXg== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@ti.com header.s=ti-com-17Q1 header.b=wHM/Ax4N; spf=pass (google.com: best guess record for domain of dri-devel-bounces@lists.freedesktop.org designates 131.252.210.177 as permitted sender) smtp.mailfrom=dri-devel-bounces@lists.freedesktop.org; dmarc=fail (p=QUARANTINE sp=NONE dis=NONE) header.from=ti.com Return-Path: Received: from gabe.freedesktop.org (gabe.freedesktop.org. [131.252.210.177]) by mx.google.com with ESMTPS id 2-v6si1163484plc.205.2018.02.28.03.28.30 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Wed, 28 Feb 2018 03:28:30 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of dri-devel-bounces@lists.freedesktop.org designates 131.252.210.177 as permitted sender) client-ip=131.252.210.177; Authentication-Results: mx.google.com; dkim=neutral (body hash did not verify) header.i=@ti.com header.s=ti-com-17Q1 header.b=wHM/Ax4N; spf=pass (google.com: best guess record for domain of dri-devel-bounces@lists.freedesktop.org designates 131.252.210.177 as permitted sender) smtp.mailfrom=dri-devel-bounces@lists.freedesktop.org; dmarc=fail (p=QUARANTINE sp=NONE dis=NONE) header.from=ti.com Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id C14056E960; Wed, 28 Feb 2018 11:27:35 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from lelnx193.ext.ti.com (lelnx193.ext.ti.com [198.47.27.77]) by gabe.freedesktop.org (Postfix) with ESMTPS id 321996E95B for ; Wed, 28 Feb 2018 11:27:34 +0000 (UTC) Received: from dlelxv90.itg.ti.com ([172.17.2.17]) by lelnx193.ext.ti.com (8.15.1/8.15.1) with ESMTP id w1SBRVNg008395; Wed, 28 Feb 2018 05:27:31 -0600 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ti.com; s=ti-com-17Q1; t=1519817251; bh=HmfYTLzcsrx6qgcYNmy04+XOWBV+xi/owlwv3z+Hei0=; h=From:To:CC:Subject:Date:In-Reply-To:References; b=wHM/Ax4NlI3ZxZ5mClZrYgqMY9M0mIlaPCxA+RKnX6FPgGX0hj9HBBmYiwTczlG/O ifh6rcVCMAIqm7D0VMJcxr1mws57cVYXBhVQ18pQfmEWzUetxssF12vQsTuSL+k4tf S8oCaGiVFBs/ldx92dCLRY7RAhsi4pTnA9I2aD80= Received: from DFLE103.ent.ti.com (dfle103.ent.ti.com [10.64.6.24]) by dlelxv90.itg.ti.com (8.14.3/8.13.8) with ESMTP id w1SBRVPx031508; Wed, 28 Feb 2018 05:27:31 -0600 Received: from DFLE114.ent.ti.com (10.64.6.35) by DFLE103.ent.ti.com (10.64.6.24) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1261.35; Wed, 28 Feb 2018 05:27:31 -0600 Received: from dflp32.itg.ti.com (10.64.6.15) by DFLE114.ent.ti.com (10.64.6.35) with Microsoft SMTP Server (version=TLS1_0, cipher=TLS_RSA_WITH_AES_256_CBC_SHA) id 15.1.1261.35 via Frontend Transport; Wed, 28 Feb 2018 05:27:31 -0600 Received: from deskari.ti.com (ileax41-snat.itg.ti.com [10.172.224.153]) by dflp32.itg.ti.com (8.14.3/8.13.8) with ESMTP id w1SBRAfT024563; Wed, 28 Feb 2018 05:27:30 -0600 From: Tomi Valkeinen To: , Laurent Pinchart Subject: [PATCHv2 10/17] drm/omap: fix WBDELAYCOUNT for HDMI Date: Wed, 28 Feb 2018 13:26:07 +0200 Message-ID: <1519817174-20714-11-git-send-email-tomi.valkeinen@ti.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1519817174-20714-1-git-send-email-tomi.valkeinen@ti.com> References: <1519817174-20714-1-git-send-email-tomi.valkeinen@ti.com> MIME-Version: 1.0 X-EXCLAIMER-MD-CONFIG: e1e8a2fd-e40a-4ac6-ac9b-f7e9cc9ee180 X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Peter Ujfalusi , Tomi Valkeinen , Jyri Sarha Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" For HDMI, WBDELAYCOUNT starts counting at the start of vsync, not at the start of vfp. This patch adjusts the wbdelay for HDMI accordingly. Signed-off-by: Tomi Valkeinen --- drivers/gpu/drm/omapdrm/dss/dispc.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/drivers/gpu/drm/omapdrm/dss/dispc.c b/drivers/gpu/drm/omapdrm/dss/dispc.c index ccfafce1ea89..7398039954a5 100644 --- a/drivers/gpu/drm/omapdrm/dss/dispc.c +++ b/drivers/gpu/drm/omapdrm/dss/dispc.c @@ -2816,8 +2816,12 @@ int dispc_wb_setup(struct dispc_device *dispc, } else { int wbdelay; - wbdelay = min(vm->vfront_porch + - vm->vsync_len + vm->vback_porch, (u32)255); + if (channel_in == DSS_WB_TV_MGR) + wbdelay = min(vm->vsync_len + vm->vback_porch, + (u32)255); + else + wbdelay = min(vm->vfront_porch + + vm->vsync_len + vm->vback_porch, (u32)255); /* WBDELAYCOUNT */ REG_FLD_MOD(dispc, DISPC_OVL_ATTRIBUTES2(plane), wbdelay, 7, 0); From patchwork Wed Feb 28 11:26:08 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tomi Valkeinen X-Patchwork-Id: 129956 Delivered-To: patch@linaro.org Received: by 10.46.66.2 with SMTP id p2csp908980lja; Wed, 28 Feb 2018 03:28:09 -0800 (PST) X-Google-Smtp-Source: AH8x226oDxug/MbJQreWXQwHodzb5CZJavTMIw1BY0FJKNjWhSlAqX/DpxNqiw2DMwCCaqtHnCqz X-Received: by 10.98.135.76 with SMTP id i73mr17395046pfe.140.1519817289447; Wed, 28 Feb 2018 03:28:09 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1519817289; cv=none; d=google.com; s=arc-20160816; b=fuMdSal74F0IwA1ddox6wCH+RasCRYRjOzqjZQRWEN12hfumT5y3l/2QiqDueXVw8X QP95Hsi9TXIIDbL1sGXw/HyvJ5i2w79jVWyw1C3V/yOSdfxqM31kPkNTzi/qU5wQSEyF 7kFlAn7K7bPhi9uUuEDSzlQanewEXEfYkfRa1/t8KTcdArPTBnMu+kgKsSSV0k/4lnUb DFNm0VaDjjm1fbSls86FA5TIm+qWW3isQJb+W5sPeoGK2tGINmXFYvHci1nmL1vOpT61 5GVAajK5SmrDv5kD20LS1iyBhTGTKNqtFkLDuf9oB5JIWS82508PVs3kthXoUcH8BVVG meBg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:cc:list-subscribe :list-help:list-post:list-archive:list-unsubscribe:list-id :precedence:mime-version:references:in-reply-to:message-id:date :subject:to:from:dkim-signature:delivered-to :arc-authentication-results; bh=/yrCb1Y2txjPniU1SdDiCUkgPEDo649rqd68gcaMISg=; b=qtNxa7ew7vpe2sWubl4hpOVoVVkJMCtRLPJyHtABeug/gHjroeOYz9SBm9B8LqMVu0 IcRX3vlaboDNgS5OKSLqDO+4n+SJ4gitH4xUgXRXaOC6gQ4DRnqVGsgOipbfG8Kys5W4 MHJ5nO8ZLv1uyaZc1TuYyoel8u2KUgQSf61FlTCN4C90aPALbDe6GHv7rvTjH9jW6Lny AL215kb3k75q3cIG5e2azXF8paKJWfvlkDXb6R/tWE2017WaKZTYBqXIKAU8Vf6wZ9LQ 2IGuyCkTtNccJb4pGNeKd6Zir0Tf6IYmy+awfLJHZ5KmrzNkDdpj9IJeZ3/SgzyzQsF/ pd+w== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@ti.com header.s=ti-com-17Q1 header.b=hjFsUjhz; spf=pass (google.com: best guess record for domain of dri-devel-bounces@lists.freedesktop.org designates 131.252.210.177 as permitted sender) smtp.mailfrom=dri-devel-bounces@lists.freedesktop.org; dmarc=fail (p=QUARANTINE sp=NONE dis=NONE) header.from=ti.com Return-Path: Received: from gabe.freedesktop.org (gabe.freedesktop.org. [131.252.210.177]) by mx.google.com with ESMTPS id j6-v6si1123334pll.799.2018.02.28.03.28.09 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Wed, 28 Feb 2018 03:28:09 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of dri-devel-bounces@lists.freedesktop.org designates 131.252.210.177 as permitted sender) client-ip=131.252.210.177; Authentication-Results: mx.google.com; dkim=neutral (body hash did not verify) header.i=@ti.com header.s=ti-com-17Q1 header.b=hjFsUjhz; spf=pass (google.com: best guess record for domain of dri-devel-bounces@lists.freedesktop.org designates 131.252.210.177 as permitted sender) smtp.mailfrom=dri-devel-bounces@lists.freedesktop.org; dmarc=fail (p=QUARANTINE sp=NONE dis=NONE) header.from=ti.com Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 44F186E96E; Wed, 28 Feb 2018 11:27:42 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from fllnx210.ext.ti.com (fllnx210.ext.ti.com [198.47.19.17]) by gabe.freedesktop.org (Postfix) with ESMTPS id 04B036E962 for ; Wed, 28 Feb 2018 11:27:35 +0000 (UTC) Received: from dlelxv90.itg.ti.com ([172.17.2.17]) by fllnx210.ext.ti.com (8.15.1/8.15.1) with ESMTP id w1SBRXov022869; Wed, 28 Feb 2018 05:27:33 -0600 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ti.com; s=ti-com-17Q1; t=1519817253; bh=eThkBCXxndqFYhMMJL4aI0d9RrheZ38s3utY1ystu1Y=; h=From:To:CC:Subject:Date:In-Reply-To:References; b=hjFsUjhzLeeeZP84AwKAVQlSAHo4nY9+MmI3FNK81r2E6iH8czHfmBL/aSH1GvQ0Z iQywhQ4/kWrQ7NsYq8LLVPsNn8dEEwNsM/irCA+bmTPP9yBSZBt44VnNwP4JtO/SaQ PshOC7FF1IGq1xE1Y/OFgDka58fiIsYYPmy7rDIQ= Received: from DLEE101.ent.ti.com (dlee101.ent.ti.com [157.170.170.31]) by dlelxv90.itg.ti.com (8.14.3/8.13.8) with ESMTP id w1SBRX69031520; Wed, 28 Feb 2018 05:27:33 -0600 Received: from DLEE105.ent.ti.com (157.170.170.35) by DLEE101.ent.ti.com (157.170.170.31) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1261.35; Wed, 28 Feb 2018 05:27:33 -0600 Received: from dflp32.itg.ti.com (10.64.6.15) by DLEE105.ent.ti.com (157.170.170.35) with Microsoft SMTP Server (version=TLS1_0, cipher=TLS_RSA_WITH_AES_256_CBC_SHA) id 15.1.1261.35 via Frontend Transport; Wed, 28 Feb 2018 05:27:33 -0600 Received: from deskari.ti.com (ileax41-snat.itg.ti.com [10.172.224.153]) by dflp32.itg.ti.com (8.14.3/8.13.8) with ESMTP id w1SBRAfU024563; Wed, 28 Feb 2018 05:27:31 -0600 From: Tomi Valkeinen To: , Laurent Pinchart Subject: [PATCHv2 11/17] drm/omap: fix WBDELAYCOUNT with interlace Date: Wed, 28 Feb 2018 13:26:08 +0200 Message-ID: <1519817174-20714-12-git-send-email-tomi.valkeinen@ti.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1519817174-20714-1-git-send-email-tomi.valkeinen@ti.com> References: <1519817174-20714-1-git-send-email-tomi.valkeinen@ti.com> MIME-Version: 1.0 X-EXCLAIMER-MD-CONFIG: e1e8a2fd-e40a-4ac6-ac9b-f7e9cc9ee180 X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Peter Ujfalusi , Tomi Valkeinen , Jyri Sarha Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" Vertical blanking needs to be halved on interlace modes. WBDELAYCOUNT was calculated without such halving, resulting in WBUNCOMPLETE errors. Signed-off-by: Tomi Valkeinen Acked-by: Benoit Parrot --- drivers/gpu/drm/omapdrm/dss/dispc.c | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/drivers/gpu/drm/omapdrm/dss/dispc.c b/drivers/gpu/drm/omapdrm/dss/dispc.c index 7398039954a5..000a3d4a27bf 100644 --- a/drivers/gpu/drm/omapdrm/dss/dispc.c +++ b/drivers/gpu/drm/omapdrm/dss/dispc.c @@ -2814,14 +2814,18 @@ int dispc_wb_setup(struct dispc_device *dispc, /* WBDELAYCOUNT */ REG_FLD_MOD(dispc, DISPC_OVL_ATTRIBUTES2(plane), 0, 7, 0); } else { - int wbdelay; + u32 wbdelay; if (channel_in == DSS_WB_TV_MGR) - wbdelay = min(vm->vsync_len + vm->vback_porch, - (u32)255); + wbdelay = vm->vsync_len + vm->vback_porch; else - wbdelay = min(vm->vfront_porch + - vm->vsync_len + vm->vback_porch, (u32)255); + wbdelay = vm->vfront_porch + vm->vsync_len + + vm->vback_porch; + + if (vm->flags & DISPLAY_FLAGS_INTERLACED) + wbdelay /= 2; + + wbdelay = min(wbdelay, 255u); /* WBDELAYCOUNT */ REG_FLD_MOD(dispc, DISPC_OVL_ATTRIBUTES2(plane), wbdelay, 7, 0); From patchwork Wed Feb 28 11:26:09 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tomi Valkeinen X-Patchwork-Id: 129955 Delivered-To: patch@linaro.org Received: by 10.46.66.2 with SMTP id p2csp908914lja; Wed, 28 Feb 2018 03:28:04 -0800 (PST) X-Google-Smtp-Source: AH8x225Kmsjsn02y+TRTpZum4kaqOnBD1mkhcvyCF468nFHd58JAh5QaQ/UulBN71jNpDFlN9HF7 X-Received: by 2002:a17:902:8d81:: with SMTP id v1-v6mr17546515plo.430.1519817284500; Wed, 28 Feb 2018 03:28:04 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1519817284; cv=none; d=google.com; s=arc-20160816; b=T+NSIdENJFOc07o7cv/ZeeIzavdui8ejeQD7rXhLowguUNVsjqTIG/rQr7a02zzjLN VPZKT74AMLDh+Kbtgf7TfW5kGBvTGTa9lCRj7DC90cAOnx8M8QT9CVZO0pwfCf1W1dQx wQRvgfMnW7K2pG171WMGh0jC5DWZAylMDq2Kce/H4drlBqbHz2DUCZpKFYebpX7DUmk/ l1Qkkyqgnlnw3ayg3hdGS8G4aFqVjBVJJ5EZO9DJ6PHokmJmL131BuR9drdQ2pocbzRH JZnyXd3on4JUklXWeRfMPjpHOEZft5VXhxtKxVfQ6jeDJ3g7Pq/jMXUIJVEhKf/EWW69 1E2A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:cc:list-subscribe :list-help:list-post:list-archive:list-unsubscribe:list-id :precedence:mime-version:references:in-reply-to:message-id:date :subject:to:from:dkim-signature:delivered-to :arc-authentication-results; bh=qCkxg+Osl3T/XnwvUix+6y5lHDZpCiFIZN4plHMdBtE=; b=jfEuAgEZl5Xvp7rxuzRLXxqcq1rZuOtXD3fu1WqfdREKaI5vSEiiCy4NrY1xzAtgrl AS3qLdzki4HicMBjRLScGAoXzl0Ki0WPtk2ZqVJmtRc9nWPAe4ECc87Kzn3UKN7w0sqN btP/JDDObSwOQlX95KGzykznQzqM99XNUE+Pe5g681aVM1JY1Ke789wYX17o8+gOe7ig YcmNvfJ/I9iW1G4qQQBWVhdgfKn9RtRKS7xEDUUATPjMdEerDwCkbfaeVwfraqbfaT7l PKSvJ/T+iDMSAMBY4h69t3fJNzB6uJnAGF69sSS4CKaP5SR2SV/vtZwu+KTifDj1JQGg gRuQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@ti.com header.s=ti-com-17Q1 header.b=vwY9/NgG; spf=pass (google.com: best guess record for domain of dri-devel-bounces@lists.freedesktop.org designates 131.252.210.177 as permitted sender) smtp.mailfrom=dri-devel-bounces@lists.freedesktop.org; dmarc=fail (p=QUARANTINE sp=NONE dis=NONE) header.from=ti.com Return-Path: Received: from gabe.freedesktop.org (gabe.freedesktop.org. [131.252.210.177]) by mx.google.com with ESMTPS id a7si1107452pfi.90.2018.02.28.03.28.04 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Wed, 28 Feb 2018 03:28:04 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of dri-devel-bounces@lists.freedesktop.org designates 131.252.210.177 as permitted sender) client-ip=131.252.210.177; Authentication-Results: mx.google.com; dkim=neutral (body hash did not verify) header.i=@ti.com header.s=ti-com-17Q1 header.b=vwY9/NgG; spf=pass (google.com: best guess record for domain of dri-devel-bounces@lists.freedesktop.org designates 131.252.210.177 as permitted sender) smtp.mailfrom=dri-devel-bounces@lists.freedesktop.org; dmarc=fail (p=QUARANTINE sp=NONE dis=NONE) header.from=ti.com Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 2B0CE6E96B; Wed, 28 Feb 2018 11:27:40 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from lelnx193.ext.ti.com (lelnx193.ext.ti.com [198.47.27.77]) by gabe.freedesktop.org (Postfix) with ESMTPS id E021F6E96B for ; Wed, 28 Feb 2018 11:27:37 +0000 (UTC) Received: from dflxv15.itg.ti.com ([128.247.5.124]) by lelnx193.ext.ti.com (8.15.1/8.15.1) with ESMTP id w1SBRZW7008399; Wed, 28 Feb 2018 05:27:35 -0600 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ti.com; s=ti-com-17Q1; t=1519817255; bh=5DNMExndBShEYP08RCy2a0/k5QdEdD+JcW/zl9Z5jUM=; h=From:To:CC:Subject:Date:In-Reply-To:References; b=vwY9/NgG96cH3RCSwE5nmdkgFINmMS8EC/FX55IOE7m0qVYXWeguXYw3oWW/WqGsW 6Cst1q+JpHVaTNqGBIPiO/BtFX7OEchFX6XDyGb9mvb5zNtTFdcbxWN0ciOOg35tIH civHKlk8IJgMhcR8YQbOBq3HhXEAAS4MGiMu1fDk= Received: from DLEE100.ent.ti.com (dlee100.ent.ti.com [157.170.170.30]) by dflxv15.itg.ti.com (8.14.3/8.13.8) with ESMTP id w1SBRZ2V021351; Wed, 28 Feb 2018 05:27:35 -0600 Received: from DLEE104.ent.ti.com (157.170.170.34) by DLEE100.ent.ti.com (157.170.170.30) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1261.35; Wed, 28 Feb 2018 05:27:35 -0600 Received: from dflp32.itg.ti.com (10.64.6.15) by DLEE104.ent.ti.com (157.170.170.34) with Microsoft SMTP Server (version=TLS1_0, cipher=TLS_RSA_WITH_AES_256_CBC_SHA) id 15.1.1261.35 via Frontend Transport; Wed, 28 Feb 2018 05:27:35 -0600 Received: from deskari.ti.com (ileax41-snat.itg.ti.com [10.172.224.153]) by dflp32.itg.ti.com (8.14.3/8.13.8) with ESMTP id w1SBRAfV024563; Wed, 28 Feb 2018 05:27:33 -0600 From: Tomi Valkeinen To: , Laurent Pinchart Subject: [PATCHv2 12/17] drm/omap: fix WB height with interlace Date: Wed, 28 Feb 2018 13:26:09 +0200 Message-ID: <1519817174-20714-13-git-send-email-tomi.valkeinen@ti.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1519817174-20714-1-git-send-email-tomi.valkeinen@ti.com> References: <1519817174-20714-1-git-send-email-tomi.valkeinen@ti.com> MIME-Version: 1.0 X-EXCLAIMER-MD-CONFIG: e1e8a2fd-e40a-4ac6-ac9b-f7e9cc9ee180 X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Peter Ujfalusi , Tomi Valkeinen , Jyri Sarha Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" When using WB capture from interlaced source, we need to halve the picture heights correctly. Unfortunately the current dispc_ovl_setup_common() doesn't deal with interlace very neatly, so the end result is a bit messy. Signed-off-by: Tomi Valkeinen Acked-by: Benoit Parrot --- drivers/gpu/drm/omapdrm/dss/dispc.c | 28 ++++++++++++++++------------ 1 file changed, 16 insertions(+), 12 deletions(-) diff --git a/drivers/gpu/drm/omapdrm/dss/dispc.c b/drivers/gpu/drm/omapdrm/dss/dispc.c index 000a3d4a27bf..72f00e8a1329 100644 --- a/drivers/gpu/drm/omapdrm/dss/dispc.c +++ b/drivers/gpu/drm/omapdrm/dss/dispc.c @@ -2597,18 +2597,19 @@ static int dispc_ovl_setup_common(struct dispc_device *dispc, out_width = out_width == 0 ? width : out_width; out_height = out_height == 0 ? height : out_height; - if (ilace && height == out_height) - fieldmode = true; - - if (ilace) { - if (fieldmode) - in_height /= 2; - pos_y /= 2; - out_height /= 2; - - DSSDBG("adjusting for ilace: height %d, pos_y %d, " - "out_height %d\n", in_height, pos_y, - out_height); + if (plane != OMAP_DSS_WB) { + if (ilace && height == out_height) + fieldmode = true; + + if (ilace) { + if (fieldmode) + in_height /= 2; + pos_y /= 2; + out_height /= 2; + + DSSDBG("adjusting for ilace: height %d, pos_y %d, out_height %d\n", + in_height, pos_y, out_height); + } } if (!dispc_ovl_color_mode_supported(dispc, plane, fourcc)) @@ -2771,6 +2772,9 @@ int dispc_wb_setup(struct dispc_device *dispc, enum omap_overlay_caps caps = OMAP_DSS_OVL_CAP_SCALE | OMAP_DSS_OVL_CAP_PRE_MULT_ALPHA; + if (vm->flags & DISPLAY_FLAGS_INTERLACED) + in_height /= 2; + DSSDBG("dispc_wb_setup, pa %x, pa_uv %x, %d,%d -> %dx%d, cmode %x, " "rot %d\n", wi->paddr, wi->p_uv_addr, in_width, in_height, wi->width, wi->height, wi->fourcc, wi->rotation); From patchwork Wed Feb 28 11:26:10 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tomi Valkeinen X-Patchwork-Id: 129964 Delivered-To: patch@linaro.org Received: by 10.46.66.2 with SMTP id p2csp909455lja; Wed, 28 Feb 2018 03:28:45 -0800 (PST) X-Google-Smtp-Source: AH8x226Slcyhksd8JLN5w/oxrATQmAGMdmGITmRAAmiYxOa0E0KeS9L+AOjKgXNWPVltEqtUPN7g X-Received: by 10.167.131.135 with SMTP id u7mr17405172pfm.50.1519817325226; Wed, 28 Feb 2018 03:28:45 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1519817325; cv=none; d=google.com; s=arc-20160816; b=w4KojVEOYrb3QPuZ4L/GnIONh9LL7o5PguEjl3BlFZFO7RpZ4umGMGgQ+vWGbVA0U1 7oRaueUTJPVJT9B2qWziO5dYFFw76Hx+Z22eshTPw5HfNu+fioCExqL8Q/DyE2o/V1vF B+g7rcwkQ7QzBaKiSYh0URQYqggCy4gVg68/mR4Y0vH2jc/4MIibYtQXU+oNJNCx+R5w j8ddLqeQVmTdFrrhVETxbLKMnWmRvCOSH81ERCbpGavg7T4xBOeKwGDGQPsaN6UajTbs F7OK4O7RWT+PdnKrMf4dnc6NPnPIGw+4+WRlu5jhV14gv9072alDPi8qjv6bbqIbNUeJ 3gDg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:cc:list-subscribe :list-help:list-post:list-archive:list-unsubscribe:list-id :precedence:mime-version:references:in-reply-to:message-id:date :subject:to:from:dkim-signature:delivered-to :arc-authentication-results; bh=tJZOk0rqHNPFAGX/azY+xH/w+qvjy5YwTU1dYzgHXD8=; b=iJFjScHvMeVwtS1DypDPJ/Eh5vFp9Dw4j9Eb191GGtxO+kaFV2oCJGaeHrLbPO2wDm w02dFo6KigLDJab8H+lMKDUgNEAJHl/2FhCm5dE2+C9g5FveVf6+UU5uA05LJRatxLfu 5un2GzLWtiDNTF9BUfMkzRTjJmjXMCCPEhITj+H9w+RUFSwUPQtX5uASxpAM0ZsiK6Gv VPUAYjvhXxlKuQC/GeGzIX6ss5/ugtMunvHrIzBBjhhQ41y6sxXpOYen8ZIL/+0WApDW CPLM/JTKsUmmXZVylaA7TSampGklQD/PrH6BQjLGBkmQOmp6ngIijccYEJG1XeDzQQHn GhHw== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@ti.com header.s=ti-com-17Q1 header.b=y7uOmGHj; spf=pass (google.com: best guess record for domain of dri-devel-bounces@lists.freedesktop.org designates 131.252.210.177 as permitted sender) smtp.mailfrom=dri-devel-bounces@lists.freedesktop.org; dmarc=fail (p=QUARANTINE sp=NONE dis=NONE) header.from=ti.com Return-Path: Received: from gabe.freedesktop.org (gabe.freedesktop.org. [131.252.210.177]) by mx.google.com with ESMTPS id h127si378192pgc.308.2018.02.28.03.28.44 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Wed, 28 Feb 2018 03:28:45 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of dri-devel-bounces@lists.freedesktop.org designates 131.252.210.177 as permitted sender) client-ip=131.252.210.177; Authentication-Results: mx.google.com; dkim=neutral (body hash did not verify) header.i=@ti.com header.s=ti-com-17Q1 header.b=y7uOmGHj; spf=pass (google.com: best guess record for domain of dri-devel-bounces@lists.freedesktop.org designates 131.252.210.177 as permitted sender) smtp.mailfrom=dri-devel-bounces@lists.freedesktop.org; dmarc=fail (p=QUARANTINE sp=NONE dis=NONE) header.from=ti.com Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 13EF96E971; Wed, 28 Feb 2018 11:27:43 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from lelnx193.ext.ti.com (lelnx193.ext.ti.com [198.47.27.77]) by gabe.freedesktop.org (Postfix) with ESMTPS id B3D3A6E96B for ; Wed, 28 Feb 2018 11:27:39 +0000 (UTC) Received: from dlelxv90.itg.ti.com ([172.17.2.17]) by lelnx193.ext.ti.com (8.15.1/8.15.1) with ESMTP id w1SBRbkA008407; Wed, 28 Feb 2018 05:27:37 -0600 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ti.com; s=ti-com-17Q1; t=1519817257; bh=IEoS6G2/z37MVXRNRckKaH1pOh5R/yW0Vn3j6zuTQQI=; h=From:To:CC:Subject:Date:In-Reply-To:References; b=y7uOmGHj+xJqqvCX09fHaxDzbS7krBasLnsA/gViXShIIhyrDLmepkCJkGLnsJPsw T8EY8DJxW8PRU0Pis7I0aEOmbX/icXsDmvK2QrS6fJ3ugnxp9BPi78YjNpFVEh+EyW 1emI4SurR2qA5eC6+9Hxb726w80n8QneAK3z9Sks= Received: from DLEE100.ent.ti.com (dlee100.ent.ti.com [157.170.170.30]) by dlelxv90.itg.ti.com (8.14.3/8.13.8) with ESMTP id w1SBRbwN031559; Wed, 28 Feb 2018 05:27:37 -0600 Received: from DLEE104.ent.ti.com (157.170.170.34) by DLEE100.ent.ti.com (157.170.170.30) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1261.35; Wed, 28 Feb 2018 05:27:37 -0600 Received: from dflp32.itg.ti.com (10.64.6.15) by DLEE104.ent.ti.com (157.170.170.34) with Microsoft SMTP Server (version=TLS1_0, cipher=TLS_RSA_WITH_AES_256_CBC_SHA) id 15.1.1261.35 via Frontend Transport; Wed, 28 Feb 2018 05:27:36 -0600 Received: from deskari.ti.com (ileax41-snat.itg.ti.com [10.172.224.153]) by dflp32.itg.ti.com (8.14.3/8.13.8) with ESMTP id w1SBRAfW024563; Wed, 28 Feb 2018 05:27:35 -0600 From: Tomi Valkeinen To: , Laurent Pinchart Subject: [PATCHv2 13/17] drm/omap: fix scaling limits for WB Date: Wed, 28 Feb 2018 13:26:10 +0200 Message-ID: <1519817174-20714-14-git-send-email-tomi.valkeinen@ti.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1519817174-20714-1-git-send-email-tomi.valkeinen@ti.com> References: <1519817174-20714-1-git-send-email-tomi.valkeinen@ti.com> MIME-Version: 1.0 X-EXCLAIMER-MD-CONFIG: e1e8a2fd-e40a-4ac6-ac9b-f7e9cc9ee180 X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Peter Ujfalusi , Tomi Valkeinen , Jyri Sarha Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" WB has additional scaling limits when the output color format is one of the YUV formats. These limits are not handled at the moment, causing bad scaling and/or NULL dereference crash. This patchs adds the check so that dispc returns an error for bad scaling request. Signed-off-by: Tomi Valkeinen --- drivers/gpu/drm/omapdrm/dss/dispc.c | 24 ++++++++++++++++++++---- 1 file changed, 20 insertions(+), 4 deletions(-) diff --git a/drivers/gpu/drm/omapdrm/dss/dispc.c b/drivers/gpu/drm/omapdrm/dss/dispc.c index 72f00e8a1329..2aa72845f819 100644 --- a/drivers/gpu/drm/omapdrm/dss/dispc.c +++ b/drivers/gpu/drm/omapdrm/dss/dispc.c @@ -2475,6 +2475,7 @@ static int dispc_ovl_calc_scaling_44xx(struct dispc_device *dispc, ((dividend) * 100 / (divisor) - ((dividend) / (divisor) * 100)) static int dispc_ovl_calc_scaling(struct dispc_device *dispc, + enum omap_plane_id plane, unsigned long pclk, unsigned long lclk, enum omap_overlay_caps caps, const struct videomode *vm, @@ -2485,7 +2486,8 @@ static int dispc_ovl_calc_scaling(struct dispc_device *dispc, enum omap_dss_rotation_type rotation_type, bool mem_to_mem) { - const int maxdownscale = dispc->feat->max_downscale; + int maxhdownscale = dispc->feat->max_downscale; + int maxvdownscale = dispc->feat->max_downscale; const int max_decim_limit = 16; unsigned long core_clk = 0; int decim_x, decim_y, ret; @@ -2493,6 +2495,20 @@ static int dispc_ovl_calc_scaling(struct dispc_device *dispc, if (width == out_width && height == out_height) return 0; + if (plane == OMAP_DSS_WB) { + switch (fourcc) { + case DRM_FORMAT_NV12: + maxhdownscale = maxvdownscale = 2; + break; + case DRM_FORMAT_YUYV: + case DRM_FORMAT_UYVY: + maxhdownscale = 2; + maxvdownscale = 4; + break; + default: + break; + } + } if (!mem_to_mem && (pclk == 0 || vm->pixelclock == 0)) { DSSERR("cannot calculate scaling settings: pclk is zero\n"); return -EINVAL; @@ -2510,8 +2526,8 @@ static int dispc_ovl_calc_scaling(struct dispc_device *dispc, 2 : max_decim_limit; } - decim_x = DIV_ROUND_UP(DIV_ROUND_UP(width, out_width), maxdownscale); - decim_y = DIV_ROUND_UP(DIV_ROUND_UP(height, out_height), maxdownscale); + decim_x = DIV_ROUND_UP(DIV_ROUND_UP(width, out_width), maxhdownscale); + decim_y = DIV_ROUND_UP(DIV_ROUND_UP(height, out_height), maxvdownscale); if (decim_x > *x_predecim || out_width > width * 8) return -EINVAL; @@ -2615,7 +2631,7 @@ static int dispc_ovl_setup_common(struct dispc_device *dispc, if (!dispc_ovl_color_mode_supported(dispc, plane, fourcc)) return -EINVAL; - r = dispc_ovl_calc_scaling(dispc, pclk, lclk, caps, vm, in_width, + r = dispc_ovl_calc_scaling(dispc, plane, pclk, lclk, caps, vm, in_width, in_height, out_width, out_height, fourcc, &five_taps, &x_predecim, &y_predecim, pos_x, rotation_type, mem_to_mem); From patchwork Wed Feb 28 11:26:11 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tomi Valkeinen X-Patchwork-Id: 129961 Delivered-To: patch@linaro.org Received: by 10.46.66.2 with SMTP id p2csp909212lja; Wed, 28 Feb 2018 03:28:28 -0800 (PST) X-Google-Smtp-Source: AH8x224Ab5xWb2OzZ/VVTKR68e89PFhxSA6RlJ7KRFNApUFSOF/LeMzLWeHsIpGd2ZOnKfNxVPr6 X-Received: by 10.98.156.148 with SMTP id u20mr17257567pfk.167.1519817308605; Wed, 28 Feb 2018 03:28:28 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1519817308; cv=none; d=google.com; s=arc-20160816; b=NO7ooZO8rvePo0M95fFbUNbC3Ev1JHvwMTVHkX3fhX/Dk8gOQCxNJE9y1OUW49nj3z Dgp4kCLnjhtqE/shbtBckFY8PgmdDwRu4UkPu/Qpc3Brn4NjLY+jgS2IryiXsdikI491 Lj8ahtB99U823RUDvyjC1eeFotxgmFPoc7G4caV5Qg+T1Y3xTsdXdE/jiP4JTfVF2k8G k0K3gfPfBw9M4Z0chWYLYAUj72+30ANadxg1fffuY8ogNC960JSZtHSRwt+MzSzG8jAl tLTbUVy4mv1UmxI5S/zaZXPIm8P21eVF5aBV2kINwVAPFX6xLkGRGXpncRQwKOAKdee/ WjKQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:cc:list-subscribe :list-help:list-post:list-archive:list-unsubscribe:list-id :precedence:mime-version:references:in-reply-to:message-id:date :subject:to:from:dkim-signature:delivered-to :arc-authentication-results; bh=09QtMkb/VqLTIGiOLJCqhHjqvWQVjvrxucxnwMn/Jls=; b=k0+TNkgNkTkyrR4fhCoWn6U+SEM8DiPJ7WhjkZRawQkhHRz2unMLYd11hD8VB5HaNg Vfa4l5bF2DCVxk6dYDhNVoTKPnd2SrlZTl9+Z4e1EMl5CY2Bv7bWQ3U1Rr63FZeEnKhN pNqrJoTy67bcBLapww8AklyFhXgLG+WY9+rYYHoOQlKoSdWViHx/jXqFqG8FNNGrxg7H U2t+nsjLNsjWv4CriZUUqfxnkZ1IIZ2kYm86U3YBjKyqVW12mjB5uGQ1rYuLDONxAvak 2NMbFPfIUtKklyp28jaJcmmprlp6BecDkudF2QL7TquWklvCRjuXBi15gtuuCMSG2NXH n/dQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@ti.com header.s=ti-com-17Q1 header.b=EzAghbql; spf=pass (google.com: best guess record for domain of dri-devel-bounces@lists.freedesktop.org designates 131.252.210.177 as permitted sender) smtp.mailfrom=dri-devel-bounces@lists.freedesktop.org; dmarc=fail (p=QUARANTINE sp=NONE dis=NONE) header.from=ti.com Return-Path: Received: from gabe.freedesktop.org (gabe.freedesktop.org. [131.252.210.177]) by mx.google.com with ESMTPS id c18-v6si648079pls.503.2018.02.28.03.28.28 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Wed, 28 Feb 2018 03:28:28 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of dri-devel-bounces@lists.freedesktop.org designates 131.252.210.177 as permitted sender) client-ip=131.252.210.177; Authentication-Results: mx.google.com; dkim=neutral (body hash did not verify) header.i=@ti.com header.s=ti-com-17Q1 header.b=EzAghbql; spf=pass (google.com: best guess record for domain of dri-devel-bounces@lists.freedesktop.org designates 131.252.210.177 as permitted sender) smtp.mailfrom=dri-devel-bounces@lists.freedesktop.org; dmarc=fail (p=QUARANTINE sp=NONE dis=NONE) header.from=ti.com Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id D69A06E977; Wed, 28 Feb 2018 11:27:46 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from lelnx194.ext.ti.com (lelnx194.ext.ti.com [198.47.27.80]) by gabe.freedesktop.org (Postfix) with ESMTPS id A51366E96E for ; Wed, 28 Feb 2018 11:27:41 +0000 (UTC) Received: from dlelxv90.itg.ti.com ([172.17.2.17]) by lelnx194.ext.ti.com (8.15.1/8.15.1) with ESMTP id w1SBRdqw004191; Wed, 28 Feb 2018 05:27:39 -0600 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ti.com; s=ti-com-17Q1; t=1519817259; bh=gSV+veEXFuoDSN3au+GhYIQJYGyUuYlWhRoP68X1X0k=; h=From:To:CC:Subject:Date:In-Reply-To:References; b=EzAghbqlb0mWDTHLslGMVHtYu+swyP4nFKzoHhdKwJhiq8CAKXkg+7D9ybvwUG21u ED666sxode1HTkJPHEHE8JGSo156LgFlwgmEpInlE4brucdhwe0jQKFyK3Zu+97zbr sc7Ic3Fb+Ko4UovnujqtIUqY6rH2D/yyBxyxJ1u4= Received: from DLEE102.ent.ti.com (dlee102.ent.ti.com [157.170.170.32]) by dlelxv90.itg.ti.com (8.14.3/8.13.8) with ESMTP id w1SBRdeA031598; Wed, 28 Feb 2018 05:27:39 -0600 Received: from DLEE101.ent.ti.com (157.170.170.31) by DLEE102.ent.ti.com (157.170.170.32) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1261.35; Wed, 28 Feb 2018 05:27:38 -0600 Received: from dflp32.itg.ti.com (10.64.6.15) by DLEE101.ent.ti.com (157.170.170.31) with Microsoft SMTP Server (version=TLS1_0, cipher=TLS_RSA_WITH_AES_256_CBC_SHA) id 15.1.1261.35 via Frontend Transport; Wed, 28 Feb 2018 05:27:38 -0600 Received: from deskari.ti.com (ileax41-snat.itg.ti.com [10.172.224.153]) by dflp32.itg.ti.com (8.14.3/8.13.8) with ESMTP id w1SBRAfX024563; Wed, 28 Feb 2018 05:27:37 -0600 From: Tomi Valkeinen To: , Laurent Pinchart Subject: [PATCHv2 14/17] drm/omap: add writeback funcs to dispc_ops Date: Wed, 28 Feb 2018 13:26:11 +0200 Message-ID: <1519817174-20714-15-git-send-email-tomi.valkeinen@ti.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1519817174-20714-1-git-send-email-tomi.valkeinen@ti.com> References: <1519817174-20714-1-git-send-email-tomi.valkeinen@ti.com> MIME-Version: 1.0 X-EXCLAIMER-MD-CONFIG: e1e8a2fd-e40a-4ac6-ac9b-f7e9cc9ee180 X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Peter Ujfalusi , Tomi Valkeinen , Jyri Sarha Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" Add writeback specific dispc functions to dispc_ops so that omapdrm can use them. Also move 'enum dss_writeback_channel' to the public omapdss.h for omapdrm. Signed-off-by: Tomi Valkeinen --- drivers/gpu/drm/omapdrm/dss/dispc.c | 19 +++++++++++++++---- drivers/gpu/drm/omapdrm/dss/dss.h | 21 --------------------- drivers/gpu/drm/omapdrm/dss/omapdss.h | 20 ++++++++++++++++++++ 3 files changed, 35 insertions(+), 25 deletions(-) diff --git a/drivers/gpu/drm/omapdrm/dss/dispc.c b/drivers/gpu/drm/omapdrm/dss/dispc.c index 2aa72845f819..57960df1517a 100644 --- a/drivers/gpu/drm/omapdrm/dss/dispc.c +++ b/drivers/gpu/drm/omapdrm/dss/dispc.c @@ -715,7 +715,7 @@ static u32 dispc_mgr_get_sync_lost_irq(struct dispc_device *dispc, return mgr_desc[channel].sync_lost_irq; } -u32 dispc_wb_get_framedone_irq(struct dispc_device *dispc) +static u32 dispc_wb_get_framedone_irq(struct dispc_device *dispc) { return DISPC_IRQ_FRAMEDONEWB; } @@ -750,12 +750,12 @@ static void dispc_mgr_go(struct dispc_device *dispc, enum omap_channel channel) mgr_fld_write(dispc, channel, DISPC_MGR_FLD_GO, 1); } -bool dispc_wb_go_busy(struct dispc_device *dispc) +static bool dispc_wb_go_busy(struct dispc_device *dispc) { return REG_GET(dispc, DISPC_CONTROL2, 6, 6) == 1; } -void dispc_wb_go(struct dispc_device *dispc) +static void dispc_wb_go(struct dispc_device *dispc) { enum omap_plane_id plane = OMAP_DSS_WB; bool enable, go; @@ -2771,7 +2771,7 @@ static int dispc_ovl_setup(struct dispc_device *dispc, return r; } -int dispc_wb_setup(struct dispc_device *dispc, +static int dispc_wb_setup(struct dispc_device *dispc, const struct omap_dss_writeback_info *wi, bool mem_to_mem, const struct videomode *vm, enum dss_writeback_channel channel_in) @@ -2854,6 +2854,11 @@ int dispc_wb_setup(struct dispc_device *dispc, return 0; } +static bool dispc_has_writeback(struct dispc_device *dispc) +{ + return dispc->feat->has_writeback; +} + static int dispc_ovl_enable(struct dispc_device *dispc, enum omap_plane_id plane, bool enable) { @@ -4709,6 +4714,12 @@ static const struct dispc_ops dispc_ops = { .ovl_enable = dispc_ovl_enable, .ovl_setup = dispc_ovl_setup, .ovl_get_color_modes = dispc_ovl_get_color_modes, + + .wb_get_framedone_irq = dispc_wb_get_framedone_irq, + .wb_setup = dispc_wb_setup, + .has_writeback = dispc_has_writeback, + .wb_go_busy = dispc_wb_go_busy, + .wb_go = dispc_wb_go, }; /* DISPC HW IP initialisation */ diff --git a/drivers/gpu/drm/omapdrm/dss/dss.h b/drivers/gpu/drm/omapdrm/dss/dss.h index c56c3c59bf18..c601ed9a09c2 100644 --- a/drivers/gpu/drm/omapdrm/dss/dss.h +++ b/drivers/gpu/drm/omapdrm/dss/dss.h @@ -102,17 +102,6 @@ enum dss_dsi_content_type { DSS_DSI_CONTENT_GENERIC, }; -enum dss_writeback_channel { - DSS_WB_LCD1_MGR = 0, - DSS_WB_LCD2_MGR = 1, - DSS_WB_TV_MGR = 2, - DSS_WB_OVL0 = 3, - DSS_WB_OVL1 = 4, - DSS_WB_OVL2 = 5, - DSS_WB_OVL3 = 6, - DSS_WB_LCD3_MGR = 7, -}; - enum dss_clk_source { DSS_CLK_SRC_FCK = 0, @@ -448,16 +437,6 @@ int dispc_mgr_get_clock_div(struct dispc_device *dispc, struct dispc_clock_info *cinfo); void dispc_set_tv_pclk(struct dispc_device *dispc, unsigned long pclk); -u32 dispc_wb_get_framedone_irq(struct dispc_device *dispc); -bool dispc_wb_go_busy(struct dispc_device *dispc); -void dispc_wb_go(struct dispc_device *dispc); -void dispc_wb_set_channel_in(struct dispc_device *dispc, - enum dss_writeback_channel channel); -int dispc_wb_setup(struct dispc_device *dispc, - const struct omap_dss_writeback_info *wi, - bool mem_to_mem, const struct videomode *vm, - enum dss_writeback_channel channel_in); - #ifdef CONFIG_OMAP2_DSS_COLLECT_IRQ_STATS static inline void dss_collect_irq_stats(u32 irqstatus, unsigned int *irq_arr) { diff --git a/drivers/gpu/drm/omapdrm/dss/omapdss.h b/drivers/gpu/drm/omapdrm/dss/omapdss.h index 162f36fa3431..14d74adb13fb 100644 --- a/drivers/gpu/drm/omapdrm/dss/omapdss.h +++ b/drivers/gpu/drm/omapdrm/dss/omapdss.h @@ -626,6 +626,17 @@ omapdss_of_find_source_for_first_ep(struct device_node *node); struct device_node *dss_of_port_get_parent_device(struct device_node *port); u32 dss_of_port_get_port_number(struct device_node *port); +enum dss_writeback_channel { + DSS_WB_LCD1_MGR = 0, + DSS_WB_LCD2_MGR = 1, + DSS_WB_TV_MGR = 2, + DSS_WB_OVL0 = 3, + DSS_WB_OVL1 = 4, + DSS_WB_OVL2 = 5, + DSS_WB_OVL3 = 6, + DSS_WB_LCD3_MGR = 7, +}; + struct dss_mgr_ops { int (*connect)(struct omap_drm_private *priv, enum omap_channel channel, @@ -732,6 +743,15 @@ struct dispc_ops { const u32 *(*ovl_get_color_modes)(struct dispc_device *dispc, enum omap_plane_id plane); + + u32 (*wb_get_framedone_irq)(struct dispc_device *dispc); + int (*wb_setup)(struct dispc_device *dispc, + const struct omap_dss_writeback_info *wi, + bool mem_to_mem, const struct videomode *vm, + enum dss_writeback_channel channel_in); + bool (*has_writeback)(struct dispc_device *dispc); + bool (*wb_go_busy)(struct dispc_device *dispc); + void (*wb_go)(struct dispc_device *dispc); }; struct dispc_device *dispc_get_dispc(struct dss_device *dss); From patchwork Wed Feb 28 11:26:12 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tomi Valkeinen X-Patchwork-Id: 129959 Delivered-To: patch@linaro.org Received: by 10.46.66.2 with SMTP id p2csp909134lja; Wed, 28 Feb 2018 03:28:22 -0800 (PST) X-Google-Smtp-Source: AH8x22477EoeQPCX5qcKbU5rJdwX7moC9YtqStDYiMwoznpWhNrHOLMUAaJKJ9PtpjCS9FqiPKfw X-Received: by 10.167.129.195 with SMTP id c3mr17336525pfn.14.1519817302540; Wed, 28 Feb 2018 03:28:22 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1519817302; cv=none; d=google.com; s=arc-20160816; b=sk26X3LwbJCuGcRlfPCWvW9+UFL2Z/7TpTDZ4B2MwEAppxMptNkvHEfCgDspET11xu seNRzDcVIyV4KL0vGyBI0evC5rTZnsc0qZvIpMz8XXl9o+X0Q3tKDBj0Dl8RB8AXuy06 g5M236WPnY2dz39hVi3udItfA+V5xeOcA+bHEBiJa5CdxmyUunGbOOe8akhAj3klvXr4 DHIitFPUYkTcTP1kURVEiNXZo3/RRZYBYChNZaw7P7MXUNsywLd8BbQWhaqqW7nJGjtt Zc5/EeEg5WjOvLLCVKEhcCJf2pF/h4RLVwY6c+Ip63+5fmfdGEH9I07fcjIxMLFjpDkQ k4DQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:cc:list-subscribe :list-help:list-post:list-archive:list-unsubscribe:list-id :precedence:mime-version:references:in-reply-to:message-id:date :subject:to:from:dkim-signature:delivered-to :arc-authentication-results; bh=KuzzgYeAW0aZFujplBsZaHTTp5MqIPQOFTYTUHCPzGA=; b=wUx4MODuHTfiW6vtkTYQBVAxsMba17HBs4ARnO9QdtkThLP5rJwdxspHfpuINwX0dJ 8vXpX+RpJ7qyB8HSAdWG1BcnlEk5BO3lAirCh7MaAC9D5suxZhPwaPowf8wfzHTV7/XI pVyUWgQKTIxot9OW/SQiU194AKlQcdKwSFy1hx0pDVrElQvI+Ib6ffGR0QDELObOsqVL zePsyAIcpNZJ1FV/Kl1vvaCvfzYgjG/4BFPCnQuoj/gY/EczfLH5yTVVZkmUil1I0F5K 6LYM0xoTeb/32PCZf5cpWZuOLPeCMvbiqnhi3voutZKthsdJMVNalF5S/LQ8sCKugcde n1+w== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@ti.com header.s=ti-com-17Q1 header.b=Fuv7HZZ1; spf=pass (google.com: best guess record for domain of dri-devel-bounces@lists.freedesktop.org designates 131.252.210.177 as permitted sender) smtp.mailfrom=dri-devel-bounces@lists.freedesktop.org; dmarc=fail (p=QUARANTINE sp=NONE dis=NONE) header.from=ti.com Return-Path: Received: from gabe.freedesktop.org (gabe.freedesktop.org. [131.252.210.177]) by mx.google.com with ESMTPS id 33-v6si1149020plo.650.2018.02.28.03.28.22 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Wed, 28 Feb 2018 03:28:22 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of dri-devel-bounces@lists.freedesktop.org designates 131.252.210.177 as permitted sender) client-ip=131.252.210.177; Authentication-Results: mx.google.com; dkim=neutral (body hash did not verify) header.i=@ti.com header.s=ti-com-17Q1 header.b=Fuv7HZZ1; spf=pass (google.com: best guess record for domain of dri-devel-bounces@lists.freedesktop.org designates 131.252.210.177 as permitted sender) smtp.mailfrom=dri-devel-bounces@lists.freedesktop.org; dmarc=fail (p=QUARANTINE sp=NONE dis=NONE) header.from=ti.com Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 0939F6E972; Wed, 28 Feb 2018 11:27:46 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from fllnx209.ext.ti.com (fllnx209.ext.ti.com [198.47.19.16]) by gabe.freedesktop.org (Postfix) with ESMTPS id A6A2E6E972 for ; Wed, 28 Feb 2018 11:27:43 +0000 (UTC) Received: from dlelxv90.itg.ti.com ([172.17.2.17]) by fllnx209.ext.ti.com (8.15.1/8.15.1) with ESMTP id w1SBRfhP004909; Wed, 28 Feb 2018 05:27:41 -0600 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ti.com; s=ti-com-17Q1; t=1519817261; bh=ssMfbSFvXItiXRkftvG3TJ7tQ3o1sfsSCaCMXT5E/M0=; h=From:To:CC:Subject:Date:In-Reply-To:References; b=Fuv7HZZ14g2eqiO5fRk9yBBvZO0D8E8c0xScX+IIZTslm6XcOm6HAqKnVgYfQIi0e gEri0gT5eBF6eCSM243A2vPaJksfaRrUy1932d6pwBUjD9TEOCKjgMNIfoXivlZHMw 6ygjUqWjkZei8CG6zuZSAm4YLWdl6QSrCtlRaBbU= Received: from DLEE102.ent.ti.com (dlee102.ent.ti.com [157.170.170.32]) by dlelxv90.itg.ti.com (8.14.3/8.13.8) with ESMTP id w1SBRfi0031617; Wed, 28 Feb 2018 05:27:41 -0600 Received: from DLEE101.ent.ti.com (157.170.170.31) by DLEE102.ent.ti.com (157.170.170.32) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1261.35; Wed, 28 Feb 2018 05:27:40 -0600 Received: from dflp32.itg.ti.com (10.64.6.15) by DLEE101.ent.ti.com (157.170.170.31) with Microsoft SMTP Server (version=TLS1_0, cipher=TLS_RSA_WITH_AES_256_CBC_SHA) id 15.1.1261.35 via Frontend Transport; Wed, 28 Feb 2018 05:27:40 -0600 Received: from deskari.ti.com (ileax41-snat.itg.ti.com [10.172.224.153]) by dflp32.itg.ti.com (8.14.3/8.13.8) with ESMTP id w1SBRAfY024563; Wed, 28 Feb 2018 05:27:39 -0600 From: Tomi Valkeinen To: , Laurent Pinchart Subject: [PATCHv2 15/17] drm/omap: fix maximum sizes Date: Wed, 28 Feb 2018 13:26:12 +0200 Message-ID: <1519817174-20714-16-git-send-email-tomi.valkeinen@ti.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1519817174-20714-1-git-send-email-tomi.valkeinen@ti.com> References: <1519817174-20714-1-git-send-email-tomi.valkeinen@ti.com> MIME-Version: 1.0 X-EXCLAIMER-MD-CONFIG: e1e8a2fd-e40a-4ac6-ac9b-f7e9cc9ee180 X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Peter Ujfalusi , Tomi Valkeinen , Jyri Sarha Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" We define max width and height in mode_config to 2048. These maximums affect many things, which are independent and depend on platform. We need to do more fine grained checks in the code paths for each component, and so the maximum values in mode_config should just be "big enough" to cover all use cases. Change the maximum width & height to 8192. Signed-off-by: Tomi Valkeinen --- drivers/gpu/drm/omapdrm/omap_drv.c | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/drivers/gpu/drm/omapdrm/omap_drv.c b/drivers/gpu/drm/omapdrm/omap_drv.c index 4f48b908bdc6..3632854c2b91 100644 --- a/drivers/gpu/drm/omapdrm/omap_drv.c +++ b/drivers/gpu/drm/omapdrm/omap_drv.c @@ -310,11 +310,14 @@ static int omap_modeset_init(struct drm_device *dev) dev->mode_config.min_width = 8; dev->mode_config.min_height = 2; - /* note: eventually will need some cpu_is_omapXYZ() type stuff here - * to fill in these limits properly on different OMAP generations.. + /* + * Note: these values are used for multiple independent things: + * connector mode filtering, buffer sizes, crtc sizes... + * Use big enough values here to cover all use cases, and do more + * specific checking in the respective code paths. */ - dev->mode_config.max_width = 2048; - dev->mode_config.max_height = 2048; + dev->mode_config.max_width = 8192; + dev->mode_config.max_height = 8192; dev->mode_config.funcs = &omap_mode_config_funcs; dev->mode_config.helper_private = &omap_mode_config_helper_funcs; From patchwork Wed Feb 28 11:26:13 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tomi Valkeinen X-Patchwork-Id: 129963 Delivered-To: patch@linaro.org Received: by 10.46.66.2 with SMTP id p2csp909348lja; Wed, 28 Feb 2018 03:28:37 -0800 (PST) X-Google-Smtp-Source: AH8x224x+9XELotStV2IdGyHtpDBKAyt+EY3Nxtf7fdGOKoT58eUwx22qDmcnuRIe5XOx6P6o1NS X-Received: by 10.99.117.28 with SMTP id q28mr14021170pgc.187.1519817317215; Wed, 28 Feb 2018 03:28:37 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1519817317; cv=none; d=google.com; s=arc-20160816; b=Xcc7ucvLschjKHn9m4N2xGSbL2D+C4VjcJwcEFr5BUiLk0X/3oyuTtd59sHD7VoP44 uoVVPnlGtHYWKJYdCzjSUt3bncr1eSZ/qbKGz9agfwy2tMWpMD49k8XxUPTuv3/eTxvY K+AWXv/5k24D2HafSCZhCSiKt0qn0fkAnCjcYWkgI2XZfSMGzjv0ULsHRjZAd0wNTz8/ za/8KeciryHZDK4p4F400lXIM4nUtD0QFByI6/LACx+PUYsKv81onfRafEBAiUI3zQ+b rMLXIEC2Zd4gbhMjfG8EgeMOmpEXE3WE2D6hkByWW2iYix54Tpz5Xux0JHipkwT+09g+ TlSQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:cc:list-subscribe :list-help:list-post:list-archive:list-unsubscribe:list-id :precedence:mime-version:references:in-reply-to:message-id:date :subject:to:from:dkim-signature:delivered-to :arc-authentication-results; bh=GrgmQgf/MI2dcSZ4l6aN8oYxvly9Amv4VNc/jeTIYjg=; b=IngmpbGPqcYmnPiHyj8kVL5Tj/njYiWJTd+SW94AS75jtuGu5CNF0yU84KksiuXcwI VotZVINejsL1fB5ivkiezXCgAbH7OYRC7Yr3fa8mAbMrSJmtTYchczb+NJzNk3Ne80fp J2H6AoaTC105yuesZtThtg7I8sBO6LSi5RxAPtd8JqhdnUwF3UdT53wDRo85xH4gLPGP nGbFk8SVoNCSSu8oCdM/R9cJTEqp2NmEO3c6z4Y8PAw4aEf1IZulHnYos+hd1JNukpo9 1PP61S9Nunw89B0b8db4y93u2pv++ShSEMHOiVPhXhp3uo1NrARlKkW6+YH5cvr+nE1V znLw== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@ti.com header.s=ti-com-17Q1 header.b=KeQop9m2; spf=pass (google.com: best guess record for domain of dri-devel-bounces@lists.freedesktop.org designates 131.252.210.177 as permitted sender) smtp.mailfrom=dri-devel-bounces@lists.freedesktop.org; dmarc=fail (p=QUARANTINE sp=NONE dis=NONE) header.from=ti.com Return-Path: Received: from gabe.freedesktop.org (gabe.freedesktop.org. [131.252.210.177]) by mx.google.com with ESMTPS id s11si921905pgn.207.2018.02.28.03.28.36 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Wed, 28 Feb 2018 03:28:37 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of dri-devel-bounces@lists.freedesktop.org designates 131.252.210.177 as permitted sender) client-ip=131.252.210.177; Authentication-Results: mx.google.com; dkim=neutral (body hash did not verify) header.i=@ti.com header.s=ti-com-17Q1 header.b=KeQop9m2; spf=pass (google.com: best guess record for domain of dri-devel-bounces@lists.freedesktop.org designates 131.252.210.177 as permitted sender) smtp.mailfrom=dri-devel-bounces@lists.freedesktop.org; dmarc=fail (p=QUARANTINE sp=NONE dis=NONE) header.from=ti.com Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 0A2F26E918; Wed, 28 Feb 2018 11:27:49 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from lelnx194.ext.ti.com (lelnx194.ext.ti.com [198.47.27.80]) by gabe.freedesktop.org (Postfix) with ESMTPS id 0F0746E972 for ; Wed, 28 Feb 2018 11:27:45 +0000 (UTC) Received: from dflxv15.itg.ti.com ([128.247.5.124]) by lelnx194.ext.ti.com (8.15.1/8.15.1) with ESMTP id w1SBRgTN004206; Wed, 28 Feb 2018 05:27:42 -0600 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ti.com; s=ti-com-17Q1; t=1519817262; bh=MtNW/YdDWsWXIcUyewtfNPQ/FBbvEr4GeV58O7SnCMU=; h=From:To:CC:Subject:Date:In-Reply-To:References; b=KeQop9m2gFZry/YP3Inil0y84mrOk6fL90+gNO20Owc7AQFTuylTjrMYAF7U/LcXn b1lV10eATq+lJJ8nCqr7ocSHIZOMUSLWal0md0fHeUxPjIKoknDyVGD+eQwRCzD1FN /+GOVa0N7DCO3zpJCgJbeDhT2j3hJoq8mqy55tNg= Received: from DFLE105.ent.ti.com (dfle105.ent.ti.com [10.64.6.26]) by dflxv15.itg.ti.com (8.14.3/8.13.8) with ESMTP id w1SBRgMN021453; Wed, 28 Feb 2018 05:27:42 -0600 Received: from DFLE100.ent.ti.com (10.64.6.21) by DFLE105.ent.ti.com (10.64.6.26) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1261.35; Wed, 28 Feb 2018 05:27:42 -0600 Received: from dflp32.itg.ti.com (10.64.6.15) by DFLE100.ent.ti.com (10.64.6.21) with Microsoft SMTP Server (version=TLS1_0, cipher=TLS_RSA_WITH_AES_256_CBC_SHA) id 15.1.1261.35 via Frontend Transport; Wed, 28 Feb 2018 05:27:42 -0600 Received: from deskari.ti.com (ileax41-snat.itg.ti.com [10.172.224.153]) by dflp32.itg.ti.com (8.14.3/8.13.8) with ESMTP id w1SBRAfZ024563; Wed, 28 Feb 2018 05:27:41 -0600 From: Tomi Valkeinen To: , Laurent Pinchart Subject: [PATCHv2 16/17] drm/omap: Allow HDMI audio setup even if we do not have video configured Date: Wed, 28 Feb 2018 13:26:13 +0200 Message-ID: <1519817174-20714-17-git-send-email-tomi.valkeinen@ti.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1519817174-20714-1-git-send-email-tomi.valkeinen@ti.com> References: <1519817174-20714-1-git-send-email-tomi.valkeinen@ti.com> MIME-Version: 1.0 X-EXCLAIMER-MD-CONFIG: e1e8a2fd-e40a-4ac6-ac9b-f7e9cc9ee180 X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Peter Ujfalusi , Tomi Valkeinen , Jyri Sarha Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" From: Jyri Sarha Allow HDMI audio setup even if we do not have video configured. Audio will get configured at the same time with video if the video is configured soon enough. If it is not the audio DMA will timeout in couple of seconds and audio playback will be aborted. Signed-off-by: Jyri Sarha Signed-off-by: Tomi Valkeinen --- drivers/gpu/drm/omapdrm/dss/hdmi4.c | 33 ++++++++++++++------------------- drivers/gpu/drm/omapdrm/dss/hdmi5.c | 37 ++++++++++++++++--------------------- 2 files changed, 30 insertions(+), 40 deletions(-) diff --git a/drivers/gpu/drm/omapdrm/dss/hdmi4.c b/drivers/gpu/drm/omapdrm/dss/hdmi4.c index 1f7897c58f2f..97c88861d67a 100644 --- a/drivers/gpu/drm/omapdrm/dss/hdmi4.c +++ b/drivers/gpu/drm/omapdrm/dss/hdmi4.c @@ -615,21 +615,16 @@ static int hdmi_audio_startup(struct device *dev, void (*abort_cb)(struct device *dev)) { struct omap_hdmi *hd = dev_get_drvdata(dev); - int ret = 0; mutex_lock(&hd->lock); - if (!hdmi_mode_has_audio(&hd->cfg) || !hd->display_enabled) { - ret = -EPERM; - goto out; - } + WARN_ON(hd->audio_abort_cb != NULL); hd->audio_abort_cb = abort_cb; -out: mutex_unlock(&hd->lock); - return ret; + return 0; } static int hdmi_audio_shutdown(struct device *dev) @@ -650,12 +645,14 @@ static int hdmi_audio_start(struct device *dev) struct omap_hdmi *hd = dev_get_drvdata(dev); unsigned long flags; - WARN_ON(!hdmi_mode_has_audio(&hd->cfg)); - spin_lock_irqsave(&hd->audio_playing_lock, flags); - if (hd->display_enabled) + if (hd->display_enabled) { + if (!hdmi_mode_has_audio(&hd->cfg)) + DSSERR("%s: Video mode does not support audio\n", + __func__); hdmi_start_audio_stream(hd); + } hd->audio_playing = true; spin_unlock_irqrestore(&hd->audio_playing_lock, flags); @@ -686,17 +683,15 @@ static int hdmi_audio_config(struct device *dev, mutex_lock(&hd->lock); - if (!hdmi_mode_has_audio(&hd->cfg) || !hd->display_enabled) { - ret = -EPERM; - goto out; + if (hd->display_enabled) { + ret = hdmi4_audio_config(&hd->core, &hd->wp, dss_audio, + hd->cfg.vm.pixelclock); + if (ret) + goto out; } - ret = hdmi4_audio_config(&hd->core, &hd->wp, dss_audio, - hd->cfg.vm.pixelclock); - if (!ret) { - hd->audio_configured = true; - hd->audio_config = *dss_audio; - } + hd->audio_configured = true; + hd->audio_config = *dss_audio; out: mutex_unlock(&hd->lock); diff --git a/drivers/gpu/drm/omapdrm/dss/hdmi5.c b/drivers/gpu/drm/omapdrm/dss/hdmi5.c index 4a0178ab8016..d28da9ac3e90 100644 --- a/drivers/gpu/drm/omapdrm/dss/hdmi5.c +++ b/drivers/gpu/drm/omapdrm/dss/hdmi5.c @@ -606,21 +606,16 @@ static int hdmi_audio_startup(struct device *dev, void (*abort_cb)(struct device *dev)) { struct omap_hdmi *hd = dev_get_drvdata(dev); - int ret = 0; mutex_lock(&hd->lock); - if (!hdmi_mode_has_audio(&hd->cfg) || !hd->display_enabled) { - ret = -EPERM; - goto out; - } + WARN_ON(hd->audio_abort_cb != NULL); hd->audio_abort_cb = abort_cb; -out: mutex_unlock(&hd->lock); - return ret; + return 0; } static int hdmi_audio_shutdown(struct device *dev) @@ -641,12 +636,14 @@ static int hdmi_audio_start(struct device *dev) struct omap_hdmi *hd = dev_get_drvdata(dev); unsigned long flags; - WARN_ON(!hdmi_mode_has_audio(&hd->cfg)); - spin_lock_irqsave(&hd->audio_playing_lock, flags); - if (hd->display_enabled) + if (hd->display_enabled) { + if (!hdmi_mode_has_audio(&hd->cfg)) + DSSERR("%s: Video mode does not support audio\n", + __func__); hdmi_start_audio_stream(hd); + } hd->audio_playing = true; spin_unlock_irqrestore(&hd->audio_playing_lock, flags); @@ -658,7 +655,8 @@ static void hdmi_audio_stop(struct device *dev) struct omap_hdmi *hd = dev_get_drvdata(dev); unsigned long flags; - WARN_ON(!hdmi_mode_has_audio(&hd->cfg)); + if (!hdmi_mode_has_audio(&hd->cfg)) + DSSERR("%s: Video mode does not support audio\n", __func__); spin_lock_irqsave(&hd->audio_playing_lock, flags); @@ -677,18 +675,15 @@ static int hdmi_audio_config(struct device *dev, mutex_lock(&hd->lock); - if (!hdmi_mode_has_audio(&hd->cfg) || !hd->display_enabled) { - ret = -EPERM; - goto out; + if (hd->display_enabled) { + ret = hdmi5_audio_config(&hd->core, &hd->wp, dss_audio, + hd->cfg.vm.pixelclock); + if (ret) + goto out; } - ret = hdmi5_audio_config(&hd->core, &hd->wp, dss_audio, - hd->cfg.vm.pixelclock); - - if (!ret) { - hd->audio_configured = true; - hd->audio_config = *dss_audio; - } + hd->audio_configured = true; + hd->audio_config = *dss_audio; out: mutex_unlock(&hd->lock); From patchwork Wed Feb 28 11:26:14 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tomi Valkeinen X-Patchwork-Id: 129965 Delivered-To: patch@linaro.org Received: by 10.46.66.2 with SMTP id p2csp909697lja; Wed, 28 Feb 2018 03:29:03 -0800 (PST) X-Google-Smtp-Source: AH8x226/EQikU0N9CvAFQxyUnD9bT5vzvLHzjhxCVoGlpFhv89d04f6ZINqbFTquhSJ62Omd39yN X-Received: by 2002:a17:902:123:: with SMTP id 32-v6mr17970834plb.278.1519817342864; Wed, 28 Feb 2018 03:29:02 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1519817342; cv=none; d=google.com; s=arc-20160816; b=p8toRfiv7ftd+1QTIgLLcHfZHbMKjjWfLbKSTNTJrkDdtWQ8h90hnOzDOT4FmI8fkV YArAz0qBG/C4189b3piWe8OghuFxafhEUGhXg9sS1EJAJhqtE+7nfga6NFREorOSRPOE +t5pxxaYgmUFL8g8lljCHqMB0b5HUkYgFhCnk5jiE5clHXcKVnN8hneDDfH4xMdcWd0W C49E03liMorppVYnzQ4pTJ+rO8iDi1+1ZUVENQq+qrCEUNRHfhqEoyLhIw+VLqSP0s62 zn/Fb3cO+2umUeWlDUPfktEkvbAp5PtmQ7liET1Fg/MN5o2vvur54ah69acsZrq6E+3M a8LQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:cc:list-subscribe :list-help:list-post:list-archive:list-unsubscribe:list-id :precedence:mime-version:references:in-reply-to:message-id:date :subject:to:from:dkim-signature:delivered-to :arc-authentication-results; bh=TSNHCWwdfydfVsgdGWnAaKfCqJL0FoappeMpIiQC9Hw=; b=hhVRv9FEaWfp7DEvpPY6t0fGDJpvvY0FpuMytkO8wtqz4lZJs4U6FLvLLEqTAyL4Ez VNkzwBQ3RHhrvMkOVYqecRYZXEOrwgdAYXLkvuPXnBtbnYi5ZnQAJJbd1/0wDt9UU5rq pD1OB7ghFgXjFsyL7q7JPrU8bWL6NhDD/dNXSxvlyF7+ZRJyU2qMARz8WUQuI36mC+D4 QO0EZfJhu4B9vywNK2WeRY9O8SHvyaoVvMWynBy0nigEmlQdShzne6rlAzCE5uPhrULH CK5ug2IsiHxyNLWv+pbVAHy4svKTVjCb0SJIa45+2gVTkgSlsBatiW07IoPfzUy8i2ML g/2Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@ti.com header.s=ti-com-17Q1 header.b=q2DcYyjq; spf=pass (google.com: best guess record for domain of dri-devel-bounces@lists.freedesktop.org designates 131.252.210.177 as permitted sender) smtp.mailfrom=dri-devel-bounces@lists.freedesktop.org; dmarc=fail (p=QUARANTINE sp=NONE dis=NONE) header.from=ti.com Return-Path: Received: from gabe.freedesktop.org (gabe.freedesktop.org. [131.252.210.177]) by mx.google.com with ESMTPS id a3-v6si1132205plc.370.2018.02.28.03.29.02 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Wed, 28 Feb 2018 03:29:02 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of dri-devel-bounces@lists.freedesktop.org designates 131.252.210.177 as permitted sender) client-ip=131.252.210.177; Authentication-Results: mx.google.com; dkim=neutral (body hash did not verify) header.i=@ti.com header.s=ti-com-17Q1 header.b=q2DcYyjq; spf=pass (google.com: best guess record for domain of dri-devel-bounces@lists.freedesktop.org designates 131.252.210.177 as permitted sender) smtp.mailfrom=dri-devel-bounces@lists.freedesktop.org; dmarc=fail (p=QUARANTINE sp=NONE dis=NONE) header.from=ti.com Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id CB7486E97A; Wed, 28 Feb 2018 11:27:48 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from lelnx193.ext.ti.com (lelnx193.ext.ti.com [198.47.27.77]) by gabe.freedesktop.org (Postfix) with ESMTPS id 6C29E6E97A for ; Wed, 28 Feb 2018 11:27:47 +0000 (UTC) Received: from dlelxv90.itg.ti.com ([172.17.2.17]) by lelnx193.ext.ti.com (8.15.1/8.15.1) with ESMTP id w1SBRjKt008420; Wed, 28 Feb 2018 05:27:45 -0600 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ti.com; s=ti-com-17Q1; t=1519817265; bh=92/fxvXqxY0G3TkpcHFGXplx9ENY9tGk3dPUMnH8RAY=; h=From:To:CC:Subject:Date:In-Reply-To:References; b=q2DcYyjqoq5+lTXLatOyTRX/kFJ83YwyDUWk7rqkWcoY911sZoO7/XH3hJM5xMrI3 MBjhwt5Id2Pf3zN51XN7j37ozqBUb+4vv1Xd/i+e5tNQwZ1VPSIdvTcxRAvw1cBBTk KZEnej35NMFvWKWTg7EtUVGtIR1XBaxOnikH8OCE= Received: from DLEE104.ent.ti.com (dlee104.ent.ti.com [157.170.170.34]) by dlelxv90.itg.ti.com (8.14.3/8.13.8) with ESMTP id w1SBRjT6031671; Wed, 28 Feb 2018 05:27:45 -0600 Received: from DLEE110.ent.ti.com (157.170.170.21) by DLEE104.ent.ti.com (157.170.170.34) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1261.35; Wed, 28 Feb 2018 05:27:44 -0600 Received: from dflp32.itg.ti.com (10.64.6.15) by DLEE110.ent.ti.com (157.170.170.21) with Microsoft SMTP Server (version=TLS1_0, cipher=TLS_RSA_WITH_AES_256_CBC_SHA) id 15.1.1261.35 via Frontend Transport; Wed, 28 Feb 2018 05:27:44 -0600 Received: from deskari.ti.com (ileax41-snat.itg.ti.com [10.172.224.153]) by dflp32.itg.ti.com (8.14.3/8.13.8) with ESMTP id w1SBRAfa024563; Wed, 28 Feb 2018 05:27:42 -0600 From: Tomi Valkeinen To: , Laurent Pinchart Subject: [PATCHv2 17/17] drm/omap: cleanup color space conversion Date: Wed, 28 Feb 2018 13:26:14 +0200 Message-ID: <1519817174-20714-18-git-send-email-tomi.valkeinen@ti.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1519817174-20714-1-git-send-email-tomi.valkeinen@ti.com> References: <1519817174-20714-1-git-send-email-tomi.valkeinen@ti.com> MIME-Version: 1.0 X-EXCLAIMER-MD-CONFIG: e1e8a2fd-e40a-4ac6-ac9b-f7e9cc9ee180 X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Peter Ujfalusi , Tomi Valkeinen , Jyri Sarha Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" The setup code for color space conversion is a bit messy. This patch cleans it up. For some reason the TRM uses values in YCrCb order, which is also used in the current driver, whereas everywhere else it's YCbCr (which also matches YUV order). This patch changes the tables to use the common order to avoid confusion. The tables are split into separate lines, and comments added for clarity. WB color conversion registers are similar but different than non-WB, but the same function was used to write both. It worked fine because the coef table was adjusted accordingly, but that was rather confusing. This patch adds a separate function to write the WB values so that the coef table can be written in an understandable way. Recalculation also showed that 'bcb' value in yuv-to-rgb conversion had been rounded wrongly, and it should be 516 instead of 517. Signed-off-by: Tomi Valkeinen Reviewed-by: Laurent Pinchart --- drivers/gpu/drm/omapdrm/dss/dispc.c | 59 +++++++++++++++++++++++++++---------- 1 file changed, 44 insertions(+), 15 deletions(-) diff --git a/drivers/gpu/drm/omapdrm/dss/dispc.c b/drivers/gpu/drm/omapdrm/dss/dispc.c index 57960df1517a..f688f09b4eae 100644 --- a/drivers/gpu/drm/omapdrm/dss/dispc.c +++ b/drivers/gpu/drm/omapdrm/dss/dispc.c @@ -352,11 +352,6 @@ static const struct { }, }; -struct color_conv_coef { - int ry, rcr, rcb, gy, gcr, gcb, by, bcr, bcb; - int full_range; -}; - static unsigned long dispc_fclk_rate(struct dispc_device *dispc); static unsigned long dispc_core_clk_rate(struct dispc_device *dispc); static unsigned long dispc_mgr_lclk_rate(struct dispc_device *dispc, @@ -868,10 +863,19 @@ static void dispc_ovl_set_scale_coef(struct dispc_device *dispc, } } +struct csc_coef_yuv2rgb { + int ry, rcb, rcr, gy, gcb, gcr, by, bcb, bcr; + bool full_range; +}; + +struct csc_coef_rgb2yuv { + int yr, yg, yb, cbr, cbg, cbb, crr, crg, crb; + bool full_range; +}; static void dispc_ovl_write_color_conv_coef(struct dispc_device *dispc, enum omap_plane_id plane, - const struct color_conv_coef *ct) + const struct csc_coef_yuv2rgb *ct) { #define CVAL(x, y) (FLD_VAL(x, 26, 16) | FLD_VAL(y, 10, 0)) @@ -886,25 +890,50 @@ static void dispc_ovl_write_color_conv_coef(struct dispc_device *dispc, #undef CVAL } +static void dispc_wb_write_color_conv_coef(struct dispc_device *dispc, + const struct csc_coef_rgb2yuv *ct) +{ + const enum omap_plane_id plane = OMAP_DSS_WB; + +#define CVAL(x, y) (FLD_VAL(x, 26, 16) | FLD_VAL(y, 10, 0)) + + dispc_write_reg(dispc, DISPC_OVL_CONV_COEF(plane, 0), CVAL(ct->yg, ct->yr)); + dispc_write_reg(dispc, DISPC_OVL_CONV_COEF(plane, 1), CVAL(ct->crr, ct->yb)); + dispc_write_reg(dispc, DISPC_OVL_CONV_COEF(plane, 2), CVAL(ct->crb, ct->crg)); + dispc_write_reg(dispc, DISPC_OVL_CONV_COEF(plane, 3), CVAL(ct->cbg, ct->cbr)); + dispc_write_reg(dispc, DISPC_OVL_CONV_COEF(plane, 4), CVAL(0, ct->cbb)); + + REG_FLD_MOD(dispc, DISPC_OVL_ATTRIBUTES(plane), !!ct->full_range, 11, 11); + +#undef CVAL +} + static void dispc_setup_color_conv_coef(struct dispc_device *dispc) { int i; int num_ovl = dispc_get_num_ovls(dispc); - const struct color_conv_coef ctbl_bt601_5_ovl = { - /* YUV -> RGB */ - 298, 409, 0, 298, -208, -100, 298, 0, 517, 0, + + /* YUV -> RGB, ITU-R BT.601, limited range */ + const struct csc_coef_yuv2rgb coefs_yuv2rgb_bt601_lim = { + 298, 0, 409, /* ry, rcb, rcr */ + 298, -100, -208, /* gy, gcb, gcr */ + 298, 516, 0, /* by, bcb, bcr */ + false, /* limited range */ }; - const struct color_conv_coef ctbl_bt601_5_wb = { - /* RGB -> YUV */ - 66, 129, 25, 112, -94, -18, -38, -74, 112, 0, + + /* RGB -> YUV, ITU-R BT.601, limited range */ + const struct csc_coef_rgb2yuv coefs_rgb2yuv_bt601_lim = { + 66, 129, 25, /* yr, yg, yb */ + -38, -74, 112, /* cbr, cbg, cbb */ + 112, -94, -18, /* crr, crg, crb */ + false, /* limited range */ }; for (i = 1; i < num_ovl; i++) - dispc_ovl_write_color_conv_coef(dispc, i, &ctbl_bt601_5_ovl); + dispc_ovl_write_color_conv_coef(dispc, i, &coefs_yuv2rgb_bt601_lim); if (dispc->feat->has_writeback) - dispc_ovl_write_color_conv_coef(dispc, OMAP_DSS_WB, - &ctbl_bt601_5_wb); + dispc_wb_write_color_conv_coef(dispc, &coefs_rgb2yuv_bt601_lim); } static void dispc_ovl_set_ba0(struct dispc_device *dispc,