From patchwork Thu Jun 7 13:36:06 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Marek Szyprowski X-Patchwork-Id: 137889 Delivered-To: patch@linaro.org Received: by 2002:a2e:970d:0:0:0:0:0 with SMTP id r13-v6csp2108556lji; Thu, 7 Jun 2018 06:36:23 -0700 (PDT) X-Google-Smtp-Source: ADUXVKLlUD+NVEDgkQVv9U/cE4R1QB0hnb6yU9th7Gkj31UBK9mH9zu+IabCM42Do4So6twoACWD X-Received: by 2002:a63:67c4:: with SMTP id b187-v6mr1624056pgc.86.1528378583374; Thu, 07 Jun 2018 06:36:23 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1528378583; cv=none; d=google.com; s=arc-20160816; b=phe1uO2UymBG9BCk2VZd/uqpncP4C4bTJY8Frt9uQIhaFuWJtNg5+0+qsfJCRyxTI5 2+5wsOxssliZCeDzI///9iOCEfXv+xnOTSB3j9ZjQIXvgPR7dgi6qGVs/+3KWt9PNgAz 539iXvS9+dLibTDTqpQeGdjHhSN3dWsOsvSV+m2eroy3Ymoy+IqMV9VMlNBhm8NEmmfr Ngw8H06nDUW64W37wv4G/cqs+k0C3i+s/x4z4Iib7D3zB1HcuDUMEQKvTZOGPHmELDTe 65fsJayBI/xclMoXSjlMaJMTeWRkEVtV/JvvBo4a6PrwlCJxZMSwUHuO6U8ZJOiNUzl6 +3Ag== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:cms-type:in-reply-to :message-id:date:subject:cc:to:from:dkim-signature:dkim-filter :arc-authentication-results; bh=lxnAuA0sHNf9+9OuICPGK8Mk+iOGcni+N+UxOIIHhA4=; b=aogwOllxgNSfC10tzf3d5/xPi2+DGzz383IrU4UHFEEMWAXNMcloxQ+2lJZyY9VZjJ Dj/RWfraCsr9vBuCYuyTC13r22olH5wDJWDD6ZfS4As2DnhtqDn4jxPt7SwbNIlXgzaF MwM6JxxksJtdIJnGNGW1Cwecj4aV6Oj7lqwHWZMBrqHvEiJqGxEJIy+XiR2Kkrh2irPU 8w9+jJ3zCC/6rEkQ3e+U3wehgdakZ8p6zqTpbWFvT0tfzyc2er/J+oIrcmCCavedAKGH WmoCOCI77y6c47zzYz480DpUY+0gv0utqKdvui0Eo5XWeY38tQcEaFJsSWSwlUUM/TdG HMLQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@samsung.com header.s=mail20170921 header.b=qs/OAh3H; spf=pass (google.com: best guess record for domain of linux-samsung-soc-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-samsung-soc-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=samsung.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id h127-v6si57919045pfb.111.2018.06.07.06.36.23; Thu, 07 Jun 2018 06:36:23 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-samsung-soc-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=neutral (body hash did not verify) header.i=@samsung.com header.s=mail20170921 header.b=qs/OAh3H; spf=pass (google.com: best guess record for domain of linux-samsung-soc-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-samsung-soc-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=samsung.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932743AbeFGNgW (ORCPT + 3 others); Thu, 7 Jun 2018 09:36:22 -0400 Received: from mailout2.w1.samsung.com ([210.118.77.12]:54072 "EHLO mailout2.w1.samsung.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932389AbeFGNgV (ORCPT ); Thu, 7 Jun 2018 09:36:21 -0400 Received: from eucas1p1.samsung.com (unknown [182.198.249.206]) by mailout2.w1.samsung.com (KnoxPortal) with ESMTP id 20180607133618euoutp023cd37ce28bf195c572e890e0417fc1c1~15Dgx_Lo30874908749euoutp02L; Thu, 7 Jun 2018 13:36:18 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 mailout2.w1.samsung.com 20180607133618euoutp023cd37ce28bf195c572e890e0417fc1c1~15Dgx_Lo30874908749euoutp02L DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=samsung.com; s=mail20170921; t=1528378578; bh=fn0oN1zZ3SC+4U1pNUTovIbZLWU4hY5GJkPozHAj0ao=; h=From:To:Cc:Subject:Date:In-reply-to:References:From; b=qs/OAh3HAPchbgmYqKEWVMkFPrpsAj9/zPoGLp9JZJwcoQqMlusZBtPVqCxU1R5S2 HKW9nd5cOXhLxKqdsV61iCTXeyx2YsRTjsRT1/KkUcOxxZ/wQn7KNEFMsJ16xRn+o2 gddZkCUdPRS0Q1a7P6rt91wqbR+UkpzNN/5+nv14= Received: from eusmges1new.samsung.com (unknown [203.254.199.242]) by eucas1p1.samsung.com (KnoxPortal) with ESMTP id 20180607133617eucas1p19038dd722441b9e59b19ebb35105aff7~15Df2OuqM2458624586eucas1p1R; Thu, 7 Jun 2018 13:36:17 +0000 (GMT) Received: from eucas1p2.samsung.com ( [182.198.249.207]) by eusmges1new.samsung.com (EUCPMTA) with SMTP id 42.4F.05700.0D4391B5; Thu, 7 Jun 2018 14:36:17 +0100 (BST) Received: from eusmgms1.samsung.com (unknown [182.198.249.179]) by eucas1p1.samsung.com (KnoxPortal) with ESMTP id 20180607133616eucas1p1be2dc272b369a40270d6bc991085e1cf~15DenEgdi2502125021eucas1p18; Thu, 7 Jun 2018 13:36:16 +0000 (GMT) X-AuditID: cbfec7f2-1c1ff70000011644-5a-5b1934d0dae8 Received: from eusync4.samsung.com ( [203.254.199.214]) by eusmgms1.samsung.com (EUCPMTA) with SMTP id 22.C2.04178.0D4391B5; Thu, 7 Jun 2018 14:36:16 +0100 (BST) Received: from AMDC2765.digital.local ([106.116.147.25]) by eusync4.samsung.com (Oracle Communications Messaging Server 7.0.5.31.0 64bit (built May 5 2014)) with ESMTPA id <0P9Y00B59GGBIO30@eusync4.samsung.com>; Thu, 07 Jun 2018 14:36:16 +0100 (BST) From: Marek Szyprowski To: dri-devel@lists.freedesktop.org, linux-samsung-soc@vger.kernel.org Cc: Marek Szyprowski , Inki Dae , Seung-Woo Kim , Andrzej Hajda , Bartlomiej Zolnierkiewicz , Krzysztof Kozlowski , Tobias Jakobi Subject: [PATCH 1/4] drm/exynos: g2d: Convert to driver component API Date: Thu, 07 Jun 2018 15:36:06 +0200 Message-id: <20180607133609.28397-2-m.szyprowski@samsung.com> X-Mailer: git-send-email 2.17.1 In-reply-to: <20180607133609.28397-1-m.szyprowski@samsung.com> X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFtrGIsWRmVeSWpSXmKPExsWy7djP87oXTSSjDRYtYrK4te4cq8XGGetZ La58fc9mMen+BBaL8+c3sFvMOL+PyWLtkbtA1uSXbBZtqz+wOnB6bFrVyeZxv/s4k8e/Y+we fVtWMXp83iQXwBrFZZOSmpNZllqkb5fAlbHhVS9zwZFHjBVvfpxlamC8u5uxi5GTQ0LARGLP o2csXYxcHEICKxgleg71MkI4nxkl+vY9g6uav2oTK0RiGaPE9YvfoaoamCT+v1jMBFLFJmAo 0fW2iw3EFhFwk2g6PBOsg1lgI5PE5kcTwYqEBVwlJt9dCNTNwcEioCqx7osESJhXwFbi0+K/ LBDb5CVWbzjADGJzCthJTH6/kxlkjoTAFDaJA39PQ53kInFp1zcoW1ji1fEt7BC2jERnx0Em iIZmRon2GbPYIZweRomtc3awQVRZSxw+fpEVxGYW4JOYtG06M8hFEgK8Eh1tQhAlHhK7puyB +nkio8SFD/tYJjBKLmBkWMUonlpanJueWmyYl1quV5yYW1yal66XnJ+7iREYm6f/Hf+0g/Hr paRDjAIcjEo8vDceikcLsSaWFVfmHmKU4GBWEuFNvCQWLcSbklhZlVqUH19UmpNafIhRmoNF SZw3TqMuSkggPbEkNTs1tSC1CCbLxMEp1cDIHRivr31h08P5MhE2UhPz6oMEO7NTtvIdf1fg y9QU9NN9879rK+UdwuqSxf7wsCtM8PzskHf/YM7BQ10/lpSWn7xWrzYxw01ctiNgcdjK1+vt tDjKHgm+PSJY1nj0tkXct8ZHj8NVV6tpBPwp/9N3kss/fINs3NIbTRt8nlb0LlssIO4XL63E UpyRaKjFXFScCACifsD8yQIAAA== X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFprELMWRmVeSWpSXmKPExsVy+t/xa7oXTCSjDbZO5bW4te4cq8XGGetZ La58fc9mMen+BBaL8+c3sFvMOL+PyWLtkbtA1uSXbBZtqz+wOnB6bFrVyeZxv/s4k8e/Y+we fVtWMXp83iQXwBrFZZOSmpNZllqkb5fAlbHhVS9zwZFHjBVvfpxlamC8u5uxi5GTQ0LARGL+ qk2sXYxcHEICSxgltvx7zwLhNDFJfOi4xAZSxSZgKNH1tgvMFhFwk2g6PBOsg1lgM5NEz/F+ sFHCAq4Sk+8uBLI5OFgEVCXWfZEACfMK2Ep8WvyXBWKbvMTqDQeYQWxOATuJye93gtlCQDXr 3ixmm8DIs4CRYRWjSGppcW56brGhXnFibnFpXrpecn7uJkZgSG079nPzDsZLG4MPMQpwMCrx 8DbcF48WYk0sK67MPcQowcGsJMKbeEksWog3JbGyKrUoP76oNCe1+BCjNAeLkjjveYPKKCGB 9MSS1OzU1ILUIpgsEwenVAOjQN6E+uNtD9z8F1VUpSyacHDjUpn71yamVmkK7Dm0pqh/9bNJ h41+fiq2bPRRfjHr9KEbTp3zZ7QcPpKZZxC38DHnuubrJxiSKi4wLT7hu7CYZzPb3vAeAb6i unkqakdihKN5OJUqn0rnvCnYdHQRu7nr8W3Tp5+7lPByp26ThO/q79v61/yTUWIpzkg01GIu Kk4EAH4QClElAgAA X-CMS-MailID: 20180607133616eucas1p1be2dc272b369a40270d6bc991085e1cf X-Msg-Generator: CA CMS-TYPE: 201P X-CMS-RootMailID: 20180607133616eucas1p1be2dc272b369a40270d6bc991085e1cf References: <20180607133609.28397-1-m.szyprowski@samsung.com> Sender: linux-samsung-soc-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-samsung-soc@vger.kernel.org Exynos G2D driver is the last client of the custom Exynos 'sub-driver' framework. In the current state it doesn't really resolve any of the issues it has been designed for, as Exynos DRM is already built only as a single kernel module. Remove the custom 'sub-driver' framework and simply use generic component framework also in G2D driver. Signed-off-by: Marek Szyprowski --- drivers/gpu/drm/exynos/Makefile | 2 +- drivers/gpu/drm/exynos/exynos_drm_core.c | 119 ----------- drivers/gpu/drm/exynos/exynos_drm_drv.c | 14 +- drivers/gpu/drm/exynos/exynos_drm_drv.h | 47 +---- drivers/gpu/drm/exynos/exynos_drm_g2d.c | 257 +++++++++-------------- drivers/gpu/drm/exynos/exynos_drm_g2d.h | 11 + 6 files changed, 115 insertions(+), 335 deletions(-) delete mode 100644 drivers/gpu/drm/exynos/exynos_drm_core.c -- 2.17.1 -- To unsubscribe from this list: send the line "unsubscribe linux-samsung-soc" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html diff --git a/drivers/gpu/drm/exynos/Makefile b/drivers/gpu/drm/exynos/Makefile index 3b323f1e0475..2ad146bbf4f5 100644 --- a/drivers/gpu/drm/exynos/Makefile +++ b/drivers/gpu/drm/exynos/Makefile @@ -4,7 +4,7 @@ # Direct Rendering Infrastructure (DRI) in XFree86 4.1.0 and higher. exynosdrm-y := exynos_drm_drv.o exynos_drm_crtc.o exynos_drm_fb.o \ - exynos_drm_gem.o exynos_drm_core.o exynos_drm_plane.o + exynos_drm_gem.o exynos_drm_plane.o exynosdrm-$(CONFIG_DRM_FBDEV_EMULATION) += exynos_drm_fbdev.o exynosdrm-$(CONFIG_DRM_EXYNOS_IOMMU) += exynos_drm_iommu.o diff --git a/drivers/gpu/drm/exynos/exynos_drm_core.c b/drivers/gpu/drm/exynos/exynos_drm_core.c deleted file mode 100644 index b0c0621fcdf7..000000000000 --- a/drivers/gpu/drm/exynos/exynos_drm_core.c +++ /dev/null @@ -1,119 +0,0 @@ -/* exynos_drm_core.c - * - * Copyright (c) 2011 Samsung Electronics Co., Ltd. - * Author: - * Inki Dae - * Joonyoung Shim - * Seung-Woo Kim - * - * This program is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License as published by the - * Free Software Foundation; either version 2 of the License, or (at your - * option) any later version. - */ - -#include - -#include "exynos_drm_drv.h" -#include "exynos_drm_crtc.h" - -static LIST_HEAD(exynos_drm_subdrv_list); - -int exynos_drm_subdrv_register(struct exynos_drm_subdrv *subdrv) -{ - if (!subdrv) - return -EINVAL; - - list_add_tail(&subdrv->list, &exynos_drm_subdrv_list); - - return 0; -} - -int exynos_drm_subdrv_unregister(struct exynos_drm_subdrv *subdrv) -{ - if (!subdrv) - return -EINVAL; - - list_del(&subdrv->list); - - return 0; -} - -int exynos_drm_device_subdrv_probe(struct drm_device *dev) -{ - struct exynos_drm_subdrv *subdrv, *n; - int err; - - if (!dev) - return -EINVAL; - - list_for_each_entry_safe(subdrv, n, &exynos_drm_subdrv_list, list) { - if (subdrv->probe) { - subdrv->drm_dev = dev; - - /* - * this probe callback would be called by sub driver - * after setting of all resources to this sub driver, - * such as clock, irq and register map are done. - */ - err = subdrv->probe(dev, subdrv->dev); - if (err) { - DRM_DEBUG("exynos drm subdrv probe failed.\n"); - list_del(&subdrv->list); - continue; - } - } - } - - return 0; -} - -int exynos_drm_device_subdrv_remove(struct drm_device *dev) -{ - struct exynos_drm_subdrv *subdrv; - - if (!dev) { - WARN(1, "Unexpected drm device unregister!\n"); - return -EINVAL; - } - - list_for_each_entry(subdrv, &exynos_drm_subdrv_list, list) { - if (subdrv->remove) - subdrv->remove(dev, subdrv->dev); - } - - return 0; -} - -int exynos_drm_subdrv_open(struct drm_device *dev, struct drm_file *file) -{ - struct exynos_drm_subdrv *subdrv; - int ret; - - list_for_each_entry(subdrv, &exynos_drm_subdrv_list, list) { - if (subdrv->open) { - ret = subdrv->open(dev, subdrv->dev, file); - if (ret) - goto err; - } - } - - return 0; - -err: - list_for_each_entry_continue_reverse(subdrv, &exynos_drm_subdrv_list, list) { - if (subdrv->close) - subdrv->close(dev, subdrv->dev, file); - } - return ret; -} - -void exynos_drm_subdrv_close(struct drm_device *dev, struct drm_file *file) -{ - struct exynos_drm_subdrv *subdrv; - - list_for_each_entry(subdrv, &exynos_drm_subdrv_list, list) { - if (subdrv->close) - subdrv->close(dev, subdrv->dev, file); - } -} diff --git a/drivers/gpu/drm/exynos/exynos_drm_drv.c b/drivers/gpu/drm/exynos/exynos_drm_drv.c index a81b4a5e24a7..80d9c10146c3 100644 --- a/drivers/gpu/drm/exynos/exynos_drm_drv.c +++ b/drivers/gpu/drm/exynos/exynos_drm_drv.c @@ -55,8 +55,7 @@ static int exynos_drm_open(struct drm_device *dev, struct drm_file *file) return -ENOMEM; file->driver_priv = file_priv; - - ret = exynos_drm_subdrv_open(dev, file); + ret = g2d_open(dev, file); if (ret) goto err_file_priv_free; @@ -70,7 +69,7 @@ static int exynos_drm_open(struct drm_device *dev, struct drm_file *file) static void exynos_drm_postclose(struct drm_device *dev, struct drm_file *file) { - exynos_drm_subdrv_close(dev, file); + g2d_close(dev, file); kfree(file->driver_priv); file->driver_priv = NULL; } @@ -240,6 +239,7 @@ static struct exynos_drm_driver_info exynos_drm_drivers[] = { DRM_COMPONENT_DRIVER | DRM_VIRTUAL_DEVICE }, { DRV_PTR(g2d_driver, CONFIG_DRM_EXYNOS_G2D), + DRM_COMPONENT_DRIVER }, { DRV_PTR(fimc_driver, CONFIG_DRM_EXYNOS_FIMC), DRM_COMPONENT_DRIVER | DRM_FIMC_DEVICE, @@ -376,11 +376,6 @@ static int exynos_drm_bind(struct device *dev) if (ret) goto err_unbind_all; - /* Probe non kms sub drivers and virtual display driver. */ - ret = exynos_drm_device_subdrv_probe(drm); - if (ret) - goto err_unbind_all; - drm_mode_config_reset(drm); /* @@ -411,7 +406,6 @@ static int exynos_drm_bind(struct device *dev) exynos_drm_fbdev_fini(drm); err_cleanup_poll: drm_kms_helper_poll_fini(drm); - exynos_drm_device_subdrv_remove(drm); err_unbind_all: component_unbind_all(drm->dev, drm); err_mode_config_cleanup: @@ -431,8 +425,6 @@ static void exynos_drm_unbind(struct device *dev) drm_dev_unregister(drm); - exynos_drm_device_subdrv_remove(drm); - exynos_drm_fbdev_fini(drm); drm_kms_helper_poll_fini(drm); diff --git a/drivers/gpu/drm/exynos/exynos_drm_drv.h b/drivers/gpu/drm/exynos/exynos_drm_drv.h index 0f6d079a55c9..c737c4bd2c19 100644 --- a/drivers/gpu/drm/exynos/exynos_drm_drv.h +++ b/drivers/gpu/drm/exynos/exynos_drm_drv.h @@ -179,17 +179,13 @@ static inline void exynos_drm_pipe_clk_enable(struct exynos_drm_crtc *crtc, crtc->pipe_clk->enable(crtc->pipe_clk, enable); } -struct exynos_drm_g2d_private { - struct device *dev; +struct drm_exynos_file_private { + /* for g2d api */ struct list_head inuse_cmdlist; struct list_head event_list; struct list_head userptr_list; }; -struct drm_exynos_file_private { - struct exynos_drm_g2d_private *g2d_priv; -}; - /* * Exynos drm private structure. * @@ -201,6 +197,7 @@ struct exynos_drm_private { struct drm_fb_helper *fb_helper; struct drm_atomic_state *suspend_state; + struct device *g2d_dev; struct device *dma_dev; void *mapping; @@ -217,44 +214,6 @@ static inline struct device *to_dma_dev(struct drm_device *dev) return priv->dma_dev; } -/* - * Exynos drm sub driver structure. - * - * @list: sub driver has its own list object to register to exynos drm driver. - * @dev: pointer to device object for subdrv device driver. - * @drm_dev: pointer to drm_device and this pointer would be set - * when sub driver calls exynos_drm_subdrv_register(). - * @probe: this callback would be called by exynos drm driver after - * subdrv is registered to it. - * @remove: this callback is used to release resources created - * by probe callback. - * @open: this would be called with drm device file open. - * @close: this would be called with drm device file close. - */ -struct exynos_drm_subdrv { - struct list_head list; - struct device *dev; - struct drm_device *drm_dev; - - int (*probe)(struct drm_device *drm_dev, struct device *dev); - void (*remove)(struct drm_device *drm_dev, struct device *dev); - int (*open)(struct drm_device *drm_dev, struct device *dev, - struct drm_file *file); - void (*close)(struct drm_device *drm_dev, struct device *dev, - struct drm_file *file); -}; - - /* This function would be called by non kms drivers such as g2d and ipp. */ -int exynos_drm_subdrv_register(struct exynos_drm_subdrv *drm_subdrv); - -/* this function removes subdrv list from exynos drm driver */ -int exynos_drm_subdrv_unregister(struct exynos_drm_subdrv *drm_subdrv); - -int exynos_drm_device_subdrv_probe(struct drm_device *dev); -int exynos_drm_device_subdrv_remove(struct drm_device *dev); -int exynos_drm_subdrv_open(struct drm_device *dev, struct drm_file *file); -void exynos_drm_subdrv_close(struct drm_device *dev, struct drm_file *file); - #ifdef CONFIG_DRM_EXYNOS_DPI struct drm_encoder *exynos_dpi_probe(struct device *dev); int exynos_dpi_remove(struct drm_encoder *encoder); diff --git a/drivers/gpu/drm/exynos/exynos_drm_g2d.c b/drivers/gpu/drm/exynos/exynos_drm_g2d.c index f68ef1b3a28c..27b929757b43 100644 --- a/drivers/gpu/drm/exynos/exynos_drm_g2d.c +++ b/drivers/gpu/drm/exynos/exynos_drm_g2d.c @@ -9,6 +9,7 @@ #include #include +#include #include #include #include @@ -237,7 +238,7 @@ struct g2d_data { int irq; struct workqueue_struct *g2d_workq; struct work_struct runqueue_work; - struct exynos_drm_subdrv subdrv; + struct drm_device *drm_dev; unsigned long flags; /* cmdlist */ @@ -268,14 +269,13 @@ static int g2d_init_cmdlist(struct g2d_data *g2d) { struct device *dev = g2d->dev; struct g2d_cmdlist_node *node = g2d->cmdlist_node; - struct exynos_drm_subdrv *subdrv = &g2d->subdrv; int nr; int ret; struct g2d_buf_info *buf_info; g2d->cmdlist_dma_attrs = DMA_ATTR_WRITE_COMBINE; - g2d->cmdlist_pool_virt = dma_alloc_attrs(to_dma_dev(subdrv->drm_dev), + g2d->cmdlist_pool_virt = dma_alloc_attrs(to_dma_dev(g2d->drm_dev), G2D_CMDLIST_POOL_SIZE, &g2d->cmdlist_pool, GFP_KERNEL, g2d->cmdlist_dma_attrs); @@ -308,7 +308,7 @@ static int g2d_init_cmdlist(struct g2d_data *g2d) return 0; err: - dma_free_attrs(to_dma_dev(subdrv->drm_dev), G2D_CMDLIST_POOL_SIZE, + dma_free_attrs(to_dma_dev(g2d->drm_dev), G2D_CMDLIST_POOL_SIZE, g2d->cmdlist_pool_virt, g2d->cmdlist_pool, g2d->cmdlist_dma_attrs); return ret; @@ -316,12 +316,10 @@ static int g2d_init_cmdlist(struct g2d_data *g2d) static void g2d_fini_cmdlist(struct g2d_data *g2d) { - struct exynos_drm_subdrv *subdrv = &g2d->subdrv; - kfree(g2d->cmdlist_node); if (g2d->cmdlist_pool_virt && g2d->cmdlist_pool) { - dma_free_attrs(to_dma_dev(subdrv->drm_dev), + dma_free_attrs(to_dma_dev(g2d->drm_dev), G2D_CMDLIST_POOL_SIZE, g2d->cmdlist_pool_virt, g2d->cmdlist_pool, g2d->cmdlist_dma_attrs); @@ -355,27 +353,27 @@ static void g2d_put_cmdlist(struct g2d_data *g2d, struct g2d_cmdlist_node *node) mutex_unlock(&g2d->cmdlist_mutex); } -static void g2d_add_cmdlist_to_inuse(struct exynos_drm_g2d_private *g2d_priv, +static void g2d_add_cmdlist_to_inuse(struct drm_exynos_file_private *file_priv, struct g2d_cmdlist_node *node) { struct g2d_cmdlist_node *lnode; - if (list_empty(&g2d_priv->inuse_cmdlist)) + if (list_empty(&file_priv->inuse_cmdlist)) goto add_to_list; /* this links to base address of new cmdlist */ - lnode = list_entry(g2d_priv->inuse_cmdlist.prev, + lnode = list_entry(file_priv->inuse_cmdlist.prev, struct g2d_cmdlist_node, list); lnode->cmdlist->data[lnode->cmdlist->last] = node->dma_addr; add_to_list: - list_add_tail(&node->list, &g2d_priv->inuse_cmdlist); + list_add_tail(&node->list, &file_priv->inuse_cmdlist); if (node->event) - list_add_tail(&node->event->base.link, &g2d_priv->event_list); + list_add_tail(&node->event->base.link, &file_priv->event_list); } -static void g2d_userptr_put_dma_addr(struct drm_device *drm_dev, +static void g2d_userptr_put_dma_addr(struct g2d_data *g2d, unsigned long obj, bool force) { @@ -398,7 +396,7 @@ static void g2d_userptr_put_dma_addr(struct drm_device *drm_dev, return; out: - dma_unmap_sg(to_dma_dev(drm_dev), g2d_userptr->sgt->sgl, + dma_unmap_sg(to_dma_dev(g2d->drm_dev), g2d_userptr->sgt->sgl, g2d_userptr->sgt->nents, DMA_BIDIRECTIONAL); pages = frame_vector_pages(g2d_userptr->vec); @@ -419,16 +417,14 @@ static void g2d_userptr_put_dma_addr(struct drm_device *drm_dev, kfree(g2d_userptr); } -static dma_addr_t *g2d_userptr_get_dma_addr(struct drm_device *drm_dev, +static dma_addr_t *g2d_userptr_get_dma_addr(struct g2d_data *g2d, unsigned long userptr, unsigned long size, struct drm_file *filp, unsigned long *obj) { struct drm_exynos_file_private *file_priv = filp->driver_priv; - struct exynos_drm_g2d_private *g2d_priv = file_priv->g2d_priv; struct g2d_cmdlist_userptr *g2d_userptr; - struct g2d_data *g2d; struct sg_table *sgt; unsigned long start, end; unsigned int npages, offset; @@ -439,10 +435,8 @@ static dma_addr_t *g2d_userptr_get_dma_addr(struct drm_device *drm_dev, return ERR_PTR(-EINVAL); } - g2d = dev_get_drvdata(g2d_priv->dev); - /* check if userptr already exists in userptr_list. */ - list_for_each_entry(g2d_userptr, &g2d_priv->userptr_list, list) { + list_for_each_entry(g2d_userptr, &file_priv->userptr_list, list) { if (g2d_userptr->userptr == userptr) { /* * also check size because there could be same address @@ -517,7 +511,7 @@ static dma_addr_t *g2d_userptr_get_dma_addr(struct drm_device *drm_dev, g2d_userptr->sgt = sgt; - if (!dma_map_sg(to_dma_dev(drm_dev), sgt->sgl, sgt->nents, + if (!dma_map_sg(to_dma_dev(g2d->drm_dev), sgt->sgl, sgt->nents, DMA_BIDIRECTIONAL)) { DRM_ERROR("failed to map sgt with dma region.\n"); ret = -ENOMEM; @@ -527,7 +521,7 @@ static dma_addr_t *g2d_userptr_get_dma_addr(struct drm_device *drm_dev, g2d_userptr->dma_addr = sgt->sgl[0].dma_address; g2d_userptr->userptr = userptr; - list_add_tail(&g2d_userptr->list, &g2d_priv->userptr_list); + list_add_tail(&g2d_userptr->list, &file_priv->userptr_list); if (g2d->current_pool + (npages << PAGE_SHIFT) < g2d->max_pool) { g2d->current_pool += npages << PAGE_SHIFT; @@ -556,17 +550,14 @@ static dma_addr_t *g2d_userptr_get_dma_addr(struct drm_device *drm_dev, return ERR_PTR(ret); } -static void g2d_userptr_free_all(struct drm_device *drm_dev, - struct g2d_data *g2d, - struct drm_file *filp) +static void g2d_userptr_free_all(struct g2d_data *g2d, struct drm_file *filp) { struct drm_exynos_file_private *file_priv = filp->driver_priv; - struct exynos_drm_g2d_private *g2d_priv = file_priv->g2d_priv; struct g2d_cmdlist_userptr *g2d_userptr, *n; - list_for_each_entry_safe(g2d_userptr, n, &g2d_priv->userptr_list, list) + list_for_each_entry_safe(g2d_userptr, n, &file_priv->userptr_list, list) if (g2d_userptr->in_pool) - g2d_userptr_put_dma_addr(drm_dev, + g2d_userptr_put_dma_addr(g2d, (unsigned long)g2d_userptr, true); @@ -758,7 +749,7 @@ static int g2d_map_cmdlist_gem(struct g2d_data *g2d, goto err; } - addr = g2d_userptr_get_dma_addr(drm_dev, + addr = g2d_userptr_get_dma_addr(g2d, g2d_userptr.userptr, g2d_userptr.size, file, @@ -785,7 +776,6 @@ static void g2d_unmap_cmdlist_gem(struct g2d_data *g2d, struct g2d_cmdlist_node *node, struct drm_file *filp) { - struct exynos_drm_subdrv *subdrv = &g2d->subdrv; struct g2d_buf_info *buf_info = &node->buf_info; int i; @@ -800,11 +790,9 @@ static void g2d_unmap_cmdlist_gem(struct g2d_data *g2d, handle = buf_info->handles[reg_type]; if (buf_info->types[reg_type] == BUF_TYPE_GEM) - exynos_drm_gem_put_dma_addr(subdrv->drm_dev, handle, - filp); + exynos_drm_gem_put_dma_addr(g2d->drm_dev, handle, filp); else - g2d_userptr_put_dma_addr(subdrv->drm_dev, handle, - false); + g2d_userptr_put_dma_addr(g2d, handle, false); buf_info->reg_types[i] = REG_TYPE_NONE; buf_info->handles[reg_type] = 0; @@ -922,7 +910,7 @@ static void g2d_runqueue_worker(struct work_struct *work) static void g2d_finish_event(struct g2d_data *g2d, u32 cmdlist_no) { - struct drm_device *drm_dev = g2d->subdrv.drm_dev; + struct drm_device *drm_dev = g2d->drm_dev; struct g2d_runqueue_node *runqueue_node = g2d->runqueue_node; struct drm_exynos_pending_g2d_event *e; struct timespec64 now; @@ -1031,7 +1019,7 @@ static void g2d_wait_finish(struct g2d_data *g2d, struct drm_file *file) mutex_unlock(&g2d->runqueue_mutex); } -static int g2d_check_reg_offset(struct device *dev, +static int g2d_check_reg_offset(struct g2d_data *g2d, struct g2d_cmdlist_node *node, int nr, bool for_addr) { @@ -1131,7 +1119,7 @@ static int g2d_check_reg_offset(struct device *dev, return 0; err: - dev_err(dev, "Bad register offset: 0x%lx\n", cmdlist->data[index]); + dev_err(g2d->dev, "Bad register offset: 0x%lx\n", cmdlist->data[index]); return -EINVAL; } @@ -1139,23 +1127,8 @@ static int g2d_check_reg_offset(struct device *dev, int exynos_g2d_get_ver_ioctl(struct drm_device *drm_dev, void *data, struct drm_file *file) { - struct drm_exynos_file_private *file_priv = file->driver_priv; - struct exynos_drm_g2d_private *g2d_priv = file_priv->g2d_priv; - struct device *dev; - struct g2d_data *g2d; struct drm_exynos_g2d_get_ver *ver = data; - if (!g2d_priv) - return -ENODEV; - - dev = g2d_priv->dev; - if (!dev) - return -ENODEV; - - g2d = dev_get_drvdata(dev); - if (!g2d) - return -EFAULT; - ver->major = G2D_HW_MAJOR_VER; ver->minor = G2D_HW_MINOR_VER; @@ -1166,9 +1139,8 @@ int exynos_g2d_set_cmdlist_ioctl(struct drm_device *drm_dev, void *data, struct drm_file *file) { struct drm_exynos_file_private *file_priv = file->driver_priv; - struct exynos_drm_g2d_private *g2d_priv = file_priv->g2d_priv; - struct device *dev; - struct g2d_data *g2d; + struct exynos_drm_private *priv = drm_dev->dev_private; + struct g2d_data *g2d = dev_get_drvdata(priv->g2d_dev); struct drm_exynos_g2d_set_cmdlist *req = data; struct drm_exynos_g2d_cmd *cmd; struct drm_exynos_pending_g2d_event *e; @@ -1177,17 +1149,6 @@ int exynos_g2d_set_cmdlist_ioctl(struct drm_device *drm_dev, void *data, int size; int ret; - if (!g2d_priv) - return -ENODEV; - - dev = g2d_priv->dev; - if (!dev) - return -ENODEV; - - g2d = dev_get_drvdata(dev); - if (!g2d) - return -EFAULT; - node = g2d_get_cmdlist(g2d); if (!node) return -ENOMEM; @@ -1199,7 +1160,7 @@ int exynos_g2d_set_cmdlist_ioctl(struct drm_device *drm_dev, void *data, */ if (req->cmd_nr > G2D_CMDLIST_DATA_NUM || req->cmd_buf_nr > G2D_CMDLIST_DATA_NUM) { - dev_err(dev, "number of submitted G2D commands exceeds limit\n"); + dev_err(g2d->dev, "number of submitted G2D commands exceeds limit\n"); return -EINVAL; } @@ -1267,7 +1228,7 @@ int exynos_g2d_set_cmdlist_ioctl(struct drm_device *drm_dev, void *data, */ size = cmdlist->last + req->cmd_nr * 2 + req->cmd_buf_nr * 2 + 2; if (size > G2D_CMDLIST_DATA_NUM) { - dev_err(dev, "cmdlist size is too big\n"); + dev_err(g2d->dev, "cmdlist size is too big\n"); ret = -EINVAL; goto err_free_event; } @@ -1282,7 +1243,7 @@ int exynos_g2d_set_cmdlist_ioctl(struct drm_device *drm_dev, void *data, } cmdlist->last += req->cmd_nr * 2; - ret = g2d_check_reg_offset(dev, node, req->cmd_nr, false); + ret = g2d_check_reg_offset(g2d, node, req->cmd_nr, false); if (ret < 0) goto err_free_event; @@ -1301,7 +1262,7 @@ int exynos_g2d_set_cmdlist_ioctl(struct drm_device *drm_dev, void *data, } cmdlist->last += req->cmd_buf_nr * 2; - ret = g2d_check_reg_offset(dev, node, req->cmd_buf_nr, true); + ret = g2d_check_reg_offset(g2d, node, req->cmd_buf_nr, true); if (ret < 0) goto err_free_event; @@ -1319,7 +1280,7 @@ int exynos_g2d_set_cmdlist_ioctl(struct drm_device *drm_dev, void *data, /* tail */ cmdlist->data[cmdlist->last] = 0; - g2d_add_cmdlist_to_inuse(g2d_priv, node); + g2d_add_cmdlist_to_inuse(file_priv, node); return 0; @@ -1337,25 +1298,13 @@ int exynos_g2d_exec_ioctl(struct drm_device *drm_dev, void *data, struct drm_file *file) { struct drm_exynos_file_private *file_priv = file->driver_priv; - struct exynos_drm_g2d_private *g2d_priv = file_priv->g2d_priv; - struct device *dev; - struct g2d_data *g2d; + struct exynos_drm_private *priv = drm_dev->dev_private; + struct g2d_data *g2d = dev_get_drvdata(priv->g2d_dev); struct drm_exynos_g2d_exec *req = data; struct g2d_runqueue_node *runqueue_node; struct list_head *run_cmdlist; struct list_head *event_list; - if (!g2d_priv) - return -ENODEV; - - dev = g2d_priv->dev; - if (!dev) - return -ENODEV; - - g2d = dev_get_drvdata(dev); - if (!g2d) - return -EFAULT; - runqueue_node = kmem_cache_alloc(g2d->runqueue_slab, GFP_KERNEL); if (!runqueue_node) return -ENOMEM; @@ -1367,11 +1316,11 @@ int exynos_g2d_exec_ioctl(struct drm_device *drm_dev, void *data, init_completion(&runqueue_node->complete); runqueue_node->async = req->async; - list_splice_init(&g2d_priv->inuse_cmdlist, run_cmdlist); - list_splice_init(&g2d_priv->event_list, event_list); + list_splice_init(&file_priv->inuse_cmdlist, run_cmdlist); + list_splice_init(&file_priv->event_list, event_list); if (list_empty(run_cmdlist)) { - dev_err(dev, "there is no inuse cmdlist\n"); + dev_err(g2d->dev, "there is no inuse cmdlist\n"); kmem_cache_free(g2d->runqueue_slab, runqueue_node); return -EPERM; } @@ -1395,71 +1344,28 @@ int exynos_g2d_exec_ioctl(struct drm_device *drm_dev, void *data, return 0; } -static int g2d_subdrv_probe(struct drm_device *drm_dev, struct device *dev) -{ - struct g2d_data *g2d; - int ret; - - g2d = dev_get_drvdata(dev); - if (!g2d) - return -EFAULT; - - /* allocate dma-aware cmdlist buffer. */ - ret = g2d_init_cmdlist(g2d); - if (ret < 0) { - dev_err(dev, "cmdlist init failed\n"); - return ret; - } - - ret = drm_iommu_attach_device(drm_dev, dev); - if (ret < 0) { - dev_err(dev, "failed to enable iommu.\n"); - g2d_fini_cmdlist(g2d); - } - - return ret; - -} - -static void g2d_subdrv_remove(struct drm_device *drm_dev, struct device *dev) -{ - drm_iommu_detach_device(drm_dev, dev); -} - -static int g2d_open(struct drm_device *drm_dev, struct device *dev, - struct drm_file *file) +int g2d_open(struct drm_device *drm_dev, struct drm_file *file) { struct drm_exynos_file_private *file_priv = file->driver_priv; - struct exynos_drm_g2d_private *g2d_priv; - - g2d_priv = kzalloc(sizeof(*g2d_priv), GFP_KERNEL); - if (!g2d_priv) - return -ENOMEM; - - g2d_priv->dev = dev; - file_priv->g2d_priv = g2d_priv; - INIT_LIST_HEAD(&g2d_priv->inuse_cmdlist); - INIT_LIST_HEAD(&g2d_priv->event_list); - INIT_LIST_HEAD(&g2d_priv->userptr_list); + INIT_LIST_HEAD(&file_priv->inuse_cmdlist); + INIT_LIST_HEAD(&file_priv->event_list); + INIT_LIST_HEAD(&file_priv->userptr_list); return 0; } -static void g2d_close(struct drm_device *drm_dev, struct device *dev, - struct drm_file *file) +void g2d_close(struct drm_device *drm_dev, struct drm_file *file) { struct drm_exynos_file_private *file_priv = file->driver_priv; - struct exynos_drm_g2d_private *g2d_priv = file_priv->g2d_priv; + struct exynos_drm_private *priv = drm_dev->dev_private; struct g2d_data *g2d; struct g2d_cmdlist_node *node, *n; - if (!dev) + if (!priv->g2d_dev) return; - g2d = dev_get_drvdata(dev); - if (!g2d) - return; + g2d = dev_get_drvdata(priv->g2d_dev); /* Remove the runqueue nodes that belong to us. */ mutex_lock(&g2d->runqueue_mutex); @@ -1480,24 +1386,70 @@ static void g2d_close(struct drm_device *drm_dev, struct device *dev, * Properly unmap these buffers here. */ mutex_lock(&g2d->cmdlist_mutex); - list_for_each_entry_safe(node, n, &g2d_priv->inuse_cmdlist, list) { + list_for_each_entry_safe(node, n, &file_priv->inuse_cmdlist, list) { g2d_unmap_cmdlist_gem(g2d, node, file); list_move_tail(&node->list, &g2d->free_cmdlist); } mutex_unlock(&g2d->cmdlist_mutex); /* release all g2d_userptr in pool. */ - g2d_userptr_free_all(drm_dev, g2d, file); + g2d_userptr_free_all(g2d, file); +} + +static int g2d_bind(struct device *dev, struct device *master, void *data) +{ + struct g2d_data *g2d = dev_get_drvdata(dev); + struct drm_device *drm_dev = data; + struct exynos_drm_private *priv = drm_dev->dev_private; + int ret; + + g2d->drm_dev = drm_dev; + + /* allocate dma-aware cmdlist buffer. */ + ret = g2d_init_cmdlist(g2d); + if (ret < 0) { + dev_err(dev, "cmdlist init failed\n"); + return ret; + } + + ret = drm_iommu_attach_device(drm_dev, dev); + if (ret < 0) { + dev_err(dev, "failed to enable iommu.\n"); + g2d_fini_cmdlist(g2d); + return ret; + } + priv->g2d_dev = dev; - kfree(file_priv->g2d_priv); + dev_info(dev, "The Exynos G2D (ver %d.%d) successfully registered.\n", + G2D_HW_MAJOR_VER, G2D_HW_MINOR_VER); + return 0; } +static void g2d_unbind(struct device *dev, struct device *master, void *data) +{ + struct g2d_data *g2d = dev_get_drvdata(dev); + struct drm_device *drm_dev = data; + struct exynos_drm_private *priv = drm_dev->dev_private; + + /* Suspend operation and wait for engine idle. */ + set_bit(G2D_BIT_SUSPEND_RUNQUEUE, &g2d->flags); + g2d_wait_finish(g2d, NULL); + priv->g2d_dev = NULL; + + cancel_work_sync(&g2d->runqueue_work); + drm_iommu_detach_device(g2d->drm_dev, dev); +} + +static const struct component_ops g2d_component_ops = { + .bind = g2d_bind, + .unbind = g2d_unbind, +}; + static int g2d_probe(struct platform_device *pdev) { struct device *dev = &pdev->dev; struct resource *res; struct g2d_data *g2d; - struct exynos_drm_subdrv *subdrv; int ret; g2d = devm_kzalloc(dev, sizeof(*g2d), GFP_KERNEL); @@ -1564,22 +1516,12 @@ static int g2d_probe(struct platform_device *pdev) platform_set_drvdata(pdev, g2d); - subdrv = &g2d->subdrv; - subdrv->dev = dev; - subdrv->probe = g2d_subdrv_probe; - subdrv->remove = g2d_subdrv_remove; - subdrv->open = g2d_open; - subdrv->close = g2d_close; - - ret = exynos_drm_subdrv_register(subdrv); + ret = component_add(dev, &g2d_component_ops); if (ret < 0) { dev_err(dev, "failed to register drm g2d device\n"); goto err_put_clk; } - dev_info(dev, "The Exynos G2D (ver %d.%d) successfully probed.\n", - G2D_HW_MAJOR_VER, G2D_HW_MINOR_VER); - return 0; err_put_clk: @@ -1595,12 +1537,7 @@ static int g2d_remove(struct platform_device *pdev) { struct g2d_data *g2d = platform_get_drvdata(pdev); - /* Suspend operation and wait for engine idle. */ - set_bit(G2D_BIT_SUSPEND_RUNQUEUE, &g2d->flags); - g2d_wait_finish(g2d, NULL); - - cancel_work_sync(&g2d->runqueue_work); - exynos_drm_subdrv_unregister(&g2d->subdrv); + component_del(&pdev->dev, &g2d_component_ops); /* There should be no locking needed here. */ g2d_remove_runqueue_nodes(g2d, NULL); diff --git a/drivers/gpu/drm/exynos/exynos_drm_g2d.h b/drivers/gpu/drm/exynos/exynos_drm_g2d.h index 1a9c7ca8c15b..287b2ed8f178 100644 --- a/drivers/gpu/drm/exynos/exynos_drm_g2d.h +++ b/drivers/gpu/drm/exynos/exynos_drm_g2d.h @@ -14,6 +14,9 @@ extern int exynos_g2d_set_cmdlist_ioctl(struct drm_device *dev, void *data, struct drm_file *file_priv); extern int exynos_g2d_exec_ioctl(struct drm_device *dev, void *data, struct drm_file *file_priv); + +extern int g2d_open(struct drm_device *drm_dev, struct drm_file *file); +extern void g2d_close(struct drm_device *drm_dev, struct drm_file *file); #else static inline int exynos_g2d_get_ver_ioctl(struct drm_device *dev, void *data, struct drm_file *file_priv) @@ -33,4 +36,12 @@ static inline int exynos_g2d_exec_ioctl(struct drm_device *dev, void *data, { return -ENODEV; } + +int g2d_open(struct drm_device *drm_dev, struct drm_file *file) +{ + return 0; +} + +void g2d_close(struct drm_device *drm_dev, struct drm_file *file) +{ } #endif From patchwork Thu Jun 7 13:36:07 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Marek Szyprowski X-Patchwork-Id: 137890 Delivered-To: patch@linaro.org Received: by 2002:a2e:970d:0:0:0:0:0 with SMTP id r13-v6csp2108570lji; Thu, 7 Jun 2018 06:36:24 -0700 (PDT) X-Google-Smtp-Source: ADUXVKIrB2NRtTpp3DO6y9aGStFVYLeQNkJe8XyrDBD1+kFNiBeppawbAdio8vaFnNzdasYFTF+J X-Received: by 2002:a63:b215:: with SMTP id x21-v6mr1604945pge.393.1528378583989; Thu, 07 Jun 2018 06:36:23 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1528378583; cv=none; d=google.com; s=arc-20160816; b=RFFnlfb5J6vP0EZThQ8mD/Q7xHSLUhxmQJkr9xoNtLFXFtNDvqufp7cfzI7QrkOYlP IXeo+ZN9D5Sr71iDT15cxhfzrs9yh3SvHJCzwGKJEV1sZ1wpRgbYpPlDIZayNsRbYLlo uSdxvuw8aN9C0uAiNzNgH93Kyyq+d78hT0raIpk3aOi2qGu+icy2BoerV2wfIGFsmCJf 0SSiVeiogE9nzA7RwDNaVOaEVt+pjbQ+aokyuV20NoRmyvO5Zv6XyROjLvIJfStzQaSA 58sK0rYxQW7iB7oMh67Pt1FTUNbl88QRIWfxz9svcsGpbq5xh5mBvYPEEpbyGxJcl1/3 YnUg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:cms-type:in-reply-to :message-id:date:subject:cc:to:from:dkim-signature:dkim-filter :arc-authentication-results; bh=4imUc5emHNaGH5jdfJp5imOj8uXHibyF7wAIqAWHOTM=; b=cN/HoswFaru1qABCi0WtyofV1p/ovaNhHuC/AP/YIpujnaBdBlzGcVXLAPaGUAu5iZ YOwl3Xmgzi1mC0LdA3yrinM5Ow7Zg/lL30OduVJtL4I/2pk6mBwb3CoCxvAHMl3RfcKW tGByXfuPXe4eblsKRoFv3eCghrawkw93Ge15m9uDdQAk3dSZBijUEBs+Dj9Yl5XiBqG3 0Xt2rBR1AK2P5nAqZnHUd9iASVTJffMmvCe3qND1vieRV4vOk3htXIPfhLtZKa6KOB6y BScLtYkYxfzSvmrLLhK3O1/G3W/YxK6xNHpku1uyQAXUUrckDPnFE347oMkIZzVSK2SP b9EA== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@samsung.com header.s=mail20170921 header.b=nY8TJzue; spf=pass (google.com: best guess record for domain of linux-samsung-soc-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-samsung-soc-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=samsung.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id h127-v6si57919045pfb.111.2018.06.07.06.36.23; Thu, 07 Jun 2018 06:36:23 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-samsung-soc-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=neutral (body hash did not verify) header.i=@samsung.com header.s=mail20170921 header.b=nY8TJzue; spf=pass (google.com: best guess record for domain of linux-samsung-soc-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-samsung-soc-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=samsung.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932389AbeFGNgX (ORCPT + 3 others); Thu, 7 Jun 2018 09:36:23 -0400 Received: from mailout1.w1.samsung.com ([210.118.77.11]:36645 "EHLO mailout1.w1.samsung.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932489AbeFGNgV (ORCPT ); Thu, 7 Jun 2018 09:36:21 -0400 Received: from eucas1p2.samsung.com (unknown [182.198.249.207]) by mailout1.w1.samsung.com (KnoxPortal) with ESMTP id 20180607133619euoutp01c3c464c1ae53970043aa52646dcc1344~15DhtaMdY3031930319euoutp01o; Thu, 7 Jun 2018 13:36:19 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 mailout1.w1.samsung.com 20180607133619euoutp01c3c464c1ae53970043aa52646dcc1344~15DhtaMdY3031930319euoutp01o DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=samsung.com; s=mail20170921; t=1528378579; bh=TJjCHsvf0R1EIYI/kyRqEiJgk6QIS1ZoFAYSU/DToH0=; h=From:To:Cc:Subject:Date:In-reply-to:References:From; b=nY8TJzue8O7ZytBRBduzzrQ+FHv0hMb4rkBrxVwvRcTnStqbbpo3JbjBftJWhUe/V G86rCZBHNd1AHAedqQ8eXxqvURBTnrqzPQfRbvNp6cyvUMS1gTtN631RKkOecMaWIx fXQrdCjFbyKMj/+kfFJivzAHM1OwrG2/8SOUaIJQ= Received: from eusmges3new.samsung.com (unknown [203.254.199.245]) by eucas1p1.samsung.com (KnoxPortal) with ESMTP id 20180607133618eucas1p1b25f56e906d32b8b2d90e4cb5dc3699b~15DgxGryV2458624586eucas1p1T; Thu, 7 Jun 2018 13:36:18 +0000 (GMT) Received: from eucas1p2.samsung.com ( [182.198.249.207]) by eusmges3new.samsung.com (EUCPMTA) with SMTP id 86.A9.10409.1D4391B5; Thu, 7 Jun 2018 14:36:18 +0100 (BST) Received: from eusmgms2.samsung.com (unknown [182.198.249.180]) by eucas1p1.samsung.com (KnoxPortal) with ESMTP id 20180607133617eucas1p153c3d48a5d00785066c7fa6ff4cbe875~15DfePAmQ2501625016eucas1p1m; Thu, 7 Jun 2018 13:36:17 +0000 (GMT) X-AuditID: cbfec7f5-f95739c0000028a9-70-5b1934d1fda2 Received: from eusync4.samsung.com ( [203.254.199.214]) by eusmgms2.samsung.com (EUCPMTA) with SMTP id EA.A0.04183.0D4391B5; Thu, 7 Jun 2018 14:36:16 +0100 (BST) Received: from AMDC2765.digital.local ([106.116.147.25]) by eusync4.samsung.com (Oracle Communications Messaging Server 7.0.5.31.0 64bit (built May 5 2014)) with ESMTPA id <0P9Y00B59GGBIO30@eusync4.samsung.com>; Thu, 07 Jun 2018 14:36:16 +0100 (BST) From: Marek Szyprowski To: dri-devel@lists.freedesktop.org, linux-samsung-soc@vger.kernel.org Cc: Marek Szyprowski , Inki Dae , Seung-Woo Kim , Andrzej Hajda , Bartlomiej Zolnierkiewicz , Krzysztof Kozlowski , Tobias Jakobi Subject: [PATCH 2/4] drm/exynos: gem: Simplify access to exynos GEM objects Date: Thu, 07 Jun 2018 15:36:07 +0200 Message-id: <20180607133609.28397-3-m.szyprowski@samsung.com> X-Mailer: git-send-email 2.17.1 In-reply-to: <20180607133609.28397-1-m.szyprowski@samsung.com> X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFtrIIsWRmVeSWpSXmKPExsWy7djP87qXTCSjDZ5cY7S4te4cq8XGGetZ La58fc9mMen+BBaL8+c3sFvMOL+PyWLtkbtA1uSXbBZtqz+wOnB6bFrVyeZxv/s4k8e/Y+we fVtWMXp83iQXwBrFZZOSmpNZllqkb5fAlTF1xRqWgkMeFa0HlzE1MB6x6mLk4JAQMJHYMbmi i5GLQ0hgBaPEtIOLWSGcz4wSJ7Z/Zupi5AQralw0mx0isYxR4s3tucwQTgOTxP8Xi8Gq2AQM JbredrGB2CICbhJNh2eCjWIW2MgksfnRRLAiYQFviY5T64GK2DlYBFQlbriARHkFbCVa2pcw QiyTl1i94QAziM0pYCcx+f1OZoh4D5vEkWYeCNtF4umyOVD1whKvjm9hh7BlJC5P7mYBWSsh 0Mwo0T5jFjuE08MosXXODjaIKmuJw8cvsoLYzAJ8EpO2TWeGhAWvREebEESJh8Sj3c9ZIJ6c yCgxc+IJlgmMkgsYGVYxiqeWFuempxYb56WW6xUn5haX5qXrJefnbmIERuTpf8e/7mDc9yfp EKMAB6MSD2/DffFoIdbEsuLK3EOMEhzMSiK8iZfEooV4UxIrq1KL8uOLSnNSiw8xSnOwKInz xmnURQkJpCeWpGanphakFsFkmTg4pRoYpRuELZgm5oe9nf9u9r/kmTV/+h7wl0cKMdfMmLdm Ld+HZ++7mXu1y7jmphof62lMCkjM1d/+8FaSZLn7FdbbvwWzH28xOfuJP3zyu+jtb25LXXL9 sveA+w4uUceb23sjM2S0GnyKdLwfKO3dXaeVz6SiF1a8/N4sxpvrepj9ttx7/Z9D5flJJZbi jERDLeai4kQAwAvhVsQCAAA= X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFupnluLIzCtJLcpLzFFi42I5/e/4Nd0LJpLRBvunqFncWneO1WLjjPWs Fle+vmezmHR/AovF+fMb2C1mnN/HZLH2yF0ga/JLNou21R9YHTg9Nq3qZPO4332cyePfMXaP vi2rGD0+b5ILYI3isklJzcksSy3St0vgypi6Yg1LwSGPitaDy5gaGI9YdTFyckgImEg0LprN 3sXIxSEksIRR4sHFa1BOE5PEh45LbCBVbAKGEl1vu8BsEQE3iabDM1lBipgFNjNJ9BzvZwRJ CAt4S3ScWg9UxM7BIqAqccMFJMorYCvR0r6EEWKZvMTqDQeYQWxOATuJye93gtlCQDXr3ixm m8DIs4CRYRWjSGppcW56brGRXnFibnFpXrpecn7uJkZgMG079nPLDsaud8GHGAU4GJV4eG88 FI8WYk0sK67MPcQowcGsJMKbeEksWog3JbGyKrUoP76oNCe1+BCjNAeLkjjveYPKKCGB9MSS 1OzU1ILUIpgsEwenVAPjXu0v/e2uFWF3G26anouI0XWP6ppjq98aUDqd371cvCI657G00gkZ qxWJDddF3d4EGe018Dnx4dL3rEImhX9ZrYnth4wzJ/KKH7dnPzDfO+SHHoP6AfXMJssl25uX 2jJHlPazXM0sMcvX2fRQ1+lrz+QUZhbvjyutZsiu/jnz6Kp8Jv2tzEosxRmJhlrMRcWJACNG AoMiAgAA X-CMS-MailID: 20180607133617eucas1p153c3d48a5d00785066c7fa6ff4cbe875 X-Msg-Generator: CA CMS-TYPE: 201P X-CMS-RootMailID: 20180607133617eucas1p153c3d48a5d00785066c7fa6ff4cbe875 References: <20180607133609.28397-1-m.szyprowski@samsung.com> Sender: linux-samsung-soc-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-samsung-soc@vger.kernel.org Replace all calls to exynos_drm_gem_get_{dma_addr,size}, by a simpler function exynos_drm_gem_get(). This lets the caller to get access to exynos_drm_gem object and extract any information about GEM object without searching object tree for getting each parameter. Signed-off-by: Marek Szyprowski --- drivers/gpu/drm/exynos/exynos_drm_g2d.c | 49 +++++++++------------ drivers/gpu/drm/exynos/exynos_drm_gem.c | 58 +++---------------------- drivers/gpu/drm/exynos/exynos_drm_gem.h | 24 ++++------ 3 files changed, 35 insertions(+), 96 deletions(-) -- 2.17.1 -- To unsubscribe from this list: send the line "unsubscribe linux-samsung-soc" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html diff --git a/drivers/gpu/drm/exynos/exynos_drm_g2d.c b/drivers/gpu/drm/exynos/exynos_drm_g2d.c index 27b929757b43..f2481a2014bb 100644 --- a/drivers/gpu/drm/exynos/exynos_drm_g2d.c +++ b/drivers/gpu/drm/exynos/exynos_drm_g2d.c @@ -191,7 +191,7 @@ struct g2d_buf_desc { struct g2d_buf_info { unsigned int map_nr; enum g2d_reg_type reg_types[MAX_REG_TYPE_NR]; - unsigned long handles[MAX_REG_TYPE_NR]; + void *obj[MAX_REG_TYPE_NR]; unsigned int types[MAX_REG_TYPE_NR]; struct g2d_buf_desc descs[MAX_REG_TYPE_NR]; }; @@ -374,11 +374,10 @@ static void g2d_add_cmdlist_to_inuse(struct drm_exynos_file_private *file_priv, } static void g2d_userptr_put_dma_addr(struct g2d_data *g2d, - unsigned long obj, + void *obj, bool force) { - struct g2d_cmdlist_userptr *g2d_userptr = - (struct g2d_cmdlist_userptr *)obj; + struct g2d_cmdlist_userptr *g2d_userptr = obj; struct page **pages; if (!obj) @@ -421,7 +420,7 @@ static dma_addr_t *g2d_userptr_get_dma_addr(struct g2d_data *g2d, unsigned long userptr, unsigned long size, struct drm_file *filp, - unsigned long *obj) + void **obj) { struct drm_exynos_file_private *file_priv = filp->driver_priv; struct g2d_cmdlist_userptr *g2d_userptr; @@ -444,7 +443,7 @@ static dma_addr_t *g2d_userptr_get_dma_addr(struct g2d_data *g2d, */ if (g2d_userptr->size == size) { atomic_inc(&g2d_userptr->refcount); - *obj = (unsigned long)g2d_userptr; + *obj = g2d_userptr; return &g2d_userptr->dma_addr; } @@ -528,7 +527,7 @@ static dma_addr_t *g2d_userptr_get_dma_addr(struct g2d_data *g2d, g2d_userptr->in_pool = true; } - *obj = (unsigned long)g2d_userptr; + *obj = g2d_userptr; return &g2d_userptr->dma_addr; @@ -557,9 +556,7 @@ static void g2d_userptr_free_all(struct g2d_data *g2d, struct drm_file *filp) list_for_each_entry_safe(g2d_userptr, n, &file_priv->userptr_list, list) if (g2d_userptr->in_pool) - g2d_userptr_put_dma_addr(g2d, - (unsigned long)g2d_userptr, - true); + g2d_userptr_put_dma_addr(g2d, g2d_userptr, true); g2d->current_pool = 0; } @@ -714,26 +711,23 @@ static int g2d_map_cmdlist_gem(struct g2d_data *g2d, buf_desc = &buf_info->descs[reg_type]; if (buf_info->types[reg_type] == BUF_TYPE_GEM) { - unsigned long size; + struct exynos_drm_gem *exynos_gem; - size = exynos_drm_gem_get_size(drm_dev, handle, file); - if (!size) { + exynos_gem = exynos_drm_gem_get(file, handle); + if (!exynos_gem) { ret = -EFAULT; goto err; } - if (!g2d_check_buf_desc_is_valid(buf_desc, reg_type, - size)) { + if (!g2d_check_buf_desc_is_valid(buf_desc, + reg_type, exynos_gem->size)) { + exynos_drm_gem_put(exynos_gem); ret = -EFAULT; goto err; } - addr = exynos_drm_gem_get_dma_addr(drm_dev, handle, - file); - if (IS_ERR(addr)) { - ret = -EFAULT; - goto err; - } + addr = &exynos_gem->dma_addr; + buf_info->obj[reg_type] = exynos_gem; } else { struct drm_exynos_g2d_userptr g2d_userptr; @@ -753,7 +747,7 @@ static int g2d_map_cmdlist_gem(struct g2d_data *g2d, g2d_userptr.userptr, g2d_userptr.size, file, - &handle); + &buf_info->obj[reg_type]); if (IS_ERR(addr)) { ret = -EFAULT; goto err; @@ -762,7 +756,6 @@ static int g2d_map_cmdlist_gem(struct g2d_data *g2d, cmdlist->data[reg_pos + 1] = *addr; buf_info->reg_types[i] = reg_type; - buf_info->handles[reg_type] = handle; } return 0; @@ -782,20 +775,20 @@ static void g2d_unmap_cmdlist_gem(struct g2d_data *g2d, for (i = 0; i < buf_info->map_nr; i++) { struct g2d_buf_desc *buf_desc; enum g2d_reg_type reg_type; - unsigned long handle; + void *obj; reg_type = buf_info->reg_types[i]; buf_desc = &buf_info->descs[reg_type]; - handle = buf_info->handles[reg_type]; + obj = buf_info->obj[reg_type]; if (buf_info->types[reg_type] == BUF_TYPE_GEM) - exynos_drm_gem_put_dma_addr(g2d->drm_dev, handle, filp); + exynos_drm_gem_put(obj); else - g2d_userptr_put_dma_addr(g2d, handle, false); + g2d_userptr_put_dma_addr(g2d, obj, false); buf_info->reg_types[i] = REG_TYPE_NONE; - buf_info->handles[reg_type] = 0; + buf_info->obj[reg_type] = NULL; buf_info->types[reg_type] = 0; memset(buf_desc, 0x00, sizeof(*buf_desc)); } diff --git a/drivers/gpu/drm/exynos/exynos_drm_gem.c b/drivers/gpu/drm/exynos/exynos_drm_gem.c index 6e1494fa71b4..0b8c6f8fc48a 100644 --- a/drivers/gpu/drm/exynos/exynos_drm_gem.c +++ b/drivers/gpu/drm/exynos/exynos_drm_gem.c @@ -171,26 +171,6 @@ void exynos_drm_gem_destroy(struct exynos_drm_gem *exynos_gem) kfree(exynos_gem); } -unsigned long exynos_drm_gem_get_size(struct drm_device *dev, - unsigned int gem_handle, - struct drm_file *file_priv) -{ - struct exynos_drm_gem *exynos_gem; - struct drm_gem_object *obj; - - obj = drm_gem_object_lookup(file_priv, gem_handle); - if (!obj) { - DRM_ERROR("failed to lookup gem object.\n"); - return 0; - } - - exynos_gem = to_exynos_gem(obj); - - drm_gem_object_unreference_unlocked(obj); - - return exynos_gem->size; -} - static struct exynos_drm_gem *exynos_drm_gem_init(struct drm_device *dev, unsigned long size) { @@ -299,43 +279,15 @@ int exynos_drm_gem_map_ioctl(struct drm_device *dev, void *data, &args->offset); } -dma_addr_t *exynos_drm_gem_get_dma_addr(struct drm_device *dev, - unsigned int gem_handle, - struct drm_file *filp) +struct exynos_drm_gem *exynos_drm_gem_get(struct drm_file *filp, + unsigned int gem_handle) { - struct exynos_drm_gem *exynos_gem; struct drm_gem_object *obj; obj = drm_gem_object_lookup(filp, gem_handle); - if (!obj) { - DRM_ERROR("failed to lookup gem object.\n"); - return ERR_PTR(-EINVAL); - } - - exynos_gem = to_exynos_gem(obj); - - return &exynos_gem->dma_addr; -} - -void exynos_drm_gem_put_dma_addr(struct drm_device *dev, - unsigned int gem_handle, - struct drm_file *filp) -{ - struct drm_gem_object *obj; - - obj = drm_gem_object_lookup(filp, gem_handle); - if (!obj) { - DRM_ERROR("failed to lookup gem object.\n"); - return; - } - - drm_gem_object_unreference_unlocked(obj); - - /* - * decrease obj->refcount one more time because we has already - * increased it at exynos_drm_gem_get_dma_addr(). - */ - drm_gem_object_unreference_unlocked(obj); + if (!obj) + return NULL; + return to_exynos_gem(obj); } static int exynos_drm_gem_mmap_buffer(struct exynos_drm_gem *exynos_gem, diff --git a/drivers/gpu/drm/exynos/exynos_drm_gem.h b/drivers/gpu/drm/exynos/exynos_drm_gem.h index 9057d7f1d6ed..d46a62c30812 100644 --- a/drivers/gpu/drm/exynos/exynos_drm_gem.h +++ b/drivers/gpu/drm/exynos/exynos_drm_gem.h @@ -77,32 +77,26 @@ int exynos_drm_gem_map_ioctl(struct drm_device *dev, void *data, struct drm_file *file_priv); /* - * get dma address from gem handle and this function could be used for + * get exynos drm object from gem handle, this function could be used for * other drivers such as 2d/3d acceleration drivers. * with this function call, gem object reference count would be increased. */ -dma_addr_t *exynos_drm_gem_get_dma_addr(struct drm_device *dev, - unsigned int gem_handle, - struct drm_file *filp); +struct exynos_drm_gem *exynos_drm_gem_get(struct drm_file *filp, + unsigned int gem_handle); /* - * put dma address from gem handle and this function could be used for - * other drivers such as 2d/3d acceleration drivers. - * with this function call, gem object reference count would be decreased. + * put exynos drm object acquired from exynos_drm_gem_get(), + * gem object reference count would be decreased. */ -void exynos_drm_gem_put_dma_addr(struct drm_device *dev, - unsigned int gem_handle, - struct drm_file *filp); +static inline void exynos_drm_gem_put(struct exynos_drm_gem *exynos_gem) +{ + drm_gem_object_put_unlocked(&exynos_gem->base); +} /* get buffer information to memory region allocated by gem. */ int exynos_drm_gem_get_ioctl(struct drm_device *dev, void *data, struct drm_file *file_priv); -/* get buffer size to gem handle. */ -unsigned long exynos_drm_gem_get_size(struct drm_device *dev, - unsigned int gem_handle, - struct drm_file *file_priv); - /* free gem object. */ void exynos_drm_gem_free_object(struct drm_gem_object *obj); From patchwork Thu Jun 7 13:36:08 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Marek Szyprowski X-Patchwork-Id: 137892 Delivered-To: patch@linaro.org Received: by 2002:a2e:970d:0:0:0:0:0 with SMTP id r13-v6csp2108601lji; Thu, 7 Jun 2018 06:36:25 -0700 (PDT) X-Google-Smtp-Source: ADUXVKKwX+1tpThXzIfdt2nS37gyPfEOAKw8SLVLnaxMVCJxPDsnL7sM923I90kCdcumTvQrHbfb X-Received: by 2002:a62:5d83:: with SMTP id n3-v6mr1881885pfj.68.1528378585287; Thu, 07 Jun 2018 06:36:25 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1528378585; cv=none; d=google.com; s=arc-20160816; b=MzUqMoTVqmqfKSzi0zi3JXAvaZmOGCOUGXdh0mvzCIcqYKnbZcH7dNLXGOPT6LwN8r oua2EHIM/Fd7RtAsvv50RHPwNlUzHz3TsXIFKBkGDQ6Tcfndi4Em56b1X2EgtiwuLVBe +hFn8KraijHmze3DCrXvw4+Gsj6p+RWXmwOlYoXFAJf9oHWvjSYg8XEjnnUQ0sVJ8WV6 26sV2vdf3SufN/Eo+jvfCIyjZVlH0uI1frTS+NLyW2BLCjNCOXm9/PJkzGZWliHi1hyc UWZDIhwEfxqx3jW1fVKznWQHAOnyimh86fkxKKtye9rIsHcJH9DxIyH5EGsNmXtF1ol/ 15lA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:cms-type:in-reply-to :message-id:date:subject:cc:to:from:dkim-signature:dkim-filter :arc-authentication-results; bh=we4J2N4IUxQDjhIa/xO7/tASpHmFRO5Y78FBHHidCsY=; b=SfP8zoz3LhRn3tDSfSwCX4V1+oYhiyC6YwamWmX0Ye9FMiLjuCwRpsEwGov/dKmy6Q cR2CpNg5juzmvURdxmijVm4XenZoTyWMrTJguIZBIXiWtJdWmje600c34mXApcpIgsIE PmgzYR5Ad4GSkywR7aLGxpS6U9+y+qQ4q/ZRCTk0ySe0FvIrjHWSLfuG6xPLV3r4/e2C GQz0dkttm3BODivMuxRJcw+YkBknHeKFAkoCMjizqPe0pazkTi7WLnk33RPuo26nj4/J C24gp8aIO0vD8IZ4kFcyjoXoOFE8GNAwsdch+XlKEVZ8xeC0slpC2wfj4Ej/yTomWPEg 1xJw== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@samsung.com header.s=mail20170921 header.b=SGHyMBOO; spf=pass (google.com: best guess record for domain of linux-samsung-soc-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-samsung-soc-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=samsung.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id h127-v6si57919045pfb.111.2018.06.07.06.36.25; Thu, 07 Jun 2018 06:36:25 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-samsung-soc-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=neutral (body hash did not verify) header.i=@samsung.com header.s=mail20170921 header.b=SGHyMBOO; spf=pass (google.com: best guess record for domain of linux-samsung-soc-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-samsung-soc-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=samsung.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932578AbeFGNgY (ORCPT + 3 others); Thu, 7 Jun 2018 09:36:24 -0400 Received: from mailout2.w1.samsung.com ([210.118.77.12]:54095 "EHLO mailout2.w1.samsung.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932457AbeFGNgW (ORCPT ); Thu, 7 Jun 2018 09:36:22 -0400 Received: from eucas1p2.samsung.com (unknown [182.198.249.207]) by mailout2.w1.samsung.com (KnoxPortal) with ESMTP id 20180607133620euoutp0213fe6976a413478c3cd8a8308a934c3e~15DiaqBfI0829208292euoutp02u; Thu, 7 Jun 2018 13:36:20 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 mailout2.w1.samsung.com 20180607133620euoutp0213fe6976a413478c3cd8a8308a934c3e~15DiaqBfI0829208292euoutp02u DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=samsung.com; s=mail20170921; t=1528378580; bh=ArTnaRsSEZR5ccB3bQ5NxriIOJuM5u/+VaSQ7aXaWxU=; h=From:To:Cc:Subject:Date:In-reply-to:References:From; b=SGHyMBOOhZIfTD7ggM93szFN/bMumpPtXB0NvOWdp95XgVI3L+PdVPumyJLQHl9L/ jWK88wOYgDGqVBbgIGxw5yM310u/RFyuEc7uZug6wz53BB+GGVpUjDSlIZjFmpPgcV pGJI8LuJxjdaqRLfgASC5958gCbGA/0GpcmriIZQ= Received: from eusmges3new.samsung.com (unknown [203.254.199.245]) by eucas1p1.samsung.com (KnoxPortal) with ESMTP id 20180607133619eucas1p10f7e48c5823482c92ef40b5d112acc0d~15Dha9ASC2458724587eucas1p1Y; Thu, 7 Jun 2018 13:36:19 +0000 (GMT) Received: from eucas1p2.samsung.com ( [182.198.249.207]) by eusmges3new.samsung.com (EUCPMTA) with SMTP id A8.A9.10409.2D4391B5; Thu, 7 Jun 2018 14:36:18 +0100 (BST) Received: from eusmgms2.samsung.com (unknown [182.198.249.180]) by eucas1p2.samsung.com (KnoxPortal) with ESMTP id 20180607133617eucas1p2409012bcecf42728a0d6d54e3e80c710~15Df8Pmju2920129201eucas1p2V; Thu, 7 Jun 2018 13:36:17 +0000 (GMT) X-AuditID: cbfec7f5-f95739c0000028a9-75-5b1934d28b94 Received: from eusync4.samsung.com ( [203.254.199.214]) by eusmgms2.samsung.com (EUCPMTA) with SMTP id AB.A0.04183.1D4391B5; Thu, 7 Jun 2018 14:36:17 +0100 (BST) Received: from AMDC2765.digital.local ([106.116.147.25]) by eusync4.samsung.com (Oracle Communications Messaging Server 7.0.5.31.0 64bit (built May 5 2014)) with ESMTPA id <0P9Y00B59GGBIO30@eusync4.samsung.com>; Thu, 07 Jun 2018 14:36:17 +0100 (BST) From: Marek Szyprowski To: dri-devel@lists.freedesktop.org, linux-samsung-soc@vger.kernel.org Cc: Marek Szyprowski , Inki Dae , Seung-Woo Kim , Andrzej Hajda , Bartlomiej Zolnierkiewicz , Krzysztof Kozlowski , Tobias Jakobi Subject: [PATCH 3/4] drm/exynos: Use common exynos_drm_gem_get()/put() functions for GEM lookup Date: Thu, 07 Jun 2018 15:36:08 +0200 Message-id: <20180607133609.28397-4-m.szyprowski@samsung.com> X-Mailer: git-send-email 2.17.1 In-reply-to: <20180607133609.28397-1-m.szyprowski@samsung.com> X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFtrKIsWRmVeSWpSXmKPExsWy7djP87qXTCSjDToei1vcWneO1WLjjPWs Fle+vmezmHR/AovF+fMb2C1mnN/HZLH2yF0ga/JLNou21R9YHTg9Nq3qZPO4332cyePfMXaP vi2rGD0+b5ILYI3isklJzcksSy3St0vgyriy5wt7wTrJisat85gbGNtEuxg5OSQETCTePtzP 3sXIxSEksIJR4uvJdWwQzmdGiQPL1rHAVC3d/50RIrGMUWLVshaolgYmidl7drOBVLEJGEp0 ve0Cs0UE3CSaDs9kBSliFtjIJLH50UQmkISwQKLE4WvHwMayCKhK/Dz4jx3E5hWwlZj5bxoT xDp5idUbDjCD2JwCdhKT3+9kBhkkITCFTWLyjmeMEEUuEj1XzjFD2MISr45vYYewZSQuT+5m gWhoZpRonzGLHcLpYZTYOmcHG0SVtcTh4xdZQWxmAT6JSdumA03iAIrzSnS0CUGUeEi0b97O DPHnREaJnUt+s01glFzAyLCKUTy1tDg3PbXYOC+1XK84Mbe4NC9dLzk/dxMjMDJP/zv+dQfj vj9JhxgFOBiVeHgb7otHC7EmlhVX5h5ilOBgVhLhTbwkFi3Em5JYWZValB9fVJqTWnyIUZqD RUmcN06jLkpIID2xJDU7NbUgtQgmy8TBKdXAGM31JkIoXnT1plfcP36E2r6MWas98+YVl+Ov 95n/qera9kFFOV3RzyjKdWI+S46eZIGTbN/1qpYJK/6xZ4g1vXvwPaFtbtqP5ukfig3efJm+ fXbXgqQFJ3wehhYxsLuFzmQrvql7qpNr4ftcli/Jy/avDJ6zXsdghti1nG0nzxYFu+hfv8T/ SImlOCPRUIu5qDgRABP7YZ/IAgAA X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFprILMWRmVeSWpSXmKPExsVy+t/xa7oXTSSjDa4tZba4te4cq8XGGetZ La58fc9mMen+BBaL8+c3sFvMOL+PyWLtkbtA1uSXbBZtqz+wOnB6bFrVyeZxv/s4k8e/Y+we fVtWMXp83iQXwBrFZZOSmpNZllqkb5fAlXFlzxf2gnWSFY1b5zE3MLaJdjFyckgImEgs3f+d sYuRi0NIYAmjxJsHa6CcJiaJ3dv2M4JUsQkYSnS97WIDsUUE3CSaDs9kBSliFtjMJNFzvB+s SFggUeLwtWMsIDaLgKrEz4P/2EFsXgFbiZn/pjFBrJOXWL3hADOIzSlgJzH5/U4wWwioZt2b xWwTGHkWMDKsYhRJLS3OTc8tNtIrTswtLs1L10vOz93ECAyobcd+btnB2PUu+BCjAAejEg/v jYfi0UKsiWXFlbmHGCU4mJVEeBMviUUL8aYkVlalFuXHF5XmpBYfYpTmYFES5z1vUBklJJCe WJKanZpakFoEk2Xi4JRqYKx73PNzhfid6VtY7131lUxLKHhz46jx+b88inmrawt+NO8JLXwe LLb0yLVbf0tPd1yfHSu7zmDiiYfGfh8mLhZ8+4A1J6jyRBbDhuvTUi37mOancpfbf5rvvvSp lDA3g8skk1/ucrMurNnZYlGy+sOKNYlFUtrNK6eaSxuo+h3jZzCQW84REqnEUpyRaKjFXFSc CAB1Zqs1JAIAAA== X-CMS-MailID: 20180607133617eucas1p2409012bcecf42728a0d6d54e3e80c710 X-Msg-Generator: CA CMS-TYPE: 201P X-CMS-RootMailID: 20180607133617eucas1p2409012bcecf42728a0d6d54e3e80c710 References: <20180607133609.28397-1-m.szyprowski@samsung.com> Sender: linux-samsung-soc-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-samsung-soc@vger.kernel.org Use recently introduced common helpers to unify GEM handling code. Signed-off-by: Marek Szyprowski --- drivers/gpu/drm/exynos/exynos_drm_fb.c | 10 ++++------ drivers/gpu/drm/exynos/exynos_drm_ipp.c | 10 +++++----- 2 files changed, 9 insertions(+), 11 deletions(-) -- 2.17.1 -- To unsubscribe from this list: send the line "unsubscribe linux-samsung-soc" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html diff --git a/drivers/gpu/drm/exynos/exynos_drm_fb.c b/drivers/gpu/drm/exynos/exynos_drm_fb.c index 7fcc1a7ab1a0..9f52382e19ee 100644 --- a/drivers/gpu/drm/exynos/exynos_drm_fb.c +++ b/drivers/gpu/drm/exynos/exynos_drm_fb.c @@ -101,7 +101,6 @@ exynos_user_fb_create(struct drm_device *dev, struct drm_file *file_priv, { const struct drm_format_info *info = drm_get_format_info(dev, mode_cmd); struct exynos_drm_gem *exynos_gem[MAX_FB_BUFFER]; - struct drm_gem_object *obj; struct drm_framebuffer *fb; int i; int ret; @@ -112,15 +111,14 @@ exynos_user_fb_create(struct drm_device *dev, struct drm_file *file_priv, unsigned long size = height * mode_cmd->pitches[i] + mode_cmd->offsets[i]; - obj = drm_gem_object_lookup(file_priv, mode_cmd->handles[i]); - if (!obj) { + exynos_gem[i] = exynos_drm_gem_get(file_priv, + mode_cmd->handles[i]); + if (!exynos_gem[i]) { DRM_ERROR("failed to lookup gem object\n"); ret = -ENOENT; goto err; } - exynos_gem[i] = to_exynos_gem(obj); - if (size > exynos_gem[i]->size) { i++; ret = -EINVAL; @@ -138,7 +136,7 @@ exynos_user_fb_create(struct drm_device *dev, struct drm_file *file_priv, err: while (i--) - drm_gem_object_unreference_unlocked(&exynos_gem[i]->base); + exynos_drm_gem_put(exynos_gem[i]); return ERR_PTR(ret); } diff --git a/drivers/gpu/drm/exynos/exynos_drm_ipp.c b/drivers/gpu/drm/exynos/exynos_drm_ipp.c index 26374e58c557..2963acfbe350 100644 --- a/drivers/gpu/drm/exynos/exynos_drm_ipp.c +++ b/drivers/gpu/drm/exynos/exynos_drm_ipp.c @@ -371,13 +371,13 @@ static int exynos_drm_ipp_task_setup_buffer(struct exynos_drm_ipp_buffer *buf, unsigned int height = (i == 0) ? buf->buf.height : DIV_ROUND_UP(buf->buf.height, buf->format->vsub); unsigned long size = height * buf->buf.pitch[i]; - struct drm_gem_object *obj = drm_gem_object_lookup(filp, + struct exynos_drm_gem *gem = exynos_drm_gem_get(filp, buf->buf.gem_id[i]); - if (!obj) { + if (!gem) { ret = -ENOENT; goto gem_free; } - buf->exynos_gem[i] = to_exynos_gem(obj); + buf->exynos_gem[i] = gem; if (size + buf->buf.offset[i] > buf->exynos_gem[i]->size) { i++; @@ -391,7 +391,7 @@ static int exynos_drm_ipp_task_setup_buffer(struct exynos_drm_ipp_buffer *buf, return 0; gem_free: while (i--) { - drm_gem_object_put_unlocked(&buf->exynos_gem[i]->base); + exynos_drm_gem_put(buf->exynos_gem[i]); buf->exynos_gem[i] = NULL; } return ret; @@ -404,7 +404,7 @@ static void exynos_drm_ipp_task_release_buf(struct exynos_drm_ipp_buffer *buf) if (!buf->exynos_gem[0]) return; for (i = 0; i < buf->format->num_planes; i++) - drm_gem_object_put_unlocked(&buf->exynos_gem[i]->base); + exynos_drm_gem_put(buf->exynos_gem[i]); } static void exynos_drm_ipp_task_free(struct exynos_drm_ipp *ipp, From patchwork Thu Jun 7 13:36:09 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Marek Szyprowski X-Patchwork-Id: 137891 Delivered-To: patch@linaro.org Received: by 2002:a2e:970d:0:0:0:0:0 with SMTP id r13-v6csp2108592lji; Thu, 7 Jun 2018 06:36:24 -0700 (PDT) X-Google-Smtp-Source: ADUXVKKcwUbYSD6CJm/8wVHZKK1FzdQ/jLbYWbu+xgiXkVR+EW4+vdn7tYYO2xRRwoaQkRy8Ahfy X-Received: by 2002:a17:902:8a8c:: with SMTP id p12-v6mr2083295plo.94.1528378584717; Thu, 07 Jun 2018 06:36:24 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1528378584; cv=none; d=google.com; s=arc-20160816; b=blmWr/T/juDvYwVVfAd9RyejuPjEJejTJA6C0qu3xPFdmp0RCbsckBuCDSvBD3zl9v Orzg9GSFvwjBKy7xeXsIjfVcT+r3dfxCwSpRQJysMck1izeOfqYiFxeP00rioR6/7e06 KA44g+GA9xx/8ytP63Y0FMs7aMM5Lau2svhUIrJgyig7g4cv2fMmQ0R2pNgtz6SLRxRb rRkk4aPwJo0qyyQRsTMe2ClAIuAjmWQD/Q/C3BotUSrSjWvxalXS0efP8/acXaLGsuBD PEicx7LqkUh1azV83VepucmLs+n6DoXsZAT0tRw+69EAB5bmsTk1XDo06Ic4rUutJXW7 hfPA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:cms-type:in-reply-to :message-id:date:subject:cc:to:from:dkim-signature:dkim-filter :arc-authentication-results; bh=AefKi3G/Jz5No2tMch2tHPLG/fR6mziSu8pA7Dgq+II=; b=A0XpxrME6NuW8D7WVBel6ls8E534/bNa85c7plBdJIcv2qcLkWzhQa+2ZP5+oLn1EH SIEFHP3D68jTcNHpT5ep1gj2yxynnMa5UC9eNHzFN+u740Yr/iaSnlr1lZJ3SHZ9GcgI JPg9jM2zcCZ/cFnjjVade+uA+7yasiMPBqfQ2j6NgXvnNXEotBo1EqgyIwGTLUPWsUAV zcD07HEpo0rxQyGN1vU59Vh3mn8OFZfrXMPg4DMTzgN9rIC1XPT9/BYuvQiGwRYZgceh xsIl8eDXtFRdcjEj6NYNKqVFuxtnbF3vaqwGn0L+oQqvaz/8qW+78C5/1JpEl55zvo7N 4pEQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@samsung.com header.s=mail20170921 header.b=VF0Emv0V; spf=pass (google.com: best guess record for domain of linux-samsung-soc-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-samsung-soc-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=samsung.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id h127-v6si57919045pfb.111.2018.06.07.06.36.24; Thu, 07 Jun 2018 06:36:24 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-samsung-soc-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=neutral (body hash did not verify) header.i=@samsung.com header.s=mail20170921 header.b=VF0Emv0V; spf=pass (google.com: best guess record for domain of linux-samsung-soc-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-samsung-soc-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=samsung.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932489AbeFGNgX (ORCPT + 3 others); Thu, 7 Jun 2018 09:36:23 -0400 Received: from mailout2.w1.samsung.com ([210.118.77.12]:54082 "EHLO mailout2.w1.samsung.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932578AbeFGNgV (ORCPT ); Thu, 7 Jun 2018 09:36:21 -0400 Received: from eucas1p1.samsung.com (unknown [182.198.249.206]) by mailout2.w1.samsung.com (KnoxPortal) with ESMTP id 20180607133619euoutp02dbd30b58cb8dd4695023141cb970159a~15Dh6xXgS0788307883euoutp02J; Thu, 7 Jun 2018 13:36:19 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 mailout2.w1.samsung.com 20180607133619euoutp02dbd30b58cb8dd4695023141cb970159a~15Dh6xXgS0788307883euoutp02J DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=samsung.com; s=mail20170921; t=1528378579; bh=+tmMf8pRD+fFgbBw2lk3wiHek9Cz51/raOXAwsgJsVo=; h=From:To:Cc:Subject:Date:In-reply-to:References:From; b=VF0Emv0V8JUpSkfjzzK99SmMTpu4gCA9VqZzZGnmsi9JHeO2mPzuEDuAJ7bg4CJsV V4KCq3WhSLc/Zl5cL5qy2+DOdpvwJGnGFwdYKcyUI4JXTpih6+3GQugOwDTCDxEfI7 5+CKm1TX+Gjaf5xj3Q1ICByU4dxWH/hMMuqdx+9E= Received: from eusmges3new.samsung.com (unknown [203.254.199.245]) by eucas1p2.samsung.com (KnoxPortal) with ESMTP id 20180607133618eucas1p2b16d0bcbd29790d2649d50ab1c2dea5e~15DhJMBR_2920229202eucas1p2P; Thu, 7 Jun 2018 13:36:18 +0000 (GMT) Received: from eucas1p1.samsung.com ( [182.198.249.206]) by eusmges3new.samsung.com (EUCPMTA) with SMTP id 47.A9.10409.2D4391B5; Thu, 7 Jun 2018 14:36:18 +0100 (BST) Received: from eusmgms2.samsung.com (unknown [182.198.249.180]) by eucas1p1.samsung.com (KnoxPortal) with ESMTP id 20180607133617eucas1p11a0b97f50b125b2167b05e5f7a60fc8f~15Dfz29vL2931029310eucas1p15; Thu, 7 Jun 2018 13:36:17 +0000 (GMT) X-AuditID: cbfec7f5-b45ff700000028a9-73-5b1934d2c204 Received: from eusync4.samsung.com ( [203.254.199.214]) by eusmgms2.samsung.com (EUCPMTA) with SMTP id 0D.A0.04183.1D4391B5; Thu, 7 Jun 2018 14:36:17 +0100 (BST) Received: from AMDC2765.digital.local ([106.116.147.25]) by eusync4.samsung.com (Oracle Communications Messaging Server 7.0.5.31.0 64bit (built May 5 2014)) with ESMTPA id <0P9Y00B59GGBIO30@eusync4.samsung.com>; Thu, 07 Jun 2018 14:36:17 +0100 (BST) From: Marek Szyprowski To: dri-devel@lists.freedesktop.org, linux-samsung-soc@vger.kernel.org Cc: Marek Szyprowski , Inki Dae , Seung-Woo Kim , Andrzej Hajda , Bartlomiej Zolnierkiewicz , Krzysztof Kozlowski , Tobias Jakobi Subject: [PATCH 4/4] drm/exynos: gem: Switch to drm_gem_object_put_unlocked() helper Date: Thu, 07 Jun 2018 15:36:09 +0200 Message-id: <20180607133609.28397-5-m.szyprowski@samsung.com> X-Mailer: git-send-email 2.17.1 In-reply-to: <20180607133609.28397-1-m.szyprowski@samsung.com> X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFtrCIsWRmVeSWpSXmKPExsWy7djPc7qXTCSjDf5f57W4te4cq8XGGetZ La58fc9mMen+BBaL8+c3sFvMOL+PyWLtkbtA1uSXbBZtqz+wOnB6bFrVyeZxv/s4k8e/Y+we fVtWMXp83iQXwBrFZZOSmpNZllqkb5fAldHzZT1jwSLOiiPzZ7A1MH5i72Lk5JAQMJE4//sE axcjF4eQwApGic6Hq5khnM+MEnu7LzHBVJ3umskMYgsJLGOU2LFPEaKogUli9p7dbCAJNgFD ia63XWC2iICbRNPhmWBjmQU2MklsfjQRbJKwQJjEkY0/wYpYBFQlFu58wAhi8wrYSnTP/sgM sU1eYvWGA2A2p4CdxOT3O8FOkhCYwCax7/t1FogiF4npt/uhnhCWeHV8C5QtI3F5cjcLREMz o0T7jFnsEE4Po8TWOTvYIKqsJQ4fv8gKYjML8ElM2jYdaAUHUJxXoqNNCKLEQ6L53kMmiD8n Mkr8Xd/HOIFRcgEjwypG8dTS4tz01GLjvNRyveLE3OLSvHS95PzcTYzAuDz97/jXHYz7/iQd YhTgYFTi4W24Lx4txJpYVlyZe4hRgoNZSYQ38ZJYtBBvSmJlVWpRfnxRaU5q8SFGaQ4WJXHe OI26KCGB9MSS1OzU1ILUIpgsEwenVANjmEikYhDT2Yxpi+b83rj2fvvz/QU7KtYleqSVH541 f/rq6ytvhed/Ofrih8PdaTfWfFyzxfzHcwaPhy8039lp1Z3S6fgbFdZvx3bl4D3Z+SFXpQo+ 9L2cs2/Ps/v7JJwlFwYcifBUcam+Ou31T11m9hM3er88LyrYKyorIbqlzlTXyvftRtkvZkos xRmJhlrMRcWJAMmHMlnHAgAA X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFprILMWRmVeSWpSXmKPExsVy+t/xa7oXTSSjDZrvy1ncWneO1WLjjPWs Fle+vmezmHR/AovF+fMb2C1mnN/HZLH2yF0ga/JLNou21R9YHTg9Nq3qZPO4332cyePfMXaP vi2rGD0+b5ILYI3isklJzcksSy3St0vgyuj5sp6xYBFnxZH5M9gaGD+xdzFyckgImEic7prJ 3MXIxSEksIRRYub2c6wQThOTxO5t+xlBqtgEDCW63naxgdgiAm4STYdnghUxC2xmkug53g9W JCwQJnHzzVwWEJtFQFVi4c4HYHFeAVuJ7tkfmSHWyUus3nAAzOYUsJOY/H4nmC0EVLPuzWK2 CYw8CxgZVjGKpJYW56bnFhvpFSfmFpfmpesl5+duYgQG1LZjP7fsYOx6F3yIUYCDUYmH98ZD 8Wgh1sSy4srcQ4wSHMxKIryJl8SihXhTEiurUovy44tKc1KLDzFKc7AoifOeN6iMEhJITyxJ zU5NLUgtgskycXBKNTBGiU1d+W3BLudE27mm+/XM33X+myTy+J2ZxuzPgh6l52TdDW4vnTA7 4PyOrMlxLFulLD1TvTkmcvAZBO5ha1VKdZ6/w1r0DXeWGPe7aaKpf3LzroUtOSJqwbzp0B6V wIVf793etClAdqd08vnkCyeOKfQ1hc5Z8vd45022VYc9tv6W4dVcfihXiaU4I9FQi7moOBEA NxWqPCQCAAA= X-CMS-MailID: 20180607133617eucas1p11a0b97f50b125b2167b05e5f7a60fc8f X-Msg-Generator: CA CMS-TYPE: 201P X-CMS-RootMailID: 20180607133617eucas1p11a0b97f50b125b2167b05e5f7a60fc8f References: <20180607133609.28397-1-m.szyprowski@samsung.com> Sender: linux-samsung-soc-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-samsung-soc@vger.kernel.org drm_gem_object_unreference() function is just a compatibility alias for drm_gem_object_put() and should not be used by the new code, so convert all users of compatibility functions to use the new API. Signed-off-by: Marek Szyprowski --- drivers/gpu/drm/exynos/exynos_drm_gem.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) -- 2.17.1 -- To unsubscribe from this list: send the line "unsubscribe linux-samsung-soc" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html diff --git a/drivers/gpu/drm/exynos/exynos_drm_gem.c b/drivers/gpu/drm/exynos/exynos_drm_gem.c index 0b8c6f8fc48a..34ace85feb68 100644 --- a/drivers/gpu/drm/exynos/exynos_drm_gem.c +++ b/drivers/gpu/drm/exynos/exynos_drm_gem.c @@ -143,7 +143,7 @@ static int exynos_drm_gem_handle_create(struct drm_gem_object *obj, DRM_DEBUG_KMS("gem handle = 0x%x\n", *handle); /* drop reference from allocate - handle holds it now. */ - drm_gem_object_unreference_unlocked(obj); + drm_gem_object_put_unlocked(obj); return 0; } @@ -335,7 +335,7 @@ int exynos_drm_gem_get_ioctl(struct drm_device *dev, void *data, args->flags = exynos_gem->flags; args->size = exynos_gem->size; - drm_gem_object_unreference_unlocked(obj); + drm_gem_object_put_unlocked(obj); return 0; }