Skip to contentSkip to conversation

drm/fbdev: Remove DRM's helpers for fbdev I/O

PATCH Superseded Thomas Zimmermann 5 participants 24 messages May 15, 2023 – May 18, 2023

Subsystems (15)

v2 of 5 Superseded Latest is v5 →

lore
Share & tools
lore

Thomas Zimmermann

author maintainer
#0 lore raw

v2 cover drm/fbdev: Remove DRM's helpers for fbdev I/O

DRM provides a number of wrappers around fbdev cfb_() sys_(), fb_io_() and fb_sys_() helpers. The DRM functions don't provide any additional functionality for most DRM drivers. So remove them and call the fbdev I/O helpers directly.

The DRM fbdev I/O wrappers were originally added because <linux/fb.h> does not protect its content with CONFIG_FB. DRM fbdev emulation did not build if the config option had been disabled. This has been fixed. For fbdev-generic and i915, the wrappers added support for damage handling. But this is better handled within the two callers, as each is special in its damage handling.

Patch 1 adds several internal Kconfig otpions that DRM drivers (and possibly other fbdev code) will use to select the correct set of I/O helpers.

Patches 2 to 9 replace the DRM wrappers in a number of fbdev emulations. Patch 10 exports two helpers for damage handling. Patches 11 and 12 update fbdev-generic and i915 with the help of the exported functions. The patches also remove DRM's fbdev I/O helpers, which are now unused.

DRM's fbdev helpers had to select fbdev I/O helpers for I/O and for system memory. Each fbdev emulation now selects the correct helpers for itself. Depending on the selected DRM drivers, kernel builds will now only contain the necessary fbdev I/O helpers and might be slightly smaller in size.

v2:
* simplify Kconfig handling (Sam)

Thomas Zimmermann (12):
fbdev: Add Kconfig options to select different fb_ops helpers drm/armada: Use regular fbdev I/O helpers drm/exynos: Use regular fbdev I/O helpers drm/gma500: Use regular fbdev I/O helpers drm/radeon: Use regular fbdev I/O helpers drm/fbdev-dma: Use regular fbdev I/O helpers drm/msm: Use regular fbdev I/O helpers
drm/omapdrm: Use regular fbdev I/O helpers drm/tegra: Use regular fbdev I/O helpers drm/fb-helper: Export helpers for marking damage areas drm/fbdev-generic: Implement dedicated fbdev I/O helpers drm/i915: Implement dedicated fbdev I/O helpers

 drivers/gpu/drm/Kconfig                    |  10 +-
 drivers/gpu/drm/armada/Kconfig             |   1 +
 drivers/gpu/drm/armada/armada_fbdev.c      |   9 +-
 drivers/gpu/drm/drm_fb_helper.c            | 233 ++-------------------
 drivers/gpu/drm/drm_fbdev_dma.c            |  12 +-
 drivers/gpu/drm/drm_fbdev_generic.c        |  47 ++++-
 drivers/gpu/drm/exynos/Kconfig             |   1 +
 drivers/gpu/drm/exynos/Makefile            |   2 +-
 drivers/gpu/drm/exynos/exynos_drm_fbdev.c  |  10 +-
 drivers/gpu/drm/gma500/Kconfig             |   1 +
 drivers/gpu/drm/gma500/fbdev.c             |   9 +-
 drivers/gpu/drm/i915/Kconfig               |   1 +
 drivers/gpu/drm/i915/display/intel_fbdev.c |  51 ++++-
 drivers/gpu/drm/msm/Kconfig                |   1 +
 drivers/gpu/drm/msm/msm_fbdev.c            |  12 +-
 drivers/gpu/drm/omapdrm/Kconfig            |   1 +
 drivers/gpu/drm/omapdrm/omap_fbdev.c       |  12 +-
 drivers/gpu/drm/radeon/Kconfig             |   1 +
 drivers/gpu/drm/radeon/radeon_fbdev.c      |   9 +-
 drivers/gpu/drm/tegra/Kconfig              |   1 +
 drivers/gpu/drm/tegra/fbdev.c              |  11 +-
 drivers/video/fbdev/Kconfig                |  21 ++
 include/drm/drm_fb_helper.h                |  84 +-------
 23 files changed, 184 insertions(+), 356 deletions(-)

base-commit: 451e49cfbaa90720149e63f4fa9c7824013c783d

Signature · 1 line
2.40.1
author maintainer
#1 lore raw

PATCH v2 1/12 fbdev: Add Kconfig options to select different fb_ops helpers

Many fbdev drivers use the same set of fb_ops helpers. Add Kconfig options to select them at once. This will help with making DRM's fbdev emulation code more modular, but can also be used to simplify fbdev's driver configs.

---
 drivers/video/fbdev/Kconfig | 21 +++++++++++++++++++++
 1 file changed, 21 insertions(+)
drivers/video/fbdev/Kconfig +21 -0
index 485e8c35d5c6..d5ca66f10d1c 100644
@@ -158,6 +158,27 @@ config FB_DEFERRED_IO
 	bool
 	depends on FB
 
+config FB_IO_HELPERS
+	bool
+	depends on FB
+	select FB_CFB_COPYAREA
+	select FB_CFB_FILLRECT
+	select FB_CFB_IMAGEBLIT
+
+config FB_SYS_HELPERS
+	bool
+	depends on FB
+	select FB_SYS_COPYAREA
+	select FB_SYS_FILLRECT
+	select FB_SYS_FOPS
+	select FB_SYS_IMAGEBLIT
+
+config FB_SYS_HELPERS_DEFERRED
+	bool
+	depends on FB
+	select FB_DEFERRED_IO
+	select FB_SYS_HELPER
+
 config FB_HECUBA
 	tristate
 	depends on FB
Signature · 1 line
2.40.1
author maintainer
#2 lore raw

PATCH v2 2/12 drm/armada: Use regular fbdev I/O helpers

In reply to Thomas Zimmermann

Use the regular fbdev helpers for framebuffer I/O instead of DRM's helpers. Armada does not use damage handling, so DRM's fbdev helpers are mere wrappers around the fbdev code.

By using fbdev helpers directly within each DRM fbdev emulation, we can eventually remove DRM's wrapper functions entirely.

v2:
* use FB_IO_HELPERS option

---
 drivers/gpu/drm/armada/Kconfig        | 1 +
 drivers/gpu/drm/armada/armada_fbdev.c | 9 ++++-----
 2 files changed, 5 insertions(+), 5 deletions(-)
drivers/gpu/drm/armada/Kconfig +1 -0
index f5c66d89ba99..5afade25e217 100644
@@ -3,6 +3,7 @@ config DRM_ARMADA
 	tristate "DRM support for Marvell Armada SoCs"
 	depends on DRM && HAVE_CLK && ARM && MMU
 	select DRM_KMS_HELPER
+	select FB_IO_HELPERS if DRM_FBDEV_EMULATION
 	help
 	  Support the "LCD" controllers found on the Marvell Armada 510
 	  devices.  There are two controllers on the device, each controller
drivers/gpu/drm/armada/armada_fbdev.c +4 -5
index 0a5fd1aa86eb..6c3bbaf53569 100644
@@ -5,6 +5,7 @@
  */
 
 #include <linux/errno.h>
+#include <linux/fb.h>
 #include <linux/kernel.h>
 #include <linux/module.h>
 
@@ -34,11 +35,9 @@ static void armada_fbdev_fb_destroy(struct fb_info *info)
 static const struct fb_ops armada_fb_ops = {
 	.owner		= THIS_MODULE,
 	DRM_FB_HELPER_DEFAULT_OPS,
-	.fb_read	= drm_fb_helper_cfb_read,
-	.fb_write	= drm_fb_helper_cfb_write,
-	.fb_fillrect	= drm_fb_helper_cfb_fillrect,
-	.fb_copyarea	= drm_fb_helper_cfb_copyarea,
-	.fb_imageblit	= drm_fb_helper_cfb_imageblit,
+	.fb_fillrect	= cfb_fillrect,
+	.fb_copyarea	= cfb_copyarea,
+	.fb_imageblit	= cfb_imageblit,
 	.fb_destroy	= armada_fbdev_fb_destroy,
 };
 
Signature · 1 line
2.40.1
#3 lore raw

Re: [PATCH v2 02/12] drm/armada: Use regular fbdev I/O helpers

Hi Thomas,

Quoted 42 lines · Thomas Zimmermann

Use the regular fbdev helpers for framebuffer I/O instead of DRM's helpers. Armada does not use damage handling, so DRM's fbdev helpers are mere wrappers around the fbdev code.

By using fbdev helpers directly within each DRM fbdev emulation, we can eventually remove DRM's wrapper functions entirely.

v2:
* use FB_IO_HELPERS option

---
 drivers/gpu/drm/armada/Kconfig        | 1 +
 drivers/gpu/drm/armada/armada_fbdev.c | 9 ++++-----
 2 files changed, 5 insertions(+), 5 deletions(-)
drivers/gpu/drm/armada/Kconfig +1 -0
index f5c66d89ba99..5afade25e217 100644
@@ -3,6 +3,7 @@ config DRM_ARMADA
 	tristate "DRM support for Marvell Armada SoCs"
 	depends on DRM && HAVE_CLK && ARM && MMU
 	select DRM_KMS_HELPER
+	select FB_IO_HELPERS if DRM_FBDEV_EMULATION
 	help
 	  Support the "LCD" controllers found on the Marvell Armada 510
 	  devices.  There are two controllers on the device, each controller
drivers/gpu/drm/armada/armada_fbdev.c +1 -0
index 0a5fd1aa86eb..6c3bbaf53569 100644
@@ -5,6 +5,7 @@
  */
 
 #include <linux/errno.h>
+#include <linux/fb.h>
 #include <linux/kernel.h>
 #include <linux/module.h>
 

drivers/gpu/drm/armada/armada_fbdev.c static void armada_fbdev_fb_destroy(struct fb_info *info) · line 38

Quoted 5 lines
drivers/gpu/drm/armada/armada_fbdev.c +0 -2
@@ -34,11 +35,9 @@ static void armada_fbdev_fb_destroy(struct fb_info *info)
 static const struct fb_ops armada_fb_ops = {
 	.owner		= THIS_MODULE,
 	DRM_FB_HELPER_DEFAULT_OPS,
-	.fb_read	= drm_fb_helper_cfb_read,
-	.fb_write	= drm_fb_helper_cfb_write,

I had expected to see
.fb_read = fb_io_read,

But maybe this only used when using damage handling?

Likewise for drm_fb_helper_cfb_write.

??

drivers/gpu/drm/armada/armada_fbdev.c static void armada_fbdev_fb_destroy(struct fb_info *info) · line 40

Quoted 6 lines
drivers/gpu/drm/armada/armada_fbdev.c +3 -3
-	.fb_fillrect	= drm_fb_helper_cfb_fillrect,
-	.fb_copyarea	= drm_fb_helper_cfb_copyarea,
-	.fb_imageblit	= drm_fb_helper_cfb_imageblit,
+	.fb_fillrect	= cfb_fillrect,
+	.fb_copyarea	= cfb_copyarea,
+	.fb_imageblit	= cfb_imageblit,

This part is as expected.

Sam

Quoted 5 lines
drivers/gpu/drm/armada/armada_fbdev.c +0 -0
 	.fb_destroy	= armada_fbdev_fb_destroy,
 };
 
Signature · 1 line
2.40.1
#4 lore raw

Re: [PATCH v2 02/12] drm/armada: Use regular fbdev I/O helpers

Quoted 59 lines · Sam Ravnborg

Hi Thomas,

Quoted 42 lines · Thomas Zimmermann

Use the regular fbdev helpers for framebuffer I/O instead of DRM's helpers. Armada does not use damage handling, so DRM's fbdev helpers are mere wrappers around the fbdev code.

By using fbdev helpers directly within each DRM fbdev emulation, we can eventually remove DRM's wrapper functions entirely.

v2:
* use FB_IO_HELPERS option

---
 drivers/gpu/drm/armada/Kconfig        | 1 +
 drivers/gpu/drm/armada/armada_fbdev.c | 9 ++++-----
 2 files changed, 5 insertions(+), 5 deletions(-)
drivers/gpu/drm/armada/Kconfig +1 -0
index f5c66d89ba99..5afade25e217 100644
@@ -3,6 +3,7 @@ config DRM_ARMADA
 	tristate "DRM support for Marvell Armada SoCs"
 	depends on DRM && HAVE_CLK && ARM && MMU
 	select DRM_KMS_HELPER
+	select FB_IO_HELPERS if DRM_FBDEV_EMULATION
 	help
 	  Support the "LCD" controllers found on the Marvell Armada 510
 	  devices.  There are two controllers on the device, each controller
drivers/gpu/drm/armada/armada_fbdev.c +1 -0
index 0a5fd1aa86eb..6c3bbaf53569 100644
@@ -5,6 +5,7 @@
  */
 
 #include <linux/errno.h>
+#include <linux/fb.h>
 #include <linux/kernel.h>
 #include <linux/module.h>
 

drivers/gpu/drm/armada/armada_fbdev.c static void armada_fbdev_fb_destroy(struct fb_info *info) · line 38

Quoted 5 lines
drivers/gpu/drm/armada/armada_fbdev.c +0 -2
@@ -34,11 +35,9 @@ static void armada_fbdev_fb_destroy(struct fb_info *info)
 static const struct fb_ops armada_fb_ops = {
 	.owner		= THIS_MODULE,
 	DRM_FB_HELPER_DEFAULT_OPS,
-	.fb_read	= drm_fb_helper_cfb_read,
-	.fb_write	= drm_fb_helper_cfb_write,

I had expected to see
.fb_read = fb_io_read,

But maybe this only used when using damage handling?

Likewise for drm_fb_helper_cfb_write.

??

Quoted 8 lines

drivers/gpu/drm/armada/armada_fbdev.c static void armada_fbdev_fb_destroy(struct fb_info *info) · line 40

Quoted 6 lines
drivers/gpu/drm/armada/armada_fbdev.c +3 -3
-	.fb_fillrect	= drm_fb_helper_cfb_fillrect,
-	.fb_copyarea	= drm_fb_helper_cfb_copyarea,
-	.fb_imageblit	= drm_fb_helper_cfb_imageblit,
+	.fb_fillrect	= cfb_fillrect,
+	.fb_copyarea	= cfb_copyarea,
+	.fb_imageblit	= cfb_imageblit,

This part is as expected.

Well, to me it looks like this has gone through an entire circular set of revisions:

commit e8b70e4dd7b5dad7c2379de6e0851587bf86bfd6

Author: Archit Taneja <[email protected]>
Date:   Wed Jul 22 14:58:04 2015 +0530

drm/armada: Use new drm_fb_helper functions

-       .fb_fillrect    = cfb_fillrect,
-       .fb_copyarea    = cfb_copyarea,
-       .fb_imageblit   = cfb_imageblit,
+       .fb_fillrect    = drm_fb_helper_cfb_fillrect,
+       .fb_copyarea    = drm_fb_helper_cfb_copyarea,
+       .fb_imageblit   = drm_fb_helper_cfb_imageblit,

commit 983780918c759fdbbf0bf033e701bbff75d2af23

Author: Thomas Zimmermann <[email protected]>
Date:   Thu Nov 3 16:14:40 2022 +0100

drm/fb-helper: Perform all fbdev I/O with the same implementation

+       .fb_read        = drm_fb_helper_cfb_read,
+       .fb_write       = drm_fb_helper_cfb_write,

and now effectively those two changes are being reverted, so we'd now be back to the pre-July 2015 state of affairs. As I believe the fbdev layer has been stable, this change merely reverts the driver back to what it once was.

Signature · 7 lines
RMK's Patch system: https://www.armlinux.org.uk/developer/patches/
FTTP is here! 80Mbps down 10Mbps up. Decent connectivity at last!

_______________________________________________
linux-arm-kernel mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
author maintainer
#5 lore raw

Re: [PATCH v2 02/12] drm/armada: Use regular fbdev I/O helpers

Hi

Am 15.05.23 um 20:04 schrieb Russell King (Oracle):

Quoted 94 lines · Sam Ravnborg
Quoted 59 lines

Hi Thomas,

Quoted 42 lines · Thomas Zimmermann

Use the regular fbdev helpers for framebuffer I/O instead of DRM's helpers. Armada does not use damage handling, so DRM's fbdev helpers are mere wrappers around the fbdev code.

By using fbdev helpers directly within each DRM fbdev emulation, we can eventually remove DRM's wrapper functions entirely.

v2:
* use FB_IO_HELPERS option

---
  drivers/gpu/drm/armada/Kconfig        | 1 +
  drivers/gpu/drm/armada/armada_fbdev.c | 9 ++++-----
  2 files changed, 5 insertions(+), 5 deletions(-)
drivers/gpu/drm/armada/Kconfig +1 -0
index f5c66d89ba99..5afade25e217 100644
@@ -3,6 +3,7 @@ config DRM_ARMADA
  	tristate "DRM support for Marvell Armada SoCs"
  	depends on DRM && HAVE_CLK && ARM && MMU
  	select DRM_KMS_HELPER
+	select FB_IO_HELPERS if DRM_FBDEV_EMULATION
  	help
  	  Support the "LCD" controllers found on the Marvell Armada 510
  	  devices.  There are two controllers on the device, each controller
drivers/gpu/drm/armada/armada_fbdev.c +1 -0
index 0a5fd1aa86eb..6c3bbaf53569 100644
@@ -5,6 +5,7 @@
   */
 
  #include <linux/errno.h>
+#include <linux/fb.h>
  #include <linux/kernel.h>
  #include <linux/module.h>
 

drivers/gpu/drm/armada/armada_fbdev.c static void armada_fbdev_fb_destroy(struct fb_info *info) · line 38

Quoted 5 lines
drivers/gpu/drm/armada/armada_fbdev.c +0 -2
@@ -34,11 +35,9 @@ static void armada_fbdev_fb_destroy(struct fb_info *info)
  static const struct fb_ops armada_fb_ops = {
  	.owner		= THIS_MODULE,
  	DRM_FB_HELPER_DEFAULT_OPS,
-	.fb_read	= drm_fb_helper_cfb_read,
-	.fb_write	= drm_fb_helper_cfb_write,

I had expected to see
.fb_read = fb_io_read,

But maybe this only used when using damage handling?

Likewise for drm_fb_helper_cfb_write.

??

Quoted 8 lines

drivers/gpu/drm/armada/armada_fbdev.c static void armada_fbdev_fb_destroy(struct fb_info *info) · line 40

Quoted 6 lines
drivers/gpu/drm/armada/armada_fbdev.c +3 -3
-	.fb_fillrect	= drm_fb_helper_cfb_fillrect,
-	.fb_copyarea	= drm_fb_helper_cfb_copyarea,
-	.fb_imageblit	= drm_fb_helper_cfb_imageblit,
+	.fb_fillrect	= cfb_fillrect,
+	.fb_copyarea	= cfb_copyarea,
+	.fb_imageblit	= cfb_imageblit,

This part is as expected.

Well, to me it looks like this has gone through an entire circular set of revisions:

commit e8b70e4dd7b5dad7c2379de6e0851587bf86bfd6

Author: Archit Taneja <[email protected]>
Date:   Wed Jul 22 14:58:04 2015 +0530

drm/armada: Use new drm_fb_helper functions

(quoted diff) +3 -3
-       .fb_fillrect    = cfb_fillrect,
-       .fb_copyarea    = cfb_copyarea,
-       .fb_imageblit   = cfb_imageblit,
+       .fb_fillrect    = drm_fb_helper_cfb_fillrect,
+       .fb_copyarea    = drm_fb_helper_cfb_copyarea,
+       .fb_imageblit   = drm_fb_helper_cfb_imageblit,

commit 983780918c759fdbbf0bf033e701bbff75d2af23

Author: Thomas Zimmermann <[email protected]>
Date:   Thu Nov 3 16:14:40 2022 +0100

drm/fb-helper: Perform all fbdev I/O with the same implementation

(quoted diff) +2 -0
+       .fb_read        = drm_fb_helper_cfb_read,
+       .fb_write       = drm_fb_helper_cfb_write,
Quoted 4 lines

and now effectively those two changes are being reverted, so we'd now be back to the pre-July 2015 state of affairs. As I believe the fbdev layer has been stable, this change merely reverts the driver back to what it once was.

Not quite. One long-standing problem has been that fbdev does not protect its public interfaces with CONFIG_FB. If fbdev had been disabled, DRM drivers could no longer be linked/loaded. DRM wrappers solved this. The issue has recently been fixed for all of DRM. DRM does not build it's fbdev emulation if CONFIG_FB has been disabled.

Another thing was that the original DRM wrappers might have been different from fbdev's I/O helpers in subtle ways. But now they are simple wrappers around their fbdev counterparts; plus the option of additional damage handling. But such damage handling is better implemented by the driver itself. The two cases that require it, i915 and fbdev-generic, are different enough that each should probably have it's own code.

Best regards
Thomas

Quoted 1 line
Signature · 6 lines
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)
author maintainer
#6 lore raw

Re: [PATCH v2 02/12] drm/armada: Use regular fbdev I/O helpers

In reply to Sam Ravnborg

Hi

Am 15.05.23 um 19:55 schrieb Sam Ravnborg:

Quoted 53 lines

Hi Thomas,

Quoted 42 lines · Thomas Zimmermann

Use the regular fbdev helpers for framebuffer I/O instead of DRM's helpers. Armada does not use damage handling, so DRM's fbdev helpers are mere wrappers around the fbdev code.

By using fbdev helpers directly within each DRM fbdev emulation, we can eventually remove DRM's wrapper functions entirely.

v2:
* use FB_IO_HELPERS option

---
  drivers/gpu/drm/armada/Kconfig        | 1 +
  drivers/gpu/drm/armada/armada_fbdev.c | 9 ++++-----
  2 files changed, 5 insertions(+), 5 deletions(-)
drivers/gpu/drm/armada/Kconfig +1 -0
index f5c66d89ba99..5afade25e217 100644
@@ -3,6 +3,7 @@ config DRM_ARMADA
  	tristate "DRM support for Marvell Armada SoCs"
  	depends on DRM && HAVE_CLK && ARM && MMU
  	select DRM_KMS_HELPER
+	select FB_IO_HELPERS if DRM_FBDEV_EMULATION
  	help
  	  Support the "LCD" controllers found on the Marvell Armada 510
  	  devices.  There are two controllers on the device, each controller
drivers/gpu/drm/armada/armada_fbdev.c +1 -0
index 0a5fd1aa86eb..6c3bbaf53569 100644
@@ -5,6 +5,7 @@
   */
 
  #include <linux/errno.h>
+#include <linux/fb.h>
  #include <linux/kernel.h>
  #include <linux/module.h>
 

drivers/gpu/drm/armada/armada_fbdev.c static void armada_fbdev_fb_destroy(struct fb_info *info) · line 38

Quoted 5 lines
drivers/gpu/drm/armada/armada_fbdev.c +0 -2
@@ -34,11 +35,9 @@ static void armada_fbdev_fb_destroy(struct fb_info *info)
  static const struct fb_ops armada_fb_ops = {
  	.owner		= THIS_MODULE,
  	DRM_FB_HELPER_DEFAULT_OPS,
-	.fb_read	= drm_fb_helper_cfb_read,
-	.fb_write	= drm_fb_helper_cfb_write,

I had expected to see
.fb_read = fb_io_read,

Quoted 1 line

But maybe this only used when using damage handling?

fb_io_read() and fb_io_write() are the default implementations. They are called when no callback has been set. All the other fbdev drivers leave them out, so I kept this pattern for the DRM side as well.

Best regards
Thomas

Quoted 21 lines

Likewise for drm_fb_helper_cfb_write.

??

drivers/gpu/drm/armada/armada_fbdev.c static void armada_fbdev_fb_destroy(struct fb_info *info) · line 40

Quoted 6 lines
drivers/gpu/drm/armada/armada_fbdev.c +3 -3
-	.fb_fillrect	= drm_fb_helper_cfb_fillrect,
-	.fb_copyarea	= drm_fb_helper_cfb_copyarea,
-	.fb_imageblit	= drm_fb_helper_cfb_imageblit,
+	.fb_fillrect	= cfb_fillrect,
+	.fb_copyarea	= cfb_copyarea,
+	.fb_imageblit	= cfb_imageblit,

This part is as expected.

Sam

Quoted 5 lines
drivers/gpu/drm/armada/armada_fbdev.c +0 -0
  	.fb_destroy	= armada_fbdev_fb_destroy,
  };
 
Signature · 1 line
2.40.1
Signature · 6 lines
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)
author maintainer
#7 lore raw

PATCH v2 3/12 drm/exynos: Use regular fbdev I/O helpers

In reply to Thomas Zimmermann

Use the regular fbdev helpers for framebuffer I/O instead of DRM's helpers. Exynos does not use damage handling, so DRM's fbdev helpers are mere wrappers around the fbdev code.

By using fbdev helpers directly within each DRM fbdev emulation, we can eventually remove DRM's wrapper functions entirely.

v2:
* use FB_IO_HELPERS option

Cc Inki Dae <[email protected]>
Cc Seung-Woo Kim <[email protected]>
Cc Kyungmin Park <[email protected]>
Cc Krzysztof Kozlowski <[email protected]>
Cc Alim Akhtar <[email protected]>
---
 drivers/gpu/drm/exynos/Kconfig            |  1 +
 drivers/gpu/drm/exynos/Makefile           |  2 +-
 drivers/gpu/drm/exynos/exynos_drm_fbdev.c | 10 +++++-----
 3 files changed, 7 insertions(+), 6 deletions(-)
drivers/gpu/drm/exynos/Kconfig +1 -0
index 0cb92d651ff1..7ca7e1dab52c 100644
@@ -7,6 +7,7 @@ config DRM_EXYNOS
 	select DRM_DISPLAY_HELPER if DRM_EXYNOS_DP
 	select DRM_KMS_HELPER
 	select VIDEOMODE_HELPERS
+	select FB_IO_HELPERS if DRM_FBDEV_EMULATION
 	select SND_SOC_HDMI_CODEC if SND_SOC
 	help
 	  Choose this option if you have a Samsung SoC Exynos chipset.
drivers/gpu/drm/exynos/Makefile +1 -1
index 2fd2f3ee4fcf..233a66036584 100644
@@ -6,7 +6,6 @@
 exynosdrm-y := exynos_drm_drv.o exynos_drm_crtc.o exynos_drm_fb.o \
 		exynos_drm_gem.o exynos_drm_plane.o exynos_drm_dma.o
 
-exynosdrm-$(CONFIG_DRM_FBDEV_EMULATION) += exynos_drm_fbdev.o
 exynosdrm-$(CONFIG_DRM_EXYNOS_FIMD)	+= exynos_drm_fimd.o
 exynosdrm-$(CONFIG_DRM_EXYNOS5433_DECON)	+= exynos5433_drm_decon.o
 exynosdrm-$(CONFIG_DRM_EXYNOS7_DECON)	+= exynos7_drm_decon.o
@@ -23,5 +22,6 @@ exynosdrm-$(CONFIG_DRM_EXYNOS_ROTATOR)	+= exynos_drm_rotator.o
 exynosdrm-$(CONFIG_DRM_EXYNOS_SCALER)	+= exynos_drm_scaler.o
 exynosdrm-$(CONFIG_DRM_EXYNOS_GSC)	+= exynos_drm_gsc.o
 exynosdrm-$(CONFIG_DRM_EXYNOS_MIC)     += exynos_drm_mic.o
+exynosdrm-$(CONFIG_DRM_FBDEV_EMULATION)	+= exynos_drm_fbdev.o
 
 obj-$(CONFIG_DRM_EXYNOS)		+= exynosdrm.o
drivers/gpu/drm/exynos/exynos_drm_fbdev.c +5 -5
index ea4b3d248aac..b3333dd1d087 100644
@@ -8,6 +8,8 @@
  *	Seung-Woo Kim <[email protected]>
  */
 
+#include <linux/fb.h>
+
 #include <drm/drm_crtc_helper.h>
 #include <drm/drm_drv.h>
 #include <drm/drm_fb_helper.h>
@@ -49,11 +51,9 @@ static const struct fb_ops exynos_drm_fb_ops = {
 	.owner		= THIS_MODULE,
 	DRM_FB_HELPER_DEFAULT_OPS,
 	.fb_mmap        = exynos_drm_fb_mmap,
-	.fb_read	= drm_fb_helper_cfb_read,
-	.fb_write	= drm_fb_helper_cfb_write,
-	.fb_fillrect	= drm_fb_helper_cfb_fillrect,
-	.fb_copyarea	= drm_fb_helper_cfb_copyarea,
-	.fb_imageblit	= drm_fb_helper_cfb_imageblit,
+	.fb_fillrect	= cfb_fillrect,
+	.fb_copyarea	= cfb_copyarea,
+	.fb_imageblit	= cfb_imageblit,
 	.fb_destroy	= exynos_drm_fb_destroy,
 };
 
Signature · 1 line
2.40.1
#8 lore raw

Re: [PATCH v2 03/12] drm/exynos: Use regular fbdev I/O helpers

Hi Thomas,

Quoted 47 lines · Thomas Zimmermann

Use the regular fbdev helpers for framebuffer I/O instead of DRM's helpers. Exynos does not use damage handling, so DRM's fbdev helpers are mere wrappers around the fbdev code.

By using fbdev helpers directly within each DRM fbdev emulation, we can eventually remove DRM's wrapper functions entirely.

v2:
* use FB_IO_HELPERS option

Cc Inki Dae <[email protected]>
Cc Seung-Woo Kim <[email protected]>
Cc Kyungmin Park <[email protected]>
Cc Krzysztof Kozlowski <[email protected]>
Cc Alim Akhtar <[email protected]>
---
 drivers/gpu/drm/exynos/Kconfig            |  1 +
 drivers/gpu/drm/exynos/Makefile           |  2 +-
 drivers/gpu/drm/exynos/exynos_drm_fbdev.c | 10 +++++-----
 3 files changed, 7 insertions(+), 6 deletions(-)
drivers/gpu/drm/exynos/Kconfig +1 -0
index 0cb92d651ff1..7ca7e1dab52c 100644
@@ -7,6 +7,7 @@ config DRM_EXYNOS
 	select DRM_DISPLAY_HELPER if DRM_EXYNOS_DP
 	select DRM_KMS_HELPER
 	select VIDEOMODE_HELPERS
+	select FB_IO_HELPERS if DRM_FBDEV_EMULATION
 	select SND_SOC_HDMI_CODEC if SND_SOC
 	help
 	  Choose this option if you have a Samsung SoC Exynos chipset.
drivers/gpu/drm/exynos/Makefile +0 -1
index 2fd2f3ee4fcf..233a66036584 100644
@@ -6,7 +6,6 @@
 exynosdrm-y := exynos_drm_drv.o exynos_drm_crtc.o exynos_drm_fb.o \
 		exynos_drm_gem.o exynos_drm_plane.o exynos_drm_dma.o
 
-exynosdrm-$(CONFIG_DRM_FBDEV_EMULATION) += exynos_drm_fbdev.o
 exynosdrm-$(CONFIG_DRM_EXYNOS_FIMD)	+= exynos_drm_fimd.o
 exynosdrm-$(CONFIG_DRM_EXYNOS5433_DECON)	+= exynos5433_drm_decon.o
 exynosdrm-$(CONFIG_DRM_EXYNOS7_DECON)	+= exynos7_drm_decon.o

drivers/gpu/drm/exynos/Makefile exynosdrm-$(CONFIG_DRM_EXYNOS_ROTATOR) += exynos_drm_rotator.o · line 25

Quoted 4 lines
drivers/gpu/drm/exynos/Makefile +1 -0
@@ -23,5 +22,6 @@ exynosdrm-$(CONFIG_DRM_EXYNOS_ROTATOR)	+= exynos_drm_rotator.o
 exynosdrm-$(CONFIG_DRM_EXYNOS_SCALER)	+= exynos_drm_scaler.o
 exynosdrm-$(CONFIG_DRM_EXYNOS_GSC)	+= exynos_drm_gsc.o
 exynosdrm-$(CONFIG_DRM_EXYNOS_MIC)     += exynos_drm_mic.o
+exynosdrm-$(CONFIG_DRM_FBDEV_EMULATION)	+= exynos_drm_fbdev.o

What does this change do?
Maybe something that was left by accident?

Sam

Quoted 32 lines
drivers/gpu/drm/exynos/Makefile +0 -0
 obj-$(CONFIG_DRM_EXYNOS)		+= exynosdrm.o
drivers/gpu/drm/exynos/exynos_drm_fbdev.c +5 -5
index ea4b3d248aac..b3333dd1d087 100644
@@ -8,6 +8,8 @@
  *	Seung-Woo Kim <[email protected]>
  */
 
+#include <linux/fb.h>
+
 #include <drm/drm_crtc_helper.h>
 #include <drm/drm_drv.h>
 #include <drm/drm_fb_helper.h>
@@ -49,11 +51,9 @@ static const struct fb_ops exynos_drm_fb_ops = {
 	.owner		= THIS_MODULE,
 	DRM_FB_HELPER_DEFAULT_OPS,
 	.fb_mmap        = exynos_drm_fb_mmap,
-	.fb_read	= drm_fb_helper_cfb_read,
-	.fb_write	= drm_fb_helper_cfb_write,
-	.fb_fillrect	= drm_fb_helper_cfb_fillrect,
-	.fb_copyarea	= drm_fb_helper_cfb_copyarea,
-	.fb_imageblit	= drm_fb_helper_cfb_imageblit,
+	.fb_fillrect	= cfb_fillrect,
+	.fb_copyarea	= cfb_copyarea,
+	.fb_imageblit	= cfb_imageblit,
 	.fb_destroy	= exynos_drm_fb_destroy,
 };
 
Signature · 1 line
2.40.1
author maintainer
#9 lore raw

Re: [PATCH v2 03/12] drm/exynos: Use regular fbdev I/O helpers

Hi Sam

Am 15.05.23 um 19:43 schrieb Sam Ravnborg:

Quoted 45 lines

Hi Thomas,

Quoted 42 lines · Thomas Zimmermann

Use the regular fbdev helpers for framebuffer I/O instead of DRM's helpers. Exynos does not use damage handling, so DRM's fbdev helpers are mere wrappers around the fbdev code.

By using fbdev helpers directly within each DRM fbdev emulation, we can eventually remove DRM's wrapper functions entirely.

v2:
* use FB_IO_HELPERS option

Cc Inki Dae <[email protected]>
Cc Seung-Woo Kim <[email protected]>
Cc Kyungmin Park <[email protected]>
Cc Krzysztof Kozlowski <[email protected]>
Cc Alim Akhtar <[email protected]>
---
  drivers/gpu/drm/exynos/Kconfig            |  1 +
  drivers/gpu/drm/exynos/Makefile           |  2 +-
  drivers/gpu/drm/exynos/exynos_drm_fbdev.c | 10 +++++-----
  3 files changed, 7 insertions(+), 6 deletions(-)
drivers/gpu/drm/exynos/Kconfig +1 -0
index 0cb92d651ff1..7ca7e1dab52c 100644
@@ -7,6 +7,7 @@ config DRM_EXYNOS
  	select DRM_DISPLAY_HELPER if DRM_EXYNOS_DP
  	select DRM_KMS_HELPER
  	select VIDEOMODE_HELPERS
+	select FB_IO_HELPERS if DRM_FBDEV_EMULATION
  	select SND_SOC_HDMI_CODEC if SND_SOC
  	help
  	  Choose this option if you have a Samsung SoC Exynos chipset.
drivers/gpu/drm/exynos/Makefile +0 -0
index 2fd2f3ee4fcf..233a66036584 100644
@@ -6,7 +6,6 @@
  exynosdrm-y := exynos_drm_drv.o exynos_drm_crtc.o exynos_drm_fb.o \
  		exynos_drm_gem.o exynos_drm_plane.o exynos_drm_dma.o
 
Quoted 11 lines

drivers/gpu/drm/exynos/Makefile exynosdrm-$(CONFIG_DRM_EXYNOS_ROTATOR) += exynos_drm_rotator.o · line 25

Quoted 9 lines
drivers/gpu/drm/exynos/Makefile +1 -1
-exynosdrm-$(CONFIG_DRM_FBDEV_EMULATION) += exynos_drm_fbdev.o
  exynosdrm-$(CONFIG_DRM_EXYNOS_FIMD)	+= exynos_drm_fimd.o
  exynosdrm-$(CONFIG_DRM_EXYNOS5433_DECON)	+= exynos5433_drm_decon.o
  exynosdrm-$(CONFIG_DRM_EXYNOS7_DECON)	+= exynos7_drm_decon.o
@@ -23,5 +22,6 @@ exynosdrm-$(CONFIG_DRM_EXYNOS_ROTATOR)	+= exynos_drm_rotator.o
  exynosdrm-$(CONFIG_DRM_EXYNOS_SCALER)	+= exynos_drm_scaler.o
  exynosdrm-$(CONFIG_DRM_EXYNOS_GSC)	+= exynos_drm_gsc.o
  exynosdrm-$(CONFIG_DRM_EXYNOS_MIC)     += exynos_drm_mic.o
+exynosdrm-$(CONFIG_DRM_FBDEV_EMULATION)	+= exynos_drm_fbdev.o

What does this change do?
Maybe something that was left by accident?

It reorders the statements alphabetically. I can remove this, if unwanted.

Best regards
Thomas

Quoted 35 lines

Sam

Quoted 32 lines
drivers/gpu/drm/exynos/Makefile +0 -0
  obj-$(CONFIG_DRM_EXYNOS)		+= exynosdrm.o
drivers/gpu/drm/exynos/exynos_drm_fbdev.c +5 -5
index ea4b3d248aac..b3333dd1d087 100644
@@ -8,6 +8,8 @@
   *	Seung-Woo Kim <[email protected]>
   */
 
+#include <linux/fb.h>
+
  #include <drm/drm_crtc_helper.h>
  #include <drm/drm_drv.h>
  #include <drm/drm_fb_helper.h>
@@ -49,11 +51,9 @@ static const struct fb_ops exynos_drm_fb_ops = {
  	.owner		= THIS_MODULE,
  	DRM_FB_HELPER_DEFAULT_OPS,
  	.fb_mmap        = exynos_drm_fb_mmap,
-	.fb_read	= drm_fb_helper_cfb_read,
-	.fb_write	= drm_fb_helper_cfb_write,
-	.fb_fillrect	= drm_fb_helper_cfb_fillrect,
-	.fb_copyarea	= drm_fb_helper_cfb_copyarea,
-	.fb_imageblit	= drm_fb_helper_cfb_imageblit,
+	.fb_fillrect	= cfb_fillrect,
+	.fb_copyarea	= cfb_copyarea,
+	.fb_imageblit	= cfb_imageblit,
  	.fb_destroy	= exynos_drm_fb_destroy,
  };
 
Signature · 1 line
2.40.1
Signature · 6 lines
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)
author maintainer
#10 lore raw

PATCH v2 4/12 drm/gma500: Use regular fbdev I/O helpers

In reply to Thomas Zimmermann

Use the regular fbdev helpers for framebuffer I/O instead of DRM's helpers. Gma500 does not use damage handling, so DRM's fbdev helpers are mere wrappers around the fbdev code.

By using fbdev helpers directly within each DRM fbdev emulation, we can eventually remove DRM's wrapper functions entirely.

v2:
* use FB_IO_HELPERS option

---
 drivers/gpu/drm/gma500/Kconfig | 1 +
 drivers/gpu/drm/gma500/fbdev.c | 9 ++++-----
 2 files changed, 5 insertions(+), 5 deletions(-)
drivers/gpu/drm/gma500/Kconfig +1 -0
index 2efc0eb41c64..cd3d92725ed4 100644
@@ -3,6 +3,7 @@ config DRM_GMA500
 	tristate "Intel GMA500/600/3600/3650 KMS Framebuffer"
 	depends on DRM && PCI && X86 && MMU
 	select DRM_KMS_HELPER
+	select FB_IO_HELPERS if DRM_FBDEV_EMULATION
 	select I2C
 	select I2C_ALGOBIT
 	# GMA500 depends on ACPI_VIDEO when ACPI is enabled, just like i915
drivers/gpu/drm/gma500/fbdev.c +4 -5
index 62287407e717..60005c3d01d0 100644
@@ -5,6 +5,7 @@
  *
  **************************************************************************/
 
+#include <linux/fb.h>
 #include <linux/pfn_t.h>
 
 #include <drm/drm_crtc_helper.h>
@@ -136,11 +137,9 @@ static const struct fb_ops psb_fbdev_fb_ops = {
 	.owner = THIS_MODULE,
 	DRM_FB_HELPER_DEFAULT_OPS,
 	.fb_setcolreg = psb_fbdev_fb_setcolreg,
-	.fb_read = drm_fb_helper_cfb_read,
-	.fb_write = drm_fb_helper_cfb_write,
-	.fb_fillrect = drm_fb_helper_cfb_fillrect,
-	.fb_copyarea = drm_fb_helper_cfb_copyarea,
-	.fb_imageblit = drm_fb_helper_cfb_imageblit,
+	.fb_fillrect = cfb_fillrect,
+	.fb_copyarea = cfb_copyarea,
+	.fb_imageblit = cfb_imageblit,
 	.fb_mmap = psb_fbdev_fb_mmap,
 	.fb_destroy = psb_fbdev_fb_destroy,
 };
Signature · 7 lines
2.40.1


_______________________________________________
linux-arm-kernel mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
author maintainer
#11 lore raw

PATCH v2 5/12 drm/radeon: Use regular fbdev I/O helpers

In reply to Thomas Zimmermann

Use the regular fbdev helpers for framebuffer I/O instead of DRM's helpers. Radeon does not use damage handling, so DRM's fbdev helpers are mere wrappers around the fbdev code.

By using fbdev helpers directly within each DRM fbdev emulation, we can eventually remove DRM's wrapper functions entirely.

v2:
* use FB_IO_HELPERS option

Cc Alex Deucher <[email protected]>
Cc "Christian König" <[email protected]>
Cc "Pan, Xinhui" <[email protected]>
---
 drivers/gpu/drm/radeon/Kconfig        | 1 +
 drivers/gpu/drm/radeon/radeon_fbdev.c | 9 ++++-----
 2 files changed, 5 insertions(+), 5 deletions(-)
drivers/gpu/drm/radeon/Kconfig +1 -0
index e19d77d58810..fe498c8af1bb 100644
@@ -11,6 +11,7 @@ config DRM_RADEON
 	select DRM_SUBALLOC_HELPER
         select DRM_TTM
 	select DRM_TTM_HELPER
+	select FB_IO_HELPERS if DRM_FBDEV_EMULATION
 	select SND_HDA_COMPONENT if SND_HDA_CORE
 	select POWER_SUPPLY
 	select HWMON
drivers/gpu/drm/radeon/radeon_fbdev.c +4 -5
index fe76e29910ef..dcabe527f9c0 100644
@@ -24,6 +24,7 @@
  *     David Airlie
  */
 
+#include <linux/fb.h>
 #include <linux/pci.h>
 #include <linux/pm_runtime.h>
 #include <linux/vga_switcheroo.h>
@@ -193,11 +194,9 @@ static const struct fb_ops radeon_fbdev_fb_ops = {
 	DRM_FB_HELPER_DEFAULT_OPS,
 	.fb_open = radeon_fbdev_fb_open,
 	.fb_release = radeon_fbdev_fb_release,
-	.fb_read = drm_fb_helper_cfb_read,
-	.fb_write = drm_fb_helper_cfb_write,
-	.fb_fillrect = drm_fb_helper_cfb_fillrect,
-	.fb_copyarea = drm_fb_helper_cfb_copyarea,
-	.fb_imageblit = drm_fb_helper_cfb_imageblit,
+	.fb_fillrect = cfb_fillrect,
+	.fb_copyarea = cfb_copyarea,
+	.fb_imageblit = cfb_imageblit,
 	.fb_destroy = radeon_fbdev_fb_destroy,
 };
 
Signature · 1 line
2.40.1
author maintainer
#12 lore raw

PATCH v2 6/12 drm/fbdev-dma: Use regular fbdev I/O helpers

In reply to Thomas Zimmermann

Use the regular fbdev helpers for framebuffer I/O instead of DRM's helpers. Fbdev-dma does not use damage handling, so DRM's fbdev helpers are mere wrappers around the fbdev code.

By using fbdev helpers directly within each DRM fbdev emulation, we can eventually remove DRM's wrapper functions entirely.

v2:
* use FB_SYS_HELPERS option

---
 drivers/gpu/drm/Kconfig         |  1 +
 drivers/gpu/drm/drm_fbdev_dma.c | 12 +++++++-----
 2 files changed, 8 insertions(+), 5 deletions(-)
drivers/gpu/drm/Kconfig +1 -0
index ba3fb04bb691..77fb10ddd8a2 100644
@@ -223,6 +223,7 @@ config DRM_TTM_HELPER
 config DRM_GEM_DMA_HELPER
 	tristate
 	depends on DRM
+	select FB_SYS_HELPERS if DRM_FBDEV_EMULATION
 	help
 	  Choose this if you need the GEM DMA helper functions
 
drivers/gpu/drm/drm_fbdev_dma.c +7 -5
index 728deffcc0d9..09a36dc38c43 100644
@@ -1,5 +1,7 @@
 // SPDX-License-Identifier: MIT
 
+#include <linux/fb.h>
+
 #include <drm/drm_crtc_helper.h>
 #include <drm/drm_drv.h>
 #include <drm/drm_fb_helper.h>
@@ -64,12 +66,12 @@ static const struct fb_ops drm_fbdev_dma_fb_ops = {
 	.owner = THIS_MODULE,
 	.fb_open = drm_fbdev_dma_fb_open,
 	.fb_release = drm_fbdev_dma_fb_release,
-	.fb_read = drm_fb_helper_sys_read,
-	.fb_write = drm_fb_helper_sys_write,
+	.fb_read = fb_sys_read,
+	.fb_write = fb_sys_write,
 	DRM_FB_HELPER_DEFAULT_OPS,
-	.fb_fillrect = drm_fb_helper_sys_fillrect,
-	.fb_copyarea = drm_fb_helper_sys_copyarea,
-	.fb_imageblit = drm_fb_helper_sys_imageblit,
+	.fb_fillrect = sys_fillrect,
+	.fb_copyarea = sys_copyarea,
+	.fb_imageblit = sys_imageblit,
 	.fb_destroy = drm_fbdev_dma_fb_destroy,
 	.fb_mmap = drm_fbdev_dma_fb_mmap,
 };
Signature · 1 line
2.40.1
author maintainer
#13 lore raw

PATCH v2 7/12 drm/msm: Use regular fbdev I/O helpers

In reply to Thomas Zimmermann

Use the regular fbdev helpers for framebuffer I/O instead of DRM's helpers. Msm does not use damage handling, so DRM's fbdev helpers are mere wrappers around the fbdev code.

By using fbdev helpers directly within each DRM fbdev emulation, we can eventually remove DRM's wrapper functions entirely.

v2:
* use FB_SYS_HELPERS option

---
 drivers/gpu/drm/msm/Kconfig     |  1 +
 drivers/gpu/drm/msm/msm_fbdev.c | 12 +++++++-----
 2 files changed, 8 insertions(+), 5 deletions(-)
drivers/gpu/drm/msm/Kconfig +1 -0
index 85f5ab1d552c..a78662bd6273 100644
@@ -21,6 +21,7 @@ config DRM_MSM
 	select DRM_BRIDGE
 	select DRM_PANEL_BRIDGE
 	select DRM_SCHED
+	select FB_SYS_HELPERS if DRM_FBDEV_EMULATION
 	select SHMEM
 	select TMPFS
 	select QCOM_SCM
drivers/gpu/drm/msm/msm_fbdev.c +7 -5
index 2ebc86381e1c..fc0353a4160e 100644
@@ -4,6 +4,8 @@
  * Author: Rob Clark <[email protected]>
  */
 
+#include <linux/fb.h>
+
 #include <drm/drm_drv.h>
 #include <drm/drm_crtc_helper.h>
 #include <drm/drm_fb_helper.h>
@@ -57,11 +59,11 @@ static const struct fb_ops msm_fb_ops = {
 	/* Note: to properly handle manual update displays, we wrap the
 	 * basic fbdev ops which write to the framebuffer
 	 */
-	.fb_read = drm_fb_helper_sys_read,
-	.fb_write = drm_fb_helper_sys_write,
-	.fb_fillrect = drm_fb_helper_sys_fillrect,
-	.fb_copyarea = drm_fb_helper_sys_copyarea,
-	.fb_imageblit = drm_fb_helper_sys_imageblit,
+	.fb_read = fb_sys_read,
+	.fb_write = fb_sys_write,
+	.fb_fillrect = sys_fillrect,
+	.fb_copyarea = sys_copyarea,
+	.fb_imageblit = sys_imageblit,
 	.fb_mmap = msm_fbdev_mmap,
 	.fb_destroy = msm_fbdev_fb_destroy,
 };
Signature · 7 lines
2.40.1


_______________________________________________
linux-arm-kernel mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
author maintainer
#14 lore raw

PATCH v2 8/12 drm/omapdrm: Use regular fbdev I/O helpers

In reply to Thomas Zimmermann

Use the regular fbdev helpers for framebuffer I/O instead of DRM's helpers. Omapdrm does not use damage handling, so DRM's fbdev helpers are mere wrappers around the fbdev code.

By using fbdev helpers directly within each DRM fbdev emulation, we can eventually remove DRM's wrapper functions entirely.

v2:
* use FB_SYS_HELPERS option

---
 drivers/gpu/drm/omapdrm/Kconfig      |  1 +
 drivers/gpu/drm/omapdrm/omap_fbdev.c | 12 +++++++-----
 2 files changed, 8 insertions(+), 5 deletions(-)
drivers/gpu/drm/omapdrm/Kconfig +1 -0
index 76ded1568bd0..b4ac76c9f31b 100644
@@ -4,6 +4,7 @@ config DRM_OMAP
 	depends on DRM && OF
 	depends on ARCH_OMAP2PLUS
 	select DRM_KMS_HELPER
+	select FB_SYS_HELPERS if DRM_FBDEV_EMULATION
 	select VIDEOMODE_HELPERS
 	select HDMI
 	default n
drivers/gpu/drm/omapdrm/omap_fbdev.c +7 -5
index b950e93b3846..55a65b81ccdc 100644
@@ -4,6 +4,8 @@
  * Author: Rob Clark <[email protected]>
  */
 
+#include <linux/fb.h>
+
 #include <drm/drm_drv.h>
 #include <drm/drm_crtc_helper.h>
 #include <drm/drm_fb_helper.h>
@@ -103,11 +105,11 @@ static const struct fb_ops omap_fb_ops = {
 	.fb_pan_display = omap_fbdev_pan_display,
 	.fb_ioctl	= drm_fb_helper_ioctl,
 
-	.fb_read = drm_fb_helper_sys_read,
-	.fb_write = drm_fb_helper_sys_write,
-	.fb_fillrect = drm_fb_helper_sys_fillrect,
-	.fb_copyarea = drm_fb_helper_sys_copyarea,
-	.fb_imageblit = drm_fb_helper_sys_imageblit,
+	.fb_read = fb_sys_read,
+	.fb_write = fb_sys_write,
+	.fb_fillrect = sys_fillrect,
+	.fb_copyarea = sys_copyarea,
+	.fb_imageblit = sys_imageblit,
 
 	.fb_destroy = omap_fbdev_fb_destroy,
 };
Signature · 1 line
2.40.1
author maintainer
#15 lore raw

PATCH v2 9/12 drm/tegra: Use regular fbdev I/O helpers

In reply to Thomas Zimmermann

Use the regular fbdev helpers for framebuffer I/O instead of DRM's helpers. Tegra does not use damage handling, so DRM's fbdev helpers are mere wrappers around the fbdev code.

By using fbdev helpers directly within each DRM fbdev emulation, we can eventually remove DRM's wrapper functions entirely.

v2:
* use FB_SYS_HELPERS option

Cc Thierry Reding <[email protected]>
Cc Mikko Perttunen <[email protected]>
Cc Jonathan Hunter <[email protected]>
---
 drivers/gpu/drm/tegra/Kconfig |  1 +
 drivers/gpu/drm/tegra/fbdev.c | 11 ++++++-----
 2 files changed, 7 insertions(+), 5 deletions(-)
drivers/gpu/drm/tegra/Kconfig +1 -0
index 56453ca277c2..498313778175 100644
@@ -12,6 +12,7 @@ config DRM_TEGRA
 	select DRM_KMS_HELPER
 	select DRM_MIPI_DSI
 	select DRM_PANEL
+	select FB_SYS_HELPERS if DRM_FBDEV_EMULATION
 	select TEGRA_HOST1X
 	select INTERCONNECT
 	select IOMMU_IOVA
drivers/gpu/drm/tegra/fbdev.c +6 -5
index dca9eccae466..144d851e566f 100644
@@ -8,6 +8,7 @@
  */
 
 #include <linux/console.h>
+#include <linux/fb.h>
 #include <linux/vmalloc.h>
 
 #include <drm/drm_drv.h>
@@ -59,11 +60,11 @@ static void tegra_fbdev_fb_destroy(struct fb_info *info)
 static const struct fb_ops tegra_fb_ops = {
 	.owner = THIS_MODULE,
 	DRM_FB_HELPER_DEFAULT_OPS,
-	.fb_read = drm_fb_helper_sys_read,
-	.fb_write = drm_fb_helper_sys_write,
-	.fb_fillrect = drm_fb_helper_sys_fillrect,
-	.fb_copyarea = drm_fb_helper_sys_copyarea,
-	.fb_imageblit = drm_fb_helper_sys_imageblit,
+	.fb_read = fb_sys_read,
+	.fb_write = fb_sys_write,
+	.fb_fillrect = sys_fillrect,
+	.fb_copyarea = sys_copyarea,
+	.fb_imageblit = sys_imageblit,
 	.fb_mmap = tegra_fb_mmap,
 	.fb_destroy = tegra_fbdev_fb_destroy,
 };
Signature · 1 line
2.40.1
author maintainer
#16 lore raw

PATCH v2 10/12 drm/fb-helper: Export helpers for marking damage areas

In reply to Thomas Zimmermann

Export drm_fb_helper_damage() and drm_fb_helper_damage_range(), which handle damage areas for fbdev emulation. This is a temporary export that allows to move the DRM I/O helpers for fbdev into drivers. Only fbdev-generic and i915 need them. Both will be updated to implement damage handling by themselves and the exported functions will be removed.

---
 drivers/gpu/drm/drm_fb_helper.c | 19 +++++++++++++++++--
 include/drm/drm_fb_helper.h     |  4 ++++
 2 files changed, 21 insertions(+), 2 deletions(-)
drivers/gpu/drm/drm_fb_helper.c +17 -2
index f0e9549b6bd7..8724e08c518b 100644
@@ -625,13 +625,15 @@ static void drm_fb_helper_add_damage_clip(struct drm_fb_helper *helper, u32 x, u
 	spin_unlock_irqrestore(&helper->damage_lock, flags);
 }
 
-static void drm_fb_helper_damage(struct drm_fb_helper *helper, u32 x, u32 y,
-				 u32 width, u32 height)
+/* Don't use in new code. */
+void drm_fb_helper_damage(struct drm_fb_helper *helper, u32 x, u32 y,
+			  u32 width, u32 height)
 {
 	drm_fb_helper_add_damage_clip(helper, x, y, width, height);
 
 	schedule_work(&helper->damage_work);
 }
+EXPORT_SYMBOL(drm_fb_helper_damage);
 
 /*
  * Convert memory region into area of scanlines and pixels per
@@ -670,6 +672,19 @@ static void drm_fb_helper_memory_range_to_clip(struct fb_info *info, off_t off,
 	drm_rect_init(clip, x1, y1, x2 - x1, y2 - y1);
 }
 
+/* Don't use in new code. */
+void drm_fb_helper_damage_range(struct drm_fb_helper *fb_helper, off_t off, size_t len)
+{
+	struct fb_info *info = fb_helper->info;
+	struct drm_rect damage_area;
+
+	drm_fb_helper_memory_range_to_clip(info, off, len, &damage_area);
+	drm_fb_helper_damage(fb_helper, damage_area.x1, damage_area.y1,
+			     drm_rect_width(&damage_area),
+			     drm_rect_height(&damage_area));
+}
+EXPORT_SYMBOL(drm_fb_helper_damage_range);
+
 /**
  * drm_fb_helper_deferred_io() - fbdev deferred_io callback function
  * @info: fb_info struct pointer
include/drm/drm_fb_helper.h +4 -0
index 72032c354a30..80c402f4e379 100644
@@ -253,6 +253,10 @@ void drm_fb_helper_fill_info(struct fb_info *info,
 			     struct drm_fb_helper *fb_helper,
 			     struct drm_fb_helper_surface_size *sizes);
 
+void drm_fb_helper_damage(struct drm_fb_helper *helper, u32 x, u32 y,
+			  u32 width, u32 height);
+void drm_fb_helper_damage_range(struct drm_fb_helper *helper, off_t off, size_t len);
+
 void drm_fb_helper_deferred_io(struct fb_info *info, struct list_head *pagereflist);
 
 ssize_t drm_fb_helper_sys_read(struct fb_info *info, char __user *buf,
Signature · 1 line
2.40.1
author maintainer
#17 lore raw

PATCH v2 11/12 drm/fbdev-generic: Implement dedicated fbdev I/O helpers

In reply to Thomas Zimmermann

Implement dedicated fbdev helpers for framebuffer I/O instead of using DRM's helpers. Fbdev-generic was the only caller of the DRM helpers, so remove them from the helper module.

v2:
* use FB_SYS_HELPERS_DEFERRED option

---
 drivers/gpu/drm/Kconfig             |   6 +-
 drivers/gpu/drm/drm_fb_helper.c     | 107 ----------------------------
 drivers/gpu/drm/drm_fbdev_generic.c |  47 ++++++++++--
 include/drm/drm_fb_helper.h         |  41 -----------
 4 files changed, 43 insertions(+), 158 deletions(-)
drivers/gpu/drm/Kconfig +1 -5
index 77fb10ddd8a2..92a782827b7b 100644
@@ -95,6 +95,7 @@ config DRM_KUNIT_TEST
 config DRM_KMS_HELPER
 	tristate
 	depends on DRM
+	select FB_SYS_HELPERS_DEFERRED if DRM_FBDEV_EMULATION
 	help
 	  CRTC helpers for KMS drivers.
 
@@ -135,11 +136,6 @@ config DRM_FBDEV_EMULATION
 	select FB_CFB_FILLRECT
 	select FB_CFB_COPYAREA
 	select FB_CFB_IMAGEBLIT
-	select FB_DEFERRED_IO
-	select FB_SYS_FOPS
-	select FB_SYS_FILLRECT
-	select FB_SYS_COPYAREA
-	select FB_SYS_IMAGEBLIT
 	select FRAMEBUFFER_CONSOLE if !EXPERT
 	select FRAMEBUFFER_CONSOLE_DETECT_PRIMARY if FRAMEBUFFER_CONSOLE
 	default y
drivers/gpu/drm/drm_fb_helper.c +0 -107

113 lines not on this page · raw message

drivers/gpu/drm/drm_fbdev_generic.c +42 -5

60 lines not on this page · raw message

include/drm/drm_fb_helper.h +0 -41

53 lines not on this page · raw message

Signature · 1 line
2.40.1
#18 lore raw

Re: [v2,11/12] drm/fbdev-generic: Implement dedicated fbdev I/O helpers

Hi, Thomas

After apply your patch set, the kernel with arch/loongarch/configs/loongson3_defconfig

can not finish compile anymore.  gcc complains:

  AR      drivers/gpu/built-in.a
  AR      drivers/built-in.a
  AR      built-in.a
  AR      vmlinux.a
  LD      vmlinux.o
  OBJCOPY modules.builtin.modinfo
  GEN     modules.builtin
  GEN     .vmlinux.objs
  MODPOST Module.symvers
ERROR: modpost: "fb_sys_write" [drivers/gpu/drm/drm_kms_helper.ko] undefined!
ERROR: modpost: "sys_imageblit" [drivers/gpu/drm/drm_kms_helper.ko] undefined!
ERROR: modpost: "sys_fillrect" [drivers/gpu/drm/drm_kms_helper.ko] undefined!
ERROR: modpost: "sys_copyarea" [drivers/gpu/drm/drm_kms_helper.ko] undefined!
ERROR: modpost: "fb_sys_read" [drivers/gpu/drm/drm_kms_helper.ko] undefined! make[1]: *** [scripts/Makefile.modpost:136: Module.symvers] Error 1
make: *** [Makefile:1978: modpost] Error 2

Quoted 20 lines · Thomas Zimmermann

Implement dedicated fbdev helpers for framebuffer I/O instead of using DRM's helpers. Fbdev-generic was the only caller of the DRM helpers, so remove them from the helper module.

v2:
* use FB_SYS_HELPERS_DEFERRED option

---
  drivers/gpu/drm/Kconfig             |   6 +-
  drivers/gpu/drm/drm_fb_helper.c     | 107 ----------------------------
  drivers/gpu/drm/drm_fbdev_generic.c |  47 ++++++++++--
  include/drm/drm_fb_helper.h         |  41 -----------
  4 files changed, 43 insertions(+), 158 deletions(-)
drivers/gpu/drm/Kconfig +0 -0
index 77fb10ddd8a2..92a782827b7b 100644

drivers/gpu/drm/Kconfig config DRM_KUNIT_TEST · line 98

Quoted 4 lines
drivers/gpu/drm/Kconfig +1 -0
@@ -95,6 +95,7 @@ config DRM_KUNIT_TEST
  config DRM_KMS_HELPER
  	tristate
  	depends on DRM
+	select FB_SYS_HELPERS_DEFERRED if DRM_FBDEV_EMULATION

Here, select FB_SYS_HELPERS helps resolve the above issue mentioned.

Quoted 258 lines
drivers/gpu/drm/Kconfig +0 -5
  	help
  	  CRTC helpers for KMS drivers.
 
@@ -135,11 +136,6 @@ config DRM_FBDEV_EMULATION
  	select FB_CFB_FILLRECT
  	select FB_CFB_COPYAREA
  	select FB_CFB_IMAGEBLIT
-	select FB_DEFERRED_IO
-	select FB_SYS_FOPS
-	select FB_SYS_FILLRECT
-	select FB_SYS_COPYAREA
-	select FB_SYS_IMAGEBLIT
  	select FRAMEBUFFER_CONSOLE if !EXPERT
  	select FRAMEBUFFER_CONSOLE_DETECT_PRIMARY if FRAMEBUFFER_CONSOLE
  	default y
drivers/gpu/drm/drm_fb_helper.c +0 -107
index 8724e08c518b..ba0a808f14ee 100644
@@ -729,113 +729,6 @@ void drm_fb_helper_deferred_io(struct fb_info *info, struct list_head *pagerefli
  }
  EXPORT_SYMBOL(drm_fb_helper_deferred_io);
 
-/**
- * drm_fb_helper_sys_read - Implements struct &fb_ops.fb_read for system memory
- * @info: fb_info struct pointer
- * @buf: userspace buffer to read from framebuffer memory
- * @count: number of bytes to read from framebuffer memory
- * @ppos: read offset within framebuffer memory
- *
- * Returns:
- * The number of bytes read on success, or an error code otherwise.
- */
-ssize_t drm_fb_helper_sys_read(struct fb_info *info, char __user *buf,
-			       size_t count, loff_t *ppos)
-{
-	return fb_sys_read(info, buf, count, ppos);
-}
-EXPORT_SYMBOL(drm_fb_helper_sys_read);
-
-/**
- * drm_fb_helper_sys_write - Implements struct &fb_ops.fb_write for system memory
- * @info: fb_info struct pointer
- * @buf: userspace buffer to write to framebuffer memory
- * @count: number of bytes to write to framebuffer memory
- * @ppos: write offset within framebuffer memory
- *
- * Returns:
- * The number of bytes written on success, or an error code otherwise.
- */
-ssize_t drm_fb_helper_sys_write(struct fb_info *info, const char __user *buf,
-				size_t count, loff_t *ppos)
-{
-	struct drm_fb_helper *helper = info->par;
-	loff_t pos = *ppos;
-	ssize_t ret;
-	struct drm_rect damage_area;
-
-	ret = fb_sys_write(info, buf, count, ppos);
-	if (ret <= 0)
-		return ret;
-
-	if (helper->funcs->fb_dirty) {
-		drm_fb_helper_memory_range_to_clip(info, pos, ret, &damage_area);
-		drm_fb_helper_damage(helper, damage_area.x1, damage_area.y1,
-				     drm_rect_width(&damage_area),
-				     drm_rect_height(&damage_area));
-	}
-
-	return ret;
-}
-EXPORT_SYMBOL(drm_fb_helper_sys_write);
-
-/**
- * drm_fb_helper_sys_fillrect - wrapper around sys_fillrect
- * @info: fbdev registered by the helper
- * @rect: info about rectangle to fill
- *
- * A wrapper around sys_fillrect implemented by fbdev core
- */
-void drm_fb_helper_sys_fillrect(struct fb_info *info,
-				const struct fb_fillrect *rect)
-{
-	struct drm_fb_helper *helper = info->par;
-
-	sys_fillrect(info, rect);
-
-	if (helper->funcs->fb_dirty)
-		drm_fb_helper_damage(helper, rect->dx, rect->dy, rect->width, rect->height);
-}
-EXPORT_SYMBOL(drm_fb_helper_sys_fillrect);
-
-/**
- * drm_fb_helper_sys_copyarea - wrapper around sys_copyarea
- * @info: fbdev registered by the helper
- * @area: info about area to copy
- *
- * A wrapper around sys_copyarea implemented by fbdev core
- */
-void drm_fb_helper_sys_copyarea(struct fb_info *info,
-				const struct fb_copyarea *area)
-{
-	struct drm_fb_helper *helper = info->par;
-
-	sys_copyarea(info, area);
-
-	if (helper->funcs->fb_dirty)
-		drm_fb_helper_damage(helper, area->dx, area->dy, area->width, area->height);
-}
-EXPORT_SYMBOL(drm_fb_helper_sys_copyarea);
-
-/**
- * drm_fb_helper_sys_imageblit - wrapper around sys_imageblit
- * @info: fbdev registered by the helper
- * @image: info about image to blit
- *
- * A wrapper around sys_imageblit implemented by fbdev core
- */
-void drm_fb_helper_sys_imageblit(struct fb_info *info,
-				 const struct fb_image *image)
-{
-	struct drm_fb_helper *helper = info->par;
-
-	sys_imageblit(info, image);
-
-	if (helper->funcs->fb_dirty)
-		drm_fb_helper_damage(helper, image->dx, image->dy, image->width, image->height);
-}
-EXPORT_SYMBOL(drm_fb_helper_sys_imageblit);
-
  /**
   * drm_fb_helper_cfb_read - Implements struct &fb_ops.fb_read for I/O memory
   * @info: fb_info struct pointer
drivers/gpu/drm/drm_fbdev_generic.c +42 -5
index 8e5148bf40bb..f53fc49e34a4 100644
@@ -34,6 +34,43 @@ static int drm_fbdev_generic_fb_release(struct fb_info *info, int user)
  	return 0;
  }
 
+static ssize_t drm_fbdev_generic_fb_write(struct fb_info *info, const char __user *buf,
+					  size_t count, loff_t *ppos)
+{
+	struct drm_fb_helper *helper = info->par;
+	loff_t pos = *ppos;
+	ssize_t ret;
+
+	ret = fb_sys_write(info, buf, count, ppos);
+	if (ret > 0)
+		drm_fb_helper_damage_range(helper, pos, ret);
+	return ret;
+}
+
+static void drm_fbdev_generic_fb_fillrect(struct fb_info *info, const struct fb_fillrect *rect)
+{
+	struct drm_fb_helper *helper = info->par;
+
+	sys_fillrect(info, rect);
+	drm_fb_helper_damage(helper, rect->dx, rect->dy, rect->width, rect->height);
+}
+
+static void drm_fbdev_generic_fb_copyarea(struct fb_info *info, const struct fb_copyarea *area)
+{
+	struct drm_fb_helper *helper = info->par;
+
+	sys_copyarea(info, area);
+	drm_fb_helper_damage(helper, area->dx, area->dy, area->width, area->height);
+}
+
+static void drm_fbdev_generic_fb_imageblit(struct fb_info *info, const struct fb_image *image)
+{
+	struct drm_fb_helper *helper = info->par;
+
+	sys_imageblit(info, image);
+	drm_fb_helper_damage(helper, image->dx, image->dy, image->width, image->height);
+}
+
  static void drm_fbdev_generic_fb_destroy(struct fb_info *info)
  {
  	struct drm_fb_helper *fb_helper = info->par;
@@ -56,12 +93,12 @@ static const struct fb_ops drm_fbdev_generic_fb_ops = {
  	.owner		= THIS_MODULE,
  	.fb_open	= drm_fbdev_generic_fb_open,
  	.fb_release	= drm_fbdev_generic_fb_release,
-	.fb_read	= drm_fb_helper_sys_read,
-	.fb_write	= drm_fb_helper_sys_write,
+	.fb_read	= fb_sys_read,
+	.fb_write	= drm_fbdev_generic_fb_write,
  	DRM_FB_HELPER_DEFAULT_OPS,
-	.fb_fillrect	= drm_fb_helper_sys_fillrect,
-	.fb_copyarea	= drm_fb_helper_sys_copyarea,
-	.fb_imageblit	= drm_fb_helper_sys_imageblit,
+	.fb_fillrect	= drm_fbdev_generic_fb_fillrect,
+	.fb_copyarea	= drm_fbdev_generic_fb_copyarea,
+	.fb_imageblit	= drm_fbdev_generic_fb_imageblit,
  	.fb_mmap	= fb_deferred_io_mmap,
  	.fb_destroy	= drm_fbdev_generic_fb_destroy,
  };
include/drm/drm_fb_helper.h +0 -41
index 80c402f4e379..e3240d749a43 100644
@@ -259,18 +259,6 @@ void drm_fb_helper_damage_range(struct drm_fb_helper *helper, off_t off, size_t
 
  void drm_fb_helper_deferred_io(struct fb_info *info, struct list_head *pagereflist);
 
-ssize_t drm_fb_helper_sys_read(struct fb_info *info, char __user *buf,
-			       size_t count, loff_t *ppos);
-ssize_t drm_fb_helper_sys_write(struct fb_info *info, const char __user *buf,
-				size_t count, loff_t *ppos);
-
-void drm_fb_helper_sys_fillrect(struct fb_info *info,
-				const struct fb_fillrect *rect);
-void drm_fb_helper_sys_copyarea(struct fb_info *info,
-				const struct fb_copyarea *area);
-void drm_fb_helper_sys_imageblit(struct fb_info *info,
-				 const struct fb_image *image);
-
  ssize_t drm_fb_helper_cfb_read(struct fb_info *info, char __user *buf,
  			       size_t count, loff_t *ppos);
  ssize_t drm_fb_helper_cfb_write(struct fb_info *info, const char __user *buf,
@@ -398,35 +386,6 @@ static inline int drm_fb_helper_defio_init(struct drm_fb_helper *fb_helper)
  	return -ENODEV;
  }
 
-static inline ssize_t drm_fb_helper_sys_read(struct fb_info *info,
-					     char __user *buf, size_t count,
-					     loff_t *ppos)
-{
-	return -ENODEV;
-}
-
-static inline ssize_t drm_fb_helper_sys_write(struct fb_info *info,
-					      const char __user *buf,
-					      size_t count, loff_t *ppos)
-{
-	return -ENODEV;
-}
-
-static inline void drm_fb_helper_sys_fillrect(struct fb_info *info,
-					      const struct fb_fillrect *rect)
-{
-}
-
-static inline void drm_fb_helper_sys_copyarea(struct fb_info *info,
-					      const struct fb_copyarea *area)
-{
-}
-
-static inline void drm_fb_helper_sys_imageblit(struct fb_info *info,
-					       const struct fb_image *image)
-{
-}
-
  static inline ssize_t drm_fb_helper_cfb_read(struct fb_info *info, char __user *buf,
  					     size_t count, loff_t *ppos)
  {
author maintainer
#19 lore raw

Re: [v2,11/12] drm/fbdev-generic: Implement dedicated fbdev I/O helpers

Hi

Am 17.05.23 um 03:58 schrieb Sui Jingfeng:

Quoted 8 lines

Hi, Thomas

After apply your patch set, the kernel with arch/loongarch/configs/loongson3_defconfig

can not finish compile anymore.  gcc complains:

Quoted 16 lines

  AR      drivers/gpu/built-in.a
  AR      drivers/built-in.a
  AR      built-in.a
  AR      vmlinux.a
  LD      vmlinux.o
  OBJCOPY modules.builtin.modinfo
  GEN     modules.builtin
  GEN     .vmlinux.objs
  MODPOST Module.symvers
ERROR: modpost: "fb_sys_write" [drivers/gpu/drm/drm_kms_helper.ko] undefined!
ERROR: modpost: "sys_imageblit" [drivers/gpu/drm/drm_kms_helper.ko] undefined!
ERROR: modpost: "sys_fillrect" [drivers/gpu/drm/drm_kms_helper.ko] undefined!
ERROR: modpost: "sys_copyarea" [drivers/gpu/drm/drm_kms_helper.ko] undefined!
ERROR: modpost: "fb_sys_read" [drivers/gpu/drm/drm_kms_helper.ko] undefined! make[1]: *** [scripts/Makefile.modpost:136: Module.symvers] Error 1
make: *** [Makefile:1978: modpost] Error 2

Thanks for reporting this problem. I found that it's caused by a typo in the very first patch 1/7, where these helpers are not selected correctly. Will be fixed in the next round.

Best regards
Thomas

Quoted 302 lines · Thomas Zimmermann
Quoted 20 lines

Implement dedicated fbdev helpers for framebuffer I/O instead of using DRM's helpers. Fbdev-generic was the only caller of the DRM helpers, so remove them from the helper module.

v2:
    * use FB_SYS_HELPERS_DEFERRED option

---
  drivers/gpu/drm/Kconfig             |   6 +- drivers/gpu/drm/drm_fb_helper.c     | 107 ---------------------------- drivers/gpu/drm/drm_fbdev_generic.c |  47 ++++++++++-- include/drm/drm_fb_helper.h         |  41 -----------

  4 files changed, 43 insertions(+), 158 deletions(-)
drivers/gpu/drm/Kconfig +0 -0
index 77fb10ddd8a2..92a782827b7b 100644
@@ -95,6 +95,7 @@ config DRM_KUNIT_TEST
Quoted 4 lines

  config DRM_KMS_HELPER
      tristate
      depends on DRM
+    select FB_SYS_HELPERS_DEFERRED if DRM_FBDEV_EMULATION

Here, select FB_SYS_HELPERS helps resolve the above issue mentioned.

Quoted 272 lines

      help
        CRTC helpers for KMS drivers.

drivers/gpu/drm/Kconfig +0 -0
@@ -135,11 +136,6 @@ config DRM_FBDEV_EMULATION

      select FB_CFB_FILLRECT
      select FB_CFB_COPYAREA
      select FB_CFB_IMAGEBLIT
-    select FB_DEFERRED_IO
-    select FB_SYS_FOPS
-    select FB_SYS_FILLRECT
-    select FB_SYS_COPYAREA
-    select FB_SYS_IMAGEBLIT
      select FRAMEBUFFER_CONSOLE if !EXPERT
      select FRAMEBUFFER_CONSOLE_DETECT_PRIMARY if FRAMEBUFFER_CONSOLE default y

drivers/gpu/drm/drm_fb_helper.c +0 -2
index 8724e08c518b..ba0a808f14ee 100644
@@ -729,113 +729,6 @@ void drm_fb_helper_deferred_io(struct fb_info 
 *info, struct list_head *pagerefli
   }
   EXPORT_SYMBOL(drm_fb_helper_deferred_io);
-/**
- * drm_fb_helper_sys_read - Implements struct &fb_ops.fb_read for 

system memory
- * @info: fb_info struct pointer
- * @buf: userspace buffer to read from framebuffer memory
- * @count: number of bytes to read from framebuffer memory
- * @ppos: read offset within framebuffer memory
- *
- * Returns:
- * The number of bytes read on success, or an error code otherwise.
- */

drivers/gpu/drm/drm_fb_helper.c +0 -9
-ssize_t drm_fb_helper_sys_read(struct fb_info *info, char __user *buf,
-                   size_t count, loff_t *ppos)
-{
-    return fb_sys_read(info, buf, count, ppos);
-}
-EXPORT_SYMBOL(drm_fb_helper_sys_read);
-
-/**
- * drm_fb_helper_sys_write - Implements struct &fb_ops.fb_write for 

system memory
- * @info: fb_info struct pointer
- * @buf: userspace buffer to write to framebuffer memory
- * @count: number of bytes to write to framebuffer memory
- * @ppos: write offset within framebuffer memory
- *
- * Returns:
- * The number of bytes written on success, or an error code otherwise.
- */
-ssize_t drm_fb_helper_sys_write(struct fb_info *info, const char __user *buf,
-                size_t count, loff_t *ppos)

drivers/gpu/drm/drm_fb_helper.c +0 -12
-{
-    struct drm_fb_helper *helper = info->par;
-    loff_t pos = *ppos;
-    ssize_t ret;
-    struct drm_rect damage_area;
-
-    ret = fb_sys_write(info, buf, count, ppos);
-    if (ret <= 0)
-        return ret;
-
-    if (helper->funcs->fb_dirty) {
-        drm_fb_helper_memory_range_to_clip(info, pos, ret, 

&damage_area);
-        drm_fb_helper_damage(helper, damage_area.x1, damage_area.y1, -                     drm_rect_width(&damage_area),
-                     drm_rect_height(&damage_area));
-    }

drivers/gpu/drm/drm_fb_helper.c +0 -21
-
-    return ret;
-}
-EXPORT_SYMBOL(drm_fb_helper_sys_write);
-
-/**
- * drm_fb_helper_sys_fillrect - wrapper around sys_fillrect
- * @info: fbdev registered by the helper
- * @rect: info about rectangle to fill
- *
- * A wrapper around sys_fillrect implemented by fbdev core
- */
-void drm_fb_helper_sys_fillrect(struct fb_info *info,
-                const struct fb_fillrect *rect)
-{
-    struct drm_fb_helper *helper = info->par;
-
-    sys_fillrect(info, rect);
-
-    if (helper->funcs->fb_dirty)
-        drm_fb_helper_damage(helper, rect->dx, rect->dy, rect->width, 

rect->height);

drivers/gpu/drm/drm_fb_helper.c +0 -19
-}
-EXPORT_SYMBOL(drm_fb_helper_sys_fillrect);
-
-/**
- * drm_fb_helper_sys_copyarea - wrapper around sys_copyarea
- * @info: fbdev registered by the helper
- * @area: info about area to copy
- *
- * A wrapper around sys_copyarea implemented by fbdev core
- */
-void drm_fb_helper_sys_copyarea(struct fb_info *info,
-                const struct fb_copyarea *area)
-{
-    struct drm_fb_helper *helper = info->par;
-
-    sys_copyarea(info, area);
-
-    if (helper->funcs->fb_dirty)
-        drm_fb_helper_damage(helper, area->dx, area->dy, area->width, 

area->height);

drivers/gpu/drm/drm_fb_helper.c +0 -19
-}
-EXPORT_SYMBOL(drm_fb_helper_sys_copyarea);
-
-/**
- * drm_fb_helper_sys_imageblit - wrapper around sys_imageblit
- * @info: fbdev registered by the helper
- * @image: info about image to blit
- *
- * A wrapper around sys_imageblit implemented by fbdev core
- */
-void drm_fb_helper_sys_imageblit(struct fb_info *info,
-                 const struct fb_image *image)
-{
-    struct drm_fb_helper *helper = info->par;
-
-    sys_imageblit(info, image);
-
-    if (helper->funcs->fb_dirty)
-        drm_fb_helper_damage(helper, image->dx, image->dy, 

image->width, image->height);

drivers/gpu/drm/drm_fb_helper.c +0 -3
-}
-EXPORT_SYMBOL(drm_fb_helper_sys_imageblit);
-

  /**
   * drm_fb_helper_cfb_read - Implements struct &fb_ops.fb_read for I/O memory
   * @info: fb_info struct pointer

drivers/gpu/drm/drm_fbdev_generic.c +22 -0
index 8e5148bf40bb..f53fc49e34a4 100644
@@ -34,6 +34,43 @@ static int drm_fbdev_generic_fb_release(struct 
 fb_info *info, int user)
       return 0;
   }
+static ssize_t drm_fbdev_generic_fb_write(struct fb_info *info, const 
 char __user *buf,
+                      size_t count, loff_t *ppos)
+{
+    struct drm_fb_helper *helper = info->par;
+    loff_t pos = *ppos;
+    ssize_t ret;
+
+    ret = fb_sys_write(info, buf, count, ppos);
+    if (ret > 0)
+        drm_fb_helper_damage_range(helper, pos, ret);
+    return ret;
+}
+
+static void drm_fbdev_generic_fb_fillrect(struct fb_info *info, const 
 struct fb_fillrect *rect)
+{
+    struct drm_fb_helper *helper = info->par;
+
+    sys_fillrect(info, rect);
+    drm_fb_helper_damage(helper, rect->dx, rect->dy, rect->width, 
 rect->height);
+}
+
+static void drm_fbdev_generic_fb_copyarea(struct fb_info *info, const 

struct fb_copyarea *area)

drivers/gpu/drm/drm_fbdev_generic.c +5 -0
+{
+    struct drm_fb_helper *helper = info->par;
+
+    sys_copyarea(info, area);
+    drm_fb_helper_damage(helper, area->dx, area->dy, area->width, 

area->height);

drivers/gpu/drm/drm_fbdev_generic.c +3 -0
+}
+
+static void drm_fbdev_generic_fb_imageblit(struct fb_info *info, 

const struct fb_image *image)

drivers/gpu/drm/drm_fbdev_generic.c +5 -0
+{
+    struct drm_fb_helper *helper = info->par;
+
+    sys_imageblit(info, image);
+    drm_fb_helper_damage(helper, image->dx, image->dy, image->width, 

image->height);

drivers/gpu/drm/drm_fbdev_generic.c +2 -0
+}
+

  static void drm_fbdev_generic_fb_destroy(struct fb_info *info) {
      struct drm_fb_helper *fb_helper = info->par;

drivers/gpu/drm/drm_fbdev_generic.c +5 -5
@@ -56,12 +93,12 @@ static const struct fb_ops 
 drm_fbdev_generic_fb_ops = {
       .owner        = THIS_MODULE,
       .fb_open    = drm_fbdev_generic_fb_open,
       .fb_release    = drm_fbdev_generic_fb_release,
-    .fb_read    = drm_fb_helper_sys_read,
-    .fb_write    = drm_fb_helper_sys_write,
+    .fb_read    = fb_sys_read,
+    .fb_write    = drm_fbdev_generic_fb_write,
       DRM_FB_HELPER_DEFAULT_OPS,
-    .fb_fillrect    = drm_fb_helper_sys_fillrect,
-    .fb_copyarea    = drm_fb_helper_sys_copyarea,
-    .fb_imageblit    = drm_fb_helper_sys_imageblit,
+    .fb_fillrect    = drm_fbdev_generic_fb_fillrect,
+    .fb_copyarea    = drm_fbdev_generic_fb_copyarea,
+    .fb_imageblit    = drm_fbdev_generic_fb_imageblit,
       .fb_mmap    = fb_deferred_io_mmap,
       .fb_destroy    = drm_fbdev_generic_fb_destroy,

  };

include/drm/drm_fb_helper.h +0 -0
index 80c402f4e379..e3240d749a43 100644
@@ -259,18 +259,6 @@ void drm_fb_helper_damage_range(struct 

drm_fb_helper *helper, off_t off, size_t
  void drm_fb_helper_deferred_io(struct fb_info *info, struct list_head *pagereflist);

include/drm/drm_fb_helper.h +0 -3
-ssize_t drm_fb_helper_sys_read(struct fb_info *info, char __user *buf,
-                   size_t count, loff_t *ppos);
-ssize_t drm_fb_helper_sys_write(struct fb_info *info, const char 

__user *buf,
-                size_t count, loff_t *ppos);

include/drm/drm_fb_helper.h +0 -8
-
-void drm_fb_helper_sys_fillrect(struct fb_info *info,
-                const struct fb_fillrect *rect);
-void drm_fb_helper_sys_copyarea(struct fb_info *info,
-                const struct fb_copyarea *area);
-void drm_fb_helper_sys_imageblit(struct fb_info *info,
-                 const struct fb_image *image);
-

  ssize_t drm_fb_helper_cfb_read(struct fb_info *info, char __user *buf, size_t count, loff_t *ppos);
  ssize_t drm_fb_helper_cfb_write(struct fb_info *info, const char __user *buf,

include/drm/drm_fb_helper.h +0 -29
@@ -398,35 +386,6 @@ static inline int drm_fb_helper_defio_init(struct 
 drm_fb_helper *fb_helper)
       return -ENODEV;
   }
-static inline ssize_t drm_fb_helper_sys_read(struct fb_info *info,
-                         char __user *buf, size_t count,
-                         loff_t *ppos)
-{
-    return -ENODEV;
-}
-
-static inline ssize_t drm_fb_helper_sys_write(struct fb_info *info,
-                          const char __user *buf,
-                          size_t count, loff_t *ppos)
-{
-    return -ENODEV;
-}
-
-static inline void drm_fb_helper_sys_fillrect(struct fb_info *info,
-                          const struct fb_fillrect *rect)
-{
-}
-
-static inline void drm_fb_helper_sys_copyarea(struct fb_info *info,
-                          const struct fb_copyarea *area)
-{
-}
-
-static inline void drm_fb_helper_sys_imageblit(struct fb_info *info,
-                           const struct fb_image *image)
-{
-}
-
   static inline ssize_t drm_fb_helper_cfb_read(struct fb_info *info, char __user *buf,
                            size_t count, loff_t *ppos)
   {
Signature · 6 lines
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)
#20 lore raw

Re: [v2,11/12] drm/fbdev-generic: Implement dedicated fbdev I/O helpers

Hi,

Quoted 28 lines · Thomas Zimmermann

Hi

Am 17.05.23 um 03:58 schrieb Sui Jingfeng:

Quoted 8 lines

Hi, Thomas

After apply your patch set, the kernel with arch/loongarch/configs/loongson3_defconfig

can not finish compile anymore.  gcc complains:

Quoted 16 lines

   AR      drivers/gpu/built-in.a
   AR      drivers/built-in.a
   AR      built-in.a
   AR      vmlinux.a
   LD      vmlinux.o
   OBJCOPY modules.builtin.modinfo
   GEN     modules.builtin
   GEN     .vmlinux.objs
   MODPOST Module.symvers
ERROR: modpost: "fb_sys_write" [drivers/gpu/drm/drm_kms_helper.ko] undefined!
ERROR: modpost: "sys_imageblit" [drivers/gpu/drm/drm_kms_helper.ko] undefined!
ERROR: modpost: "sys_fillrect" [drivers/gpu/drm/drm_kms_helper.ko] undefined!
ERROR: modpost: "sys_copyarea" [drivers/gpu/drm/drm_kms_helper.ko] undefined!
ERROR: modpost: "fb_sys_read" [drivers/gpu/drm/drm_kms_helper.ko] undefined! make[1]: *** [scripts/Makefile.modpost:136: Module.symvers] Error 1
make: *** [Makefile:1978: modpost] Error 2

Quoted 2 lines

Thanks for reporting this problem. I found that it's caused by a typo in the very first patch 1/7, where these helpers are not selected correctly. Will be fixed in the next round.

Yeah, this is just a typo.

Should replace 'FB_SYS_HELPER' with 'FB_SYS_HELPERS' on the first patch of this series.

Quoted 34 lines

Best regards
Thomas

Quoted 31 lines · Thomas Zimmermann
Quoted 21 lines

Implement dedicated fbdev helpers for framebuffer I/O instead of using DRM's helpers. Fbdev-generic was the only caller of the DRM helpers, so remove them from the helper module.

v2:
    * use FB_SYS_HELPERS_DEFERRED option

---
  drivers/gpu/drm/Kconfig             |   6 +- drivers/gpu/drm/drm_fb_helper.c     | 107
----------------------------
  drivers/gpu/drm/drm_fbdev_generic.c |  47 ++++++++++-- include/drm/drm_fb_helper.h         |  41 -----------

  4 files changed, 43 insertions(+), 158 deletions(-)
drivers/gpu/drm/Kconfig +0 -0
index 77fb10ddd8a2..92a782827b7b 100644
@@ -95,6 +95,7 @@ config DRM_KUNIT_TEST
Quoted 4 lines

  config DRM_KMS_HELPER
      tristate
      depends on DRM
+    select FB_SYS_HELPERS_DEFERRED if DRM_FBDEV_EMULATION

Here, select FB_SYS_HELPERS helps resolve the above issue mentioned.

But select FB_SYS_HELPERS here is more better, I think.  Because it show the nature that

DRM_KMS_HELPER is depend on FB_SYS_HELPERS, I think you may want isolate

those dependency with DRM_FBDEV_EMULATION guard.

at least, you should guarantee that drm itself could built and run standalone.

Fbdev emulation is a client of drm, not reverse.

By the way, does Denial happy about this,

maybe, he want the fbdev emulation 100% made in drm?

Quoted 273 lines
Quoted 272 lines
Quoted 272 lines

      help
        CRTC helpers for KMS drivers.

drivers/gpu/drm/Kconfig +0 -0
@@ -135,11 +136,6 @@ config DRM_FBDEV_EMULATION

      select FB_CFB_FILLRECT
      select FB_CFB_COPYAREA
      select FB_CFB_IMAGEBLIT
-    select FB_DEFERRED_IO
-    select FB_SYS_FOPS
-    select FB_SYS_FILLRECT
-    select FB_SYS_COPYAREA
-    select FB_SYS_IMAGEBLIT
      select FRAMEBUFFER_CONSOLE if !EXPERT
      select FRAMEBUFFER_CONSOLE_DETECT_PRIMARY if FRAMEBUFFER_CONSOLE default y

drivers/gpu/drm/drm_fb_helper.c +0 -2
index 8724e08c518b..ba0a808f14ee 100644
@@ -729,113 +729,6 @@ void drm_fb_helper_deferred_io(struct fb_info 
 *info, struct list_head *pagerefli
   }
   EXPORT_SYMBOL(drm_fb_helper_deferred_io);
-/**
- * drm_fb_helper_sys_read - Implements struct &fb_ops.fb_read for 

system memory
- * @info: fb_info struct pointer
- * @buf: userspace buffer to read from framebuffer memory
- * @count: number of bytes to read from framebuffer memory
- * @ppos: read offset within framebuffer memory
- *
- * Returns:
- * The number of bytes read on success, or an error code otherwise.
- */

drivers/gpu/drm/drm_fb_helper.c +0 -9
-ssize_t drm_fb_helper_sys_read(struct fb_info *info, char __user *buf,
-                   size_t count, loff_t *ppos)
-{
-    return fb_sys_read(info, buf, count, ppos);
-}
-EXPORT_SYMBOL(drm_fb_helper_sys_read);
-
-/**
- * drm_fb_helper_sys_write - Implements struct &fb_ops.fb_write for 

system memory
- * @info: fb_info struct pointer
- * @buf: userspace buffer to write to framebuffer memory
- * @count: number of bytes to write to framebuffer memory
- * @ppos: write offset within framebuffer memory
- *
- * Returns:
- * The number of bytes written on success, or an error code otherwise.
- */
-ssize_t drm_fb_helper_sys_write(struct fb_info *info, const char __user *buf,
-                size_t count, loff_t *ppos)

drivers/gpu/drm/drm_fb_helper.c +0 -12
-{
-    struct drm_fb_helper *helper = info->par;
-    loff_t pos = *ppos;
-    ssize_t ret;
-    struct drm_rect damage_area;
-
-    ret = fb_sys_write(info, buf, count, ppos);
-    if (ret <= 0)
-        return ret;
-
-    if (helper->funcs->fb_dirty) {
-        drm_fb_helper_memory_range_to_clip(info, pos, ret, 

&damage_area);
-        drm_fb_helper_damage(helper, damage_area.x1, damage_area.y1, -                     drm_rect_width(&damage_area),
-                     drm_rect_height(&damage_area));
-    }

drivers/gpu/drm/drm_fb_helper.c +0 -21
-
-    return ret;
-}
-EXPORT_SYMBOL(drm_fb_helper_sys_write);
-
-/**
- * drm_fb_helper_sys_fillrect - wrapper around sys_fillrect
- * @info: fbdev registered by the helper
- * @rect: info about rectangle to fill
- *
- * A wrapper around sys_fillrect implemented by fbdev core
- */
-void drm_fb_helper_sys_fillrect(struct fb_info *info,
-                const struct fb_fillrect *rect)
-{
-    struct drm_fb_helper *helper = info->par;
-
-    sys_fillrect(info, rect);
-
-    if (helper->funcs->fb_dirty)
-        drm_fb_helper_damage(helper, rect->dx, rect->dy, 

rect->width, rect->height);

drivers/gpu/drm/drm_fb_helper.c +0 -19
-}
-EXPORT_SYMBOL(drm_fb_helper_sys_fillrect);
-
-/**
- * drm_fb_helper_sys_copyarea - wrapper around sys_copyarea
- * @info: fbdev registered by the helper
- * @area: info about area to copy
- *
- * A wrapper around sys_copyarea implemented by fbdev core
- */
-void drm_fb_helper_sys_copyarea(struct fb_info *info,
-                const struct fb_copyarea *area)
-{
-    struct drm_fb_helper *helper = info->par;
-
-    sys_copyarea(info, area);
-
-    if (helper->funcs->fb_dirty)
-        drm_fb_helper_damage(helper, area->dx, area->dy, 

area->width, area->height);

drivers/gpu/drm/drm_fb_helper.c +0 -19
-}
-EXPORT_SYMBOL(drm_fb_helper_sys_copyarea);
-
-/**
- * drm_fb_helper_sys_imageblit - wrapper around sys_imageblit
- * @info: fbdev registered by the helper
- * @image: info about image to blit
- *
- * A wrapper around sys_imageblit implemented by fbdev core
- */
-void drm_fb_helper_sys_imageblit(struct fb_info *info,
-                 const struct fb_image *image)
-{
-    struct drm_fb_helper *helper = info->par;
-
-    sys_imageblit(info, image);
-
-    if (helper->funcs->fb_dirty)
-        drm_fb_helper_damage(helper, image->dx, image->dy, 

image->width, image->height);

drivers/gpu/drm/drm_fb_helper.c +0 -3
-}
-EXPORT_SYMBOL(drm_fb_helper_sys_imageblit);
-

  /**
   * drm_fb_helper_cfb_read - Implements struct &fb_ops.fb_read for I/O memory
   * @info: fb_info struct pointer

drivers/gpu/drm/drm_fbdev_generic.c +22 -0
index 8e5148bf40bb..f53fc49e34a4 100644
@@ -34,6 +34,43 @@ static int drm_fbdev_generic_fb_release(struct 
 fb_info *info, int user)
       return 0;
   }
+static ssize_t drm_fbdev_generic_fb_write(struct fb_info *info, 
 const char __user *buf,
+                      size_t count, loff_t *ppos)
+{
+    struct drm_fb_helper *helper = info->par;
+    loff_t pos = *ppos;
+    ssize_t ret;
+
+    ret = fb_sys_write(info, buf, count, ppos);
+    if (ret > 0)
+        drm_fb_helper_damage_range(helper, pos, ret);
+    return ret;
+}
+
+static void drm_fbdev_generic_fb_fillrect(struct fb_info *info, 
 const struct fb_fillrect *rect)
+{
+    struct drm_fb_helper *helper = info->par;
+
+    sys_fillrect(info, rect);
+    drm_fb_helper_damage(helper, rect->dx, rect->dy, rect->width, 
 rect->height);
+}
+
+static void drm_fbdev_generic_fb_copyarea(struct fb_info *info, 

const struct fb_copyarea *area)

drivers/gpu/drm/drm_fbdev_generic.c +5 -0
+{
+    struct drm_fb_helper *helper = info->par;
+
+    sys_copyarea(info, area);
+    drm_fb_helper_damage(helper, area->dx, area->dy, area->width, 

area->height);

drivers/gpu/drm/drm_fbdev_generic.c +3 -0
+}
+
+static void drm_fbdev_generic_fb_imageblit(struct fb_info *info, 

const struct fb_image *image)

drivers/gpu/drm/drm_fbdev_generic.c +5 -0
+{
+    struct drm_fb_helper *helper = info->par;
+
+    sys_imageblit(info, image);
+    drm_fb_helper_damage(helper, image->dx, image->dy, 

image->width, image->height);

drivers/gpu/drm/drm_fbdev_generic.c +2 -0
+}
+

  static void drm_fbdev_generic_fb_destroy(struct fb_info *info) {
      struct drm_fb_helper *fb_helper = info->par;

drivers/gpu/drm/drm_fbdev_generic.c +5 -5
@@ -56,12 +93,12 @@ static const struct fb_ops 
 drm_fbdev_generic_fb_ops = {
       .owner        = THIS_MODULE,
       .fb_open    = drm_fbdev_generic_fb_open,
       .fb_release    = drm_fbdev_generic_fb_release,
-    .fb_read    = drm_fb_helper_sys_read,
-    .fb_write    = drm_fb_helper_sys_write,
+    .fb_read    = fb_sys_read,
+    .fb_write    = drm_fbdev_generic_fb_write,
       DRM_FB_HELPER_DEFAULT_OPS,
-    .fb_fillrect    = drm_fb_helper_sys_fillrect,
-    .fb_copyarea    = drm_fb_helper_sys_copyarea,
-    .fb_imageblit    = drm_fb_helper_sys_imageblit,
+    .fb_fillrect    = drm_fbdev_generic_fb_fillrect,
+    .fb_copyarea    = drm_fbdev_generic_fb_copyarea,
+    .fb_imageblit    = drm_fbdev_generic_fb_imageblit,
       .fb_mmap    = fb_deferred_io_mmap,
       .fb_destroy    = drm_fbdev_generic_fb_destroy,

  };

include/drm/drm_fb_helper.h +0 -0
index 80c402f4e379..e3240d749a43 100644
@@ -259,18 +259,6 @@ void drm_fb_helper_damage_range(struct 

drm_fb_helper *helper, off_t off, size_t
  void drm_fb_helper_deferred_io(struct fb_info *info, struct list_head *pagereflist);

include/drm/drm_fb_helper.h +0 -3
-ssize_t drm_fb_helper_sys_read(struct fb_info *info, char __user *buf,
-                   size_t count, loff_t *ppos);
-ssize_t drm_fb_helper_sys_write(struct fb_info *info, const char 

__user *buf,
-                size_t count, loff_t *ppos);

include/drm/drm_fb_helper.h +0 -8
-
-void drm_fb_helper_sys_fillrect(struct fb_info *info,
-                const struct fb_fillrect *rect);
-void drm_fb_helper_sys_copyarea(struct fb_info *info,
-                const struct fb_copyarea *area);
-void drm_fb_helper_sys_imageblit(struct fb_info *info,
-                 const struct fb_image *image);
-

  ssize_t drm_fb_helper_cfb_read(struct fb_info *info, char __user *buf, size_t count, loff_t *ppos);
  ssize_t drm_fb_helper_cfb_write(struct fb_info *info, const char __user *buf,

include/drm/drm_fb_helper.h +0 -29
@@ -398,35 +386,6 @@ static inline int 
 drm_fb_helper_defio_init(struct drm_fb_helper *fb_helper)
       return -ENODEV;
   }
-static inline ssize_t drm_fb_helper_sys_read(struct fb_info *info,
-                         char __user *buf, size_t count,
-                         loff_t *ppos)
-{
-    return -ENODEV;
-}
-
-static inline ssize_t drm_fb_helper_sys_write(struct fb_info *info,
-                          const char __user *buf,
-                          size_t count, loff_t *ppos)
-{
-    return -ENODEV;
-}
-
-static inline void drm_fb_helper_sys_fillrect(struct fb_info *info,
-                          const struct fb_fillrect *rect)
-{
-}
-
-static inline void drm_fb_helper_sys_copyarea(struct fb_info *info,
-                          const struct fb_copyarea *area)
-{
-}
-
-static inline void drm_fb_helper_sys_imageblit(struct fb_info *info,
-                           const struct fb_image *image)
-{
-}
-
   static inline ssize_t drm_fb_helper_cfb_read(struct fb_info *info, char __user *buf,
                            size_t count, loff_t *ppos)
   {
author maintainer
#21 lore raw

Re: [v2,11/12] drm/fbdev-generic: Implement dedicated fbdev I/O helpers

Hi

Am 18.05.23 um 14:46 schrieb Sui Jingfeng:

Quoted 72 lines

Hi,

Quoted 28 lines · Thomas Zimmermann

Hi

Am 17.05.23 um 03:58 schrieb Sui Jingfeng:

Quoted 8 lines

Hi, Thomas

After apply your patch set, the kernel with arch/loongarch/configs/loongson3_defconfig

can not finish compile anymore.  gcc complains:

Quoted 16 lines

   AR      drivers/gpu/built-in.a
   AR      drivers/built-in.a
   AR      built-in.a
   AR      vmlinux.a
   LD      vmlinux.o
   OBJCOPY modules.builtin.modinfo
   GEN     modules.builtin
   GEN     .vmlinux.objs
   MODPOST Module.symvers
ERROR: modpost: "fb_sys_write" [drivers/gpu/drm/drm_kms_helper.ko] undefined!
ERROR: modpost: "sys_imageblit" [drivers/gpu/drm/drm_kms_helper.ko] undefined!
ERROR: modpost: "sys_fillrect" [drivers/gpu/drm/drm_kms_helper.ko] undefined!
ERROR: modpost: "sys_copyarea" [drivers/gpu/drm/drm_kms_helper.ko] undefined!
ERROR: modpost: "fb_sys_read" [drivers/gpu/drm/drm_kms_helper.ko] undefined! make[1]: *** [scripts/Makefile.modpost:136: Module.symvers] Error 1
make: *** [Makefile:1978: modpost] Error 2

Quoted 2 lines

Thanks for reporting this problem. I found that it's caused by a typo in the very first patch 1/7, where these helpers are not selected correctly. Will be fixed in the next round.

Yeah, this is just a typo.

Should replace 'FB_SYS_HELPER' with 'FB_SYS_HELPERS' on the first patch of this series.

Quoted 34 lines

Best regards
Thomas

Quoted 31 lines · Thomas Zimmermann
Quoted 21 lines

Implement dedicated fbdev helpers for framebuffer I/O instead of using DRM's helpers. Fbdev-generic was the only caller of the DRM helpers, so remove them from the helper module.

v2:
    * use FB_SYS_HELPERS_DEFERRED option

---
  drivers/gpu/drm/Kconfig             |   6 +- drivers/gpu/drm/drm_fb_helper.c     | 107
----------------------------
  drivers/gpu/drm/drm_fbdev_generic.c |  47 ++++++++++-- include/drm/drm_fb_helper.h         |  41 -----------

  4 files changed, 43 insertions(+), 158 deletions(-)
drivers/gpu/drm/Kconfig +0 -0
index 77fb10ddd8a2..92a782827b7b 100644
@@ -95,6 +95,7 @@ config DRM_KUNIT_TEST
Quoted 4 lines

  config DRM_KMS_HELPER
      tristate
      depends on DRM
+    select FB_SYS_HELPERS_DEFERRED if DRM_FBDEV_EMULATION

Here, select FB_SYS_HELPERS helps resolve the above issue mentioned.

Quoted 7 lines

But select FB_SYS_HELPERS here is more better, I think.  Because it show the nature that

DRM_KMS_HELPER is depend on FB_SYS_HELPERS, I think you may want isolate

those dependency with DRM_FBDEV_EMULATION guard.

at least, you should guarantee that drm itself could built and run standalone.

Indeed, it would be better to select this from DRM_FBDEV_EMULATION. Thanks for the remark. I'll update this in the next version.

Best regards
Thomas

Quoted 281 lines

Fbdev emulation is a client of drm, not reverse.

By the way, does Denial happy about this,

maybe, he want the fbdev emulation 100% made in drm?

Quoted 273 lines
Quoted 272 lines
Quoted 272 lines

      help
        CRTC helpers for KMS drivers.

drivers/gpu/drm/Kconfig +0 -0
@@ -135,11 +136,6 @@ config DRM_FBDEV_EMULATION

      select FB_CFB_FILLRECT
      select FB_CFB_COPYAREA
      select FB_CFB_IMAGEBLIT
-    select FB_DEFERRED_IO
-    select FB_SYS_FOPS
-    select FB_SYS_FILLRECT
-    select FB_SYS_COPYAREA
-    select FB_SYS_IMAGEBLIT
      select FRAMEBUFFER_CONSOLE if !EXPERT
      select FRAMEBUFFER_CONSOLE_DETECT_PRIMARY if FRAMEBUFFER_CONSOLE default y

drivers/gpu/drm/drm_fb_helper.c +0 -2
index 8724e08c518b..ba0a808f14ee 100644
@@ -729,113 +729,6 @@ void drm_fb_helper_deferred_io(struct fb_info 
 *info, struct list_head *pagerefli
   }
   EXPORT_SYMBOL(drm_fb_helper_deferred_io);
-/**
- * drm_fb_helper_sys_read - Implements struct &fb_ops.fb_read for 

system memory
- * @info: fb_info struct pointer
- * @buf: userspace buffer to read from framebuffer memory
- * @count: number of bytes to read from framebuffer memory
- * @ppos: read offset within framebuffer memory
- *
- * Returns:
- * The number of bytes read on success, or an error code otherwise.
- */

drivers/gpu/drm/drm_fb_helper.c +0 -9
-ssize_t drm_fb_helper_sys_read(struct fb_info *info, char __user *buf,
-                   size_t count, loff_t *ppos)
-{
-    return fb_sys_read(info, buf, count, ppos);
-}
-EXPORT_SYMBOL(drm_fb_helper_sys_read);
-
-/**
- * drm_fb_helper_sys_write - Implements struct &fb_ops.fb_write for 

system memory
- * @info: fb_info struct pointer
- * @buf: userspace buffer to write to framebuffer memory
- * @count: number of bytes to write to framebuffer memory
- * @ppos: write offset within framebuffer memory
- *
- * Returns:
- * The number of bytes written on success, or an error code otherwise.
- */
-ssize_t drm_fb_helper_sys_write(struct fb_info *info, const char __user *buf,
-                size_t count, loff_t *ppos)

drivers/gpu/drm/drm_fb_helper.c +0 -12
-{
-    struct drm_fb_helper *helper = info->par;
-    loff_t pos = *ppos;
-    ssize_t ret;
-    struct drm_rect damage_area;
-
-    ret = fb_sys_write(info, buf, count, ppos);
-    if (ret <= 0)
-        return ret;
-
-    if (helper->funcs->fb_dirty) {
-        drm_fb_helper_memory_range_to_clip(info, pos, ret, 

&damage_area);
-        drm_fb_helper_damage(helper, damage_area.x1, damage_area.y1, -                     drm_rect_width(&damage_area),
-                     drm_rect_height(&damage_area));
-    }

drivers/gpu/drm/drm_fb_helper.c +0 -21
-
-    return ret;
-}
-EXPORT_SYMBOL(drm_fb_helper_sys_write);
-
-/**
- * drm_fb_helper_sys_fillrect - wrapper around sys_fillrect
- * @info: fbdev registered by the helper
- * @rect: info about rectangle to fill
- *
- * A wrapper around sys_fillrect implemented by fbdev core
- */
-void drm_fb_helper_sys_fillrect(struct fb_info *info,
-                const struct fb_fillrect *rect)
-{
-    struct drm_fb_helper *helper = info->par;
-
-    sys_fillrect(info, rect);
-
-    if (helper->funcs->fb_dirty)
-        drm_fb_helper_damage(helper, rect->dx, rect->dy, 

rect->width, rect->height);

drivers/gpu/drm/drm_fb_helper.c +0 -19
-}
-EXPORT_SYMBOL(drm_fb_helper_sys_fillrect);
-
-/**
- * drm_fb_helper_sys_copyarea - wrapper around sys_copyarea
- * @info: fbdev registered by the helper
- * @area: info about area to copy
- *
- * A wrapper around sys_copyarea implemented by fbdev core
- */
-void drm_fb_helper_sys_copyarea(struct fb_info *info,
-                const struct fb_copyarea *area)
-{
-    struct drm_fb_helper *helper = info->par;
-
-    sys_copyarea(info, area);
-
-    if (helper->funcs->fb_dirty)
-        drm_fb_helper_damage(helper, area->dx, area->dy, 

area->width, area->height);

drivers/gpu/drm/drm_fb_helper.c +0 -19
-}
-EXPORT_SYMBOL(drm_fb_helper_sys_copyarea);
-
-/**
- * drm_fb_helper_sys_imageblit - wrapper around sys_imageblit
- * @info: fbdev registered by the helper
- * @image: info about image to blit
- *
- * A wrapper around sys_imageblit implemented by fbdev core
- */
-void drm_fb_helper_sys_imageblit(struct fb_info *info,
-                 const struct fb_image *image)
-{
-    struct drm_fb_helper *helper = info->par;
-
-    sys_imageblit(info, image);
-
-    if (helper->funcs->fb_dirty)
-        drm_fb_helper_damage(helper, image->dx, image->dy, 

image->width, image->height);

drivers/gpu/drm/drm_fb_helper.c +0 -3
-}
-EXPORT_SYMBOL(drm_fb_helper_sys_imageblit);
-

  /**
   * drm_fb_helper_cfb_read - Implements struct &fb_ops.fb_read for I/O memory
   * @info: fb_info struct pointer

drivers/gpu/drm/drm_fbdev_generic.c +22 -0
index 8e5148bf40bb..f53fc49e34a4 100644
@@ -34,6 +34,43 @@ static int drm_fbdev_generic_fb_release(struct 
 fb_info *info, int user)
       return 0;
   }
+static ssize_t drm_fbdev_generic_fb_write(struct fb_info *info, 
 const char __user *buf,
+                      size_t count, loff_t *ppos)
+{
+    struct drm_fb_helper *helper = info->par;
+    loff_t pos = *ppos;
+    ssize_t ret;
+
+    ret = fb_sys_write(info, buf, count, ppos);
+    if (ret > 0)
+        drm_fb_helper_damage_range(helper, pos, ret);
+    return ret;
+}
+
+static void drm_fbdev_generic_fb_fillrect(struct fb_info *info, 
 const struct fb_fillrect *rect)
+{
+    struct drm_fb_helper *helper = info->par;
+
+    sys_fillrect(info, rect);
+    drm_fb_helper_damage(helper, rect->dx, rect->dy, rect->width, 
 rect->height);
+}
+
+static void drm_fbdev_generic_fb_copyarea(struct fb_info *info, 

const struct fb_copyarea *area)

drivers/gpu/drm/drm_fbdev_generic.c +5 -0
+{
+    struct drm_fb_helper *helper = info->par;
+
+    sys_copyarea(info, area);
+    drm_fb_helper_damage(helper, area->dx, area->dy, area->width, 

area->height);

drivers/gpu/drm/drm_fbdev_generic.c +3 -0
+}
+
+static void drm_fbdev_generic_fb_imageblit(struct fb_info *info, 

const struct fb_image *image)

drivers/gpu/drm/drm_fbdev_generic.c +5 -0
+{
+    struct drm_fb_helper *helper = info->par;
+
+    sys_imageblit(info, image);
+    drm_fb_helper_damage(helper, image->dx, image->dy, 

image->width, image->height);

drivers/gpu/drm/drm_fbdev_generic.c +2 -0
+}
+

  static void drm_fbdev_generic_fb_destroy(struct fb_info *info) {
      struct drm_fb_helper *fb_helper = info->par;

drivers/gpu/drm/drm_fbdev_generic.c +5 -5
@@ -56,12 +93,12 @@ static const struct fb_ops 
 drm_fbdev_generic_fb_ops = {
       .owner        = THIS_MODULE,
       .fb_open    = drm_fbdev_generic_fb_open,
       .fb_release    = drm_fbdev_generic_fb_release,
-    .fb_read    = drm_fb_helper_sys_read,
-    .fb_write    = drm_fb_helper_sys_write,
+    .fb_read    = fb_sys_read,
+    .fb_write    = drm_fbdev_generic_fb_write,
       DRM_FB_HELPER_DEFAULT_OPS,
-    .fb_fillrect    = drm_fb_helper_sys_fillrect,
-    .fb_copyarea    = drm_fb_helper_sys_copyarea,
-    .fb_imageblit    = drm_fb_helper_sys_imageblit,
+    .fb_fillrect    = drm_fbdev_generic_fb_fillrect,
+    .fb_copyarea    = drm_fbdev_generic_fb_copyarea,
+    .fb_imageblit    = drm_fbdev_generic_fb_imageblit,
       .fb_mmap    = fb_deferred_io_mmap,
       .fb_destroy    = drm_fbdev_generic_fb_destroy,

  };

include/drm/drm_fb_helper.h +0 -0
index 80c402f4e379..e3240d749a43 100644
@@ -259,18 +259,6 @@ void drm_fb_helper_damage_range(struct 

drm_fb_helper *helper, off_t off, size_t
  void drm_fb_helper_deferred_io(struct fb_info *info, struct list_head *pagereflist);

include/drm/drm_fb_helper.h +0 -3
-ssize_t drm_fb_helper_sys_read(struct fb_info *info, char __user *buf,
-                   size_t count, loff_t *ppos);
-ssize_t drm_fb_helper_sys_write(struct fb_info *info, const char 

__user *buf,
-                size_t count, loff_t *ppos);

include/drm/drm_fb_helper.h +0 -8
-
-void drm_fb_helper_sys_fillrect(struct fb_info *info,
-                const struct fb_fillrect *rect);
-void drm_fb_helper_sys_copyarea(struct fb_info *info,
-                const struct fb_copyarea *area);
-void drm_fb_helper_sys_imageblit(struct fb_info *info,
-                 const struct fb_image *image);
-

  ssize_t drm_fb_helper_cfb_read(struct fb_info *info, char __user *buf, size_t count, loff_t *ppos);
  ssize_t drm_fb_helper_cfb_write(struct fb_info *info, const char __user *buf,

include/drm/drm_fb_helper.h +0 -29
@@ -398,35 +386,6 @@ static inline int 
 drm_fb_helper_defio_init(struct drm_fb_helper *fb_helper)
       return -ENODEV;
   }
-static inline ssize_t drm_fb_helper_sys_read(struct fb_info *info,
-                         char __user *buf, size_t count,
-                         loff_t *ppos)
-{
-    return -ENODEV;
-}
-
-static inline ssize_t drm_fb_helper_sys_write(struct fb_info *info,
-                          const char __user *buf,
-                          size_t count, loff_t *ppos)
-{
-    return -ENODEV;
-}
-
-static inline void drm_fb_helper_sys_fillrect(struct fb_info *info,
-                          const struct fb_fillrect *rect)
-{
-}
-
-static inline void drm_fb_helper_sys_copyarea(struct fb_info *info,
-                          const struct fb_copyarea *area)
-{
-}
-
-static inline void drm_fb_helper_sys_imageblit(struct fb_info *info,
-                           const struct fb_image *image)
-{
-}
-
   static inline ssize_t drm_fb_helper_cfb_read(struct fb_info *info, char __user *buf,
                            size_t count, loff_t *ppos)
   {
Signature · 6 lines
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)
author maintainer
#22 lore raw

PATCH v2 12/12 drm/i915: Implement dedicated fbdev I/O helpers

In reply to Thomas Zimmermann

Implement dedicated fbdev helpers for framebuffer I/O instead of using DRM's helpers. i915 was the only caller of the DRM helpers, so remove them from the helper module.

v2:
* use FB_IO_HELPERS options

Cc Jani Nikula <[email protected]>
Cc Joonas Lahtinen <[email protected]>
Cc Rodrigo Vivi <[email protected]>
Cc Tvrtko Ursulin <[email protected]>
Cc "Ville Syrjälä" <[email protected]>
---
 drivers/gpu/drm/Kconfig                    |   3 -
 drivers/gpu/drm/drm_fb_helper.c            | 107 ---------------------
 drivers/gpu/drm/i915/Kconfig               |   1 +
 drivers/gpu/drm/i915/display/intel_fbdev.c |  51 ++++++++--
 include/drm/drm_fb_helper.h                |  39 --------
 5 files changed, 46 insertions(+), 155 deletions(-)
drivers/gpu/drm/Kconfig +0 -3
index 92a782827b7b..bb2e48cc6cd6 100644
@@ -133,9 +133,6 @@ config DRM_FBDEV_EMULATION
 	bool "Enable legacy fbdev support for your modesetting driver"
 	depends on DRM_KMS_HELPER
 	depends on FB=y || FB=DRM_KMS_HELPER
-	select FB_CFB_FILLRECT
-	select FB_CFB_COPYAREA
-	select FB_CFB_IMAGEBLIT
 	select FRAMEBUFFER_CONSOLE if !EXPERT
 	select FRAMEBUFFER_CONSOLE_DETECT_PRIMARY if FRAMEBUFFER_CONSOLE
 	default y
drivers/gpu/drm/drm_fb_helper.c +0 -107

113 lines not on this page · raw message

drivers/gpu/drm/i915/Kconfig +1 -0
index e4f4d2e3fdfe..01b5a8272a27 100644
@@ -17,6 +17,7 @@ config DRM_I915
 	select DRM_KMS_HELPER
 	select DRM_PANEL
 	select DRM_MIPI_DSI
+	select FB_IO_HELPERS if DRM_FBDEV_EMULATION
 	select RELAY
 	select I2C
 	select I2C_ALGOBIT
drivers/gpu/drm/i915/display/intel_fbdev.c +45 -6

76 lines not on this page · raw message

include/drm/drm_fb_helper.h +0 -39
index e3240d749a43..15f03d8fb5cd 100644
@@ -259,18 +259,6 @@ void drm_fb_helper_damage_range(struct drm_fb_helper *helper, off_t off, size_t
 
 void drm_fb_helper_deferred_io(struct fb_info *info, struct list_head *pagereflist);
 
-ssize_t drm_fb_helper_cfb_read(struct fb_info *info, char __user *buf,
-			       size_t count, loff_t *ppos);
-ssize_t drm_fb_helper_cfb_write(struct fb_info *info, const char __user *buf,
-				size_t count, loff_t *ppos);
-
-void drm_fb_helper_cfb_fillrect(struct fb_info *info,
-				const struct fb_fillrect *rect);
-void drm_fb_helper_cfb_copyarea(struct fb_info *info,
-				const struct fb_copyarea *area);
-void drm_fb_helper_cfb_imageblit(struct fb_info *info,
-				 const struct fb_image *image);
-
 void drm_fb_helper_set_suspend(struct drm_fb_helper *fb_helper, bool suspend);
 void drm_fb_helper_set_suspend_unlocked(struct drm_fb_helper *fb_helper,
 					bool suspend);
@@ -386,33 +374,6 @@ static inline int drm_fb_helper_defio_init(struct drm_fb_helper *fb_helper)
 	return -ENODEV;
 }
 
-static inline ssize_t drm_fb_helper_cfb_read(struct fb_info *info, char __user *buf,
-					     size_t count, loff_t *ppos)
-{
-	return -ENODEV;
-}
-
-static inline ssize_t drm_fb_helper_cfb_write(struct fb_info *info, const char __user *buf,
-					      size_t count, loff_t *ppos)
-{
-	return -ENODEV;
-}
-
-static inline void drm_fb_helper_cfb_fillrect(struct fb_info *info,
-					      const struct fb_fillrect *rect)
-{
-}
-
-static inline void drm_fb_helper_cfb_copyarea(struct fb_info *info,
-					      const struct fb_copyarea *area)
-{
-}
-
-static inline void drm_fb_helper_cfb_imageblit(struct fb_info *info,
-					       const struct fb_image *image)
-{
-}
-
 static inline void drm_fb_helper_set_suspend(struct drm_fb_helper *fb_helper,
 					     bool suspend)
 {
Signature · 1 line
2.40.1
#23 lore raw

[Intel-gfx] ✗ Fi.CI.BUILD: failure for drm/fbdev: Remove DRM's helpers for fbdev I/O (rev2)

In reply to Thomas Zimmermann
== Series Details ==

== Series Details ==

Series: drm/fbdev: Remove DRM's helpers for fbdev I/O (rev2)
URL : https://patchwork.freedesktop.org/series/117671/
State : failure

== Summary ==

Error: make failed
CALL scripts/checksyscalls.sh
DESCEND objtool
INSTALL libsubcmd_headers
MODPOST Module.symvers
ERROR: modpost: "fb_sys_write" [drivers/gpu/drm/drm_kms_helper.ko] undefined!
ERROR: modpost: "sys_imageblit" [drivers/gpu/drm/drm_kms_helper.ko] undefined!
ERROR: modpost: "sys_fillrect" [drivers/gpu/drm/drm_kms_helper.ko] undefined!
ERROR: modpost: "sys_copyarea" [drivers/gpu/drm/drm_kms_helper.ko] undefined!
ERROR: modpost: "fb_sys_read" [drivers/gpu/drm/drm_kms_helper.ko] undefined! make[1]: *** [scripts/Makefile.modpost:136: Module.symvers] Error 1
make: *** [Makefile:1978: modpost] Error 2
Build failed, no error log produced