From patchwork Thu Mar 30 07:36:31 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Thomas Zimmermann X-Patchwork-Id: 668799 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id AFA4AC6FD1D for ; Thu, 30 Mar 2023 07:36:52 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230089AbjC3Hgv (ORCPT ); Thu, 30 Mar 2023 03:36:51 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37544 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230339AbjC3Hgm (ORCPT ); Thu, 30 Mar 2023 03:36:42 -0400 Received: from smtp-out1.suse.de (smtp-out1.suse.de [195.135.220.28]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D00E546AD for ; Thu, 30 Mar 2023 00:36:40 -0700 (PDT) Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by smtp-out1.suse.de (Postfix) with ESMTPS id 58D3F21ADF; Thu, 30 Mar 2023 07:36:39 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1680161799; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=BNNOL/lWdVbxL4t1f0l8ZdkexG+cACWw4qmbFgADDvE=; b=akeyAXYrHgfGFSqL9FFlNWaWVotWwL/B8B3iSy9AZGpDRtycaz7jPmlwXhUvX3tuQpfEXc Moy2GQxtrvRyrP6PAbW4EQmHlm40fIAYHQB7DIwaJUTIGDIsaexbbg9b+PoTnmJp3hIYzI MoFJgAuY3KA6h0Uor2H/4c+VBrc2bEQ= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1680161799; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=BNNOL/lWdVbxL4t1f0l8ZdkexG+cACWw4qmbFgADDvE=; b=J46ec2tTFhJQdPCOXUQxX0Gf4NJlmFoSktceKdmQUn5mdP0Llt61Q24PMTazsQW5XWLkA2 KkAzBj/+bdI7beCg== Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by imap2.suse-dmz.suse.de (Postfix) with ESMTPS id 1CFCD1390D; Thu, 30 Mar 2023 07:36:39 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id 4OQRBgc8JWQJewAAMHmgww (envelope-from ); Thu, 30 Mar 2023 07:36:39 +0000 From: Thomas Zimmermann To: inki.dae@samsung.com, sw0312.kim@samsung.com, kyungmin.park@samsung.com, javierm@redhat.com, airlied@gmail.com, daniel@ffwll.ch, krzysztof.kozlowski@linaro.org, alim.akhtar@samsung.com Cc: dri-devel@lists.freedesktop.org, linux-arm-kernel@lists.infradead.org, linux-samsung-soc@vger.kernel.org, Thomas Zimmermann Subject: [PATCH 1/5] drm/exynos: Remove exynos_gem from struct exynos_drm_fbdev Date: Thu, 30 Mar 2023 09:36:31 +0200 Message-Id: <20230330073635.7409-2-tzimmermann@suse.de> X-Mailer: git-send-email 2.40.0 In-Reply-To: <20230330073635.7409-1-tzimmermann@suse.de> References: <20230330073635.7409-1-tzimmermann@suse.de> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-samsung-soc@vger.kernel.org Fbdev's framebuffer stores a pointer to the GEM object. Remove struct exynos_drm_fbdev.exynos_gem, which contains the same value. No functional changes. Signed-off-by: Thomas Zimmermann --- drivers/gpu/drm/exynos/exynos_drm_fbdev.c | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-) diff --git a/drivers/gpu/drm/exynos/exynos_drm_fbdev.c b/drivers/gpu/drm/exynos/exynos_drm_fbdev.c index 4929ffe5a09a..f11895d32982 100644 --- a/drivers/gpu/drm/exynos/exynos_drm_fbdev.c +++ b/drivers/gpu/drm/exynos/exynos_drm_fbdev.c @@ -16,6 +16,7 @@ #include #include #include +#include #include #include #include @@ -32,17 +33,14 @@ struct exynos_drm_fbdev { struct drm_fb_helper drm_fb_helper; - struct exynos_drm_gem *exynos_gem; }; -static int exynos_drm_fb_mmap(struct fb_info *info, - struct vm_area_struct *vma) +static int exynos_drm_fb_mmap(struct fb_info *info, struct vm_area_struct *vma) { struct drm_fb_helper *helper = info->par; - struct exynos_drm_fbdev *exynos_fbd = to_exynos_fbdev(helper); - struct exynos_drm_gem *exynos_gem = exynos_fbd->exynos_gem; + struct drm_gem_object *obj = drm_gem_fb_get_obj(helper->fb, 0); - return drm_gem_prime_mmap(&exynos_gem->base, vma); + return drm_gem_prime_mmap(obj, vma); } static const struct fb_ops exynos_drm_fb_ops = { @@ -89,7 +87,6 @@ static int exynos_drm_fbdev_update(struct drm_fb_helper *helper, static int exynos_drm_fbdev_create(struct drm_fb_helper *helper, struct drm_fb_helper_surface_size *sizes) { - struct exynos_drm_fbdev *exynos_fbdev = to_exynos_fbdev(helper); struct exynos_drm_gem *exynos_gem; struct drm_device *dev = helper->dev; struct drm_mode_fb_cmd2 mode_cmd = { 0 }; @@ -113,8 +110,6 @@ static int exynos_drm_fbdev_create(struct drm_fb_helper *helper, if (IS_ERR(exynos_gem)) return PTR_ERR(exynos_gem); - exynos_fbdev->exynos_gem = exynos_gem; - helper->fb = exynos_drm_framebuffer_init(dev, &mode_cmd, &exynos_gem, 1); if (IS_ERR(helper->fb)) { From patchwork Thu Mar 30 07:36:32 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Thomas Zimmermann X-Patchwork-Id: 669720 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 25ACBC77B6D for ; Thu, 30 Mar 2023 07:36:53 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230177AbjC3Hgw (ORCPT ); Thu, 30 Mar 2023 03:36:52 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38232 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230340AbjC3Hgm (ORCPT ); Thu, 30 Mar 2023 03:36:42 -0400 Received: from smtp-out1.suse.de (smtp-out1.suse.de [IPv6:2001:67c:2178:6::1c]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0C4DE49D8 for ; Thu, 30 Mar 2023 00:36:40 -0700 (PDT) Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by smtp-out1.suse.de (Postfix) with ESMTPS id 9A26421B01; Thu, 30 Mar 2023 07:36:39 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1680161799; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=8ZTpKz6L8f1fe9PoKyrygbmsbD0wLYxCPYj/fI5lK9s=; b=ONBZxDj3kcG+ptzuMVBbpAXGMlKdPCE3xXwLl79Q4OeutUyTV14a9sWDgWVi16qm+j65nR rcymzeezDuu/wIxZN26E6bu9m/RTqqDfRLBSAD+5/VHgPHxfXo3TgYESRuLRZaCLKs66le kKTlJFVpXWDglokMvXxSiLLcUf8RXD4= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1680161799; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=8ZTpKz6L8f1fe9PoKyrygbmsbD0wLYxCPYj/fI5lK9s=; b=sJwECjBDYHomRTTm9jXUNYy+ntj82UsDbDn+tmZBvt3njZrTBexgahRfAoUmGrP6g7+JxE 647xFAOIytcEgJBQ== Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by imap2.suse-dmz.suse.de (Postfix) with ESMTPS id 5DBC81348E; Thu, 30 Mar 2023 07:36:39 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id QD30FQc8JWQJewAAMHmgww (envelope-from ); Thu, 30 Mar 2023 07:36:39 +0000 From: Thomas Zimmermann To: inki.dae@samsung.com, sw0312.kim@samsung.com, kyungmin.park@samsung.com, javierm@redhat.com, airlied@gmail.com, daniel@ffwll.ch, krzysztof.kozlowski@linaro.org, alim.akhtar@samsung.com Cc: dri-devel@lists.freedesktop.org, linux-arm-kernel@lists.infradead.org, linux-samsung-soc@vger.kernel.org, Thomas Zimmermann Subject: [PATCH 2/5] drm/exynos: Remove struct exynos_drm_fbdev Date: Thu, 30 Mar 2023 09:36:32 +0200 Message-Id: <20230330073635.7409-3-tzimmermann@suse.de> X-Mailer: git-send-email 2.40.0 In-Reply-To: <20230330073635.7409-1-tzimmermann@suse.de> References: <20230330073635.7409-1-tzimmermann@suse.de> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-samsung-soc@vger.kernel.org Remove struct exynos_drm_fbdev, which is an empty wrapper around struct drm_fb_helper. Use the latter directly. No functional changes. Signed-off-by: Thomas Zimmermann --- drivers/gpu/drm/exynos/exynos_drm_fbdev.c | 21 +++++---------------- 1 file changed, 5 insertions(+), 16 deletions(-) diff --git a/drivers/gpu/drm/exynos/exynos_drm_fbdev.c b/drivers/gpu/drm/exynos/exynos_drm_fbdev.c index f11895d32982..e7059850baa2 100644 --- a/drivers/gpu/drm/exynos/exynos_drm_fbdev.c +++ b/drivers/gpu/drm/exynos/exynos_drm_fbdev.c @@ -28,13 +28,6 @@ #define MAX_CONNECTOR 4 #define PREFERRED_BPP 32 -#define to_exynos_fbdev(x) container_of(x, struct exynos_drm_fbdev,\ - drm_fb_helper) - -struct exynos_drm_fbdev { - struct drm_fb_helper drm_fb_helper; -}; - static int exynos_drm_fb_mmap(struct fb_info *info, struct vm_area_struct *vma) { struct drm_fb_helper *helper = info->par; @@ -144,7 +137,6 @@ static const struct drm_fb_helper_funcs exynos_drm_fb_helper_funcs = { int exynos_drm_fbdev_init(struct drm_device *dev) { - struct exynos_drm_fbdev *fbdev; struct exynos_drm_private *private = dev->dev_private; struct drm_fb_helper *helper; int ret; @@ -152,11 +144,11 @@ int exynos_drm_fbdev_init(struct drm_device *dev) if (!dev->mode_config.num_crtc) return 0; - fbdev = kzalloc(sizeof(*fbdev), GFP_KERNEL); - if (!fbdev) + helper = kzalloc(sizeof(*helper), GFP_KERNEL); + if (!helper) return -ENOMEM; - private->fb_helper = helper = &fbdev->drm_fb_helper; + private->fb_helper = helper; drm_fb_helper_prepare(dev, helper, PREFERRED_BPP, &exynos_drm_fb_helper_funcs); @@ -181,7 +173,7 @@ int exynos_drm_fbdev_init(struct drm_device *dev) err_init: drm_fb_helper_unprepare(helper); private->fb_helper = NULL; - kfree(fbdev); + kfree(helper); return ret; } @@ -206,16 +198,13 @@ static void exynos_drm_fbdev_destroy(struct drm_device *dev, void exynos_drm_fbdev_fini(struct drm_device *dev) { struct exynos_drm_private *private = dev->dev_private; - struct exynos_drm_fbdev *fbdev; if (!private || !private->fb_helper) return; - fbdev = to_exynos_fbdev(private->fb_helper); - exynos_drm_fbdev_destroy(dev, private->fb_helper); drm_fb_helper_unprepare(private->fb_helper); - kfree(fbdev); + kfree(private->fb_helper); private->fb_helper = NULL; } From patchwork Thu Mar 30 07:36:33 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Thomas Zimmermann X-Patchwork-Id: 668798 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id A9E4CC77B6E for ; Thu, 30 Mar 2023 07:36:53 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229552AbjC3Hgw (ORCPT ); Thu, 30 Mar 2023 03:36:52 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37700 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230448AbjC3Hgm (ORCPT ); Thu, 30 Mar 2023 03:36:42 -0400 Received: from smtp-out2.suse.de (smtp-out2.suse.de [195.135.220.29]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4B7B54224 for ; Thu, 30 Mar 2023 00:36:41 -0700 (PDT) Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by smtp-out2.suse.de (Postfix) with ESMTPS id D9B831FE92; Thu, 30 Mar 2023 07:36:39 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1680161799; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=MEZaVpJU3qEkKtywxW07EVAjjN44se8OWxU4qiBKPog=; b=TsZ2FAgX82lFatsdrg4OpGVjZFrI2WU4BAYD3WaVxDs0PItqtfYTnYszKrK2k8J4tp7fwm Jg+GxVbED3DMwTRU2NV6fDWAqmdEMnkYwlPKHdOBqXBa4QR7U4i8MY/1K6gXTT1KkEHK8x OXUMDhU5ov5LyUPpAgllkihYHie656E= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1680161799; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=MEZaVpJU3qEkKtywxW07EVAjjN44se8OWxU4qiBKPog=; b=uDUZexHfMT7UAHgAyGfYYHe1YY2N01EqHQ/upXChU2Lv7KrVc2Bv8rT2M7OSz/G/9rxgm9 qRadHQTc5hIgmODQ== Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by imap2.suse-dmz.suse.de (Postfix) with ESMTPS id 9E76F1390D; Thu, 30 Mar 2023 07:36:39 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id uPtxJQc8JWQJewAAMHmgww (envelope-from ); Thu, 30 Mar 2023 07:36:39 +0000 From: Thomas Zimmermann To: inki.dae@samsung.com, sw0312.kim@samsung.com, kyungmin.park@samsung.com, javierm@redhat.com, airlied@gmail.com, daniel@ffwll.ch, krzysztof.kozlowski@linaro.org, alim.akhtar@samsung.com Cc: dri-devel@lists.freedesktop.org, linux-arm-kernel@lists.infradead.org, linux-samsung-soc@vger.kernel.org, Thomas Zimmermann Subject: [PATCH 3/5] drm/exynos: Remove fb_helper from struct exynos_drm_private Date: Thu, 30 Mar 2023 09:36:33 +0200 Message-Id: <20230330073635.7409-4-tzimmermann@suse.de> X-Mailer: git-send-email 2.40.0 In-Reply-To: <20230330073635.7409-1-tzimmermann@suse.de> References: <20230330073635.7409-1-tzimmermann@suse.de> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-samsung-soc@vger.kernel.org The DRM device stores a pointer to the fbdev helper. Remove struct exynos_drm_private.fb_helper, which contains the same value. No functional changes. Signed-off-by: Thomas Zimmermann --- drivers/gpu/drm/exynos/exynos_drm_drv.h | 2 -- drivers/gpu/drm/exynos/exynos_drm_fbdev.c | 15 +++++---------- 2 files changed, 5 insertions(+), 12 deletions(-) diff --git a/drivers/gpu/drm/exynos/exynos_drm_drv.h b/drivers/gpu/drm/exynos/exynos_drm_drv.h index 6ae9056e7a18..81d501efd013 100644 --- a/drivers/gpu/drm/exynos/exynos_drm_drv.h +++ b/drivers/gpu/drm/exynos/exynos_drm_drv.h @@ -197,8 +197,6 @@ struct drm_exynos_file_private { * @wait: wait an atomic commit to finish */ struct exynos_drm_private { - struct drm_fb_helper *fb_helper; - struct device *g2d_dev; struct device *dma_dev; void *mapping; diff --git a/drivers/gpu/drm/exynos/exynos_drm_fbdev.c b/drivers/gpu/drm/exynos/exynos_drm_fbdev.c index e7059850baa2..81f909cb5c9b 100644 --- a/drivers/gpu/drm/exynos/exynos_drm_fbdev.c +++ b/drivers/gpu/drm/exynos/exynos_drm_fbdev.c @@ -137,7 +137,6 @@ static const struct drm_fb_helper_funcs exynos_drm_fb_helper_funcs = { int exynos_drm_fbdev_init(struct drm_device *dev) { - struct exynos_drm_private *private = dev->dev_private; struct drm_fb_helper *helper; int ret; @@ -148,8 +147,6 @@ int exynos_drm_fbdev_init(struct drm_device *dev) if (!helper) return -ENOMEM; - private->fb_helper = helper; - drm_fb_helper_prepare(dev, helper, PREFERRED_BPP, &exynos_drm_fb_helper_funcs); ret = drm_fb_helper_init(dev, helper); @@ -172,7 +169,6 @@ int exynos_drm_fbdev_init(struct drm_device *dev) drm_fb_helper_fini(helper); err_init: drm_fb_helper_unprepare(helper); - private->fb_helper = NULL; kfree(helper); return ret; @@ -197,14 +193,13 @@ static void exynos_drm_fbdev_destroy(struct drm_device *dev, void exynos_drm_fbdev_fini(struct drm_device *dev) { - struct exynos_drm_private *private = dev->dev_private; + struct drm_fb_helper *fb_helper = dev->fb_helper; - if (!private || !private->fb_helper) + if (!fb_helper) return; - exynos_drm_fbdev_destroy(dev, private->fb_helper); - drm_fb_helper_unprepare(private->fb_helper); - kfree(private->fb_helper); - private->fb_helper = NULL; + exynos_drm_fbdev_destroy(dev, fb_helper); + drm_fb_helper_unprepare(fb_helper); + kfree(fb_helper); } From patchwork Thu Mar 30 07:36:34 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Thomas Zimmermann X-Patchwork-Id: 669719 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id C8FCBC77B61 for ; Thu, 30 Mar 2023 07:36:54 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229620AbjC3Hgx (ORCPT ); Thu, 30 Mar 2023 03:36:53 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37590 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230465AbjC3Hgm (ORCPT ); Thu, 30 Mar 2023 03:36:42 -0400 Received: from smtp-out2.suse.de (smtp-out2.suse.de [IPv6:2001:67c:2178:6::1d]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8431C423A for ; Thu, 30 Mar 2023 00:36:41 -0700 (PDT) Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by smtp-out2.suse.de (Postfix) with ESMTPS id 323921FE93; Thu, 30 Mar 2023 07:36:40 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1680161800; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=kXm8bYvQ3dmgdus+3W+I2N4JISx8iIQGevzOGQX8T4Y=; b=XofIzXAtE4h4pP78hg7WSpLndrVyVNo7VGzxbiE0Kyr5kMupLAFoCQjQVmPy4F2fUWQjdK tvVK93y0cQEOk2Z8cr0GV22k2Z8a+ALNQro0xiZ8uRgZe3HhUbQLwkAqsq/DYLqAEuChK3 GUTvAGxIbRsXVZRHje+sAlnCFxY/2Jo= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1680161800; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=kXm8bYvQ3dmgdus+3W+I2N4JISx8iIQGevzOGQX8T4Y=; b=UiMtTwYuswQJCgtG4UZwasgerV9XyyQDOFQ72CMBPri9C4mCUcSllDlDPYuUBHORY/a7Jv knBsZ+M9KKX6PqCA== Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by imap2.suse-dmz.suse.de (Postfix) with ESMTPS id DD5171348E; Thu, 30 Mar 2023 07:36:39 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id 8J0tNQc8JWQJewAAMHmgww (envelope-from ); Thu, 30 Mar 2023 07:36:39 +0000 From: Thomas Zimmermann To: inki.dae@samsung.com, sw0312.kim@samsung.com, kyungmin.park@samsung.com, javierm@redhat.com, airlied@gmail.com, daniel@ffwll.ch, krzysztof.kozlowski@linaro.org, alim.akhtar@samsung.com Cc: dri-devel@lists.freedesktop.org, linux-arm-kernel@lists.infradead.org, linux-samsung-soc@vger.kernel.org, Thomas Zimmermann Subject: [PATCH 4/5] drm/exynos: Initialize fbdev DRM client Date: Thu, 30 Mar 2023 09:36:34 +0200 Message-Id: <20230330073635.7409-5-tzimmermann@suse.de> X-Mailer: git-send-email 2.40.0 In-Reply-To: <20230330073635.7409-1-tzimmermann@suse.de> References: <20230330073635.7409-1-tzimmermann@suse.de> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-samsung-soc@vger.kernel.org Initialize the fbdev client in the fbdev code with empty helper functions. Also clean up the client. The helpers will later implement various functionality of the DRM client. No functional changes. Signed-off-by: Thomas Zimmermann --- drivers/gpu/drm/exynos/exynos_drm_fbdev.c | 35 +++++++++++++++++++++-- 1 file changed, 33 insertions(+), 2 deletions(-) diff --git a/drivers/gpu/drm/exynos/exynos_drm_fbdev.c b/drivers/gpu/drm/exynos/exynos_drm_fbdev.c index 81f909cb5c9b..d1de49530c48 100644 --- a/drivers/gpu/drm/exynos/exynos_drm_fbdev.c +++ b/drivers/gpu/drm/exynos/exynos_drm_fbdev.c @@ -135,6 +135,30 @@ static const struct drm_fb_helper_funcs exynos_drm_fb_helper_funcs = { .fb_probe = exynos_drm_fbdev_create, }; +/* + * struct drm_client + */ + +static void exynos_drm_fbdev_client_unregister(struct drm_client_dev *client) +{ } + +static int exynos_drm_fbdev_client_restore(struct drm_client_dev *client) +{ + return 0; +} + +static int exynos_drm_fbdev_client_hotplug(struct drm_client_dev *client) +{ + return 0; +} + +static const struct drm_client_funcs exynos_drm_fbdev_client_funcs = { + .owner = THIS_MODULE, + .unregister = exynos_drm_fbdev_client_unregister, + .restore = exynos_drm_fbdev_client_restore, + .hotplug = exynos_drm_fbdev_client_hotplug, +}; + int exynos_drm_fbdev_init(struct drm_device *dev) { struct drm_fb_helper *helper; @@ -149,11 +173,15 @@ int exynos_drm_fbdev_init(struct drm_device *dev) drm_fb_helper_prepare(dev, helper, PREFERRED_BPP, &exynos_drm_fb_helper_funcs); + ret = drm_client_init(dev, &helper->client, "exynos-fbdev", &exynos_drm_fbdev_client_funcs); + if (ret) + goto err_drm_fb_helper_unprepare; + ret = drm_fb_helper_init(dev, helper); if (ret < 0) { DRM_DEV_ERROR(dev->dev, "failed to initialize drm fb helper.\n"); - goto err_init; + goto err_drm_client_release; } ret = drm_fb_helper_initial_config(helper); @@ -167,7 +195,9 @@ int exynos_drm_fbdev_init(struct drm_device *dev) err_setup: drm_fb_helper_fini(helper); -err_init: +err_drm_client_release: + drm_client_release(&helper->client); +err_drm_fb_helper_unprepare: drm_fb_helper_unprepare(helper); kfree(helper); @@ -199,6 +229,7 @@ void exynos_drm_fbdev_fini(struct drm_device *dev) return; exynos_drm_fbdev_destroy(dev, fb_helper); + drm_client_release(&fb_helper->client); drm_fb_helper_unprepare(fb_helper); kfree(fb_helper); } From patchwork Thu Mar 30 07:36:35 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Thomas Zimmermann X-Patchwork-Id: 668797 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 785D9C761AF for ; Thu, 30 Mar 2023 07:36:55 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229661AbjC3Hgx (ORCPT ); Thu, 30 Mar 2023 03:36:53 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37702 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230478AbjC3Hgn (ORCPT ); Thu, 30 Mar 2023 03:36:43 -0400 Received: from smtp-out2.suse.de (smtp-out2.suse.de [IPv6:2001:67c:2178:6::1d]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id CB33D49DE for ; Thu, 30 Mar 2023 00:36:41 -0700 (PDT) Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by smtp-out2.suse.de (Postfix) with ESMTPS id 6B7981FE94; Thu, 30 Mar 2023 07:36:40 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1680161800; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=lytV5vCAPfPBoRHtGA4AV6p/TyLXKz5QPYdyjb2wLYw=; b=PpFobUuk5UHLHRouoH9N8eXt+2K2WCFb+S4Oc0OInbp/wS3etiQ2OWM7aLQOe/uC8St9Ch bmSpVIHT6o8Eff9733F9WP07Ff5IOJYg4TFRNl6abwRuO4MXJWsL/FzJHtHUji9Zytwh2P 6Mys+UPIAv64CKcA3razaLPPL1byY28= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1680161800; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=lytV5vCAPfPBoRHtGA4AV6p/TyLXKz5QPYdyjb2wLYw=; b=kKR7F8lG8poe9E58S9sNmKU21Ty+mjiz1SQf+VIGRSyefdOBCVikOrE2CMXLO2wAfX4KuX DRZubB2/1C3RreBw== Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by imap2.suse-dmz.suse.de (Postfix) with ESMTPS id 2A6C81390D; Thu, 30 Mar 2023 07:36:40 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id 6AFxCQg8JWQJewAAMHmgww (envelope-from ); Thu, 30 Mar 2023 07:36:40 +0000 From: Thomas Zimmermann To: inki.dae@samsung.com, sw0312.kim@samsung.com, kyungmin.park@samsung.com, javierm@redhat.com, airlied@gmail.com, daniel@ffwll.ch, krzysztof.kozlowski@linaro.org, alim.akhtar@samsung.com Cc: dri-devel@lists.freedesktop.org, linux-arm-kernel@lists.infradead.org, linux-samsung-soc@vger.kernel.org, Thomas Zimmermann Subject: [PATCH 5/5] drm/exynos: Implement fbdev emulation as in-kernel client Date: Thu, 30 Mar 2023 09:36:35 +0200 Message-Id: <20230330073635.7409-6-tzimmermann@suse.de> X-Mailer: git-send-email 2.40.0 In-Reply-To: <20230330073635.7409-1-tzimmermann@suse.de> References: <20230330073635.7409-1-tzimmermann@suse.de> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-samsung-soc@vger.kernel.org Move code from ad-hoc fbdev callbacks into DRM client functions and remove the old callbacks. The functions instruct the client to poll for changed output or restore the display. The DRM core calls both, the old callbacks and the new client helpers, from the same places. The new functions perform the same operation as before, so there's no change in functionality. Replace all code that initializes or releases fbdev emulation throughout the driver. Instead initialize the fbdev client by a single call to exynos_fbdev_setup() after exynos has registered its DRM device. As in most drivers, exynos' fbdev emulation now acts like a regular DRM client. The fbdev client setup consists of the initial preparation and the hot-plugging of the display. The latter creates the fbdev device and sets up the fbdev framebuffer. The setup performs display hot-plugging once. If no display can be detected, DRM probe helpers re-run the detection on each hotplug event. A call to drm_dev_unregister() releases the client automatically. No further action is required within exynos. If the fbdev framebuffer has been fully set up, struct fb_ops.fb_destroy implements the release. For partially initialized emulation, the fbdev client reverts the initial setup. Signed-off-by: Thomas Zimmermann --- drivers/gpu/drm/exynos/exynos_drm_drv.c | 13 +- drivers/gpu/drm/exynos/exynos_drm_fb.c | 2 - drivers/gpu/drm/exynos/exynos_drm_fbdev.c | 150 +++++++++++----------- drivers/gpu/drm/exynos/exynos_drm_fbdev.h | 20 +-- 4 files changed, 77 insertions(+), 108 deletions(-) diff --git a/drivers/gpu/drm/exynos/exynos_drm_drv.c b/drivers/gpu/drm/exynos/exynos_drm_drv.c index 16c539657f73..6b73fb7a83c3 100644 --- a/drivers/gpu/drm/exynos/exynos_drm_drv.c +++ b/drivers/gpu/drm/exynos/exynos_drm_drv.c @@ -16,7 +16,6 @@ #include #include #include -#include #include #include #include @@ -108,7 +107,6 @@ static const struct drm_driver exynos_drm_driver = { .driver_features = DRIVER_MODESET | DRIVER_GEM | DRIVER_ATOMIC | DRIVER_RENDER, .open = exynos_drm_open, - .lastclose = drm_fb_helper_lastclose, .postclose = exynos_drm_postclose, .dumb_create = exynos_drm_gem_dumb_create, .prime_handle_to_fd = drm_gem_prime_handle_to_fd, @@ -288,19 +286,15 @@ static int exynos_drm_bind(struct device *dev) /* init kms poll for handling hpd */ drm_kms_helper_poll_init(drm); - ret = exynos_drm_fbdev_init(drm); - if (ret) - goto err_cleanup_poll; - /* register the DRM device */ ret = drm_dev_register(drm, 0); if (ret < 0) - goto err_cleanup_fbdev; + goto err_cleanup_poll; + + exynos_drm_fbdev_setup(drm); return 0; -err_cleanup_fbdev: - exynos_drm_fbdev_fini(drm); err_cleanup_poll: drm_kms_helper_poll_fini(drm); err_unbind_all: @@ -321,7 +315,6 @@ static void exynos_drm_unbind(struct device *dev) drm_dev_unregister(drm); - exynos_drm_fbdev_fini(drm); drm_kms_helper_poll_fini(drm); component_unbind_all(drm->dev, drm); diff --git a/drivers/gpu/drm/exynos/exynos_drm_fb.c b/drivers/gpu/drm/exynos/exynos_drm_fb.c index 97f2dee2db29..fc1c5608db96 100644 --- a/drivers/gpu/drm/exynos/exynos_drm_fb.c +++ b/drivers/gpu/drm/exynos/exynos_drm_fb.c @@ -11,7 +11,6 @@ #include #include #include -#include #include #include #include @@ -157,7 +156,6 @@ static struct drm_mode_config_helper_funcs exynos_drm_mode_config_helpers = { static const struct drm_mode_config_funcs exynos_drm_mode_config_funcs = { .fb_create = exynos_user_fb_create, - .output_poll_changed = drm_fb_helper_output_poll_changed, .atomic_check = drm_atomic_helper_check, .atomic_commit = drm_atomic_helper_commit, }; diff --git a/drivers/gpu/drm/exynos/exynos_drm_fbdev.c b/drivers/gpu/drm/exynos/exynos_drm_fbdev.c index d1de49530c48..ea4b3d248aac 100644 --- a/drivers/gpu/drm/exynos/exynos_drm_fbdev.c +++ b/drivers/gpu/drm/exynos/exynos_drm_fbdev.c @@ -8,17 +8,12 @@ * Seung-Woo Kim */ -#include -#include -#include - -#include +#include +#include #include -#include #include #include #include -#include #include #include "exynos_drm_drv.h" @@ -36,6 +31,20 @@ static int exynos_drm_fb_mmap(struct fb_info *info, struct vm_area_struct *vma) return drm_gem_prime_mmap(obj, vma); } +static void exynos_drm_fb_destroy(struct fb_info *info) +{ + struct drm_fb_helper *fb_helper = info->par; + struct drm_framebuffer *fb = fb_helper->fb; + + drm_fb_helper_fini(fb_helper); + + drm_framebuffer_remove(fb); + + drm_client_release(&fb_helper->client); + drm_fb_helper_unprepare(fb_helper); + kfree(fb_helper); +} + static const struct fb_ops exynos_drm_fb_ops = { .owner = THIS_MODULE, DRM_FB_HELPER_DEFAULT_OPS, @@ -45,6 +54,7 @@ static const struct fb_ops exynos_drm_fb_ops = { .fb_fillrect = drm_fb_helper_cfb_fillrect, .fb_copyarea = drm_fb_helper_cfb_copyarea, .fb_imageblit = drm_fb_helper_cfb_imageblit, + .fb_destroy = exynos_drm_fb_destroy, }; static int exynos_drm_fbdev_update(struct drm_fb_helper *helper, @@ -115,19 +125,13 @@ static int exynos_drm_fbdev_create(struct drm_fb_helper *helper, if (ret < 0) goto err_destroy_framebuffer; - return ret; + return 0; err_destroy_framebuffer: drm_framebuffer_cleanup(helper->fb); + helper->fb = NULL; err_destroy_gem: exynos_drm_gem_destroy(exynos_gem); - - /* - * if failed, all resources allocated above would be released by - * drm_mode_config_cleanup() when drm_load() had been called prior - * to any specific driver such as fimd or hdmi driver. - */ - return ret; } @@ -140,16 +144,52 @@ static const struct drm_fb_helper_funcs exynos_drm_fb_helper_funcs = { */ static void exynos_drm_fbdev_client_unregister(struct drm_client_dev *client) -{ } +{ + struct drm_fb_helper *fb_helper = drm_fb_helper_from_client(client); + + if (fb_helper->info) { + drm_fb_helper_unregister_info(fb_helper); + } else { + drm_client_release(&fb_helper->client); + drm_fb_helper_unprepare(fb_helper); + kfree(fb_helper); + } +} static int exynos_drm_fbdev_client_restore(struct drm_client_dev *client) { + drm_fb_helper_lastclose(client->dev); + return 0; } static int exynos_drm_fbdev_client_hotplug(struct drm_client_dev *client) { + struct drm_fb_helper *fb_helper = drm_fb_helper_from_client(client); + struct drm_device *dev = client->dev; + int ret; + + if (dev->fb_helper) + return drm_fb_helper_hotplug_event(dev->fb_helper); + + ret = drm_fb_helper_init(dev, fb_helper); + if (ret) + goto err_drm_err; + + if (!drm_drv_uses_atomic_modeset(dev)) + drm_helper_disable_unused_functions(dev); + + ret = drm_fb_helper_initial_config(fb_helper); + if (ret) + goto err_drm_fb_helper_fini; + return 0; + +err_drm_fb_helper_fini: + drm_fb_helper_fini(fb_helper); +err_drm_err: + drm_err(dev, "Failed to setup fbdev emulation (ret=%d)\n", ret); + return ret; } static const struct drm_client_funcs exynos_drm_fbdev_client_funcs = { @@ -159,78 +199,32 @@ static const struct drm_client_funcs exynos_drm_fbdev_client_funcs = { .hotplug = exynos_drm_fbdev_client_hotplug, }; -int exynos_drm_fbdev_init(struct drm_device *dev) +void exynos_drm_fbdev_setup(struct drm_device *dev) { - struct drm_fb_helper *helper; + struct drm_fb_helper *fb_helper; int ret; - if (!dev->mode_config.num_crtc) - return 0; + drm_WARN(dev, !dev->registered, "Device has not been registered.\n"); + drm_WARN(dev, dev->fb_helper, "fb_helper is already set!\n"); - helper = kzalloc(sizeof(*helper), GFP_KERNEL); - if (!helper) - return -ENOMEM; - - drm_fb_helper_prepare(dev, helper, PREFERRED_BPP, &exynos_drm_fb_helper_funcs); + fb_helper = kzalloc(sizeof(*fb_helper), GFP_KERNEL); + if (!fb_helper) + return; + drm_fb_helper_prepare(dev, fb_helper, PREFERRED_BPP, &exynos_drm_fb_helper_funcs); - ret = drm_client_init(dev, &helper->client, "exynos-fbdev", &exynos_drm_fbdev_client_funcs); + ret = drm_client_init(dev, &fb_helper->client, "fbdev", &exynos_drm_fbdev_client_funcs); if (ret) - goto err_drm_fb_helper_unprepare; - - ret = drm_fb_helper_init(dev, helper); - if (ret < 0) { - DRM_DEV_ERROR(dev->dev, - "failed to initialize drm fb helper.\n"); - goto err_drm_client_release; - } - - ret = drm_fb_helper_initial_config(helper); - if (ret < 0) { - DRM_DEV_ERROR(dev->dev, - "failed to set up hw configuration.\n"); - goto err_setup; - } - - return 0; - -err_setup: - drm_fb_helper_fini(helper); -err_drm_client_release: - drm_client_release(&helper->client); -err_drm_fb_helper_unprepare: - drm_fb_helper_unprepare(helper); - kfree(helper); - - return ret; -} - -static void exynos_drm_fbdev_destroy(struct drm_device *dev, - struct drm_fb_helper *fb_helper) -{ - struct drm_framebuffer *fb; + goto err_drm_client_init; - /* release drm framebuffer and real buffer */ - if (fb_helper->fb && fb_helper->fb->funcs) { - fb = fb_helper->fb; - if (fb) - drm_framebuffer_remove(fb); - } - - drm_fb_helper_unregister_info(fb_helper); - - drm_fb_helper_fini(fb_helper); -} + ret = exynos_drm_fbdev_client_hotplug(&fb_helper->client); + if (ret) + drm_dbg_kms(dev, "client hotplug ret=%d\n", ret); -void exynos_drm_fbdev_fini(struct drm_device *dev) -{ - struct drm_fb_helper *fb_helper = dev->fb_helper; + drm_client_register(&fb_helper->client); - if (!fb_helper) - return; + return; - exynos_drm_fbdev_destroy(dev, fb_helper); - drm_client_release(&fb_helper->client); +err_drm_client_init: drm_fb_helper_unprepare(fb_helper); kfree(fb_helper); } - diff --git a/drivers/gpu/drm/exynos/exynos_drm_fbdev.h b/drivers/gpu/drm/exynos/exynos_drm_fbdev.h index 3b1e98e84580..1e1dea627cd9 100644 --- a/drivers/gpu/drm/exynos/exynos_drm_fbdev.h +++ b/drivers/gpu/drm/exynos/exynos_drm_fbdev.h @@ -12,27 +12,11 @@ #define _EXYNOS_DRM_FBDEV_H_ #ifdef CONFIG_DRM_FBDEV_EMULATION - -int exynos_drm_fbdev_init(struct drm_device *dev); -void exynos_drm_fbdev_fini(struct drm_device *dev); - +void exynos_drm_fbdev_setup(struct drm_device *dev); #else - -static inline int exynos_drm_fbdev_init(struct drm_device *dev) -{ - return 0; -} - -static inline void exynos_drm_fbdev_fini(struct drm_device *dev) +static inline void exynos_drm_fbdev_setup(struct drm_device *dev) { } - -static inline void exynos_drm_fbdev_restore_mode(struct drm_device *dev) -{ -} - -#define exynos_drm_output_poll_changed (NULL) - #endif #endif