linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Thomas Zimmermann <tzimmermann@suse.de>
To: Gerd Hoffmann <kraxel@redhat.com>, dri-devel@lists.freedesktop.org
Cc: Maxime Ripard <maxime.ripard@bootlin.com>,
	David Airlie <airlied@linux.ie>,
	Daniel Vetter <daniel.vetter@ffwll.ch>,
	open list <linux-kernel@vger.kernel.org>,
	"open list:DRM DRIVER FOR BOCHS VIRTUAL GPU" 
	<virtualization@lists.linux-foundation.org>,
	Xinliang Liu <z.liuxinliang@hisilicon.com>,
	Hans de Goede <hdegoede@redhat.com>,
	Xinwei Kong <kong.kongxinwei@hisilicon.com>,
	Chen Feng <puck.chen@hisilicon.com>,
	Rongrong Zou <zourongrong@gmail.com>,
	Dave Airlie <airlied@redhat.com>, Sean Paul <sean@poorly.run>
Subject: Re: [PATCH 8/8] drm/vram: drop DRM_VRAM_MM_FILE_OPERATIONS
Date: Fri, 13 Sep 2019 15:18:53 +0200	[thread overview]
Message-ID: <e9712055-c6db-5515-0c11-4d7add138856@suse.de> (raw)
In-Reply-To: <20190913122908.784-9-kraxel@redhat.com>


[-- Attachment #1.1: Type: text/plain, Size: 7962 bytes --]



Am 13.09.19 um 14:29 schrieb Gerd Hoffmann:
> Not needed any more because we don't have vram specific fops
> any more.  DEFINE_DRM_GEM_FOPS() can be used instead.
> 
> Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
> ---
>  include/drm/drm_gem_vram_helper.h             | 18 ----
>  include/drm/drm_vram_mm_helper.h              | 82 +++++++++++++++++++
>  drivers/gpu/drm/ast/ast_drv.c                 |  5 +-
>  drivers/gpu/drm/bochs/bochs_drv.c             |  5 +-
>  .../gpu/drm/hisilicon/hibmc/hibmc_drm_drv.c   |  5 +-
>  drivers/gpu/drm/mgag200/mgag200_drv.c         |  5 +-
>  drivers/gpu/drm/vboxvideo/vbox_drv.c          |  5 +-
>  7 files changed, 87 insertions(+), 38 deletions(-)
>  create mode 100644 include/drm/drm_vram_mm_helper.h
> 
> diff --git a/include/drm/drm_gem_vram_helper.h b/include/drm/drm_gem_vram_helper.h
> index 9d5526650291..3503ff784803 100644
> --- a/include/drm/drm_gem_vram_helper.h
> +++ b/include/drm/drm_gem_vram_helper.h
> @@ -180,22 +180,4 @@ struct drm_vram_mm *drm_vram_helper_alloc_mm(
>  	struct drm_device *dev, uint64_t vram_base, size_t vram_size);
>  void drm_vram_helper_release_mm(struct drm_device *dev);
>  
> -/**
> - * define DRM_VRAM_MM_FILE_OPERATIONS - default callback functions for \
> -	&struct file_operations
> - *
> - * Drivers that use VRAM MM can use this macro to initialize
> - * &struct file_operations with default functions.
> - */
> -#define DRM_VRAM_MM_FILE_OPERATIONS \
> -	.llseek		= no_llseek, \
> -	.read		= drm_read, \
> -	.poll		= drm_poll, \
> -	.unlocked_ioctl = drm_ioctl, \
> -	.compat_ioctl	= drm_compat_ioctl, \
> -	.mmap		= drm_gem_mmap, \
> -	.open		= drm_open, \
> -	.release	= drm_release \
> -
> -
>  #endif
> diff --git a/include/drm/drm_vram_mm_helper.h b/include/drm/drm_vram_mm_helper.h
> new file mode 100644

Please rebase onto the latest drm-tip. This entire file has been removed
in a recent patch.

With this change applied:

Reviewed-by: Thomas Zimmermann <tzimmermann@suse.de>

> index 000000000000..a47b49adba62
> --- /dev/null
> +++ b/include/drm/drm_vram_mm_helper.h
> @@ -0,0 +1,82 @@
> +/* SPDX-License-Identifier: GPL-2.0-or-later */
> +
> +#ifndef DRM_VRAM_MM_HELPER_H
> +#define DRM_VRAM_MM_HELPER_H
> +
> +#include <drm/drm_file.h>
> +#include <drm/drm_ioctl.h>
> +#include <drm/ttm/ttm_bo_driver.h>
> +
> +struct drm_device;
> +
> +/**
> + * struct drm_vram_mm_funcs - Callback functions for &struct drm_vram_mm
> + * @evict_flags:	Provides an implementation for struct \
> +	&ttm_bo_driver.evict_flags
> + * @move_notify:	Provides an implementation for
> + *			struct &ttm_bo_driver.move_notify
> + *
> + * These callback function integrate VRAM MM with TTM buffer objects. New
> + * functions can be added if necessary.
> + */
> +struct drm_vram_mm_funcs {
> +	void (*evict_flags)(struct ttm_buffer_object *bo,
> +			    struct ttm_placement *placement);
> +	void (*move_notify)(struct ttm_buffer_object *bo, bool evict,
> +			    struct ttm_mem_reg *new_mem);
> +};
> +
> +/**
> + * struct drm_vram_mm - An instance of VRAM MM
> + * @vram_base:	Base address of the managed video memory
> + * @vram_size:	Size of the managed video memory in bytes
> + * @bdev:	The TTM BO device.
> + * @funcs:	TTM BO functions
> + *
> + * The fields &struct drm_vram_mm.vram_base and
> + * &struct drm_vram_mm.vrm_size are managed by VRAM MM, but are
> + * available for public read access. Use the field
> + * &struct drm_vram_mm.bdev to access the TTM BO device.
> + */
> +struct drm_vram_mm {
> +	uint64_t vram_base;
> +	size_t vram_size;
> +
> +	struct ttm_bo_device bdev;
> +
> +	const struct drm_vram_mm_funcs *funcs;
> +};
> +
> +/**
> + * drm_vram_mm_of_bdev() - \
> +	Returns the container of type &struct ttm_bo_device for field bdev.
> + * @bdev:	the TTM BO device
> + *
> + * Returns:
> + * The containing instance of &struct drm_vram_mm
> + */
> +static inline struct drm_vram_mm *drm_vram_mm_of_bdev(
> +	struct ttm_bo_device *bdev)
> +{
> +	return container_of(bdev, struct drm_vram_mm, bdev);
> +}
> +
> +int drm_vram_mm_debugfs_init(struct drm_minor *minor);
> +int drm_vram_mm_init(struct drm_vram_mm *vmm, struct drm_device *dev,
> +		     uint64_t vram_base, size_t vram_size,
> +		     const struct drm_vram_mm_funcs *funcs);
> +void drm_vram_mm_cleanup(struct drm_vram_mm *vmm);
> +
> +int drm_vram_mm_mmap(struct file *filp, struct vm_area_struct *vma,
> +		     struct drm_vram_mm *vmm);
> +
> +/*
> + * Helpers for integration with struct drm_device
> + */
> +
> +struct drm_vram_mm *drm_vram_helper_alloc_mm(
> +	struct drm_device *dev, uint64_t vram_base, size_t vram_size,
> +	const struct drm_vram_mm_funcs *funcs);
> +void drm_vram_helper_release_mm(struct drm_device *dev);
> +
> +#endif
> diff --git a/drivers/gpu/drm/ast/ast_drv.c b/drivers/gpu/drm/ast/ast_drv.c
> index e0e8770462bc..1f17794b0890 100644
> --- a/drivers/gpu/drm/ast/ast_drv.c
> +++ b/drivers/gpu/drm/ast/ast_drv.c
> @@ -200,10 +200,7 @@ static struct pci_driver ast_pci_driver = {
>  	.driver.pm = &ast_pm_ops,
>  };
>  
> -static const struct file_operations ast_fops = {
> -	.owner = THIS_MODULE,
> -	DRM_VRAM_MM_FILE_OPERATIONS
> -};
> +DEFINE_DRM_GEM_FOPS(ast_fops);
>  
>  static struct drm_driver driver = {
>  	.driver_features = DRIVER_MODESET | DRIVER_GEM,
> diff --git a/drivers/gpu/drm/bochs/bochs_drv.c b/drivers/gpu/drm/bochs/bochs_drv.c
> index 3b9b0d9bbc14..10460878414e 100644
> --- a/drivers/gpu/drm/bochs/bochs_drv.c
> +++ b/drivers/gpu/drm/bochs/bochs_drv.c
> @@ -58,10 +58,7 @@ static int bochs_load(struct drm_device *dev)
>  	return ret;
>  }
>  
> -static const struct file_operations bochs_fops = {
> -	.owner		= THIS_MODULE,
> -	DRM_VRAM_MM_FILE_OPERATIONS
> -};
> +DEFINE_DRM_GEM_FOPS(bochs_fops);
>  
>  static struct drm_driver bochs_driver = {
>  	.driver_features	= DRIVER_GEM | DRIVER_MODESET | DRIVER_ATOMIC,
> diff --git a/drivers/gpu/drm/hisilicon/hibmc/hibmc_drm_drv.c b/drivers/gpu/drm/hisilicon/hibmc/hibmc_drm_drv.c
> index f5b35fdef6f3..b6fdac91e502 100644
> --- a/drivers/gpu/drm/hisilicon/hibmc/hibmc_drm_drv.c
> +++ b/drivers/gpu/drm/hisilicon/hibmc/hibmc_drm_drv.c
> @@ -26,10 +26,7 @@
>  #include "hibmc_drm_drv.h"
>  #include "hibmc_drm_regs.h"
>  
> -static const struct file_operations hibmc_fops = {
> -	.owner		= THIS_MODULE,
> -	DRM_VRAM_MM_FILE_OPERATIONS
> -};
> +DEFINE_DRM_GEM_FOPS(hibmc_fops);
>  
>  static irqreturn_t hibmc_drm_interrupt(int irq, void *arg)
>  {
> diff --git a/drivers/gpu/drm/mgag200/mgag200_drv.c b/drivers/gpu/drm/mgag200/mgag200_drv.c
> index 4f9df3b93598..397f8b0a9af8 100644
> --- a/drivers/gpu/drm/mgag200/mgag200_drv.c
> +++ b/drivers/gpu/drm/mgag200/mgag200_drv.c
> @@ -58,10 +58,7 @@ static void mga_pci_remove(struct pci_dev *pdev)
>  	drm_put_dev(dev);
>  }
>  
> -static const struct file_operations mgag200_driver_fops = {
> -	.owner = THIS_MODULE,
> -	DRM_VRAM_MM_FILE_OPERATIONS
> -};
> +DEFINE_DRM_GEM_FOPS(mgag200_driver_fops);
>  
>  static struct drm_driver driver = {
>  	.driver_features = DRIVER_GEM | DRIVER_MODESET,
> diff --git a/drivers/gpu/drm/vboxvideo/vbox_drv.c b/drivers/gpu/drm/vboxvideo/vbox_drv.c
> index 862db495d111..0c37032c8b65 100644
> --- a/drivers/gpu/drm/vboxvideo/vbox_drv.c
> +++ b/drivers/gpu/drm/vboxvideo/vbox_drv.c
> @@ -189,10 +189,7 @@ static struct pci_driver vbox_pci_driver = {
>  #endif
>  };
>  
> -static const struct file_operations vbox_fops = {
> -	.owner = THIS_MODULE,
> -	DRM_VRAM_MM_FILE_OPERATIONS
> -};
> +DEFINE_DRM_GEM_FOPS(vbox_fops);
>  
>  static struct drm_driver driver = {
>  	.driver_features =
> 

-- 
Thomas Zimmermann
Graphics Driver Developer
SUSE Linux GmbH, Maxfeldstrasse 5, 90409 Nuernberg, Germany
GF: Felix Imendörffer, Mary Higgins, Sri Rasiah
HRB 21284 (AG Nürnberg)


[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

  reply	other threads:[~2019-09-13 13:19 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <20190913122908.784-1-kraxel@redhat.com>
2019-09-13 12:29 ` [PATCH 1/8] drm: add mmap() to drm_gem_object_funcs Gerd Hoffmann
2019-09-17 13:27   ` Daniel Vetter
2019-09-13 12:29 ` [PATCH 2/8] drm/shmem: switch shmem helper to &drm_gem_object_funcs.mmap Gerd Hoffmann
2019-09-13 14:03   ` Steven Price
2019-09-17  8:14     ` Gerd Hoffmann
2019-09-13 12:29 ` [PATCH 3/8] drm/shmem: drop DEFINE_DRM_GEM_SHMEM_FOPS Gerd Hoffmann
2019-09-16 22:07   ` Rob Herring
2019-09-17  8:18     ` Gerd Hoffmann
2019-09-13 12:29 ` [PATCH 4/8] drm/ttm: factor out ttm_bo_mmap_vma_setup Gerd Hoffmann
2019-09-13 12:56   ` Thomas Zimmermann
2019-09-17  8:26     ` Gerd Hoffmann
2019-09-13 13:05   ` Thomas Zimmermann
2019-09-17  8:34     ` Gerd Hoffmann
2019-09-17  9:38       ` Thomas Zimmermann
2019-09-17  9:54         ` Gerd Hoffmann
2019-09-13 12:29 ` [PATCH 5/8] drm/ttm: add drm_gem_ttm_mmap() Gerd Hoffmann
2019-09-13 13:02   ` Thomas Zimmermann
2019-09-13 12:29 ` [PATCH 6/8] drm/vram: switch vram helper to &drm_gem_object_funcs.mmap() Gerd Hoffmann
2019-09-13 13:10   ` Thomas Zimmermann
2019-09-13 12:29 ` [PATCH 7/8] drm/vram: drop verify_access Gerd Hoffmann
2019-09-13 13:11   ` Thomas Zimmermann
2019-09-13 12:29 ` [PATCH 8/8] drm/vram: drop DRM_VRAM_MM_FILE_OPERATIONS Gerd Hoffmann
2019-09-13 13:18   ` Thomas Zimmermann [this message]
2019-09-17  8:39     ` Gerd Hoffmann

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=e9712055-c6db-5515-0c11-4d7add138856@suse.de \
    --to=tzimmermann@suse.de \
    --cc=airlied@linux.ie \
    --cc=airlied@redhat.com \
    --cc=daniel.vetter@ffwll.ch \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=hdegoede@redhat.com \
    --cc=kong.kongxinwei@hisilicon.com \
    --cc=kraxel@redhat.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=maxime.ripard@bootlin.com \
    --cc=puck.chen@hisilicon.com \
    --cc=sean@poorly.run \
    --cc=virtualization@lists.linux-foundation.org \
    --cc=z.liuxinliang@hisilicon.com \
    --cc=zourongrong@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).