Skip to contentSkip to conversation

drm/dma-helper: Add dedicated fbdev emulation

PATCH Applied Thomas Zimmermann 2 participants 30 messages Mar 13, 2023 – Mar 14, 2023

Subsystems (31)
lore
Share & tools
lore

Thomas Zimmermann

author maintainer
#0 lore raw

v2 cover drm/dma-helper: Add dedicated fbdev emulation

Add fbdev emulation that is optimized for DMA helpers, as used by most drivers. It operates directly on GEM DMA buffers in system memory. Memory pages are mmap'ed directly to userspace. No implicit shadow buffers need to be allocated; as can happen with the generic fbdev emulation. Convert drivers that fulfil the requirements.

Tested with fbcon and IGT on vc4.

Future direction: providing a dedicated fbdev emulation for GEM DMA helpers will allow us to remove this case from the generic fbdev code. The latter can then be simplified.

v2:
* update mcde and pl111 as well (Linus)

Linus Walleij (1):
drm/mcde: Do not use dirty GEM FB handling

Thomas Zimmermann (24):
drm/fbdev-dma: Implement fbdev emulation for GEM DMA helpers arm/hdlcd: Use GEM DMA fbdev emulation
arm/malidp: Use GEM DMA fbdev emulation drm/aspeed: Use GEM DMA fbdev emulation drm/atmel-hlcdc: Use GEM DMA fbdev emulation drm/fsl-dcu: Use GEM DMA fbdev emulation drm/imx/dcss: Use GEM DMA fbdev emulation
drm/imx: Use GEM DMA fbdev emulation
drm/kmb: Use GEM DMA fbdev emulation
drm/logicvc: Use GEM DMA fbdev emulation drm/meson: Use GEM DMA fbdev emulation drm/mxsfb/lcdif: Use GEM DMA fbdev emulation drm/mxsfb: Use GEM DMA fbdev emulation
drm/sti: Use GEM DMA fbdev emulation
drm/stm: Use GEM DMA fbdev emulation
drm/sun4i: Use GEM DMA fbdev emulation
drm/tidss: Use GEM DMA fbdev emulation
drm/tilcdc: Use GEM DMA fbdev emulation drm/arcpgu: Use GEM DMA fbdev emulation drm/tve200: Use GEM DMA fbdev emulation
drm/vc4: Use GEM DMA fbdev emulation
drm/xlnx: Use GEM DMA fbdev emulation
drm/mcde: Use GEM DMA fbdev emulation
drm/pl111: Use GEM DMA fbdev emulation

 drivers/gpu/drm/Makefile                     |   1 +
 drivers/gpu/drm/arm/hdlcd_drv.c              |   4 +-
 drivers/gpu/drm/arm/malidp_drv.c             |   4 +-
 drivers/gpu/drm/aspeed/aspeed_gfx_drv.c      |   4 +-
 drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_dc.c |   4 +-
 drivers/gpu/drm/drm_fbdev_dma.c              | 275 +++++++++++++++++++
 drivers/gpu/drm/fsl-dcu/fsl_dcu_drm_drv.c    |   4 +-
 drivers/gpu/drm/imx/dcss/dcss-kms.c          |   4 +-
 drivers/gpu/drm/imx/ipuv3/imx-drm-core.c     |   4 +-
 drivers/gpu/drm/kmb/kmb_drv.c                |   4 +-
 drivers/gpu/drm/logicvc/logicvc_drm.c        |   4 +-
 drivers/gpu/drm/mcde/mcde_drv.c              |   6 +-
 drivers/gpu/drm/meson/meson_drv.c            |   4 +-
 drivers/gpu/drm/mxsfb/lcdif_drv.c            |   4 +-
 drivers/gpu/drm/mxsfb/mxsfb_drv.c            |   4 +-
 drivers/gpu/drm/pl111/pl111_drv.c            |   4 +-
 drivers/gpu/drm/sti/sti_drv.c                |   4 +-
 drivers/gpu/drm/stm/drv.c                    |   4 +-
 drivers/gpu/drm/sun4i/sun4i_drv.c            |   4 +-
 drivers/gpu/drm/tidss/tidss_drv.c            |   4 +-
 drivers/gpu/drm/tilcdc/tilcdc_drv.c          |   4 +-
 drivers/gpu/drm/tiny/arcpgu.c                |   4 +-
 drivers/gpu/drm/tve200/tve200_drv.c          |   4 +-
 drivers/gpu/drm/vc4/vc4_drv.c                |   4 +-
 drivers/gpu/drm/xlnx/zynqmp_kms.c            |   4 +-
 include/drm/drm_fbdev_dma.h                  |  15 +
 26 files changed, 338 insertions(+), 47 deletions(-)
 create mode 100644 drivers/gpu/drm/drm_fbdev_dma.c
 create mode 100644 include/drm/drm_fbdev_dma.h

base-commit: b21ced77ae1dbc3d8b01d3aef3c99bba7377a69b
prerequisite-patch-id: 0aa359f6144c4015c140c8a6750be19099c676fb
prerequisite-patch-id: c67e5d886a47b7d0266d81100837557fda34cb24
prerequisite-patch-id: 3f204510fcbf9530d6540bd8e6128cce598988b6
prerequisite-patch-id: 75f2ebf12693f23508f00d574b2b57488723e474
prerequisite-patch-id: 718531bf5cf15716834cfaf3008ea0e2366ec927
prerequisite-patch-id: a793aa283cf41f290d970404881f24bffc48caff
prerequisite-patch-id: e74f259d1923247a74d5bf7d996afb0e6ca01883
prerequisite-patch-id: a1d12b9548110b1f5e9aa3803b21e2a7f9f8c19d
prerequisite-patch-id: 033f10da72f10d82f113a5066a3b3a7ff91d13aa
prerequisite-patch-id: 976264fafbd69d0996209a90a3d546d9be3f3779
prerequisite-patch-id: 617c74af5e16717898a23ced9c8badfff1e0ade7
prerequisite-patch-id: 5e0cfa9c81aa7ceb2cc48c5cbc9934496251fac4
prerequisite-patch-id: 13594c3cc8102960bb195bc7f572fefba8eb19d7
prerequisite-patch-id: 99d9da7e08369050d135c23d32dead811bb9cf97
prerequisite-patch-id: 833f9d8341a287961ee653b04730da57ce987b06
prerequisite-patch-id: 5d5c9caaf9489a6c2f688d632a57a0fb65fcb5f7
prerequisite-patch-id: b64758ecd64ec0c0acd96d0766ba891378c5c539
prerequisite-patch-id: 37a7d3e9fb3e4e2b7ebeac3f77da6610f12beea3
prerequisite-patch-id: 99073429dafdc98cdd31464ce28e795696a149f9
prerequisite-patch-id: c2247eca44927569cd2b6d9f370195965346adb4

Signature · 1 line
2.39.2
author maintainer
#1 lore raw

PATCH v2 1/25 drm/fbdev-dma: Implement fbdev emulation for GEM DMA helpers

Implement fbdev emulation that is optimized for drivers that use DMA helpers. The buffers may no tbe moveable, may not require damage handling and have to be located in system memory. This allows fbdev emulation to operate directly on the buffer and mmap it to userspace.

Besides those constraints, the emulation works like in the generic code. As an internal DRM client provides, it receives hotplug, restore and unregister events. The DRM client is independent from the fbdev probing, which runs on the first successful hotplug event.

The emulation is part of the DMA helper module and not build unless DMA helpers and fbdev emulation has been configured.

Tested with vc4.

---
 drivers/gpu/drm/Makefile        |   1 +
 drivers/gpu/drm/drm_fbdev_dma.c | 275 ++++++++++++++++++++++++++++++++
 include/drm/drm_fbdev_dma.h     |  15 ++
 3 files changed, 291 insertions(+)
 create mode 100644 drivers/gpu/drm/drm_fbdev_dma.c
 create mode 100644 include/drm/drm_fbdev_dma.h
drivers/gpu/drm/Makefile +1 -0
index 1e04d135e866..a33257d2bc7f 100644
@@ -82,6 +82,7 @@ obj-$(CONFIG_DRM_PANEL_ORIENTATION_QUIRKS) += drm_panel_orientation_quirks.o
 obj-$(CONFIG_DRM_BUDDY) += drm_buddy.o
 
 drm_dma_helper-y := drm_gem_dma_helper.o
+drm_dma_helper-$(CONFIG_DRM_FBDEV_EMULATION) += drm_fbdev_dma.o
 drm_dma_helper-$(CONFIG_DRM_KMS_HELPER) += drm_fb_dma_helper.o
 obj-$(CONFIG_DRM_GEM_DMA_HELPER) += drm_dma_helper.o
 
drivers/gpu/drm/drm_fbdev_dma.c new file +275 -0

275 lines not on this page · raw message

include/drm/drm_fbdev_dma.h new file +15 -0
new file mode 100644
index 000000000000..2da7ee784133
@@ -0,0 +1,15 @@
+/* SPDX-License-Identifier: MIT */
+
+#ifndef DRM_FBDEV_DMA_H
+#define DRM_FBDEV_DMA_H
+
+struct drm_device;
+
+#ifdef CONFIG_DRM_FBDEV_EMULATION
+void drm_fbdev_dma_setup(struct drm_device *dev, unsigned int preferred_bpp);
+#else
+static inline void drm_fbdev_dma_setup(struct drm_device *dev, unsigned int preferred_bpp)
+{ }
+#endif
+
+#endif
Signature · 1 line
2.39.2
author maintainer
#2 lore raw

PATCH v2 2/25 arm/hdlcd: Use GEM DMA fbdev emulation

In reply to Thomas Zimmermann

Use the fbdev emulation that is optimized for DMA helpers. Avoids possible shadow buffering and makes the code simpler.

---
 drivers/gpu/drm/arm/hdlcd_drv.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/gpu/drm/arm/hdlcd_drv.c +2 -2
index e3507dd6f82a..a554c79dcd39 100644
@@ -26,7 +26,7 @@
 #include <drm/drm_crtc.h>
 #include <drm/drm_debugfs.h>
 #include <drm/drm_drv.h>
-#include <drm/drm_fbdev_generic.h>
+#include <drm/drm_fbdev_dma.h>
 #include <drm/drm_gem_dma_helper.h>
 #include <drm/drm_gem_framebuffer_helper.h>
 #include <drm/drm_modeset_helper.h>
@@ -301,7 +301,7 @@ static int hdlcd_drm_bind(struct device *dev)
 	if (ret)
 		goto err_register;
 
-	drm_fbdev_generic_setup(drm, 32);
+	drm_fbdev_dma_setup(drm, 32);
 
 	return 0;
 
Signature · 1 line
2.39.2
author maintainer
#3 lore raw

PATCH v2 3/25 arm/malidp: Use GEM DMA fbdev emulation

In reply to Thomas Zimmermann

Use the fbdev emulation that is optimized for DMA helpers. Avoids possible shadow buffering and makes the code simpler.

---
 drivers/gpu/drm/arm/malidp_drv.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/gpu/drm/arm/malidp_drv.c +2 -2
index cf040e2e9efe..0597e6ad56e7 100644
@@ -19,7 +19,7 @@
 #include <drm/drm_atomic_helper.h>
 #include <drm/drm_crtc.h>
 #include <drm/drm_drv.h>
-#include <drm/drm_fbdev_generic.h>
+#include <drm/drm_fbdev_dma.h>
 #include <drm/drm_fourcc.h>
 #include <drm/drm_gem_dma_helper.h>
 #include <drm/drm_gem_framebuffer_helper.h>
@@ -852,7 +852,7 @@ static int malidp_bind(struct device *dev)
 	if (ret)
 		goto register_fail;
 
-	drm_fbdev_generic_setup(drm, 32);
+	drm_fbdev_dma_setup(drm, 32);
 
 	return 0;
 
Signature · 1 line
2.39.2
author maintainer
#4 lore raw

PATCH v2 4/25 drm/aspeed: Use GEM DMA fbdev emulation

In reply to Thomas Zimmermann

Use the fbdev emulation that is optimized for DMA helpers. Avoids possible shadow buffering and makes the code simpler.

---
 drivers/gpu/drm/aspeed/aspeed_gfx_drv.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/gpu/drm/aspeed/aspeed_gfx_drv.c +2 -2
index ecfb060d2557..c8c7f8215155 100644
@@ -15,7 +15,7 @@
 
 #include <drm/drm_atomic_helper.h>
 #include <drm/drm_device.h>
-#include <drm/drm_fbdev_generic.h>
+#include <drm/drm_fbdev_dma.h>
 #include <drm/drm_gem_dma_helper.h>
 #include <drm/drm_gem_framebuffer_helper.h>
 #include <drm/drm_module.h>
@@ -341,7 +341,7 @@ static int aspeed_gfx_probe(struct platform_device *pdev)
 	if (ret)
 		goto err_unload;
 
-	drm_fbdev_generic_setup(&priv->drm, 32);
+	drm_fbdev_dma_setup(&priv->drm, 32);
 	return 0;
 
 err_unload:
Signature · 1 line
2.39.2
author maintainer
#5 lore raw

PATCH v2 5/25 drm/atmel-hlcdc: Use GEM DMA fbdev emulation

In reply to Thomas Zimmermann

Use the fbdev emulation that is optimized for DMA helpers. Avoids possible shadow buffering and makes the code simpler.

---
 drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_dc.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_dc.c +2 -2
index 4e806b06d35d..29603561d501 100644
@@ -19,7 +19,7 @@
 #include <drm/drm_atomic.h>
 #include <drm/drm_atomic_helper.h>
 #include <drm/drm_drv.h>
-#include <drm/drm_fbdev_generic.h>
+#include <drm/drm_fbdev_dma.h>
 #include <drm/drm_gem_dma_helper.h>
 #include <drm/drm_gem_framebuffer_helper.h>
 #include <drm/drm_module.h>
@@ -760,7 +760,7 @@ static int atmel_hlcdc_dc_drm_probe(struct platform_device *pdev)
 	if (ret)
 		goto err_unload;
 
-	drm_fbdev_generic_setup(ddev, 24);
+	drm_fbdev_dma_setup(ddev, 24);
 
 	return 0;
 
Signature · 1 line
2.39.2
author maintainer
#6 lore raw

PATCH v2 6/25 drm/fsl-dcu: Use GEM DMA fbdev emulation

In reply to Thomas Zimmermann

Use the fbdev emulation that is optimized for DMA helpers. Avoids possible shadow buffering and makes the code simpler.

---
 drivers/gpu/drm/fsl-dcu/fsl_dcu_drm_drv.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/gpu/drm/fsl-dcu/fsl_dcu_drm_drv.c +2 -2
index 8579c7629f5e..c09ba019ba5e 100644
@@ -20,7 +20,7 @@
 
 #include <drm/drm_atomic_helper.h>
 #include <drm/drm_drv.h>
-#include <drm/drm_fbdev_generic.h>
+#include <drm/drm_fbdev_dma.h>
 #include <drm/drm_gem_dma_helper.h>
 #include <drm/drm_modeset_helper.h>
 #include <drm/drm_module.h>
@@ -333,7 +333,7 @@ static int fsl_dcu_drm_probe(struct platform_device *pdev)
 	if (ret < 0)
 		goto put;
 
-	drm_fbdev_generic_setup(drm, legacyfb_depth);
+	drm_fbdev_dma_setup(drm, legacyfb_depth);
 
 	return 0;
 
Signature · 1 line
2.39.2
author maintainer
#7 lore raw

PATCH v2 7/25 drm/imx/dcss: Use GEM DMA fbdev emulation

In reply to Thomas Zimmermann

Use the fbdev emulation that is optimized for DMA helpers. Avoids possible shadow buffering and makes the code simpler.

---
 drivers/gpu/drm/imx/dcss/dcss-kms.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/gpu/drm/imx/dcss/dcss-kms.c +2 -2
index dab5e664920d..896de946f8df 100644
@@ -7,7 +7,7 @@
 #include <drm/drm_atomic_helper.h>
 #include <drm/drm_bridge_connector.h>
 #include <drm/drm_drv.h>
-#include <drm/drm_fbdev_generic.h>
+#include <drm/drm_fbdev_dma.h>
 #include <drm/drm_gem_dma_helper.h>
 #include <drm/drm_gem_framebuffer_helper.h>
 #include <drm/drm_of.h>
@@ -145,7 +145,7 @@ struct dcss_kms_dev *dcss_kms_attach(struct dcss_dev *dcss)
 	if (ret)
 		goto cleanup_crtc;
 
-	drm_fbdev_generic_setup(drm, 32);
+	drm_fbdev_dma_setup(drm, 32);
 
 	return kms;
 
Signature · 1 line
2.39.2
author maintainer
#8 lore raw

PATCH v2 8/25 drm/imx: Use GEM DMA fbdev emulation

In reply to Thomas Zimmermann

Use the fbdev emulation that is optimized for DMA helpers. Avoids possible shadow buffering and makes the code simpler.

---
 drivers/gpu/drm/imx/ipuv3/imx-drm-core.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/gpu/drm/imx/ipuv3/imx-drm-core.c +2 -2
index e060fa6cbcb9..4a866ac60fff 100644
@@ -16,7 +16,7 @@
 #include <drm/drm_atomic.h>
 #include <drm/drm_atomic_helper.h>
 #include <drm/drm_drv.h>
-#include <drm/drm_fbdev_generic.h>
+#include <drm/drm_fbdev_dma.h>
 #include <drm/drm_gem_dma_helper.h>
 #include <drm/drm_gem_framebuffer_helper.h>
 #include <drm/drm_managed.h>
@@ -249,7 +249,7 @@ static int imx_drm_bind(struct device *dev)
 	if (ret)
 		goto err_poll_fini;
 
-	drm_fbdev_generic_setup(drm, legacyfb_depth);
+	drm_fbdev_dma_setup(drm, legacyfb_depth);
 
 	return 0;
 
Signature · 1 line
2.39.2
author maintainer
#9 lore raw

PATCH v2 9/25 drm/kmb: Use GEM DMA fbdev emulation

In reply to Thomas Zimmermann

Use the fbdev emulation that is optimized for DMA helpers. Avoids possible shadow buffering and makes the code simpler.

---
 drivers/gpu/drm/kmb/kmb_drv.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/gpu/drm/kmb/kmb_drv.c +2 -2
index d29c678f6c91..24035b53441c 100644
@@ -15,7 +15,7 @@
 
 #include <drm/drm_atomic_helper.h>
 #include <drm/drm_drv.h>
-#include <drm/drm_fbdev_generic.h>
+#include <drm/drm_fbdev_dma.h>
 #include <drm/drm_gem_dma_helper.h>
 #include <drm/drm_gem_framebuffer_helper.h>
 #include <drm/drm_module.h>
@@ -562,7 +562,7 @@ static int kmb_probe(struct platform_device *pdev)
 	if (ret)
 		goto err_register;
 
-	drm_fbdev_generic_setup(&kmb->drm, 0);
+	drm_fbdev_dma_setup(&kmb->drm, 0);
 
 	return 0;
 
Signature · 1 line
2.39.2
author maintainer
#10 lore raw

PATCH v2 10/25 drm/logicvc: Use GEM DMA fbdev emulation

In reply to Thomas Zimmermann

Use the fbdev emulation that is optimized for DMA helpers. Avoids possible shadow buffering and makes the code simpler.

---
 drivers/gpu/drm/logicvc/logicvc_drm.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/gpu/drm/logicvc/logicvc_drm.c +2 -2
index 2fb23697740a..c35c453fd025 100644
@@ -17,7 +17,7 @@
 
 #include <drm/drm_atomic_helper.h>
 #include <drm/drm_drv.h>
-#include <drm/drm_fbdev_generic.h>
+#include <drm/drm_fbdev_dma.h>
 #include <drm/drm_gem_dma_helper.h>
 #include <drm/drm_print.h>
 
@@ -449,7 +449,7 @@ static int logicvc_drm_probe(struct platform_device *pdev)
 		preferred_bpp = 32;
 		break;
 	}
-	drm_fbdev_generic_setup(drm_dev, preferred_bpp);
+	drm_fbdev_dma_setup(drm_dev, preferred_bpp);
 
 	return 0;
 
Signature · 1 line
2.39.2
author maintainer
#11 lore raw

PATCH v2 11/25 drm/meson: Use GEM DMA fbdev emulation

In reply to Thomas Zimmermann

Use the fbdev emulation that is optimized for DMA helpers. Avoids possible shadow buffering and makes the code simpler.

---
 drivers/gpu/drm/meson/meson_drv.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/gpu/drm/meson/meson_drv.c +2 -2
index 79bfe3938d3c..6608a251106b 100644
@@ -18,7 +18,7 @@
 #include <drm/drm_aperture.h>
 #include <drm/drm_atomic_helper.h>
 #include <drm/drm_drv.h>
-#include <drm/drm_fbdev_generic.h>
+#include <drm/drm_fbdev_dma.h>
 #include <drm/drm_gem_dma_helper.h>
 #include <drm/drm_gem_framebuffer_helper.h>
 #include <drm/drm_modeset_helper_vtables.h>
@@ -353,7 +353,7 @@ static int meson_drv_bind_master(struct device *dev, bool has_components)
 	if (ret)
 		goto uninstall_irq;
 
-	drm_fbdev_generic_setup(drm, 32);
+	drm_fbdev_dma_setup(drm, 32);
 
 	return 0;
 
Signature · 1 line
2.39.2
author maintainer
#12 lore raw

PATCH v2 12/25 drm/mxsfb/lcdif: Use GEM DMA fbdev emulation

In reply to Thomas Zimmermann

Use the fbdev emulation that is optimized for DMA helpers. Avoids possible shadow buffering and makes the code simpler.

---
 drivers/gpu/drm/mxsfb/lcdif_drv.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/gpu/drm/mxsfb/lcdif_drv.c +2 -2
index cc2ceb301b96..6fb5b469ee5a 100644
@@ -16,7 +16,7 @@
 #include <drm/drm_atomic_helper.h>
 #include <drm/drm_bridge.h>
 #include <drm/drm_drv.h>
-#include <drm/drm_fbdev_generic.h>
+#include <drm/drm_fbdev_dma.h>
 #include <drm/drm_gem_dma_helper.h>
 #include <drm/drm_gem_framebuffer_helper.h>
 #include <drm/drm_mode_config.h>
@@ -220,7 +220,7 @@ static int lcdif_probe(struct platform_device *pdev)
 	if (ret)
 		goto err_unload;
 
-	drm_fbdev_generic_setup(drm, 32);
+	drm_fbdev_dma_setup(drm, 32);
 
 	return 0;
 
Signature · 1 line
2.39.2
author maintainer
#13 lore raw

PATCH v2 13/25 drm/mxsfb: Use GEM DMA fbdev emulation

In reply to Thomas Zimmermann

Use the fbdev emulation that is optimized for DMA helpers. Avoids possible shadow buffering and makes the code simpler.

---
 drivers/gpu/drm/mxsfb/mxsfb_drv.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/gpu/drm/mxsfb/mxsfb_drv.c +2 -2
index b3ab86ad1b36..368b1fbd8305 100644
@@ -20,7 +20,7 @@
 #include <drm/drm_bridge.h>
 #include <drm/drm_connector.h>
 #include <drm/drm_drv.h>
-#include <drm/drm_fbdev_generic.h>
+#include <drm/drm_fbdev_dma.h>
 #include <drm/drm_fourcc.h>
 #include <drm/drm_gem_dma_helper.h>
 #include <drm/drm_gem_framebuffer_helper.h>
@@ -365,7 +365,7 @@ static int mxsfb_probe(struct platform_device *pdev)
 	if (ret)
 		goto err_unload;
 
-	drm_fbdev_generic_setup(drm, 32);
+	drm_fbdev_dma_setup(drm, 32);
 
 	return 0;
 
Signature · 1 line
2.39.2
author maintainer
#14 lore raw

PATCH v2 14/25 drm/sti: Use GEM DMA fbdev emulation

In reply to Thomas Zimmermann

Use the fbdev emulation that is optimized for DMA helpers. Avoids possible shadow buffering and makes the code simpler.

---
 drivers/gpu/drm/sti/sti_drv.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/gpu/drm/sti/sti_drv.c +2 -2
index ef6a4e63198f..1b87b5899f9e 100644
@@ -14,7 +14,7 @@
 #include <drm/drm_atomic_helper.h>
 #include <drm/drm_debugfs.h>
 #include <drm/drm_drv.h>
-#include <drm/drm_fbdev_generic.h>
+#include <drm/drm_fbdev_dma.h>
 #include <drm/drm_gem_dma_helper.h>
 #include <drm/drm_gem_framebuffer_helper.h>
 #include <drm/drm_of.h>
@@ -199,7 +199,7 @@ static int sti_bind(struct device *dev)
 
 	drm_mode_config_reset(ddev);
 
-	drm_fbdev_generic_setup(ddev, 32);
+	drm_fbdev_dma_setup(ddev, 32);
 
 	return 0;
 
Signature · 1 line
2.39.2
author maintainer
#15 lore raw

PATCH v2 15/25 drm/stm: Use GEM DMA fbdev emulation

In reply to Thomas Zimmermann

Use the fbdev emulation that is optimized for DMA helpers. Avoids possible shadow buffering and makes the code simpler.

---
 drivers/gpu/drm/stm/drv.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/gpu/drm/stm/drv.c +2 -2
index 50410bd99dfe..422220df7d8c 100644
@@ -18,7 +18,7 @@
 #include <drm/drm_atomic.h>
 #include <drm/drm_atomic_helper.h>
 #include <drm/drm_drv.h>
-#include <drm/drm_fbdev_generic.h>
+#include <drm/drm_fbdev_dma.h>
 #include <drm/drm_gem_dma_helper.h>
 #include <drm/drm_gem_framebuffer_helper.h>
 #include <drm/drm_module.h>
@@ -203,7 +203,7 @@ static int stm_drm_platform_probe(struct platform_device *pdev)
 	if (ret)
 		goto err_put;
 
-	drm_fbdev_generic_setup(ddev, 16);
+	drm_fbdev_dma_setup(ddev, 16);
 
 	return 0;
 
Signature · 1 line
2.39.2
author maintainer
#16 lore raw

PATCH v2 16/25 drm/sun4i: Use GEM DMA fbdev emulation

In reply to Thomas Zimmermann

Use the fbdev emulation that is optimized for DMA helpers. Avoids possible shadow buffering and makes the code simpler.

---
 drivers/gpu/drm/sun4i/sun4i_drv.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/gpu/drm/sun4i/sun4i_drv.c +2 -2
index d6c741716167..e49f78a6a8cf 100644
@@ -17,7 +17,7 @@
 #include <drm/drm_aperture.h>
 #include <drm/drm_atomic_helper.h>
 #include <drm/drm_drv.h>
-#include <drm/drm_fbdev_generic.h>
+#include <drm/drm_fbdev_dma.h>
 #include <drm/drm_gem_dma_helper.h>
 #include <drm/drm_module.h>
 #include <drm/drm_of.h>
@@ -111,7 +111,7 @@ static int sun4i_drv_bind(struct device *dev)
 	if (ret)
 		goto finish_poll;
 
-	drm_fbdev_generic_setup(drm, 32);
+	drm_fbdev_dma_setup(drm, 32);
 
 	dev_set_drvdata(dev, drm);
 
Signature · 1 line
2.39.2
author maintainer
#17 lore raw

PATCH v2 17/25 drm/tidss: Use GEM DMA fbdev emulation

In reply to Thomas Zimmermann

Use the fbdev emulation that is optimized for DMA helpers. Avoids possible shadow buffering and makes the code simpler.

---
 drivers/gpu/drm/tidss/tidss_drv.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/gpu/drm/tidss/tidss_drv.c +2 -2
index 2dac8727d2f4..3f5f27fb6ebc 100644
@@ -13,7 +13,7 @@
 #include <drm/drm_atomic_helper.h>
 #include <drm/drm_crtc.h>
 #include <drm/drm_drv.h>
-#include <drm/drm_fbdev_generic.h>
+#include <drm/drm_fbdev_dma.h>
 #include <drm/drm_gem_dma_helper.h>
 #include <drm/drm_managed.h>
 #include <drm/drm_module.h>
@@ -179,7 +179,7 @@ static int tidss_probe(struct platform_device *pdev)
 		goto err_irq_uninstall;
 	}
 
-	drm_fbdev_generic_setup(ddev, 32);
+	drm_fbdev_dma_setup(ddev, 32);
 
 	dev_dbg(dev, "%s done\n", __func__);
 
Signature · 1 line
2.39.2
author maintainer
#18 lore raw

PATCH v2 18/25 drm/tilcdc: Use GEM DMA fbdev emulation

In reply to Thomas Zimmermann

Use the fbdev emulation that is optimized for DMA helpers. Avoids possible shadow buffering and makes the code simpler.

---
 drivers/gpu/drm/tilcdc/tilcdc_drv.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/gpu/drm/tilcdc/tilcdc_drv.c +2 -2
index 4ca426007dc8..fe56beea3e93 100644
@@ -16,7 +16,7 @@
 #include <drm/drm_atomic_helper.h>
 #include <drm/drm_debugfs.h>
 #include <drm/drm_drv.h>
-#include <drm/drm_fbdev_generic.h>
+#include <drm/drm_fbdev_dma.h>
 #include <drm/drm_fourcc.h>
 #include <drm/drm_gem_dma_helper.h>
 #include <drm/drm_gem_framebuffer_helper.h>
@@ -384,7 +384,7 @@ static int tilcdc_init(const struct drm_driver *ddrv, struct device *dev)
 		goto init_failed;
 	priv->is_registered = true;
 
-	drm_fbdev_generic_setup(ddev, bpp);
+	drm_fbdev_dma_setup(ddev, bpp);
 	return 0;
 
 init_failed:
Signature · 1 line
2.39.2
author maintainer
#19 lore raw

PATCH v2 19/25 drm/arcpgu: Use GEM DMA fbdev emulation

In reply to Thomas Zimmermann

Use the fbdev emulation that is optimized for DMA helpers. Avoids possible shadow buffering and makes the code simpler.

---
 drivers/gpu/drm/tiny/arcpgu.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/gpu/drm/tiny/arcpgu.c +2 -2
index 611bbee15071..e5b10e41554a 100644
@@ -12,7 +12,7 @@
 #include <drm/drm_drv.h>
 #include <drm/drm_edid.h>
 #include <drm/drm_fb_dma_helper.h>
-#include <drm/drm_fbdev_generic.h>
+#include <drm/drm_fbdev_dma.h>
 #include <drm/drm_fourcc.h>
 #include <drm/drm_framebuffer.h>
 #include <drm/drm_gem_dma_helper.h>
@@ -394,7 +394,7 @@ static int arcpgu_probe(struct platform_device *pdev)
 	if (ret)
 		goto err_unload;
 
-	drm_fbdev_generic_setup(&arcpgu->drm, 16);
+	drm_fbdev_dma_setup(&arcpgu->drm, 16);
 
 	return 0;
 
Signature · 1 line
2.39.2
author maintainer
#20 lore raw

PATCH v2 20/25 drm/tve200: Use GEM DMA fbdev emulation

In reply to Thomas Zimmermann

Use the fbdev emulation that is optimized for DMA helpers. Avoids possible shadow buffering and makes the code simpler.

---
 drivers/gpu/drm/tve200/tve200_drv.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/gpu/drm/tve200/tve200_drv.c +2 -2
index 0d05c386d303..abd557332b28 100644
@@ -40,7 +40,7 @@
 #include <drm/drm_atomic_helper.h>
 #include <drm/drm_bridge.h>
 #include <drm/drm_drv.h>
-#include <drm/drm_fbdev_generic.h>
+#include <drm/drm_fbdev_dma.h>
 #include <drm/drm_gem_dma_helper.h>
 #include <drm/drm_gem_framebuffer_helper.h>
 #include <drm/drm_module.h>
@@ -227,7 +227,7 @@ static int tve200_probe(struct platform_device *pdev)
 	 * Passing in 16 here will make the RGB565 mode the default
 	 * Passing in 32 will use XRGB8888 mode
 	 */
-	drm_fbdev_generic_setup(drm, 16);
+	drm_fbdev_dma_setup(drm, 16);
 
 	return 0;
 
Signature · 1 line
2.39.2
author maintainer
#21 lore raw

PATCH v2 21/25 drm/vc4: Use GEM DMA fbdev emulation

In reply to Thomas Zimmermann

Use the fbdev emulation that is optimized for DMA helpers. Avoids possible shadow buffering and makes the code simpler.

---
 drivers/gpu/drm/vc4/vc4_drv.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/gpu/drm/vc4/vc4_drv.c +2 -2
index 0ccaee57fe9a..c8bf954042e0 100644
@@ -33,7 +33,7 @@
 #include <drm/drm_aperture.h>
 #include <drm/drm_atomic_helper.h>
 #include <drm/drm_drv.h>
-#include <drm/drm_fbdev_generic.h>
+#include <drm/drm_fbdev_dma.h>
 #include <drm/drm_vblank.h>
 
 #include <soc/bcm2835/raspberrypi-firmware.h>
@@ -387,7 +387,7 @@ static int vc4_drm_bind(struct device *dev)
 	if (ret < 0)
 		goto unbind_all;
 
-	drm_fbdev_generic_setup(drm, 16);
+	drm_fbdev_dma_setup(drm, 16);
 
 	return 0;
 
Signature · 1 line
2.39.2
author maintainer
#22 lore raw

PATCH v2 22/25 drm/xlnx: Use GEM DMA fbdev emulation

In reply to Thomas Zimmermann

Use the fbdev emulation that is optimized for DMA helpers. Avoids possible shadow buffering and makes the code simpler.

---
 drivers/gpu/drm/xlnx/zynqmp_kms.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/gpu/drm/xlnx/zynqmp_kms.c +2 -2
index 776ef5480206..a7f8611be6f4 100644
@@ -19,7 +19,7 @@
 #include <drm/drm_device.h>
 #include <drm/drm_drv.h>
 #include <drm/drm_encoder.h>
-#include <drm/drm_fbdev_generic.h>
+#include <drm/drm_fbdev_dma.h>
 #include <drm/drm_fourcc.h>
 #include <drm/drm_framebuffer.h>
 #include <drm/drm_gem_dma_helper.h>
@@ -515,7 +515,7 @@ int zynqmp_dpsub_drm_init(struct zynqmp_dpsub *dpsub)
 		goto err_poll_fini;
 
 	/* Initialize fbdev generic emulation. */
-	drm_fbdev_generic_setup(drm, 24);
+	drm_fbdev_dma_setup(drm, 24);
 
 	return 0;
 
Signature · 1 line
2.39.2
author maintainer
#23 lore raw

PATCH v2 23/25 drm/mcde: Do not use dirty GEM FB handling

In reply to Thomas Zimmermann

From: Linus Walleij <[email protected]>

This driver has no way to handle damage, the reason the drm_gem_fb_create_with_dirty() was used was because I had the ambition that the driver would only send out updates to DSI command displays whenever something changed, so as to minimize traffic.

It turns out this ambition with command mode isn't working in practice because all the MCDE does is to create a continuous stream of DSI commands and while it is possible to send single frame updates with it, it's not been worthwhile. So we are just setting up continuous updates.

---
 drivers/gpu/drm/mcde/mcde_drv.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/mcde/mcde_drv.c +1 -1
index 4aedb050d2a5..a592ad0d7886 100644
@@ -94,7 +94,7 @@
 #define MCDE_PID_MAJOR_VERSION_MASK 0xFF000000
 
 static const struct drm_mode_config_funcs mcde_mode_config_funcs = {
-	.fb_create = drm_gem_fb_create_with_dirty,
+	.fb_create = drm_gem_fb_create,
 	.atomic_check = drm_atomic_helper_check,
 	.atomic_commit = drm_atomic_helper_commit,
 };
Signature · 1 line
2.39.2
author maintainer
#24 lore raw

PATCH v2 24/25 drm/mcde: Use GEM DMA fbdev emulation

In reply to Thomas Zimmermann

Use the fbdev emulation that is optimized for DMA helpers. Avoids possible shadow buffering and makes the code simpler.

---
 drivers/gpu/drm/mcde/mcde_drv.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/gpu/drm/mcde/mcde_drv.c +2 -2
index a592ad0d7886..a8cd86c06c14 100644
@@ -69,7 +69,7 @@
 #include <drm/drm_bridge.h>
 #include <drm/drm_drv.h>
 #include <drm/drm_fb_dma_helper.h>
-#include <drm/drm_fbdev_generic.h>
+#include <drm/drm_fbdev_dma.h>
 #include <drm/drm_gem.h>
 #include <drm/drm_gem_dma_helper.h>
 #include <drm/drm_gem_framebuffer_helper.h>
@@ -237,7 +237,7 @@ static int mcde_drm_bind(struct device *dev)
 	if (ret < 0)
 		goto unbind;
 
-	drm_fbdev_generic_setup(drm, 32);
+	drm_fbdev_dma_setup(drm, 32);
 
 	return 0;
 
Signature · 1 line
2.39.2
Reviewed-by Tested-by on v2 24/25
#25 lore raw

Re: [PATCH v2 24/25] drm/mcde: Use GEM DMA fbdev emulation

Quoted 6 lines · On Mon, Mar 13, 2023 at 4:51?PM Thomas Zimmermann <[email protected]> wrote:

Use the fbdev emulation that is optimized for DMA helpers. Avoids possible shadow buffering and makes the code simpler.

Yours,
Linus Walleij

author maintainer
#26 lore raw

PATCH v2 25/25 drm/pl111: Use GEM DMA fbdev emulation

In reply to Thomas Zimmermann

Use the fbdev emulation that is optimized for DMA helpers. Avoids possible shadow buffering and makes the code simpler.

---
 drivers/gpu/drm/pl111/pl111_drv.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/gpu/drm/pl111/pl111_drv.c +2 -2
index 00deba0b7271..4b2a9e9753f6 100644
@@ -48,7 +48,7 @@
 #include <drm/drm_atomic_helper.h>
 #include <drm/drm_bridge.h>
 #include <drm/drm_drv.h>
-#include <drm/drm_fbdev_generic.h>
+#include <drm/drm_fbdev_dma.h>
 #include <drm/drm_fourcc.h>
 #include <drm/drm_gem_dma_helper.h>
 #include <drm/drm_gem_framebuffer_helper.h>
@@ -308,7 +308,7 @@ static int pl111_amba_probe(struct amba_device *amba_dev,
 	if (ret < 0)
 		goto dev_put;
 
-	drm_fbdev_generic_setup(drm, priv->variant->fb_bpp);
+	drm_fbdev_dma_setup(drm, priv->variant->fb_bpp);
 
 	return 0;
 
Signature · 1 line
2.39.2
Reviewed-by on v2 25/25
#27 lore raw

Re: [PATCH v2 25/25] drm/pl111: Use GEM DMA fbdev emulation

Quoted 6 lines · On Mon, Mar 13, 2023 at 4:51?PM Thomas Zimmermann <[email protected]> wrote:

Use the fbdev emulation that is optimized for DMA helpers. Avoids possible shadow buffering and makes the code simpler.

Yours,
Linus Walleij

author maintainer Applied
#29 lore raw
In reply to Thomas Zimmermann

Merged into drm-misc-next. Thanks a lot for reviews and comments.

Am 13.03.23 um 16:51 schrieb Thomas Zimmermann:

Quoted 96 lines

Add fbdev emulation that is optimized for DMA helpers, as used by most drivers. It operates directly on GEM DMA buffers in system memory. Memory pages are mmap'ed directly to userspace. No implicit shadow buffers need to be allocated; as can happen with the generic fbdev emulation. Convert drivers that fulfil the requirements.

Tested with fbcon and IGT on vc4.

Future direction: providing a dedicated fbdev emulation for GEM DMA helpers will allow us to remove this case from the generic fbdev code. The latter can then be simplified.

v2:
* update mcde and pl111 as well (Linus)

Linus Walleij (1):
drm/mcde: Do not use dirty GEM FB handling

Thomas Zimmermann (24):
drm/fbdev-dma: Implement fbdev emulation for GEM DMA helpers arm/hdlcd: Use GEM DMA fbdev emulation
arm/malidp: Use GEM DMA fbdev emulation drm/aspeed: Use GEM DMA fbdev emulation drm/atmel-hlcdc: Use GEM DMA fbdev emulation drm/fsl-dcu: Use GEM DMA fbdev emulation drm/imx/dcss: Use GEM DMA fbdev emulation
drm/imx: Use GEM DMA fbdev emulation
drm/kmb: Use GEM DMA fbdev emulation
drm/logicvc: Use GEM DMA fbdev emulation drm/meson: Use GEM DMA fbdev emulation drm/mxsfb/lcdif: Use GEM DMA fbdev emulation drm/mxsfb: Use GEM DMA fbdev emulation
drm/sti: Use GEM DMA fbdev emulation
drm/stm: Use GEM DMA fbdev emulation
drm/sun4i: Use GEM DMA fbdev emulation
drm/tidss: Use GEM DMA fbdev emulation
drm/tilcdc: Use GEM DMA fbdev emulation drm/arcpgu: Use GEM DMA fbdev emulation drm/tve200: Use GEM DMA fbdev emulation
drm/vc4: Use GEM DMA fbdev emulation
drm/xlnx: Use GEM DMA fbdev emulation
drm/mcde: Use GEM DMA fbdev emulation
drm/pl111: Use GEM DMA fbdev emulation

  drivers/gpu/drm/Makefile                     |   1 +
  drivers/gpu/drm/arm/hdlcd_drv.c              |   4 +-
  drivers/gpu/drm/arm/malidp_drv.c             |   4 +-
  drivers/gpu/drm/aspeed/aspeed_gfx_drv.c      |   4 +-
  drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_dc.c |   4 +-
  drivers/gpu/drm/drm_fbdev_dma.c              | 275 +++++++++++++++++++
  drivers/gpu/drm/fsl-dcu/fsl_dcu_drm_drv.c    |   4 +-
  drivers/gpu/drm/imx/dcss/dcss-kms.c          |   4 +-
  drivers/gpu/drm/imx/ipuv3/imx-drm-core.c     |   4 +-
  drivers/gpu/drm/kmb/kmb_drv.c                |   4 +-
  drivers/gpu/drm/logicvc/logicvc_drm.c        |   4 +-
  drivers/gpu/drm/mcde/mcde_drv.c              |   6 +-
  drivers/gpu/drm/meson/meson_drv.c            |   4 +-
  drivers/gpu/drm/mxsfb/lcdif_drv.c            |   4 +-
  drivers/gpu/drm/mxsfb/mxsfb_drv.c            |   4 +-
  drivers/gpu/drm/pl111/pl111_drv.c            |   4 +-
  drivers/gpu/drm/sti/sti_drv.c                |   4 +-
  drivers/gpu/drm/stm/drv.c                    |   4 +-
  drivers/gpu/drm/sun4i/sun4i_drv.c            |   4 +-
  drivers/gpu/drm/tidss/tidss_drv.c            |   4 +-
  drivers/gpu/drm/tilcdc/tilcdc_drv.c          |   4 +-
  drivers/gpu/drm/tiny/arcpgu.c                |   4 +-
  drivers/gpu/drm/tve200/tve200_drv.c          |   4 +-
  drivers/gpu/drm/vc4/vc4_drv.c                |   4 +-
  drivers/gpu/drm/xlnx/zynqmp_kms.c            |   4 +-
  include/drm/drm_fbdev_dma.h                  |  15 +
  26 files changed, 338 insertions(+), 47 deletions(-)

create mode 100644 drivers/gpu/drm/drm_fbdev_dma.c create mode 100644 include/drm/drm_fbdev_dma.h

base-commit: b21ced77ae1dbc3d8b01d3aef3c99bba7377a69b
prerequisite-patch-id: 0aa359f6144c4015c140c8a6750be19099c676fb
prerequisite-patch-id: c67e5d886a47b7d0266d81100837557fda34cb24
prerequisite-patch-id: 3f204510fcbf9530d6540bd8e6128cce598988b6
prerequisite-patch-id: 75f2ebf12693f23508f00d574b2b57488723e474
prerequisite-patch-id: 718531bf5cf15716834cfaf3008ea0e2366ec927
prerequisite-patch-id: a793aa283cf41f290d970404881f24bffc48caff
prerequisite-patch-id: e74f259d1923247a74d5bf7d996afb0e6ca01883
prerequisite-patch-id: a1d12b9548110b1f5e9aa3803b21e2a7f9f8c19d
prerequisite-patch-id: 033f10da72f10d82f113a5066a3b3a7ff91d13aa
prerequisite-patch-id: 976264fafbd69d0996209a90a3d546d9be3f3779
prerequisite-patch-id: 617c74af5e16717898a23ced9c8badfff1e0ade7
prerequisite-patch-id: 5e0cfa9c81aa7ceb2cc48c5cbc9934496251fac4
prerequisite-patch-id: 13594c3cc8102960bb195bc7f572fefba8eb19d7
prerequisite-patch-id: 99d9da7e08369050d135c23d32dead811bb9cf97
prerequisite-patch-id: 833f9d8341a287961ee653b04730da57ce987b06
prerequisite-patch-id: 5d5c9caaf9489a6c2f688d632a57a0fb65fcb5f7
prerequisite-patch-id: b64758ecd64ec0c0acd96d0766ba891378c5c539
prerequisite-patch-id: 37a7d3e9fb3e4e2b7ebeac3f77da6610f12beea3
prerequisite-patch-id: 99073429dafdc98cdd31464ce28e795696a149f9
prerequisite-patch-id: c2247eca44927569cd2b6d9f370195965346adb4

Signature · 13 lines
Thomas Zimmermann
Graphics Driver Developer
SUSE Software Solutions Germany GmbH
Maxfeldstr. 5, 90409 N?rnberg, Germany
(HRB 36809, AG N?rnberg)
Gesch?ftsf?hrer: Ivo Totev
-------------- next part --------------
A non-text attachment was scrubbed...
Name: OpenPGP_signature
Type: application/pgp-signature
Size: 840 bytes
Desc: OpenPGP digital signature
URL: <http://lists.ozlabs.org/pipermail/linux-aspeed/attachments/20230314/c6d848ed/attachment.sig>