All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 00/43] drm: Provide fbdev emulation per memory manager
@ 2024-03-12 15:44 Thomas Zimmermann
  2024-03-12 15:44 ` [PATCH 01/43] drm/fbdev-generic: Do not set physical framebuffer address Thomas Zimmermann
                   ` (42 more replies)
  0 siblings, 43 replies; 78+ messages in thread
From: Thomas Zimmermann @ 2024-03-12 15:44 UTC (permalink / raw)
  To: daniel, airlied, deller, javierm
  Cc: linux-fbdev, dri-devel, Thomas Zimmermann

DRM provides 3 different memory managers with slightly different
characteristics: DMA-based, SHMEM-based and TTM. This effects fbdev
emulation as each requires different handling of mmap(). This series
reworks fbdev emualtion to provide an optimized emulation for each
of the memory managers.

Patch 1 fixes a minor bug in fbdev-generic.

Patches 2 to 8 implement fbdev-shmem, which is optimized for drivers
with SHMEM-based allocation. Patches 2 to 7 prepare deferred I/O to
support driver-custom page lookups. When the mmap'ed framebuffer sees
a pagefault, the deferred-I/O code can ask the graphics driver of the
page (instead of trying to detect it by itself). Using this hook,
patch 8 implements fbdev-shmem. The code is similar to fbdev-generic,
but does not require an additional shadow buffer for mmap(). Mmap'ed
pages are instead provided from the GEM buffer object. That saves a
few MiB of framebuffer memory and copying between the internal buffers.

Patches 9 to 20 convert SHMEM-based drivers to fbdev-shmem.

Patch 21 adds damage handling and deferred I/O to fbdev-dma. Such
code has been tested on the DMA-based omapdrm and can be adopted for
all drivers.

Patches 22 to 41 convert DMA-based drivers to fbdev-dma. These drivers
could not use it because of the missing support for damage handling.

Patch 42 renames fbdev-generic to fbdev-ttm. Only TTM-based drivers
still use it, so building it can be linked to TTM as well.

Patch 43 cleans up the documentation.

Tested with simpledrm, vc4 and amdgpu.

Thomas Zimmermann (43):
  drm/fbdev-generic: Do not set physical framebuffer address
  fbdev/deferred-io: Move pageref setup into separate helper
  fbdev/deferred-io: Clean up pageref on lastclose
  fbdev/deferred-io: Test screen_buffer for vmalloc'ed memory
  fbdev/deferred-io: Test smem_start for I/O memory
  fbdev/deferred-io: Always call get_page() for framebuffer pages
  fbdev/deferred-io: Provide get_page hook in struct fb_deferred_io
  drm/fbdev: Add fbdev-shmem
  drm/ast: Use fbdev-shmem
  drm/gud: Use fbdev-shmem
  drm/hyperv: Use fbdev-shmem
  drm/mgag200: Use fbdev-shmem
  drm/solomon: Use fbdev-shmem
  drm/tiny/cirrus: Use fbdev-shmem
  drm/tiny/gm12u320: Use fbdev-shmem
  drm/tiny/ofdrm: Use fbdev-shmem
  drm/tiny/simpledrm: Use fbdev-shmem
  drm/udl: Use fbdev-shmem
  drm/virtio: Use fbdev-shmem
  drm/vkms: Use fbdev-shmem
  drm/fbdev-dma: Implement damage handling and deferred I/O
  drm/arm/komeda: Use fbdev-dma
  drm/hisilicon/kirin: Use fbdev-dma
  drm/imx/lcdc: Use fbdev-dma
  drm/ingenic: Use fbdev-dma
  drm/mediatek: Use fbdev-dma
  drm/panel/panel-ilitek-9341: Use fbdev-dma
  drm/renesas/rcar-du: Use fbdev-dma
  drm/renesas/rz-du: Use fbdev-dma
  drm/renesas/shmobile: Use fbdev-dma
  drm/rockchip: Use fbdev-dma
  drm/tiny/hx8357d: Use fbdev-dma
  drm/tiny/ili9163: Use fbdev-dma
  drm/tiny/ili9225: Use fbdev-dma
  drm/tiny/ili9341: Use fbdev-dma
  drm/tiny/ili9486: Use fbdev-dma
  drm/tiny/mi0283qt: Use fbdev-dma
  drm/tiny/panel-mipi-dbi: Use fbdev-dma
  drm/tiny/repaper: Use fbdev-dma
  drm/tiny/st7586: Use fbdev-dma
  drm/tiny/st7735r: Use fbdev-dma
  drm/fbdev-generic: Convert to fbdev-ttm
  drm/fbdev: Clean up fbdev documentation

 Documentation/gpu/drm-kms-helpers.rst         |  12 +-
 Documentation/gpu/todo.rst                    |  13 -
 drivers/gpu/drm/Makefile                      |   6 +-
 drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c       |   6 +-
 .../gpu/drm/arm/display/komeda/komeda_drv.c   |   4 +-
 drivers/gpu/drm/ast/ast_drv.c                 |   4 +-
 drivers/gpu/drm/drm_drv.c                     |   2 +-
 drivers/gpu/drm/drm_fb_helper.c               |  11 +-
 drivers/gpu/drm/drm_fbdev_dma.c               |  65 +++-
 drivers/gpu/drm/drm_fbdev_shmem.c             | 316 ++++++++++++++++++
 .../{drm_fbdev_generic.c => drm_fbdev_ttm.c}  |  81 +++--
 drivers/gpu/drm/gud/gud_drv.c                 |   4 +-
 .../gpu/drm/hisilicon/hibmc/hibmc_drm_drv.c   |   4 +-
 .../gpu/drm/hisilicon/kirin/kirin_drm_drv.c   |   4 +-
 drivers/gpu/drm/hyperv/hyperv_drm_drv.c       |   4 +-
 drivers/gpu/drm/imx/lcdc/imx-lcdc.c           |   4 +-
 drivers/gpu/drm/ingenic/ingenic-drm-drv.c     |   4 +-
 drivers/gpu/drm/loongson/Kconfig              |   1 +
 drivers/gpu/drm/loongson/lsdc_drv.c           |   4 +-
 drivers/gpu/drm/mediatek/mtk_drm_drv.c        |   4 +-
 drivers/gpu/drm/mgag200/mgag200_drv.c         |   4 +-
 drivers/gpu/drm/nouveau/nouveau_drm.c         |   6 +-
 drivers/gpu/drm/panel/panel-ilitek-ili9341.c  |   4 +-
 drivers/gpu/drm/qxl/qxl_drv.c                 |   4 +-
 drivers/gpu/drm/renesas/rcar-du/rcar_du_drv.c |   4 +-
 drivers/gpu/drm/renesas/rz-du/rzg2l_du_drv.c  |   4 +-
 .../gpu/drm/renesas/shmobile/shmob_drm_drv.c  |   4 +-
 drivers/gpu/drm/rockchip/rockchip_drm_drv.c   |   4 +-
 drivers/gpu/drm/solomon/ssd130x.c             |   4 +-
 drivers/gpu/drm/tiny/bochs.c                  |   4 +-
 drivers/gpu/drm/tiny/cirrus.c                 |   4 +-
 drivers/gpu/drm/tiny/gm12u320.c               |   4 +-
 drivers/gpu/drm/tiny/hx8357d.c                |   4 +-
 drivers/gpu/drm/tiny/ili9163.c                |   4 +-
 drivers/gpu/drm/tiny/ili9225.c                |   4 +-
 drivers/gpu/drm/tiny/ili9341.c                |   4 +-
 drivers/gpu/drm/tiny/ili9486.c                |   4 +-
 drivers/gpu/drm/tiny/mi0283qt.c               |   4 +-
 drivers/gpu/drm/tiny/ofdrm.c                  |   4 +-
 drivers/gpu/drm/tiny/panel-mipi-dbi.c         |   4 +-
 drivers/gpu/drm/tiny/repaper.c                |   4 +-
 drivers/gpu/drm/tiny/simpledrm.c              |   4 +-
 drivers/gpu/drm/tiny/st7586.c                 |   4 +-
 drivers/gpu/drm/tiny/st7735r.c                |   4 +-
 drivers/gpu/drm/udl/udl_drv.c                 |   4 +-
 drivers/gpu/drm/vboxvideo/vbox_drv.c          |   4 +-
 drivers/gpu/drm/virtio/virtgpu_drv.c          |   4 +-
 drivers/gpu/drm/vkms/vkms_drv.c               |   4 +-
 drivers/gpu/drm/vmwgfx/vmwgfx_drv.c           |   4 +-
 drivers/video/fbdev/core/fb_defio.c           |  82 +++--
 include/drm/drm_fbdev_generic.h               |  15 -
 include/drm/drm_fbdev_shmem.h                 |  15 +
 include/drm/drm_fbdev_ttm.h                   |  15 +
 include/drm/drm_mode_config.h                 |   4 +-
 include/linux/fb.h                            |   1 +
 55 files changed, 593 insertions(+), 210 deletions(-)
 create mode 100644 drivers/gpu/drm/drm_fbdev_shmem.c
 rename drivers/gpu/drm/{drm_fbdev_generic.c => drm_fbdev_ttm.c} (76%)
 delete mode 100644 include/drm/drm_fbdev_generic.h
 create mode 100644 include/drm/drm_fbdev_shmem.h
 create mode 100644 include/drm/drm_fbdev_ttm.h

-- 
2.44.0


^ permalink raw reply	[flat|nested] 78+ messages in thread

* [PATCH 01/43] drm/fbdev-generic: Do not set physical framebuffer address
  2024-03-12 15:44 [PATCH 00/43] drm: Provide fbdev emulation per memory manager Thomas Zimmermann
@ 2024-03-12 15:44 ` Thomas Zimmermann
  2024-03-17 12:43   ` Javier Martinez Canillas
                     ` (2 more replies)
  2024-03-12 15:44 ` [PATCH 02/43] fbdev/deferred-io: Move pageref setup into separate helper Thomas Zimmermann
                   ` (41 subsequent siblings)
  42 siblings, 3 replies; 78+ messages in thread
From: Thomas Zimmermann @ 2024-03-12 15:44 UTC (permalink / raw)
  To: daniel, airlied, deller, javierm
  Cc: linux-fbdev, dri-devel, Thomas Zimmermann, Zack Rusin,
	Maarten Lankhorst, Maxime Ripard, stable

Framebuffer memory is allocated via vmalloc() from non-contiguous
physical pages. The physical framebuffer start address is therefore
meaningless. Do not set it.

The value is not used within the kernel and only exported to userspace
on dedicated ARM configs. No functional change is expected.

Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
Fixes: a5b44c4adb16 ("drm/fbdev-generic: Always use shadow buffering")
Cc: Thomas Zimmermann <tzimmermann@suse.de>
Cc: Javier Martinez Canillas <javierm@redhat.com>
Cc: Zack Rusin <zackr@vmware.com>
Cc: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
Cc: Maxime Ripard <mripard@kernel.org>
Cc: <stable@vger.kernel.org> # v6.4+
---
 drivers/gpu/drm/drm_fbdev_generic.c | 1 -
 1 file changed, 1 deletion(-)

diff --git a/drivers/gpu/drm/drm_fbdev_generic.c b/drivers/gpu/drm/drm_fbdev_generic.c
index d647d89764cb9..b4659cd6285ab 100644
--- a/drivers/gpu/drm/drm_fbdev_generic.c
+++ b/drivers/gpu/drm/drm_fbdev_generic.c
@@ -113,7 +113,6 @@ static int drm_fbdev_generic_helper_fb_probe(struct drm_fb_helper *fb_helper,
 	/* screen */
 	info->flags |= FBINFO_VIRTFB | FBINFO_READS_FAST;
 	info->screen_buffer = screen_buffer;
-	info->fix.smem_start = page_to_phys(vmalloc_to_page(info->screen_buffer));
 	info->fix.smem_len = screen_size;
 
 	/* deferred I/O */
-- 
2.44.0


^ permalink raw reply related	[flat|nested] 78+ messages in thread

* [PATCH 02/43] fbdev/deferred-io: Move pageref setup into separate helper
  2024-03-12 15:44 [PATCH 00/43] drm: Provide fbdev emulation per memory manager Thomas Zimmermann
  2024-03-12 15:44 ` [PATCH 01/43] drm/fbdev-generic: Do not set physical framebuffer address Thomas Zimmermann
@ 2024-03-12 15:44 ` Thomas Zimmermann
  2024-03-17 12:49   ` Javier Martinez Canillas
  2024-03-12 15:44 ` [PATCH 03/43] fbdev/deferred-io: Clean up pageref on lastclose Thomas Zimmermann
                   ` (40 subsequent siblings)
  42 siblings, 1 reply; 78+ messages in thread
From: Thomas Zimmermann @ 2024-03-12 15:44 UTC (permalink / raw)
  To: daniel, airlied, deller, javierm
  Cc: linux-fbdev, dri-devel, Thomas Zimmermann

Set up struct fb_deferred_io_pageref in th new helper function
fb_deferred_io_pageref_lookup(), which runs when the pageref is first
taken. Remove the setup code from the rest of the code.

At first, the code allocates the memory of all pageref structs. The
setup of the various fields happens when the pageref is required.

Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
---
 drivers/video/fbdev/core/fb_defio.c | 42 ++++++++++++++++++++---------
 1 file changed, 30 insertions(+), 12 deletions(-)

diff --git a/drivers/video/fbdev/core/fb_defio.c b/drivers/video/fbdev/core/fb_defio.c
index dae96c9f61cf8..bff1e300ed6bb 100644
--- a/drivers/video/fbdev/core/fb_defio.c
+++ b/drivers/video/fbdev/core/fb_defio.c
@@ -36,20 +36,43 @@ static struct page *fb_deferred_io_page(struct fb_info *info, unsigned long offs
 	return page;
 }
 
+static struct fb_deferred_io_pageref *fb_deferred_io_pageref_lookup(struct fb_info *info,
+								    unsigned long offset,
+								    struct page *page)
+{
+	unsigned long pgoff = offset >> PAGE_SHIFT;
+	struct fb_deferred_io_pageref *pageref;
+
+	if (fb_WARN_ON_ONCE(info, pgoff >= info->npagerefs))
+		return NULL; /* incorrect allocation size */
+
+	/* 1:1 mapping between pageref and page offset */
+	pageref = &info->pagerefs[pgoff];
+
+	if (pageref->page)
+		goto out;
+
+	pageref->page = page;
+	pageref->offset = pgoff << PAGE_SHIFT;
+	INIT_LIST_HEAD(&pageref->list);
+
+out:
+	if (fb_WARN_ON_ONCE(info, pageref->page != page))
+		return NULL; /* inconsistent state */
+	return pageref;
+}
+
 static struct fb_deferred_io_pageref *fb_deferred_io_pageref_get(struct fb_info *info,
 								 unsigned long offset,
 								 struct page *page)
 {
 	struct fb_deferred_io *fbdefio = info->fbdefio;
 	struct list_head *pos = &fbdefio->pagereflist;
-	unsigned long pgoff = offset >> PAGE_SHIFT;
 	struct fb_deferred_io_pageref *pageref, *cur;
 
-	if (WARN_ON_ONCE(pgoff >= info->npagerefs))
-		return NULL; /* incorrect allocation size */
-
-	/* 1:1 mapping between pageref and page offset */
-	pageref = &info->pagerefs[pgoff];
+	pageref = fb_deferred_io_pageref_lookup(info, offset, page);
+	if (!pageref)
+		return NULL;
 
 	/*
 	 * This check is to catch the case where a new process could start
@@ -60,9 +83,6 @@ static struct fb_deferred_io_pageref *fb_deferred_io_pageref_get(struct fb_info
 	if (!list_empty(&pageref->list))
 		goto pageref_already_added;
 
-	pageref->page = page;
-	pageref->offset = pgoff << PAGE_SHIFT;
-
 	if (unlikely(fbdefio->sort_pagereflist)) {
 		/*
 		 * We loop through the list of pagerefs before adding in
@@ -264,7 +284,7 @@ int fb_deferred_io_init(struct fb_info *info)
 {
 	struct fb_deferred_io *fbdefio = info->fbdefio;
 	struct fb_deferred_io_pageref *pagerefs;
-	unsigned long npagerefs, i;
+	unsigned long npagerefs;
 	int ret;
 
 	BUG_ON(!fbdefio);
@@ -286,8 +306,6 @@ int fb_deferred_io_init(struct fb_info *info)
 		ret = -ENOMEM;
 		goto err;
 	}
-	for (i = 0; i < npagerefs; ++i)
-		INIT_LIST_HEAD(&pagerefs[i].list);
 	info->npagerefs = npagerefs;
 	info->pagerefs = pagerefs;
 
-- 
2.44.0


^ permalink raw reply related	[flat|nested] 78+ messages in thread

* [PATCH 03/43] fbdev/deferred-io: Clean up pageref on lastclose
  2024-03-12 15:44 [PATCH 00/43] drm: Provide fbdev emulation per memory manager Thomas Zimmermann
  2024-03-12 15:44 ` [PATCH 01/43] drm/fbdev-generic: Do not set physical framebuffer address Thomas Zimmermann
  2024-03-12 15:44 ` [PATCH 02/43] fbdev/deferred-io: Move pageref setup into separate helper Thomas Zimmermann
@ 2024-03-12 15:44 ` Thomas Zimmermann
  2024-03-17 13:19   ` Javier Martinez Canillas
  2024-03-12 15:44 ` [PATCH 04/43] fbdev/deferred-io: Test screen_buffer for vmalloc'ed memory Thomas Zimmermann
                   ` (39 subsequent siblings)
  42 siblings, 1 reply; 78+ messages in thread
From: Thomas Zimmermann @ 2024-03-12 15:44 UTC (permalink / raw)
  To: daniel, airlied, deller, javierm
  Cc: linux-fbdev, dri-devel, Thomas Zimmermann

Clean up the pageref state as part of the lastclose helper. This
only requirs to clear the page's mapping field. The pageref and
page can stay in place for the next opened instance of the frame-
buffer file.

With the change in the clean-up logic, here's no further need
to lookup pages during the lastclose cleanup. The code instead
uses the existing pagerefs in its look-up table. It also avoids
using smem_len, which some driver might not set correctly.

Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
---
 drivers/video/fbdev/core/fb_defio.c | 17 +++++++++++------
 1 file changed, 11 insertions(+), 6 deletions(-)

diff --git a/drivers/video/fbdev/core/fb_defio.c b/drivers/video/fbdev/core/fb_defio.c
index bff1e300ed6bb..f23b1cbe67192 100644
--- a/drivers/video/fbdev/core/fb_defio.c
+++ b/drivers/video/fbdev/core/fb_defio.c
@@ -62,6 +62,14 @@ static struct fb_deferred_io_pageref *fb_deferred_io_pageref_lookup(struct fb_in
 	return pageref;
 }
 
+static void fb_deferred_io_pageref_clear(struct fb_deferred_io_pageref *pageref)
+{
+	struct page *page = pageref->page;
+
+	if (page)
+		page->mapping = NULL;
+}
+
 static struct fb_deferred_io_pageref *fb_deferred_io_pageref_get(struct fb_info *info,
 								 unsigned long offset,
 								 struct page *page)
@@ -330,16 +338,13 @@ EXPORT_SYMBOL_GPL(fb_deferred_io_open);
 
 static void fb_deferred_io_lastclose(struct fb_info *info)
 {
-	struct page *page;
-	int i;
+	unsigned long i;
 
 	flush_delayed_work(&info->deferred_work);
 
 	/* clear out the mapping that we setup */
-	for (i = 0 ; i < info->fix.smem_len; i += PAGE_SIZE) {
-		page = fb_deferred_io_page(info, i);
-		page->mapping = NULL;
-	}
+	for (i = 0; i < info->npagerefs; ++i)
+		fb_deferred_io_pageref_clear(&info->pagerefs[i]);
 }
 
 void fb_deferred_io_release(struct fb_info *info)
-- 
2.44.0


^ permalink raw reply related	[flat|nested] 78+ messages in thread

* [PATCH 04/43] fbdev/deferred-io: Test screen_buffer for vmalloc'ed memory
  2024-03-12 15:44 [PATCH 00/43] drm: Provide fbdev emulation per memory manager Thomas Zimmermann
                   ` (2 preceding siblings ...)
  2024-03-12 15:44 ` [PATCH 03/43] fbdev/deferred-io: Clean up pageref on lastclose Thomas Zimmermann
@ 2024-03-12 15:44 ` Thomas Zimmermann
  2024-03-17 13:20   ` Javier Martinez Canillas
  2024-03-12 15:45 ` [PATCH 05/43] fbdev/deferred-io: Test smem_start for I/O memory Thomas Zimmermann
                   ` (38 subsequent siblings)
  42 siblings, 1 reply; 78+ messages in thread
From: Thomas Zimmermann @ 2024-03-12 15:44 UTC (permalink / raw)
  To: daniel, airlied, deller, javierm
  Cc: linux-fbdev, dri-devel, Thomas Zimmermann

Framebuffers in virtual memory are available via screen_buffer. Use
it instead of screen_base and avoid the type casting.

Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
---
 drivers/video/fbdev/core/fb_defio.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/video/fbdev/core/fb_defio.c b/drivers/video/fbdev/core/fb_defio.c
index f23b1cbe67192..b38f775cd39dd 100644
--- a/drivers/video/fbdev/core/fb_defio.c
+++ b/drivers/video/fbdev/core/fb_defio.c
@@ -25,11 +25,11 @@
 
 static struct page *fb_deferred_io_page(struct fb_info *info, unsigned long offs)
 {
-	void *screen_base = (void __force *) info->screen_base;
+	const void *screen_buffer = info->screen_buffer;
 	struct page *page;
 
-	if (is_vmalloc_addr(screen_base + offs))
-		page = vmalloc_to_page(screen_base + offs);
+	if (is_vmalloc_addr(screen_buffer + offs))
+		page = vmalloc_to_page(screen_buffer + offs);
 	else
 		page = pfn_to_page((info->fix.smem_start + offs) >> PAGE_SHIFT);
 
-- 
2.44.0


^ permalink raw reply related	[flat|nested] 78+ messages in thread

* [PATCH 05/43] fbdev/deferred-io: Test smem_start for I/O memory
  2024-03-12 15:44 [PATCH 00/43] drm: Provide fbdev emulation per memory manager Thomas Zimmermann
                   ` (3 preceding siblings ...)
  2024-03-12 15:44 ` [PATCH 04/43] fbdev/deferred-io: Test screen_buffer for vmalloc'ed memory Thomas Zimmermann
@ 2024-03-12 15:45 ` Thomas Zimmermann
  2024-03-18 17:03   ` Javier Martinez Canillas
  2024-03-12 15:45 ` [PATCH 06/43] fbdev/deferred-io: Always call get_page() for framebuffer pages Thomas Zimmermann
                   ` (37 subsequent siblings)
  42 siblings, 1 reply; 78+ messages in thread
From: Thomas Zimmermann @ 2024-03-12 15:45 UTC (permalink / raw)
  To: daniel, airlied, deller, javierm
  Cc: linux-fbdev, dri-devel, Thomas Zimmermann

Test smem_start before looking up pages from its value. Return
NULL if it is unset. This will result in a SIGBUS signal.

Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
---
 drivers/video/fbdev/core/fb_defio.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/video/fbdev/core/fb_defio.c b/drivers/video/fbdev/core/fb_defio.c
index b38f775cd39dd..fe84218ded457 100644
--- a/drivers/video/fbdev/core/fb_defio.c
+++ b/drivers/video/fbdev/core/fb_defio.c
@@ -26,11 +26,11 @@
 static struct page *fb_deferred_io_page(struct fb_info *info, unsigned long offs)
 {
 	const void *screen_buffer = info->screen_buffer;
-	struct page *page;
+	struct page *page = NULL;
 
 	if (is_vmalloc_addr(screen_buffer + offs))
 		page = vmalloc_to_page(screen_buffer + offs);
-	else
+	else if (info->fix.smem_start)
 		page = pfn_to_page((info->fix.smem_start + offs) >> PAGE_SHIFT);
 
 	return page;
-- 
2.44.0


^ permalink raw reply related	[flat|nested] 78+ messages in thread

* [PATCH 06/43] fbdev/deferred-io: Always call get_page() for framebuffer pages
  2024-03-12 15:44 [PATCH 00/43] drm: Provide fbdev emulation per memory manager Thomas Zimmermann
                   ` (4 preceding siblings ...)
  2024-03-12 15:45 ` [PATCH 05/43] fbdev/deferred-io: Test smem_start for I/O memory Thomas Zimmermann
@ 2024-03-12 15:45 ` Thomas Zimmermann
  2024-03-18 17:04   ` Javier Martinez Canillas
  2024-03-12 15:45 ` [PATCH 07/43] fbdev/deferred-io: Provide get_page hook in struct fb_deferred_io Thomas Zimmermann
                   ` (36 subsequent siblings)
  42 siblings, 1 reply; 78+ messages in thread
From: Thomas Zimmermann @ 2024-03-12 15:45 UTC (permalink / raw)
  To: daniel, airlied, deller, javierm
  Cc: linux-fbdev, dri-devel, Thomas Zimmermann

Unconditionally call get_page() after looking up a page from the
framebuffer memory. Guarantees that we always hold a reference.

This change also refactors the code such that it can support a
driver-supplied get_page helper. This will be useful for DRM's
fbdev emulation.

Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
---
 drivers/video/fbdev/core/fb_defio.c | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)

diff --git a/drivers/video/fbdev/core/fb_defio.c b/drivers/video/fbdev/core/fb_defio.c
index fe84218ded457..6e0bbcfdb01b5 100644
--- a/drivers/video/fbdev/core/fb_defio.c
+++ b/drivers/video/fbdev/core/fb_defio.c
@@ -23,7 +23,7 @@
 #include <linux/rmap.h>
 #include <linux/pagemap.h>
 
-static struct page *fb_deferred_io_page(struct fb_info *info, unsigned long offs)
+static struct page *fb_deferred_io_get_page(struct fb_info *info, unsigned long offs)
 {
 	const void *screen_buffer = info->screen_buffer;
 	struct page *page = NULL;
@@ -33,6 +33,9 @@ static struct page *fb_deferred_io_page(struct fb_info *info, unsigned long offs
 	else if (info->fix.smem_start)
 		page = pfn_to_page((info->fix.smem_start + offs) >> PAGE_SHIFT);
 
+	if (page)
+		get_page(page);
+
 	return page;
 }
 
@@ -129,12 +132,10 @@ static vm_fault_t fb_deferred_io_fault(struct vm_fault *vmf)
 	if (offset >= info->fix.smem_len)
 		return VM_FAULT_SIGBUS;
 
-	page = fb_deferred_io_page(info, offset);
+	page = fb_deferred_io_get_page(info, offset);
 	if (!page)
 		return VM_FAULT_SIGBUS;
 
-	get_page(page);
-
 	if (vmf->vma->vm_file)
 		page->mapping = vmf->vma->vm_file->f_mapping;
 	else
-- 
2.44.0


^ permalink raw reply related	[flat|nested] 78+ messages in thread

* [PATCH 07/43] fbdev/deferred-io: Provide get_page hook in struct fb_deferred_io
  2024-03-12 15:44 [PATCH 00/43] drm: Provide fbdev emulation per memory manager Thomas Zimmermann
                   ` (5 preceding siblings ...)
  2024-03-12 15:45 ` [PATCH 06/43] fbdev/deferred-io: Always call get_page() for framebuffer pages Thomas Zimmermann
@ 2024-03-12 15:45 ` Thomas Zimmermann
  2024-03-18 17:11   ` Javier Martinez Canillas
  2024-03-12 15:45 ` [PATCH 08/43] drm/fbdev: Add fbdev-shmem Thomas Zimmermann
                   ` (35 subsequent siblings)
  42 siblings, 1 reply; 78+ messages in thread
From: Thomas Zimmermann @ 2024-03-12 15:45 UTC (permalink / raw)
  To: daniel, airlied, deller, javierm
  Cc: linux-fbdev, dri-devel, Thomas Zimmermann

Add a callback for drivers to provide framebuffer pages to fbdev's
deferred-I/O helpers. Implementations need to acquire a reference on
the page before returning it. Returning NULL generates a SIGBUS
signal.

This will be useful for DRM's fbdev emulation with GEM-shemem buffer
objects.

Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
---
 drivers/video/fbdev/core/fb_defio.c | 4 ++++
 include/linux/fb.h                  | 1 +
 2 files changed, 5 insertions(+)

diff --git a/drivers/video/fbdev/core/fb_defio.c b/drivers/video/fbdev/core/fb_defio.c
index 6e0bbcfdb01b5..51928ff7961a5 100644
--- a/drivers/video/fbdev/core/fb_defio.c
+++ b/drivers/video/fbdev/core/fb_defio.c
@@ -25,9 +25,13 @@
 
 static struct page *fb_deferred_io_get_page(struct fb_info *info, unsigned long offs)
 {
+	struct fb_deferred_io *fbdefio = info->fbdefio;
 	const void *screen_buffer = info->screen_buffer;
 	struct page *page = NULL;
 
+	if (fbdefio->get_page)
+		return fbdefio->get_page(info, offs);
+
 	if (is_vmalloc_addr(screen_buffer + offs))
 		page = vmalloc_to_page(screen_buffer + offs);
 	else if (info->fix.smem_start)
diff --git a/include/linux/fb.h b/include/linux/fb.h
index 708e6a177b1be..bbb0805c0ab1e 100644
--- a/include/linux/fb.h
+++ b/include/linux/fb.h
@@ -219,6 +219,7 @@ struct fb_deferred_io {
 	struct mutex lock; /* mutex that protects the pageref list */
 	struct list_head pagereflist; /* list of pagerefs for touched pages */
 	/* callback */
+	struct page *(*get_page)(struct fb_info *info, unsigned long offset);
 	void (*deferred_io)(struct fb_info *info, struct list_head *pagelist);
 };
 #endif
-- 
2.44.0


^ permalink raw reply related	[flat|nested] 78+ messages in thread

* [PATCH 08/43] drm/fbdev: Add fbdev-shmem
  2024-03-12 15:44 [PATCH 00/43] drm: Provide fbdev emulation per memory manager Thomas Zimmermann
                   ` (6 preceding siblings ...)
  2024-03-12 15:45 ` [PATCH 07/43] fbdev/deferred-io: Provide get_page hook in struct fb_deferred_io Thomas Zimmermann
@ 2024-03-12 15:45 ` Thomas Zimmermann
  2024-03-12 16:14   ` Geert Uytterhoeven
  2024-03-12 15:45 ` [PATCH 09/43] drm/ast: Use fbdev-shmem Thomas Zimmermann
                   ` (34 subsequent siblings)
  42 siblings, 1 reply; 78+ messages in thread
From: Thomas Zimmermann @ 2024-03-12 15:45 UTC (permalink / raw)
  To: daniel, airlied, deller, javierm
  Cc: linux-fbdev, dri-devel, Thomas Zimmermann

Add an fbdev emulation for SHMEM-based memory managers. The code is
similar to fbdev-generic, but does not require an addition shadow
buffer for mmap(). Fbdev-shmem operates directly on the buffer object's
SHMEM pages. Fbdev's deferred-I/O mechanism updates the hardware state
on write operations.

Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
---
 drivers/gpu/drm/Makefile          |   1 +
 drivers/gpu/drm/drm_fbdev_shmem.c | 316 ++++++++++++++++++++++++++++++
 include/drm/drm_fbdev_shmem.h     |  15 ++
 3 files changed, 332 insertions(+)
 create mode 100644 drivers/gpu/drm/drm_fbdev_shmem.c
 create mode 100644 include/drm/drm_fbdev_shmem.h

diff --git a/drivers/gpu/drm/Makefile b/drivers/gpu/drm/Makefile
index a73c04d2d7a39..50a2f0cffdac2 100644
--- a/drivers/gpu/drm/Makefile
+++ b/drivers/gpu/drm/Makefile
@@ -107,6 +107,7 @@ drm_dma_helper-$(CONFIG_DRM_KMS_HELPER) += drm_fb_dma_helper.o
 obj-$(CONFIG_DRM_GEM_DMA_HELPER) += drm_dma_helper.o
 
 drm_shmem_helper-y := drm_gem_shmem_helper.o
+drm_shmem_helper-$(CONFIG_DRM_FBDEV_EMULATION) += drm_fbdev_shmem.o
 obj-$(CONFIG_DRM_GEM_SHMEM_HELPER) += drm_shmem_helper.o
 
 drm_suballoc_helper-y := drm_suballoc.o
diff --git a/drivers/gpu/drm/drm_fbdev_shmem.c b/drivers/gpu/drm/drm_fbdev_shmem.c
new file mode 100644
index 0000000000000..f568efcb198d6
--- /dev/null
+++ b/drivers/gpu/drm/drm_fbdev_shmem.c
@@ -0,0 +1,316 @@
+// 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>
+#include <drm/drm_framebuffer.h>
+#include <drm/drm_gem_framebuffer_helper.h>
+#include <drm/drm_gem_shmem_helper.h>
+
+#include <drm/drm_fbdev_shmem.h>
+
+/*
+ * struct fb_ops
+ */
+
+static int drm_fbdev_shmem_fb_open(struct fb_info *info, int user)
+{
+	struct drm_fb_helper *fb_helper = info->par;
+
+	/* No need to take a ref for fbcon because it unbinds on unregister */
+	if (user && !try_module_get(fb_helper->dev->driver->fops->owner))
+		return -ENODEV;
+
+	return 0;
+}
+
+static int drm_fbdev_shmem_fb_release(struct fb_info *info, int user)
+{
+	struct drm_fb_helper *fb_helper = info->par;
+
+	if (user)
+		module_put(fb_helper->dev->driver->fops->owner);
+
+	return 0;
+}
+
+FB_GEN_DEFAULT_DEFERRED_SYSMEM_OPS(drm_fbdev_shmem,
+				   drm_fb_helper_damage_range,
+				   drm_fb_helper_damage_area);
+
+static int drm_fbdev_shmem_fb_mmap(struct fb_info *info, struct vm_area_struct *vma)
+{
+	struct drm_fb_helper *fb_helper = info->par;
+	struct drm_framebuffer *fb = fb_helper->fb;
+	struct drm_gem_object *obj = drm_gem_fb_get_obj(fb, 0);
+	struct drm_gem_shmem_object *shmem = to_drm_gem_shmem_obj(obj);
+
+	if (shmem->map_wc)
+		vma->vm_page_prot = pgprot_writecombine(vma->vm_page_prot);
+
+	return fb_deferred_io_mmap(info, vma);
+}
+
+static void drm_fbdev_shmem_fb_destroy(struct fb_info *info)
+{
+	struct drm_fb_helper *fb_helper = info->par;
+
+	if (!fb_helper->dev)
+		return;
+
+	drm_fb_helper_fini(fb_helper);
+
+	drm_client_buffer_vunmap(fb_helper->buffer);
+	drm_client_framebuffer_delete(fb_helper->buffer);
+	drm_client_release(&fb_helper->client);
+	drm_fb_helper_unprepare(fb_helper);
+	kfree(fb_helper);
+}
+
+static const struct fb_ops drm_fbdev_shmem_fb_ops = {
+	.owner = THIS_MODULE,
+	.fb_open = drm_fbdev_shmem_fb_open,
+	.fb_release = drm_fbdev_shmem_fb_release,
+	__FB_DEFAULT_DEFERRED_OPS_RDWR(drm_fbdev_shmem),
+	DRM_FB_HELPER_DEFAULT_OPS,
+	__FB_DEFAULT_DEFERRED_OPS_DRAW(drm_fbdev_shmem),
+	.fb_mmap = drm_fbdev_shmem_fb_mmap,
+	.fb_destroy = drm_fbdev_shmem_fb_destroy,
+};
+
+static struct page *drm_fbdev_shmem_get_page(struct fb_info *info, unsigned long offset)
+{
+	struct drm_fb_helper *fb_helper = info->par;
+	struct drm_framebuffer *fb = fb_helper->fb;
+	struct drm_gem_object *obj = drm_gem_fb_get_obj(fb, 0);
+	struct drm_gem_shmem_object *shmem = to_drm_gem_shmem_obj(obj);
+	unsigned int i = offset >> PAGE_SHIFT;
+	struct page *page;
+
+	if (fb_WARN_ON_ONCE(info, offset > obj->size))
+		return NULL;
+
+	page = shmem->pages[i]; // protected by active vmap
+	if (page)
+		get_page(page);
+	fb_WARN_ON_ONCE(info, !page);
+
+	return page;
+}
+
+/*
+ * struct drm_fb_helper
+ */
+
+static int drm_fbdev_shmem_helper_fb_probe(struct drm_fb_helper *fb_helper,
+					   struct drm_fb_helper_surface_size *sizes)
+{
+	struct drm_client_dev *client = &fb_helper->client;
+	struct drm_device *dev = fb_helper->dev;
+	struct drm_client_buffer *buffer;
+	struct drm_gem_shmem_object *shmem;
+	struct drm_framebuffer *fb;
+	struct fb_info *info;
+	u32 format;
+	struct iosys_map map;
+	int ret;
+
+	drm_dbg_kms(dev, "surface width(%d), height(%d) and bpp(%d)\n",
+		    sizes->surface_width, sizes->surface_height,
+		    sizes->surface_bpp);
+
+	format = drm_mode_legacy_fb_format(sizes->surface_bpp, sizes->surface_depth);
+	buffer = drm_client_framebuffer_create(client, sizes->surface_width,
+					       sizes->surface_height, format);
+	if (IS_ERR(buffer))
+		return PTR_ERR(buffer);
+	shmem = to_drm_gem_shmem_obj(buffer->gem);
+
+	fb = buffer->fb;
+
+	ret = drm_client_buffer_vmap(buffer, &map);
+	if (ret) {
+		goto err_drm_client_buffer_delete;
+	} else if (drm_WARN_ON(dev, map.is_iomem)) {
+		ret = -ENODEV; /* I/O memory not supported; use generic emulation */
+		goto err_drm_client_buffer_delete;
+	}
+
+	fb_helper->buffer = buffer;
+	fb_helper->fb = fb;
+
+	info = drm_fb_helper_alloc_info(fb_helper);
+	if (IS_ERR(info)) {
+		ret = PTR_ERR(info);
+		goto err_drm_client_buffer_vunmap;
+	}
+
+	drm_fb_helper_fill_info(info, fb_helper, sizes);
+
+	info->fbops = &drm_fbdev_shmem_fb_ops;
+
+	/* screen */
+	info->flags |= FBINFO_VIRTFB; /* system memory */
+	if (!shmem->map_wc)
+		info->flags |= FBINFO_READS_FAST; /* signal caching */
+	info->screen_size = sizes->surface_height * fb->pitches[0];
+	info->screen_buffer = map.vaddr;
+	info->fix.smem_len = info->screen_size;
+
+	/* deferred I/O */
+	fb_helper->fbdefio.delay = HZ / 20;
+	fb_helper->fbdefio.get_page = drm_fbdev_shmem_get_page;
+	fb_helper->fbdefio.deferred_io = drm_fb_helper_deferred_io;
+
+	info->fbdefio = &fb_helper->fbdefio;
+	ret = fb_deferred_io_init(info);
+	if (ret)
+		goto err_drm_fb_helper_release_info;
+
+	return 0;
+
+err_drm_fb_helper_release_info:
+	drm_fb_helper_release_info(fb_helper);
+err_drm_client_buffer_vunmap:
+	fb_helper->fb = NULL;
+	fb_helper->buffer = NULL;
+	drm_client_buffer_vunmap(buffer);
+err_drm_client_buffer_delete:
+	drm_client_framebuffer_delete(buffer);
+	return ret;
+}
+
+static int drm_fbdev_shmem_helper_fb_dirty(struct drm_fb_helper *helper,
+					   struct drm_clip_rect *clip)
+{
+	struct drm_device *dev = helper->dev;
+	int ret;
+
+	/* Call damage handlers only if necessary */
+	if (!(clip->x1 < clip->x2 && clip->y1 < clip->y2))
+		return 0;
+
+	if (helper->fb->funcs->dirty) {
+		ret = helper->fb->funcs->dirty(helper->fb, NULL, 0, 0, clip, 1);
+		if (drm_WARN_ONCE(dev, ret, "Dirty helper failed: ret=%d\n", ret))
+			return ret;
+	}
+
+	return 0;
+}
+
+static const struct drm_fb_helper_funcs drm_fbdev_shmem_helper_funcs = {
+	.fb_probe = drm_fbdev_shmem_helper_fb_probe,
+	.fb_dirty = drm_fbdev_shmem_helper_fb_dirty,
+};
+
+/*
+ * struct drm_client_funcs
+ */
+
+static void drm_fbdev_shmem_client_unregister(struct drm_client_dev *client)
+{
+	struct drm_fb_helper *fb_helper = drm_fb_helper_from_client(client);
+
+	if (fb_helper->info) {
+		drm_fb_helper_unregister_info(fb_helper);
+	} else {
+		drm_client_release(&fb_helper->client);
+		drm_fb_helper_unprepare(fb_helper);
+		kfree(fb_helper);
+	}
+}
+
+static int drm_fbdev_shmem_client_restore(struct drm_client_dev *client)
+{
+	drm_fb_helper_lastclose(client->dev);
+
+	return 0;
+}
+
+static int drm_fbdev_shmem_client_hotplug(struct drm_client_dev *client)
+{
+	struct drm_fb_helper *fb_helper = drm_fb_helper_from_client(client);
+	struct drm_device *dev = client->dev;
+	int ret;
+
+	if (dev->fb_helper)
+		return drm_fb_helper_hotplug_event(dev->fb_helper);
+
+	ret = drm_fb_helper_init(dev, fb_helper);
+	if (ret)
+		goto err_drm_err;
+
+	if (!drm_drv_uses_atomic_modeset(dev))
+		drm_helper_disable_unused_functions(dev);
+
+	ret = drm_fb_helper_initial_config(fb_helper);
+	if (ret)
+		goto err_drm_fb_helper_fini;
+
+	return 0;
+
+err_drm_fb_helper_fini:
+	drm_fb_helper_fini(fb_helper);
+err_drm_err:
+	drm_err(dev, "fbdev-shmem: Failed to setup emulation (ret=%d)\n", ret);
+	return ret;
+}
+
+static const struct drm_client_funcs drm_fbdev_shmem_client_funcs = {
+	.owner		= THIS_MODULE,
+	.unregister	= drm_fbdev_shmem_client_unregister,
+	.restore	= drm_fbdev_shmem_client_restore,
+	.hotplug	= drm_fbdev_shmem_client_hotplug,
+};
+
+/**
+ * drm_fbdev_shmem_setup() - Setup fbdev emulation for GEM SHMEM helpers
+ * @dev: DRM device
+ * @preferred_bpp: Preferred bits per pixel for the device.
+ *                 32 is used if this is zero.
+ *
+ * This function sets up fbdev emulation for GEM DMA drivers that support
+ * dumb buffers with a virtual address and that can be mmap'ed.
+ * drm_fbdev_shmem_setup() shall be called after the DRM driver registered
+ * the new DRM device with drm_dev_register().
+ *
+ * Restore, hotplug events and teardown are all taken care of. Drivers that do
+ * suspend/resume need to call drm_fb_helper_set_suspend_unlocked() themselves.
+ * Simple drivers might use drm_mode_config_helper_suspend().
+ *
+ * This function is safe to call even when there are no connectors present.
+ * Setup will be retried on the next hotplug event.
+ *
+ * The fbdev is destroyed by drm_dev_unregister().
+ */
+void drm_fbdev_shmem_setup(struct drm_device *dev, unsigned int preferred_bpp)
+{
+	struct drm_fb_helper *fb_helper;
+	int ret;
+
+	drm_WARN(dev, !dev->registered, "Device has not been registered.\n");
+	drm_WARN(dev, dev->fb_helper, "fb_helper is already set!\n");
+
+	fb_helper = kzalloc(sizeof(*fb_helper), GFP_KERNEL);
+	if (!fb_helper)
+		return;
+	drm_fb_helper_prepare(dev, fb_helper, preferred_bpp, &drm_fbdev_shmem_helper_funcs);
+
+	ret = drm_client_init(dev, &fb_helper->client, "fbdev", &drm_fbdev_shmem_client_funcs);
+	if (ret) {
+		drm_err(dev, "Failed to register client: %d\n", ret);
+		goto err_drm_client_init;
+	}
+
+	drm_client_register(&fb_helper->client);
+
+	return;
+
+err_drm_client_init:
+	drm_fb_helper_unprepare(fb_helper);
+	kfree(fb_helper);
+}
+EXPORT_SYMBOL(drm_fbdev_shmem_setup);
diff --git a/include/drm/drm_fbdev_shmem.h b/include/drm/drm_fbdev_shmem.h
new file mode 100644
index 0000000000000..fb43cadd1950c
--- /dev/null
+++ b/include/drm/drm_fbdev_shmem.h
@@ -0,0 +1,15 @@
+/* SPDX-License-Identifier: MIT */
+
+#ifndef DRM_FBDEV_SHMEM_H
+#define DRM_FBDEV_SHMEM_H
+
+struct drm_device;
+
+#ifdef CONFIG_DRM_FBDEV_EMULATION
+void drm_fbdev_shmem_setup(struct drm_device *dev, unsigned int preferred_bpp);
+#else
+static inline void drm_fbdev_shmem_setup(struct drm_device *dev, unsigned int preferred_bpp)
+{ }
+#endif
+
+#endif
-- 
2.44.0


^ permalink raw reply related	[flat|nested] 78+ messages in thread

* [PATCH 09/43] drm/ast: Use fbdev-shmem
  2024-03-12 15:44 [PATCH 00/43] drm: Provide fbdev emulation per memory manager Thomas Zimmermann
                   ` (7 preceding siblings ...)
  2024-03-12 15:45 ` [PATCH 08/43] drm/fbdev: Add fbdev-shmem Thomas Zimmermann
@ 2024-03-12 15:45 ` Thomas Zimmermann
  2024-03-13 14:03   ` Jocelyn Falempe
  2024-03-12 15:45 ` [PATCH 10/43] drm/gud: " Thomas Zimmermann
                   ` (33 subsequent siblings)
  42 siblings, 1 reply; 78+ messages in thread
From: Thomas Zimmermann @ 2024-03-12 15:45 UTC (permalink / raw)
  To: daniel, airlied, deller, javierm
  Cc: linux-fbdev, dri-devel, Thomas Zimmermann, Dave Airlie, Jocelyn Falempe

Implement fbdev emulation with fbdev-shmem. Avoids the overhead of
fbdev-generic's additional shadow buffering. No functional changes.

Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
Cc: Dave Airlie <airlied@redhat.com>
Cc: Thomas Zimmermann <tzimmermann@suse.de>
Cc: Jocelyn Falempe <jfalempe@redhat.com>
---
 drivers/gpu/drm/ast/ast_drv.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/gpu/drm/ast/ast_drv.c b/drivers/gpu/drm/ast/ast_drv.c
index 90bcb1eb9cd94..4fcab4304e176 100644
--- a/drivers/gpu/drm/ast/ast_drv.c
+++ b/drivers/gpu/drm/ast/ast_drv.c
@@ -32,7 +32,7 @@
 #include <drm/drm_aperture.h>
 #include <drm/drm_atomic_helper.h>
 #include <drm/drm_drv.h>
-#include <drm/drm_fbdev_generic.h>
+#include <drm/drm_fbdev_shmem.h>
 #include <drm/drm_gem_shmem_helper.h>
 #include <drm/drm_module.h>
 #include <drm/drm_probe_helper.h>
@@ -359,7 +359,7 @@ static int ast_pci_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
 	if (ret)
 		return ret;
 
-	drm_fbdev_generic_setup(drm, 32);
+	drm_fbdev_shmem_setup(drm, 32);
 
 	return 0;
 }
-- 
2.44.0


^ permalink raw reply related	[flat|nested] 78+ messages in thread

* [PATCH 10/43] drm/gud: Use fbdev-shmem
  2024-03-12 15:44 [PATCH 00/43] drm: Provide fbdev emulation per memory manager Thomas Zimmermann
                   ` (8 preceding siblings ...)
  2024-03-12 15:45 ` [PATCH 09/43] drm/ast: Use fbdev-shmem Thomas Zimmermann
@ 2024-03-12 15:45 ` Thomas Zimmermann
  2024-03-17 19:21   ` Noralf Trønnes
  2024-03-12 15:45 ` [PATCH 11/43] drm/hyperv: " Thomas Zimmermann
                   ` (32 subsequent siblings)
  42 siblings, 1 reply; 78+ messages in thread
From: Thomas Zimmermann @ 2024-03-12 15:45 UTC (permalink / raw)
  To: daniel, airlied, deller, javierm
  Cc: linux-fbdev, dri-devel, Thomas Zimmermann, Noralf Trønnes

Implement fbdev emulation with fbdev-shmem. Avoids the overhead of
fbdev-generic's additional shadow buffering. No functional changes.

Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
Cc: "Noralf Trønnes" <noralf@tronnes.org>
---
 drivers/gpu/drm/gud/gud_drv.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/gpu/drm/gud/gud_drv.c b/drivers/gpu/drm/gud/gud_drv.c
index 9d7bf8ee45f13..4f5aa2e5cb890 100644
--- a/drivers/gpu/drm/gud/gud_drv.c
+++ b/drivers/gpu/drm/gud/gud_drv.c
@@ -18,7 +18,7 @@
 #include <drm/drm_damage_helper.h>
 #include <drm/drm_debugfs.h>
 #include <drm/drm_drv.h>
-#include <drm/drm_fbdev_generic.h>
+#include <drm/drm_fbdev_shmem.h>
 #include <drm/drm_fourcc.h>
 #include <drm/drm_gem_atomic_helper.h>
 #include <drm/drm_gem_framebuffer_helper.h>
@@ -622,7 +622,7 @@ static int gud_probe(struct usb_interface *intf, const struct usb_device_id *id)
 
 	drm_kms_helper_poll_init(drm);
 
-	drm_fbdev_generic_setup(drm, 0);
+	drm_fbdev_shmem_setup(drm, 0);
 
 	return 0;
 }
-- 
2.44.0


^ permalink raw reply related	[flat|nested] 78+ messages in thread

* [PATCH 11/43] drm/hyperv: Use fbdev-shmem
  2024-03-12 15:44 [PATCH 00/43] drm: Provide fbdev emulation per memory manager Thomas Zimmermann
                   ` (9 preceding siblings ...)
  2024-03-12 15:45 ` [PATCH 10/43] drm/gud: " Thomas Zimmermann
@ 2024-03-12 15:45 ` Thomas Zimmermann
  2024-03-12 16:08   ` Deepak Rawat
  2024-03-12 15:45 ` [PATCH 12/43] drm/mgag200: " Thomas Zimmermann
                   ` (31 subsequent siblings)
  42 siblings, 1 reply; 78+ messages in thread
From: Thomas Zimmermann @ 2024-03-12 15:45 UTC (permalink / raw)
  To: daniel, airlied, deller, javierm
  Cc: linux-fbdev, dri-devel, Thomas Zimmermann, Deepak Rawat

Implement fbdev emulation with fbdev-shmem. Avoids the overhead of
fbdev-generic's additional shadow buffering. No functional changes.

Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
Cc: Deepak Rawat <drawat.floss@gmail.com>
---
 drivers/gpu/drm/hyperv/hyperv_drm_drv.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/gpu/drm/hyperv/hyperv_drm_drv.c b/drivers/gpu/drm/hyperv/hyperv_drm_drv.c
index cff85086f2d66..ff93e08d5036d 100644
--- a/drivers/gpu/drm/hyperv/hyperv_drm_drv.c
+++ b/drivers/gpu/drm/hyperv/hyperv_drm_drv.c
@@ -11,7 +11,7 @@
 #include <drm/drm_aperture.h>
 #include <drm/drm_atomic_helper.h>
 #include <drm/drm_drv.h>
-#include <drm/drm_fbdev_generic.h>
+#include <drm/drm_fbdev_shmem.h>
 #include <drm/drm_gem_shmem_helper.h>
 #include <drm/drm_simple_kms_helper.h>
 
@@ -149,7 +149,7 @@ static int hyperv_vmbus_probe(struct hv_device *hdev,
 		goto err_free_mmio;
 	}
 
-	drm_fbdev_generic_setup(dev, 0);
+	drm_fbdev_shmem_setup(dev, 0);
 
 	return 0;
 
-- 
2.44.0


^ permalink raw reply related	[flat|nested] 78+ messages in thread

* [PATCH 12/43] drm/mgag200: Use fbdev-shmem
  2024-03-12 15:44 [PATCH 00/43] drm: Provide fbdev emulation per memory manager Thomas Zimmermann
                   ` (10 preceding siblings ...)
  2024-03-12 15:45 ` [PATCH 11/43] drm/hyperv: " Thomas Zimmermann
@ 2024-03-12 15:45 ` Thomas Zimmermann
  2024-03-13 14:03   ` Jocelyn Falempe
  2024-03-12 15:45 ` [PATCH 13/43] drm/solomon: " Thomas Zimmermann
                   ` (30 subsequent siblings)
  42 siblings, 1 reply; 78+ messages in thread
From: Thomas Zimmermann @ 2024-03-12 15:45 UTC (permalink / raw)
  To: daniel, airlied, deller, javierm
  Cc: linux-fbdev, dri-devel, Thomas Zimmermann, Dave Airlie, Jocelyn Falempe

Implement fbdev emulation with fbdev-shmem. Avoids the overhead of
fbdev-generic's additional shadow buffering. No functional changes.

Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
Cc: Dave Airlie <airlied@redhat.com>
Cc: Thomas Zimmermann <tzimmermann@suse.de>
Cc: Jocelyn Falempe <jfalempe@redhat.com>
---
 drivers/gpu/drm/mgag200/mgag200_drv.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/gpu/drm/mgag200/mgag200_drv.c b/drivers/gpu/drm/mgag200/mgag200_drv.c
index 573dbe256aa8b..65f2ed18b31c5 100644
--- a/drivers/gpu/drm/mgag200/mgag200_drv.c
+++ b/drivers/gpu/drm/mgag200/mgag200_drv.c
@@ -12,7 +12,7 @@
 #include <drm/drm_aperture.h>
 #include <drm/drm_atomic_helper.h>
 #include <drm/drm_drv.h>
-#include <drm/drm_fbdev_generic.h>
+#include <drm/drm_fbdev_shmem.h>
 #include <drm/drm_file.h>
 #include <drm/drm_ioctl.h>
 #include <drm/drm_managed.h>
@@ -285,7 +285,7 @@ mgag200_pci_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
 	 * FIXME: A 24-bit color depth does not work with 24 bpp on
 	 * G200ER. Force 32 bpp.
 	 */
-	drm_fbdev_generic_setup(dev, 32);
+	drm_fbdev_shmem_setup(dev, 32);
 
 	return 0;
 }
-- 
2.44.0


^ permalink raw reply related	[flat|nested] 78+ messages in thread

* [PATCH 13/43] drm/solomon: Use fbdev-shmem
  2024-03-12 15:44 [PATCH 00/43] drm: Provide fbdev emulation per memory manager Thomas Zimmermann
                   ` (11 preceding siblings ...)
  2024-03-12 15:45 ` [PATCH 12/43] drm/mgag200: " Thomas Zimmermann
@ 2024-03-12 15:45 ` Thomas Zimmermann
  2024-03-12 15:45 ` [PATCH 14/43] drm/tiny/cirrus: " Thomas Zimmermann
                   ` (29 subsequent siblings)
  42 siblings, 0 replies; 78+ messages in thread
From: Thomas Zimmermann @ 2024-03-12 15:45 UTC (permalink / raw)
  To: daniel, airlied, deller, javierm
  Cc: linux-fbdev, dri-devel, Thomas Zimmermann

Implement fbdev emulation with fbdev-shmem. Avoids the overhead of
fbdev-generic's additional shadow buffering. No functional changes.

Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
Cc: Javier Martinez Canillas <javierm@redhat.com>
---
 drivers/gpu/drm/solomon/ssd130x.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/gpu/drm/solomon/ssd130x.c b/drivers/gpu/drm/solomon/ssd130x.c
index ebd943b9e357b..6f51bcf774e27 100644
--- a/drivers/gpu/drm/solomon/ssd130x.c
+++ b/drivers/gpu/drm/solomon/ssd130x.c
@@ -23,7 +23,7 @@
 #include <drm/drm_crtc_helper.h>
 #include <drm/drm_damage_helper.h>
 #include <drm/drm_edid.h>
-#include <drm/drm_fbdev_generic.h>
+#include <drm/drm_fbdev_shmem.h>
 #include <drm/drm_format_helper.h>
 #include <drm/drm_framebuffer.h>
 #include <drm/drm_gem_atomic_helper.h>
@@ -2029,7 +2029,7 @@ struct ssd130x_device *ssd130x_probe(struct device *dev, struct regmap *regmap)
 	if (ret)
 		return ERR_PTR(dev_err_probe(dev, ret, "DRM device register failed\n"));
 
-	drm_fbdev_generic_setup(drm, 32);
+	drm_fbdev_shmem_setup(drm, 32);
 
 	return ssd130x;
 }
-- 
2.44.0


^ permalink raw reply related	[flat|nested] 78+ messages in thread

* [PATCH 14/43] drm/tiny/cirrus: Use fbdev-shmem
  2024-03-12 15:44 [PATCH 00/43] drm: Provide fbdev emulation per memory manager Thomas Zimmermann
                   ` (12 preceding siblings ...)
  2024-03-12 15:45 ` [PATCH 13/43] drm/solomon: " Thomas Zimmermann
@ 2024-03-12 15:45 ` Thomas Zimmermann
  2024-03-12 15:45 ` [PATCH 15/43] drm/tiny/gm12u320: " Thomas Zimmermann
                   ` (28 subsequent siblings)
  42 siblings, 0 replies; 78+ messages in thread
From: Thomas Zimmermann @ 2024-03-12 15:45 UTC (permalink / raw)
  To: daniel, airlied, deller, javierm
  Cc: linux-fbdev, dri-devel, Thomas Zimmermann

Implement fbdev emulation with fbdev-shmem. Avoids the overhead of
fbdev-generic's additional shadow buffering. No functional changes.

Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
---
 drivers/gpu/drm/tiny/cirrus.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/gpu/drm/tiny/cirrus.c b/drivers/gpu/drm/tiny/cirrus.c
index 4e3a152f897ac..3ac4f310aa2ad 100644
--- a/drivers/gpu/drm/tiny/cirrus.c
+++ b/drivers/gpu/drm/tiny/cirrus.c
@@ -31,7 +31,7 @@
 #include <drm/drm_damage_helper.h>
 #include <drm/drm_drv.h>
 #include <drm/drm_edid.h>
-#include <drm/drm_fbdev_generic.h>
+#include <drm/drm_fbdev_shmem.h>
 #include <drm/drm_file.h>
 #include <drm/drm_format_helper.h>
 #include <drm/drm_fourcc.h>
@@ -716,7 +716,7 @@ static int cirrus_pci_probe(struct pci_dev *pdev,
 	if (ret)
 		return ret;
 
-	drm_fbdev_generic_setup(dev, 16);
+	drm_fbdev_shmem_setup(dev, 16);
 	return 0;
 }
 
-- 
2.44.0


^ permalink raw reply related	[flat|nested] 78+ messages in thread

* [PATCH 15/43] drm/tiny/gm12u320: Use fbdev-shmem
  2024-03-12 15:44 [PATCH 00/43] drm: Provide fbdev emulation per memory manager Thomas Zimmermann
                   ` (13 preceding siblings ...)
  2024-03-12 15:45 ` [PATCH 14/43] drm/tiny/cirrus: " Thomas Zimmermann
@ 2024-03-12 15:45 ` Thomas Zimmermann
  2024-03-12 15:45 ` [PATCH 16/43] drm/tiny/ofdrm: " Thomas Zimmermann
                   ` (27 subsequent siblings)
  42 siblings, 0 replies; 78+ messages in thread
From: Thomas Zimmermann @ 2024-03-12 15:45 UTC (permalink / raw)
  To: daniel, airlied, deller, javierm
  Cc: linux-fbdev, dri-devel, Thomas Zimmermann, Hans de Goede

Implement fbdev emulation with fbdev-shmem. Avoids the overhead of
fbdev-generic's additional shadow buffering. No functional changes.

Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
Cc: Hans de Goede <hdegoede@redhat.com>
---
 drivers/gpu/drm/tiny/gm12u320.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/gpu/drm/tiny/gm12u320.c b/drivers/gpu/drm/tiny/gm12u320.c
index 0187539ff5eaa..8b4efd39d7c41 100644
--- a/drivers/gpu/drm/tiny/gm12u320.c
+++ b/drivers/gpu/drm/tiny/gm12u320.c
@@ -13,7 +13,7 @@
 #include <drm/drm_damage_helper.h>
 #include <drm/drm_drv.h>
 #include <drm/drm_edid.h>
-#include <drm/drm_fbdev_generic.h>
+#include <drm/drm_fbdev_shmem.h>
 #include <drm/drm_file.h>
 #include <drm/drm_format_helper.h>
 #include <drm/drm_fourcc.h>
@@ -699,7 +699,7 @@ static int gm12u320_usb_probe(struct usb_interface *interface,
 	if (ret)
 		goto err_put_device;
 
-	drm_fbdev_generic_setup(dev, 0);
+	drm_fbdev_shmem_setup(dev, 0);
 
 	return 0;
 
-- 
2.44.0


^ permalink raw reply related	[flat|nested] 78+ messages in thread

* [PATCH 16/43] drm/tiny/ofdrm: Use fbdev-shmem
  2024-03-12 15:44 [PATCH 00/43] drm: Provide fbdev emulation per memory manager Thomas Zimmermann
                   ` (14 preceding siblings ...)
  2024-03-12 15:45 ` [PATCH 15/43] drm/tiny/gm12u320: " Thomas Zimmermann
@ 2024-03-12 15:45 ` Thomas Zimmermann
  2024-03-12 15:45 ` [PATCH 17/43] drm/tiny/simpledrm: " Thomas Zimmermann
                   ` (26 subsequent siblings)
  42 siblings, 0 replies; 78+ messages in thread
From: Thomas Zimmermann @ 2024-03-12 15:45 UTC (permalink / raw)
  To: daniel, airlied, deller, javierm
  Cc: linux-fbdev, dri-devel, Thomas Zimmermann

Implement fbdev emulation with fbdev-shmem. Avoids the overhead of
fbdev-generic's additional shadow buffering. No functional changes.

Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
Cc: Thomas Zimmermann <tzimmermann@suse.de>
Cc: Javier Martinez Canillas <javierm@redhat.com>
---
 drivers/gpu/drm/tiny/ofdrm.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/gpu/drm/tiny/ofdrm.c b/drivers/gpu/drm/tiny/ofdrm.c
index ab89b7fc7bf61..35996f7eedac0 100644
--- a/drivers/gpu/drm/tiny/ofdrm.c
+++ b/drivers/gpu/drm/tiny/ofdrm.c
@@ -11,7 +11,7 @@
 #include <drm/drm_damage_helper.h>
 #include <drm/drm_device.h>
 #include <drm/drm_drv.h>
-#include <drm/drm_fbdev_generic.h>
+#include <drm/drm_fbdev_shmem.h>
 #include <drm/drm_format_helper.h>
 #include <drm/drm_framebuffer.h>
 #include <drm/drm_gem_atomic_helper.h>
@@ -1377,7 +1377,7 @@ static int ofdrm_probe(struct platform_device *pdev)
 	if (color_mode == 16)
 		color_mode = odev->format->depth; // can be 15 or 16
 
-	drm_fbdev_generic_setup(dev, color_mode);
+	drm_fbdev_shmem_setup(dev, color_mode);
 
 	return 0;
 }
-- 
2.44.0


^ permalink raw reply related	[flat|nested] 78+ messages in thread

* [PATCH 17/43] drm/tiny/simpledrm: Use fbdev-shmem
  2024-03-12 15:44 [PATCH 00/43] drm: Provide fbdev emulation per memory manager Thomas Zimmermann
                   ` (15 preceding siblings ...)
  2024-03-12 15:45 ` [PATCH 16/43] drm/tiny/ofdrm: " Thomas Zimmermann
@ 2024-03-12 15:45 ` Thomas Zimmermann
  2024-03-12 15:45 ` [PATCH 18/43] drm/udl: " Thomas Zimmermann
                   ` (25 subsequent siblings)
  42 siblings, 0 replies; 78+ messages in thread
From: Thomas Zimmermann @ 2024-03-12 15:45 UTC (permalink / raw)
  To: daniel, airlied, deller, javierm
  Cc: linux-fbdev, dri-devel, Thomas Zimmermann

Implement fbdev emulation with fbdev-shmem. Avoids the overhead of
fbdev-generic's additional shadow buffering. No functional changes.

Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
Cc: Thomas Zimmermann <tzimmermann@suse.de>
Cc: Javier Martinez Canillas <javierm@redhat.com>
---
 drivers/gpu/drm/tiny/simpledrm.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/gpu/drm/tiny/simpledrm.c b/drivers/gpu/drm/tiny/simpledrm.c
index 7ce1c46176750..3cb09ad5f7537 100644
--- a/drivers/gpu/drm/tiny/simpledrm.c
+++ b/drivers/gpu/drm/tiny/simpledrm.c
@@ -17,7 +17,7 @@
 #include <drm/drm_damage_helper.h>
 #include <drm/drm_device.h>
 #include <drm/drm_drv.h>
-#include <drm/drm_fbdev_generic.h>
+#include <drm/drm_fbdev_shmem.h>
 #include <drm/drm_format_helper.h>
 #include <drm/drm_framebuffer.h>
 #include <drm/drm_gem_atomic_helper.h>
@@ -1026,7 +1026,7 @@ static int simpledrm_probe(struct platform_device *pdev)
 	if (color_mode == 16)
 		color_mode = sdev->format->depth; // can be 15 or 16
 
-	drm_fbdev_generic_setup(dev, color_mode);
+	drm_fbdev_shmem_setup(dev, color_mode);
 
 	return 0;
 }
-- 
2.44.0


^ permalink raw reply related	[flat|nested] 78+ messages in thread

* [PATCH 18/43] drm/udl: Use fbdev-shmem
  2024-03-12 15:44 [PATCH 00/43] drm: Provide fbdev emulation per memory manager Thomas Zimmermann
                   ` (16 preceding siblings ...)
  2024-03-12 15:45 ` [PATCH 17/43] drm/tiny/simpledrm: " Thomas Zimmermann
@ 2024-03-12 15:45 ` Thomas Zimmermann
  2024-03-12 15:45 ` [PATCH 19/43] drm/virtio: " Thomas Zimmermann
                   ` (24 subsequent siblings)
  42 siblings, 0 replies; 78+ messages in thread
From: Thomas Zimmermann @ 2024-03-12 15:45 UTC (permalink / raw)
  To: daniel, airlied, deller, javierm
  Cc: linux-fbdev, dri-devel, Thomas Zimmermann, Dave Airlie, Sean Paul

Implement fbdev emulation with fbdev-shmem. Avoids the overhead of
fbdev-generic's additional shadow buffering. No functional changes.

Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
Cc: Dave Airlie <airlied@redhat.com>
Cc: Sean Paul <sean@poorly.run>
Cc: Thomas Zimmermann <tzimmermann@suse.de>
---
 drivers/gpu/drm/udl/udl_drv.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/gpu/drm/udl/udl_drv.c b/drivers/gpu/drm/udl/udl_drv.c
index 1506094a80098..9612e9af27a47 100644
--- a/drivers/gpu/drm/udl/udl_drv.c
+++ b/drivers/gpu/drm/udl/udl_drv.c
@@ -6,7 +6,7 @@
 #include <linux/module.h>
 
 #include <drm/drm_drv.h>
-#include <drm/drm_fbdev_generic.h>
+#include <drm/drm_fbdev_shmem.h>
 #include <drm/drm_file.h>
 #include <drm/drm_gem_shmem_helper.h>
 #include <drm/drm_managed.h>
@@ -117,7 +117,7 @@ static int udl_usb_probe(struct usb_interface *interface,
 
 	DRM_INFO("Initialized udl on minor %d\n", udl->drm.primary->index);
 
-	drm_fbdev_generic_setup(&udl->drm, 0);
+	drm_fbdev_shmem_setup(&udl->drm, 0);
 
 	return 0;
 }
-- 
2.44.0


^ permalink raw reply related	[flat|nested] 78+ messages in thread

* [PATCH 19/43] drm/virtio: Use fbdev-shmem
  2024-03-12 15:44 [PATCH 00/43] drm: Provide fbdev emulation per memory manager Thomas Zimmermann
                   ` (17 preceding siblings ...)
  2024-03-12 15:45 ` [PATCH 18/43] drm/udl: " Thomas Zimmermann
@ 2024-03-12 15:45 ` Thomas Zimmermann
  2024-03-28 14:55   ` Dmitry Osipenko
  2024-03-12 15:45 ` [PATCH 20/43] drm/vkms: " Thomas Zimmermann
                   ` (23 subsequent siblings)
  42 siblings, 1 reply; 78+ messages in thread
From: Thomas Zimmermann @ 2024-03-12 15:45 UTC (permalink / raw)
  To: daniel, airlied, deller, javierm
  Cc: linux-fbdev, dri-devel, Thomas Zimmermann, David Airlie,
	Gerd Hoffmann, Gurchetan Singh, Chia-I Wu

Implement fbdev emulation with fbdev-shmem. Avoids the overhead of
fbdev-generic's additional shadow buffering. No functional changes.

Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
Cc: David Airlie <airlied@redhat.com>
Cc: Gerd Hoffmann <kraxel@redhat.com>
Cc: Gurchetan Singh <gurchetansingh@chromium.org>
Cc: Chia-I Wu <olvaffe@gmail.com>
---
 drivers/gpu/drm/virtio/virtgpu_drv.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/gpu/drm/virtio/virtgpu_drv.c b/drivers/gpu/drm/virtio/virtgpu_drv.c
index 9539aa28937fa..3d626bbaab9e4 100644
--- a/drivers/gpu/drm/virtio/virtgpu_drv.c
+++ b/drivers/gpu/drm/virtio/virtgpu_drv.c
@@ -35,7 +35,7 @@
 #include <drm/drm_aperture.h>
 #include <drm/drm_atomic_helper.h>
 #include <drm/drm_drv.h>
-#include <drm/drm_fbdev_generic.h>
+#include <drm/drm_fbdev_shmem.h>
 #include <drm/drm_file.h>
 
 #include "virtgpu_drv.h"
@@ -103,7 +103,7 @@ static int virtio_gpu_probe(struct virtio_device *vdev)
 	if (ret)
 		goto err_deinit;
 
-	drm_fbdev_generic_setup(vdev->priv, 32);
+	drm_fbdev_shmem_setup(vdev->priv, 32);
 	return 0;
 
 err_deinit:
-- 
2.44.0


^ permalink raw reply related	[flat|nested] 78+ messages in thread

* [PATCH 20/43] drm/vkms: Use fbdev-shmem
  2024-03-12 15:44 [PATCH 00/43] drm: Provide fbdev emulation per memory manager Thomas Zimmermann
                   ` (18 preceding siblings ...)
  2024-03-12 15:45 ` [PATCH 19/43] drm/virtio: " Thomas Zimmermann
@ 2024-03-12 15:45 ` Thomas Zimmermann
  2024-03-12 15:45 ` [PATCH 21/43] drm/fbdev-dma: Implement damage handling and deferred I/O Thomas Zimmermann
                   ` (22 subsequent siblings)
  42 siblings, 0 replies; 78+ messages in thread
From: Thomas Zimmermann @ 2024-03-12 15:45 UTC (permalink / raw)
  To: daniel, airlied, deller, javierm
  Cc: linux-fbdev, dri-devel, Thomas Zimmermann, Rodrigo Siqueira,
	Melissa Wen, Maíra Canal, Haneen Mohammed

Implement fbdev emulation with fbdev-shmem. Avoids the overhead of
fbdev-generic's additional shadow buffering. No functional changes.

Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
Cc: Rodrigo Siqueira <rodrigosiqueiramelo@gmail.com>
Cc: Melissa Wen <melissa.srw@gmail.com>
Cc: "Maíra Canal" <mairacanal@riseup.net>
Cc: Haneen Mohammed <hamohammed.sa@gmail.com>
Cc: Daniel Vetter <daniel@ffwll.ch>
---
 drivers/gpu/drm/vkms/vkms_drv.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/gpu/drm/vkms/vkms_drv.c b/drivers/gpu/drm/vkms/vkms_drv.c
index dd0af086e7fa9..8dc9dc13896e9 100644
--- a/drivers/gpu/drm/vkms/vkms_drv.c
+++ b/drivers/gpu/drm/vkms/vkms_drv.c
@@ -17,7 +17,7 @@
 #include <drm/drm_atomic.h>
 #include <drm/drm_atomic_helper.h>
 #include <drm/drm_drv.h>
-#include <drm/drm_fbdev_generic.h>
+#include <drm/drm_fbdev_shmem.h>
 #include <drm/drm_file.h>
 #include <drm/drm_gem_framebuffer_helper.h>
 #include <drm/drm_ioctl.h>
@@ -223,7 +223,7 @@ static int vkms_create(struct vkms_config *config)
 	if (ret)
 		goto out_devres;
 
-	drm_fbdev_generic_setup(&vkms_device->drm, 0);
+	drm_fbdev_shmem_setup(&vkms_device->drm, 0);
 
 	return 0;
 
-- 
2.44.0


^ permalink raw reply related	[flat|nested] 78+ messages in thread

* [PATCH 21/43] drm/fbdev-dma: Implement damage handling and deferred I/O
  2024-03-12 15:44 [PATCH 00/43] drm: Provide fbdev emulation per memory manager Thomas Zimmermann
                   ` (19 preceding siblings ...)
  2024-03-12 15:45 ` [PATCH 20/43] drm/vkms: " Thomas Zimmermann
@ 2024-03-12 15:45 ` Thomas Zimmermann
  2024-03-12 15:45 ` [PATCH 22/43] drm/arm/komeda: Use fbdev-dma Thomas Zimmermann
                   ` (21 subsequent siblings)
  42 siblings, 0 replies; 78+ messages in thread
From: Thomas Zimmermann @ 2024-03-12 15:45 UTC (permalink / raw)
  To: daniel, airlied, deller, javierm
  Cc: linux-fbdev, dri-devel, Thomas Zimmermann

Add support for damage handling and deferred I/O to fbdev-dma. This
enables fbdev-dma to support all DMA-memory-based DRM drivers, even
such with a dirty callback in their framebuffers.

The patch adds the code for deferred I/O and also sets a dedicated
helper for struct fb_ops.fb_mmap that support coherent mappings.

Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
---
 drivers/gpu/drm/drm_fbdev_dma.c | 65 ++++++++++++++++++++++++++-------
 1 file changed, 51 insertions(+), 14 deletions(-)

diff --git a/drivers/gpu/drm/drm_fbdev_dma.c b/drivers/gpu/drm/drm_fbdev_dma.c
index 6c9427bb4053b..8ffd072368bca 100644
--- a/drivers/gpu/drm/drm_fbdev_dma.c
+++ b/drivers/gpu/drm/drm_fbdev_dma.c
@@ -4,6 +4,7 @@
 
 #include <drm/drm_crtc_helper.h>
 #include <drm/drm_drv.h>
+#include <drm/drm_fb_dma_helper.h>
 #include <drm/drm_fb_helper.h>
 #include <drm/drm_framebuffer.h>
 #include <drm/drm_gem_dma_helper.h>
@@ -35,6 +36,22 @@ static int drm_fbdev_dma_fb_release(struct fb_info *info, int user)
 	return 0;
 }
 
+FB_GEN_DEFAULT_DEFERRED_SYSMEM_OPS(drm_fbdev_dma,
+				   drm_fb_helper_damage_range,
+				   drm_fb_helper_damage_area);
+
+static int drm_fbdev_dma_fb_mmap(struct fb_info *info, struct vm_area_struct *vma)
+{
+	struct drm_fb_helper *fb_helper = info->par;
+	struct drm_framebuffer *fb = fb_helper->fb;
+	struct drm_gem_dma_object *dma = drm_fb_dma_get_gem_obj(fb, 0);
+
+	if (!dma->map_noncoherent)
+		vma->vm_page_prot = pgprot_writecombine(vma->vm_page_prot);
+
+	return fb_deferred_io_mmap(info, vma);
+}
+
 static void drm_fbdev_dma_fb_destroy(struct fb_info *info)
 {
 	struct drm_fb_helper *fb_helper = info->par;
@@ -51,20 +68,13 @@ static void drm_fbdev_dma_fb_destroy(struct fb_info *info)
 	kfree(fb_helper);
 }
 
-static int drm_fbdev_dma_fb_mmap(struct fb_info *info, struct vm_area_struct *vma)
-{
-	struct drm_fb_helper *fb_helper = info->par;
-
-	return drm_gem_prime_mmap(fb_helper->buffer->gem, vma);
-}
-
 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_DEFAULT_DMAMEM_OPS_RDWR,
+	__FB_DEFAULT_DEFERRED_OPS_RDWR(drm_fbdev_dma),
 	DRM_FB_HELPER_DEFAULT_OPS,
-	__FB_DEFAULT_DMAMEM_OPS_DRAW,
+	__FB_DEFAULT_DEFERRED_OPS_DRAW(drm_fbdev_dma),
 	.fb_mmap = drm_fbdev_dma_fb_mmap,
 	.fb_destroy = drm_fbdev_dma_fb_destroy,
 };
@@ -98,10 +108,6 @@ static int drm_fbdev_dma_helper_fb_probe(struct drm_fb_helper *fb_helper,
 	dma_obj = to_drm_gem_dma_obj(buffer->gem);
 
 	fb = buffer->fb;
-	if (drm_WARN_ON(dev, fb->funcs->dirty)) {
-		ret = -ENODEV; /* damage handling not supported; use generic emulation */
-		goto err_drm_client_buffer_delete;
-	}
 
 	ret = drm_client_buffer_vmap(buffer, &map);
 	if (ret) {
@@ -112,7 +118,7 @@ static int drm_fbdev_dma_helper_fb_probe(struct drm_fb_helper *fb_helper,
 	}
 
 	fb_helper->buffer = buffer;
-	fb_helper->fb = buffer->fb;
+	fb_helper->fb = fb;
 
 	info = drm_fb_helper_alloc_info(fb_helper);
 	if (IS_ERR(info)) {
@@ -133,8 +139,19 @@ static int drm_fbdev_dma_helper_fb_probe(struct drm_fb_helper *fb_helper,
 	info->fix.smem_start = page_to_phys(virt_to_page(info->screen_buffer));
 	info->fix.smem_len = info->screen_size;
 
+	/* deferred I/O */
+	fb_helper->fbdefio.delay = HZ / 20;
+	fb_helper->fbdefio.deferred_io = drm_fb_helper_deferred_io;
+
+	info->fbdefio = &fb_helper->fbdefio;
+	ret = fb_deferred_io_init(info);
+	if (ret)
+		goto err_drm_fb_helper_release_info;
+
 	return 0;
 
+err_drm_fb_helper_release_info:
+	drm_fb_helper_release_info(fb_helper);
 err_drm_client_buffer_vunmap:
 	fb_helper->fb = NULL;
 	fb_helper->buffer = NULL;
@@ -144,8 +161,28 @@ static int drm_fbdev_dma_helper_fb_probe(struct drm_fb_helper *fb_helper,
 	return ret;
 }
 
+static int drm_fbdev_dma_helper_fb_dirty(struct drm_fb_helper *helper,
+					 struct drm_clip_rect *clip)
+{
+	struct drm_device *dev = helper->dev;
+	int ret;
+
+	/* Call damage handlers only if necessary */
+	if (!(clip->x1 < clip->x2 && clip->y1 < clip->y2))
+		return 0;
+
+	if (helper->fb->funcs->dirty) {
+		ret = helper->fb->funcs->dirty(helper->fb, NULL, 0, 0, clip, 1);
+		if (drm_WARN_ONCE(dev, ret, "Dirty helper failed: ret=%d\n", ret))
+			return ret;
+	}
+
+	return 0;
+}
+
 static const struct drm_fb_helper_funcs drm_fbdev_dma_helper_funcs = {
 	.fb_probe = drm_fbdev_dma_helper_fb_probe,
+	.fb_dirty = drm_fbdev_dma_helper_fb_dirty,
 };
 
 /*
-- 
2.44.0


^ permalink raw reply related	[flat|nested] 78+ messages in thread

* [PATCH 22/43] drm/arm/komeda: Use fbdev-dma
  2024-03-12 15:44 [PATCH 00/43] drm: Provide fbdev emulation per memory manager Thomas Zimmermann
                   ` (20 preceding siblings ...)
  2024-03-12 15:45 ` [PATCH 21/43] drm/fbdev-dma: Implement damage handling and deferred I/O Thomas Zimmermann
@ 2024-03-12 15:45 ` Thomas Zimmermann
  2024-03-13 10:53   ` Liviu Dudau
  2024-03-12 15:45 ` [PATCH 23/43] drm/hisilicon/kirin: " Thomas Zimmermann
                   ` (20 subsequent siblings)
  42 siblings, 1 reply; 78+ messages in thread
From: Thomas Zimmermann @ 2024-03-12 15:45 UTC (permalink / raw)
  To: daniel, airlied, deller, javierm
  Cc: linux-fbdev, dri-devel, Thomas Zimmermann, Liviu Dudau

Implement fbdev emulation with fbdev-dma. Fbdev-dma now supports
damage handling, which is required by komeda. Avoids the overhead of
fbdev-generic's additional shadow buffering. No functional changes.

Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
Cc: Liviu Dudau <liviu.dudau@arm.com>
---
 drivers/gpu/drm/arm/display/komeda/komeda_drv.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/gpu/drm/arm/display/komeda/komeda_drv.c b/drivers/gpu/drm/arm/display/komeda/komeda_drv.c
index cc57ea4e13ae6..ffdeec3b3f2ea 100644
--- a/drivers/gpu/drm/arm/display/komeda/komeda_drv.c
+++ b/drivers/gpu/drm/arm/display/komeda/komeda_drv.c
@@ -9,7 +9,7 @@
 #include <linux/of.h>
 #include <linux/platform_device.h>
 #include <linux/pm_runtime.h>
-#include <drm/drm_fbdev_generic.h>
+#include <drm/drm_fbdev_dma.h>
 #include <drm/drm_module.h>
 #include <drm/drm_of.h>
 #include "komeda_dev.h"
@@ -80,7 +80,7 @@ static int komeda_platform_probe(struct platform_device *pdev)
 	}
 
 	dev_set_drvdata(dev, mdrv);
-	drm_fbdev_generic_setup(&mdrv->kms->base, 32);
+	drm_fbdev_dma_setup(&mdrv->kms->base, 32);
 
 	return 0;
 
-- 
2.44.0


^ permalink raw reply related	[flat|nested] 78+ messages in thread

* [PATCH 23/43] drm/hisilicon/kirin: Use fbdev-dma
  2024-03-12 15:44 [PATCH 00/43] drm: Provide fbdev emulation per memory manager Thomas Zimmermann
                   ` (21 preceding siblings ...)
  2024-03-12 15:45 ` [PATCH 22/43] drm/arm/komeda: Use fbdev-dma Thomas Zimmermann
@ 2024-03-12 15:45 ` Thomas Zimmermann
  2024-03-12 15:45 ` [PATCH 24/43] drm/imx/lcdc: " Thomas Zimmermann
                   ` (19 subsequent siblings)
  42 siblings, 0 replies; 78+ messages in thread
From: Thomas Zimmermann @ 2024-03-12 15:45 UTC (permalink / raw)
  To: daniel, airlied, deller, javierm
  Cc: linux-fbdev, dri-devel, Thomas Zimmermann, Xinliang Liu,
	Tian Tao, Xinwei Kong, Sumit Semwal, Yongqin Liu, John Stultz

Implement fbdev emulation with fbdev-dma. Fbdev-dma now supports
damage handling, which is required by kirin. Avoids the overhead of
fbdev-generic's additional shadow buffering. No functional changes.

Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
Cc: Xinliang Liu <xinliang.liu@linaro.org>
Cc: Tian Tao <tiantao6@hisilicon.com>
Cc: Xinwei Kong <kong.kongxinwei@hisilicon.com>
Cc: Sumit Semwal <sumit.semwal@linaro.org>
Cc: Yongqin Liu <yongqin.liu@linaro.org>
Cc: John Stultz <jstultz@google.com>
---
 drivers/gpu/drm/hisilicon/kirin/kirin_drm_drv.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/gpu/drm/hisilicon/kirin/kirin_drm_drv.c b/drivers/gpu/drm/hisilicon/kirin/kirin_drm_drv.c
index 75292a2f46445..12666985686b9 100644
--- a/drivers/gpu/drm/hisilicon/kirin/kirin_drm_drv.c
+++ b/drivers/gpu/drm/hisilicon/kirin/kirin_drm_drv.c
@@ -19,7 +19,7 @@
 
 #include <drm/drm_atomic_helper.h>
 #include <drm/drm_drv.h>
-#include <drm/drm_fbdev_generic.h>
+#include <drm/drm_fbdev_dma.h>
 #include <drm/drm_gem_dma_helper.h>
 #include <drm/drm_gem_framebuffer_helper.h>
 #include <drm/drm_module.h>
@@ -237,7 +237,7 @@ static int kirin_drm_bind(struct device *dev)
 	if (ret)
 		goto err_kms_cleanup;
 
-	drm_fbdev_generic_setup(drm_dev, 32);
+	drm_fbdev_dma_setup(drm_dev, 32);
 
 	return 0;
 
-- 
2.44.0


^ permalink raw reply related	[flat|nested] 78+ messages in thread

* [PATCH 24/43] drm/imx/lcdc: Use fbdev-dma
  2024-03-12 15:44 [PATCH 00/43] drm: Provide fbdev emulation per memory manager Thomas Zimmermann
                   ` (22 preceding siblings ...)
  2024-03-12 15:45 ` [PATCH 23/43] drm/hisilicon/kirin: " Thomas Zimmermann
@ 2024-03-12 15:45 ` Thomas Zimmermann
  2024-03-12 15:45 ` [PATCH 25/43] drm/ingenic: " Thomas Zimmermann
                   ` (18 subsequent siblings)
  42 siblings, 0 replies; 78+ messages in thread
From: Thomas Zimmermann @ 2024-03-12 15:45 UTC (permalink / raw)
  To: daniel, airlied, deller, javierm
  Cc: linux-fbdev, dri-devel, Thomas Zimmermann, Shawn Guo,
	Sascha Hauer, Pengutronix Kernel Team, Fabio Estevam,
	NXP Linux Team

Implement fbdev emulation with fbdev-dma. Fbdev-dma now supports
damage handling, which is required by lcdc. Avoids the overhead of
fbdev-generic's additional shadow buffering. No functional changes.

Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
Cc: Shawn Guo <shawnguo@kernel.org>
Cc: Sascha Hauer <s.hauer@pengutronix.de>
Cc: Pengutronix Kernel Team <kernel@pengutronix.de>
Cc: Fabio Estevam <festevam@gmail.com>
Cc: NXP Linux Team <linux-imx@nxp.com>
---
 drivers/gpu/drm/imx/lcdc/imx-lcdc.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/gpu/drm/imx/lcdc/imx-lcdc.c b/drivers/gpu/drm/imx/lcdc/imx-lcdc.c
index 43ddf3a9810b6..36668455aee8c 100644
--- a/drivers/gpu/drm/imx/lcdc/imx-lcdc.c
+++ b/drivers/gpu/drm/imx/lcdc/imx-lcdc.c
@@ -5,7 +5,7 @@
 #include <drm/drm_bridge_connector.h>
 #include <drm/drm_damage_helper.h>
 #include <drm/drm_drv.h>
-#include <drm/drm_fbdev_generic.h>
+#include <drm/drm_fbdev_dma.h>
 #include <drm/drm_fb_dma_helper.h>
 #include <drm/drm_fourcc.h>
 #include <drm/drm_framebuffer.h>
@@ -501,7 +501,7 @@ static int imx_lcdc_probe(struct platform_device *pdev)
 	if (ret)
 		return dev_err_probe(dev, ret, "Cannot register device\n");
 
-	drm_fbdev_generic_setup(drm, 0);
+	drm_fbdev_dma_setup(drm, 0);
 
 	return 0;
 }
-- 
2.44.0


^ permalink raw reply related	[flat|nested] 78+ messages in thread

* [PATCH 25/43] drm/ingenic: Use fbdev-dma
  2024-03-12 15:44 [PATCH 00/43] drm: Provide fbdev emulation per memory manager Thomas Zimmermann
                   ` (23 preceding siblings ...)
  2024-03-12 15:45 ` [PATCH 24/43] drm/imx/lcdc: " Thomas Zimmermann
@ 2024-03-12 15:45 ` Thomas Zimmermann
  2024-03-12 15:45 ` [PATCH 26/43] drm/mediatek: " Thomas Zimmermann
                   ` (17 subsequent siblings)
  42 siblings, 0 replies; 78+ messages in thread
From: Thomas Zimmermann @ 2024-03-12 15:45 UTC (permalink / raw)
  To: daniel, airlied, deller, javierm
  Cc: linux-fbdev, dri-devel, Thomas Zimmermann, Paul Cercueil

Implement fbdev emulation with fbdev-dma. Fbdev-dma now supports
damage handling, which is required by ingenic. Avoids the overhead of
fbdev-generic's additional shadow buffering. No functional changes.

Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
Cc: Paul Cercueil <paul@crapouillou.net>
---
 drivers/gpu/drm/ingenic/ingenic-drm-drv.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/gpu/drm/ingenic/ingenic-drm-drv.c b/drivers/gpu/drm/ingenic/ingenic-drm-drv.c
index 0751235007a7e..39fa291f43dd1 100644
--- a/drivers/gpu/drm/ingenic/ingenic-drm-drv.c
+++ b/drivers/gpu/drm/ingenic/ingenic-drm-drv.c
@@ -31,7 +31,7 @@
 #include <drm/drm_encoder.h>
 #include <drm/drm_gem_dma_helper.h>
 #include <drm/drm_fb_dma_helper.h>
-#include <drm/drm_fbdev_generic.h>
+#include <drm/drm_fbdev_dma.h>
 #include <drm/drm_fourcc.h>
 #include <drm/drm_framebuffer.h>
 #include <drm/drm_gem_atomic_helper.h>
@@ -1399,7 +1399,7 @@ static int ingenic_drm_bind(struct device *dev, bool has_components)
 		goto err_clk_notifier_unregister;
 	}
 
-	drm_fbdev_generic_setup(drm, 32);
+	drm_fbdev_dma_setup(drm, 32);
 
 	return 0;
 
-- 
2.44.0


^ permalink raw reply related	[flat|nested] 78+ messages in thread

* [PATCH 26/43] drm/mediatek: Use fbdev-dma
  2024-03-12 15:44 [PATCH 00/43] drm: Provide fbdev emulation per memory manager Thomas Zimmermann
                   ` (24 preceding siblings ...)
  2024-03-12 15:45 ` [PATCH 25/43] drm/ingenic: " Thomas Zimmermann
@ 2024-03-12 15:45 ` Thomas Zimmermann
  2024-03-12 15:45 ` [PATCH 27/43] drm/panel/panel-ilitek-9341: " Thomas Zimmermann
                   ` (16 subsequent siblings)
  42 siblings, 0 replies; 78+ messages in thread
From: Thomas Zimmermann @ 2024-03-12 15:45 UTC (permalink / raw)
  To: daniel, airlied, deller, javierm
  Cc: linux-fbdev, dri-devel, Thomas Zimmermann, Chun-Kuang Hu, Philipp Zabel

Implement fbdev emulation with fbdev-dma. Fbdev-dma now supports
damage handling, which is required by ingenic. Avoids the overhead of
fbdev-generic's additional shadow buffering. No functional changes.

Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
Cc: Chun-Kuang Hu <chunkuang.hu@kernel.org>
Cc: Philipp Zabel <p.zabel@pengutronix.de>
---
 drivers/gpu/drm/mediatek/mtk_drm_drv.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/gpu/drm/mediatek/mtk_drm_drv.c b/drivers/gpu/drm/mediatek/mtk_drm_drv.c
index 74832c2130921..5dcedf0fc4467 100644
--- a/drivers/gpu/drm/mediatek/mtk_drm_drv.c
+++ b/drivers/gpu/drm/mediatek/mtk_drm_drv.c
@@ -15,7 +15,7 @@
 #include <drm/drm_atomic.h>
 #include <drm/drm_atomic_helper.h>
 #include <drm/drm_drv.h>
-#include <drm/drm_fbdev_generic.h>
+#include <drm/drm_fbdev_dma.h>
 #include <drm/drm_fourcc.h>
 #include <drm/drm_gem.h>
 #include <drm/drm_gem_framebuffer_helper.h>
@@ -644,7 +644,7 @@ static int mtk_drm_bind(struct device *dev)
 	if (ret < 0)
 		goto err_deinit;
 
-	drm_fbdev_generic_setup(drm, 32);
+	drm_fbdev_dma_setup(drm, 32);
 
 	return 0;
 
-- 
2.44.0


^ permalink raw reply related	[flat|nested] 78+ messages in thread

* [PATCH 27/43] drm/panel/panel-ilitek-9341: Use fbdev-dma
  2024-03-12 15:44 [PATCH 00/43] drm: Provide fbdev emulation per memory manager Thomas Zimmermann
                   ` (25 preceding siblings ...)
  2024-03-12 15:45 ` [PATCH 26/43] drm/mediatek: " Thomas Zimmermann
@ 2024-03-12 15:45 ` Thomas Zimmermann
  2024-03-12 15:45 ` [PATCH 28/43] drm/renesas/rcar-du: " Thomas Zimmermann
                   ` (15 subsequent siblings)
  42 siblings, 0 replies; 78+ messages in thread
From: Thomas Zimmermann @ 2024-03-12 15:45 UTC (permalink / raw)
  To: daniel, airlied, deller, javierm
  Cc: linux-fbdev, dri-devel, Thomas Zimmermann, Neil Armstrong,
	Jessica Zhang, Sam Ravnborg

Implement fbdev emulation with fbdev-dma. Fbdev-dma now supports
damage handling, which is required by panel-ilitek-9341. Avoids
the overhead of fbdev-generic's additional shadow buffering. No
functional changes.

Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
Cc: Neil Armstrong <neil.armstrong@linaro.org>
Cc: Jessica Zhang <quic_jesszhan@quicinc.com>
Cc: Sam Ravnborg <sam@ravnborg.org>
---
 drivers/gpu/drm/panel/panel-ilitek-ili9341.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/gpu/drm/panel/panel-ilitek-ili9341.c b/drivers/gpu/drm/panel/panel-ilitek-ili9341.c
index 3574681891e81..89830582b5d79 100644
--- a/drivers/gpu/drm/panel/panel-ilitek-ili9341.c
+++ b/drivers/gpu/drm/panel/panel-ilitek-ili9341.c
@@ -31,7 +31,7 @@
 
 #include <drm/drm_atomic_helper.h>
 #include <drm/drm_drv.h>
-#include <drm/drm_fbdev_generic.h>
+#include <drm/drm_fbdev_dma.h>
 #include <drm/drm_gem_atomic_helper.h>
 #include <drm/drm_gem_dma_helper.h>
 #include <drm/drm_gem_framebuffer_helper.h>
@@ -650,7 +650,7 @@ static int ili9341_dbi_probe(struct spi_device *spi, struct gpio_desc *dc,
 
 	spi_set_drvdata(spi, drm);
 
-	drm_fbdev_generic_setup(drm, 0);
+	drm_fbdev_dma_setup(drm, 0);
 
 	return 0;
 }
-- 
2.44.0


^ permalink raw reply related	[flat|nested] 78+ messages in thread

* [PATCH 28/43] drm/renesas/rcar-du: Use fbdev-dma
  2024-03-12 15:44 [PATCH 00/43] drm: Provide fbdev emulation per memory manager Thomas Zimmermann
                   ` (26 preceding siblings ...)
  2024-03-12 15:45 ` [PATCH 27/43] drm/panel/panel-ilitek-9341: " Thomas Zimmermann
@ 2024-03-12 15:45 ` Thomas Zimmermann
  2024-03-12 15:45 ` [PATCH 29/43] drm/renesas/rz-du: " Thomas Zimmermann
                   ` (14 subsequent siblings)
  42 siblings, 0 replies; 78+ messages in thread
From: Thomas Zimmermann @ 2024-03-12 15:45 UTC (permalink / raw)
  To: daniel, airlied, deller, javierm
  Cc: linux-fbdev, dri-devel, Thomas Zimmermann, Laurent Pinchart,
	Kieran Bingham

Implement fbdev emulation with fbdev-dma. Fbdev-dma now supports
damage handling, which is required by rcar-du. Avoids the overhead of
fbdev-generic's additional shadow buffering. No functional changes.

Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
Cc: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Cc: Kieran Bingham <kieran.bingham+renesas@ideasonboard.com>
---
 drivers/gpu/drm/renesas/rcar-du/rcar_du_drv.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/gpu/drm/renesas/rcar-du/rcar_du_drv.c b/drivers/gpu/drm/renesas/rcar-du/rcar_du_drv.c
index dee530e4c8b27..fb719d9aff10d 100644
--- a/drivers/gpu/drm/renesas/rcar-du/rcar_du_drv.c
+++ b/drivers/gpu/drm/renesas/rcar-du/rcar_du_drv.c
@@ -20,7 +20,7 @@
 
 #include <drm/drm_atomic_helper.h>
 #include <drm/drm_drv.h>
-#include <drm/drm_fbdev_generic.h>
+#include <drm/drm_fbdev_dma.h>
 #include <drm/drm_gem_dma_helper.h>
 #include <drm/drm_managed.h>
 #include <drm/drm_probe_helper.h>
@@ -716,7 +716,7 @@ static int rcar_du_probe(struct platform_device *pdev)
 
 	drm_info(&rcdu->ddev, "Device %s probed\n", dev_name(&pdev->dev));
 
-	drm_fbdev_generic_setup(&rcdu->ddev, 32);
+	drm_fbdev_dma_setup(&rcdu->ddev, 32);
 
 	return 0;
 
-- 
2.44.0


^ permalink raw reply related	[flat|nested] 78+ messages in thread

* [PATCH 29/43] drm/renesas/rz-du: Use fbdev-dma
  2024-03-12 15:44 [PATCH 00/43] drm: Provide fbdev emulation per memory manager Thomas Zimmermann
                   ` (27 preceding siblings ...)
  2024-03-12 15:45 ` [PATCH 28/43] drm/renesas/rcar-du: " Thomas Zimmermann
@ 2024-03-12 15:45 ` Thomas Zimmermann
  2024-03-12 19:14   ` Biju Das
  2024-03-12 15:45 ` [PATCH 30/43] drm/renesas/shmobile: " Thomas Zimmermann
                   ` (13 subsequent siblings)
  42 siblings, 1 reply; 78+ messages in thread
From: Thomas Zimmermann @ 2024-03-12 15:45 UTC (permalink / raw)
  To: daniel, airlied, deller, javierm
  Cc: linux-fbdev, dri-devel, Thomas Zimmermann, Biju Das

Implement fbdev emulation with fbdev-dma. Fbdev-dma now supports
damage handling, which is required by rz-du. Avoids the overhead of
fbdev-generic's additional shadow buffering. No functional changes.

Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
Cc: Biju Das <biju.das.jz@bp.renesas.com>
---
 drivers/gpu/drm/renesas/rz-du/rzg2l_du_drv.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/gpu/drm/renesas/rz-du/rzg2l_du_drv.c b/drivers/gpu/drm/renesas/rz-du/rzg2l_du_drv.c
index 470d34da1d6c4..e5eca8691a331 100644
--- a/drivers/gpu/drm/renesas/rz-du/rzg2l_du_drv.c
+++ b/drivers/gpu/drm/renesas/rz-du/rzg2l_du_drv.c
@@ -14,7 +14,7 @@
 
 #include <drm/drm_atomic_helper.h>
 #include <drm/drm_drv.h>
-#include <drm/drm_fbdev_generic.h>
+#include <drm/drm_fbdev_dma.h>
 #include <drm/drm_gem_dma_helper.h>
 #include <drm/drm_probe_helper.h>
 
@@ -149,7 +149,7 @@ static int rzg2l_du_probe(struct platform_device *pdev)
 
 	drm_info(&rcdu->ddev, "Device %s probed\n", dev_name(&pdev->dev));
 
-	drm_fbdev_generic_setup(&rcdu->ddev, 32);
+	drm_fbdev_dma_setup(&rcdu->ddev, 32);
 
 	return 0;
 
-- 
2.44.0


^ permalink raw reply related	[flat|nested] 78+ messages in thread

* [PATCH 30/43] drm/renesas/shmobile: Use fbdev-dma
  2024-03-12 15:44 [PATCH 00/43] drm: Provide fbdev emulation per memory manager Thomas Zimmermann
                   ` (28 preceding siblings ...)
  2024-03-12 15:45 ` [PATCH 29/43] drm/renesas/rz-du: " Thomas Zimmermann
@ 2024-03-12 15:45 ` Thomas Zimmermann
  2024-03-12 15:45 ` [PATCH 31/43] drm/rockchip: " Thomas Zimmermann
                   ` (12 subsequent siblings)
  42 siblings, 0 replies; 78+ messages in thread
From: Thomas Zimmermann @ 2024-03-12 15:45 UTC (permalink / raw)
  To: daniel, airlied, deller, javierm
  Cc: linux-fbdev, dri-devel, Thomas Zimmermann, Laurent Pinchart,
	Geert Uytterhoeven

Implement fbdev emulation with fbdev-dma. Fbdev-dma now supports
damage handling, which is required by shmobile. Avoids the overhead of
fbdev-generic's additional shadow buffering. No functional changes.

Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
Cc: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Cc: Geert Uytterhoeven <geert+renesas@glider.be>
---
 drivers/gpu/drm/renesas/shmobile/shmob_drm_drv.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/gpu/drm/renesas/shmobile/shmob_drm_drv.c b/drivers/gpu/drm/renesas/shmobile/shmob_drm_drv.c
index e83c3e52251de..890cc2f6408d6 100644
--- a/drivers/gpu/drm/renesas/shmobile/shmob_drm_drv.c
+++ b/drivers/gpu/drm/renesas/shmobile/shmob_drm_drv.c
@@ -19,7 +19,7 @@
 
 #include <drm/drm_atomic_helper.h>
 #include <drm/drm_drv.h>
-#include <drm/drm_fbdev_generic.h>
+#include <drm/drm_fbdev_dma.h>
 #include <drm/drm_gem_dma_helper.h>
 #include <drm/drm_modeset_helper.h>
 #include <drm/drm_module.h>
@@ -250,7 +250,7 @@ static int shmob_drm_probe(struct platform_device *pdev)
 	if (ret < 0)
 		goto err_modeset_cleanup;
 
-	drm_fbdev_generic_setup(ddev, 16);
+	drm_fbdev_dma_setup(ddev, 16);
 
 	return 0;
 
-- 
2.44.0


^ permalink raw reply related	[flat|nested] 78+ messages in thread

* [PATCH 31/43] drm/rockchip: Use fbdev-dma
  2024-03-12 15:44 [PATCH 00/43] drm: Provide fbdev emulation per memory manager Thomas Zimmermann
                   ` (29 preceding siblings ...)
  2024-03-12 15:45 ` [PATCH 30/43] drm/renesas/shmobile: " Thomas Zimmermann
@ 2024-03-12 15:45 ` Thomas Zimmermann
  2024-03-12 15:45 ` [PATCH 32/43] drm/tiny/hx8357d: " Thomas Zimmermann
                   ` (11 subsequent siblings)
  42 siblings, 0 replies; 78+ messages in thread
From: Thomas Zimmermann @ 2024-03-12 15:45 UTC (permalink / raw)
  To: daniel, airlied, deller, javierm
  Cc: linux-fbdev, dri-devel, Thomas Zimmermann, Sandy Huang,
	Heiko Stübner, Andy Yan

Implement fbdev emulation with fbdev-dma. Fbdev-dma now supports
damage handling, which is required by rockchip. Avoids the overhead of
fbdev-generic's additional shadow buffering. No functional changes.

Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
Cc: Sandy Huang <hjc@rock-chips.com>
Cc: "Heiko Stübner" <heiko@sntech.de>
Cc: Andy Yan <andy.yan@rock-chips.com>
---
 drivers/gpu/drm/rockchip/rockchip_drm_drv.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/gpu/drm/rockchip/rockchip_drm_drv.c b/drivers/gpu/drm/rockchip/rockchip_drm_drv.c
index ab55d71325500..44d769d9234d6 100644
--- a/drivers/gpu/drm/rockchip/rockchip_drm_drv.c
+++ b/drivers/gpu/drm/rockchip/rockchip_drm_drv.c
@@ -18,7 +18,7 @@
 
 #include <drm/drm_aperture.h>
 #include <drm/drm_drv.h>
-#include <drm/drm_fbdev_generic.h>
+#include <drm/drm_fbdev_dma.h>
 #include <drm/drm_gem_dma_helper.h>
 #include <drm/drm_of.h>
 #include <drm/drm_probe_helper.h>
@@ -191,7 +191,7 @@ static int rockchip_drm_bind(struct device *dev)
 	if (ret)
 		goto err_kms_helper_poll_fini;
 
-	drm_fbdev_generic_setup(drm_dev, 0);
+	drm_fbdev_dma_setup(drm_dev, 0);
 
 	return 0;
 err_kms_helper_poll_fini:
-- 
2.44.0


^ permalink raw reply related	[flat|nested] 78+ messages in thread

* [PATCH 32/43] drm/tiny/hx8357d: Use fbdev-dma
  2024-03-12 15:44 [PATCH 00/43] drm: Provide fbdev emulation per memory manager Thomas Zimmermann
                   ` (30 preceding siblings ...)
  2024-03-12 15:45 ` [PATCH 31/43] drm/rockchip: " Thomas Zimmermann
@ 2024-03-12 15:45 ` Thomas Zimmermann
  2024-03-12 15:45 ` [PATCH 33/43] drm/tiny/ili9163: " Thomas Zimmermann
                   ` (10 subsequent siblings)
  42 siblings, 0 replies; 78+ messages in thread
From: Thomas Zimmermann @ 2024-03-12 15:45 UTC (permalink / raw)
  To: daniel, airlied, deller, javierm
  Cc: linux-fbdev, dri-devel, Thomas Zimmermann

Implement fbdev emulation with fbdev-dma. Fbdev-dma now supports
damage handling, which is required by hx8357d. Avoids the overhead of
fbdev-generic's additional shadow buffering. No functional changes.

Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
---
 drivers/gpu/drm/tiny/hx8357d.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/gpu/drm/tiny/hx8357d.c b/drivers/gpu/drm/tiny/hx8357d.c
index cdc4486e059b5..2e631282edeb4 100644
--- a/drivers/gpu/drm/tiny/hx8357d.c
+++ b/drivers/gpu/drm/tiny/hx8357d.c
@@ -18,7 +18,7 @@
 
 #include <drm/drm_atomic_helper.h>
 #include <drm/drm_drv.h>
-#include <drm/drm_fbdev_generic.h>
+#include <drm/drm_fbdev_dma.h>
 #include <drm/drm_gem_atomic_helper.h>
 #include <drm/drm_gem_dma_helper.h>
 #include <drm/drm_managed.h>
@@ -256,7 +256,7 @@ static int hx8357d_probe(struct spi_device *spi)
 
 	spi_set_drvdata(spi, drm);
 
-	drm_fbdev_generic_setup(drm, 0);
+	drm_fbdev_dma_setup(drm, 0);
 
 	return 0;
 }
-- 
2.44.0


^ permalink raw reply related	[flat|nested] 78+ messages in thread

* [PATCH 33/43] drm/tiny/ili9163: Use fbdev-dma
  2024-03-12 15:44 [PATCH 00/43] drm: Provide fbdev emulation per memory manager Thomas Zimmermann
                   ` (31 preceding siblings ...)
  2024-03-12 15:45 ` [PATCH 32/43] drm/tiny/hx8357d: " Thomas Zimmermann
@ 2024-03-12 15:45 ` Thomas Zimmermann
  2024-03-12 15:45 ` [PATCH 34/43] drm/tiny/ili9225: " Thomas Zimmermann
                   ` (9 subsequent siblings)
  42 siblings, 0 replies; 78+ messages in thread
From: Thomas Zimmermann @ 2024-03-12 15:45 UTC (permalink / raw)
  To: daniel, airlied, deller, javierm
  Cc: linux-fbdev, dri-devel, Thomas Zimmermann

Implement fbdev emulation with fbdev-dma. Fbdev-dma now supports
damage handling, which is required by ili9163. Avoids the overhead of
fbdev-generic's additional shadow buffering. No functional changes.

Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
---
 drivers/gpu/drm/tiny/ili9163.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/gpu/drm/tiny/ili9163.c b/drivers/gpu/drm/tiny/ili9163.c
index bc4384d410fcc..86f9d88349015 100644
--- a/drivers/gpu/drm/tiny/ili9163.c
+++ b/drivers/gpu/drm/tiny/ili9163.c
@@ -9,7 +9,7 @@
 
 #include <drm/drm_atomic_helper.h>
 #include <drm/drm_drv.h>
-#include <drm/drm_fbdev_generic.h>
+#include <drm/drm_fbdev_dma.h>
 #include <drm/drm_gem_atomic_helper.h>
 #include <drm/drm_gem_dma_helper.h>
 #include <drm/drm_mipi_dbi.h>
@@ -185,7 +185,7 @@ static int ili9163_probe(struct spi_device *spi)
 	if (ret)
 		return ret;
 
-	drm_fbdev_generic_setup(drm, 0);
+	drm_fbdev_dma_setup(drm, 0);
 
 	return 0;
 }
-- 
2.44.0


^ permalink raw reply related	[flat|nested] 78+ messages in thread

* [PATCH 34/43] drm/tiny/ili9225: Use fbdev-dma
  2024-03-12 15:44 [PATCH 00/43] drm: Provide fbdev emulation per memory manager Thomas Zimmermann
                   ` (32 preceding siblings ...)
  2024-03-12 15:45 ` [PATCH 33/43] drm/tiny/ili9163: " Thomas Zimmermann
@ 2024-03-12 15:45 ` Thomas Zimmermann
  2024-03-12 22:20   ` David Lechner
  2024-03-12 15:45 ` [PATCH 35/43] drm/tiny/ili9341: " Thomas Zimmermann
                   ` (8 subsequent siblings)
  42 siblings, 1 reply; 78+ messages in thread
From: Thomas Zimmermann @ 2024-03-12 15:45 UTC (permalink / raw)
  To: daniel, airlied, deller, javierm
  Cc: linux-fbdev, dri-devel, Thomas Zimmermann, David Lechner

Implement fbdev emulation with fbdev-dma. Fbdev-dma now supports
damage handling, which is required by ili9225. Avoids the overhead of
fbdev-generic's additional shadow buffering. No functional changes.

Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
Cc: David Lechner <david@lechnology.com>
---
 drivers/gpu/drm/tiny/ili9225.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/gpu/drm/tiny/ili9225.c b/drivers/gpu/drm/tiny/ili9225.c
index dd8b0a181be94..537df5f5b8a6e 100644
--- a/drivers/gpu/drm/tiny/ili9225.c
+++ b/drivers/gpu/drm/tiny/ili9225.c
@@ -20,7 +20,7 @@
 #include <drm/drm_damage_helper.h>
 #include <drm/drm_drv.h>
 #include <drm/drm_fb_dma_helper.h>
-#include <drm/drm_fbdev_generic.h>
+#include <drm/drm_fbdev_dma.h>
 #include <drm/drm_fourcc.h>
 #include <drm/drm_framebuffer.h>
 #include <drm/drm_gem_atomic_helper.h>
@@ -426,7 +426,7 @@ static int ili9225_probe(struct spi_device *spi)
 
 	spi_set_drvdata(spi, drm);
 
-	drm_fbdev_generic_setup(drm, 0);
+	drm_fbdev_dma_setup(drm, 0);
 
 	return 0;
 }
-- 
2.44.0


^ permalink raw reply related	[flat|nested] 78+ messages in thread

* [PATCH 35/43] drm/tiny/ili9341: Use fbdev-dma
  2024-03-12 15:44 [PATCH 00/43] drm: Provide fbdev emulation per memory manager Thomas Zimmermann
                   ` (33 preceding siblings ...)
  2024-03-12 15:45 ` [PATCH 34/43] drm/tiny/ili9225: " Thomas Zimmermann
@ 2024-03-12 15:45 ` Thomas Zimmermann
  2024-03-12 15:45 ` [PATCH 36/43] drm/tiny/ili9486: " Thomas Zimmermann
                   ` (7 subsequent siblings)
  42 siblings, 0 replies; 78+ messages in thread
From: Thomas Zimmermann @ 2024-03-12 15:45 UTC (permalink / raw)
  To: daniel, airlied, deller, javierm
  Cc: linux-fbdev, dri-devel, Thomas Zimmermann, Kamlesh Gurudasani

Implement fbdev emulation with fbdev-dma. Fbdev-dma now supports
damage handling, which is required by ili9341. Avoids the overhead of
fbdev-generic's additional shadow buffering. No functional changes.

Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
Cc: Kamlesh Gurudasani <kamlesh.gurudasani@gmail.com>
---
 drivers/gpu/drm/tiny/ili9341.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/gpu/drm/tiny/ili9341.c b/drivers/gpu/drm/tiny/ili9341.c
index 47b61c3bf1457..8bcada30af717 100644
--- a/drivers/gpu/drm/tiny/ili9341.c
+++ b/drivers/gpu/drm/tiny/ili9341.c
@@ -17,7 +17,7 @@
 
 #include <drm/drm_atomic_helper.h>
 #include <drm/drm_drv.h>
-#include <drm/drm_fbdev_generic.h>
+#include <drm/drm_fbdev_dma.h>
 #include <drm/drm_gem_atomic_helper.h>
 #include <drm/drm_gem_dma_helper.h>
 #include <drm/drm_managed.h>
@@ -218,7 +218,7 @@ static int ili9341_probe(struct spi_device *spi)
 
 	spi_set_drvdata(spi, drm);
 
-	drm_fbdev_generic_setup(drm, 0);
+	drm_fbdev_dma_setup(drm, 0);
 
 	return 0;
 }
-- 
2.44.0


^ permalink raw reply related	[flat|nested] 78+ messages in thread

* [PATCH 36/43] drm/tiny/ili9486: Use fbdev-dma
  2024-03-12 15:44 [PATCH 00/43] drm: Provide fbdev emulation per memory manager Thomas Zimmermann
                   ` (34 preceding siblings ...)
  2024-03-12 15:45 ` [PATCH 35/43] drm/tiny/ili9341: " Thomas Zimmermann
@ 2024-03-12 15:45 ` Thomas Zimmermann
  2024-03-12 15:45 ` [PATCH 37/43] drm/tiny/mi0283qt: " Thomas Zimmermann
                   ` (6 subsequent siblings)
  42 siblings, 0 replies; 78+ messages in thread
From: Thomas Zimmermann @ 2024-03-12 15:45 UTC (permalink / raw)
  To: daniel, airlied, deller, javierm
  Cc: linux-fbdev, dri-devel, Thomas Zimmermann

Implement fbdev emulation with fbdev-dma. Fbdev-dma now supports
damage handling, which is required by ili9486. Avoids the overhead of
fbdev-generic's additional shadow buffering. No functional changes.

Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
---
 drivers/gpu/drm/tiny/ili9486.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/gpu/drm/tiny/ili9486.c b/drivers/gpu/drm/tiny/ili9486.c
index 938bceed59998..70d3662600410 100644
--- a/drivers/gpu/drm/tiny/ili9486.c
+++ b/drivers/gpu/drm/tiny/ili9486.c
@@ -16,7 +16,7 @@
 
 #include <drm/drm_atomic_helper.h>
 #include <drm/drm_drv.h>
-#include <drm/drm_fbdev_generic.h>
+#include <drm/drm_fbdev_dma.h>
 #include <drm/drm_gem_atomic_helper.h>
 #include <drm/drm_gem_dma_helper.h>
 #include <drm/drm_managed.h>
@@ -247,7 +247,7 @@ static int ili9486_probe(struct spi_device *spi)
 
 	spi_set_drvdata(spi, drm);
 
-	drm_fbdev_generic_setup(drm, 0);
+	drm_fbdev_dma_setup(drm, 0);
 
 	return 0;
 }
-- 
2.44.0


^ permalink raw reply related	[flat|nested] 78+ messages in thread

* [PATCH 37/43] drm/tiny/mi0283qt: Use fbdev-dma
  2024-03-12 15:44 [PATCH 00/43] drm: Provide fbdev emulation per memory manager Thomas Zimmermann
                   ` (35 preceding siblings ...)
  2024-03-12 15:45 ` [PATCH 36/43] drm/tiny/ili9486: " Thomas Zimmermann
@ 2024-03-12 15:45 ` Thomas Zimmermann
  2024-03-17 19:21   ` Noralf Trønnes
  2024-03-12 15:45 ` [PATCH 38/43] drm/tiny/panel-mipi-dbi: " Thomas Zimmermann
                   ` (5 subsequent siblings)
  42 siblings, 1 reply; 78+ messages in thread
From: Thomas Zimmermann @ 2024-03-12 15:45 UTC (permalink / raw)
  To: daniel, airlied, deller, javierm
  Cc: linux-fbdev, dri-devel, Thomas Zimmermann, Noralf Trønnes

Implement fbdev emulation with fbdev-dma. Fbdev-dma now supports
damage handling, which is required by mi0283qt. Avoids the overhead of
fbdev-generic's additional shadow buffering. No functional changes.

Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
Cc: "Noralf Trønnes" <noralf@tronnes.org>
---
 drivers/gpu/drm/tiny/mi0283qt.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/gpu/drm/tiny/mi0283qt.c b/drivers/gpu/drm/tiny/mi0283qt.c
index 01ff43c8ac3ff..e46581d74c257 100644
--- a/drivers/gpu/drm/tiny/mi0283qt.c
+++ b/drivers/gpu/drm/tiny/mi0283qt.c
@@ -15,7 +15,7 @@
 
 #include <drm/drm_atomic_helper.h>
 #include <drm/drm_drv.h>
-#include <drm/drm_fbdev_generic.h>
+#include <drm/drm_fbdev_dma.h>
 #include <drm/drm_gem_atomic_helper.h>
 #include <drm/drm_gem_dma_helper.h>
 #include <drm/drm_managed.h>
@@ -226,7 +226,7 @@ static int mi0283qt_probe(struct spi_device *spi)
 
 	spi_set_drvdata(spi, drm);
 
-	drm_fbdev_generic_setup(drm, 0);
+	drm_fbdev_dma_setup(drm, 0);
 
 	return 0;
 }
-- 
2.44.0


^ permalink raw reply related	[flat|nested] 78+ messages in thread

* [PATCH 38/43] drm/tiny/panel-mipi-dbi: Use fbdev-dma
  2024-03-12 15:44 [PATCH 00/43] drm: Provide fbdev emulation per memory manager Thomas Zimmermann
                   ` (36 preceding siblings ...)
  2024-03-12 15:45 ` [PATCH 37/43] drm/tiny/mi0283qt: " Thomas Zimmermann
@ 2024-03-12 15:45 ` Thomas Zimmermann
  2024-03-17 19:22   ` Noralf Trønnes
  2024-03-12 15:45 ` [PATCH 39/43] drm/tiny/repaper: " Thomas Zimmermann
                   ` (4 subsequent siblings)
  42 siblings, 1 reply; 78+ messages in thread
From: Thomas Zimmermann @ 2024-03-12 15:45 UTC (permalink / raw)
  To: daniel, airlied, deller, javierm
  Cc: linux-fbdev, dri-devel, Thomas Zimmermann, Noralf Trønnes

Implement fbdev emulation with fbdev-dma. Fbdev-dma now supports
damage handling, which is required by panel-mipi-dbi. Avoids the
overhead of fbdev-generic's additional shadow buffering. No functional
changes.

Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
Cc: "Noralf Trønnes" <noralf@tronnes.org>
---
 drivers/gpu/drm/tiny/panel-mipi-dbi.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/gpu/drm/tiny/panel-mipi-dbi.c b/drivers/gpu/drm/tiny/panel-mipi-dbi.c
index f80a141fcf365..4cc4ca787c7d1 100644
--- a/drivers/gpu/drm/tiny/panel-mipi-dbi.c
+++ b/drivers/gpu/drm/tiny/panel-mipi-dbi.c
@@ -16,7 +16,7 @@
 
 #include <drm/drm_atomic_helper.h>
 #include <drm/drm_drv.h>
-#include <drm/drm_fbdev_generic.h>
+#include <drm/drm_fbdev_dma.h>
 #include <drm/drm_gem_atomic_helper.h>
 #include <drm/drm_gem_dma_helper.h>
 #include <drm/drm_managed.h>
@@ -335,7 +335,7 @@ static int panel_mipi_dbi_spi_probe(struct spi_device *spi)
 
 	spi_set_drvdata(spi, drm);
 
-	drm_fbdev_generic_setup(drm, 0);
+	drm_fbdev_dma_setup(drm, 0);
 
 	return 0;
 }
-- 
2.44.0


^ permalink raw reply related	[flat|nested] 78+ messages in thread

* [PATCH 39/43] drm/tiny/repaper: Use fbdev-dma
  2024-03-12 15:44 [PATCH 00/43] drm: Provide fbdev emulation per memory manager Thomas Zimmermann
                   ` (37 preceding siblings ...)
  2024-03-12 15:45 ` [PATCH 38/43] drm/tiny/panel-mipi-dbi: " Thomas Zimmermann
@ 2024-03-12 15:45 ` Thomas Zimmermann
  2024-03-17 19:22   ` Noralf Trønnes
  2024-03-12 15:45 ` [PATCH 40/43] drm/tiny/st7586: " Thomas Zimmermann
                   ` (3 subsequent siblings)
  42 siblings, 1 reply; 78+ messages in thread
From: Thomas Zimmermann @ 2024-03-12 15:45 UTC (permalink / raw)
  To: daniel, airlied, deller, javierm
  Cc: linux-fbdev, dri-devel, Thomas Zimmermann, Noralf Trønnes

Implement fbdev emulation with fbdev-dma. Fbdev-dma now supports
damage handling, which is required by repaper. Avoids the overhead of
fbdev-generic's additional shadow buffering. No functional changes.

Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
Cc: "Noralf Trønnes" <noralf@tronnes.org>
---
 drivers/gpu/drm/tiny/repaper.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/gpu/drm/tiny/repaper.c b/drivers/gpu/drm/tiny/repaper.c
index 8fd6758f5725f..1f78aa3d26bbd 100644
--- a/drivers/gpu/drm/tiny/repaper.c
+++ b/drivers/gpu/drm/tiny/repaper.c
@@ -26,7 +26,7 @@
 #include <drm/drm_damage_helper.h>
 #include <drm/drm_drv.h>
 #include <drm/drm_fb_dma_helper.h>
-#include <drm/drm_fbdev_generic.h>
+#include <drm/drm_fbdev_dma.h>
 #include <drm/drm_format_helper.h>
 #include <drm/drm_framebuffer.h>
 #include <drm/drm_gem_atomic_helper.h>
@@ -1118,7 +1118,7 @@ static int repaper_probe(struct spi_device *spi)
 
 	DRM_DEBUG_DRIVER("SPI speed: %uMHz\n", spi->max_speed_hz / 1000000);
 
-	drm_fbdev_generic_setup(drm, 0);
+	drm_fbdev_dma_setup(drm, 0);
 
 	return 0;
 }
-- 
2.44.0


^ permalink raw reply related	[flat|nested] 78+ messages in thread

* [PATCH 40/43] drm/tiny/st7586: Use fbdev-dma
  2024-03-12 15:44 [PATCH 00/43] drm: Provide fbdev emulation per memory manager Thomas Zimmermann
                   ` (38 preceding siblings ...)
  2024-03-12 15:45 ` [PATCH 39/43] drm/tiny/repaper: " Thomas Zimmermann
@ 2024-03-12 15:45 ` Thomas Zimmermann
  2024-03-12 22:21   ` David Lechner
  2024-03-12 15:45 ` [PATCH 41/43] drm/tiny/st7735r: " Thomas Zimmermann
                   ` (2 subsequent siblings)
  42 siblings, 1 reply; 78+ messages in thread
From: Thomas Zimmermann @ 2024-03-12 15:45 UTC (permalink / raw)
  To: daniel, airlied, deller, javierm
  Cc: linux-fbdev, dri-devel, Thomas Zimmermann, David Lechner

Implement fbdev emulation with fbdev-dma. Fbdev-dma now supports
damage handling, which is required by st7586. Avoids the overhead of
fbdev-generic's additional shadow buffering. No functional changes.

Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
Cc: David Lechner <david@lechnology.com>
---
 drivers/gpu/drm/tiny/st7586.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/gpu/drm/tiny/st7586.c b/drivers/gpu/drm/tiny/st7586.c
index 7336fa1ddaed1..9e080d3b084c5 100644
--- a/drivers/gpu/drm/tiny/st7586.c
+++ b/drivers/gpu/drm/tiny/st7586.c
@@ -16,7 +16,7 @@
 #include <drm/drm_damage_helper.h>
 #include <drm/drm_drv.h>
 #include <drm/drm_fb_dma_helper.h>
-#include <drm/drm_fbdev_generic.h>
+#include <drm/drm_fbdev_dma.h>
 #include <drm/drm_format_helper.h>
 #include <drm/drm_framebuffer.h>
 #include <drm/drm_gem_atomic_helper.h>
@@ -371,7 +371,7 @@ static int st7586_probe(struct spi_device *spi)
 
 	spi_set_drvdata(spi, drm);
 
-	drm_fbdev_generic_setup(drm, 0);
+	drm_fbdev_dma_setup(drm, 0);
 
 	return 0;
 }
-- 
2.44.0


^ permalink raw reply related	[flat|nested] 78+ messages in thread

* [PATCH 41/43] drm/tiny/st7735r: Use fbdev-dma
  2024-03-12 15:44 [PATCH 00/43] drm: Provide fbdev emulation per memory manager Thomas Zimmermann
                   ` (39 preceding siblings ...)
  2024-03-12 15:45 ` [PATCH 40/43] drm/tiny/st7586: " Thomas Zimmermann
@ 2024-03-12 15:45 ` Thomas Zimmermann
  2024-03-12 22:21   ` David Lechner
  2024-03-12 15:45 ` [PATCH 42/43] drm/fbdev-generic: Convert to fbdev-ttm Thomas Zimmermann
  2024-03-12 15:45 ` [PATCH 43/43] drm/fbdev: Clean up fbdev documentation Thomas Zimmermann
  42 siblings, 1 reply; 78+ messages in thread
From: Thomas Zimmermann @ 2024-03-12 15:45 UTC (permalink / raw)
  To: daniel, airlied, deller, javierm
  Cc: linux-fbdev, dri-devel, Thomas Zimmermann, David Lechner

Implement fbdev emulation with fbdev-dma. Fbdev-dma now supports
damage handling, which is required by st7735r. Avoids the overhead of
fbdev-generic's additional shadow buffering. No functional changes.

Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
Cc: David Lechner <david@lechnology.com>
---
 drivers/gpu/drm/tiny/st7735r.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/gpu/drm/tiny/st7735r.c b/drivers/gpu/drm/tiny/st7735r.c
index 477eb36fbb70d..1676da00883d3 100644
--- a/drivers/gpu/drm/tiny/st7735r.c
+++ b/drivers/gpu/drm/tiny/st7735r.c
@@ -18,7 +18,7 @@
 
 #include <drm/drm_atomic_helper.h>
 #include <drm/drm_drv.h>
-#include <drm/drm_fbdev_generic.h>
+#include <drm/drm_fbdev_dma.h>
 #include <drm/drm_gem_atomic_helper.h>
 #include <drm/drm_gem_dma_helper.h>
 #include <drm/drm_managed.h>
@@ -241,7 +241,7 @@ static int st7735r_probe(struct spi_device *spi)
 
 	spi_set_drvdata(spi, drm);
 
-	drm_fbdev_generic_setup(drm, 0);
+	drm_fbdev_dma_setup(drm, 0);
 
 	return 0;
 }
-- 
2.44.0


^ permalink raw reply related	[flat|nested] 78+ messages in thread

* [PATCH 42/43] drm/fbdev-generic: Convert to fbdev-ttm
  2024-03-12 15:44 [PATCH 00/43] drm: Provide fbdev emulation per memory manager Thomas Zimmermann
                   ` (40 preceding siblings ...)
  2024-03-12 15:45 ` [PATCH 41/43] drm/tiny/st7735r: " Thomas Zimmermann
@ 2024-03-12 15:45 ` Thomas Zimmermann
  2024-03-12 15:45 ` [PATCH 43/43] drm/fbdev: Clean up fbdev documentation Thomas Zimmermann
  42 siblings, 0 replies; 78+ messages in thread
From: Thomas Zimmermann @ 2024-03-12 15:45 UTC (permalink / raw)
  To: daniel, airlied, deller, javierm
  Cc: linux-fbdev, dri-devel, Thomas Zimmermann

Only TTM-based drivers use fbdev-generic. Rename it to fbdev-ttm and
change the symbol infix from _generic_ to _ttm_. Link the source file
into TTM helpers, so that it is only build if TTM-based drivers have
been selected. Select DRM_TTM_HELPER for loongson.

Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
---
 Documentation/gpu/drm-kms-helpers.rst         |  2 +-
 drivers/gpu/drm/Makefile                      |  5 +-
 drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c       |  6 +-
 .../{drm_fbdev_generic.c => drm_fbdev_ttm.c}  | 80 +++++++++----------
 .../gpu/drm/hisilicon/hibmc/hibmc_drm_drv.c   |  4 +-
 drivers/gpu/drm/loongson/Kconfig              |  1 +
 drivers/gpu/drm/loongson/lsdc_drv.c           |  4 +-
 drivers/gpu/drm/nouveau/nouveau_drm.c         |  6 +-
 drivers/gpu/drm/qxl/qxl_drv.c                 |  4 +-
 drivers/gpu/drm/tiny/bochs.c                  |  4 +-
 drivers/gpu/drm/vboxvideo/vbox_drv.c          |  4 +-
 drivers/gpu/drm/vmwgfx/vmwgfx_drv.c           |  4 +-
 include/drm/drm_fbdev_generic.h               | 15 ----
 include/drm/drm_fbdev_ttm.h                   | 15 ++++
 14 files changed, 77 insertions(+), 77 deletions(-)
 rename drivers/gpu/drm/{drm_fbdev_generic.c => drm_fbdev_ttm.c} (76%)
 delete mode 100644 include/drm/drm_fbdev_generic.h
 create mode 100644 include/drm/drm_fbdev_ttm.h

diff --git a/Documentation/gpu/drm-kms-helpers.rst b/Documentation/gpu/drm-kms-helpers.rst
index 59cfe8a7a8bac..e46ab9b670acd 100644
--- a/Documentation/gpu/drm-kms-helpers.rst
+++ b/Documentation/gpu/drm-kms-helpers.rst
@@ -116,7 +116,7 @@ fbdev Helper Functions Reference
 .. kernel-doc:: drivers/gpu/drm/drm_fb_helper.c
    :export:
 
-.. kernel-doc:: drivers/gpu/drm/drm_fbdev_generic.c
+.. kernel-doc:: drivers/gpu/drm/drm_fbdev_ttm.c
    :export:
 
 format Helper Functions Reference
diff --git a/drivers/gpu/drm/Makefile b/drivers/gpu/drm/Makefile
index 50a2f0cffdac2..7bd4c525fd825 100644
--- a/drivers/gpu/drm/Makefile
+++ b/drivers/gpu/drm/Makefile
@@ -117,6 +117,7 @@ drm_vram_helper-y := drm_gem_vram_helper.o
 obj-$(CONFIG_DRM_VRAM_HELPER) += drm_vram_helper.o
 
 drm_ttm_helper-y := drm_gem_ttm_helper.o
+drm_ttm_helper-$(CONFIG_DRM_FBDEV_EMULATION) += drm_fbdev_ttm.o
 obj-$(CONFIG_DRM_TTM_HELPER) += drm_ttm_helper.o
 
 #
@@ -142,9 +143,7 @@ drm_kms_helper-y := \
 	drm_self_refresh_helper.o \
 	drm_simple_kms_helper.o
 drm_kms_helper-$(CONFIG_DRM_PANEL_BRIDGE) += bridge/panel.o
-drm_kms_helper-$(CONFIG_DRM_FBDEV_EMULATION) += \
-	drm_fbdev_generic.o \
-	drm_fb_helper.o
+drm_kms_helper-$(CONFIG_DRM_FBDEV_EMULATION) += drm_fb_helper.o
 obj-$(CONFIG_DRM_KMS_HELPER) += drm_kms_helper.o
 
 #
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c
index 6acffedf648c8..e13c03d29c162 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c
@@ -24,7 +24,7 @@
 
 #include <drm/amdgpu_drm.h>
 #include <drm/drm_drv.h>
-#include <drm/drm_fbdev_generic.h>
+#include <drm/drm_fbdev_ttm.h>
 #include <drm/drm_gem.h>
 #include <drm/drm_managed.h>
 #include <drm/drm_pciids.h>
@@ -2308,9 +2308,9 @@ static int amdgpu_pci_probe(struct pci_dev *pdev,
 	    !list_empty(&adev_to_drm(adev)->mode_config.connector_list)) {
 		/* select 8 bpp console on low vram cards */
 		if (adev->gmc.real_vram_size <= (32*1024*1024))
-			drm_fbdev_generic_setup(adev_to_drm(adev), 8);
+			drm_fbdev_ttm_setup(adev_to_drm(adev), 8);
 		else
-			drm_fbdev_generic_setup(adev_to_drm(adev), 32);
+			drm_fbdev_ttm_setup(adev_to_drm(adev), 32);
 	}
 
 	ret = amdgpu_debugfs_init(adev);
diff --git a/drivers/gpu/drm/drm_fbdev_generic.c b/drivers/gpu/drm/drm_fbdev_ttm.c
similarity index 76%
rename from drivers/gpu/drm/drm_fbdev_generic.c
rename to drivers/gpu/drm/drm_fbdev_ttm.c
index b4659cd6285ab..2114a589bd7d3 100644
--- a/drivers/gpu/drm/drm_fbdev_generic.c
+++ b/drivers/gpu/drm/drm_fbdev_ttm.c
@@ -10,10 +10,10 @@
 #include <drm/drm_gem.h>
 #include <drm/drm_print.h>
 
-#include <drm/drm_fbdev_generic.h>
+#include <drm/drm_fbdev_ttm.h>
 
 /* @user: 1=userspace, 0=fbcon */
-static int drm_fbdev_generic_fb_open(struct fb_info *info, int user)
+static int drm_fbdev_ttm_fb_open(struct fb_info *info, int user)
 {
 	struct drm_fb_helper *fb_helper = info->par;
 
@@ -24,7 +24,7 @@ static int drm_fbdev_generic_fb_open(struct fb_info *info, int user)
 	return 0;
 }
 
-static int drm_fbdev_generic_fb_release(struct fb_info *info, int user)
+static int drm_fbdev_ttm_fb_release(struct fb_info *info, int user)
 {
 	struct drm_fb_helper *fb_helper = info->par;
 
@@ -34,11 +34,11 @@ static int drm_fbdev_generic_fb_release(struct fb_info *info, int user)
 	return 0;
 }
 
-FB_GEN_DEFAULT_DEFERRED_SYSMEM_OPS(drm_fbdev_generic,
+FB_GEN_DEFAULT_DEFERRED_SYSMEM_OPS(drm_fbdev_ttm,
 				   drm_fb_helper_damage_range,
 				   drm_fb_helper_damage_area);
 
-static void drm_fbdev_generic_fb_destroy(struct fb_info *info)
+static void drm_fbdev_ttm_fb_destroy(struct fb_info *info)
 {
 	struct drm_fb_helper *fb_helper = info->par;
 	void *shadow = info->screen_buffer;
@@ -56,19 +56,19 @@ static void drm_fbdev_generic_fb_destroy(struct fb_info *info)
 	kfree(fb_helper);
 }
 
-static const struct fb_ops drm_fbdev_generic_fb_ops = {
+static const struct fb_ops drm_fbdev_ttm_fb_ops = {
 	.owner		= THIS_MODULE,
-	.fb_open	= drm_fbdev_generic_fb_open,
-	.fb_release	= drm_fbdev_generic_fb_release,
-	FB_DEFAULT_DEFERRED_OPS(drm_fbdev_generic),
+	.fb_open	= drm_fbdev_ttm_fb_open,
+	.fb_release	= drm_fbdev_ttm_fb_release,
+	FB_DEFAULT_DEFERRED_OPS(drm_fbdev_ttm),
 	DRM_FB_HELPER_DEFAULT_OPS,
-	.fb_destroy	= drm_fbdev_generic_fb_destroy,
+	.fb_destroy	= drm_fbdev_ttm_fb_destroy,
 };
 
 /*
  * This function uses the client API to create a framebuffer backed by a dumb buffer.
  */
-static int drm_fbdev_generic_helper_fb_probe(struct drm_fb_helper *fb_helper,
+static int drm_fbdev_ttm_helper_fb_probe(struct drm_fb_helper *fb_helper,
 					     struct drm_fb_helper_surface_size *sizes)
 {
 	struct drm_client_dev *client = &fb_helper->client;
@@ -108,7 +108,7 @@ static int drm_fbdev_generic_helper_fb_probe(struct drm_fb_helper *fb_helper,
 
 	drm_fb_helper_fill_info(info, fb_helper, sizes);
 
-	info->fbops = &drm_fbdev_generic_fb_ops;
+	info->fbops = &drm_fbdev_ttm_fb_ops;
 
 	/* screen */
 	info->flags |= FBINFO_VIRTFB | FBINFO_READS_FAST;
@@ -137,9 +137,9 @@ static int drm_fbdev_generic_helper_fb_probe(struct drm_fb_helper *fb_helper,
 	return ret;
 }
 
-static void drm_fbdev_generic_damage_blit_real(struct drm_fb_helper *fb_helper,
-					       struct drm_clip_rect *clip,
-					       struct iosys_map *dst)
+static void drm_fbdev_ttm_damage_blit_real(struct drm_fb_helper *fb_helper,
+					   struct drm_clip_rect *clip,
+					   struct iosys_map *dst)
 {
 	struct drm_framebuffer *fb = fb_helper->fb;
 	size_t offset = clip->y1 * fb->pitches[0];
@@ -176,8 +176,8 @@ static void drm_fbdev_generic_damage_blit_real(struct drm_fb_helper *fb_helper,
 	}
 }
 
-static int drm_fbdev_generic_damage_blit(struct drm_fb_helper *fb_helper,
-					 struct drm_clip_rect *clip)
+static int drm_fbdev_ttm_damage_blit(struct drm_fb_helper *fb_helper,
+				     struct drm_clip_rect *clip)
 {
 	struct drm_client_buffer *buffer = fb_helper->buffer;
 	struct iosys_map map, dst;
@@ -201,7 +201,7 @@ static int drm_fbdev_generic_damage_blit(struct drm_fb_helper *fb_helper,
 		goto out;
 
 	dst = map;
-	drm_fbdev_generic_damage_blit_real(fb_helper, clip, &dst);
+	drm_fbdev_ttm_damage_blit_real(fb_helper, clip, &dst);
 
 	drm_client_buffer_vunmap(buffer);
 
@@ -211,8 +211,8 @@ static int drm_fbdev_generic_damage_blit(struct drm_fb_helper *fb_helper,
 	return ret;
 }
 
-static int drm_fbdev_generic_helper_fb_dirty(struct drm_fb_helper *helper,
-					     struct drm_clip_rect *clip)
+static int drm_fbdev_ttm_helper_fb_dirty(struct drm_fb_helper *helper,
+					 struct drm_clip_rect *clip)
 {
 	struct drm_device *dev = helper->dev;
 	int ret;
@@ -221,7 +221,7 @@ static int drm_fbdev_generic_helper_fb_dirty(struct drm_fb_helper *helper,
 	if (!(clip->x1 < clip->x2 && clip->y1 < clip->y2))
 		return 0;
 
-	ret = drm_fbdev_generic_damage_blit(helper, clip);
+	ret = drm_fbdev_ttm_damage_blit(helper, clip);
 	if (drm_WARN_ONCE(dev, ret, "Damage blitter failed: ret=%d\n", ret))
 		return ret;
 
@@ -234,12 +234,12 @@ static int drm_fbdev_generic_helper_fb_dirty(struct drm_fb_helper *helper,
 	return 0;
 }
 
-static const struct drm_fb_helper_funcs drm_fbdev_generic_helper_funcs = {
-	.fb_probe = drm_fbdev_generic_helper_fb_probe,
-	.fb_dirty = drm_fbdev_generic_helper_fb_dirty,
+static const struct drm_fb_helper_funcs drm_fbdev_ttm_helper_funcs = {
+	.fb_probe = drm_fbdev_ttm_helper_fb_probe,
+	.fb_dirty = drm_fbdev_ttm_helper_fb_dirty,
 };
 
-static void drm_fbdev_generic_client_unregister(struct drm_client_dev *client)
+static void drm_fbdev_ttm_client_unregister(struct drm_client_dev *client)
 {
 	struct drm_fb_helper *fb_helper = drm_fb_helper_from_client(client);
 
@@ -252,14 +252,14 @@ static void drm_fbdev_generic_client_unregister(struct drm_client_dev *client)
 	}
 }
 
-static int drm_fbdev_generic_client_restore(struct drm_client_dev *client)
+static int drm_fbdev_ttm_client_restore(struct drm_client_dev *client)
 {
 	drm_fb_helper_lastclose(client->dev);
 
 	return 0;
 }
 
-static int drm_fbdev_generic_client_hotplug(struct drm_client_dev *client)
+static int drm_fbdev_ttm_client_hotplug(struct drm_client_dev *client)
 {
 	struct drm_fb_helper *fb_helper = drm_fb_helper_from_client(client);
 	struct drm_device *dev = client->dev;
@@ -284,32 +284,32 @@ static int drm_fbdev_generic_client_hotplug(struct drm_client_dev *client)
 err_drm_fb_helper_fini:
 	drm_fb_helper_fini(fb_helper);
 err_drm_err:
-	drm_err(dev, "fbdev: Failed to setup generic emulation (ret=%d)\n", ret);
+	drm_err(dev, "fbdev: Failed to setup emulation (ret=%d)\n", ret);
 	return ret;
 }
 
-static const struct drm_client_funcs drm_fbdev_generic_client_funcs = {
+static const struct drm_client_funcs drm_fbdev_ttm_client_funcs = {
 	.owner		= THIS_MODULE,
-	.unregister	= drm_fbdev_generic_client_unregister,
-	.restore	= drm_fbdev_generic_client_restore,
-	.hotplug	= drm_fbdev_generic_client_hotplug,
+	.unregister	= drm_fbdev_ttm_client_unregister,
+	.restore	= drm_fbdev_ttm_client_restore,
+	.hotplug	= drm_fbdev_ttm_client_hotplug,
 };
 
 /**
- * drm_fbdev_generic_setup() - Setup generic fbdev emulation
+ * drm_fbdev_ttm_setup() - Setup fbdev emulation for TTM-based drivers
  * @dev: DRM device
  * @preferred_bpp: Preferred bits per pixel for the device.
  *
- * This function sets up generic fbdev emulation for drivers that supports
+ * This function sets up fbdev emulation for TTM-based drivers that support
  * dumb buffers with a virtual address and that can be mmap'ed.
- * drm_fbdev_generic_setup() shall be called after the DRM driver registered
+ * drm_fbdev_ttm_setup() shall be called after the DRM driver registered
  * the new DRM device with drm_dev_register().
  *
  * Restore, hotplug events and teardown are all taken care of. Drivers that do
  * suspend/resume need to call drm_fb_helper_set_suspend_unlocked() themselves.
  * Simple drivers might use drm_mode_config_helper_suspend().
  *
- * In order to provide fixed mmap-able memory ranges, generic fbdev emulation
+ * In order to provide fixed mmap-able memory ranges, fbdev emulation
  * uses a shadow buffer in system memory. The implementation blits the shadow
  * fbdev buffer onto the real buffer in regular intervals.
  *
@@ -318,7 +318,7 @@ static const struct drm_client_funcs drm_fbdev_generic_client_funcs = {
  *
  * The fbdev is destroyed by drm_dev_unregister().
  */
-void drm_fbdev_generic_setup(struct drm_device *dev, unsigned int preferred_bpp)
+void drm_fbdev_ttm_setup(struct drm_device *dev, unsigned int preferred_bpp)
 {
 	struct drm_fb_helper *fb_helper;
 	int ret;
@@ -329,9 +329,9 @@ void drm_fbdev_generic_setup(struct drm_device *dev, unsigned int preferred_bpp)
 	fb_helper = kzalloc(sizeof(*fb_helper), GFP_KERNEL);
 	if (!fb_helper)
 		return;
-	drm_fb_helper_prepare(dev, fb_helper, preferred_bpp, &drm_fbdev_generic_helper_funcs);
+	drm_fb_helper_prepare(dev, fb_helper, preferred_bpp, &drm_fbdev_ttm_helper_funcs);
 
-	ret = drm_client_init(dev, &fb_helper->client, "fbdev", &drm_fbdev_generic_client_funcs);
+	ret = drm_client_init(dev, &fb_helper->client, "fbdev", &drm_fbdev_ttm_client_funcs);
 	if (ret) {
 		drm_err(dev, "Failed to register client: %d\n", ret);
 		goto err_drm_client_init;
@@ -346,4 +346,4 @@ void drm_fbdev_generic_setup(struct drm_device *dev, unsigned int preferred_bpp)
 	kfree(fb_helper);
 	return;
 }
-EXPORT_SYMBOL(drm_fbdev_generic_setup);
+EXPORT_SYMBOL(drm_fbdev_ttm_setup);
diff --git a/drivers/gpu/drm/hisilicon/hibmc/hibmc_drm_drv.c b/drivers/gpu/drm/hisilicon/hibmc/hibmc_drm_drv.c
index 57c21ec452b70..9f9b19ea05879 100644
--- a/drivers/gpu/drm/hisilicon/hibmc/hibmc_drm_drv.c
+++ b/drivers/gpu/drm/hisilicon/hibmc/hibmc_drm_drv.c
@@ -17,7 +17,7 @@
 #include <drm/drm_aperture.h>
 #include <drm/drm_atomic_helper.h>
 #include <drm/drm_drv.h>
-#include <drm/drm_fbdev_generic.h>
+#include <drm/drm_fbdev_ttm.h>
 #include <drm/drm_gem_framebuffer_helper.h>
 #include <drm/drm_gem_vram_helper.h>
 #include <drm/drm_managed.h>
@@ -339,7 +339,7 @@ static int hibmc_pci_probe(struct pci_dev *pdev,
 		goto err_unload;
 	}
 
-	drm_fbdev_generic_setup(dev, 32);
+	drm_fbdev_ttm_setup(dev, 32);
 
 	return 0;
 
diff --git a/drivers/gpu/drm/loongson/Kconfig b/drivers/gpu/drm/loongson/Kconfig
index 8e59753e532de..9ed463a76ae29 100644
--- a/drivers/gpu/drm/loongson/Kconfig
+++ b/drivers/gpu/drm/loongson/Kconfig
@@ -6,6 +6,7 @@ config DRM_LOONGSON
 	depends on LOONGARCH || MIPS || COMPILE_TEST
 	select DRM_KMS_HELPER
 	select DRM_TTM
+	select DRM_TTM_HELPER
 	select I2C
 	select I2C_ALGOBIT
 	help
diff --git a/drivers/gpu/drm/loongson/lsdc_drv.c b/drivers/gpu/drm/loongson/lsdc_drv.c
index d8ff60b46abe6..adc7344d2f807 100644
--- a/drivers/gpu/drm/loongson/lsdc_drv.c
+++ b/drivers/gpu/drm/loongson/lsdc_drv.c
@@ -10,7 +10,7 @@
 #include <drm/drm_atomic.h>
 #include <drm/drm_atomic_helper.h>
 #include <drm/drm_drv.h>
-#include <drm/drm_fbdev_generic.h>
+#include <drm/drm_fbdev_ttm.h>
 #include <drm/drm_gem_framebuffer_helper.h>
 #include <drm/drm_ioctl.h>
 #include <drm/drm_modeset_helper.h>
@@ -314,7 +314,7 @@ static int lsdc_pci_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
 	if (ret)
 		return ret;
 
-	drm_fbdev_generic_setup(ddev, 32);
+	drm_fbdev_ttm_setup(ddev, 32);
 
 	return 0;
 }
diff --git a/drivers/gpu/drm/nouveau/nouveau_drm.c b/drivers/gpu/drm/nouveau/nouveau_drm.c
index a947e1d5f309a..a58c31089613e 100644
--- a/drivers/gpu/drm/nouveau/nouveau_drm.c
+++ b/drivers/gpu/drm/nouveau/nouveau_drm.c
@@ -32,7 +32,7 @@
 
 #include <drm/drm_aperture.h>
 #include <drm/drm_drv.h>
-#include <drm/drm_fbdev_generic.h>
+#include <drm/drm_fbdev_ttm.h>
 #include <drm/drm_gem_ttm_helper.h>
 #include <drm/drm_ioctl.h>
 #include <drm/drm_vblank.h>
@@ -846,9 +846,9 @@ static int nouveau_drm_probe(struct pci_dev *pdev,
 		goto fail_drm_dev_init;
 
 	if (nouveau_drm(drm_dev)->client.device.info.ram_size <= 32 * 1024 * 1024)
-		drm_fbdev_generic_setup(drm_dev, 8);
+		drm_fbdev_ttm_setup(drm_dev, 8);
 	else
-		drm_fbdev_generic_setup(drm_dev, 32);
+		drm_fbdev_ttm_setup(drm_dev, 32);
 
 	quirk_broken_nv_runpm(pdev);
 	return 0;
diff --git a/drivers/gpu/drm/qxl/qxl_drv.c b/drivers/gpu/drm/qxl/qxl_drv.c
index beee5563031aa..5eb3f5719fdf3 100644
--- a/drivers/gpu/drm/qxl/qxl_drv.c
+++ b/drivers/gpu/drm/qxl/qxl_drv.c
@@ -37,7 +37,7 @@
 #include <drm/drm_aperture.h>
 #include <drm/drm_atomic_helper.h>
 #include <drm/drm_drv.h>
-#include <drm/drm_fbdev_generic.h>
+#include <drm/drm_fbdev_ttm.h>
 #include <drm/drm_file.h>
 #include <drm/drm_gem_ttm_helper.h>
 #include <drm/drm_module.h>
@@ -118,7 +118,7 @@ qxl_pci_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
 	if (ret)
 		goto modeset_cleanup;
 
-	drm_fbdev_generic_setup(&qdev->ddev, 32);
+	drm_fbdev_ttm_setup(&qdev->ddev, 32);
 	return 0;
 
 modeset_cleanup:
diff --git a/drivers/gpu/drm/tiny/bochs.c b/drivers/gpu/drm/tiny/bochs.c
index c23c9f0cf49cb..2d7ad808cc0e2 100644
--- a/drivers/gpu/drm/tiny/bochs.c
+++ b/drivers/gpu/drm/tiny/bochs.c
@@ -7,7 +7,7 @@
 #include <drm/drm_atomic_helper.h>
 #include <drm/drm_drv.h>
 #include <drm/drm_edid.h>
-#include <drm/drm_fbdev_generic.h>
+#include <drm/drm_fbdev_ttm.h>
 #include <drm/drm_fourcc.h>
 #include <drm/drm_framebuffer.h>
 #include <drm/drm_gem_framebuffer_helper.h>
@@ -670,7 +670,7 @@ static int bochs_pci_probe(struct pci_dev *pdev, const struct pci_device_id *ent
 	if (ret)
 		goto err_hw_fini;
 
-	drm_fbdev_generic_setup(dev, 32);
+	drm_fbdev_ttm_setup(dev, 32);
 	return ret;
 
 err_hw_fini:
diff --git a/drivers/gpu/drm/vboxvideo/vbox_drv.c b/drivers/gpu/drm/vboxvideo/vbox_drv.c
index cd9e66a06596a..ef36834c8673c 100644
--- a/drivers/gpu/drm/vboxvideo/vbox_drv.c
+++ b/drivers/gpu/drm/vboxvideo/vbox_drv.c
@@ -14,7 +14,7 @@
 #include <drm/drm_aperture.h>
 #include <drm/drm_atomic_helper.h>
 #include <drm/drm_drv.h>
-#include <drm/drm_fbdev_generic.h>
+#include <drm/drm_fbdev_ttm.h>
 #include <drm/drm_file.h>
 #include <drm/drm_ioctl.h>
 #include <drm/drm_managed.h>
@@ -80,7 +80,7 @@ static int vbox_pci_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
 	if (ret)
 		goto err_irq_fini;
 
-	drm_fbdev_generic_setup(&vbox->ddev, 32);
+	drm_fbdev_ttm_setup(&vbox->ddev, 32);
 
 	return 0;
 
diff --git a/drivers/gpu/drm/vmwgfx/vmwgfx_drv.c b/drivers/gpu/drm/vmwgfx/vmwgfx_drv.c
index d3e308fdfd5be..9fcbd640278bb 100644
--- a/drivers/gpu/drm/vmwgfx/vmwgfx_drv.c
+++ b/drivers/gpu/drm/vmwgfx/vmwgfx_drv.c
@@ -36,7 +36,7 @@
 
 #include <drm/drm_aperture.h>
 #include <drm/drm_drv.h>
-#include <drm/drm_fbdev_generic.h>
+#include <drm/drm_fbdev_ttm.h>
 #include <drm/drm_gem_ttm_helper.h>
 #include <drm/drm_ioctl.h>
 #include <drm/drm_module.h>
@@ -1676,7 +1676,7 @@ static int vmw_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
 
 	vmw_fifo_resource_inc(vmw);
 	vmw_svga_enable(vmw);
-	drm_fbdev_generic_setup(&vmw->drm,  0);
+	drm_fbdev_ttm_setup(&vmw->drm,  0);
 
 	vmw_debugfs_gem_init(vmw);
 	vmw_debugfs_resource_managers_init(vmw);
diff --git a/include/drm/drm_fbdev_generic.h b/include/drm/drm_fbdev_generic.h
deleted file mode 100644
index 75799342098dc..0000000000000
--- a/include/drm/drm_fbdev_generic.h
+++ /dev/null
@@ -1,15 +0,0 @@
-/* SPDX-License-Identifier: MIT */
-
-#ifndef DRM_FBDEV_GENERIC_H
-#define DRM_FBDEV_GENERIC_H
-
-struct drm_device;
-
-#ifdef CONFIG_DRM_FBDEV_EMULATION
-void drm_fbdev_generic_setup(struct drm_device *dev, unsigned int preferred_bpp);
-#else
-static inline void drm_fbdev_generic_setup(struct drm_device *dev, unsigned int preferred_bpp)
-{ }
-#endif
-
-#endif
diff --git a/include/drm/drm_fbdev_ttm.h b/include/drm/drm_fbdev_ttm.h
new file mode 100644
index 0000000000000..9e6c3bdf35376
--- /dev/null
+++ b/include/drm/drm_fbdev_ttm.h
@@ -0,0 +1,15 @@
+/* SPDX-License-Identifier: MIT */
+
+#ifndef DRM_FBDEV_TTM_H
+#define DRM_FBDEV_TTM_H
+
+struct drm_device;
+
+#ifdef CONFIG_DRM_FBDEV_EMULATION
+void drm_fbdev_ttm_setup(struct drm_device *dev, unsigned int preferred_bpp);
+#else
+static inline void drm_fbdev_ttm_setup(struct drm_device *dev, unsigned int preferred_bpp)
+{ }
+#endif
+
+#endif
-- 
2.44.0


^ permalink raw reply related	[flat|nested] 78+ messages in thread

* [PATCH 43/43] drm/fbdev: Clean up fbdev documentation
  2024-03-12 15:44 [PATCH 00/43] drm: Provide fbdev emulation per memory manager Thomas Zimmermann
                   ` (41 preceding siblings ...)
  2024-03-12 15:45 ` [PATCH 42/43] drm/fbdev-generic: Convert to fbdev-ttm Thomas Zimmermann
@ 2024-03-12 15:45 ` Thomas Zimmermann
  42 siblings, 0 replies; 78+ messages in thread
From: Thomas Zimmermann @ 2024-03-12 15:45 UTC (permalink / raw)
  To: daniel, airlied, deller, javierm
  Cc: linux-fbdev, dri-devel, Thomas Zimmermann, Jonathan Corbet

Rewrite some docs that are not up-to-date any longer. Remove the TODO
item for fbdev-generic conversion, as the helper has been replaced. Make
documentation for DMA, SHMEM and TTM emulation available.

Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
Cc: Jonathan Corbet <corbet@lwn.net>
---
 Documentation/gpu/drm-kms-helpers.rst | 12 +++++++++---
 Documentation/gpu/todo.rst            | 13 -------------
 drivers/gpu/drm/drm_drv.c             |  2 +-
 drivers/gpu/drm/drm_fb_helper.c       | 11 ++---------
 include/drm/drm_mode_config.h         |  4 ++--
 5 files changed, 14 insertions(+), 28 deletions(-)

diff --git a/Documentation/gpu/drm-kms-helpers.rst b/Documentation/gpu/drm-kms-helpers.rst
index e46ab9b670acd..8435e8621cc08 100644
--- a/Documentation/gpu/drm-kms-helpers.rst
+++ b/Documentation/gpu/drm-kms-helpers.rst
@@ -110,15 +110,21 @@ fbdev Helper Functions Reference
 .. kernel-doc:: drivers/gpu/drm/drm_fb_helper.c
    :doc: fbdev helpers
 
-.. kernel-doc:: include/drm/drm_fb_helper.h
-   :internal:
+.. kernel-doc:: drivers/gpu/drm/drm_fbdev_dma.c
+   :export:
 
-.. kernel-doc:: drivers/gpu/drm/drm_fb_helper.c
+.. kernel-doc:: drivers/gpu/drm/drm_fbdev_shmem.c
    :export:
 
 .. kernel-doc:: drivers/gpu/drm/drm_fbdev_ttm.c
    :export:
 
+.. kernel-doc:: include/drm/drm_fb_helper.h
+   :internal:
+
+.. kernel-doc:: drivers/gpu/drm/drm_fb_helper.c
+   :export:
+
 format Helper Functions Reference
 =================================
 
diff --git a/Documentation/gpu/todo.rst b/Documentation/gpu/todo.rst
index fb9ad120b1414..e2a0585915b32 100644
--- a/Documentation/gpu/todo.rst
+++ b/Documentation/gpu/todo.rst
@@ -243,19 +243,6 @@ Contact: Maintainer of the driver you plan to convert
 
 Level: Intermediate
 
-Convert drivers to use drm_fbdev_generic_setup()
-------------------------------------------------
-
-Most drivers can use drm_fbdev_generic_setup(). Driver have to implement
-atomic modesetting and GEM vmap support. Historically, generic fbdev emulation
-expected the framebuffer in system memory or system-like memory. By employing
-struct iosys_map, drivers with frambuffers in I/O memory can be supported
-as well.
-
-Contact: Maintainer of the driver you plan to convert
-
-Level: Intermediate
-
 Reimplement functions in drm_fbdev_fb_ops without fbdev
 -------------------------------------------------------
 
diff --git a/drivers/gpu/drm/drm_drv.c b/drivers/gpu/drm/drm_drv.c
index 243cacb3575c0..cfcd45480d326 100644
--- a/drivers/gpu/drm/drm_drv.c
+++ b/drivers/gpu/drm/drm_drv.c
@@ -345,7 +345,7 @@ void drm_minor_release(struct drm_minor *minor)
  *		if (ret)
  *			return ret;
  *
- *		drm_fbdev_generic_setup(drm, 32);
+ *		drm_fbdev_{...}_setup(drm, 32);
  *
  *		return 0;
  *	}
diff --git a/drivers/gpu/drm/drm_fb_helper.c b/drivers/gpu/drm/drm_fb_helper.c
index d612133e2cf7e..e2e19f49342e1 100644
--- a/drivers/gpu/drm/drm_fb_helper.c
+++ b/drivers/gpu/drm/drm_fb_helper.c
@@ -85,12 +85,8 @@ static DEFINE_MUTEX(kernel_fb_helper_lock);
  * The fb helper functions are useful to provide an fbdev on top of a drm kernel
  * mode setting driver. They can be used mostly independently from the crtc
  * helper functions used by many drivers to implement the kernel mode setting
- * interfaces.
- *
- * Drivers that support a dumb buffer with a virtual address and mmap support,
- * should try out the generic fbdev emulation using drm_fbdev_generic_setup().
- * It will automatically set up deferred I/O if the driver requires a shadow
- * buffer.
+ * interfaces. Drivers that use one of the shared memory managers, TTM, SHMEM,
+ * DMA, should instead use the corresponding fbdev emulation.
  *
  * Existing fbdev implementations should restore the fbdev console by using
  * drm_fb_helper_lastclose() as their &drm_driver.lastclose callback.
@@ -126,9 +122,6 @@ static DEFINE_MUTEX(kernel_fb_helper_lock);
  * atomic context. If drm_fb_helper_deferred_io() is used as the deferred_io
  * callback it will also schedule dirty_work with the damage collected from the
  * mmap page writes.
- *
- * Deferred I/O is not compatible with SHMEM. Such drivers should request an
- * fbdev shadow buffer and call drm_fbdev_generic_setup() instead.
  */
 
 static void drm_fb_helper_restore_lut_atomic(struct drm_crtc *crtc)
diff --git a/include/drm/drm_mode_config.h b/include/drm/drm_mode_config.h
index 973119a9176b2..1e4b8d01212e6 100644
--- a/include/drm/drm_mode_config.h
+++ b/include/drm/drm_mode_config.h
@@ -106,8 +106,8 @@ struct drm_mode_config_funcs {
 	 * Drivers implementing fbdev emulation use drm_kms_helper_hotplug_event()
 	 * to call this hook to inform the fbdev helper of output changes.
 	 *
-	 * This hook is deprecated, drivers should instead use
-	 * drm_fbdev_generic_setup() which takes care of any necessary
+	 * This hook is deprecated, drivers should instead implement fbdev
+	 * support with struct drm_client, which takes care of any necessary
 	 * hotplug event forwarding already without further involvement by
 	 * the driver.
 	 */
-- 
2.44.0


^ permalink raw reply related	[flat|nested] 78+ messages in thread

* Re: [PATCH 11/43] drm/hyperv: Use fbdev-shmem
  2024-03-12 15:45 ` [PATCH 11/43] drm/hyperv: " Thomas Zimmermann
@ 2024-03-12 16:08   ` Deepak Rawat
  0 siblings, 0 replies; 78+ messages in thread
From: Deepak Rawat @ 2024-03-12 16:08 UTC (permalink / raw)
  To: Thomas Zimmermann
  Cc: daniel, airlied, deller, javierm, linux-fbdev, dri-devel

Reviewed-by: Deepak Rawat <drawat.floss@gmail.com>

On Tue, Mar 12, 2024 at 8:48 AM Thomas Zimmermann <tzimmermann@suse.de> wrote:
>
> Implement fbdev emulation with fbdev-shmem. Avoids the overhead of
> fbdev-generic's additional shadow buffering. No functional changes.
>
> Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
> Cc: Deepak Rawat <drawat.floss@gmail.com>
> ---
>  drivers/gpu/drm/hyperv/hyperv_drm_drv.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/gpu/drm/hyperv/hyperv_drm_drv.c b/drivers/gpu/drm/hyperv/hyperv_drm_drv.c
> index cff85086f2d66..ff93e08d5036d 100644
> --- a/drivers/gpu/drm/hyperv/hyperv_drm_drv.c
> +++ b/drivers/gpu/drm/hyperv/hyperv_drm_drv.c
> @@ -11,7 +11,7 @@
>  #include <drm/drm_aperture.h>
>  #include <drm/drm_atomic_helper.h>
>  #include <drm/drm_drv.h>
> -#include <drm/drm_fbdev_generic.h>
> +#include <drm/drm_fbdev_shmem.h>
>  #include <drm/drm_gem_shmem_helper.h>
>  #include <drm/drm_simple_kms_helper.h>
>
> @@ -149,7 +149,7 @@ static int hyperv_vmbus_probe(struct hv_device *hdev,
>                 goto err_free_mmio;
>         }
>
> -       drm_fbdev_generic_setup(dev, 0);
> +       drm_fbdev_shmem_setup(dev, 0);
>
>         return 0;
>
> --
> 2.44.0
>

^ permalink raw reply	[flat|nested] 78+ messages in thread

* Re: [PATCH 08/43] drm/fbdev: Add fbdev-shmem
  2024-03-12 15:45 ` [PATCH 08/43] drm/fbdev: Add fbdev-shmem Thomas Zimmermann
@ 2024-03-12 16:14   ` Geert Uytterhoeven
  2024-03-13  8:19     ` Thomas Zimmermann
  0 siblings, 1 reply; 78+ messages in thread
From: Geert Uytterhoeven @ 2024-03-12 16:14 UTC (permalink / raw)
  To: Thomas Zimmermann
  Cc: daniel, airlied, deller, javierm, linux-fbdev, dri-devel

Hi Thomas,

On Tue, Mar 12, 2024 at 4:48 PM Thomas Zimmermann <tzimmermann@suse.de> wrote:
> Add an fbdev emulation for SHMEM-based memory managers. The code is
> similar to fbdev-generic, but does not require an addition shadow
> buffer for mmap(). Fbdev-shmem operates directly on the buffer object's
> SHMEM pages. Fbdev's deferred-I/O mechanism updates the hardware state
> on write operations.
>
> Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>

Thanks for your patch!

> --- /dev/null
> +++ b/drivers/gpu/drm/drm_fbdev_shmem.c

> +static int drm_fbdev_shmem_helper_fb_probe(struct drm_fb_helper *fb_helper,
> +                                          struct drm_fb_helper_surface_size *sizes)
> +{
> +       struct drm_client_dev *client = &fb_helper->client;
> +       struct drm_device *dev = fb_helper->dev;
> +       struct drm_client_buffer *buffer;
> +       struct drm_gem_shmem_object *shmem;
> +       struct drm_framebuffer *fb;
> +       struct fb_info *info;
> +       u32 format;
> +       struct iosys_map map;
> +       int ret;
> +
> +       drm_dbg_kms(dev, "surface width(%d), height(%d) and bpp(%d)\n",
> +                   sizes->surface_width, sizes->surface_height,
> +                   sizes->surface_bpp);
> +
> +       format = drm_mode_legacy_fb_format(sizes->surface_bpp, sizes->surface_depth);

Oops, one more caller of the imprecise
let's-guess-the-format-from-bpp-and-depth machinery to get rid of...

> +       buffer = drm_client_framebuffer_create(client, sizes->surface_width,
> +                                              sizes->surface_height, format);

[...]

> +}

> +/**
> + * drm_fbdev_shmem_setup() - Setup fbdev emulation for GEM SHMEM helpers
> + * @dev: DRM device
> + * @preferred_bpp: Preferred bits per pixel for the device.
> + *                 32 is used if this is zero.
> + *
> + * This function sets up fbdev emulation for GEM DMA drivers that support
> + * dumb buffers with a virtual address and that can be mmap'ed.
> + * drm_fbdev_shmem_setup() shall be called after the DRM driver registered
> + * the new DRM device with drm_dev_register().
> + *
> + * Restore, hotplug events and teardown are all taken care of. Drivers that do
> + * suspend/resume need to call drm_fb_helper_set_suspend_unlocked() themselves.
> + * Simple drivers might use drm_mode_config_helper_suspend().
> + *
> + * This function is safe to call even when there are no connectors present.
> + * Setup will be retried on the next hotplug event.
> + *
> + * The fbdev is destroyed by drm_dev_unregister().
> + */
> +void drm_fbdev_shmem_setup(struct drm_device *dev, unsigned int preferred_bpp)

As this is a completely new function, can we please get a
preferred_format parameter instead?

> +{
> +       struct drm_fb_helper *fb_helper;
> +       int ret;
> +
> +       drm_WARN(dev, !dev->registered, "Device has not been registered.\n");
> +       drm_WARN(dev, dev->fb_helper, "fb_helper is already set!\n");
> +
> +       fb_helper = kzalloc(sizeof(*fb_helper), GFP_KERNEL);
> +       if (!fb_helper)
> +               return;
> +       drm_fb_helper_prepare(dev, fb_helper, preferred_bpp, &drm_fbdev_shmem_helper_funcs);
> +
> +       ret = drm_client_init(dev, &fb_helper->client, "fbdev", &drm_fbdev_shmem_client_funcs);
> +       if (ret) {
> +               drm_err(dev, "Failed to register client: %d\n", ret);
> +               goto err_drm_client_init;
> +       }
> +
> +       drm_client_register(&fb_helper->client);
> +
> +       return;
> +
> +err_drm_client_init:
> +       drm_fb_helper_unprepare(fb_helper);
> +       kfree(fb_helper);
> +}
> +EXPORT_SYMBOL(drm_fbdev_shmem_setup);


Gr{oetje,eeting}s,

                        Geert

-- 
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
                                -- Linus Torvalds

^ permalink raw reply	[flat|nested] 78+ messages in thread

* RE: [PATCH 29/43] drm/renesas/rz-du: Use fbdev-dma
  2024-03-12 15:45 ` [PATCH 29/43] drm/renesas/rz-du: " Thomas Zimmermann
@ 2024-03-12 19:14   ` Biju Das
  2024-03-13  8:30     ` Thomas Zimmermann
  0 siblings, 1 reply; 78+ messages in thread
From: Biju Das @ 2024-03-12 19:14 UTC (permalink / raw)
  To: Thomas Zimmermann, daniel, airlied, deller, javierm
  Cc: linux-fbdev, dri-devel

Hi Thomas,

> -----Original Message-----
> From: Thomas Zimmermann <tzimmermann@suse.de>
> Sent: Tuesday, March 12, 2024 3:45 PM
> To: daniel@ffwll.ch; airlied@gmail.com; deller@gmx.de; javierm@redhat.com
> Cc: linux-fbdev@vger.kernel.org; dri-devel@lists.freedesktop.org; Thomas Zimmermann
> <tzimmermann@suse.de>; Biju Das <biju.das.jz@bp.renesas.com>
> Subject: [PATCH 29/43] drm/renesas/rz-du: Use fbdev-dma
> 
> Implement fbdev emulation with fbdev-dma. Fbdev-dma now supports damage handling, which is required by
> rz-du. Avoids the overhead of fbdev-generic's additional shadow buffering. No functional changes.
> 
> Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>


Tested-by: Biju Das <biju.das.jz@bp.renesas.com>

Cheers,
Biju

> Cc: Biju Das <biju.das.jz@bp.renesas.com>
> ---
>  drivers/gpu/drm/renesas/rz-du/rzg2l_du_drv.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/gpu/drm/renesas/rz-du/rzg2l_du_drv.c b/drivers/gpu/drm/renesas/rz-
> du/rzg2l_du_drv.c
> index 470d34da1d6c4..e5eca8691a331 100644
> --- a/drivers/gpu/drm/renesas/rz-du/rzg2l_du_drv.c
> +++ b/drivers/gpu/drm/renesas/rz-du/rzg2l_du_drv.c
> @@ -14,7 +14,7 @@
> 
>  #include <drm/drm_atomic_helper.h>
>  #include <drm/drm_drv.h>
> -#include <drm/drm_fbdev_generic.h>
> +#include <drm/drm_fbdev_dma.h>
>  #include <drm/drm_gem_dma_helper.h>
>  #include <drm/drm_probe_helper.h>
> 
> @@ -149,7 +149,7 @@ static int rzg2l_du_probe(struct platform_device *pdev)
> 
>  	drm_info(&rcdu->ddev, "Device %s probed\n", dev_name(&pdev->dev));
> 
> -	drm_fbdev_generic_setup(&rcdu->ddev, 32);
> +	drm_fbdev_dma_setup(&rcdu->ddev, 32);
> 
>  	return 0;
> 
> --
> 2.44.0


^ permalink raw reply	[flat|nested] 78+ messages in thread

* Re: [PATCH 34/43] drm/tiny/ili9225: Use fbdev-dma
  2024-03-12 15:45 ` [PATCH 34/43] drm/tiny/ili9225: " Thomas Zimmermann
@ 2024-03-12 22:20   ` David Lechner
  0 siblings, 0 replies; 78+ messages in thread
From: David Lechner @ 2024-03-12 22:20 UTC (permalink / raw)
  To: Thomas Zimmermann, daniel, airlied, deller, javierm
  Cc: linux-fbdev, dri-devel

On 3/12/24 10:45 AM, Thomas Zimmermann wrote:
> Implement fbdev emulation with fbdev-dma. Fbdev-dma now supports
> damage handling, which is required by ili9225. Avoids the overhead of
> fbdev-generic's additional shadow buffering. No functional changes.
> 
> Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
> Cc: David Lechner <david@lechnology.com>
> ---

Acked-by: David Lechner <david@lechnology.com>


^ permalink raw reply	[flat|nested] 78+ messages in thread

* Re: [PATCH 40/43] drm/tiny/st7586: Use fbdev-dma
  2024-03-12 15:45 ` [PATCH 40/43] drm/tiny/st7586: " Thomas Zimmermann
@ 2024-03-12 22:21   ` David Lechner
  0 siblings, 0 replies; 78+ messages in thread
From: David Lechner @ 2024-03-12 22:21 UTC (permalink / raw)
  To: Thomas Zimmermann, daniel, airlied, deller, javierm
  Cc: linux-fbdev, dri-devel

On 3/12/24 10:45 AM, Thomas Zimmermann wrote:
> Implement fbdev emulation with fbdev-dma. Fbdev-dma now supports
> damage handling, which is required by st7586. Avoids the overhead of
> fbdev-generic's additional shadow buffering. No functional changes.
> 
> Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
> Cc: David Lechner <david@lechnology.com>
> ---

Acked-by: David Lechner <david@lechnology.com>



^ permalink raw reply	[flat|nested] 78+ messages in thread

* Re: [PATCH 41/43] drm/tiny/st7735r: Use fbdev-dma
  2024-03-12 15:45 ` [PATCH 41/43] drm/tiny/st7735r: " Thomas Zimmermann
@ 2024-03-12 22:21   ` David Lechner
  0 siblings, 0 replies; 78+ messages in thread
From: David Lechner @ 2024-03-12 22:21 UTC (permalink / raw)
  To: Thomas Zimmermann, daniel, airlied, deller, javierm
  Cc: linux-fbdev, dri-devel

On 3/12/24 10:45 AM, Thomas Zimmermann wrote:
> Implement fbdev emulation with fbdev-dma. Fbdev-dma now supports
> damage handling, which is required by st7735r. Avoids the overhead of
> fbdev-generic's additional shadow buffering. No functional changes.
> 
> Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
> Cc: David Lechner <david@lechnology.com>
> ---

Acked-by: David Lechner <david@lechnology.com>



^ permalink raw reply	[flat|nested] 78+ messages in thread

* Re: [PATCH 08/43] drm/fbdev: Add fbdev-shmem
  2024-03-12 16:14   ` Geert Uytterhoeven
@ 2024-03-13  8:19     ` Thomas Zimmermann
  2024-03-13  9:03       ` Geert Uytterhoeven
  0 siblings, 1 reply; 78+ messages in thread
From: Thomas Zimmermann @ 2024-03-13  8:19 UTC (permalink / raw)
  To: Geert Uytterhoeven
  Cc: daniel, airlied, deller, javierm, linux-fbdev, dri-devel

Hi Geert

Am 12.03.24 um 17:14 schrieb Geert Uytterhoeven:
> Hi Thomas,
>
> On Tue, Mar 12, 2024 at 4:48 PM Thomas Zimmermann <tzimmermann@suse.de> wrote:
>> Add an fbdev emulation for SHMEM-based memory managers. The code is
>> similar to fbdev-generic, but does not require an addition shadow
>> buffer for mmap(). Fbdev-shmem operates directly on the buffer object's
>> SHMEM pages. Fbdev's deferred-I/O mechanism updates the hardware state
>> on write operations.
>>
>> Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
> Thanks for your patch!
>
>> --- /dev/null
>> +++ b/drivers/gpu/drm/drm_fbdev_shmem.c
>> +static int drm_fbdev_shmem_helper_fb_probe(struct drm_fb_helper *fb_helper,
>> +                                          struct drm_fb_helper_surface_size *sizes)
>> +{
>> +       struct drm_client_dev *client = &fb_helper->client;
>> +       struct drm_device *dev = fb_helper->dev;
>> +       struct drm_client_buffer *buffer;
>> +       struct drm_gem_shmem_object *shmem;
>> +       struct drm_framebuffer *fb;
>> +       struct fb_info *info;
>> +       u32 format;
>> +       struct iosys_map map;
>> +       int ret;
>> +
>> +       drm_dbg_kms(dev, "surface width(%d), height(%d) and bpp(%d)\n",
>> +                   sizes->surface_width, sizes->surface_height,
>> +                   sizes->surface_bpp);
>> +
>> +       format = drm_mode_legacy_fb_format(sizes->surface_bpp, sizes->surface_depth);
> Oops, one more caller of the imprecise
> let's-guess-the-format-from-bpp-and-depth machinery to get rid of...

Right, that has been discussed in another thread. I'll change this call 
to the drm_driver_() function.

>
>> +       buffer = drm_client_framebuffer_create(client, sizes->surface_width,
>> +                                              sizes->surface_height, format);
> [...]
>
>> +}
>> +/**
>> + * drm_fbdev_shmem_setup() - Setup fbdev emulation for GEM SHMEM helpers
>> + * @dev: DRM device
>> + * @preferred_bpp: Preferred bits per pixel for the device.
>> + *                 32 is used if this is zero.
>> + *
>> + * This function sets up fbdev emulation for GEM DMA drivers that support
>> + * dumb buffers with a virtual address and that can be mmap'ed.
>> + * drm_fbdev_shmem_setup() shall be called after the DRM driver registered
>> + * the new DRM device with drm_dev_register().
>> + *
>> + * Restore, hotplug events and teardown are all taken care of. Drivers that do
>> + * suspend/resume need to call drm_fb_helper_set_suspend_unlocked() themselves.
>> + * Simple drivers might use drm_mode_config_helper_suspend().
>> + *
>> + * This function is safe to call even when there are no connectors present.
>> + * Setup will be retried on the next hotplug event.
>> + *
>> + * The fbdev is destroyed by drm_dev_unregister().
>> + */
>> +void drm_fbdev_shmem_setup(struct drm_device *dev, unsigned int preferred_bpp)
> As this is a completely new function, can we please get a
> preferred_format parameter instead?

An understandable question. But as it is, the patchset has a trivial 
change in each driver. And the preferred_bpp parameter has the same 
meaning as the bpp value in the video= parameter. So it's ok-ish for now.

Using a format parameter here is really a much larger update and touches 
the internals of the fbdev emulation. I'm not even sure that we should 
have a parameter at all. Since in-kernel clients should behave like 
userspace clients, we could try to figure out the format from the 
driver's primary planes. That's a patchset of its own.

Best regards
Thomas

>
>> +{
>> +       struct drm_fb_helper *fb_helper;
>> +       int ret;
>> +
>> +       drm_WARN(dev, !dev->registered, "Device has not been registered.\n");
>> +       drm_WARN(dev, dev->fb_helper, "fb_helper is already set!\n");
>> +
>> +       fb_helper = kzalloc(sizeof(*fb_helper), GFP_KERNEL);
>> +       if (!fb_helper)
>> +               return;
>> +       drm_fb_helper_prepare(dev, fb_helper, preferred_bpp, &drm_fbdev_shmem_helper_funcs);
>> +
>> +       ret = drm_client_init(dev, &fb_helper->client, "fbdev", &drm_fbdev_shmem_client_funcs);
>> +       if (ret) {
>> +               drm_err(dev, "Failed to register client: %d\n", ret);
>> +               goto err_drm_client_init;
>> +       }
>> +
>> +       drm_client_register(&fb_helper->client);
>> +
>> +       return;
>> +
>> +err_drm_client_init:
>> +       drm_fb_helper_unprepare(fb_helper);
>> +       kfree(fb_helper);
>> +}
>> +EXPORT_SYMBOL(drm_fbdev_shmem_setup);
>
> Gr{oetje,eeting}s,
>
>                          Geert
>

-- 
--
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)


^ permalink raw reply	[flat|nested] 78+ messages in thread

* Re: [PATCH 29/43] drm/renesas/rz-du: Use fbdev-dma
  2024-03-12 19:14   ` Biju Das
@ 2024-03-13  8:30     ` Thomas Zimmermann
  0 siblings, 0 replies; 78+ messages in thread
From: Thomas Zimmermann @ 2024-03-13  8:30 UTC (permalink / raw)
  To: Biju Das, daniel, airlied, deller, javierm; +Cc: linux-fbdev, dri-devel

Hi

Am 12.03.24 um 20:14 schrieb Biju Das:
> Hi Thomas,
>
>> -----Original Message-----
>> From: Thomas Zimmermann <tzimmermann@suse.de>
>> Sent: Tuesday, March 12, 2024 3:45 PM
>> To: daniel@ffwll.ch; airlied@gmail.com; deller@gmx.de; javierm@redhat.com
>> Cc: linux-fbdev@vger.kernel.org; dri-devel@lists.freedesktop.org; Thomas Zimmermann
>> <tzimmermann@suse.de>; Biju Das <biju.das.jz@bp.renesas.com>
>> Subject: [PATCH 29/43] drm/renesas/rz-du: Use fbdev-dma
>>
>> Implement fbdev emulation with fbdev-dma. Fbdev-dma now supports damage handling, which is required by
>> rz-du. Avoids the overhead of fbdev-generic's additional shadow buffering. No functional changes.
>>
>> Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
>
> Tested-by: Biju Das <biju.das.jz@bp.renesas.com>

Thanks a lot.

I just noticed that the drivers under renesas/ don't require damage 
handling, so the commit message needs a change.

Best regards
Thomas

>
> Cheers,
> Biju
>
>> Cc: Biju Das <biju.das.jz@bp.renesas.com>
>> ---
>>   drivers/gpu/drm/renesas/rz-du/rzg2l_du_drv.c | 4 ++--
>>   1 file changed, 2 insertions(+), 2 deletions(-)
>>
>> diff --git a/drivers/gpu/drm/renesas/rz-du/rzg2l_du_drv.c b/drivers/gpu/drm/renesas/rz-
>> du/rzg2l_du_drv.c
>> index 470d34da1d6c4..e5eca8691a331 100644
>> --- a/drivers/gpu/drm/renesas/rz-du/rzg2l_du_drv.c
>> +++ b/drivers/gpu/drm/renesas/rz-du/rzg2l_du_drv.c
>> @@ -14,7 +14,7 @@
>>
>>   #include <drm/drm_atomic_helper.h>
>>   #include <drm/drm_drv.h>
>> -#include <drm/drm_fbdev_generic.h>
>> +#include <drm/drm_fbdev_dma.h>
>>   #include <drm/drm_gem_dma_helper.h>
>>   #include <drm/drm_probe_helper.h>
>>
>> @@ -149,7 +149,7 @@ static int rzg2l_du_probe(struct platform_device *pdev)
>>
>>   	drm_info(&rcdu->ddev, "Device %s probed\n", dev_name(&pdev->dev));
>>
>> -	drm_fbdev_generic_setup(&rcdu->ddev, 32);
>> +	drm_fbdev_dma_setup(&rcdu->ddev, 32);
>>
>>   	return 0;
>>
>> --
>> 2.44.0

-- 
--
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)


^ permalink raw reply	[flat|nested] 78+ messages in thread

* Re: [PATCH 08/43] drm/fbdev: Add fbdev-shmem
  2024-03-13  8:19     ` Thomas Zimmermann
@ 2024-03-13  9:03       ` Geert Uytterhoeven
  2024-03-13  9:24         ` Thomas Zimmermann
  0 siblings, 1 reply; 78+ messages in thread
From: Geert Uytterhoeven @ 2024-03-13  9:03 UTC (permalink / raw)
  To: Thomas Zimmermann
  Cc: daniel, airlied, deller, javierm, linux-fbdev, dri-devel

Hi Thomas,

On Wed, Mar 13, 2024 at 9:19 AM Thomas Zimmermann <tzimmermann@suse.de> wrote:
> Am 12.03.24 um 17:14 schrieb Geert Uytterhoeven:
> > On Tue, Mar 12, 2024 at 4:48 PM Thomas Zimmermann <tzimmermann@suse.de> wrote:
> >> Add an fbdev emulation for SHMEM-based memory managers. The code is
> >> similar to fbdev-generic, but does not require an addition shadow
> >> buffer for mmap(). Fbdev-shmem operates directly on the buffer object's
> >> SHMEM pages. Fbdev's deferred-I/O mechanism updates the hardware state
> >> on write operations.
> >>
> >> Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
> > Thanks for your patch!
> >
> >> --- /dev/null
> >> +++ b/drivers/gpu/drm/drm_fbdev_shmem.c
> >> +static int drm_fbdev_shmem_helper_fb_probe(struct drm_fb_helper *fb_helper,
> >> +                                          struct drm_fb_helper_surface_size *sizes)
> >> +{
> >> +       struct drm_client_dev *client = &fb_helper->client;
> >> +       struct drm_device *dev = fb_helper->dev;
> >> +       struct drm_client_buffer *buffer;
> >> +       struct drm_gem_shmem_object *shmem;
> >> +       struct drm_framebuffer *fb;
> >> +       struct fb_info *info;
> >> +       u32 format;
> >> +       struct iosys_map map;
> >> +       int ret;
> >> +
> >> +       drm_dbg_kms(dev, "surface width(%d), height(%d) and bpp(%d)\n",
> >> +                   sizes->surface_width, sizes->surface_height,
> >> +                   sizes->surface_bpp);
> >> +
> >> +       format = drm_mode_legacy_fb_format(sizes->surface_bpp, sizes->surface_depth);
> > Oops, one more caller of the imprecise
> > let's-guess-the-format-from-bpp-and-depth machinery to get rid of...
>
> Right, that has been discussed in another thread. I'll change this call
> to the drm_driver_() function.

You mean drm_driver_legacy_fb_format()? That has the same issues.

> >> +       buffer = drm_client_framebuffer_create(client, sizes->surface_width,
> >> +                                              sizes->surface_height, format);
> > [...]
> >
> >> +}
> >> +/**
> >> + * drm_fbdev_shmem_setup() - Setup fbdev emulation for GEM SHMEM helpers
> >> + * @dev: DRM device
> >> + * @preferred_bpp: Preferred bits per pixel for the device.
> >> + *                 32 is used if this is zero.
> >> + *
> >> + * This function sets up fbdev emulation for GEM DMA drivers that support
> >> + * dumb buffers with a virtual address and that can be mmap'ed.
> >> + * drm_fbdev_shmem_setup() shall be called after the DRM driver registered
> >> + * the new DRM device with drm_dev_register().
> >> + *
> >> + * Restore, hotplug events and teardown are all taken care of. Drivers that do
> >> + * suspend/resume need to call drm_fb_helper_set_suspend_unlocked() themselves.
> >> + * Simple drivers might use drm_mode_config_helper_suspend().
> >> + *
> >> + * This function is safe to call even when there are no connectors present.
> >> + * Setup will be retried on the next hotplug event.
> >> + *
> >> + * The fbdev is destroyed by drm_dev_unregister().
> >> + */
> >> +void drm_fbdev_shmem_setup(struct drm_device *dev, unsigned int preferred_bpp)
> > As this is a completely new function, can we please get a
> > preferred_format parameter instead?
>
> An understandable question. But as it is, the patchset has a trivial
> change in each driver. And the preferred_bpp parameter has the same
> meaning as the bpp value in the video= parameter. So it's ok-ish for now.

OK.

> Using a format parameter here is really a much larger update and touches
> the internals of the fbdev emulation. I'm not even sure that we should
> have a parameter at all. Since in-kernel clients should behave like
> userspace clients, we could try to figure out the format from the
> driver's primary planes. That's a patchset of its own.

How do you figure out "the" format from the driver's primary plane?
Isn't that a list of formats (always including XR24) , so the driver
still needs to specify a preferred format?

A while ago, I had a look into replacing preferred_{depth,bpp} by
preferred_format, but I was held back by the inconsistencies in some
drivers (e.g. depth 24 vs. 32).  Perhaps an incremental approach
(use preferred_format if available, else fall back to legacy
preferred_{depth,bpp} handling) would be more suitable?

FTR, my main use-case is letting fbdev emulation distinguish between
DRM_FORMAT_Rx and DRM_FORMAT_Cx, which share the values of depth
and bpp.

Gr{oetje,eeting}s,

                        Geert

-- 
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
                                -- Linus Torvalds

^ permalink raw reply	[flat|nested] 78+ messages in thread

* Re: [PATCH 08/43] drm/fbdev: Add fbdev-shmem
  2024-03-13  9:03       ` Geert Uytterhoeven
@ 2024-03-13  9:24         ` Thomas Zimmermann
  2024-03-13  9:56           ` Geert Uytterhoeven
  0 siblings, 1 reply; 78+ messages in thread
From: Thomas Zimmermann @ 2024-03-13  9:24 UTC (permalink / raw)
  To: Geert Uytterhoeven
  Cc: daniel, airlied, deller, javierm, linux-fbdev, dri-devel

Hi

Am 13.03.24 um 10:03 schrieb Geert Uytterhoeven:
> Hi Thomas,
>
> On Wed, Mar 13, 2024 at 9:19 AM Thomas Zimmermann <tzimmermann@suse.de> wrote:
>> Am 12.03.24 um 17:14 schrieb Geert Uytterhoeven:
>>> On Tue, Mar 12, 2024 at 4:48 PM Thomas Zimmermann <tzimmermann@suse.de> wrote:
>>>> Add an fbdev emulation for SHMEM-based memory managers. The code is
>>>> similar to fbdev-generic, but does not require an addition shadow
>>>> buffer for mmap(). Fbdev-shmem operates directly on the buffer object's
>>>> SHMEM pages. Fbdev's deferred-I/O mechanism updates the hardware state
>>>> on write operations.
>>>>
>>>> Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
>>> Thanks for your patch!
>>>
>>>> --- /dev/null
>>>> +++ b/drivers/gpu/drm/drm_fbdev_shmem.c
>>>> +static int drm_fbdev_shmem_helper_fb_probe(struct drm_fb_helper *fb_helper,
>>>> +                                          struct drm_fb_helper_surface_size *sizes)
>>>> +{
>>>> +       struct drm_client_dev *client = &fb_helper->client;
>>>> +       struct drm_device *dev = fb_helper->dev;
>>>> +       struct drm_client_buffer *buffer;
>>>> +       struct drm_gem_shmem_object *shmem;
>>>> +       struct drm_framebuffer *fb;
>>>> +       struct fb_info *info;
>>>> +       u32 format;
>>>> +       struct iosys_map map;
>>>> +       int ret;
>>>> +
>>>> +       drm_dbg_kms(dev, "surface width(%d), height(%d) and bpp(%d)\n",
>>>> +                   sizes->surface_width, sizes->surface_height,
>>>> +                   sizes->surface_bpp);
>>>> +
>>>> +       format = drm_mode_legacy_fb_format(sizes->surface_bpp, sizes->surface_depth);
>>> Oops, one more caller of the imprecise
>>> let's-guess-the-format-from-bpp-and-depth machinery to get rid of...
>> Right, that has been discussed in another thread. I'll change this call
>> to the drm_driver_() function.
> You mean drm_driver_legacy_fb_format()? That has the same issues.

We have the video= parameter with its bpp argument. So we won't ever 
fully remove that function.

>
>>>> +       buffer = drm_client_framebuffer_create(client, sizes->surface_width,
>>>> +                                              sizes->surface_height, format);
>>> [...]
>>>
>>>> +}
>>>> +/**
>>>> + * drm_fbdev_shmem_setup() - Setup fbdev emulation for GEM SHMEM helpers
>>>> + * @dev: DRM device
>>>> + * @preferred_bpp: Preferred bits per pixel for the device.
>>>> + *                 32 is used if this is zero.
>>>> + *
>>>> + * This function sets up fbdev emulation for GEM DMA drivers that support
>>>> + * dumb buffers with a virtual address and that can be mmap'ed.
>>>> + * drm_fbdev_shmem_setup() shall be called after the DRM driver registered
>>>> + * the new DRM device with drm_dev_register().
>>>> + *
>>>> + * Restore, hotplug events and teardown are all taken care of. Drivers that do
>>>> + * suspend/resume need to call drm_fb_helper_set_suspend_unlocked() themselves.
>>>> + * Simple drivers might use drm_mode_config_helper_suspend().
>>>> + *
>>>> + * This function is safe to call even when there are no connectors present.
>>>> + * Setup will be retried on the next hotplug event.
>>>> + *
>>>> + * The fbdev is destroyed by drm_dev_unregister().
>>>> + */
>>>> +void drm_fbdev_shmem_setup(struct drm_device *dev, unsigned int preferred_bpp)
>>> As this is a completely new function, can we please get a
>>> preferred_format parameter instead?
>> An understandable question. But as it is, the patchset has a trivial
>> change in each driver. And the preferred_bpp parameter has the same
>> meaning as the bpp value in the video= parameter. So it's ok-ish for now.
> OK.
>
>> Using a format parameter here is really a much larger update and touches
>> the internals of the fbdev emulation. I'm not even sure that we should
>> have a parameter at all. Since in-kernel clients should behave like
>> userspace clients, we could try to figure out the format from the
>> driver's primary planes. That's a patchset of its own.
> How do you figure out "the" format from the driver's primary plane?
> Isn't that a list of formats (always including XR24) , so the driver
> still needs to specify a preferred format?

The list of formats for each plane is roughly sorted by preference. We 
can go through it and pick the first format that is supported by the 
fbdev code. That's likely how userspace would do it.

>
> A while ago, I had a look into replacing preferred_{depth,bpp} by
> preferred_format, but I was held back by the inconsistencies in some
> drivers (e.g. depth 24 vs. 32).  Perhaps an incremental approach
> (use preferred_format if available, else fall back to legacy
> preferred_{depth,bpp} handling) would be more suitable?

I have initial patches to move format selection from the fb_probe 
helpers into the shared helpers. That allows to remove the surface_depth 
and surface_bpp fields. That is at least a step into the right direction.

>
> FTR, my main use-case is letting fbdev emulation distinguish between
> DRM_FORMAT_Rx and DRM_FORMAT_Cx, which share the values of depth
> and bpp.

How are they used for the framebuffer console? Shouldn't it always be 
_Cx? _Rx is just monochrome AFAIU.

Best regards
Thomas

>
> Gr{oetje,eeting}s,
>
>                          Geert
>

-- 
--
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)


^ permalink raw reply	[flat|nested] 78+ messages in thread

* Re: [PATCH 08/43] drm/fbdev: Add fbdev-shmem
  2024-03-13  9:24         ` Thomas Zimmermann
@ 2024-03-13  9:56           ` Geert Uytterhoeven
  0 siblings, 0 replies; 78+ messages in thread
From: Geert Uytterhoeven @ 2024-03-13  9:56 UTC (permalink / raw)
  To: Thomas Zimmermann
  Cc: daniel, airlied, deller, javierm, linux-fbdev, dri-devel

Hi Thomas,

On Wed, Mar 13, 2024 at 10:24 AM Thomas Zimmermann <tzimmermann@suse.de> wrote:
> Am 13.03.24 um 10:03 schrieb Geert Uytterhoeven:
> > On Wed, Mar 13, 2024 at 9:19 AM Thomas Zimmermann <tzimmermann@suse.de> wrote:
> >> Am 12.03.24 um 17:14 schrieb Geert Uytterhoeven:
> >>> On Tue, Mar 12, 2024 at 4:48 PM Thomas Zimmermann <tzimmermann@suse.de> wrote:
> >>>> Add an fbdev emulation for SHMEM-based memory managers. The code is
> >>>> similar to fbdev-generic, but does not require an addition shadow
> >>>> buffer for mmap(). Fbdev-shmem operates directly on the buffer object's
> >>>> SHMEM pages. Fbdev's deferred-I/O mechanism updates the hardware state
> >>>> on write operations.
> >>>>
> >>>> Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
> >>> Thanks for your patch!
> >>>
> >>>> --- /dev/null
> >>>> +++ b/drivers/gpu/drm/drm_fbdev_shmem.c
> >>>> +static int drm_fbdev_shmem_helper_fb_probe(struct drm_fb_helper *fb_helper,
> >>>> +                                          struct drm_fb_helper_surface_size *sizes)
> >>>> +{
> >>>> +       struct drm_client_dev *client = &fb_helper->client;
> >>>> +       struct drm_device *dev = fb_helper->dev;
> >>>> +       struct drm_client_buffer *buffer;
> >>>> +       struct drm_gem_shmem_object *shmem;
> >>>> +       struct drm_framebuffer *fb;
> >>>> +       struct fb_info *info;
> >>>> +       u32 format;
> >>>> +       struct iosys_map map;
> >>>> +       int ret;
> >>>> +
> >>>> +       drm_dbg_kms(dev, "surface width(%d), height(%d) and bpp(%d)\n",
> >>>> +                   sizes->surface_width, sizes->surface_height,
> >>>> +                   sizes->surface_bpp);
> >>>> +
> >>>> +       format = drm_mode_legacy_fb_format(sizes->surface_bpp, sizes->surface_depth);
> >>> Oops, one more caller of the imprecise
> >>> let's-guess-the-format-from-bpp-and-depth machinery to get rid of...
> >> Right, that has been discussed in another thread. I'll change this call
> >> to the drm_driver_() function.
> > You mean drm_driver_legacy_fb_format()? That has the same issues.
>
> We have the video= parameter with its bpp argument. So we won't ever
> fully remove that function.

For that to work with monochrome and greyscale displays, it should
fall back to DRM_FORMAT_Rx (or _Dx) if depth <= 8 and DRM_FORMAT_Cx
is not supported by the underlying primary plane or driver.

Hmm, perhaps I should indeed implement the fallback in
drm_driver_legacy_fb_format() instead of drm_fb_helper_find_format()
(like I did in [1]).

> >>>> +       buffer = drm_client_framebuffer_create(client, sizes->surface_width,
> >>>> +                                              sizes->surface_height, format);
> >>> [...]
> >>>
> >>>> +}
> >>>> +/**
> >>>> + * drm_fbdev_shmem_setup() - Setup fbdev emulation for GEM SHMEM helpers
> >>>> + * @dev: DRM device
> >>>> + * @preferred_bpp: Preferred bits per pixel for the device.
> >>>> + *                 32 is used if this is zero.
> >>>> + *
> >>>> + * This function sets up fbdev emulation for GEM DMA drivers that support
> >>>> + * dumb buffers with a virtual address and that can be mmap'ed.
> >>>> + * drm_fbdev_shmem_setup() shall be called after the DRM driver registered
> >>>> + * the new DRM device with drm_dev_register().
> >>>> + *
> >>>> + * Restore, hotplug events and teardown are all taken care of. Drivers that do
> >>>> + * suspend/resume need to call drm_fb_helper_set_suspend_unlocked() themselves.
> >>>> + * Simple drivers might use drm_mode_config_helper_suspend().
> >>>> + *
> >>>> + * This function is safe to call even when there are no connectors present.
> >>>> + * Setup will be retried on the next hotplug event.
> >>>> + *
> >>>> + * The fbdev is destroyed by drm_dev_unregister().
> >>>> + */
> >>>> +void drm_fbdev_shmem_setup(struct drm_device *dev, unsigned int preferred_bpp)
> >>> As this is a completely new function, can we please get a
> >>> preferred_format parameter instead?
> >> An understandable question. But as it is, the patchset has a trivial
> >> change in each driver. And the preferred_bpp parameter has the same
> >> meaning as the bpp value in the video= parameter. So it's ok-ish for now.
> > OK.
> >
> >> Using a format parameter here is really a much larger update and touches
> >> the internals of the fbdev emulation. I'm not even sure that we should
> >> have a parameter at all. Since in-kernel clients should behave like
> >> userspace clients, we could try to figure out the format from the
> >> driver's primary planes. That's a patchset of its own.
> > How do you figure out "the" format from the driver's primary plane?
> > Isn't that a list of formats (always including XR24) , so the driver
> > still needs to specify a preferred format?
>
> The list of formats for each plane is roughly sorted by preference. We
> can go through it and pick the first format that is supported by the
> fbdev code. That's likely how userspace would do it.

OK.

> > A while ago, I had a look into replacing preferred_{depth,bpp} by
> > preferred_format, but I was held back by the inconsistencies in some
> > drivers (e.g. depth 24 vs. 32).  Perhaps an incremental approach
> > (use preferred_format if available, else fall back to legacy
> > preferred_{depth,bpp} handling) would be more suitable?
>
> I have initial patches to move format selection from the fb_probe
> helpers into the shared helpers. That allows to remove the surface_depth
> and surface_bpp fields. That is at least a step into the right direction.

Thanks, I am looking forward to that...

> > FTR, my main use-case is letting fbdev emulation distinguish between
> > DRM_FORMAT_Rx and DRM_FORMAT_Cx, which share the values of depth
> > and bpp.
>
> How are they used for the framebuffer console? Shouldn't it always be
> _Cx? _Rx is just monochrome AFAIU.

The fbdev console supports monochrome (including bold, underline, and
reverse video!) and grayscale text, too.  I proposed adding support
for monochrome to the DRM fbdev emulation in [2].  Javier will be able
to make use of grayscale for the Solomon SSD132x controllers to improve
console performance.

[1] "[PATCH 7/8] drm/fb-helper: Add support for DRM_FORMAT_R1"
    https://lore.kernel.org/r/ea0d68ef5630fe9748a11e50f6d79f79a768ebdb.1689252746.git.geert@linux-m68k.org/
[2] "PATCH 0/8] drm: fb-helper/ssd130x: Add support for DRM_FORMAT_R1"
    https://lore.kernel.org/r/cover.1689252746.git.geert@linux-m68k.org/

Gr{oetje,eeting}s,

                        Geert

-- 
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
                                -- Linus Torvalds

^ permalink raw reply	[flat|nested] 78+ messages in thread

* Re: [PATCH 22/43] drm/arm/komeda: Use fbdev-dma
  2024-03-12 15:45 ` [PATCH 22/43] drm/arm/komeda: Use fbdev-dma Thomas Zimmermann
@ 2024-03-13 10:53   ` Liviu Dudau
  0 siblings, 0 replies; 78+ messages in thread
From: Liviu Dudau @ 2024-03-13 10:53 UTC (permalink / raw)
  To: Thomas Zimmermann
  Cc: daniel, airlied, deller, javierm, linux-fbdev, dri-devel

On Tue, Mar 12, 2024 at 04:45:17PM +0100, Thomas Zimmermann wrote:
> Implement fbdev emulation with fbdev-dma. Fbdev-dma now supports
> damage handling, which is required by komeda. Avoids the overhead of
> fbdev-generic's additional shadow buffering. No functional changes.
> 
> Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
> Cc: Liviu Dudau <liviu.dudau@arm.com>

Acked-by: Liviu Dudau <liviu.dudau@arm.com>

Best regards,
Liviu


> ---
>  drivers/gpu/drm/arm/display/komeda/komeda_drv.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/gpu/drm/arm/display/komeda/komeda_drv.c b/drivers/gpu/drm/arm/display/komeda/komeda_drv.c
> index cc57ea4e13ae6..ffdeec3b3f2ea 100644
> --- a/drivers/gpu/drm/arm/display/komeda/komeda_drv.c
> +++ b/drivers/gpu/drm/arm/display/komeda/komeda_drv.c
> @@ -9,7 +9,7 @@
>  #include <linux/of.h>
>  #include <linux/platform_device.h>
>  #include <linux/pm_runtime.h>
> -#include <drm/drm_fbdev_generic.h>
> +#include <drm/drm_fbdev_dma.h>
>  #include <drm/drm_module.h>
>  #include <drm/drm_of.h>
>  #include "komeda_dev.h"
> @@ -80,7 +80,7 @@ static int komeda_platform_probe(struct platform_device *pdev)
>  	}
>  
>  	dev_set_drvdata(dev, mdrv);
> -	drm_fbdev_generic_setup(&mdrv->kms->base, 32);
> +	drm_fbdev_dma_setup(&mdrv->kms->base, 32);
>  
>  	return 0;
>  
> -- 
> 2.44.0
> 

-- 
====================
| I would like to |
| fix the world,  |
| but they're not |
| giving me the   |
 \ source code!  /
  ---------------
    ¯\_(ツ)_/¯

^ permalink raw reply	[flat|nested] 78+ messages in thread

* Re: [PATCH 09/43] drm/ast: Use fbdev-shmem
  2024-03-12 15:45 ` [PATCH 09/43] drm/ast: Use fbdev-shmem Thomas Zimmermann
@ 2024-03-13 14:03   ` Jocelyn Falempe
  0 siblings, 0 replies; 78+ messages in thread
From: Jocelyn Falempe @ 2024-03-13 14:03 UTC (permalink / raw)
  To: Thomas Zimmermann, daniel, airlied, deller, javierm
  Cc: linux-fbdev, dri-devel, Dave Airlie

Hi,

Thanks, it looks good to me.

Reviewed-by: Jocelyn Falempe <jfalempe@redhat.com>

-- 

Jocelyn

On 12/03/2024 16:45, Thomas Zimmermann wrote:
> Implement fbdev emulation with fbdev-shmem. Avoids the overhead of
> fbdev-generic's additional shadow buffering. No functional changes.
> 
> Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
> Cc: Dave Airlie <airlied@redhat.com>
> Cc: Thomas Zimmermann <tzimmermann@suse.de>
> Cc: Jocelyn Falempe <jfalempe@redhat.com>
> ---
>   drivers/gpu/drm/ast/ast_drv.c | 4 ++--
>   1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/gpu/drm/ast/ast_drv.c b/drivers/gpu/drm/ast/ast_drv.c
> index 90bcb1eb9cd94..4fcab4304e176 100644
> --- a/drivers/gpu/drm/ast/ast_drv.c
> +++ b/drivers/gpu/drm/ast/ast_drv.c
> @@ -32,7 +32,7 @@
>   #include <drm/drm_aperture.h>
>   #include <drm/drm_atomic_helper.h>
>   #include <drm/drm_drv.h>
> -#include <drm/drm_fbdev_generic.h>
> +#include <drm/drm_fbdev_shmem.h>
>   #include <drm/drm_gem_shmem_helper.h>
>   #include <drm/drm_module.h>
>   #include <drm/drm_probe_helper.h>
> @@ -359,7 +359,7 @@ static int ast_pci_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
>   	if (ret)
>   		return ret;
>   
> -	drm_fbdev_generic_setup(drm, 32);
> +	drm_fbdev_shmem_setup(drm, 32);
>   
>   	return 0;
>   }


^ permalink raw reply	[flat|nested] 78+ messages in thread

* Re: [PATCH 12/43] drm/mgag200: Use fbdev-shmem
  2024-03-12 15:45 ` [PATCH 12/43] drm/mgag200: " Thomas Zimmermann
@ 2024-03-13 14:03   ` Jocelyn Falempe
  2024-03-18  7:56     ` Thomas Zimmermann
  0 siblings, 1 reply; 78+ messages in thread
From: Jocelyn Falempe @ 2024-03-13 14:03 UTC (permalink / raw)
  To: Thomas Zimmermann, daniel, airlied, deller, javierm
  Cc: linux-fbdev, dri-devel, Dave Airlie

Hi,

Thanks, it looks good to me.

Reviewed-by: Jocelyn Falempe <jfalempe@redhat.com>

-- 

Jocelyn

On 12/03/2024 16:45, Thomas Zimmermann wrote:
> Implement fbdev emulation with fbdev-shmem. Avoids the overhead of
> fbdev-generic's additional shadow buffering. No functional changes.
> 
> Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
> Cc: Dave Airlie <airlied@redhat.com>
> Cc: Thomas Zimmermann <tzimmermann@suse.de>
> Cc: Jocelyn Falempe <jfalempe@redhat.com>
> ---
>   drivers/gpu/drm/mgag200/mgag200_drv.c | 4 ++--
>   1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/gpu/drm/mgag200/mgag200_drv.c b/drivers/gpu/drm/mgag200/mgag200_drv.c
> index 573dbe256aa8b..65f2ed18b31c5 100644
> --- a/drivers/gpu/drm/mgag200/mgag200_drv.c
> +++ b/drivers/gpu/drm/mgag200/mgag200_drv.c
> @@ -12,7 +12,7 @@
>   #include <drm/drm_aperture.h>
>   #include <drm/drm_atomic_helper.h>
>   #include <drm/drm_drv.h>
> -#include <drm/drm_fbdev_generic.h>
> +#include <drm/drm_fbdev_shmem.h>
>   #include <drm/drm_file.h>
>   #include <drm/drm_ioctl.h>
>   #include <drm/drm_managed.h>
> @@ -285,7 +285,7 @@ mgag200_pci_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
>   	 * FIXME: A 24-bit color depth does not work with 24 bpp on
>   	 * G200ER. Force 32 bpp.
>   	 */
> -	drm_fbdev_generic_setup(dev, 32);
> +	drm_fbdev_shmem_setup(dev, 32);
>   
>   	return 0;
>   }


^ permalink raw reply	[flat|nested] 78+ messages in thread

* Re: [PATCH 01/43] drm/fbdev-generic: Do not set physical framebuffer address
  2024-03-12 15:44 ` [PATCH 01/43] drm/fbdev-generic: Do not set physical framebuffer address Thomas Zimmermann
@ 2024-03-17 12:43   ` Javier Martinez Canillas
  2024-03-18  8:19     ` Thomas Zimmermann
  2024-03-18  2:35   ` Zack Rusin
  2024-03-18 22:22   ` [01/43] " Sui Jingfeng
  2 siblings, 1 reply; 78+ messages in thread
From: Javier Martinez Canillas @ 2024-03-17 12:43 UTC (permalink / raw)
  To: Thomas Zimmermann, daniel, airlied, deller
  Cc: linux-fbdev, dri-devel, Thomas Zimmermann, Zack Rusin,
	Maarten Lankhorst, Maxime Ripard, stable

Thomas Zimmermann <tzimmermann@suse.de> writes:

Hello Thomas,

> Framebuffer memory is allocated via vmalloc() from non-contiguous

It's vmalloc() true, but through vzmalloc() so I would mention that
function instead in the commit message.

> physical pages. The physical framebuffer start address is therefore
> meaningless. Do not set it.
>
> The value is not used within the kernel and only exported to userspace
> on dedicated ARM configs. No functional change is expected.
>

How's that info used? Does user-space assumes that the whole memory range
is contiguous in physical memory or just cares about the phyisical start
address ?

> Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
> Fixes: a5b44c4adb16 ("drm/fbdev-generic: Always use shadow buffering")
> Cc: Thomas Zimmermann <tzimmermann@suse.de>
> Cc: Javier Martinez Canillas <javierm@redhat.com>
> Cc: Zack Rusin <zackr@vmware.com>
> Cc: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
> Cc: Maxime Ripard <mripard@kernel.org>
> Cc: <stable@vger.kernel.org> # v6.4+
> ---
>  drivers/gpu/drm/drm_fbdev_generic.c | 1 -
>  1 file changed, 1 deletion(-)
>
> diff --git a/drivers/gpu/drm/drm_fbdev_generic.c b/drivers/gpu/drm/drm_fbdev_generic.c
> index d647d89764cb9..b4659cd6285ab 100644
> --- a/drivers/gpu/drm/drm_fbdev_generic.c
> +++ b/drivers/gpu/drm/drm_fbdev_generic.c
> @@ -113,7 +113,6 @@ static int drm_fbdev_generic_helper_fb_probe(struct drm_fb_helper *fb_helper,
>  	/* screen */
>  	info->flags |= FBINFO_VIRTFB | FBINFO_READS_FAST;
>  	info->screen_buffer = screen_buffer;
> -	info->fix.smem_start = page_to_phys(vmalloc_to_page(info->screen_buffer));
>  	info->fix.smem_len = screen_size;
>  

Makes sense:

Reviewed-by: Javier Martinez Canillas <javierm@redhat.com>

What about drivers/gpu/drm/drm_fb_helper.c btw? Since the memory range
allocated may not be physically contiguous if a platform uses an IOMMU ?

Asking because I don't really know how these exported values are used...
I just know that is when the CONFIG_DRM_FBDEV_LEAK_PHYS_SMEM is enabled.

--
Best regards,

Javier Martinez Canillas
Core Platforms
Red Hat


^ permalink raw reply	[flat|nested] 78+ messages in thread

* Re: [PATCH 02/43] fbdev/deferred-io: Move pageref setup into separate helper
  2024-03-12 15:44 ` [PATCH 02/43] fbdev/deferred-io: Move pageref setup into separate helper Thomas Zimmermann
@ 2024-03-17 12:49   ` Javier Martinez Canillas
  0 siblings, 0 replies; 78+ messages in thread
From: Javier Martinez Canillas @ 2024-03-17 12:49 UTC (permalink / raw)
  To: Thomas Zimmermann, daniel, airlied, deller
  Cc: linux-fbdev, dri-devel, Thomas Zimmermann

Thomas Zimmermann <tzimmermann@suse.de> writes:

> Set up struct fb_deferred_io_pageref in th new helper function

the

> fb_deferred_io_pageref_lookup(), which runs when the pageref is first
> taken. Remove the setup code from the rest of the code.
>
> At first, the code allocates the memory of all pageref structs. The
> setup of the various fields happens when the pageref is required.
>
> Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
> ---

Reviewed-by: Javier Martinez Canillas <javierm@redhat.com>

-- 
Best regards,

Javier Martinez Canillas
Core Platforms
Red Hat


^ permalink raw reply	[flat|nested] 78+ messages in thread

* Re: [PATCH 03/43] fbdev/deferred-io: Clean up pageref on lastclose
  2024-03-12 15:44 ` [PATCH 03/43] fbdev/deferred-io: Clean up pageref on lastclose Thomas Zimmermann
@ 2024-03-17 13:19   ` Javier Martinez Canillas
  0 siblings, 0 replies; 78+ messages in thread
From: Javier Martinez Canillas @ 2024-03-17 13:19 UTC (permalink / raw)
  To: Thomas Zimmermann, daniel, airlied, deller
  Cc: linux-fbdev, dri-devel, Thomas Zimmermann

Thomas Zimmermann <tzimmermann@suse.de> writes:

> Clean up the pageref state as part of the lastclose helper. This
> only requirs to clear the page's mapping field. The pageref and

requires

> page can stay in place for the next opened instance of the frame-
> buffer file.
>
> With the change in the clean-up logic, here's no further need

there's

> to lookup pages during the lastclose cleanup. The code instead
> uses the existing pagerefs in its look-up table. It also avoids
> using smem_len, which some driver might not set correctly.
>
> Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
> ---

Reviewed-by: Javier Martinez Canillas <javierm@redhat.com>

-- 
Best regards,

Javier Martinez Canillas
Core Platforms
Red Hat


^ permalink raw reply	[flat|nested] 78+ messages in thread

* Re: [PATCH 04/43] fbdev/deferred-io: Test screen_buffer for vmalloc'ed memory
  2024-03-12 15:44 ` [PATCH 04/43] fbdev/deferred-io: Test screen_buffer for vmalloc'ed memory Thomas Zimmermann
@ 2024-03-17 13:20   ` Javier Martinez Canillas
  0 siblings, 0 replies; 78+ messages in thread
From: Javier Martinez Canillas @ 2024-03-17 13:20 UTC (permalink / raw)
  To: Thomas Zimmermann, daniel, airlied, deller
  Cc: linux-fbdev, dri-devel, Thomas Zimmermann

Thomas Zimmermann <tzimmermann@suse.de> writes:

> Framebuffers in virtual memory are available via screen_buffer. Use
> it instead of screen_base and avoid the type casting.
>
> Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
> ---

Reviewed-by: Javier Martinez Canillas <javierm@redhat.com>

-- 
Best regards,

Javier Martinez Canillas
Core Platforms
Red Hat


^ permalink raw reply	[flat|nested] 78+ messages in thread

* Re: [PATCH 10/43] drm/gud: Use fbdev-shmem
  2024-03-12 15:45 ` [PATCH 10/43] drm/gud: " Thomas Zimmermann
@ 2024-03-17 19:21   ` Noralf Trønnes
  0 siblings, 0 replies; 78+ messages in thread
From: Noralf Trønnes @ 2024-03-17 19:21 UTC (permalink / raw)
  To: Thomas Zimmermann, daniel, airlied, deller, javierm
  Cc: linux-fbdev, dri-devel, noralf



On 3/12/24 16:45, Thomas Zimmermann wrote:
> Implement fbdev emulation with fbdev-shmem. Avoids the overhead of
> fbdev-generic's additional shadow buffering. No functional changes.
> 
> Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
> Cc: "Noralf Trønnes" <noralf@tronnes.org>
> ---

Acked-by: Noralf Trønnes <noralf@tronnes.org>

^ permalink raw reply	[flat|nested] 78+ messages in thread

* Re: [PATCH 37/43] drm/tiny/mi0283qt: Use fbdev-dma
  2024-03-12 15:45 ` [PATCH 37/43] drm/tiny/mi0283qt: " Thomas Zimmermann
@ 2024-03-17 19:21   ` Noralf Trønnes
  0 siblings, 0 replies; 78+ messages in thread
From: Noralf Trønnes @ 2024-03-17 19:21 UTC (permalink / raw)
  To: Thomas Zimmermann, daniel, airlied, deller, javierm
  Cc: linux-fbdev, dri-devel, noralf



On 3/12/24 16:45, Thomas Zimmermann wrote:
> Implement fbdev emulation with fbdev-dma. Fbdev-dma now supports
> damage handling, which is required by mi0283qt. Avoids the overhead of
> fbdev-generic's additional shadow buffering. No functional changes.
> 
> Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
> Cc: "Noralf Trønnes" <noralf@tronnes.org>
> ---
>  drivers/gpu/drm/tiny/mi0283qt.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 

Acked-by: Noralf Trønnes <noralf@tronnes.org>

^ permalink raw reply	[flat|nested] 78+ messages in thread

* Re: [PATCH 38/43] drm/tiny/panel-mipi-dbi: Use fbdev-dma
  2024-03-12 15:45 ` [PATCH 38/43] drm/tiny/panel-mipi-dbi: " Thomas Zimmermann
@ 2024-03-17 19:22   ` Noralf Trønnes
  0 siblings, 0 replies; 78+ messages in thread
From: Noralf Trønnes @ 2024-03-17 19:22 UTC (permalink / raw)
  To: Thomas Zimmermann, daniel, airlied, deller, javierm
  Cc: linux-fbdev, dri-devel, noralf



On 3/12/24 16:45, Thomas Zimmermann wrote:
> Implement fbdev emulation with fbdev-dma. Fbdev-dma now supports
> damage handling, which is required by panel-mipi-dbi. Avoids the
> overhead of fbdev-generic's additional shadow buffering. No functional
> changes.
> 
> Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
> Cc: "Noralf Trønnes" <noralf@tronnes.org>
> ---
>  drivers/gpu/drm/tiny/panel-mipi-dbi.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 

Acked-by: Noralf Trønnes <noralf@tronnes.org>

^ permalink raw reply	[flat|nested] 78+ messages in thread

* Re: [PATCH 39/43] drm/tiny/repaper: Use fbdev-dma
  2024-03-12 15:45 ` [PATCH 39/43] drm/tiny/repaper: " Thomas Zimmermann
@ 2024-03-17 19:22   ` Noralf Trønnes
  0 siblings, 0 replies; 78+ messages in thread
From: Noralf Trønnes @ 2024-03-17 19:22 UTC (permalink / raw)
  To: Thomas Zimmermann, daniel, airlied, deller, javierm
  Cc: linux-fbdev, dri-devel, noralf



On 3/12/24 16:45, Thomas Zimmermann wrote:
> Implement fbdev emulation with fbdev-dma. Fbdev-dma now supports
> damage handling, which is required by repaper. Avoids the overhead of
> fbdev-generic's additional shadow buffering. No functional changes.
> 
> Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
> Cc: "Noralf Trønnes" <noralf@tronnes.org>
> ---
>  drivers/gpu/drm/tiny/repaper.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 

Acked-by: Noralf Trønnes <noralf@tronnes.org>

^ permalink raw reply	[flat|nested] 78+ messages in thread

* Re: [PATCH 01/43] drm/fbdev-generic: Do not set physical framebuffer address
  2024-03-12 15:44 ` [PATCH 01/43] drm/fbdev-generic: Do not set physical framebuffer address Thomas Zimmermann
  2024-03-17 12:43   ` Javier Martinez Canillas
@ 2024-03-18  2:35   ` Zack Rusin
  2024-03-18  7:59     ` Thomas Zimmermann
  2024-03-18 22:22   ` [01/43] " Sui Jingfeng
  2 siblings, 1 reply; 78+ messages in thread
From: Zack Rusin @ 2024-03-18  2:35 UTC (permalink / raw)
  To: Thomas Zimmermann
  Cc: daniel, airlied, deller, javierm, linux-fbdev, dri-devel,
	Zack Rusin, Maarten Lankhorst, Maxime Ripard, stable

On Tue, Mar 12, 2024 at 11:48 AM Thomas Zimmermann <tzimmermann@suse.de> wrote:
>
> Framebuffer memory is allocated via vmalloc() from non-contiguous
> physical pages. The physical framebuffer start address is therefore
> meaningless. Do not set it.
>
> The value is not used within the kernel and only exported to userspace
> on dedicated ARM configs. No functional change is expected.
>
> Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
> Fixes: a5b44c4adb16 ("drm/fbdev-generic: Always use shadow buffering")
> Cc: Thomas Zimmermann <tzimmermann@suse.de>
> Cc: Javier Martinez Canillas <javierm@redhat.com>
> Cc: Zack Rusin <zackr@vmware.com>
> Cc: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
> Cc: Maxime Ripard <mripard@kernel.org>
> Cc: <stable@vger.kernel.org> # v6.4+
> ---
>  drivers/gpu/drm/drm_fbdev_generic.c | 1 -
>  1 file changed, 1 deletion(-)
>
> diff --git a/drivers/gpu/drm/drm_fbdev_generic.c b/drivers/gpu/drm/drm_fbdev_generic.c
> index d647d89764cb9..b4659cd6285ab 100644
> --- a/drivers/gpu/drm/drm_fbdev_generic.c
> +++ b/drivers/gpu/drm/drm_fbdev_generic.c
> @@ -113,7 +113,6 @@ static int drm_fbdev_generic_helper_fb_probe(struct drm_fb_helper *fb_helper,
>         /* screen */
>         info->flags |= FBINFO_VIRTFB | FBINFO_READS_FAST;
>         info->screen_buffer = screen_buffer;
> -       info->fix.smem_start = page_to_phys(vmalloc_to_page(info->screen_buffer));
>         info->fix.smem_len = screen_size;
>
>         /* deferred I/O */
> --
> 2.44.0
>

Good idea. I think given that drm_leak_fbdev_smem is off by default we
could remove the setting of smem_start by all of the in-tree drm
drivers (they all have open source userspace that won't mess around
with fbdev fb) - it will be reset to 0 anyway. Actually, I wonder if
we still need drm_leak_fbdev_smem at all...

Reviewed-by: Zack Rusin <zack.rusin@broadcom.com>

z

^ permalink raw reply	[flat|nested] 78+ messages in thread

* Re: [PATCH 12/43] drm/mgag200: Use fbdev-shmem
  2024-03-13 14:03   ` Jocelyn Falempe
@ 2024-03-18  7:56     ` Thomas Zimmermann
  2024-03-18  9:23       ` Jocelyn Falempe
  0 siblings, 1 reply; 78+ messages in thread
From: Thomas Zimmermann @ 2024-03-18  7:56 UTC (permalink / raw)
  To: Jocelyn Falempe, daniel, airlied, deller, javierm
  Cc: linux-fbdev, dri-devel, Dave Airlie

Hi

Am 13.03.24 um 15:03 schrieb Jocelyn Falempe:
> Hi,
>
> Thanks, it looks good to me.
>
> Reviewed-by: Jocelyn Falempe <jfalempe@redhat.com>

Thanks. Do you still have access to that broken realtime system? I 
wonder if this patch makes a difference, as there's now one large 
memcpy() less.

Best regards
Thomas

-- 
--
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)


^ permalink raw reply	[flat|nested] 78+ messages in thread

* Re: [PATCH 01/43] drm/fbdev-generic: Do not set physical framebuffer address
  2024-03-18  2:35   ` Zack Rusin
@ 2024-03-18  7:59     ` Thomas Zimmermann
  2024-03-18  8:44       ` Maxime Ripard
  0 siblings, 1 reply; 78+ messages in thread
From: Thomas Zimmermann @ 2024-03-18  7:59 UTC (permalink / raw)
  To: Zack Rusin
  Cc: daniel, airlied, deller, javierm, linux-fbdev, dri-devel,
	Zack Rusin, Maarten Lankhorst, Maxime Ripard, stable

Hi

Am 18.03.24 um 03:35 schrieb Zack Rusin:
> On Tue, Mar 12, 2024 at 11:48 AM Thomas Zimmermann <tzimmermann@suse.de> wrote:
>> Framebuffer memory is allocated via vmalloc() from non-contiguous
>> physical pages. The physical framebuffer start address is therefore
>> meaningless. Do not set it.
>>
>> The value is not used within the kernel and only exported to userspace
>> on dedicated ARM configs. No functional change is expected.
>>
>> Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
>> Fixes: a5b44c4adb16 ("drm/fbdev-generic: Always use shadow buffering")
>> Cc: Thomas Zimmermann <tzimmermann@suse.de>
>> Cc: Javier Martinez Canillas <javierm@redhat.com>
>> Cc: Zack Rusin <zackr@vmware.com>
>> Cc: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
>> Cc: Maxime Ripard <mripard@kernel.org>
>> Cc: <stable@vger.kernel.org> # v6.4+
>> ---
>>   drivers/gpu/drm/drm_fbdev_generic.c | 1 -
>>   1 file changed, 1 deletion(-)
>>
>> diff --git a/drivers/gpu/drm/drm_fbdev_generic.c b/drivers/gpu/drm/drm_fbdev_generic.c
>> index d647d89764cb9..b4659cd6285ab 100644
>> --- a/drivers/gpu/drm/drm_fbdev_generic.c
>> +++ b/drivers/gpu/drm/drm_fbdev_generic.c
>> @@ -113,7 +113,6 @@ static int drm_fbdev_generic_helper_fb_probe(struct drm_fb_helper *fb_helper,
>>          /* screen */
>>          info->flags |= FBINFO_VIRTFB | FBINFO_READS_FAST;
>>          info->screen_buffer = screen_buffer;
>> -       info->fix.smem_start = page_to_phys(vmalloc_to_page(info->screen_buffer));
>>          info->fix.smem_len = screen_size;
>>
>>          /* deferred I/O */
>> --
>> 2.44.0
>>
> Good idea. I think given that drm_leak_fbdev_smem is off by default we
> could remove the setting of smem_start by all of the in-tree drm
> drivers (they all have open source userspace that won't mess around
> with fbdev fb) - it will be reset to 0 anyway. Actually, I wonder if
> we still need drm_leak_fbdev_smem at all...

All I know is that there's an embedded userspace driver that requires 
that setting. I don't even know which hardware.

Best regards
Thomas

>
> Reviewed-by: Zack Rusin <zack.rusin@broadcom.com>
>
> z

-- 
--
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)


^ permalink raw reply	[flat|nested] 78+ messages in thread

* Re: [PATCH 01/43] drm/fbdev-generic: Do not set physical framebuffer address
  2024-03-17 12:43   ` Javier Martinez Canillas
@ 2024-03-18  8:19     ` Thomas Zimmermann
  0 siblings, 0 replies; 78+ messages in thread
From: Thomas Zimmermann @ 2024-03-18  8:19 UTC (permalink / raw)
  To: Javier Martinez Canillas, daniel, airlied, deller
  Cc: linux-fbdev, dri-devel, Zack Rusin, Maarten Lankhorst,
	Maxime Ripard, stable

Hi

Am 17.03.24 um 13:43 schrieb Javier Martinez Canillas:
> Thomas Zimmermann <tzimmermann@suse.de> writes:
>
> Hello Thomas,
>
>> Framebuffer memory is allocated via vmalloc() from non-contiguous
> It's vmalloc() true, but through vzmalloc() so I would mention that
> function instead in the commit message.

Ok.

>
>> physical pages. The physical framebuffer start address is therefore
>> meaningless. Do not set it.
>>
>> The value is not used within the kernel and only exported to userspace
>> on dedicated ARM configs. No functional change is expected.
>>
> How's that info used? Does user-space assumes that the whole memory range
> is contiguous in physical memory or just cares about the phyisical start
> address ?

I assume that it is supposed to refer to contiguous memory. There's the 
corresponding field smem_len, which refers to the full memory.

>
>> Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
>> Fixes: a5b44c4adb16 ("drm/fbdev-generic: Always use shadow buffering")
>> Cc: Thomas Zimmermann <tzimmermann@suse.de>
>> Cc: Javier Martinez Canillas <javierm@redhat.com>
>> Cc: Zack Rusin <zackr@vmware.com>
>> Cc: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
>> Cc: Maxime Ripard <mripard@kernel.org>
>> Cc: <stable@vger.kernel.org> # v6.4+
>> ---
>>   drivers/gpu/drm/drm_fbdev_generic.c | 1 -
>>   1 file changed, 1 deletion(-)
>>
>> diff --git a/drivers/gpu/drm/drm_fbdev_generic.c b/drivers/gpu/drm/drm_fbdev_generic.c
>> index d647d89764cb9..b4659cd6285ab 100644
>> --- a/drivers/gpu/drm/drm_fbdev_generic.c
>> +++ b/drivers/gpu/drm/drm_fbdev_generic.c
>> @@ -113,7 +113,6 @@ static int drm_fbdev_generic_helper_fb_probe(struct drm_fb_helper *fb_helper,
>>   	/* screen */
>>   	info->flags |= FBINFO_VIRTFB | FBINFO_READS_FAST;
>>   	info->screen_buffer = screen_buffer;
>> -	info->fix.smem_start = page_to_phys(vmalloc_to_page(info->screen_buffer));
>>   	info->fix.smem_len = screen_size;
>>   
> Makes sense:
>
> Reviewed-by: Javier Martinez Canillas <javierm@redhat.com>
>
> What about drivers/gpu/drm/drm_fb_helper.c btw? Since the memory range
> allocated may not be physically contiguous if a platform uses an IOMMU ?
>
> Asking because I don't really know how these exported values are used...
> I just know that is when the CONFIG_DRM_FBDEV_LEAK_PHYS_SMEM is enabled.

The value of smem_start is used in the fbdev code in only two places : 
deferred I/O [1] and devfile I/O [2]. For the former, patch 5 of this 
series adds an additional test. The latter case is only relevant for 
framebuffers in I/O memory space. But that does not affect 
fbdev-generic, which has the shadow buffer in main memory. Some 
driver-internal fbdev code sets smem_length, such as in gma500, but 
these drivers are special anyway.

For what userspace does with this value IDK. But it can't be much, as 
we've had smem_start cleared for years.

Best regards
Thomas

[1] 
https://elixir.bootlin.com/linux/v6.8/source/drivers/video/fbdev/core/fb_defio.c#L34
[2] 
https://elixir.bootlin.com/linux/v6.8/source/drivers/video/fbdev/core/fb_io_fops.c#L143

>
> --
> Best regards,
>
> Javier Martinez Canillas
> Core Platforms
> Red Hat
>
>

-- 
--
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)


^ permalink raw reply	[flat|nested] 78+ messages in thread

* Re: [PATCH 01/43] drm/fbdev-generic: Do not set physical framebuffer address
  2024-03-18  7:59     ` Thomas Zimmermann
@ 2024-03-18  8:44       ` Maxime Ripard
  2024-03-18  9:48         ` Javier Martinez Canillas
  0 siblings, 1 reply; 78+ messages in thread
From: Maxime Ripard @ 2024-03-18  8:44 UTC (permalink / raw)
  To: Thomas Zimmermann
  Cc: Zack Rusin, daniel, airlied, deller, javierm, linux-fbdev,
	dri-devel, Zack Rusin, Maarten Lankhorst, stable

[-- Attachment #1: Type: text/plain, Size: 2608 bytes --]

On Mon, Mar 18, 2024 at 08:59:01AM +0100, Thomas Zimmermann wrote:
> Hi
> 
> Am 18.03.24 um 03:35 schrieb Zack Rusin:
> > On Tue, Mar 12, 2024 at 11:48 AM Thomas Zimmermann <tzimmermann@suse.de> wrote:
> > > Framebuffer memory is allocated via vmalloc() from non-contiguous
> > > physical pages. The physical framebuffer start address is therefore
> > > meaningless. Do not set it.
> > > 
> > > The value is not used within the kernel and only exported to userspace
> > > on dedicated ARM configs. No functional change is expected.
> > > 
> > > Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
> > > Fixes: a5b44c4adb16 ("drm/fbdev-generic: Always use shadow buffering")
> > > Cc: Thomas Zimmermann <tzimmermann@suse.de>
> > > Cc: Javier Martinez Canillas <javierm@redhat.com>
> > > Cc: Zack Rusin <zackr@vmware.com>
> > > Cc: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
> > > Cc: Maxime Ripard <mripard@kernel.org>
> > > Cc: <stable@vger.kernel.org> # v6.4+
> > > ---
> > >   drivers/gpu/drm/drm_fbdev_generic.c | 1 -
> > >   1 file changed, 1 deletion(-)
> > > 
> > > diff --git a/drivers/gpu/drm/drm_fbdev_generic.c b/drivers/gpu/drm/drm_fbdev_generic.c
> > > index d647d89764cb9..b4659cd6285ab 100644
> > > --- a/drivers/gpu/drm/drm_fbdev_generic.c
> > > +++ b/drivers/gpu/drm/drm_fbdev_generic.c
> > > @@ -113,7 +113,6 @@ static int drm_fbdev_generic_helper_fb_probe(struct drm_fb_helper *fb_helper,
> > >          /* screen */
> > >          info->flags |= FBINFO_VIRTFB | FBINFO_READS_FAST;
> > >          info->screen_buffer = screen_buffer;
> > > -       info->fix.smem_start = page_to_phys(vmalloc_to_page(info->screen_buffer));
> > >          info->fix.smem_len = screen_size;
> > > 
> > >          /* deferred I/O */
> > > --
> > > 2.44.0
> > > 
> > Good idea. I think given that drm_leak_fbdev_smem is off by default we
> > could remove the setting of smem_start by all of the in-tree drm
> > drivers (they all have open source userspace that won't mess around
> > with fbdev fb) - it will be reset to 0 anyway. Actually, I wonder if
> > we still need drm_leak_fbdev_smem at all...
> 
> All I know is that there's an embedded userspace driver that requires that
> setting. I don't even know which hardware.

The original Mali driver (ie, lima) used to require it, that's why we
introduced it in the past.

I'm not sure if the newer versions of that driver, or if newer Mali
generations (ie, panfrost and panthor) closed source driver would
require it, so it might be worth removing if it's easy enough to revert.

Maxime

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 228 bytes --]

^ permalink raw reply	[flat|nested] 78+ messages in thread

* Re: [PATCH 12/43] drm/mgag200: Use fbdev-shmem
  2024-03-18  7:56     ` Thomas Zimmermann
@ 2024-03-18  9:23       ` Jocelyn Falempe
  0 siblings, 0 replies; 78+ messages in thread
From: Jocelyn Falempe @ 2024-03-18  9:23 UTC (permalink / raw)
  To: Thomas Zimmermann, daniel, airlied, deller, javierm
  Cc: linux-fbdev, dri-devel, Dave Airlie



On 18/03/2024 08:56, Thomas Zimmermann wrote:
> Hi
> 
> Am 13.03.24 um 15:03 schrieb Jocelyn Falempe:
>> Hi,
>>
>> Thanks, it looks good to me.
>>
>> Reviewed-by: Jocelyn Falempe <jfalempe@redhat.com>
> 
> Thanks. Do you still have access to that broken realtime system? I 
> wonder if this patch makes a difference, as there's now one large 
> memcpy() less.

Hi,

Sure, I'll do some latency tests if I can get access to that server again.

Best regards,

> 
> Best regards
> Thomas
> 


^ permalink raw reply	[flat|nested] 78+ messages in thread

* Re: [PATCH 01/43] drm/fbdev-generic: Do not set physical framebuffer address
  2024-03-18  8:44       ` Maxime Ripard
@ 2024-03-18  9:48         ` Javier Martinez Canillas
  0 siblings, 0 replies; 78+ messages in thread
From: Javier Martinez Canillas @ 2024-03-18  9:48 UTC (permalink / raw)
  To: Maxime Ripard, Thomas Zimmermann
  Cc: Zack Rusin, daniel, airlied, deller, linux-fbdev, dri-devel,
	Zack Rusin, Maarten Lankhorst, stable

Maxime Ripard <mripard@kernel.org> writes:

> On Mon, Mar 18, 2024 at 08:59:01AM +0100, Thomas Zimmermann wrote:
>> Hi
>> 
>> Am 18.03.24 um 03:35 schrieb Zack Rusin:
>> > On Tue, Mar 12, 2024 at 11:48 AM Thomas Zimmermann <tzimmermann@suse.de> wrote:
>> > > Framebuffer memory is allocated via vmalloc() from non-contiguous
>> > > physical pages. The physical framebuffer start address is therefore
>> > > meaningless. Do not set it.
>> > > 
>> > > The value is not used within the kernel and only exported to userspace
>> > > on dedicated ARM configs. No functional change is expected.
>> > > 
>> > > Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
>> > > Fixes: a5b44c4adb16 ("drm/fbdev-generic: Always use shadow buffering")
>> > > Cc: Thomas Zimmermann <tzimmermann@suse.de>
>> > > Cc: Javier Martinez Canillas <javierm@redhat.com>
>> > > Cc: Zack Rusin <zackr@vmware.com>
>> > > Cc: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
>> > > Cc: Maxime Ripard <mripard@kernel.org>
>> > > Cc: <stable@vger.kernel.org> # v6.4+
>> > > ---
>> > >   drivers/gpu/drm/drm_fbdev_generic.c | 1 -
>> > >   1 file changed, 1 deletion(-)
>> > > 
>> > > diff --git a/drivers/gpu/drm/drm_fbdev_generic.c b/drivers/gpu/drm/drm_fbdev_generic.c
>> > > index d647d89764cb9..b4659cd6285ab 100644
>> > > --- a/drivers/gpu/drm/drm_fbdev_generic.c
>> > > +++ b/drivers/gpu/drm/drm_fbdev_generic.c
>> > > @@ -113,7 +113,6 @@ static int drm_fbdev_generic_helper_fb_probe(struct drm_fb_helper *fb_helper,
>> > >          /* screen */
>> > >          info->flags |= FBINFO_VIRTFB | FBINFO_READS_FAST;
>> > >          info->screen_buffer = screen_buffer;
>> > > -       info->fix.smem_start = page_to_phys(vmalloc_to_page(info->screen_buffer));
>> > >          info->fix.smem_len = screen_size;
>> > > 
>> > >          /* deferred I/O */
>> > > --
>> > > 2.44.0
>> > > 
>> > Good idea. I think given that drm_leak_fbdev_smem is off by default we
>> > could remove the setting of smem_start by all of the in-tree drm
>> > drivers (they all have open source userspace that won't mess around
>> > with fbdev fb) - it will be reset to 0 anyway. Actually, I wonder if
>> > we still need drm_leak_fbdev_smem at all...
>> 
>> All I know is that there's an embedded userspace driver that requires that
>> setting. I don't even know which hardware.
>
> The original Mali driver (ie, lima) used to require it, that's why we
> introduced it in the past.
>
> I'm not sure if the newer versions of that driver, or if newer Mali
> generations (ie, panfrost and panthor) closed source driver would
> require it, so it might be worth removing if it's easy enough to revert.
>

Agreed. The DRM_FBDEV_LEAK_PHYS_SMEM symbol already depends on EXPERT and
defaults to 'n', which implies that isn't enabled by most kernels AFAICT.

So dropping it and see if anyone complains sounds like a good idea to me.

> Maxime

-- 
Best regards,

Javier Martinez Canillas
Core Platforms
Red Hat


^ permalink raw reply	[flat|nested] 78+ messages in thread

* Re: [PATCH 05/43] fbdev/deferred-io: Test smem_start for I/O memory
  2024-03-12 15:45 ` [PATCH 05/43] fbdev/deferred-io: Test smem_start for I/O memory Thomas Zimmermann
@ 2024-03-18 17:03   ` Javier Martinez Canillas
  0 siblings, 0 replies; 78+ messages in thread
From: Javier Martinez Canillas @ 2024-03-18 17:03 UTC (permalink / raw)
  To: Thomas Zimmermann, daniel, airlied, deller
  Cc: linux-fbdev, dri-devel, Thomas Zimmermann

Thomas Zimmermann <tzimmermann@suse.de> writes:

> Test smem_start before looking up pages from its value. Return
> NULL if it is unset. This will result in a SIGBUS signal.
>
> Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
> ---

Reviewed-by: Javier Martinez Canillas <javierm@redhat.com>

-- 
Best regards,

Javier Martinez Canillas
Core Platforms
Red Hat


^ permalink raw reply	[flat|nested] 78+ messages in thread

* Re: [PATCH 06/43] fbdev/deferred-io: Always call get_page() for framebuffer pages
  2024-03-12 15:45 ` [PATCH 06/43] fbdev/deferred-io: Always call get_page() for framebuffer pages Thomas Zimmermann
@ 2024-03-18 17:04   ` Javier Martinez Canillas
  0 siblings, 0 replies; 78+ messages in thread
From: Javier Martinez Canillas @ 2024-03-18 17:04 UTC (permalink / raw)
  To: Thomas Zimmermann, daniel, airlied, deller
  Cc: linux-fbdev, dri-devel, Thomas Zimmermann

Thomas Zimmermann <tzimmermann@suse.de> writes:

> Unconditionally call get_page() after looking up a page from the
> framebuffer memory. Guarantees that we always hold a reference.
>
> This change also refactors the code such that it can support a
> driver-supplied get_page helper. This will be useful for DRM's
> fbdev emulation.
>
> Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
> ---

Reviewed-by: Javier Martinez Canillas <javierm@redhat.com>

-- 
Best regards,

Javier Martinez Canillas
Core Platforms
Red Hat


^ permalink raw reply	[flat|nested] 78+ messages in thread

* Re: [PATCH 07/43] fbdev/deferred-io: Provide get_page hook in struct fb_deferred_io
  2024-03-12 15:45 ` [PATCH 07/43] fbdev/deferred-io: Provide get_page hook in struct fb_deferred_io Thomas Zimmermann
@ 2024-03-18 17:11   ` Javier Martinez Canillas
  0 siblings, 0 replies; 78+ messages in thread
From: Javier Martinez Canillas @ 2024-03-18 17:11 UTC (permalink / raw)
  To: Thomas Zimmermann, daniel, airlied, deller
  Cc: linux-fbdev, dri-devel, Thomas Zimmermann

Thomas Zimmermann <tzimmermann@suse.de> writes:

> Add a callback for drivers to provide framebuffer pages to fbdev's
> deferred-I/O helpers. Implementations need to acquire a reference on
> the page before returning it. Returning NULL generates a SIGBUS
> signal.
>
> This will be useful for DRM's fbdev emulation with GEM-shemem buffer

GEM-shmem

> objects.
>
> Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
> ---

Reviewed-by: Javier Martinez Canillas <javierm@redhat.com>

-- 
Best regards,

Javier Martinez Canillas
Core Platforms
Red Hat


^ permalink raw reply	[flat|nested] 78+ messages in thread

* Re: [01/43] drm/fbdev-generic: Do not set physical framebuffer address
  2024-03-12 15:44 ` [PATCH 01/43] drm/fbdev-generic: Do not set physical framebuffer address Thomas Zimmermann
  2024-03-17 12:43   ` Javier Martinez Canillas
  2024-03-18  2:35   ` Zack Rusin
@ 2024-03-18 22:22   ` Sui Jingfeng
  2 siblings, 0 replies; 78+ messages in thread
From: Sui Jingfeng @ 2024-03-18 22:22 UTC (permalink / raw)
  To: Thomas Zimmermann, daniel, airlied, deller, javierm
  Cc: linux-fbdev, dri-devel, Zack Rusin, Maarten Lankhorst,
	Maxime Ripard, stable

Hi,


On 2024/3/12 23:44, Thomas Zimmermann wrote:
> Framebuffer memory is allocated via vmalloc() from non-contiguous
> physical pages. The physical framebuffer start address is therefore
> meaningless. Do not set it.
>
> The value is not used within the kernel and only exported to userspace
> on dedicated ARM configs. No functional change is expected.
>
> Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
> Fixes: a5b44c4adb16 ("drm/fbdev-generic: Always use shadow buffering")
> Cc: Thomas Zimmermann <tzimmermann@suse.de>
> Cc: Javier Martinez Canillas <javierm@redhat.com>
> Cc: Zack Rusin <zackr@vmware.com>
> Cc: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
> Cc: Maxime Ripard <mripard@kernel.org>
> Cc: <stable@vger.kernel.org> # v6.4+
> Reviewed-by: Javier Martinez Canillas <javierm@redhat.com>
> Reviewed-by: Zack Rusin <zack.rusin@broadcom.com>


Reviewed-by: Sui Jingfeng <sui.jingfeng@linux.dev>

Tested-by: Sui Jingfeng <sui.jingfeng@linux.dev>

-- 
Best regards,
Sui


^ permalink raw reply	[flat|nested] 78+ messages in thread

* Re: [PATCH 19/43] drm/virtio: Use fbdev-shmem
  2024-03-12 15:45 ` [PATCH 19/43] drm/virtio: " Thomas Zimmermann
@ 2024-03-28 14:55   ` Dmitry Osipenko
  0 siblings, 0 replies; 78+ messages in thread
From: Dmitry Osipenko @ 2024-03-28 14:55 UTC (permalink / raw)
  To: Thomas Zimmermann, daniel, airlied, deller, javierm
  Cc: linux-fbdev, dri-devel, David Airlie, Gerd Hoffmann,
	Gurchetan Singh, Chia-I Wu

On 3/12/24 18:45, Thomas Zimmermann wrote:
> Implement fbdev emulation with fbdev-shmem. Avoids the overhead of
> fbdev-generic's additional shadow buffering. No functional changes.
> 
> Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
> Cc: David Airlie <airlied@redhat.com>
> Cc: Gerd Hoffmann <kraxel@redhat.com>
> Cc: Gurchetan Singh <gurchetansingh@chromium.org>
> Cc: Chia-I Wu <olvaffe@gmail.com>
> ---
>  drivers/gpu/drm/virtio/virtgpu_drv.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/gpu/drm/virtio/virtgpu_drv.c b/drivers/gpu/drm/virtio/virtgpu_drv.c
> index 9539aa28937fa..3d626bbaab9e4 100644
> --- a/drivers/gpu/drm/virtio/virtgpu_drv.c
> +++ b/drivers/gpu/drm/virtio/virtgpu_drv.c
> @@ -35,7 +35,7 @@
>  #include <drm/drm_aperture.h>
>  #include <drm/drm_atomic_helper.h>
>  #include <drm/drm_drv.h>
> -#include <drm/drm_fbdev_generic.h>
> +#include <drm/drm_fbdev_shmem.h>
>  #include <drm/drm_file.h>
>  
>  #include "virtgpu_drv.h"
> @@ -103,7 +103,7 @@ static int virtio_gpu_probe(struct virtio_device *vdev)
>  	if (ret)
>  		goto err_deinit;
>  
> -	drm_fbdev_generic_setup(vdev->priv, 32);
> +	drm_fbdev_shmem_setup(vdev->priv, 32);
>  	return 0;
>  
>  err_deinit:

Tested-by: Dmitry Osipenko <dmitry.osipenko@collabora.com>

-- 
Best regards,
Dmitry


^ permalink raw reply	[flat|nested] 78+ messages in thread

end of thread, other threads:[~2024-03-28 14:56 UTC | newest]

Thread overview: 78+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-03-12 15:44 [PATCH 00/43] drm: Provide fbdev emulation per memory manager Thomas Zimmermann
2024-03-12 15:44 ` [PATCH 01/43] drm/fbdev-generic: Do not set physical framebuffer address Thomas Zimmermann
2024-03-17 12:43   ` Javier Martinez Canillas
2024-03-18  8:19     ` Thomas Zimmermann
2024-03-18  2:35   ` Zack Rusin
2024-03-18  7:59     ` Thomas Zimmermann
2024-03-18  8:44       ` Maxime Ripard
2024-03-18  9:48         ` Javier Martinez Canillas
2024-03-18 22:22   ` [01/43] " Sui Jingfeng
2024-03-12 15:44 ` [PATCH 02/43] fbdev/deferred-io: Move pageref setup into separate helper Thomas Zimmermann
2024-03-17 12:49   ` Javier Martinez Canillas
2024-03-12 15:44 ` [PATCH 03/43] fbdev/deferred-io: Clean up pageref on lastclose Thomas Zimmermann
2024-03-17 13:19   ` Javier Martinez Canillas
2024-03-12 15:44 ` [PATCH 04/43] fbdev/deferred-io: Test screen_buffer for vmalloc'ed memory Thomas Zimmermann
2024-03-17 13:20   ` Javier Martinez Canillas
2024-03-12 15:45 ` [PATCH 05/43] fbdev/deferred-io: Test smem_start for I/O memory Thomas Zimmermann
2024-03-18 17:03   ` Javier Martinez Canillas
2024-03-12 15:45 ` [PATCH 06/43] fbdev/deferred-io: Always call get_page() for framebuffer pages Thomas Zimmermann
2024-03-18 17:04   ` Javier Martinez Canillas
2024-03-12 15:45 ` [PATCH 07/43] fbdev/deferred-io: Provide get_page hook in struct fb_deferred_io Thomas Zimmermann
2024-03-18 17:11   ` Javier Martinez Canillas
2024-03-12 15:45 ` [PATCH 08/43] drm/fbdev: Add fbdev-shmem Thomas Zimmermann
2024-03-12 16:14   ` Geert Uytterhoeven
2024-03-13  8:19     ` Thomas Zimmermann
2024-03-13  9:03       ` Geert Uytterhoeven
2024-03-13  9:24         ` Thomas Zimmermann
2024-03-13  9:56           ` Geert Uytterhoeven
2024-03-12 15:45 ` [PATCH 09/43] drm/ast: Use fbdev-shmem Thomas Zimmermann
2024-03-13 14:03   ` Jocelyn Falempe
2024-03-12 15:45 ` [PATCH 10/43] drm/gud: " Thomas Zimmermann
2024-03-17 19:21   ` Noralf Trønnes
2024-03-12 15:45 ` [PATCH 11/43] drm/hyperv: " Thomas Zimmermann
2024-03-12 16:08   ` Deepak Rawat
2024-03-12 15:45 ` [PATCH 12/43] drm/mgag200: " Thomas Zimmermann
2024-03-13 14:03   ` Jocelyn Falempe
2024-03-18  7:56     ` Thomas Zimmermann
2024-03-18  9:23       ` Jocelyn Falempe
2024-03-12 15:45 ` [PATCH 13/43] drm/solomon: " Thomas Zimmermann
2024-03-12 15:45 ` [PATCH 14/43] drm/tiny/cirrus: " Thomas Zimmermann
2024-03-12 15:45 ` [PATCH 15/43] drm/tiny/gm12u320: " Thomas Zimmermann
2024-03-12 15:45 ` [PATCH 16/43] drm/tiny/ofdrm: " Thomas Zimmermann
2024-03-12 15:45 ` [PATCH 17/43] drm/tiny/simpledrm: " Thomas Zimmermann
2024-03-12 15:45 ` [PATCH 18/43] drm/udl: " Thomas Zimmermann
2024-03-12 15:45 ` [PATCH 19/43] drm/virtio: " Thomas Zimmermann
2024-03-28 14:55   ` Dmitry Osipenko
2024-03-12 15:45 ` [PATCH 20/43] drm/vkms: " Thomas Zimmermann
2024-03-12 15:45 ` [PATCH 21/43] drm/fbdev-dma: Implement damage handling and deferred I/O Thomas Zimmermann
2024-03-12 15:45 ` [PATCH 22/43] drm/arm/komeda: Use fbdev-dma Thomas Zimmermann
2024-03-13 10:53   ` Liviu Dudau
2024-03-12 15:45 ` [PATCH 23/43] drm/hisilicon/kirin: " Thomas Zimmermann
2024-03-12 15:45 ` [PATCH 24/43] drm/imx/lcdc: " Thomas Zimmermann
2024-03-12 15:45 ` [PATCH 25/43] drm/ingenic: " Thomas Zimmermann
2024-03-12 15:45 ` [PATCH 26/43] drm/mediatek: " Thomas Zimmermann
2024-03-12 15:45 ` [PATCH 27/43] drm/panel/panel-ilitek-9341: " Thomas Zimmermann
2024-03-12 15:45 ` [PATCH 28/43] drm/renesas/rcar-du: " Thomas Zimmermann
2024-03-12 15:45 ` [PATCH 29/43] drm/renesas/rz-du: " Thomas Zimmermann
2024-03-12 19:14   ` Biju Das
2024-03-13  8:30     ` Thomas Zimmermann
2024-03-12 15:45 ` [PATCH 30/43] drm/renesas/shmobile: " Thomas Zimmermann
2024-03-12 15:45 ` [PATCH 31/43] drm/rockchip: " Thomas Zimmermann
2024-03-12 15:45 ` [PATCH 32/43] drm/tiny/hx8357d: " Thomas Zimmermann
2024-03-12 15:45 ` [PATCH 33/43] drm/tiny/ili9163: " Thomas Zimmermann
2024-03-12 15:45 ` [PATCH 34/43] drm/tiny/ili9225: " Thomas Zimmermann
2024-03-12 22:20   ` David Lechner
2024-03-12 15:45 ` [PATCH 35/43] drm/tiny/ili9341: " Thomas Zimmermann
2024-03-12 15:45 ` [PATCH 36/43] drm/tiny/ili9486: " Thomas Zimmermann
2024-03-12 15:45 ` [PATCH 37/43] drm/tiny/mi0283qt: " Thomas Zimmermann
2024-03-17 19:21   ` Noralf Trønnes
2024-03-12 15:45 ` [PATCH 38/43] drm/tiny/panel-mipi-dbi: " Thomas Zimmermann
2024-03-17 19:22   ` Noralf Trønnes
2024-03-12 15:45 ` [PATCH 39/43] drm/tiny/repaper: " Thomas Zimmermann
2024-03-17 19:22   ` Noralf Trønnes
2024-03-12 15:45 ` [PATCH 40/43] drm/tiny/st7586: " Thomas Zimmermann
2024-03-12 22:21   ` David Lechner
2024-03-12 15:45 ` [PATCH 41/43] drm/tiny/st7735r: " Thomas Zimmermann
2024-03-12 22:21   ` David Lechner
2024-03-12 15:45 ` [PATCH 42/43] drm/fbdev-generic: Convert to fbdev-ttm Thomas Zimmermann
2024-03-12 15:45 ` [PATCH 43/43] drm/fbdev: Clean up fbdev documentation Thomas Zimmermann

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.