From patchwork Fri Nov 15 09:21:14 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Daniel Vetter X-Patchwork-Id: 11245425 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 9C297159A for ; Fri, 15 Nov 2019 09:21:36 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 79B442073A for ; Fri, 15 Nov 2019 09:21:36 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="eLwBq45P"; dkim=fail reason="signature verification failed" (1024-bit key) header.d=ffwll.ch header.i=@ffwll.ch header.b="Ld4XloE2" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 79B442073A Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=ffwll.ch Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=6qtetTdwlZl03omq9EoGWlYPt43G+TFfbGReWcl6Kpg=; b=eLwBq45PXHOir8 AjTZfmCjKUvA50U7YxJ36iAtHWjb7609Ft1uN/UjkOTxnliakrAzqj9kuX8MbHTULPj78kr8moA7C FNULkBH4CrkK76p+CGjc5WpQfWZk2PU9X40W+lSAMWTgHXPUZSsLDljVGCeXyoAx6M4+2gmmDSS2d R8CSiK3KqW8De7aB0WLnh6mff3+HTkjOXEbtlfKzICYHfjXaeVygk+IMwpxWSf+cCC8DJPJbi/G6J nE741TSjbvUBFZJ2/I1P/VDgbsAWcPoxkQQIGdPAGWNVQL12SaJ9kAjiecsgKMamvMbLP0gYy48BB PNNR3ZjGBakWjTMYpJXw==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1iVXnK-0007Ol-QQ; Fri, 15 Nov 2019 09:21:34 +0000 Received: from mail-wm1-x343.google.com ([2a00:1450:4864:20::343]) by bombadil.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1iVXnH-0007Mq-BC for linux-arm-kernel@lists.infradead.org; Fri, 15 Nov 2019 09:21:32 +0000 Received: by mail-wm1-x343.google.com with SMTP id l1so8904977wme.2 for ; Fri, 15 Nov 2019 01:21:30 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ffwll.ch; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=oQB86j8FZQH4Sh7rDbVmMqNvIL9AFAXhmpfcG7mbgqg=; b=Ld4XloE2FMFzkHUAG7n2jsiQXHCt5cLaiA94t087F7u+01dZJeZ0TRKPko5uVepFBd ivSQf+gMl0XzwE6nw2V9W0qYXt0eV5v5UbehbFWKwbeTXDsPmN8p357V3VvmDe6y7oD1 b/jgpdfFOh0OLKqUH9XDrAKaEhu0GFl7FddtI= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=oQB86j8FZQH4Sh7rDbVmMqNvIL9AFAXhmpfcG7mbgqg=; b=GV3foT4wxoFXD9tRJqMVmHz4dbLTAB7nj3VGhlcxpN6mA3ie+4JppFYX0H1/wq+z/B AB5/BT9fcVuNB4HDwsP3SZIF4tDlbvZjDPZMyvdsVGZ+gDmyN8hdNcaadiYcNZW2jLXy +/XKcSkHgp9PD31lyHW/V8tOYLfE1K9Z+b10pZaNpiLueopUAUkQovffJA1eFGWwWx6F P6bIDKd10rf06brBQhIK8JLnUgWzqPvqJtnVALqyXI+omp24N3jbP8CvdXinE1EhtAG6 RuweVNA24HbGxK87cNjbqX+m8dwUXODXgwOyVlJR5bCxppCGjTjjV6mCW0E1sVL32PDt jCGg== X-Gm-Message-State: APjAAAUO3m67A9JGPjfJL8yblTnoU2UM4hnVLrRqrHGLs9kH+wGExlbf k+8HxpA/19JH5NqsVYxSiDO6Lw== X-Google-Smtp-Source: APXvYqzfNw+xEwRsZgEJ5EaZ5mtAtKcnYpFttPkjdcMRICstqKjbeIL1lMoNPriAWVWuc8ftUFw/fQ== X-Received: by 2002:a7b:c762:: with SMTP id x2mr13261637wmk.128.1573809689026; Fri, 15 Nov 2019 01:21:29 -0800 (PST) Received: from phenom.ffwll.local (212-51-149-96.fiber7.init7.net. [212.51.149.96]) by smtp.gmail.com with ESMTPSA id 11sm8987506wmi.8.2019.11.15.01.21.27 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 15 Nov 2019 01:21:28 -0800 (PST) From: Daniel Vetter To: DRI Development Subject: [PATCH 2/8] drm/atmel: ditch fb_create wrapper Date: Fri, 15 Nov 2019 10:21:14 +0100 Message-Id: <20191115092120.4445-3-daniel.vetter@ffwll.ch> X-Mailer: git-send-email 2.24.0 In-Reply-To: <20191115092120.4445-1-daniel.vetter@ffwll.ch> References: <20191115092120.4445-1-daniel.vetter@ffwll.ch> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20191115_012131_443473_CFDFDD44 X-CRM114-Status: GOOD ( 11.12 ) X-Spam-Score: -0.2 (/) X-Spam-Report: SpamAssassin version 3.4.2 on bombadil.infradead.org summary: Content analysis details: (-0.2 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 RCVD_IN_DNSWL_NONE RBL: Sender listed at https://www.dnswl.org/, no trust [2a00:1450:4864:20:0:0:0:343 listed in] [list.dnswl.org] 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record 0.0 SPF_NONE SPF: sender does not publish an SPF Record -0.1 DKIM_VALID_EF Message has a valid DKIM or DK signature from envelope-from domain 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Alexandre Belloni , Boris Brezillon , Daniel Vetter , Intel Graphics Development , Ludovic Desroches , Daniel Vetter , Sam Ravnborg , linux-arm-kernel@lists.infradead.org Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org Spotted while looking through them all. Signed-off-by: Daniel Vetter Cc: Sam Ravnborg Cc: Boris Brezillon Cc: Nicolas Ferre Cc: Alexandre Belloni Cc: Ludovic Desroches Cc: linux-arm-kernel@lists.infradead.org Acked-by: Boris Brezillon --- drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_dc.c | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_dc.c b/drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_dc.c index 92640298ad41..8dc917a1270b 100644 --- a/drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_dc.c +++ b/drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_dc.c @@ -557,12 +557,6 @@ static irqreturn_t atmel_hlcdc_dc_irq_handler(int irq, void *data) return IRQ_HANDLED; } -static struct drm_framebuffer *atmel_hlcdc_fb_create(struct drm_device *dev, - struct drm_file *file_priv, const struct drm_mode_fb_cmd2 *mode_cmd) -{ - return drm_gem_fb_create(dev, file_priv, mode_cmd); -} - struct atmel_hlcdc_dc_commit { struct work_struct work; struct drm_device *dev; @@ -657,7 +651,7 @@ static int atmel_hlcdc_dc_atomic_commit(struct drm_device *dev, } static const struct drm_mode_config_funcs mode_config_funcs = { - .fb_create = atmel_hlcdc_fb_create, + .fb_create = drm_gem_fb_create, .atomic_check = drm_atomic_helper_check, .atomic_commit = atmel_hlcdc_dc_atomic_commit, }; From patchwork Fri Nov 15 09:21:15 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Daniel Vetter X-Patchwork-Id: 11245463 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 03A14159A for ; Fri, 15 Nov 2019 09:22:04 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 8448620733 for ; Fri, 15 Nov 2019 09:22:03 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="T9jvZyFa"; dkim=fail reason="signature verification failed" (1024-bit key) header.d=ffwll.ch header.i=@ffwll.ch header.b="WfM8FyTO" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 8448620733 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=ffwll.ch Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=FQmZHHVzmFt/dRty5INKGANCVneOM5IO2zirjmfSeDs=; b=T9jvZyFakYawXo RmQCU8c+CIyPYTpl5E/o3k8j1MJ2cvu0bfcaf0fnxA4E6cCeMJnRcz92B7qydYNymfTljrndfmgEI yc7KhOEwlXKLt9aEz4B6I30j4DmjORp0dlFxoGYTT1rWFuKiPX1WYMmIA620p09guDJI3j9baCvzj vIoBhpseCCHPEAn678rVkYa/Vg1N+xLGrevvvWcNPRhbkLOZntmd4QeHUFf6YM5L2nUh7Gse5LiR5 3+KT/4ngHpq/fjJiJFbYAK0rI+w5iQmaq+6HKPFKW5yhwGQaCpMRFudj7qhxvHDmLszwOgbOjkAKw 6+LcaKLdeulWwH1qsr7g==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1iVXnk-0007pN-E0; Fri, 15 Nov 2019 09:22:00 +0000 Received: from mail-wr1-x442.google.com ([2a00:1450:4864:20::442]) by bombadil.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1iVXnH-0007Mr-HL for linux-arm-kernel@lists.infradead.org; Fri, 15 Nov 2019 09:21:34 +0000 Received: by mail-wr1-x442.google.com with SMTP id f2so10133240wrs.11 for ; Fri, 15 Nov 2019 01:21:31 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ffwll.ch; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=tGjIM2+uUqMORVIasokc3/CvFp+wprfDfEiecNEi+4o=; b=WfM8FyTO7ypE+YMQNKDxQoBKIEgYOliOhA8IHmPKabbGB3iVqRcp9+2Yiz95KojpyN 5RRyo1OFsYseOMJj0ngbATa4TKXxD9cw6JBnsUbQKpNyC8sS9fwiLVyMISJSJt3Y2mwY EujkOzvZYc9UjWmsXzRIqw8m1ryOAtGIjx3UQ= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=tGjIM2+uUqMORVIasokc3/CvFp+wprfDfEiecNEi+4o=; b=b3NIqevtz0gqkj39HSS3wT3UoJvZN9ExRivBQiIxA/JtWrwWmXujkwfo2uAS4ZpNy0 yiIePOW0BBsgSk/pLyRjOxCmmwiEJf3rm6g43clIwyts+KqRuiKXy3KubFN1+z/5ToD6 B9LId5iWpWvfC/w5HXrLnutnyvFEpJTY2gorRCqJMgNSgt38/0+eJ4vsiT1w9pfMbbZY s0Pnub1dRRf2eCNx/m/BZ6zuRCUwVLLggDYbFGNH4K/s89+O/k3rfjegmkGuQsgOxaP/ PBlfBtSPE2+Qgle90OjhqdEL87R5fm5qyFoLzb4/ZrvqYge/JSNx1cmeyibarzkdEMVA LqhA== X-Gm-Message-State: APjAAAUAWX4HFENAnIP7v5woBHpxK/OOfhSD/q6wy6vf/MnEyaFksRte 2zy5OikcIOiGHoiecapysOFDCw== X-Google-Smtp-Source: APXvYqwnf2/MQXZ679hFBEv5ABxJG5pWkcrTe0XZXAxsR67X5YWu3QoXY4fHOvAlU81ah5/AgJgOLA== X-Received: by 2002:adf:e883:: with SMTP id d3mr13501518wrm.197.1573809690172; Fri, 15 Nov 2019 01:21:30 -0800 (PST) Received: from phenom.ffwll.local (212-51-149-96.fiber7.init7.net. [212.51.149.96]) by smtp.gmail.com with ESMTPSA id 11sm8987506wmi.8.2019.11.15.01.21.29 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 15 Nov 2019 01:21:29 -0800 (PST) From: Daniel Vetter To: DRI Development Subject: [PATCH 3/8] drm/mediatek: don't open-code drm_gem_fb_create Date: Fri, 15 Nov 2019 10:21:15 +0100 Message-Id: <20191115092120.4445-4-daniel.vetter@ffwll.ch> X-Mailer: git-send-email 2.24.0 In-Reply-To: <20191115092120.4445-1-daniel.vetter@ffwll.ch> References: <20191115092120.4445-1-daniel.vetter@ffwll.ch> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20191115_012131_597092_2E782531 X-CRM114-Status: GOOD ( 17.70 ) X-Spam-Score: -0.2 (/) X-Spam-Report: SpamAssassin version 3.4.2 on bombadil.infradead.org summary: Content analysis details: (-0.2 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 RCVD_IN_DNSWL_NONE RBL: Sender listed at https://www.dnswl.org/, no trust [2a00:1450:4864:20:0:0:0:442 listed in] [list.dnswl.org] 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record 0.0 SPF_NONE SPF: sender does not publish an SPF Record -0.1 DKIM_VALID_EF Message has a valid DKIM or DK signature from envelope-from domain 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Daniel Vetter , Intel Graphics Development , Matthias Brugger , linux-mediatek@lists.infradead.org, Philipp Zabel , CK Hu , linux-arm-kernel@lists.infradead.org Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org Aside: There's a few other fb_create implementations which simply check for valid buffer format (or an approximation thereof), and then call drm_gem_fb_create. For atomic drivers at least we could walk all planes and make sure the format/modifier combo is valid, and remove even more code. For non-atomic drivers that's not possible, since the format list for the primary buffer might be garbage (and most likely it is). Also delete mtk_drm_fb.[hc] since it would now only contain one function. Signed-off-by: Daniel Vetter Cc: CK Hu Cc: Philipp Zabel Cc: Matthias Brugger Cc: linux-arm-kernel@lists.infradead.org Cc: linux-mediatek@lists.infradead.org Acked-by: CK Hu --- drivers/gpu/drm/mediatek/mtk_drm_drv.c | 16 ++++- drivers/gpu/drm/mediatek/mtk_drm_fb.c | 92 ------------------------ drivers/gpu/drm/mediatek/mtk_drm_fb.h | 13 ---- drivers/gpu/drm/mediatek/mtk_drm_plane.c | 1 - 4 files changed, 15 insertions(+), 107 deletions(-) delete mode 100644 drivers/gpu/drm/mediatek/mtk_drm_fb.c delete mode 100644 drivers/gpu/drm/mediatek/mtk_drm_fb.h diff --git a/drivers/gpu/drm/mediatek/mtk_drm_drv.c b/drivers/gpu/drm/mediatek/mtk_drm_drv.c index 84d14213d992..2b1c122066ea 100644 --- a/drivers/gpu/drm/mediatek/mtk_drm_drv.c +++ b/drivers/gpu/drm/mediatek/mtk_drm_drv.c @@ -16,8 +16,10 @@ #include #include #include +#include #include #include +#include #include #include #include @@ -27,7 +29,6 @@ #include "mtk_drm_ddp.h" #include "mtk_drm_ddp_comp.h" #include "mtk_drm_drv.h" -#include "mtk_drm_fb.h" #include "mtk_drm_gem.h" #define DRIVER_NAME "mediatek" @@ -115,6 +116,19 @@ static int mtk_atomic_commit(struct drm_device *drm, return 0; } +static struct drm_framebuffer * +mtk_drm_mode_fb_create(struct drm_device *dev, + struct drm_file *file, + const struct drm_mode_fb_cmd2 *cmd) +{ + const struct drm_format_info *info = drm_get_format_info(dev, cmd); + + if (info->num_planes != 1) + return ERR_PTR(-EINVAL); + + return drm_gem_fb_create(dev, file, cmd); +} + static const struct drm_mode_config_funcs mtk_drm_mode_config_funcs = { .fb_create = mtk_drm_mode_fb_create, .atomic_check = drm_atomic_helper_check, diff --git a/drivers/gpu/drm/mediatek/mtk_drm_fb.c b/drivers/gpu/drm/mediatek/mtk_drm_fb.c deleted file mode 100644 index 3f230a28a2dc..000000000000 --- a/drivers/gpu/drm/mediatek/mtk_drm_fb.c +++ /dev/null @@ -1,92 +0,0 @@ -// SPDX-License-Identifier: GPL-2.0-only -/* - * Copyright (c) 2015 MediaTek Inc. - */ - -#include -#include - -#include -#include -#include -#include -#include - -#include "mtk_drm_drv.h" -#include "mtk_drm_fb.h" -#include "mtk_drm_gem.h" - -static const struct drm_framebuffer_funcs mtk_drm_fb_funcs = { - .create_handle = drm_gem_fb_create_handle, - .destroy = drm_gem_fb_destroy, -}; - -static struct drm_framebuffer *mtk_drm_framebuffer_init(struct drm_device *dev, - const struct drm_mode_fb_cmd2 *mode, - struct drm_gem_object *obj) -{ - const struct drm_format_info *info = drm_get_format_info(dev, mode); - struct drm_framebuffer *fb; - int ret; - - if (info->num_planes != 1) - return ERR_PTR(-EINVAL); - - fb = kzalloc(sizeof(*fb), GFP_KERNEL); - if (!fb) - return ERR_PTR(-ENOMEM); - - drm_helper_mode_fill_fb_struct(dev, fb, mode); - - fb->obj[0] = obj; - - ret = drm_framebuffer_init(dev, fb, &mtk_drm_fb_funcs); - if (ret) { - DRM_ERROR("failed to initialize framebuffer\n"); - kfree(fb); - return ERR_PTR(ret); - } - - return fb; -} - -struct drm_framebuffer *mtk_drm_mode_fb_create(struct drm_device *dev, - struct drm_file *file, - const struct drm_mode_fb_cmd2 *cmd) -{ - const struct drm_format_info *info = drm_get_format_info(dev, cmd); - struct drm_framebuffer *fb; - struct drm_gem_object *gem; - unsigned int width = cmd->width; - unsigned int height = cmd->height; - unsigned int size, bpp; - int ret; - - if (info->num_planes != 1) - return ERR_PTR(-EINVAL); - - gem = drm_gem_object_lookup(file, cmd->handles[0]); - if (!gem) - return ERR_PTR(-ENOENT); - - bpp = info->cpp[0]; - size = (height - 1) * cmd->pitches[0] + width * bpp; - size += cmd->offsets[0]; - - if (gem->size < size) { - ret = -EINVAL; - goto unreference; - } - - fb = mtk_drm_framebuffer_init(dev, cmd, gem); - if (IS_ERR(fb)) { - ret = PTR_ERR(fb); - goto unreference; - } - - return fb; - -unreference: - drm_gem_object_put_unlocked(gem); - return ERR_PTR(ret); -} diff --git a/drivers/gpu/drm/mediatek/mtk_drm_fb.h b/drivers/gpu/drm/mediatek/mtk_drm_fb.h deleted file mode 100644 index eb64d26001c6..000000000000 --- a/drivers/gpu/drm/mediatek/mtk_drm_fb.h +++ /dev/null @@ -1,13 +0,0 @@ -/* SPDX-License-Identifier: GPL-2.0-only */ -/* - * Copyright (c) 2015 MediaTek Inc. - */ - -#ifndef MTK_DRM_FB_H -#define MTK_DRM_FB_H - -struct drm_framebuffer *mtk_drm_mode_fb_create(struct drm_device *dev, - struct drm_file *file, - const struct drm_mode_fb_cmd2 *cmd); - -#endif /* MTK_DRM_FB_H */ diff --git a/drivers/gpu/drm/mediatek/mtk_drm_plane.c b/drivers/gpu/drm/mediatek/mtk_drm_plane.c index 3b0cc91c7023..540ef2faa40a 100644 --- a/drivers/gpu/drm/mediatek/mtk_drm_plane.c +++ b/drivers/gpu/drm/mediatek/mtk_drm_plane.c @@ -13,7 +13,6 @@ #include "mtk_drm_crtc.h" #include "mtk_drm_ddp_comp.h" #include "mtk_drm_drv.h" -#include "mtk_drm_fb.h" #include "mtk_drm_gem.h" #include "mtk_drm_plane.h" From patchwork Fri Nov 15 09:21:16 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Daniel Vetter X-Patchwork-Id: 11245445 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id D4E01159A for ; Fri, 15 Nov 2019 09:21:50 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id B2CC620733 for ; Fri, 15 Nov 2019 09:21:50 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="GoA79wo3"; dkim=fail reason="signature verification failed" (1024-bit key) header.d=ffwll.ch header.i=@ffwll.ch header.b="Om/NhQzS" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org B2CC620733 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=ffwll.ch Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=Dx70+TgDyvL4+yRPpn+LcPdi8ADs0fc3E1B24ge7jtg=; b=GoA79wo3THKuUf ujXSSrtw69/pOXJ6vLyzubN8gADa2NI29xvOT/VStVzcp8f6YTpTQqxAhmerb1CL32mcysIMqDu+b Ag1bDozUELYUGNv6kbfnLAIdskOmmvMTH3snQFaB3kcqmzzY9Cadxod3W4EsREC3GQCMN8IAs6oda 6eF+yMh7QsxLbodD32oWQ78bRG4LeHsvZk5F2HXB2JleQKsefjDC5Q2M7QIyjTlOsoyf5D86Lsbfg ufuGCWHyl3Ho3S5MrKp4VCMOnfnRbfKM1a54OIEtBooxMlj3/1LQuIxeO4iR06k3tFZuFDhRNkcKe MBH7KyFJTAWS0IOoGleQ==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1iVXnZ-0007cv-OO; Fri, 15 Nov 2019 09:21:49 +0000 Received: from mail-wr1-x442.google.com ([2a00:1450:4864:20::442]) by bombadil.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1iVXnI-0007NO-AD for linux-arm-kernel@lists.infradead.org; Fri, 15 Nov 2019 09:21:34 +0000 Received: by mail-wr1-x442.google.com with SMTP id b18so8673945wrj.8 for ; Fri, 15 Nov 2019 01:21:32 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ffwll.ch; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=ofNJ8QQd5sGKrd+MvK2ikuebIJLqvpUQ1kyGZQwtx/I=; b=Om/NhQzSdKpM6y/70DSZwXeDQIzy3oww63dVXF+OkGU5AZ0pB+zj8FG7NKM/EXiRWC tsVz9AeWnDSaawt4fCt6LuYisC6aoim0bUIYwOgMWHoKxnN/px9yPhnVw6hqWCdYnapQ 5K/8mdZ77+F6o0wD71fQz9k/MvOSGh1krio6I= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=ofNJ8QQd5sGKrd+MvK2ikuebIJLqvpUQ1kyGZQwtx/I=; b=fi63a9Ru7bb12EV6ERy56qErQ6hw7cJUDI3B8R9fOTS7V90JDHQUDWfvrM57Kkzx1T uDQIEp17QxL3FK0VW97+mQax9cUDntSsYEI7SoPIYwQncI5O6znW+DI88Rg8bHoS2xgj Yd+bvfefjzoiU4cP5/4c6kHqDr2SqtfxQvreqC5B82pqOanmuwQVt1zwKhKMUFssUc+8 q+qHv7e7bToBa5EBAJKdiI9vx0AmUVgtoAhVEpkc4yb7W7JhxwQWWRWrle3AZkU6lnv+ uqF4XjvJza1h31zINv6OOEfwAwewcr1g0EKM0yrq2a4XbutgB/H6rkw2zba1EBOHMWxY c2Hg== X-Gm-Message-State: APjAAAVz/zHBZQ/QwlKrL8R05naxRGSVpHBJRptDuoz/sC+ZD81LF5A4 CQf3FsVjB403mBKpashL7F7jdQ== X-Google-Smtp-Source: APXvYqyQKoodCSy68a/nZvolemA/RUEMw97i8haQjEdjkNAIk+Di+W/dIlbZO269UWOLN4VoIfMQEA== X-Received: by 2002:adf:f44a:: with SMTP id f10mr13999917wrp.63.1573809691156; Fri, 15 Nov 2019 01:21:31 -0800 (PST) Received: from phenom.ffwll.local (212-51-149-96.fiber7.init7.net. [212.51.149.96]) by smtp.gmail.com with ESMTPSA id 11sm8987506wmi.8.2019.11.15.01.21.30 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 15 Nov 2019 01:21:30 -0800 (PST) From: Daniel Vetter To: DRI Development Subject: [PATCH 4/8] drm/rockchip: Use drm_gem_fb_create_with_dirty Date: Fri, 15 Nov 2019 10:21:16 +0100 Message-Id: <20191115092120.4445-5-daniel.vetter@ffwll.ch> X-Mailer: git-send-email 2.24.0 In-Reply-To: <20191115092120.4445-1-daniel.vetter@ffwll.ch> References: <20191115092120.4445-1-daniel.vetter@ffwll.ch> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20191115_012132_356739_E7E4D785 X-CRM114-Status: GOOD ( 13.66 ) X-Spam-Score: -0.2 (/) X-Spam-Report: SpamAssassin version 3.4.2 on bombadil.infradead.org summary: Content analysis details: (-0.2 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 RCVD_IN_DNSWL_NONE RBL: Sender listed at https://www.dnswl.org/, no trust [2a00:1450:4864:20:0:0:0:442 listed in] [list.dnswl.org] 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record 0.0 SPF_NONE SPF: sender does not publish an SPF Record -0.1 DKIM_VALID_EF Message has a valid DKIM or DK signature from envelope-from domain 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: =?utf-8?q?Heiko_St=C3=BCbner?= , Daniel Vetter , Intel Graphics Development , Sandy Huang , linux-rockchip@lists.infradead.org, Daniel Vetter , linux-arm-kernel@lists.infradead.org Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org If rockchip would switch over to the generic fbdev setup we could grabage collect even more of all this code (all of the remaining fb handling code really). Signed-off-by: Daniel Vetter Cc: Sandy Huang Cc: "Heiko Stübner" Cc: linux-arm-kernel@lists.infradead.org Cc: linux-rockchip@lists.infradead.org Tested-by: Andrzej Pietrasiewicz --- drivers/gpu/drm/rockchip/rockchip_drm_fb.c | 54 +--------------------- 1 file changed, 1 insertion(+), 53 deletions(-) diff --git a/drivers/gpu/drm/rockchip/rockchip_drm_fb.c b/drivers/gpu/drm/rockchip/rockchip_drm_fb.c index ca01234c037c..081dbdaa0b07 100644 --- a/drivers/gpu/drm/rockchip/rockchip_drm_fb.c +++ b/drivers/gpu/drm/rockchip/rockchip_drm_fb.c @@ -53,64 +53,12 @@ rockchip_fb_alloc(struct drm_device *dev, const struct drm_mode_fb_cmd2 *mode_cm return fb; } -static struct drm_framebuffer * -rockchip_user_fb_create(struct drm_device *dev, struct drm_file *file_priv, - const struct drm_mode_fb_cmd2 *mode_cmd) -{ - const struct drm_format_info *info = drm_get_format_info(dev, - mode_cmd); - struct drm_framebuffer *fb; - struct drm_gem_object *objs[ROCKCHIP_MAX_FB_BUFFER]; - struct drm_gem_object *obj; - int num_planes = min_t(int, info->num_planes, ROCKCHIP_MAX_FB_BUFFER); - int ret; - int i; - - for (i = 0; i < num_planes; i++) { - unsigned int width = mode_cmd->width / (i ? info->hsub : 1); - unsigned int height = mode_cmd->height / (i ? info->vsub : 1); - unsigned int min_size; - - obj = drm_gem_object_lookup(file_priv, mode_cmd->handles[i]); - if (!obj) { - DRM_DEV_ERROR(dev->dev, - "Failed to lookup GEM object\n"); - ret = -ENXIO; - goto err_gem_object_unreference; - } - - min_size = (height - 1) * mode_cmd->pitches[i] + - mode_cmd->offsets[i] + - width * info->cpp[i]; - - if (obj->size < min_size) { - drm_gem_object_put_unlocked(obj); - ret = -EINVAL; - goto err_gem_object_unreference; - } - objs[i] = obj; - } - - fb = rockchip_fb_alloc(dev, mode_cmd, objs, i); - if (IS_ERR(fb)) { - ret = PTR_ERR(fb); - goto err_gem_object_unreference; - } - - return fb; - -err_gem_object_unreference: - for (i--; i >= 0; i--) - drm_gem_object_put_unlocked(objs[i]); - return ERR_PTR(ret); -} - static const struct drm_mode_config_helper_funcs rockchip_mode_config_helpers = { .atomic_commit_tail = drm_atomic_helper_commit_tail_rpm, }; static const struct drm_mode_config_funcs rockchip_drm_mode_config_funcs = { - .fb_create = rockchip_user_fb_create, + .fb_create = drm_gem_fb_create, .output_poll_changed = drm_fb_helper_output_poll_changed, .atomic_check = drm_atomic_helper_check, .atomic_commit = drm_atomic_helper_commit,