From patchwork Wed Nov 27 18:00:33 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Daniel Vetter X-Patchwork-Id: 11264637 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 654BB6C1 for ; Wed, 27 Nov 2019 18:00:52 +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 29F2820871 for ; Wed, 27 Nov 2019 18:00:52 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="MM7PTNS2"; dkim=fail reason="signature verification failed" (1024-bit key) header.d=ffwll.ch header.i=@ffwll.ch header.b="ik1xcvFH" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 29F2820871 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: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:In-Reply-To:References: List-Owner; bh=dsEoY3EtY1njPgs6W3wd02JoCdHCYAqXKpU0m2uJtyw=; b=MM7PTNS2dhjEa1 l/mbvqo/9gMveKZoTVUYH6wl+vsrBCropC1gM1pDW4bdDM06xu8ag6C7Ty76a+AidnCS62x3JO6+M DqetSnAo6F1VeOXqCbLM0MHm9Wue4GgJ7XAEaXufn6NqWXsqNAMHyh8hdFJDwzpcKBP3n8xERX8f/ 0Mj6Vthm1F2w/Z9NAVQJ/NbtSTQMnQlNTMNQZDlzxvyGN6H/nk7UscTTmMVmi1+a4XjuqrpZr2heK gbz4iD5h6dqne2hNC3lRfTfSJmUEUJJ87vySxDlGYNQJPK21m9opGUAacdBC+dRpHX+OOcF0SHi/Q Qxco6HHgwqdn3VbJkDWA==; 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 1ia1cP-0000dZ-5D; Wed, 27 Nov 2019 18:00:49 +0000 Received: from mail-wm1-x342.google.com ([2a00:1450:4864:20::342]) by bombadil.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1ia1cK-0000cc-5w for linux-arm-kernel@lists.infradead.org; Wed, 27 Nov 2019 18:00:46 +0000 Received: by mail-wm1-x342.google.com with SMTP id p17so2731955wma.1 for ; Wed, 27 Nov 2019 10:00:43 -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:mime-version :content-transfer-encoding; bh=BpOgvjxM4sKKd7VkKkuDj6mkq+/hG5T/j3DPRAARKwQ=; b=ik1xcvFH2pBkK2xynTjF/Jfx6VAN9i/CkxI/GQzuSvouOKQr0EGI79/zxOxqLCTS/u 2b9Si/8Tuchp/hVhJ2HaAUakdjZsxwJqtlZ4mZQ4uE8luoxK4Nw9ixR36+7pVamV9Tou H7NWtUKw2WfrBQ4XhAB2MnN4lbiH6W6iZeLks= 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:mime-version :content-transfer-encoding; bh=BpOgvjxM4sKKd7VkKkuDj6mkq+/hG5T/j3DPRAARKwQ=; b=E+trhuy3iTQEdlvb8y2O9O14fs49LJ8VED2/dERGo7Z8LPPZxy2gH+Oh26R5amazYi 9EyrTyS5yWoxW1jZJQYPz2kZqYzbSTLZ4n/GL0Ym0lyAgpp+yFhbgBl8xWcEMbdh1cbp q8R9QrHWSJQJ3WkbgYqoPRLGkcatM+I84rI7gfte2bc406+hjFO0nh7eq3Hgyw5d9X/r eiGPJn3Eber3jAchhmTgu5SaU8qcvOsEaeuLf2zTgY4sfeJTjJIN1KJrNC9RV3sokyyH Hg6kmHS3oiWXxkmXgcrfCNFHqzukzL4yoEq3BAl/1ZpwP+uzYKkMJfoTYLF83r/NMXr4 fd4Q== X-Gm-Message-State: APjAAAUrV2pjQOWtlQ+zGEiCZtb1KJQyXDtmb58DrFvb0Ev8jOPzmqeX DsYsYoavoCl9DXHu0YhEXxHVWQ== X-Google-Smtp-Source: APXvYqz46T0HWQ8pzpwreZfkTMdj8kYk6kJTppF1wGbW+JAKUBYuyKdq15Vo2Pkn1m8UGn9tTBM/ZQ== X-Received: by 2002:a7b:c7d3:: with SMTP id z19mr5772162wmk.98.1574877642244; Wed, 27 Nov 2019 10:00:42 -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 m15sm19940165wrq.97.2019.11.27.10.00.41 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 27 Nov 2019 10:00:41 -0800 (PST) From: Daniel Vetter To: DRI Development Subject: [PATCH 1/3] drm/rockchip: Use drm_gem_fb_create_with_dirty Date: Wed, 27 Nov 2019 19:00:33 +0100 Message-Id: <20191127180035.416209-1-daniel.vetter@ffwll.ch> X-Mailer: git-send-email 2.24.0 MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20191127_100044_229408_D97902CD X-CRM114-Status: GOOD ( 13.09 ) 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:342 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 , Sandy Huang , Andrzej Pietrasiewicz , 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). v2: Actually use _with_dirty like the patch subject promised (Andrzej) Cc: Andrzej Pietrasiewicz 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 Reviewed-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..221e72e71432 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_with_dirty, .output_poll_changed = drm_fb_helper_output_poll_changed, .atomic_check = drm_atomic_helper_check, .atomic_commit = drm_atomic_helper_commit,