From patchwork Mon Apr 3 12:45:31 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Thomas Zimmermann X-Patchwork-Id: 13198128 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 57C05C761A6 for ; Mon, 3 Apr 2023 12:45:45 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231708AbjDCMpo (ORCPT ); Mon, 3 Apr 2023 08:45:44 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37930 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230269AbjDCMpn (ORCPT ); Mon, 3 Apr 2023 08:45:43 -0400 Received: from smtp-out2.suse.de (smtp-out2.suse.de [195.135.220.29]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A8A3865BC for ; Mon, 3 Apr 2023 05:45:42 -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 4CE8A1FF43; Mon, 3 Apr 2023 12:45:41 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1680525941; 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=3J+heJlM6DDAz8pDf9FYR46VE55utPLjCgK6hZx67QE=; b=QT6N/jPpurhwpEk1oN3jXqHkq87Ro5dArf7ndrvXmNrjuckz6LO2605/FxY3d+/6z0YjuJ 9EKOaSJ2v6X3ZYIQ19Hsy39Fn8uI+SIw8+LC7aYIo6uuBH6LTTCdW8g628um9+L6lOcUoe UQ/FDhdla8yqunbbqGkwwA1mszgPxd0= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1680525941; 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=3J+heJlM6DDAz8pDf9FYR46VE55utPLjCgK6hZx67QE=; b=cYWHeoGOAJc1yX9euH4QBl4NZr0/ILasQ1esMuB7tWyIgWP6YXXBbKu772FrytedYGbb2Z pjo93qG3Nsp4VSBQ== 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 01CEC13A2F; Mon, 3 Apr 2023 12:45:40 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id cCgnO3TKKmTRVgAAMHmgww (envelope-from ); Mon, 03 Apr 2023 12:45:40 +0000 From: Thomas Zimmermann To: robdclark@gmail.com, quic_abhinavk@quicinc.com, dmitry.baryshkov@linaro.org, sean@poorly.run, javierm@redhat.com, airlied@gmail.com, daniel@ffwll.ch Cc: linux-arm-msm@vger.kernel.org, dri-devel@lists.freedesktop.org, freedreno@lists.freedesktop.org, Thomas Zimmermann , kernel test robot Subject: [PATCH v2 1/8] drm/msm: Include Date: Mon, 3 Apr 2023 14:45:31 +0200 Message-Id: <20230403124538.8497-2-tzimmermann@suse.de> X-Mailer: git-send-email 2.40.0 In-Reply-To: <20230403124538.8497-1-tzimmermann@suse.de> References: <20230403124538.8497-1-tzimmermann@suse.de> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-arm-msm@vger.kernel.org Include to get the declaration of devm_ioremap() on sparc64. No functional changes. Signed-off-by: Thomas Zimmermann Reported-by: kernel test robot Link: https://lore.kernel.org/oe-kbuild-all/202303301856.zSmpwZjj-lkp@intel.com/ Reviewed-by:  Sui Jingfeng Reviewed-by: Dmitry Baryshkov --- drivers/gpu/drm/msm/msm_io_utils.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/gpu/drm/msm/msm_io_utils.c b/drivers/gpu/drm/msm/msm_io_utils.c index d02cd29ce829..59d2788c4510 100644 --- a/drivers/gpu/drm/msm/msm_io_utils.c +++ b/drivers/gpu/drm/msm/msm_io_utils.c @@ -6,6 +6,7 @@ */ #include +#include #include "msm_drv.h" From patchwork Mon Apr 3 12:45: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: 13198129 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 CBA91C77B6D for ; Mon, 3 Apr 2023 12:45:46 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232363AbjDCMpp (ORCPT ); Mon, 3 Apr 2023 08:45:45 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37964 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231995AbjDCMpp (ORCPT ); Mon, 3 Apr 2023 08:45:45 -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 044986A7F for ; Mon, 3 Apr 2023 05:45:42 -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 8A5DB1FF3F; Mon, 3 Apr 2023 12:45:41 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1680525941; 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=IBTBqtiqpLCrihzas8GahVN5wGlWlMmdB4EyqSVbcyc=; b=QbwYZJ4Q/Rm8QVokp9KvAn3yVCFk6jRawZJiCuUxrnFnhku/rvI8JcNilRkoGdku0XOljX gpl6r5jNUVuCfJcNC8VN4SCqVxRWRZOrwyog4vKKLo9Wu/IZKKXO8X0q8yw4HGlGtpNpyR PoV9dzBv0T0y1L0PUbOC5JUAlcxg9x4= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1680525941; 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=IBTBqtiqpLCrihzas8GahVN5wGlWlMmdB4EyqSVbcyc=; b=rVWRUVfRvlElvnmkw9idiPK8mlkVHusTmFQZoFlk+kQtI8mP2jA4fgOrjLvr6Vog3jaO6B W218jkmFJovTJdAQ== 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 503891331A; Mon, 3 Apr 2023 12:45:41 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id eJibEnXKKmTRVgAAMHmgww (envelope-from ); Mon, 03 Apr 2023 12:45:41 +0000 From: Thomas Zimmermann To: robdclark@gmail.com, quic_abhinavk@quicinc.com, dmitry.baryshkov@linaro.org, sean@poorly.run, javierm@redhat.com, airlied@gmail.com, daniel@ffwll.ch Cc: linux-arm-msm@vger.kernel.org, dri-devel@lists.freedesktop.org, freedreno@lists.freedesktop.org, Thomas Zimmermann Subject: [PATCH v2 2/8] drm/msm: Clear aperture ownership outside of fbdev code Date: Mon, 3 Apr 2023 14:45:32 +0200 Message-Id: <20230403124538.8497-3-tzimmermann@suse.de> X-Mailer: git-send-email 2.40.0 In-Reply-To: <20230403124538.8497-1-tzimmermann@suse.de> References: <20230403124538.8497-1-tzimmermann@suse.de> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-arm-msm@vger.kernel.org Move aperture management out of the fbdev code. It is unrelated and needs to run even if fbdev support has been disabled. Call the helper at the top of msm_drm_init() to take over hardware from other drivers. v2: * bind all subdevices before acquiring device (Dmitri) Signed-off-by: Thomas Zimmermann Reviewed-by: Dmitry Baryshkov --- drivers/gpu/drm/msm/msm_drv.c | 6 ++++++ drivers/gpu/drm/msm/msm_fbdev.c | 6 ------ 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/drivers/gpu/drm/msm/msm_drv.c b/drivers/gpu/drm/msm/msm_drv.c index aca48c868c14..2a1c6ced82c9 100644 --- a/drivers/gpu/drm/msm/msm_drv.c +++ b/drivers/gpu/drm/msm/msm_drv.c @@ -12,6 +12,7 @@ #include #include +#include #include #include #include @@ -451,6 +452,11 @@ static int msm_drm_init(struct device *dev, const struct drm_driver *drv) if (ret) goto err_drm_dev_put; + /* the fw fb could be anywhere in memory */ + ret = drm_aperture_remove_framebuffers(false, drv); + if (ret) + goto err_drm_dev_put; + dma_set_max_seg_size(dev, UINT_MAX); msm_gem_shrinker_init(ddev); diff --git a/drivers/gpu/drm/msm/msm_fbdev.c b/drivers/gpu/drm/msm/msm_fbdev.c index d26aa52217ce..fc7d0406a9f9 100644 --- a/drivers/gpu/drm/msm/msm_fbdev.c +++ b/drivers/gpu/drm/msm/msm_fbdev.c @@ -4,7 +4,6 @@ * Author: Rob Clark */ -#include #include #include #include @@ -154,11 +153,6 @@ struct drm_fb_helper *msm_fbdev_init(struct drm_device *dev) goto fail; } - /* the fw fb could be anywhere in memory */ - ret = drm_aperture_remove_framebuffers(false, dev->driver); - if (ret) - goto fini; - ret = drm_fb_helper_initial_config(helper); if (ret) goto fini; From patchwork Mon Apr 3 12:45: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: 13198132 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 E9F9AC77B6E for ; Mon, 3 Apr 2023 12:45:47 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232365AbjDCMpr (ORCPT ); Mon, 3 Apr 2023 08:45:47 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37966 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231808AbjDCMpp (ORCPT ); Mon, 3 Apr 2023 08:45:45 -0400 Received: from smtp-out1.suse.de (smtp-out1.suse.de [195.135.220.28]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 287466EB2 for ; Mon, 3 Apr 2023 05:45:43 -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 D11A521CBF; Mon, 3 Apr 2023 12:45:41 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1680525941; 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=X3xOgZ1zB6XHmsdTTIvRQ+18DhES086z/jD6JZDBTQw=; b=X/TckpTdR4wGaUBHhNMB+R6cOJw8xllGChhjbBPPl/Bi8WgWaRsvoxTSbxQHI4iKLjrxxf BbbliO27yizrTYbyBkJnktPJgYHDT/rMSyUwglSl6c/ai8lH+O3UeO4ihKraSmVd+sdKxz U7BLLWmE7gbQF43/tTgh9ExI+M1E2Jw= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1680525941; 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=X3xOgZ1zB6XHmsdTTIvRQ+18DhES086z/jD6JZDBTQw=; b=BIkkooK7o99RkeVx3fa9uVM2SYDtwrUDBBDqCraMwe8xGPO8+nH1cK7FErz3i9YZgsSoFb j4PVNU81zjO2G/BA== 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 8FB971331A; Mon, 3 Apr 2023 12:45:41 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id CL0xInXKKmTRVgAAMHmgww (envelope-from ); Mon, 03 Apr 2023 12:45:41 +0000 From: Thomas Zimmermann To: robdclark@gmail.com, quic_abhinavk@quicinc.com, dmitry.baryshkov@linaro.org, sean@poorly.run, javierm@redhat.com, airlied@gmail.com, daniel@ffwll.ch Cc: linux-arm-msm@vger.kernel.org, dri-devel@lists.freedesktop.org, freedreno@lists.freedesktop.org, Thomas Zimmermann Subject: [PATCH v2 3/8] drm/msm: Remove fb from struct msm_fbdev Date: Mon, 3 Apr 2023 14:45:33 +0200 Message-Id: <20230403124538.8497-4-tzimmermann@suse.de> X-Mailer: git-send-email 2.40.0 In-Reply-To: <20230403124538.8497-1-tzimmermann@suse.de> References: <20230403124538.8497-1-tzimmermann@suse.de> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-arm-msm@vger.kernel.org Fbdev's struct fb_helper stores a pointer to the framebuffer. Remove struct msm_fbdev.fb, which contains thre same value. No functional changes. Signed-off-by: Thomas Zimmermann Reviewed-by: Dmitry Baryshkov --- drivers/gpu/drm/msm/msm_fbdev.c | 32 +++++++++++++------------------- 1 file changed, 13 insertions(+), 19 deletions(-) diff --git a/drivers/gpu/drm/msm/msm_fbdev.c b/drivers/gpu/drm/msm/msm_fbdev.c index fc7d0406a9f9..323a79d9ef83 100644 --- a/drivers/gpu/drm/msm/msm_fbdev.c +++ b/drivers/gpu/drm/msm/msm_fbdev.c @@ -14,8 +14,6 @@ #include "msm_gem.h" #include "msm_kms.h" -static int msm_fbdev_mmap(struct fb_info *info, struct vm_area_struct *vma); - /* * fbdev funcs, to implement legacy fbdev interface on top of drm driver */ @@ -24,9 +22,16 @@ static int msm_fbdev_mmap(struct fb_info *info, struct vm_area_struct *vma); struct msm_fbdev { struct drm_fb_helper base; - struct drm_framebuffer *fb; }; +static int msm_fbdev_mmap(struct fb_info *info, struct vm_area_struct *vma) +{ + struct drm_fb_helper *helper = (struct drm_fb_helper *)info->par; + struct drm_gem_object *bo = msm_framebuffer_bo(helper->fb, 0); + + return drm_gem_prime_mmap(bo, vma); +} + static const struct fb_ops msm_fb_ops = { .owner = THIS_MODULE, DRM_FB_HELPER_DEFAULT_OPS, @@ -42,19 +47,9 @@ static const struct fb_ops msm_fb_ops = { .fb_mmap = msm_fbdev_mmap, }; -static int msm_fbdev_mmap(struct fb_info *info, struct vm_area_struct *vma) -{ - struct drm_fb_helper *helper = (struct drm_fb_helper *)info->par; - struct msm_fbdev *fbdev = to_msm_fbdev(helper); - struct drm_gem_object *bo = msm_framebuffer_bo(fbdev->fb, 0); - - return drm_gem_prime_mmap(bo, vma); -} - static int msm_fbdev_create(struct drm_fb_helper *helper, struct drm_fb_helper_surface_size *sizes) { - struct msm_fbdev *fbdev = to_msm_fbdev(helper); struct drm_device *dev = helper->dev; struct msm_drm_private *priv = dev->dev_private; struct drm_framebuffer *fb = NULL; @@ -101,7 +96,6 @@ static int msm_fbdev_create(struct drm_fb_helper *helper, DBG("fbi=%p, dev=%p", fbi, dev); - fbdev->fb = fb; helper->fb = fb; fbi->fbops = &msm_fb_ops; @@ -118,7 +112,7 @@ static int msm_fbdev_create(struct drm_fb_helper *helper, fbi->fix.smem_len = bo->size; DBG("par=%p, %dx%d", fbi->par, fbi->var.xres, fbi->var.yres); - DBG("allocated %dx%d fb", fbdev->fb->width, fbdev->fb->height); + DBG("allocated %dx%d fb", fb->width, fb->height); return 0; @@ -173,6 +167,7 @@ void msm_fbdev_free(struct drm_device *dev) { struct msm_drm_private *priv = dev->dev_private; struct drm_fb_helper *helper = priv->fbdev; + struct drm_framebuffer *fb = helper->fb; struct msm_fbdev *fbdev; DBG(); @@ -184,11 +179,10 @@ void msm_fbdev_free(struct drm_device *dev) fbdev = to_msm_fbdev(priv->fbdev); /* this will free the backing object */ - if (fbdev->fb) { - struct drm_gem_object *bo = - msm_framebuffer_bo(fbdev->fb, 0); + if (fb) { + struct drm_gem_object *bo = msm_framebuffer_bo(fb, 0); msm_gem_put_vaddr(bo); - drm_framebuffer_remove(fbdev->fb); + drm_framebuffer_remove(fb); } drm_fb_helper_unprepare(helper); From patchwork Mon Apr 3 12:45: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: 13198131 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 85AB8C76196 for ; Mon, 3 Apr 2023 12:45:47 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232351AbjDCMpq (ORCPT ); Mon, 3 Apr 2023 08:45:46 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37968 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232241AbjDCMpp (ORCPT ); Mon, 3 Apr 2023 08:45:45 -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 8E4997685 for ; Mon, 3 Apr 2023 05:45:43 -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 1672221CC3; Mon, 3 Apr 2023 12:45:42 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1680525942; 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=PBGxFc2yCehzv3WNMkfqLoCYuoPOxqXkauIB9MLClOA=; b=ZFPrSV+140kF/COUTrDE2ZJUDbuJPzdr7IqPOsesWb1ryuD6wUmEU5bJkB7FGxwQwr3LjA lWWTvZKhVVlGlfmdfVts8+pWIrxVDRzl7TeLsChR8bIfGwQRXx/CuVrqK57RcmBnnrgmn8 XrlOUeMuf/D6XItJZJJmTC52vpYoZ0o= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1680525942; 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=PBGxFc2yCehzv3WNMkfqLoCYuoPOxqXkauIB9MLClOA=; b=4vJivaIMbsurKmtpkGQEbvTM9OrR9QEfqh0Bdkwzz9NKXBEJtw0fP+Ci/dw2kFr6GCj0ft +VGqd/j6sZKkp8Bw== 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 CFF3E13A2F; Mon, 3 Apr 2023 12:45:41 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id eOikMXXKKmTRVgAAMHmgww (envelope-from ); Mon, 03 Apr 2023 12:45:41 +0000 From: Thomas Zimmermann To: robdclark@gmail.com, quic_abhinavk@quicinc.com, dmitry.baryshkov@linaro.org, sean@poorly.run, javierm@redhat.com, airlied@gmail.com, daniel@ffwll.ch Cc: linux-arm-msm@vger.kernel.org, dri-devel@lists.freedesktop.org, freedreno@lists.freedesktop.org, Thomas Zimmermann Subject: [PATCH v2 4/8] drm/msm: Remove struct msm_fbdev Date: Mon, 3 Apr 2023 14:45:34 +0200 Message-Id: <20230403124538.8497-5-tzimmermann@suse.de> X-Mailer: git-send-email 2.40.0 In-Reply-To: <20230403124538.8497-1-tzimmermann@suse.de> References: <20230403124538.8497-1-tzimmermann@suse.de> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-arm-msm@vger.kernel.org Remove struct msm_fbdev, which is an empty wrapper around struct drm_fb_helper. Use the latter directly. No functional changes. v2: * kfree fbdev helper instance on init errors (Dmitri) Signed-off-by: Thomas Zimmermann Reviewed-by: Dmitry Baryshkov --- drivers/gpu/drm/msm/msm_fbdev.c | 20 ++++---------------- 1 file changed, 4 insertions(+), 16 deletions(-) diff --git a/drivers/gpu/drm/msm/msm_fbdev.c b/drivers/gpu/drm/msm/msm_fbdev.c index 323a79d9ef83..81a4ae189a44 100644 --- a/drivers/gpu/drm/msm/msm_fbdev.c +++ b/drivers/gpu/drm/msm/msm_fbdev.c @@ -18,12 +18,6 @@ * fbdev funcs, to implement legacy fbdev interface on top of drm driver */ -#define to_msm_fbdev(x) container_of(x, struct msm_fbdev, base) - -struct msm_fbdev { - struct drm_fb_helper base; -}; - static int msm_fbdev_mmap(struct fb_info *info, struct vm_area_struct *vma) { struct drm_fb_helper *helper = (struct drm_fb_helper *)info->par; @@ -129,16 +123,13 @@ static const struct drm_fb_helper_funcs msm_fb_helper_funcs = { struct drm_fb_helper *msm_fbdev_init(struct drm_device *dev) { struct msm_drm_private *priv = dev->dev_private; - struct msm_fbdev *fbdev; struct drm_fb_helper *helper; int ret; - fbdev = kzalloc(sizeof(*fbdev), GFP_KERNEL); - if (!fbdev) + helper = kzalloc(sizeof(*helper), GFP_KERNEL); + if (!helper) return NULL; - helper = &fbdev->base; - drm_fb_helper_prepare(dev, helper, 32, &msm_fb_helper_funcs); ret = drm_fb_helper_init(dev, helper); @@ -159,7 +150,7 @@ struct drm_fb_helper *msm_fbdev_init(struct drm_device *dev) drm_fb_helper_fini(helper); fail: drm_fb_helper_unprepare(helper); - kfree(fbdev); + kfree(helper); return NULL; } @@ -168,7 +159,6 @@ void msm_fbdev_free(struct drm_device *dev) struct msm_drm_private *priv = dev->dev_private; struct drm_fb_helper *helper = priv->fbdev; struct drm_framebuffer *fb = helper->fb; - struct msm_fbdev *fbdev; DBG(); @@ -176,8 +166,6 @@ void msm_fbdev_free(struct drm_device *dev) drm_fb_helper_fini(helper); - fbdev = to_msm_fbdev(priv->fbdev); - /* this will free the backing object */ if (fb) { struct drm_gem_object *bo = msm_framebuffer_bo(fb, 0); @@ -186,7 +174,7 @@ void msm_fbdev_free(struct drm_device *dev) } drm_fb_helper_unprepare(helper); - kfree(fbdev); + kfree(helper); priv->fbdev = NULL; } From patchwork Mon Apr 3 12:45: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: 13198134 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 4468AC77B6D for ; Mon, 3 Apr 2023 12:45:49 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232381AbjDCMps (ORCPT ); Mon, 3 Apr 2023 08:45:48 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37988 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231532AbjDCMpp (ORCPT ); Mon, 3 Apr 2023 08:45:45 -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 BFA0B76AB for ; Mon, 3 Apr 2023 05:45:43 -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 524BF21CC5; Mon, 3 Apr 2023 12:45:42 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1680525942; 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=skCn5AI2uPTBCiYt5xdgkcl5qCnBD41szIwfBkuQI4g=; b=HgF19yjdHJTNpjJmKe9IiwKJIA3hUE6SAB7v6VJA6iGDwf15pI+u67Czs0b7N68HUIxWw3 +EFcjpbjmigz2hd+xgexwH31zDBOzAgQHYfXky6afrjOTCaTmf22UGLX1aPJwTWmJhU0em SMQrEpn9tp9U/+jQg3HmaI6+d+Q9zm4= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1680525942; 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=skCn5AI2uPTBCiYt5xdgkcl5qCnBD41szIwfBkuQI4g=; b=Ql8Czs46Tqtf43Zpg0lCq/ZfFdPjjvf6p38WLyiOjwMnnjwvXbjp7Tbuxj60buWNHkEjED yJA6lzym1y9ydiCw== 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 1AE691331A; Mon, 3 Apr 2023 12:45:42 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id QHaPBXbKKmTRVgAAMHmgww (envelope-from ); Mon, 03 Apr 2023 12:45:42 +0000 From: Thomas Zimmermann To: robdclark@gmail.com, quic_abhinavk@quicinc.com, dmitry.baryshkov@linaro.org, sean@poorly.run, javierm@redhat.com, airlied@gmail.com, daniel@ffwll.ch Cc: linux-arm-msm@vger.kernel.org, dri-devel@lists.freedesktop.org, freedreno@lists.freedesktop.org, Thomas Zimmermann Subject: [PATCH v2 5/8] drm/msm: Remove fbdev from struct msm_drm_private Date: Mon, 3 Apr 2023 14:45:35 +0200 Message-Id: <20230403124538.8497-6-tzimmermann@suse.de> X-Mailer: git-send-email 2.40.0 In-Reply-To: <20230403124538.8497-1-tzimmermann@suse.de> References: <20230403124538.8497-1-tzimmermann@suse.de> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-arm-msm@vger.kernel.org The DRM device stores a pointer to the fbdev helper. Remove struct msm_drm_private.fbdev, which contains the same value. No functional changes. v2: * test for fb_helper->fb in debugfs code Signed-off-by: Thomas Zimmermann Reviewed-by: Dmitry Baryshkov --- drivers/gpu/drm/msm/msm_debugfs.c | 5 ++--- drivers/gpu/drm/msm/msm_drv.c | 4 ++-- drivers/gpu/drm/msm/msm_drv.h | 2 -- drivers/gpu/drm/msm/msm_fbdev.c | 8 ++------ 4 files changed, 6 insertions(+), 13 deletions(-) diff --git a/drivers/gpu/drm/msm/msm_debugfs.c b/drivers/gpu/drm/msm/msm_debugfs.c index d6ecff0ab618..7de9e39f051e 100644 --- a/drivers/gpu/drm/msm/msm_debugfs.c +++ b/drivers/gpu/drm/msm/msm_debugfs.c @@ -241,12 +241,11 @@ static int msm_fb_show(struct seq_file *m, void *arg) { struct drm_info_node *node = (struct drm_info_node *) m->private; struct drm_device *dev = node->minor->dev; - struct msm_drm_private *priv = dev->dev_private; struct drm_framebuffer *fb, *fbdev_fb = NULL; - if (priv->fbdev) { + if (dev->fb_helper && dev->fb_helper->fb) { seq_printf(m, "fbcon "); - fbdev_fb = priv->fbdev->fb; + fbdev_fb = dev->fb_helper->fb; msm_framebuffer_describe(fbdev_fb, m); } diff --git a/drivers/gpu/drm/msm/msm_drv.c b/drivers/gpu/drm/msm/msm_drv.c index 2a1c6ced82c9..14f4bc33b50b 100644 --- a/drivers/gpu/drm/msm/msm_drv.c +++ b/drivers/gpu/drm/msm/msm_drv.c @@ -242,7 +242,7 @@ static int msm_drm_uninit(struct device *dev) msm_rd_debugfs_cleanup(priv); #ifdef CONFIG_DRM_FBDEV_EMULATION - if (fbdev && priv->fbdev) + if (fbdev && ddev->fb_helper) msm_fbdev_free(ddev); #endif @@ -537,7 +537,7 @@ static int msm_drm_init(struct device *dev, const struct drm_driver *drv) #ifdef CONFIG_DRM_FBDEV_EMULATION if (kms && fbdev) - priv->fbdev = msm_fbdev_init(ddev); + msm_fbdev_init(ddev); #endif ret = msm_debugfs_late_init(ddev); diff --git a/drivers/gpu/drm/msm/msm_drv.h b/drivers/gpu/drm/msm/msm_drv.h index 9f0c184b02a0..852f88c36621 100644 --- a/drivers/gpu/drm/msm/msm_drv.h +++ b/drivers/gpu/drm/msm/msm_drv.h @@ -129,8 +129,6 @@ struct msm_drm_private { bool is_a2xx; bool has_cached_coherent; - struct drm_fb_helper *fbdev; - struct msm_rd_state *rd; /* debugfs to dump all submits */ struct msm_rd_state *hangrd; /* debugfs to dump hanging submits */ struct msm_perf_state *perf; diff --git a/drivers/gpu/drm/msm/msm_fbdev.c b/drivers/gpu/drm/msm/msm_fbdev.c index 81a4ae189a44..0bd0cb85c538 100644 --- a/drivers/gpu/drm/msm/msm_fbdev.c +++ b/drivers/gpu/drm/msm/msm_fbdev.c @@ -122,7 +122,6 @@ static const struct drm_fb_helper_funcs msm_fb_helper_funcs = { /* initialize fbdev helper */ struct drm_fb_helper *msm_fbdev_init(struct drm_device *dev) { - struct msm_drm_private *priv = dev->dev_private; struct drm_fb_helper *helper; int ret; @@ -142,8 +141,6 @@ struct drm_fb_helper *msm_fbdev_init(struct drm_device *dev) if (ret) goto fini; - priv->fbdev = helper; - return helper; fini: @@ -156,8 +153,7 @@ struct drm_fb_helper *msm_fbdev_init(struct drm_device *dev) void msm_fbdev_free(struct drm_device *dev) { - struct msm_drm_private *priv = dev->dev_private; - struct drm_fb_helper *helper = priv->fbdev; + struct drm_fb_helper *helper = dev->fb_helper; struct drm_framebuffer *fb = helper->fb; DBG(); @@ -176,5 +172,5 @@ void msm_fbdev_free(struct drm_device *dev) drm_fb_helper_unprepare(helper); kfree(helper); - priv->fbdev = NULL; + dev->fb_helper = NULL; } From patchwork Mon Apr 3 12:45:36 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Thomas Zimmermann X-Patchwork-Id: 13198133 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 AA3CFC761A6 for ; Mon, 3 Apr 2023 12:45:48 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231808AbjDCMpr (ORCPT ); Mon, 3 Apr 2023 08:45:47 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37990 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232011AbjDCMpp (ORCPT ); Mon, 3 Apr 2023 08:45:45 -0400 Received: from smtp-out2.suse.de (smtp-out2.suse.de [195.135.220.29]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E182C7D8C for ; Mon, 3 Apr 2023 05:45:43 -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 9B7201FF48; Mon, 3 Apr 2023 12:45:42 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1680525942; 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=0MpE22ymb/Uv+aRaua0I54AqrgI32SSKhftHLKaFNwU=; b=uM57m80KIBAW40zUwPpowiigKysc6UaCyetjxw7COBDjStP9/s+C7tSYOqa2DTumFGIM17 42206dS1S9P2hbVmq608e6PFQ+qaFStO9PSU6k9KSL/wh5WWzt7TJ9oXdkySKdM2+Qx6bH CX/4oEq+9sB8SF1rt+avX02KMgDzQYk= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1680525942; 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=0MpE22ymb/Uv+aRaua0I54AqrgI32SSKhftHLKaFNwU=; b=PnNHpmm4gcar+kS82jQXoJ5KStJLMGoJpJ0i8JgBGxTYWPwX4SsNo1s3DJ67djWp7TceUo EeYIUpb6d1OHDxBg== 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 578941331A; Mon, 3 Apr 2023 12:45:42 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id kB9kFHbKKmTRVgAAMHmgww (envelope-from ); Mon, 03 Apr 2023 12:45:42 +0000 From: Thomas Zimmermann To: robdclark@gmail.com, quic_abhinavk@quicinc.com, dmitry.baryshkov@linaro.org, sean@poorly.run, javierm@redhat.com, airlied@gmail.com, daniel@ffwll.ch Cc: linux-arm-msm@vger.kernel.org, dri-devel@lists.freedesktop.org, freedreno@lists.freedesktop.org, Thomas Zimmermann Subject: [PATCH v2 6/8] drm/msm: Move module parameter 'fbdev' to fbdev code Date: Mon, 3 Apr 2023 14:45:36 +0200 Message-Id: <20230403124538.8497-7-tzimmermann@suse.de> X-Mailer: git-send-email 2.40.0 In-Reply-To: <20230403124538.8497-1-tzimmermann@suse.de> References: <20230403124538.8497-1-tzimmermann@suse.de> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-arm-msm@vger.kernel.org Define the module's parameter 'fbdev' in fbdev code. No other code uses it. No functional changes, but simplifies the later conversion to struct drm_client. Signed-off-by: Thomas Zimmermann Reviewed-by: Dmitry Baryshkov --- drivers/gpu/drm/msm/msm_drv.c | 10 ++-------- drivers/gpu/drm/msm/msm_fbdev.c | 7 +++++++ 2 files changed, 9 insertions(+), 8 deletions(-) diff --git a/drivers/gpu/drm/msm/msm_drv.c b/drivers/gpu/drm/msm/msm_drv.c index 14f4bc33b50b..4bf486f0ebb9 100644 --- a/drivers/gpu/drm/msm/msm_drv.c +++ b/drivers/gpu/drm/msm/msm_drv.c @@ -63,12 +63,6 @@ static const struct drm_mode_config_helper_funcs mode_config_helper_funcs = { .atomic_commit_tail = msm_atomic_commit_tail, }; -#ifdef CONFIG_DRM_FBDEV_EMULATION -static bool fbdev = true; -MODULE_PARM_DESC(fbdev, "Enable fbdev compat layer"); -module_param(fbdev, bool, 0600); -#endif - static char *vram = "16m"; MODULE_PARM_DESC(vram, "Configure VRAM size (for devices without IOMMU/GPUMMU)"); module_param(vram, charp, 0); @@ -242,7 +236,7 @@ static int msm_drm_uninit(struct device *dev) msm_rd_debugfs_cleanup(priv); #ifdef CONFIG_DRM_FBDEV_EMULATION - if (fbdev && ddev->fb_helper) + if (ddev->fb_helper) msm_fbdev_free(ddev); #endif @@ -536,7 +530,7 @@ static int msm_drm_init(struct device *dev, const struct drm_driver *drv) drm_mode_config_reset(ddev); #ifdef CONFIG_DRM_FBDEV_EMULATION - if (kms && fbdev) + if (kms) msm_fbdev_init(ddev); #endif diff --git a/drivers/gpu/drm/msm/msm_fbdev.c b/drivers/gpu/drm/msm/msm_fbdev.c index 0bd0cb85c538..7d205632b165 100644 --- a/drivers/gpu/drm/msm/msm_fbdev.c +++ b/drivers/gpu/drm/msm/msm_fbdev.c @@ -14,6 +14,10 @@ #include "msm_gem.h" #include "msm_kms.h" +static bool fbdev = true; +MODULE_PARM_DESC(fbdev, "Enable fbdev compat layer"); +module_param(fbdev, bool, 0600); + /* * fbdev funcs, to implement legacy fbdev interface on top of drm driver */ @@ -125,6 +129,9 @@ struct drm_fb_helper *msm_fbdev_init(struct drm_device *dev) struct drm_fb_helper *helper; int ret; + if (!fbdev) + return NULL; + helper = kzalloc(sizeof(*helper), GFP_KERNEL); if (!helper) return NULL; From patchwork Mon Apr 3 12:45:37 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Thomas Zimmermann X-Patchwork-Id: 13198135 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 E09F1C76196 for ; Mon, 3 Apr 2023 12:45:49 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231532AbjDCMpt (ORCPT ); Mon, 3 Apr 2023 08:45:49 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37992 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232341AbjDCMpp (ORCPT ); Mon, 3 Apr 2023 08:45:45 -0400 Received: from smtp-out1.suse.de (smtp-out1.suse.de [195.135.220.28]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 34FE4658F for ; Mon, 3 Apr 2023 05:45:44 -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 D946D21CCA; Mon, 3 Apr 2023 12:45:42 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1680525942; 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=Xi3die/I2dHKAwxwocB9Q8kQlecVkzakyk/lNTgIG/w=; b=NGMViStDbxAOgFYBgXP3A46oogBwwLMiODzC7eG7HI8msKGTE/SnVFBgxh+73i+W5pDhjy bP8ZoLhNFu1/sf3ULcA6JSlZTdMR+CncMw+qFYXkSLwShGp5sXvuqxxJ7ucfAhisQsydKt 4XCmx6ovnM/N2KGlRR3CqaojBjSn5OU= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1680525942; 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=Xi3die/I2dHKAwxwocB9Q8kQlecVkzakyk/lNTgIG/w=; b=Mp3i4S7Y2+xhfSeKI3hu5azB8qHC8aFrebnU+OdJGnwPyygND/uxd3nH91AbHMvm22coIn UmU+pGbgbMa/6tAg== 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 A077E1331A; Mon, 3 Apr 2023 12:45:42 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id eCtKJnbKKmTRVgAAMHmgww (envelope-from ); Mon, 03 Apr 2023 12:45:42 +0000 From: Thomas Zimmermann To: robdclark@gmail.com, quic_abhinavk@quicinc.com, dmitry.baryshkov@linaro.org, sean@poorly.run, javierm@redhat.com, airlied@gmail.com, daniel@ffwll.ch Cc: linux-arm-msm@vger.kernel.org, dri-devel@lists.freedesktop.org, freedreno@lists.freedesktop.org, Thomas Zimmermann Subject: [PATCH v2 7/8] drm/msm: Initialize fbdev DRM client Date: Mon, 3 Apr 2023 14:45:37 +0200 Message-Id: <20230403124538.8497-8-tzimmermann@suse.de> X-Mailer: git-send-email 2.40.0 In-Reply-To: <20230403124538.8497-1-tzimmermann@suse.de> References: <20230403124538.8497-1-tzimmermann@suse.de> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-arm-msm@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 Reviewed-by: Dmitry Baryshkov --- drivers/gpu/drm/msm/msm_fbdev.c | 37 +++++++++++++++++++++++++++++++-- 1 file changed, 35 insertions(+), 2 deletions(-) diff --git a/drivers/gpu/drm/msm/msm_fbdev.c b/drivers/gpu/drm/msm/msm_fbdev.c index 7d205632b165..77788c6c802d 100644 --- a/drivers/gpu/drm/msm/msm_fbdev.c +++ b/drivers/gpu/drm/msm/msm_fbdev.c @@ -123,6 +123,30 @@ static const struct drm_fb_helper_funcs msm_fb_helper_funcs = { .fb_probe = msm_fbdev_create, }; +/* + * struct drm_client + */ + +static void msm_fbdev_client_unregister(struct drm_client_dev *client) +{ } + +static int msm_fbdev_client_restore(struct drm_client_dev *client) +{ + return 0; +} + +static int msm_fbdev_client_hotplug(struct drm_client_dev *client) +{ + return 0; +} + +static const struct drm_client_funcs msm_fbdev_client_funcs = { + .owner = THIS_MODULE, + .unregister = msm_fbdev_client_unregister, + .restore = msm_fbdev_client_restore, + .hotplug = msm_fbdev_client_hotplug, +}; + /* initialize fbdev helper */ struct drm_fb_helper *msm_fbdev_init(struct drm_device *dev) { @@ -138,10 +162,16 @@ struct drm_fb_helper *msm_fbdev_init(struct drm_device *dev) drm_fb_helper_prepare(dev, helper, 32, &msm_fb_helper_funcs); + ret = drm_client_init(dev, &helper->client, "fbdev", &msm_fbdev_client_funcs); + if (ret) { + drm_err(dev, "Failed to register client: %d\n", ret); + goto err_drm_fb_helper_unprepare; + } + ret = drm_fb_helper_init(dev, helper); if (ret) { DRM_DEV_ERROR(dev->dev, "could not init fbdev: ret=%d\n", ret); - goto fail; + goto err_drm_client_release; } ret = drm_fb_helper_initial_config(helper); @@ -152,7 +182,9 @@ struct drm_fb_helper *msm_fbdev_init(struct drm_device *dev) fini: drm_fb_helper_fini(helper); -fail: +err_drm_client_release: + drm_client_release(&helper->client); +err_drm_fb_helper_unprepare: drm_fb_helper_unprepare(helper); kfree(helper); return NULL; @@ -176,6 +208,7 @@ void msm_fbdev_free(struct drm_device *dev) drm_framebuffer_remove(fb); } + drm_client_release(&helper->client); drm_fb_helper_unprepare(helper); kfree(helper); From patchwork Mon Apr 3 12:45:38 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Thomas Zimmermann X-Patchwork-Id: 13198136 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 3A20EC761A6 for ; Mon, 3 Apr 2023 12:45:51 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231893AbjDCMpt (ORCPT ); Mon, 3 Apr 2023 08:45:49 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38004 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232241AbjDCMpr (ORCPT ); Mon, 3 Apr 2023 08:45:47 -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 94D977D98 for ; Mon, 3 Apr 2023 05:45:44 -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 366E221CC7; Mon, 3 Apr 2023 12:45:43 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1680525943; 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=420wvBnvp1Pv+KONXZ7sMFyAxDEnoJgFxUL7b1bGX8k=; b=PfwrNZfGfuroxay/yEqYOJ+zk78TTLL/TrBRr8wRhmniseO1f/V1jG+8CzRqKGjhGK9AlI JQfA8FvQq8cuLz5yllDh8xnXamge1J+aBnYT04PQrVcIoET6TEMTa1y0azTwQlzMk3Q5tk 1NfJFLdZxHi1BmWn/DQxZh0+lo3Xq68= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1680525943; 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=420wvBnvp1Pv+KONXZ7sMFyAxDEnoJgFxUL7b1bGX8k=; b=pqk7ELz4fL6Xc2Us4AN4o3gGQUodiboGm9zyY6DmNHj0vSjn5VPwJNCzFLoFbvUhxbRGR+ RBwfhhPkTHtd4NCw== 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 DF6031331A; Mon, 3 Apr 2023 12:45:42 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id qIlcNXbKKmTRVgAAMHmgww (envelope-from ); Mon, 03 Apr 2023 12:45:42 +0000 From: Thomas Zimmermann To: robdclark@gmail.com, quic_abhinavk@quicinc.com, dmitry.baryshkov@linaro.org, sean@poorly.run, javierm@redhat.com, airlied@gmail.com, daniel@ffwll.ch Cc: linux-arm-msm@vger.kernel.org, dri-devel@lists.freedesktop.org, freedreno@lists.freedesktop.org, Thomas Zimmermann Subject: [PATCH v2 8/8] drm/msm: Implement fbdev emulation as in-kernel client Date: Mon, 3 Apr 2023 14:45:38 +0200 Message-Id: <20230403124538.8497-9-tzimmermann@suse.de> X-Mailer: git-send-email 2.40.0 In-Reply-To: <20230403124538.8497-1-tzimmermann@suse.de> References: <20230403124538.8497-1-tzimmermann@suse.de> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-arm-msm@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 msm_fbdev_setup() after msm has registered its DRM device. As in most drivers, msm's 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 msm. 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. v2: * handle fbdev module parameter correctly (kernel test robot) Signed-off-by: Thomas Zimmermann Reviewed-by: Dmitry Baryshkov Tested-by: Dmitry Baryshkov # RB5 --- drivers/gpu/drm/msm/msm_debugfs.c | 1 + drivers/gpu/drm/msm/msm_drv.c | 15 +--- drivers/gpu/drm/msm/msm_drv.h | 10 ++- drivers/gpu/drm/msm/msm_fbdev.c | 115 ++++++++++++++++++------------ 4 files changed, 81 insertions(+), 60 deletions(-) diff --git a/drivers/gpu/drm/msm/msm_debugfs.c b/drivers/gpu/drm/msm/msm_debugfs.c index 7de9e39f051e..9c0e633a3a61 100644 --- a/drivers/gpu/drm/msm/msm_debugfs.c +++ b/drivers/gpu/drm/msm/msm_debugfs.c @@ -10,6 +10,7 @@ #include #include +#include #include #include diff --git a/drivers/gpu/drm/msm/msm_drv.c b/drivers/gpu/drm/msm/msm_drv.c index 4bf486f0ebb9..b4d7968e4251 100644 --- a/drivers/gpu/drm/msm/msm_drv.c +++ b/drivers/gpu/drm/msm/msm_drv.c @@ -54,7 +54,6 @@ static const struct drm_mode_config_funcs mode_config_funcs = { .fb_create = msm_framebuffer_create, - .output_poll_changed = drm_fb_helper_output_poll_changed, .atomic_check = drm_atomic_helper_check, .atomic_commit = drm_atomic_helper_commit, }; @@ -235,11 +234,6 @@ static int msm_drm_uninit(struct device *dev) msm_perf_debugfs_cleanup(priv); msm_rd_debugfs_cleanup(priv); -#ifdef CONFIG_DRM_FBDEV_EMULATION - if (ddev->fb_helper) - msm_fbdev_free(ddev); -#endif - msm_disp_snapshot_destroy(ddev); drm_mode_config_cleanup(ddev); @@ -529,17 +523,15 @@ static int msm_drm_init(struct device *dev, const struct drm_driver *drv) } drm_mode_config_reset(ddev); -#ifdef CONFIG_DRM_FBDEV_EMULATION - if (kms) - msm_fbdev_init(ddev); -#endif - ret = msm_debugfs_late_init(ddev); if (ret) goto err_msm_uninit; drm_kms_helper_poll_init(ddev); + if (kms) + msm_fbdev_setup(ddev); + return 0; err_msm_uninit: @@ -1068,7 +1060,6 @@ static const struct drm_driver msm_driver = { DRIVER_SYNCOBJ, .open = msm_open, .postclose = msm_postclose, - .lastclose = drm_fb_helper_lastclose, .dumb_create = msm_gem_dumb_create, .dumb_map_offset = msm_gem_dumb_map_offset, .prime_handle_to_fd = drm_gem_prime_handle_to_fd, diff --git a/drivers/gpu/drm/msm/msm_drv.h b/drivers/gpu/drm/msm/msm_drv.h index 852f88c36621..11a9d2ce07a1 100644 --- a/drivers/gpu/drm/msm/msm_drv.h +++ b/drivers/gpu/drm/msm/msm_drv.h @@ -29,7 +29,6 @@ #include #include #include -#include #include #include #include @@ -304,8 +303,13 @@ struct drm_framebuffer *msm_framebuffer_create(struct drm_device *dev, struct drm_framebuffer * msm_alloc_stolen_fb(struct drm_device *dev, int w, int h, int p, uint32_t format); -struct drm_fb_helper *msm_fbdev_init(struct drm_device *dev); -void msm_fbdev_free(struct drm_device *dev); +#ifdef CONFIG_DRM_FBDEV_EMULATION +void msm_fbdev_setup(struct drm_device *dev); +#else +static inline void msm_fbdev_setup(struct drm_device *dev) +{ +} +#endif struct hdmi; #ifdef CONFIG_DRM_MSM_HDMI diff --git a/drivers/gpu/drm/msm/msm_fbdev.c b/drivers/gpu/drm/msm/msm_fbdev.c index 77788c6c802d..2ebc86381e1c 100644 --- a/drivers/gpu/drm/msm/msm_fbdev.c +++ b/drivers/gpu/drm/msm/msm_fbdev.c @@ -4,7 +4,8 @@ * Author: Rob Clark */ -#include +#include +#include #include #include #include @@ -30,6 +31,25 @@ static int msm_fbdev_mmap(struct fb_info *info, struct vm_area_struct *vma) return drm_gem_prime_mmap(bo, vma); } +static void msm_fbdev_fb_destroy(struct fb_info *info) +{ + struct drm_fb_helper *helper = (struct drm_fb_helper *)info->par; + struct drm_framebuffer *fb = helper->fb; + struct drm_gem_object *bo = msm_framebuffer_bo(fb, 0); + + DBG(); + + drm_fb_helper_fini(helper); + + /* this will free the backing object */ + msm_gem_put_vaddr(bo); + drm_framebuffer_remove(fb); + + drm_client_release(&helper->client); + drm_fb_helper_unprepare(helper); + kfree(helper); +} + static const struct fb_ops msm_fb_ops = { .owner = THIS_MODULE, DRM_FB_HELPER_DEFAULT_OPS, @@ -43,6 +63,7 @@ static const struct fb_ops msm_fb_ops = { .fb_copyarea = drm_fb_helper_sys_copyarea, .fb_imageblit = drm_fb_helper_sys_imageblit, .fb_mmap = msm_fbdev_mmap, + .fb_destroy = msm_fbdev_fb_destroy, }; static int msm_fbdev_create(struct drm_fb_helper *helper, @@ -128,16 +149,52 @@ static const struct drm_fb_helper_funcs msm_fb_helper_funcs = { */ static void msm_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 msm_fbdev_client_restore(struct drm_client_dev *client) { + drm_fb_helper_lastclose(client->dev); + return 0; } static int msm_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 msm_fbdev_client_funcs = { @@ -148,18 +205,20 @@ static const struct drm_client_funcs msm_fbdev_client_funcs = { }; /* initialize fbdev helper */ -struct drm_fb_helper *msm_fbdev_init(struct drm_device *dev) +void msm_fbdev_setup(struct drm_device *dev) { struct drm_fb_helper *helper; int ret; if (!fbdev) - return NULL; + return; + + 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 NULL; - + return; drm_fb_helper_prepare(dev, helper, 32, &msm_fb_helper_funcs); ret = drm_client_init(dev, &helper->client, "fbdev", &msm_fbdev_client_funcs); @@ -168,49 +227,15 @@ struct drm_fb_helper *msm_fbdev_init(struct drm_device *dev) goto err_drm_fb_helper_unprepare; } - ret = drm_fb_helper_init(dev, helper); - if (ret) { - DRM_DEV_ERROR(dev->dev, "could not init fbdev: ret=%d\n", ret); - goto err_drm_client_release; - } - - ret = drm_fb_helper_initial_config(helper); + ret = msm_fbdev_client_hotplug(&helper->client); if (ret) - goto fini; + drm_dbg_kms(dev, "client hotplug ret=%d\n", ret); - return helper; + drm_client_register(&helper->client); -fini: - 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 NULL; -} + return; -void msm_fbdev_free(struct drm_device *dev) -{ - struct drm_fb_helper *helper = dev->fb_helper; - struct drm_framebuffer *fb = helper->fb; - - DBG(); - - drm_fb_helper_unregister_info(helper); - - drm_fb_helper_fini(helper); - - /* this will free the backing object */ - if (fb) { - struct drm_gem_object *bo = msm_framebuffer_bo(fb, 0); - msm_gem_put_vaddr(bo); - drm_framebuffer_remove(fb); - } - - drm_client_release(&helper->client); +err_drm_fb_helper_unprepare: drm_fb_helper_unprepare(helper); kfree(helper); - - dev->fb_helper = NULL; }