diff mbox series

[2/3] drm/rockchip: Resolve dependency in GEM DMA helpers

Message ID 20230620121202.28263-3-tzimmermann@suse.de (mailing list archive)
State New, archived
Headers show
Series drm/gem-dma: Remove unnecessary calls | expand

Commit Message

Thomas Zimmermann June 20, 2023, 12:03 p.m. UTC
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(-)

Comments

Jonas Karlman June 20, 2023, 1:56 p.m. UTC | #1
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]
Thomas Zimmermann June 20, 2023, 2:40 p.m. UTC | #2
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]
diff mbox series

Patch

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 *