* [PATCH 0/3] drm/gem-dma: Remove unnecessary calls
@ 2023-06-20 12:03 Thomas Zimmermann
2023-06-20 12:03 ` [PATCH 1/3] drm/rcar-du: Import buffers with GEM DMA's helpers Thomas Zimmermann
` (2 more replies)
0 siblings, 3 replies; 9+ messages in thread
From: Thomas Zimmermann @ 2023-06-20 12:03 UTC (permalink / raw)
To: maarten.lankhorst, mripard, airlied, daniel, laurent.pinchart,
kieran.bingham+renesas, hjc, heiko
Cc: dri-devel, linux-renesas-soc, linux-arm-kernel, linux-rockchip,
Thomas Zimmermann
Remove rockchip's dependency on GEM DMA helpers. Rework the GEM DMA
interface to fit the needs of rcar-du.
This intends to be a cleanup with no functional changes. With the
patches merged, a later patchset can attempt to generate some of the
boiler-plate code for struct drm_gem_object_funcs automatically.
Thomas Zimmermann (3):
drm/rcar-du: Import buffers with GEM DMA's helpers
drm/rockchip: Resolve dependency in GEM DMA helpers
drm/gem-dma: Unexport drm_gem_dma_vm_ops
drivers/gpu/drm/drm_gem_dma_helper.c | 16 ++++-----
drivers/gpu/drm/renesas/rcar-du/rcar_du_kms.c | 33 +++----------------
drivers/gpu/drm/rockchip/Kconfig | 1 -
drivers/gpu/drm/rockchip/rockchip_drm_drv.c | 2 +-
drivers/gpu/drm/rockchip/rockchip_drm_gem.c | 8 +++--
include/drm/drm_gem_dma_helper.h | 5 +--
6 files changed, 22 insertions(+), 43 deletions(-)
base-commit: 32e260cd0d16cee6f33e747679f168d63ea54bf6
--
2.41.0
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
^ permalink raw reply [flat|nested] 9+ messages in thread* [PATCH 1/3] drm/rcar-du: Import buffers with GEM DMA's helpers 2023-06-20 12:03 [PATCH 0/3] drm/gem-dma: Remove unnecessary calls Thomas Zimmermann @ 2023-06-20 12:03 ` Thomas Zimmermann 2023-06-20 16:47 ` Laurent Pinchart 2023-06-20 12:03 ` [PATCH 2/3] drm/rockchip: Resolve dependency in GEM DMA helpers Thomas Zimmermann 2023-06-20 12:03 ` [PATCH 3/3] drm/gem-dma: Unexport drm_gem_dma_vm_ops Thomas Zimmermann 2 siblings, 1 reply; 9+ messages in thread From: Thomas Zimmermann @ 2023-06-20 12:03 UTC (permalink / raw) To: maarten.lankhorst, mripard, airlied, daniel, laurent.pinchart, kieran.bingham+renesas, hjc, heiko Cc: dri-devel, linux-renesas-soc, linux-arm-kernel, linux-rockchip, Thomas Zimmermann Call __drm_gem_dma_create() to create an object for imported buffers, instead of reimplementing the function within the driver. Reduces code duplication and will later allow to un-export a number of symbols from the GEM DMA helpers. Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de> --- drivers/gpu/drm/drm_gem_dma_helper.c | 5 +-- drivers/gpu/drm/renesas/rcar-du/rcar_du_kms.c | 33 +++---------------- include/drm/drm_gem_dma_helper.h | 3 ++ 3 files changed, 10 insertions(+), 31 deletions(-) diff --git a/drivers/gpu/drm/drm_gem_dma_helper.c b/drivers/gpu/drm/drm_gem_dma_helper.c index 870b90b78bc4e..e9aa3ac140654 100644 --- a/drivers/gpu/drm/drm_gem_dma_helper.c +++ b/drivers/gpu/drm/drm_gem_dma_helper.c @@ -67,8 +67,8 @@ static const struct drm_gem_object_funcs drm_gem_dma_default_funcs = { * A struct drm_gem_dma_object * on success or an ERR_PTR()-encoded negative * error code on failure. */ -static struct drm_gem_dma_object * -__drm_gem_dma_create(struct drm_device *drm, size_t size, bool private) +struct drm_gem_dma_object *__drm_gem_dma_create(struct drm_device *drm, + size_t size, bool private) { struct drm_gem_dma_object *dma_obj; struct drm_gem_object *gem_obj; @@ -112,6 +112,7 @@ __drm_gem_dma_create(struct drm_device *drm, size_t size, bool private) kfree(dma_obj); return ERR_PTR(ret); } +EXPORT_SYMBOL_GPL(__drm_gem_dma_create); /** * drm_gem_dma_create - allocate an object with the given size diff --git a/drivers/gpu/drm/renesas/rcar-du/rcar_du_kms.c b/drivers/gpu/drm/renesas/rcar-du/rcar_du_kms.c index adfb36b0e8154..ea7487e270f13 100644 --- a/drivers/gpu/drm/renesas/rcar-du/rcar_du_kms.c +++ b/drivers/gpu/drm/renesas/rcar-du/rcar_du_kms.c @@ -356,49 +356,24 @@ const struct rcar_du_format_info *rcar_du_format_info(u32 fourcc) * Frame buffer */ -static const struct drm_gem_object_funcs rcar_du_gem_funcs = { - .free = drm_gem_dma_object_free, - .print_info = drm_gem_dma_object_print_info, - .get_sg_table = drm_gem_dma_object_get_sg_table, - .vmap = drm_gem_dma_object_vmap, - .mmap = drm_gem_dma_object_mmap, - .vm_ops = &drm_gem_dma_vm_ops, -}; - struct drm_gem_object *rcar_du_gem_prime_import_sg_table(struct drm_device *dev, struct dma_buf_attachment *attach, struct sg_table *sgt) { struct rcar_du_device *rcdu = to_rcar_du_device(dev); struct drm_gem_dma_object *dma_obj; - struct drm_gem_object *gem_obj; - int ret; if (!rcar_du_has(rcdu, RCAR_DU_FEATURE_VSP1_SOURCE)) return drm_gem_dma_prime_import_sg_table(dev, attach, sgt); - /* Create a DMA GEM buffer. */ - dma_obj = kzalloc(sizeof(*dma_obj), GFP_KERNEL); - if (!dma_obj) - return ERR_PTR(-ENOMEM); - - gem_obj = &dma_obj->base; - gem_obj->funcs = &rcar_du_gem_funcs; - - drm_gem_private_object_init(dev, gem_obj, attach->dmabuf->size); - dma_obj->map_noncoherent = false; - - ret = drm_gem_create_mmap_offset(gem_obj); - if (ret) { - drm_gem_object_release(gem_obj); - kfree(dma_obj); - return ERR_PTR(ret); - } + dma_obj = __drm_gem_dma_create(dev, attach->dmabuf->size, true); + if (IS_ERR(dma_obj)) + return ERR_CAST(dma_obj); dma_obj->dma_addr = 0; dma_obj->sgt = sgt; - return gem_obj; + return &dma_obj->base; } int rcar_du_dumb_create(struct drm_file *file, struct drm_device *dev, diff --git a/include/drm/drm_gem_dma_helper.h b/include/drm/drm_gem_dma_helper.h index 61da596780b64..3877cbf0e927c 100644 --- a/include/drm/drm_gem_dma_helper.h +++ b/include/drm/drm_gem_dma_helper.h @@ -32,6 +32,9 @@ struct drm_gem_dma_object { #define to_drm_gem_dma_obj(gem_obj) \ container_of(gem_obj, struct drm_gem_dma_object, base) +struct drm_gem_dma_object *__drm_gem_dma_create(struct drm_device *drm, + size_t size, bool private); + struct drm_gem_dma_object *drm_gem_dma_create(struct drm_device *drm, size_t size); void drm_gem_dma_free(struct drm_gem_dma_object *dma_obj); -- 2.41.0 _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel ^ permalink raw reply related [flat|nested] 9+ messages in thread
* Re: [PATCH 1/3] drm/rcar-du: Import buffers with GEM DMA's helpers 2023-06-20 12:03 ` [PATCH 1/3] drm/rcar-du: Import buffers with GEM DMA's helpers Thomas Zimmermann @ 2023-06-20 16:47 ` Laurent Pinchart 2023-06-21 8:05 ` Thomas Zimmermann 0 siblings, 1 reply; 9+ messages in thread From: Laurent Pinchart @ 2023-06-20 16:47 UTC (permalink / raw) To: Thomas Zimmermann Cc: maarten.lankhorst, mripard, airlied, daniel, kieran.bingham+renesas, hjc, heiko, dri-devel, linux-renesas-soc, linux-arm-kernel, linux-rockchip Hi Thomas, Thank you for the patch. On Tue, Jun 20, 2023 at 02:03:21PM +0200, Thomas Zimmermann wrote: > Call __drm_gem_dma_create() to create an object for imported buffers, > instead of reimplementing the function within the driver. Reduces > code duplication and will later allow to un-export a number of symbols > from the GEM DMA helpers. > > Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de> Nice simplification. Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> I assume you'll merge the whole series through drm-misc, please let me know if that's not correct. > --- > drivers/gpu/drm/drm_gem_dma_helper.c | 5 +-- > drivers/gpu/drm/renesas/rcar-du/rcar_du_kms.c | 33 +++---------------- > include/drm/drm_gem_dma_helper.h | 3 ++ > 3 files changed, 10 insertions(+), 31 deletions(-) > > diff --git a/drivers/gpu/drm/drm_gem_dma_helper.c b/drivers/gpu/drm/drm_gem_dma_helper.c > index 870b90b78bc4e..e9aa3ac140654 100644 > --- a/drivers/gpu/drm/drm_gem_dma_helper.c > +++ b/drivers/gpu/drm/drm_gem_dma_helper.c > @@ -67,8 +67,8 @@ static const struct drm_gem_object_funcs drm_gem_dma_default_funcs = { > * A struct drm_gem_dma_object * on success or an ERR_PTR()-encoded negative > * error code on failure. > */ > -static struct drm_gem_dma_object * > -__drm_gem_dma_create(struct drm_device *drm, size_t size, bool private) > +struct drm_gem_dma_object *__drm_gem_dma_create(struct drm_device *drm, > + size_t size, bool private) > { > struct drm_gem_dma_object *dma_obj; > struct drm_gem_object *gem_obj; > @@ -112,6 +112,7 @@ __drm_gem_dma_create(struct drm_device *drm, size_t size, bool private) > kfree(dma_obj); > return ERR_PTR(ret); > } > +EXPORT_SYMBOL_GPL(__drm_gem_dma_create); > > /** > * drm_gem_dma_create - allocate an object with the given size > diff --git a/drivers/gpu/drm/renesas/rcar-du/rcar_du_kms.c b/drivers/gpu/drm/renesas/rcar-du/rcar_du_kms.c > index adfb36b0e8154..ea7487e270f13 100644 > --- a/drivers/gpu/drm/renesas/rcar-du/rcar_du_kms.c > +++ b/drivers/gpu/drm/renesas/rcar-du/rcar_du_kms.c > @@ -356,49 +356,24 @@ const struct rcar_du_format_info *rcar_du_format_info(u32 fourcc) > * Frame buffer > */ > > -static const struct drm_gem_object_funcs rcar_du_gem_funcs = { > - .free = drm_gem_dma_object_free, > - .print_info = drm_gem_dma_object_print_info, > - .get_sg_table = drm_gem_dma_object_get_sg_table, > - .vmap = drm_gem_dma_object_vmap, > - .mmap = drm_gem_dma_object_mmap, > - .vm_ops = &drm_gem_dma_vm_ops, > -}; > - > struct drm_gem_object *rcar_du_gem_prime_import_sg_table(struct drm_device *dev, > struct dma_buf_attachment *attach, > struct sg_table *sgt) > { > struct rcar_du_device *rcdu = to_rcar_du_device(dev); > struct drm_gem_dma_object *dma_obj; > - struct drm_gem_object *gem_obj; > - int ret; > > if (!rcar_du_has(rcdu, RCAR_DU_FEATURE_VSP1_SOURCE)) > return drm_gem_dma_prime_import_sg_table(dev, attach, sgt); > > - /* Create a DMA GEM buffer. */ > - dma_obj = kzalloc(sizeof(*dma_obj), GFP_KERNEL); > - if (!dma_obj) > - return ERR_PTR(-ENOMEM); > - > - gem_obj = &dma_obj->base; > - gem_obj->funcs = &rcar_du_gem_funcs; > - > - drm_gem_private_object_init(dev, gem_obj, attach->dmabuf->size); > - dma_obj->map_noncoherent = false; > - > - ret = drm_gem_create_mmap_offset(gem_obj); > - if (ret) { > - drm_gem_object_release(gem_obj); > - kfree(dma_obj); > - return ERR_PTR(ret); > - } > + dma_obj = __drm_gem_dma_create(dev, attach->dmabuf->size, true); > + if (IS_ERR(dma_obj)) > + return ERR_CAST(dma_obj); > > dma_obj->dma_addr = 0; > dma_obj->sgt = sgt; > > - return gem_obj; > + return &dma_obj->base; > } > > int rcar_du_dumb_create(struct drm_file *file, struct drm_device *dev, > diff --git a/include/drm/drm_gem_dma_helper.h b/include/drm/drm_gem_dma_helper.h > index 61da596780b64..3877cbf0e927c 100644 > --- a/include/drm/drm_gem_dma_helper.h > +++ b/include/drm/drm_gem_dma_helper.h > @@ -32,6 +32,9 @@ struct drm_gem_dma_object { > #define to_drm_gem_dma_obj(gem_obj) \ > container_of(gem_obj, struct drm_gem_dma_object, base) > > +struct drm_gem_dma_object *__drm_gem_dma_create(struct drm_device *drm, > + size_t size, bool private); > + > struct drm_gem_dma_object *drm_gem_dma_create(struct drm_device *drm, > size_t size); > void drm_gem_dma_free(struct drm_gem_dma_object *dma_obj); -- Regards, Laurent Pinchart _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel ^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH 1/3] drm/rcar-du: Import buffers with GEM DMA's helpers 2023-06-20 16:47 ` Laurent Pinchart @ 2023-06-21 8:05 ` Thomas Zimmermann 0 siblings, 0 replies; 9+ messages in thread From: Thomas Zimmermann @ 2023-06-21 8:05 UTC (permalink / raw) To: Laurent Pinchart Cc: hjc, mripard, linux-renesas-soc, linux-rockchip, kieran.bingham+renesas, dri-devel, linux-arm-kernel [-- Attachment #1.1.1: Type: text/plain, Size: 5112 bytes --] Hi Am 20.06.23 um 18:47 schrieb Laurent Pinchart: > Hi Thomas, > > Thank you for the patch. > > > On Tue, Jun 20, 2023 at 02:03:21PM +0200, Thomas Zimmermann wrote: >> Call __drm_gem_dma_create() to create an object for imported buffers, >> instead of reimplementing the function within the driver. Reduces >> code duplication and will later allow to un-export a number of symbols >> from the GEM DMA helpers. >> >> Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de> > > Nice simplification. > > Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> > > I assume you'll merge the whole series through drm-misc, please let me > know if that's not correct. Thanks for the reviews. The patchset can hopefully go through drm-misc-next. Best regards Thomas > >> --- >> drivers/gpu/drm/drm_gem_dma_helper.c | 5 +-- >> drivers/gpu/drm/renesas/rcar-du/rcar_du_kms.c | 33 +++---------------- >> include/drm/drm_gem_dma_helper.h | 3 ++ >> 3 files changed, 10 insertions(+), 31 deletions(-) >> >> diff --git a/drivers/gpu/drm/drm_gem_dma_helper.c b/drivers/gpu/drm/drm_gem_dma_helper.c >> index 870b90b78bc4e..e9aa3ac140654 100644 >> --- a/drivers/gpu/drm/drm_gem_dma_helper.c >> +++ b/drivers/gpu/drm/drm_gem_dma_helper.c >> @@ -67,8 +67,8 @@ static const struct drm_gem_object_funcs drm_gem_dma_default_funcs = { >> * A struct drm_gem_dma_object * on success or an ERR_PTR()-encoded negative >> * error code on failure. >> */ >> -static struct drm_gem_dma_object * >> -__drm_gem_dma_create(struct drm_device *drm, size_t size, bool private) >> +struct drm_gem_dma_object *__drm_gem_dma_create(struct drm_device *drm, >> + size_t size, bool private) >> { >> struct drm_gem_dma_object *dma_obj; >> struct drm_gem_object *gem_obj; >> @@ -112,6 +112,7 @@ __drm_gem_dma_create(struct drm_device *drm, size_t size, bool private) >> kfree(dma_obj); >> return ERR_PTR(ret); >> } >> +EXPORT_SYMBOL_GPL(__drm_gem_dma_create); >> >> /** >> * drm_gem_dma_create - allocate an object with the given size >> diff --git a/drivers/gpu/drm/renesas/rcar-du/rcar_du_kms.c b/drivers/gpu/drm/renesas/rcar-du/rcar_du_kms.c >> index adfb36b0e8154..ea7487e270f13 100644 >> --- a/drivers/gpu/drm/renesas/rcar-du/rcar_du_kms.c >> +++ b/drivers/gpu/drm/renesas/rcar-du/rcar_du_kms.c >> @@ -356,49 +356,24 @@ const struct rcar_du_format_info *rcar_du_format_info(u32 fourcc) >> * Frame buffer >> */ >> >> -static const struct drm_gem_object_funcs rcar_du_gem_funcs = { >> - .free = drm_gem_dma_object_free, >> - .print_info = drm_gem_dma_object_print_info, >> - .get_sg_table = drm_gem_dma_object_get_sg_table, >> - .vmap = drm_gem_dma_object_vmap, >> - .mmap = drm_gem_dma_object_mmap, >> - .vm_ops = &drm_gem_dma_vm_ops, >> -}; >> - >> struct drm_gem_object *rcar_du_gem_prime_import_sg_table(struct drm_device *dev, >> struct dma_buf_attachment *attach, >> struct sg_table *sgt) >> { >> struct rcar_du_device *rcdu = to_rcar_du_device(dev); >> struct drm_gem_dma_object *dma_obj; >> - struct drm_gem_object *gem_obj; >> - int ret; >> >> if (!rcar_du_has(rcdu, RCAR_DU_FEATURE_VSP1_SOURCE)) >> return drm_gem_dma_prime_import_sg_table(dev, attach, sgt); >> >> - /* Create a DMA GEM buffer. */ >> - dma_obj = kzalloc(sizeof(*dma_obj), GFP_KERNEL); >> - if (!dma_obj) >> - return ERR_PTR(-ENOMEM); >> - >> - gem_obj = &dma_obj->base; >> - gem_obj->funcs = &rcar_du_gem_funcs; >> - >> - drm_gem_private_object_init(dev, gem_obj, attach->dmabuf->size); >> - dma_obj->map_noncoherent = false; >> - >> - ret = drm_gem_create_mmap_offset(gem_obj); >> - if (ret) { >> - drm_gem_object_release(gem_obj); >> - kfree(dma_obj); >> - return ERR_PTR(ret); >> - } >> + dma_obj = __drm_gem_dma_create(dev, attach->dmabuf->size, true); >> + if (IS_ERR(dma_obj)) >> + return ERR_CAST(dma_obj); >> >> dma_obj->dma_addr = 0; >> dma_obj->sgt = sgt; >> >> - return gem_obj; >> + return &dma_obj->base; >> } >> >> int rcar_du_dumb_create(struct drm_file *file, struct drm_device *dev, >> diff --git a/include/drm/drm_gem_dma_helper.h b/include/drm/drm_gem_dma_helper.h >> index 61da596780b64..3877cbf0e927c 100644 >> --- a/include/drm/drm_gem_dma_helper.h >> +++ b/include/drm/drm_gem_dma_helper.h >> @@ -32,6 +32,9 @@ struct drm_gem_dma_object { >> #define to_drm_gem_dma_obj(gem_obj) \ >> container_of(gem_obj, struct drm_gem_dma_object, base) >> >> +struct drm_gem_dma_object *__drm_gem_dma_create(struct drm_device *drm, >> + size_t size, bool private); >> + >> struct drm_gem_dma_object *drm_gem_dma_create(struct drm_device *drm, >> size_t size); >> void drm_gem_dma_free(struct drm_gem_dma_object *dma_obj); > -- Thomas Zimmermann Graphics Driver Developer SUSE Software Solutions Germany GmbH Frankenstrasse 146, 90461 Nuernberg, Germany GF: Ivo Totev, Andrew Myers, Andrew McDonald, Boudien Moerman HRB 36809 (AG Nuernberg) [-- Attachment #1.2: OpenPGP digital signature --] [-- Type: application/pgp-signature, Size: 840 bytes --] [-- Attachment #2: Type: text/plain, Size: 176 bytes --] _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel ^ permalink raw reply [flat|nested] 9+ messages in thread
* [PATCH 2/3] drm/rockchip: Resolve dependency in GEM DMA helpers 2023-06-20 12:03 [PATCH 0/3] drm/gem-dma: Remove unnecessary calls Thomas Zimmermann 2023-06-20 12:03 ` [PATCH 1/3] drm/rcar-du: Import buffers with GEM DMA's helpers Thomas Zimmermann @ 2023-06-20 12:03 ` Thomas Zimmermann 2023-06-20 13:56 ` Jonas Karlman 2023-06-20 12:03 ` [PATCH 3/3] drm/gem-dma: Unexport drm_gem_dma_vm_ops Thomas Zimmermann 2 siblings, 1 reply; 9+ messages in thread From: Thomas Zimmermann @ 2023-06-20 12:03 UTC (permalink / raw) To: maarten.lankhorst, mripard, airlied, daniel, laurent.pinchart, kieran.bingham+renesas, hjc, heiko Cc: dri-devel, linux-renesas-soc, linux-arm-kernel, linux-rockchip, Thomas Zimmermann Remove the dependency on the GEM DMA helper library. Rockchip comes with its own implementation of the GEM interface. It only uses the VM callbacks in drm_gem_dma_vm_ops from the GEM DMA helpers. These are not DMA specific. Duplicate drm_gem_dma_vm_ops in rockchip and remove all dependencies on the GEM DMA helper library. Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de> --- drivers/gpu/drm/rockchip/Kconfig | 1 - drivers/gpu/drm/rockchip/rockchip_drm_drv.c | 2 +- drivers/gpu/drm/rockchip/rockchip_drm_gem.c | 8 ++++++-- 3 files changed, 7 insertions(+), 4 deletions(-) diff --git a/drivers/gpu/drm/rockchip/Kconfig b/drivers/gpu/drm/rockchip/Kconfig index 1bf3e2829cd07..5f49cd0210e6b 100644 --- a/drivers/gpu/drm/rockchip/Kconfig +++ b/drivers/gpu/drm/rockchip/Kconfig @@ -2,7 +2,6 @@ config DRM_ROCKCHIP tristate "DRM Support for Rockchip" depends on DRM && ROCKCHIP_IOMMU - select DRM_GEM_DMA_HELPER select DRM_KMS_HELPER select DRM_PANEL select VIDEOMODE_HELPERS diff --git a/drivers/gpu/drm/rockchip/rockchip_drm_drv.c b/drivers/gpu/drm/rockchip/rockchip_drm_drv.c index b8cf89f0cc566..b090b8abb6637 100644 --- a/drivers/gpu/drm/rockchip/rockchip_drm_drv.c +++ b/drivers/gpu/drm/rockchip/rockchip_drm_drv.c @@ -18,7 +18,7 @@ #include <drm/drm_aperture.h> #include <drm/drm_drv.h> #include <drm/drm_fbdev_generic.h> -#include <drm/drm_gem_dma_helper.h> +#include <drm/drm_ioctl.h> #include <drm/drm_of.h> #include <drm/drm_probe_helper.h> #include <drm/drm_vblank.h> diff --git a/drivers/gpu/drm/rockchip/rockchip_drm_gem.c b/drivers/gpu/drm/rockchip/rockchip_drm_gem.c index b8f8b45ebf594..acb6f122a2dca 100644 --- a/drivers/gpu/drm/rockchip/rockchip_drm_gem.c +++ b/drivers/gpu/drm/rockchip/rockchip_drm_gem.c @@ -11,13 +11,17 @@ #include <drm/drm.h> #include <drm/drm_fb_helper.h> #include <drm/drm_gem.h> -#include <drm/drm_gem_dma_helper.h> #include <drm/drm_prime.h> #include <drm/drm_vma_manager.h> #include "rockchip_drm_drv.h" #include "rockchip_drm_gem.h" +static const struct vm_operations_struct rockchip_gem_vm_ops = { + .open = drm_gem_vm_open, + .close = drm_gem_vm_close, +}; + static int rockchip_gem_iommu_map(struct rockchip_gem_object *rk_obj) { struct drm_device *drm = rk_obj->base.dev; @@ -276,7 +280,7 @@ static const struct drm_gem_object_funcs rockchip_gem_object_funcs = { .vmap = rockchip_gem_prime_vmap, .vunmap = rockchip_gem_prime_vunmap, .mmap = rockchip_drm_gem_object_mmap, - .vm_ops = &drm_gem_dma_vm_ops, + .vm_ops = &rockchip_gem_vm_ops, }; static struct rockchip_gem_object * -- 2.41.0 _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel ^ permalink raw reply related [flat|nested] 9+ messages in thread
* Re: [PATCH 2/3] drm/rockchip: Resolve dependency in GEM DMA helpers 2023-06-20 12:03 ` [PATCH 2/3] drm/rockchip: Resolve dependency in GEM DMA helpers Thomas Zimmermann @ 2023-06-20 13:56 ` Jonas Karlman 2023-06-20 14:40 ` Thomas Zimmermann 0 siblings, 1 reply; 9+ messages in thread From: Jonas Karlman @ 2023-06-20 13:56 UTC (permalink / raw) To: Thomas Zimmermann, maarten.lankhorst, mripard, airlied, daniel, laurent.pinchart, kieran.bingham+renesas, hjc, heiko Cc: linux-renesas-soc, linux-rockchip, linux-arm-kernel, dri-devel Hi Thomas, On 2023-06-20 14:03, Thomas Zimmermann wrote: > Remove the dependency on the GEM DMA helper library. Rockchip comes > with its own implementation of the GEM interface. It only uses the VM > callbacks in drm_gem_dma_vm_ops from the GEM DMA helpers. These are > not DMA specific. > > Duplicate drm_gem_dma_vm_ops in rockchip and remove all dependencies on > the GEM DMA helper library. I have intentions to remove the entire custom implementation of the GEM interface and replace it with use of GEM DMA helpers in a future series. Current custom implementation break import of video framebuffers located in memory beyond 4GB. Switching to use pure GEM DMA helpers solved that issue but requires reworking IOMMU integration for full support of multiple VOPs on e.g., RK3288 and RK3399. I have no ETA on when such series can be ready so this is more of a heads up that I will revert this removal of dependency on GEM DMA helper library in a future series. Regards, Jonas > > Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de> > --- > drivers/gpu/drm/rockchip/Kconfig | 1 - > drivers/gpu/drm/rockchip/rockchip_drm_drv.c | 2 +- > drivers/gpu/drm/rockchip/rockchip_drm_gem.c | 8 ++++++-- > 3 files changed, 7 insertions(+), 4 deletions(-) > [snip] _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel ^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH 2/3] drm/rockchip: Resolve dependency in GEM DMA helpers 2023-06-20 13:56 ` Jonas Karlman @ 2023-06-20 14:40 ` Thomas Zimmermann 0 siblings, 0 replies; 9+ messages in thread From: Thomas Zimmermann @ 2023-06-20 14:40 UTC (permalink / raw) To: Jonas Karlman, maarten.lankhorst, mripard, airlied, daniel, laurent.pinchart, kieran.bingham+renesas, hjc, heiko Cc: linux-renesas-soc, linux-rockchip, linux-arm-kernel, dri-devel [-- Attachment #1.1.1: Type: text/plain, Size: 1799 bytes --] Hi Am 20.06.23 um 15:56 schrieb Jonas Karlman: > Hi Thomas, > > On 2023-06-20 14:03, Thomas Zimmermann wrote: >> Remove the dependency on the GEM DMA helper library. Rockchip comes >> with its own implementation of the GEM interface. It only uses the VM >> callbacks in drm_gem_dma_vm_ops from the GEM DMA helpers. These are >> not DMA specific. >> >> Duplicate drm_gem_dma_vm_ops in rockchip and remove all dependencies on >> the GEM DMA helper library. > > I have intentions to remove the entire custom implementation of the GEM > interface and replace it with use of GEM DMA helpers in a future series. > > Current custom implementation break import of video framebuffers located > in memory beyond 4GB. Switching to use pure GEM DMA helpers solved that > issue but requires reworking IOMMU integration for full support of > multiple VOPs on e.g., RK3288 and RK3399. > > I have no ETA on when such series can be ready so this is more of a > heads up that I will revert this removal of dependency on GEM DMA helper > library in a future series. No problem. I'm only interested in cleaning up the current interfaces. Rockchip can easily switch to real GEM DMA code. Best regards Thomas > > Regards, > Jonas > >> >> Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de> >> --- >> drivers/gpu/drm/rockchip/Kconfig | 1 - >> drivers/gpu/drm/rockchip/rockchip_drm_drv.c | 2 +- >> drivers/gpu/drm/rockchip/rockchip_drm_gem.c | 8 ++++++-- >> 3 files changed, 7 insertions(+), 4 deletions(-) >> > [snip] -- Thomas Zimmermann Graphics Driver Developer SUSE Software Solutions Germany GmbH Frankenstrasse 146, 90461 Nuernberg, Germany GF: Ivo Totev, Andrew Myers, Andrew McDonald, Boudien Moerman HRB 36809 (AG Nuernberg) [-- Attachment #1.2: OpenPGP digital signature --] [-- Type: application/pgp-signature, Size: 840 bytes --] [-- Attachment #2: Type: text/plain, Size: 176 bytes --] _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel ^ permalink raw reply [flat|nested] 9+ messages in thread
* [PATCH 3/3] drm/gem-dma: Unexport drm_gem_dma_vm_ops 2023-06-20 12:03 [PATCH 0/3] drm/gem-dma: Remove unnecessary calls Thomas Zimmermann 2023-06-20 12:03 ` [PATCH 1/3] drm/rcar-du: Import buffers with GEM DMA's helpers Thomas Zimmermann 2023-06-20 12:03 ` [PATCH 2/3] drm/rockchip: Resolve dependency in GEM DMA helpers Thomas Zimmermann @ 2023-06-20 12:03 ` Thomas Zimmermann 2023-06-20 16:48 ` Laurent Pinchart 2 siblings, 1 reply; 9+ messages in thread From: Thomas Zimmermann @ 2023-06-20 12:03 UTC (permalink / raw) To: maarten.lankhorst, mripard, airlied, daniel, laurent.pinchart, kieran.bingham+renesas, hjc, heiko Cc: dri-devel, linux-renesas-soc, linux-arm-kernel, linux-rockchip, Thomas Zimmermann There are no external users of drm_gem_dma_vm_ops. Unexport the symbol. Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de> --- drivers/gpu/drm/drm_gem_dma_helper.c | 11 +++++------ include/drm/drm_gem_dma_helper.h | 2 -- 2 files changed, 5 insertions(+), 8 deletions(-) diff --git a/drivers/gpu/drm/drm_gem_dma_helper.c b/drivers/gpu/drm/drm_gem_dma_helper.c index e9aa3ac140654..d8a415c3d156c 100644 --- a/drivers/gpu/drm/drm_gem_dma_helper.c +++ b/drivers/gpu/drm/drm_gem_dma_helper.c @@ -45,6 +45,11 @@ * drm_gem_dma_vmap()). These helpers perform the necessary type conversion. */ +static const struct vm_operations_struct drm_gem_dma_vm_ops = { + .open = drm_gem_vm_open, + .close = drm_gem_vm_close, +}; + static const struct drm_gem_object_funcs drm_gem_dma_default_funcs = { .free = drm_gem_dma_object_free, .print_info = drm_gem_dma_object_print_info, @@ -315,12 +320,6 @@ int drm_gem_dma_dumb_create(struct drm_file *file_priv, } EXPORT_SYMBOL_GPL(drm_gem_dma_dumb_create); -const struct vm_operations_struct drm_gem_dma_vm_ops = { - .open = drm_gem_vm_open, - .close = drm_gem_vm_close, -}; -EXPORT_SYMBOL_GPL(drm_gem_dma_vm_ops); - #ifndef CONFIG_MMU /** * drm_gem_dma_get_unmapped_area - propose address for mapping in noMMU cases diff --git a/include/drm/drm_gem_dma_helper.h b/include/drm/drm_gem_dma_helper.h index 3877cbf0e927c..88a810f954fce 100644 --- a/include/drm/drm_gem_dma_helper.h +++ b/include/drm/drm_gem_dma_helper.h @@ -45,8 +45,6 @@ int drm_gem_dma_vmap(struct drm_gem_dma_object *dma_obj, struct iosys_map *map); int drm_gem_dma_mmap(struct drm_gem_dma_object *dma_obj, struct vm_area_struct *vma); -extern const struct vm_operations_struct drm_gem_dma_vm_ops; - /* * GEM object functions */ -- 2.41.0 _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel ^ permalink raw reply related [flat|nested] 9+ messages in thread
* Re: [PATCH 3/3] drm/gem-dma: Unexport drm_gem_dma_vm_ops 2023-06-20 12:03 ` [PATCH 3/3] drm/gem-dma: Unexport drm_gem_dma_vm_ops Thomas Zimmermann @ 2023-06-20 16:48 ` Laurent Pinchart 0 siblings, 0 replies; 9+ messages in thread From: Laurent Pinchart @ 2023-06-20 16:48 UTC (permalink / raw) To: Thomas Zimmermann Cc: maarten.lankhorst, mripard, airlied, daniel, kieran.bingham+renesas, hjc, heiko, dri-devel, linux-renesas-soc, linux-arm-kernel, linux-rockchip Hi Thomas, Thank you for the patch. On Tue, Jun 20, 2023 at 02:03:23PM +0200, Thomas Zimmermann wrote: > There are no external users of drm_gem_dma_vm_ops. Unexport the symbol. > > Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de> Reviewed-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com> > --- > drivers/gpu/drm/drm_gem_dma_helper.c | 11 +++++------ > include/drm/drm_gem_dma_helper.h | 2 -- > 2 files changed, 5 insertions(+), 8 deletions(-) > > diff --git a/drivers/gpu/drm/drm_gem_dma_helper.c b/drivers/gpu/drm/drm_gem_dma_helper.c > index e9aa3ac140654..d8a415c3d156c 100644 > --- a/drivers/gpu/drm/drm_gem_dma_helper.c > +++ b/drivers/gpu/drm/drm_gem_dma_helper.c > @@ -45,6 +45,11 @@ > * drm_gem_dma_vmap()). These helpers perform the necessary type conversion. > */ > > +static const struct vm_operations_struct drm_gem_dma_vm_ops = { > + .open = drm_gem_vm_open, > + .close = drm_gem_vm_close, > +}; > + > static const struct drm_gem_object_funcs drm_gem_dma_default_funcs = { > .free = drm_gem_dma_object_free, > .print_info = drm_gem_dma_object_print_info, > @@ -315,12 +320,6 @@ int drm_gem_dma_dumb_create(struct drm_file *file_priv, > } > EXPORT_SYMBOL_GPL(drm_gem_dma_dumb_create); > > -const struct vm_operations_struct drm_gem_dma_vm_ops = { > - .open = drm_gem_vm_open, > - .close = drm_gem_vm_close, > -}; > -EXPORT_SYMBOL_GPL(drm_gem_dma_vm_ops); > - > #ifndef CONFIG_MMU > /** > * drm_gem_dma_get_unmapped_area - propose address for mapping in noMMU cases > diff --git a/include/drm/drm_gem_dma_helper.h b/include/drm/drm_gem_dma_helper.h > index 3877cbf0e927c..88a810f954fce 100644 > --- a/include/drm/drm_gem_dma_helper.h > +++ b/include/drm/drm_gem_dma_helper.h > @@ -45,8 +45,6 @@ int drm_gem_dma_vmap(struct drm_gem_dma_object *dma_obj, > struct iosys_map *map); > int drm_gem_dma_mmap(struct drm_gem_dma_object *dma_obj, struct vm_area_struct *vma); > > -extern const struct vm_operations_struct drm_gem_dma_vm_ops; > - > /* > * GEM object functions > */ -- Regards, Laurent Pinchart _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel ^ permalink raw reply [flat|nested] 9+ messages in thread
end of thread, other threads:[~2023-06-21 8:05 UTC | newest] Thread overview: 9+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2023-06-20 12:03 [PATCH 0/3] drm/gem-dma: Remove unnecessary calls Thomas Zimmermann 2023-06-20 12:03 ` [PATCH 1/3] drm/rcar-du: Import buffers with GEM DMA's helpers Thomas Zimmermann 2023-06-20 16:47 ` Laurent Pinchart 2023-06-21 8:05 ` Thomas Zimmermann 2023-06-20 12:03 ` [PATCH 2/3] drm/rockchip: Resolve dependency in GEM DMA helpers Thomas Zimmermann 2023-06-20 13:56 ` Jonas Karlman 2023-06-20 14:40 ` Thomas Zimmermann 2023-06-20 12:03 ` [PATCH 3/3] drm/gem-dma: Unexport drm_gem_dma_vm_ops Thomas Zimmermann 2023-06-20 16:48 ` Laurent Pinchart
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).