From patchwork Thu Aug 13 08:36:40 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Thomas Zimmermann X-Patchwork-Id: 11712199 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 9242813B1 for ; Thu, 13 Aug 2020 08:38:04 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (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 7B03920781 for ; Thu, 13 Aug 2020 08:38:04 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 7B03920781 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=suse.de Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=dri-devel-bounces@lists.freedesktop.org Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 935526E9D9; Thu, 13 Aug 2020 08:37:09 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mx2.suse.de (mx2.suse.de [195.135.220.15]) by gabe.freedesktop.org (Postfix) with ESMTPS id DA9E66E9BF; Thu, 13 Aug 2020 08:37:06 +0000 (UTC) X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay2.suse.de (unknown [195.135.221.27]) by mx2.suse.de (Postfix) with ESMTP id 82370B5A3; Thu, 13 Aug 2020 08:37:27 +0000 (UTC) From: Thomas Zimmermann To: alexander.deucher@amd.com, christian.koenig@amd.com, airlied@linux.ie, daniel@ffwll.ch, linux@armlinux.org.uk, maarten.lankhorst@linux.intel.com, mripard@kernel.org, l.stach@pengutronix.de, christian.gmeiner@gmail.com, inki.dae@samsung.com, jy0922.shim@samsung.com, sw0312.kim@samsung.com, kyungmin.park@samsung.com, kgene@kernel.org, krzk@kernel.org, patrik.r.jakobsson@gmail.com, jani.nikula@linux.intel.com, joonas.lahtinen@linux.intel.com, rodrigo.vivi@intel.com, chunkuang.hu@kernel.org, p.zabel@pengutronix.de, matthias.bgg@gmail.com, robdclark@gmail.com, sean@poorly.run, bskeggs@redhat.com, tomi.valkeinen@ti.com, eric@anholt.net, hjc@rock-chips.com, heiko@sntech.de, thierry.reding@gmail.com, jonathanh@nvidia.com, rodrigosiqueiramelo@gmail.com, hamohammed.sa@gmail.com, oleksandr_andrushchenko@epam.com, hyun.kwon@xilinx.com, laurent.pinchart@ideasonboard.com, michal.simek@xilinx.com, sumit.semwal@linaro.org, evan.quan@amd.com, Hawking.Zhang@amd.com, tianci.yin@amd.com, marek.olsak@amd.com, hdegoede@redhat.com, andrey.grodzovsky@amd.com, Felix.Kuehling@amd.com, xinhui.pan@amd.com, aaron.liu@amd.com, nirmoy.das@amd.com, chris@chris-wilson.co.uk, matthew.auld@intel.com, abdiel.janulgue@linux.intel.com, tvrtko.ursulin@linux.intel.com, andi.shyti@intel.com, sam@ravnborg.org, miaoqinglang@huawei.com, emil.velikov@collabora.com Subject: [PATCH 16/20] drm/vgem: Introduce GEM object functions Date: Thu, 13 Aug 2020 10:36:40 +0200 Message-Id: <20200813083644.31711-17-tzimmermann@suse.de> X-Mailer: git-send-email 2.28.0 In-Reply-To: <20200813083644.31711-1-tzimmermann@suse.de> References: <20200813083644.31711-1-tzimmermann@suse.de> MIME-Version: 1.0 X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: linux-samsung-soc@vger.kernel.org, linux-arm-msm@vger.kernel.org, intel-gfx@lists.freedesktop.org, etnaviv@lists.freedesktop.org, dri-devel@lists.freedesktop.org, linux-rockchip@lists.infradead.org, linux-mediatek@lists.infradead.org, amd-gfx@lists.freedesktop.org, Thomas Zimmermann , nouveau@lists.freedesktop.org, linux-tegra@vger.kernel.org, xen-devel@lists.xenproject.org, freedreno@lists.freedesktop.org, linux-arm-kernel@lists.infradead.org Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" GEM object functions deprecate several similar callback interfaces in struct drm_driver. This patch replaces the per-driver callbacks with per-instance callbacks in vgem. The only exception is gem_prime_mmap, which is non-trivial to convert. Signed-off-by: Thomas Zimmermann --- drivers/gpu/drm/vgem/vgem_drv.c | 21 ++++++++++++++------- 1 file changed, 14 insertions(+), 7 deletions(-) diff --git a/drivers/gpu/drm/vgem/vgem_drv.c b/drivers/gpu/drm/vgem/vgem_drv.c index 313339bbff90..c49f841dd4cd 100644 --- a/drivers/gpu/drm/vgem/vgem_drv.c +++ b/drivers/gpu/drm/vgem/vgem_drv.c @@ -50,6 +50,8 @@ #define DRIVER_MAJOR 1 #define DRIVER_MINOR 0 +static const struct drm_gem_object_funcs vgem_gem_object_funcs; + static struct vgem_device { struct drm_device drm; struct platform_device *platform; @@ -167,6 +169,8 @@ static struct drm_vgem_gem_object *__vgem_gem_create(struct drm_device *dev, if (!obj) return ERR_PTR(-ENOMEM); + obj->base.funcs = &vgem_gem_object_funcs; + ret = drm_gem_object_init(dev, &obj->base, roundup(size, PAGE_SIZE)); if (ret) { kfree(obj); @@ -408,13 +412,21 @@ static void vgem_release(struct drm_device *dev) platform_device_unregister(vgem->platform); } +static const struct drm_gem_object_funcs vgem_gem_object_funcs = { + .free = vgem_gem_free_object, + .pin = vgem_prime_pin, + .unpin = vgem_prime_unpin, + .get_sg_table = vgem_prime_get_sg_table, + .vmap = vgem_prime_vmap, + .vunmap = vgem_prime_vunmap, + .vm_ops = &vgem_gem_vm_ops, +}; + static struct drm_driver vgem_driver = { .driver_features = DRIVER_GEM | DRIVER_RENDER, .release = vgem_release, .open = vgem_open, .postclose = vgem_postclose, - .gem_free_object_unlocked = vgem_gem_free_object, - .gem_vm_ops = &vgem_gem_vm_ops, .ioctls = vgem_ioctls, .num_ioctls = ARRAY_SIZE(vgem_ioctls), .fops = &vgem_driver_fops, @@ -423,13 +435,8 @@ static struct drm_driver vgem_driver = { .prime_handle_to_fd = drm_gem_prime_handle_to_fd, .prime_fd_to_handle = drm_gem_prime_fd_to_handle, - .gem_prime_pin = vgem_prime_pin, - .gem_prime_unpin = vgem_prime_unpin, .gem_prime_import = vgem_prime_import, .gem_prime_import_sg_table = vgem_prime_import_sg_table, - .gem_prime_get_sg_table = vgem_prime_get_sg_table, - .gem_prime_vmap = vgem_prime_vmap, - .gem_prime_vunmap = vgem_prime_vunmap, .gem_prime_mmap = vgem_prime_mmap, .name = DRIVER_NAME,