drm: Provide fbdev emulation per memory manager
Subsystems (45)
Thomas Zimmermann
maintainercover drm: Provide fbdev emulation per memory manager
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.hSignature · 1 line
2.44.0
Thomas Zimmermann
maintainerPATCH 1/43 drm/fbdev-generic: Do not set physical framebuffer address
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.
--- drivers/gpu/drm/drm_fbdev_generic.c | 1 - 1 file changed, 1 deletion(-)
drivers/gpu/drm/drm_fbdev_generic.c +0 -1
@@ -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 */
Signature · 1 line
2.44.0
Thomas Zimmermann
maintainerPATCH 2/43 fbdev/deferred-io: Move pageref setup into separate helper
In reply to Thomas ZimmermannSet 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.
--- drivers/video/fbdev/core/fb_defio.c | 42 ++++++++++++++++++++--------- 1 file changed, 30 insertions(+), 12 deletions(-)
drivers/video/fbdev/core/fb_defio.c +30 -12
@@ -36,20 +36,43 @@ static struct page *fb_deferred_io_page(struct fb_info *info, unsigned long offsreturn 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_infoif (!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;
Signature · 1 line
2.44.0
Thomas Zimmermann
maintainerPATCH 3/43 fbdev/deferred-io: Clean up pageref on lastclose
In reply to Thomas ZimmermannClean 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.
--- drivers/video/fbdev/core/fb_defio.c | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-)
drivers/video/fbdev/core/fb_defio.c +11 -6
@@ -62,6 +62,14 @@ static struct fb_deferred_io_pageref *fb_deferred_io_pageref_lookup(struct fb_inreturn 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)
Signature · 1 line
2.44.0
Thomas Zimmermann
maintainerPATCH 4/43 fbdev/deferred-io: Test screen_buffer for vmalloc'ed memory
In reply to Thomas ZimmermannFramebuffers in virtual memory are available via screen_buffer. Use it instead of screen_base and avoid the type casting.
--- drivers/video/fbdev/core/fb_defio.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/video/fbdev/core/fb_defio.c +3 -3
@@ -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 );
Signature · 1 line
2.44.0
Thomas Zimmermann
maintainerPATCH 5/43 fbdev/deferred-io: Test smem_start for I/O memory
In reply to Thomas ZimmermannTest smem_start before looking up pages from its value. Return NULL if it is unset. This will result in a SIGBUS signal.
--- drivers/video/fbdev/core/fb_defio.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/video/fbdev/core/fb_defio.c +2 -2
@@ -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;
Signature · 1 line
2.44.0
Thomas Zimmermann
maintainerPATCH 6/43 fbdev/deferred-io: Always call get_page() for framebuffer pages
In reply to Thomas ZimmermannUnconditionally 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.
--- drivers/video/fbdev/core/fb_defio.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-)
drivers/video/fbdev/core/fb_defio.c +5 -4
@@ -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 offselse 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
Signature · 1 line
2.44.0
Thomas Zimmermann
maintainerPATCH 7/43 fbdev/deferred-io: Provide get_page hook in struct fb_deferred_io
In reply to Thomas ZimmermannAdd 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.
--- drivers/video/fbdev/core/fb_defio.c | 4 ++++ include/linux/fb.h | 1 + 2 files changed, 5 insertions(+)
drivers/video/fbdev/core/fb_defio.c +4 -0
@@ -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)
include/linux/fb.h +1 -0
@@ -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
Signature · 1 line
2.44.0
Thomas Zimmermann
maintainerPATCH 8/43 drm/fbdev: Add fbdev-shmem
In reply to Thomas ZimmermannAdd 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.
--- 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
drivers/gpu/drm/Makefile +1 -0
@@ -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
drivers/gpu/drm/drm_fbdev_shmem.c new file +316 -0
316 lines not on this page · raw message
include/drm/drm_fbdev_shmem.h new file +15 -0
@@ -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
Signature · 1 line
2.44.0
Thomas Zimmermann
maintainerPATCH 9/43 drm/ast: Use fbdev-shmem
In reply to Thomas ZimmermannImplement fbdev emulation with fbdev-shmem. Avoids the overhead of fbdev-generic's additional shadow buffering. No functional changes.
--- drivers/gpu/drm/ast/ast_drv.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/gpu/drm/ast/ast_drv.c +2 -2
@@ -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 ; }
Signature · 1 line
2.44.0
Thomas Zimmermann
maintainerPATCH 10/43 drm/gud: Use fbdev-shmem
In reply to Thomas ZimmermannImplement fbdev emulation with fbdev-shmem. Avoids the overhead of fbdev-generic's additional shadow buffering. No functional changes.
--- drivers/gpu/drm/gud/gud_drv.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/gpu/drm/gud/gud_drv.c +2 -2
@@ -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 ; }
Signature · 1 line
2.44.0
Thomas Zimmermann
maintainerPATCH 11/43 drm/hyperv: Use fbdev-shmem
In reply to Thomas ZimmermannImplement fbdev emulation with fbdev-shmem. Avoids the overhead of fbdev-generic's additional shadow buffering. No functional changes.
--- drivers/gpu/drm/hyperv/hyperv_drm_drv.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/gpu/drm/hyperv/hyperv_drm_drv.c +2 -2
@@ -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 ;
Signature · 1 line
2.44.0
Thomas Zimmermann
maintainerPATCH 12/43 drm/mgag200: Use fbdev-shmem
In reply to Thomas ZimmermannImplement fbdev emulation with fbdev-shmem. Avoids the overhead of fbdev-generic's additional shadow buffering. No functional changes.
--- drivers/gpu/drm/mgag200/mgag200_drv.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/gpu/drm/mgag200/mgag200_drv.c +2 -2
@@ -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 ; }
Signature · 1 line
2.44.0
Thomas Zimmermann
maintainerPATCH 13/43 drm/solomon: Use fbdev-shmem
In reply to Thomas ZimmermannImplement fbdev emulation with fbdev-shmem. Avoids the overhead of fbdev-generic's additional shadow buffering. No functional changes.
--- drivers/gpu/drm/solomon/ssd130x.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/gpu/drm/solomon/ssd130x.c +2 -2
@@ -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; }
Signature · 1 line
2.44.0
Thomas Zimmermann
maintainerPATCH 14/43 drm/tiny/cirrus: Use fbdev-shmem
In reply to Thomas ZimmermannImplement fbdev emulation with fbdev-shmem. Avoids the overhead of fbdev-generic's additional shadow buffering. No functional changes.
--- drivers/gpu/drm/tiny/cirrus.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/gpu/drm/tiny/cirrus.c +2 -2
@@ -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 ; }
Signature · 1 line
2.44.0
Thomas Zimmermann
maintainerPATCH 15/43 drm/tiny/gm12u320: Use fbdev-shmem
In reply to Thomas ZimmermannImplement fbdev emulation with fbdev-shmem. Avoids the overhead of fbdev-generic's additional shadow buffering. No functional changes.
--- drivers/gpu/drm/tiny/gm12u320.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/gpu/drm/tiny/gm12u320.c +2 -2
@@ -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 ;
Signature · 1 line
2.44.0
Thomas Zimmermann
maintainerPATCH 16/43 drm/tiny/ofdrm: Use fbdev-shmem
In reply to Thomas ZimmermannImplement fbdev emulation with fbdev-shmem. Avoids the overhead of fbdev-generic's additional shadow buffering. No functional changes.
--- drivers/gpu/drm/tiny/ofdrm.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/gpu/drm/tiny/ofdrm.c +2 -2
@@ -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 ; }
Signature · 1 line
2.44.0
Thomas Zimmermann
maintainerPATCH 17/43 drm/tiny/simpledrm: Use fbdev-shmem
In reply to Thomas ZimmermannImplement fbdev emulation with fbdev-shmem. Avoids the overhead of fbdev-generic's additional shadow buffering. No functional changes.
--- drivers/gpu/drm/tiny/simpledrm.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/gpu/drm/tiny/simpledrm.c +2 -2
@@ -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 ; }
Signature · 1 line
2.44.0
Thomas Zimmermann
maintainerPATCH 18/43 drm/udl: Use fbdev-shmem
In reply to Thomas ZimmermannImplement fbdev emulation with fbdev-shmem. Avoids the overhead of fbdev-generic's additional shadow buffering. No functional changes.
--- drivers/gpu/drm/udl/udl_drv.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/gpu/drm/udl/udl_drv.c +2 -2
@@ -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 ; }
Signature · 1 line
2.44.0
Thomas Zimmermann
maintainerPATCH 19/43 drm/virtio: Use fbdev-shmem
In reply to Thomas ZimmermannImplement fbdev emulation with fbdev-shmem. Avoids the overhead of fbdev-generic's additional shadow buffering. No functional changes.
--- drivers/gpu/drm/virtio/virtgpu_drv.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/gpu/drm/virtio/virtgpu_drv.c +2 -2
@@ -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:
Signature · 1 line
2.44.0
Thomas Zimmermann
maintainerPATCH 20/43 drm/vkms: Use fbdev-shmem
In reply to Thomas ZimmermannImplement fbdev emulation with fbdev-shmem. Avoids the overhead of fbdev-generic's additional shadow buffering. No functional changes.
--- drivers/gpu/drm/vkms/vkms_drv.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/gpu/drm/vkms/vkms_drv.c +2 -2
@@ -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 ;
Signature · 1 line
2.44.0
Thomas Zimmermann
maintainerPATCH 21/43 drm/fbdev-dma: Implement damage handling and deferred I/O
In reply to Thomas ZimmermannAdd 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.
--- drivers/gpu/drm/drm_fbdev_dma.c | 65 ++++++++++++++++++++++++++------- 1 file changed, 51 insertions(+), 14 deletions(-)
drivers/gpu/drm/drm_fbdev_dma.c +51 -14
@@ -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, };/*
Signature · 1 line
2.44.0
Thomas Zimmermann
maintainerPATCH 22/43 drm/arm/komeda: Use fbdev-dma
In reply to Thomas ZimmermannImplement 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.
--- drivers/gpu/drm/arm/display/komeda/komeda_drv.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/gpu/drm/arm/display/komeda/komeda_drv.c +2 -2
@@ -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 ;
Signature · 1 line
2.44.0
Thomas Zimmermann
maintainerPATCH 23/43 drm/hisilicon/kirin: Use fbdev-dma
In reply to Thomas ZimmermannImplement 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.
--- drivers/gpu/drm/hisilicon/kirin/kirin_drm_drv.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/gpu/drm/hisilicon/kirin/kirin_drm_drv.c +2 -2
@@ -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 ;
Signature · 1 line
2.44.0
Thomas Zimmermann
maintainerPATCH 24/43 drm/imx/lcdc: Use fbdev-dma
In reply to Thomas ZimmermannImplement 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.
--- drivers/gpu/drm/imx/lcdc/imx-lcdc.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/gpu/drm/imx/lcdc/imx-lcdc.c +2 -2
@@ -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 ; }
Signature · 1 line
2.44.0
Thomas Zimmermann
maintainerPATCH 25/43 drm/ingenic: Use fbdev-dma
In reply to Thomas ZimmermannImplement 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.
--- drivers/gpu/drm/ingenic/ingenic-drm-drv.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/gpu/drm/ingenic/ingenic-drm-drv.c +2 -2
@@ -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 ;
Signature · 1 line
2.44.0
Thomas Zimmermann
maintainerPATCH 26/43 drm/mediatek: Use fbdev-dma
In reply to Thomas ZimmermannImplement 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.
--- drivers/gpu/drm/mediatek/mtk_drm_drv.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/gpu/drm/mediatek/mtk_drm_drv.c +2 -2
@@ -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 ;
Signature · 1 line
2.44.0
Thomas Zimmermann
maintainerPATCH 27/43 drm/panel/panel-ilitek-9341: Use fbdev-dma
In reply to Thomas ZimmermannImplement 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.
--- drivers/gpu/drm/panel/panel-ilitek-ili9341.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/gpu/drm/panel/panel-ilitek-ili9341.c +2 -2
@@ -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 ; }
Signature · 1 line
2.44.0
Thomas Zimmermann
maintainerPATCH 28/43 drm/renesas/rcar-du: Use fbdev-dma
In reply to Thomas ZimmermannImplement 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.
--- drivers/gpu/drm/renesas/rcar-du/rcar_du_drv.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/gpu/drm/renesas/rcar-du/rcar_du_drv.c +2 -2
@@ -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 ;
Signature · 1 line
2.44.0
Thomas Zimmermann
maintainerPATCH 29/43 drm/renesas/rz-du: Use fbdev-dma
In reply to Thomas ZimmermannImplement 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.
--- drivers/gpu/drm/renesas/rz-du/rzg2l_du_drv.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/gpu/drm/renesas/rz-du/rzg2l_du_drv.c +2 -2
@@ -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 ;
Signature · 1 line
2.44.0
Thomas Zimmermann
maintainerPATCH 30/43 drm/renesas/shmobile: Use fbdev-dma
In reply to Thomas ZimmermannImplement 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.
--- drivers/gpu/drm/renesas/shmobile/shmob_drm_drv.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/gpu/drm/renesas/shmobile/shmob_drm_drv.c +2 -2
@@ -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 ;
Signature · 1 line
2.44.0
Thomas Zimmermann
maintainerPATCH 31/43 drm/rockchip: Use fbdev-dma
In reply to Thomas ZimmermannImplement 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.
--- drivers/gpu/drm/rockchip/rockchip_drm_drv.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/gpu/drm/rockchip/rockchip_drm_drv.c +2 -2
@@ -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:
Signature · 1 line
2.44.0
Thomas Zimmermann
maintainerPATCH 32/43 drm/tiny/hx8357d: Use fbdev-dma
In reply to Thomas ZimmermannImplement 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.
--- drivers/gpu/drm/tiny/hx8357d.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/gpu/drm/tiny/hx8357d.c +2 -2
@@ -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 ; }
Signature · 1 line
2.44.0
Thomas Zimmermann
maintainerPATCH 33/43 drm/tiny/ili9163: Use fbdev-dma
In reply to Thomas ZimmermannImplement 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.
--- drivers/gpu/drm/tiny/ili9163.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/gpu/drm/tiny/ili9163.c +2 -2
@@ -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 ; }
Signature · 1 line
2.44.0
Thomas Zimmermann
maintainerPATCH 34/43 drm/tiny/ili9225: Use fbdev-dma
In reply to Thomas ZimmermannImplement 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.
--- drivers/gpu/drm/tiny/ili9225.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/gpu/drm/tiny/ili9225.c +2 -2
@@ -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 ; }
Signature · 1 line
2.44.0
Thomas Zimmermann
maintainerPATCH 35/43 drm/tiny/ili9341: Use fbdev-dma
In reply to Thomas ZimmermannImplement 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.
--- drivers/gpu/drm/tiny/ili9341.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/gpu/drm/tiny/ili9341.c +2 -2
@@ -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 ; }
Signature · 1 line
2.44.0
Thomas Zimmermann
maintainerPATCH 36/43 drm/tiny/ili9486: Use fbdev-dma
In reply to Thomas ZimmermannImplement 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.
--- drivers/gpu/drm/tiny/ili9486.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/gpu/drm/tiny/ili9486.c +2 -2
@@ -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 ; }
Signature · 1 line
2.44.0
Thomas Zimmermann
maintainerPATCH 37/43 drm/tiny/mi0283qt: Use fbdev-dma
In reply to Thomas ZimmermannImplement 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.
--- drivers/gpu/drm/tiny/mi0283qt.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/gpu/drm/tiny/mi0283qt.c +2 -2
@@ -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 ; }
Signature · 1 line
2.44.0
Thomas Zimmermann
maintainerPATCH 38/43 drm/tiny/panel-mipi-dbi: Use fbdev-dma
In reply to Thomas ZimmermannImplement 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.
--- drivers/gpu/drm/tiny/panel-mipi-dbi.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/gpu/drm/tiny/panel-mipi-dbi.c +2 -2
@@ -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 ; }
Signature · 1 line
2.44.0
Thomas Zimmermann
maintainerPATCH 39/43 drm/tiny/repaper: Use fbdev-dma
In reply to Thomas ZimmermannImplement 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.
--- drivers/gpu/drm/tiny/repaper.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/gpu/drm/tiny/repaper.c +2 -2
@@ -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 ; }
Signature · 1 line
2.44.0
Thomas Zimmermann
maintainerPATCH 40/43 drm/tiny/st7586: Use fbdev-dma
In reply to Thomas ZimmermannImplement 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.
--- drivers/gpu/drm/tiny/st7586.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/gpu/drm/tiny/st7586.c +2 -2
@@ -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 ; }
Signature · 1 line
2.44.0
Thomas Zimmermann
maintainerPATCH 41/43 drm/tiny/st7735r: Use fbdev-dma
In reply to Thomas ZimmermannImplement 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.
--- drivers/gpu/drm/tiny/st7735r.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/gpu/drm/tiny/st7735r.c +2 -2
@@ -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 ; }
Signature · 1 line
2.44.0
Thomas Zimmermann
maintainerPATCH 42/43 drm/fbdev-generic: Convert to fbdev-ttm
In reply to Thomas ZimmermannOnly 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.
---
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.hDocumentation/gpu/drm-kms-helpers.rst +1 -1
@@ -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
drivers/gpu/drm/Makefile +2 -3
@@ -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 #
drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c +3 -3
@@ -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);
drivers/gpu/drm/drm_fbdev_ttm.c renamed from drivers/gpu/drm/drm_fbdev_generic.c +40 -40
211 lines not on this page · raw message
drivers/gpu/drm/hisilicon/hibmc/hibmc_drm_drv.c +2 -2
@@ -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 ;
drivers/gpu/drm/loongson/Kconfig +1 -0
@@ -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
drivers/gpu/drm/loongson/lsdc_drv.c +2 -2
@@ -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 ; }
drivers/gpu/drm/nouveau/nouveau_drm.c +3 -3
@@ -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 ;
drivers/gpu/drm/qxl/qxl_drv.c +2 -2
@@ -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:
drivers/gpu/drm/tiny/bochs.c +2 -2
@@ -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 *entif (ret) goto err_hw_fini; -drm_fbdev_generic_setup (dev,32 ); +drm_fbdev_ttm_setup (dev,32 );return ret; err_hw_fini:
drivers/gpu/drm/vboxvideo/vbox_drv.c +2 -2
@@ -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 ;
drivers/gpu/drm/vmwgfx/vmwgfx_drv.c +2 -2
@@ -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);
include/drm/drm_fbdev_generic.h deleted +0 -15
@@ -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
include/drm/drm_fbdev_ttm.h new file +15 -0
@@ -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
Signature · 1 line
2.44.0
Thomas Zimmermann
maintainerPATCH 43/43 drm/fbdev: Clean up fbdev documentation
In reply to Thomas ZimmermannRewrite 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.
--- 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(-)
Documentation/gpu/drm-kms-helpers.rst +9 -3
@@ -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 =================================
Documentation/gpu/todo.rst +0 -13
@@ -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 -------------------------------------------------------
drivers/gpu/drm/drm_drv.c +1 -1
@@ -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; * }
drivers/gpu/drm/drm_fb_helper.c +2 -9
@@ -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)
include/drm/drm_mode_config.h +2 -2
@@ -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. */
Signature · 1 line
2.44.0
Re: [PATCH 11/43] drm/hyperv: Use fbdev-shmem
In reply to Thomas ZimmermannQuoted 35 lines · 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 <[email protected]>Cc Deepak Rawat <[email protected]>--- drivers/gpu/drm/hyperv/hyperv_drm_drv.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)drivers/gpu/drm/hyperv/hyperv_drm_drv.c +2
-3@@ -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
Re: [PATCH 08/43] drm/fbdev: Add fbdev-shmem
In reply to Thomas ZimmermannHi Thomas,
Quoted 7 lines · 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 <[email protected]>
Thanks for your patch!
Quoted 11 lines
drivers/gpu/drm/drm_fbdev_shmem.c new file +8
-0+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;
drivers/gpu/drm/drm_fbdev_shmem.c line 124
Quoted 10 lines
drivers/gpu/drm/drm_fbdev_shmem.c new file +10
-0+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...
Quoted 2 lines
drivers/gpu/drm/drm_fbdev_shmem.c new file +2
-0+ buffer =drm_client_framebuffer_create (client, sizes->surface_width, + sizes->surface_height, format);
[...]
Quoted 13 lines
drivers/gpu/drm/drm_fbdev_shmem.c new file +12
-0+} +/** +* 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(). +*
drivers/gpu/drm/drm_fbdev_shmem.c line 289
Quoted 10 lines
drivers/gpu/drm/drm_fbdev_shmem.c new file +10
-0+* 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?
Quoted 17 lines
drivers/gpu/drm/drm_fbdev_shmem.c new file +17
-0+{ +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; + }
drivers/gpu/drm/drm_fbdev_shmem.c line 316
Quoted 10 lines
drivers/gpu/drm/drm_fbdev_shmem.c new file +10
-0+ +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
Signature · 5 lines
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- [email protected] 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
RE: [PATCH 29/43] drm/renesas/rz-du: Use fbdev-dma
In reply to Thomas ZimmermannHi Thomas,
Quoted 8 lines
-----Original Message-----
From: Thomas Zimmermann <[email protected]>
Sent: Tuesday, March 12, 2024 3:45 PM
To: [email protected]; [email protected]; [email protected]; [email protected]
Cc: [email protected]; [email protected]; Thomas Zimmermann <[email protected]>; Biju Das <[email protected]>
Subject: [PATCH 29/43] drm/renesas/rz-du: Use fbdev-dma
Quoted 4 lines
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 <[email protected]>
Cheers,
Biju
Quoted 30 lines
Cc Biju Das <[email protected]>--- drivers/gpu/drm/renesas/rz-du/rzg2l_du_drv.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)drivers/gpu/drm/renesas/rz- renamed from drivers/gpu/drm/renesas/rz-du/rzg2l_du_drv.c +0
-0
du/rzg2l_du_drv.c
index470d34da1d6c4..e5eca8691a331100644drivers/gpu/drm/renesas/rz-du/rzg2l_du_drv.c +2
-3@@ -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
Re: [PATCH 34/43] drm/tiny/ili9225: Use fbdev-dma
In reply to Thomas ZimmermannQuoted 7 lines · Thomas Zimmermann
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 <[email protected]>Cc David Lechner <[email protected]>---
Re: [PATCH 40/43] drm/tiny/st7586: Use fbdev-dma
In reply to Thomas ZimmermannQuoted 7 lines · Thomas Zimmermann
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 <[email protected]>Cc David Lechner <[email protected]>---
Re: [PATCH 41/43] drm/tiny/st7735r: Use fbdev-dma
In reply to Thomas ZimmermannQuoted 7 lines · Thomas Zimmermann
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 <[email protected]>Cc David Lechner <[email protected]>---
Thomas Zimmermann
maintainerRe: [PATCH 08/43] drm/fbdev: Add fbdev-shmem
In reply to Geert UytterhoevenHi Geert
Am 12.03.24 um 17:14 schrieb Geert Uytterhoeven:
Quoted 26 lines
Hi Thomas,
Quoted 7 lines · 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 <[email protected]>Thanks for your patch!
Quoted 14 lines
drivers/gpu/drm/drm_fbdev_shmem.c new file +12
-0+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;
Quoted 8 lines
drivers/gpu/drm/drm_fbdev_shmem.c line 124
Quoted 6 lines
drivers/gpu/drm/drm_fbdev_shmem.c new file +6
-0+ +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.
Quoted 21 lines
Quoted 3 lines
drivers/gpu/drm/drm_fbdev_shmem.c new file +2
-0+ buffer =drm_client_framebuffer_create (client, sizes->surface_width, + sizes->surface_height, format);[...]
Quoted 16 lines
drivers/gpu/drm/drm_fbdev_shmem.c new file +16
-0+} +/** +* 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(). +*
Quoted 8 lines
Quoted 6 lines
+ * 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 bydrm_dev_unregister().
+ */
+voiddrm_fbdev_shmem_setup(struct drm_device *dev, unsigned int preferred_bpp)As this is a completely new function, can we please get a
preferred_formatparameter 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
Quoted 33 lines
Quoted 18 lines
drivers/gpu/drm/drm_fbdev_shmem.c new file +17
-0+{ +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; + }drivers/gpu/drm/drm_fbdev_shmem.c line 316
Quoted 10 lines
drivers/gpu/drm/drm_fbdev_shmem.c new file +10
-0+ +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
Signature · 7 lines
-- Thomas Zimmermann Graphics Driver Developer SUSE Software Solutions Germany GmbH Frankenstrasse 146, 90461 Nuernberg, Germany GF: Ivo Totev, Andrew Myers, Andrew McDonald, Boudien Moerman HRB 36809 (AG Nuernberg)
Thomas Zimmermann
maintainerRe: [PATCH 29/43] drm/renesas/rz-du: Use fbdev-dma
In reply to Biju DasHi
Am 12.03.24 um 20:14 schrieb Biju Das:
Quoted 10 lines
Hi Thomas,
Quoted 8 lines
-----Original Message-----
From: Thomas Zimmermann <[email protected]>
Sent: Tuesday, March 12, 2024 3:45 PM
To: [email protected]; [email protected]; [email protected]; [email protected]
Cc: [email protected]; [email protected]; Thomas Zimmermann <[email protected]>; Biju Das <[email protected]>
Subject: [PATCH 29/43] drm/renesas/rz-du: Use fbdev-dma
Quoted 6 lines
Quoted 4 lines
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 <[email protected]>Tested-by Biju Das <[email protected]>
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
Quoted 34 lines
Cheers,
BijuQuoted 30 lines
Cc Biju Das <[email protected]>--- drivers/gpu/drm/renesas/rz-du/rzg2l_du_drv.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)drivers/gpu/drm/renesas/rz- renamed from drivers/gpu/drm/renesas/rz-du/rzg2l_du_drv.c +0
-0
du/rzg2l_du_drv.c
index470d34da1d6c4..e5eca8691a331100644drivers/gpu/drm/renesas/rz-du/rzg2l_du_drv.c +2
-3@@ -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
Signature · 7 lines
-- Thomas Zimmermann Graphics Driver Developer SUSE Software Solutions Germany GmbH Frankenstrasse 146, 90461 Nuernberg, Germany GF: Ivo Totev, Andrew Myers, Andrew McDonald, Boudien Moerman HRB 36809 (AG Nuernberg)
Re: [PATCH 08/43] drm/fbdev: Add fbdev-shmem
In reply to Thomas ZimmermannHi Thomas,
Quoted 34 lines · Thomas Zimmermann
Am 12.03.24 um 17:14 schrieb Geert Uytterhoeven:
Quoted 24 lines · Thomas Zimmermann
Quoted 7 lines
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 <[email protected]>Thanks for your patch!
Quoted 14 lines
drivers/gpu/drm/drm_fbdev_shmem.c new file +12
-0+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;Quoted 8 lines
drivers/gpu/drm/drm_fbdev_shmem.c line 124
Quoted 6 lines
drivers/gpu/drm/drm_fbdev_shmem.c new file +6
-0+ +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...
Quoted 2 lines
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.
Quoted 29 lines
Quoted 20 lines
Quoted 2 lines
drivers/gpu/drm/drm_fbdev_shmem.c new file +2
-0+ buffer =drm_client_framebuffer_create (client, sizes->surface_width, + sizes->surface_height, format);[...]
Quoted 16 lines
drivers/gpu/drm/drm_fbdev_shmem.c new file +16
-0+} +/** +* 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(). +* Quoted 8 lines
Quoted 6 lines
+ * 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 bydrm_dev_unregister().
+ */
+voiddrm_fbdev_shmem_setup(struct drm_device *dev, unsigned int preferred_bpp)As this is a completely new function, can we please get a
preferred_formatparameter instead?
Quoted 3 lines
An understandable question. But as it is, the patchset has a trivial change in each driver. And the
preferred_bppparameter has the same meaning as the bpp value in the video= parameter. So it's ok-ish for now.
OK.
Quoted 5 lines
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
Signature · 5 lines
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- [email protected] 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
Thomas Zimmermann
maintainerRe: [PATCH 08/43] drm/fbdev: Add fbdev-shmem
Hi
Am 13.03.24 um 10:03 schrieb Geert Uytterhoeven:
Quoted 36 lines
Hi Thomas,
Quoted 33 lines · Thomas Zimmermann
Am 12.03.24 um 17:14 schrieb Geert Uytterhoeven:
Quoted 32 lines · Thomas Zimmermann
Quoted 7 lines
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 <[email protected]>Thanks for your patch!
Quoted 10 lines
drivers/gpu/drm/drm_fbdev_shmem.c new file +8
-0+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;drivers/gpu/drm/drm_fbdev_shmem.c line 124
Quoted 10 lines
drivers/gpu/drm/drm_fbdev_shmem.c new file +10
-0+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...
Quoted 3 lines
Quoted 2 lines
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.
Quoted 34 lines
Quoted 29 lines
Quoted 21 lines
Quoted 3 lines
drivers/gpu/drm/drm_fbdev_shmem.c new file +2
-0+ buffer =drm_client_framebuffer_create (client, sizes->surface_width, + sizes->surface_height, format);[...]
Quoted 16 lines
drivers/gpu/drm/drm_fbdev_shmem.c new file +16
-0+} +/** +* 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(). +* Quoted 8 lines
Quoted 6 lines
+ * 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 bydrm_dev_unregister().
+ */
+voiddrm_fbdev_shmem_setup(struct drm_device *dev, unsigned int preferred_bpp)As this is a completely new function, can we please get a
preferred_formatparameter instead?Quoted 3 lines
An understandable question. But as it is, the patchset has a trivial change in each driver. And the
preferred_bppparameter has the same meaning as the bpp value in the video= parameter. So it's ok-ish for now.OK.
Quoted 8 lines
Quoted 5 lines
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.
Quoted 6 lines
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 (usepreferred_formatif 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.
Quoted 4 lines
FTR, my main use-case is letting fbdev emulation distinguish between
DRM_FORMAT_RxandDRM_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
Quoted 5 lines
Gr{oetje,eeting}s,
Geert
Signature · 7 lines
-- Thomas Zimmermann Graphics Driver Developer SUSE Software Solutions Germany GmbH Frankenstrasse 146, 90461 Nuernberg, Germany GF: Ivo Totev, Andrew Myers, Andrew McDonald, Boudien Moerman HRB 36809 (AG Nuernberg)
Re: [PATCH 08/43] drm/fbdev: Add fbdev-shmem
Hi Thomas,
Quoted 35 lines · Thomas Zimmermann
Am 13.03.24 um 10:03 schrieb Geert Uytterhoeven:
Quoted 34 lines · Thomas Zimmermann
Quoted 33 lines
Am 12.03.24 um 17:14 schrieb Geert Uytterhoeven:
Quoted 32 lines · Thomas Zimmermann
Quoted 7 lines
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 <[email protected]>Thanks for your patch!
Quoted 10 lines
drivers/gpu/drm/drm_fbdev_shmem.c new file +8
-0+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;drivers/gpu/drm/drm_fbdev_shmem.c line 124
Quoted 10 lines
drivers/gpu/drm/drm_fbdev_shmem.c new file +10
-0+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...
Quoted 6 lines
Quoted 3 lines
Quoted 2 lines
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]).
Quoted 38 lines
Quoted 38 lines
Quoted 28 lines
Quoted 20 lines
Quoted 2 lines
drivers/gpu/drm/drm_fbdev_shmem.c new file +2
-0+ buffer =drm_client_framebuffer_create (client, sizes->surface_width, + sizes->surface_height, format);[...]
Quoted 16 lines
drivers/gpu/drm/drm_fbdev_shmem.c new file +16
-0+} +/** +* 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(). +* Quoted 8 lines
Quoted 6 lines
+ * 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 bydrm_dev_unregister().
+ */
+voiddrm_fbdev_shmem_setup(struct drm_device *dev, unsigned int preferred_bpp)As this is a completely new function, can we please get a
preferred_formatparameter instead?Quoted 3 lines
An understandable question. But as it is, the patchset has a trivial change in each driver. And the
preferred_bppparameter has the same meaning as the bpp value in the video= parameter. So it's ok-ish for now.OK.
Quoted 5 lines
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.
Quoted 7 lines
Quoted 3 lines
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.
Quoted 9 lines
Quoted 5 lines
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 (usepreferred_formatif 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_probehelpers into the shared helpers. That allows to remove thesurface_depthandsurface_bppfields. That is at least a step into the right direction.
Thanks, I am looking forward to that...
Quoted 6 lines
Quoted 3 lines
FTR, my main use-case is letting fbdev emulation distinguish between
DRM_FORMAT_RxandDRM_FORMAT_Cx, which share the values of depth and bpp.How are they used for the framebuffer console? Shouldn't it always be
_Cx?_Rxis 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/[email protected]/
Gr{oetje,eeting}s,
Geert
Signature · 5 lines
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- [email protected] 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
Re: [PATCH 22/43] drm/arm/komeda: Use fbdev-dma
In reply to Thomas ZimmermannQuoted 6 lines · Thomas Zimmermann
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 <[email protected]>Cc Liviu Dudau <[email protected]>
Best regards,
Liviu
Quoted 29 lines
--- drivers/gpu/drm/arm/display/komeda/komeda_drv.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)drivers/gpu/drm/arm/display/komeda/komeda_drv.c +2
-2@@ -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 ;Signature · 1 line
2.44.0
Signature · 8 lines
====================
| I would like to |
| fix the world, |
| but they're not |
| giving me the |
\ source code! /
---------------
¯\_(ツ)_/¯Re: [PATCH 09/43] drm/ast: Use fbdev-shmem
In reply to Thomas ZimmermannHi,
Thanks, it looks good to me.
Signature · 1 line
Jocelyn
Quoted 33 lines · 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 <[email protected]>Cc Dave Airlie <[email protected]>Cc Thomas Zimmermann <[email protected]>Cc Jocelyn Falempe <[email protected]>--- drivers/gpu/drm/ast/ast_drv.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)drivers/gpu/drm/ast/ast_drv.c +2
-2@@ -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 ; }
Re: [PATCH 12/43] drm/mgag200: Use fbdev-shmem
In reply to Thomas ZimmermannHi,
Thanks, it looks good to me.
Signature · 1 line
Jocelyn
Quoted 33 lines · 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 <[email protected]>Cc Dave Airlie <[email protected]>Cc Thomas Zimmermann <[email protected]>Cc Jocelyn Falempe <[email protected]>--- drivers/gpu/drm/mgag200/mgag200_drv.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)drivers/gpu/drm/mgag200/mgag200_drv.c +2
-2@@ -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 ; }
Re: [PATCH 01/43] drm/fbdev-generic: Do not set physical framebuffer address
In reply to Thomas ZimmermannThomas Zimmermann <[email protected]> writes:
Hello Thomas,
Quoted 1 line
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.
Quoted 6 lines
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 ?
Quoted 17 lines
Signed-off-by Thomas Zimmermann <[email protected]>Fixes a5b44c4adb16 ("drm/fbdev-generic: Always use shadow buffering")Cc Thomas Zimmermann <[email protected]>Cc Javier Martinez Canillas <[email protected]>Cc Zack Rusin <[email protected]>Cc Maarten Lankhorst <[email protected]>Cc Maxime Ripard <[email protected]>Cc <[email protected]> # v6.4+--- drivers/gpu/drm/drm_fbdev_generic.c | 1 - 1 file changed, 1 deletion(-)drivers/gpu/drm/drm_fbdev_generic.c +0
-0
drivers/gpu/drm/drm_fbdev_generic.c static int drm_fbdev_generic_helper_fb_probe(struct drm_fb_helper *fb_helper, · line 117
Quoted 6 lines
drivers/gpu/drm/drm_fbdev_generic.c +0
-1@@ -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:
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
Re: [PATCH 02/43] fbdev/deferred-io: Move pageref setup into separate helper
In reply to Thomas ZimmermannQuoted 1 line · Thomas Zimmermann
Set up struct
fb_deferred_io_pagerefin th new helper function
the
Quoted 8 lines
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 <[email protected]>---
Signature · 5 lines
Best regards, Javier Martinez Canillas Core Platforms Red Hat
Re: [PATCH 03/43] fbdev/deferred-io: Clean up pageref on lastclose
In reply to Thomas ZimmermannQuoted 2 lines · 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
requires
Quoted 4 lines
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
Quoted 6 lines
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 <[email protected]>---
Signature · 5 lines
Best regards, Javier Martinez Canillas Core Platforms Red Hat
Re: [PATCH 04/43] fbdev/deferred-io: Test screen_buffer for vmalloc'ed memory
In reply to Thomas ZimmermannQuoted 5 lines · Thomas Zimmermann
Framebuffers in virtual memory are available via
screen_buffer. Use it instead ofscreen_baseand avoid the type casting.Signed-off-by Thomas Zimmermann <[email protected]>---
Signature · 5 lines
Best regards, Javier Martinez Canillas Core Platforms Red Hat
Re: [PATCH 10/43] drm/gud: Use fbdev-shmem
In reply to Thomas ZimmermannQuoted 6 lines · 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 <[email protected]>Cc "Noralf Trønnes" <[email protected]>---
Re: [PATCH 37/43] drm/tiny/mi0283qt: Use fbdev-dma
In reply to Thomas ZimmermannQuoted 10 lines · Thomas Zimmermann
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 <[email protected]>Cc "Noralf Trønnes" <[email protected]>--- drivers/gpu/drm/tiny/mi0283qt.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
Re: [PATCH 38/43] drm/tiny/panel-mipi-dbi: Use fbdev-dma
In reply to Thomas ZimmermannQuoted 11 lines · Thomas Zimmermann
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 <[email protected]>Cc "Noralf Trønnes" <[email protected]>--- drivers/gpu/drm/tiny/panel-mipi-dbi.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
Re: [PATCH 39/43] drm/tiny/repaper: Use fbdev-dma
In reply to Thomas ZimmermannQuoted 10 lines · Thomas Zimmermann
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 <[email protected]>Cc "Noralf Trønnes" <[email protected]>--- drivers/gpu/drm/tiny/repaper.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
Re: [PATCH 01/43] drm/fbdev-generic: Do not set physical framebuffer address
In reply to Thomas ZimmermannQuoted 33 lines · Thomas Zimmermann
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 <[email protected]>Fixes a5b44c4adb16 ("drm/fbdev-generic: Always use shadow buffering")Cc Thomas Zimmermann <[email protected]>Cc Javier Martinez Canillas <[email protected]>Cc Zack Rusin <[email protected]>Cc Maarten Lankhorst <[email protected]>Cc Maxime Ripard <[email protected]>Cc <[email protected]> # v6.4+--- drivers/gpu/drm/drm_fbdev_generic.c | 1 - 1 file changed, 1 deletion(-)drivers/gpu/drm/drm_fbdev_generic.c +0
-2@@ -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 */ --
Quoted 2 lines
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...
z
Thomas Zimmermann
maintainerRe: [PATCH 12/43] drm/mgag200: Use fbdev-shmem
In reply to Jocelyn FalempeHi
Am 13.03.24 um 15:03 schrieb Jocelyn Falempe:
Quoted 5 lines
Hi,
Thanks, it looks good to me.
Reviewed-by Jocelyn Falempe <[email protected]>
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
Signature · 7 lines
-- Thomas Zimmermann Graphics Driver Developer SUSE Software Solutions Germany GmbH Frankenstrasse 146, 90461 Nuernberg, Germany GF: Ivo Totev, Andrew Myers, Andrew McDonald, Boudien Moerman HRB 36809 (AG Nuernberg)
Thomas Zimmermann
maintainerRe: [PATCH 01/43] drm/fbdev-generic: Do not set physical framebuffer address
In reply to Zack RusinHi
Am 18.03.24 um 03:35 schrieb Zack Rusin:
Quoted 31 lines · Thomas Zimmermann
Quoted 30 lines
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 <[email protected]>Fixes a5b44c4adb16 ("drm/fbdev-generic: Always use shadow buffering")Cc Thomas Zimmermann <[email protected]>Cc Javier Martinez Canillas <[email protected]>Cc Zack Rusin <[email protected]>Cc Maarten Lankhorst <[email protected]>Cc Maxime Ripard <[email protected]>Cc <[email protected]> # v6.4+--- drivers/gpu/drm/drm_fbdev_generic.c | 1 - 1 file changed, 1 deletion(-)drivers/gpu/drm/drm_fbdev_generic.c +0
-1@@ -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;
Quoted 9 lines
Quoted 4 lines
drivers/gpu/drm/drm_fbdev_generic.c +0
-1/* deferred I/O */ --2.44.0
Good idea. I think given that
drm_leak_fbdev_smemis off by default we could remove the setting ofsmem_startby 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 needdrm_leak_fbdev_smemat 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
Quoted 4 lines
Reviewed-by Zack Rusin <[email protected]>z
Signature · 7 lines
-- Thomas Zimmermann Graphics Driver Developer SUSE Software Solutions Germany GmbH Frankenstrasse 146, 90461 Nuernberg, Germany GF: Ivo Totev, Andrew Myers, Andrew McDonald, Boudien Moerman HRB 36809 (AG Nuernberg)
Thomas Zimmermann
maintainerRe: [PATCH 01/43] drm/fbdev-generic: Do not set physical framebuffer address
In reply to Javier Martinez CanillasHi
Am 17.03.24 um 13:43 schrieb Javier Martinez Canillas:
Quoted 7 lines
Thomas Zimmermann <[email protected]> writes:
Hello Thomas,
Quoted 1 line
Framebuffer memory is allocated via
vmalloc()from non-contiguousIt's
vmalloc()true, but throughvzmalloc()so I would mention that function instead in the commit message.
Ok.
Quoted 10 lines
Quoted 7 lines
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.
Quoted 26 lines
Quoted 18 lines
Signed-off-by Thomas Zimmermann <[email protected]>Fixes a5b44c4adb16 ("drm/fbdev-generic: Always use shadow buffering")Cc Thomas Zimmermann <[email protected]>Cc Javier Martinez Canillas <[email protected]>Cc Zack Rusin <[email protected]>Cc Maarten Lankhorst <[email protected]>Cc Maxime Ripard <[email protected]>Cc <[email protected]> # v6.4+--- drivers/gpu/drm/drm_fbdev_generic.c | 1 - 1 file changed, 1 deletion(-)drivers/gpu/drm/drm_fbdev_generic.c +0
-0drivers/gpu/drm/drm_fbdev_generic.c static int drm_fbdev_generic_helper_fb_probe(struct drm_fb_helper *fb_helper, · line 117
Quoted 6 lines
drivers/gpu/drm/drm_fbdev_generic.c +0
-1@@ -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:
Quoted 7 lines
Reviewed-by Javier Martinez Canillas <[email protected]>What about
drivers/gpu/drm/drm_fb_helper.cbtw? 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_SMEMis 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
Quoted 9 lines
--
Best regards,Javier Martinez Canillas
Core Platforms
Red Hat
Signature · 7 lines
-- Thomas Zimmermann Graphics Driver Developer SUSE Software Solutions Germany GmbH Frankenstrasse 146, 90461 Nuernberg, Germany GF: Ivo Totev, Andrew Myers, Andrew McDonald, Boudien Moerman HRB 36809 (AG Nuernberg)
Maxime Ripard
maintainerRe: [PATCH 01/43] drm/fbdev-generic: Do not set physical framebuffer address
In reply to Thomas ZimmermannQuoted 44 lines · Thomas Zimmermann
Hi
Am 18.03.24 um 03:35 schrieb Zack Rusin:
Quoted 31 lines · Thomas Zimmermann
Quoted 30 lines
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 <[email protected]>Fixes a5b44c4adb16 ("drm/fbdev-generic: Always use shadow buffering")Cc Thomas Zimmermann <[email protected]>Cc Javier Martinez Canillas <[email protected]>Cc Zack Rusin <[email protected]>Cc Maarten Lankhorst <[email protected]>Cc Maxime Ripard <[email protected]>Cc <[email protected]> # v6.4+--- drivers/gpu/drm/drm_fbdev_generic.c | 1 - 1 file changed, 1 deletion(-)drivers/gpu/drm/drm_fbdev_generic.c +0
-1@@ -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;Quoted 9 lines
Quoted 4 lines
drivers/gpu/drm/drm_fbdev_generic.c +0
-1/* deferred I/O */ --2.44.0
Good idea. I think given that
drm_leak_fbdev_smemis off by default we could remove the setting ofsmem_startby 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 needdrm_leak_fbdev_smemat all...
Quoted 2 lines
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
Jocelyn Falempe
reviewerRe: [PATCH 12/43] drm/mgag200: Use fbdev-shmem
In reply to Thomas ZimmermannQuoted 10 lines · Thomas Zimmermann
Hi
Am 13.03.24 um 15:03 schrieb Jocelyn Falempe:
Quoted 5 lines
Hi,
Thanks, it looks good to me.
Reviewed-by Jocelyn Falempe <[email protected]>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,
Quoted 4 lines
Best regards
Thomas
Javier Martinez Canillas
maintainerRe: [PATCH 01/43] drm/fbdev-generic: Do not set physical framebuffer address
In reply to Maxime RipardQuoted 48 lines · Maxime Ripard
Quoted 44 lines · Thomas Zimmermann
Hi
Am 18.03.24 um 03:35 schrieb Zack Rusin:
Quoted 31 lines · Thomas Zimmermann
Quoted 30 lines
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 <[email protected]>Fixes a5b44c4adb16 ("drm/fbdev-generic: Always use shadow buffering")Cc Thomas Zimmermann <[email protected]>Cc Javier Martinez Canillas <[email protected]>Cc Zack Rusin <[email protected]>Cc Maarten Lankhorst <[email protected]>Cc Maxime Ripard <[email protected]>Cc <[email protected]> # v6.4+--- drivers/gpu/drm/drm_fbdev_generic.c | 1 - 1 file changed, 1 deletion(-)drivers/gpu/drm/drm_fbdev_generic.c +0
-1@@ -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;Quoted 9 lines
Quoted 4 lines
drivers/gpu/drm/drm_fbdev_generic.c +0
-1/* deferred I/O */ --2.44.0
Good idea. I think given that
drm_leak_fbdev_smemis off by default we could remove the setting ofsmem_startby 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 needdrm_leak_fbdev_smemat all...Quoted 2 lines
All I know is that there's an embedded userspace driver that requires that setting. I don't even know which hardware.
Quoted 7 lines
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.
Quoted 1 line
Maxime
Signature · 5 lines
Best regards, Javier Martinez Canillas Core Platforms Red Hat
Re: [PATCH 05/43] fbdev/deferred-io: Test smem_start for I/O memory
In reply to Thomas ZimmermannQuoted 5 lines · Thomas Zimmermann
Test
smem_startbefore looking up pages from its value. Return NULL if it is unset. This will result in a SIGBUS signal.Signed-off-by Thomas Zimmermann <[email protected]>---
Signature · 5 lines
Best regards, Javier Martinez Canillas Core Platforms Red Hat
Re: [PATCH 06/43] fbdev/deferred-io: Always call get_page() for framebuffer pages
In reply to Thomas ZimmermannQuoted 9 lines · 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_pagehelper. This will be useful for DRM's fbdev emulation.Signed-off-by Thomas Zimmermann <[email protected]>---
Signature · 5 lines
Best regards, Javier Martinez Canillas Core Platforms Red Hat
Re: [PATCH 07/43] fbdev/deferred-io: Provide get_page hook in struct fb_deferred_io
In reply to Thomas ZimmermannQuoted 6 lines · 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
GEM-shmem
Quoted 4 lines
objects.
Signed-off-by Thomas Zimmermann <[email protected]>---
Signature · 5 lines
Best regards, Javier Martinez Canillas Core Platforms Red Hat
Re: [01/43] drm/fbdev-generic: Do not set physical framebuffer address
In reply to Thomas ZimmermannHi,
Quoted 7 lines · Thomas Zimmermann
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.
Quoted 10 lines
Signed-off-by Thomas Zimmermann <[email protected]>Fixes a5b44c4adb16 ("drm/fbdev-generic: Always use shadow buffering")Cc Thomas Zimmermann <[email protected]>Cc Javier Martinez Canillas <[email protected]>Cc Zack Rusin <[email protected]>Cc Maarten Lankhorst <[email protected]>Cc Maxime Ripard <[email protected]>Cc <[email protected]> # v6.4+Reviewed-by Javier Martinez Canillas <[email protected]>Reviewed-by Zack Rusin <[email protected]>
Signature · 2 lines
Best regards, Sui
Re: [PATCH 19/43] drm/virtio: Use fbdev-shmem
In reply to Thomas ZimmermannQuoted 26 lines · 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 <[email protected]>Cc David Airlie <[email protected]>Cc Gerd Hoffmann <[email protected]>Cc Gurchetan Singh <[email protected]>Cc Chia-I Wu <[email protected]>--- drivers/gpu/drm/virtio/virtgpu_drv.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)drivers/gpu/drm/virtio/virtgpu_drv.c +1
-1@@ -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"
drivers/gpu/drm/virtio/virtgpu_drv.c static int virtio_gpu_probe(struct virtio_device *vdev) · line 109
Quoted 8 lines
drivers/gpu/drm/virtio/virtgpu_drv.c +1
-1@@ -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:
Signature · 2 lines
Best regards, Dmitry
Jon Hunter
maintainerRe: [PATCH 42/43] drm/fbdev-generic: Convert to fbdev-ttm
In reply to Thomas ZimmermannHi Thomas,
Quoted 25 lines · 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_HELPERfor loongson.Signed-off-by Thomas Zimmermann <[email protected]>--- 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 100644include/drm/drm_fbdev_generic.h
create mode 100644include/drm/drm_fbdev_ttm.h
...
Quoted 11 lines
include/drm/drm_fbdev_ttm.h new file +5
-0@@ -0,0 +1,15 @@ +/* SPDX-License-Identifier: MIT */ + +#ifndef DRM_FBDEV_TTM_H +#define DRM_FBDEV_TTM_H +
include/drm/drm_fbdev_ttm.h line 15
Quoted 10 lines
include/drm/drm_fbdev_ttm.h new file +10
-0+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
I recently noticed that with Linux v6.11 it is possible to enable CONFIG_DRM_FBDEV_EMULATION without enabling CONFIG_DRM_TTM_HELPER. Now while this does not currently cause any build issues, I believe that if the function drm_fbdev_ttm_setup() is ever used somewhere that does not explicitly select CONFIG_DRM_TTM_HELPER, then you could get a 'ERROR:
modpost: "drm_fbdev_ttm_setup"'.
So I was thinking that may be this should be ...
include/drm/drm_fbdev_ttm.h +1 -1
@@ -5,7 +5,7 @@struct drm_device ; -#ifdef CONFIG_DRM_FBDEV_EMULATION +#if defined(CONFIG_DRM_FBDEV_EMULATION ) && defined(CONFIG_DRM_TTM_HELPER )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)
The above function has been removed now in -next, but I believe we could have the same problem with drm_fbdev_ttm_helper_fb_probe()?
Cheers
Jon
Signature · 1 line
nvpublic
Thomas Zimmermann
maintainerRe: [PATCH 42/43] drm/fbdev-generic: Convert to fbdev-ttm
Hi
Am 22.10.24 um 15:31 schrieb Jon Hunter:
Quoted 81 lines
Hi Thomas,
Quoted 25 lines · 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_HELPERfor loongson.Signed-off-by Thomas Zimmermann <[email protected]>---
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 100644include/drm/drm_fbdev_generic.h
create mode 100644include/drm/drm_fbdev_ttm.h...
Quoted 19 lines
include/drm/drm_fbdev_ttm.h new file +9
-0@@ -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);include/drm/drm_fbdev_ttm.h new file +2
-0+#else +static inline void drm_fbdev_ttm_setup(struct drm_device *dev,unsigned int
preferred_bpp)include/drm/drm_fbdev_ttm.h
Quoted 4 lines
include/drm/drm_fbdev_ttm.h new file +4
-0+{ } +#endif + +#endif I recently noticed that with Linux v6.11 it is possible to enable
CONFIG_DRM_FBDEV_EMULATIONwithout enablingCONFIG_DRM_TTM_HELPER. Now while this does not currently cause any build issues, I believe that if the functiondrm_fbdev_ttm_setup()is ever used somewhere that does not explicitly selectCONFIG_DRM_TTM_HELPER, then you could get a 'ERROR:
modpost: "drm_fbdev_ttm_setup"'.So I was thinking that may be this should be ...
include/drm/drm_fbdev_ttm.h +1
-1@@ -5,7 +5,7 @@ struct drm_device; -#ifdef CONFIG_DRM_FBDEV_EMULATION +#if defined(CONFIG_DRM_FBDEV_EMULATION ) && defined(CONFIG_DRM_TTM_HELPER ) void drm_fbdev_ttm_setup(struct drm_device *dev, unsigned int preferred_bpp); #elsestatic inline void
drm_fbdev_ttm_setup(struct drm_device *dev, unsigned int preferred_bpp)
Quoted 2 lines
The above function has been removed now in -next, but I believe we could have the same problem with
drm_fbdev_ttm_helper_fb_probe()?
We'd turn a linker/modpost error into a compiler error. Likely makes no difference. And AFAICT every driver that selects TTM also selects TTM_HELPER. Drivers without TTM should not use this header.
(DRM_TTM and DRM_TTM_HELPER are separate config options for historical reasons. Maybe one of them could go away.)
Best regards
Thomas
Quoted 4 lines
Cheers
Jon
Signature · 7 lines
-- Thomas Zimmermann Graphics Driver Developer SUSE Software Solutions Germany GmbH Frankenstrasse 146, 90461 Nuernberg, Germany GF: Ivo Totev, Andrew Myers, Andrew McDonald, Boudien Moerman HRB 36809 (AG Nuernberg)
Jon Hunter
maintainerRe: [PATCH 42/43] drm/fbdev-generic: Convert to fbdev-ttm
Quoted 84 lines · Thomas Zimmermann
Hi
Am 22.10.24 um 15:31 schrieb Jon Hunter:
Quoted 81 lines
Hi Thomas,
Quoted 25 lines · 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_HELPERfor loongson.Signed-off-by Thomas Zimmermann <[email protected]>---
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 100644include/drm/drm_fbdev_generic.h
create mode 100644include/drm/drm_fbdev_ttm.h...
Quoted 19 lines
include/drm/drm_fbdev_ttm.h new file +9
-0@@ -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);include/drm/drm_fbdev_ttm.h new file +2
-0+#else +static inline void drm_fbdev_ttm_setup(struct drm_device *dev,unsigned int
preferred_bpp)include/drm/drm_fbdev_ttm.h
Quoted 4 lines
include/drm/drm_fbdev_ttm.h new file +4
-0+{ } +#endif + +#endif I recently noticed that with Linux v6.11 it is possible to enable
CONFIG_DRM_FBDEV_EMULATIONwithout enablingCONFIG_DRM_TTM_HELPER. Now while this does not currently cause any build issues, I believe that if the functiondrm_fbdev_ttm_setup()is ever used somewhere that does not explicitly selectCONFIG_DRM_TTM_HELPER, then you could get a 'ERROR:
modpost: "drm_fbdev_ttm_setup"'.So I was thinking that may be this should be ...
include/drm/drm_fbdev_ttm.h +1
-1@@ -5,7 +5,7 @@ struct drm_device; -#ifdef CONFIG_DRM_FBDEV_EMULATION +#if defined(CONFIG_DRM_FBDEV_EMULATION ) && defined(CONFIG_DRM_TTM_HELPER ) void drm_fbdev_ttm_setup(struct drm_device *dev, unsigned int preferred_bpp); #elsestatic inline void
drm_fbdev_ttm_setup(struct drm_device *dev, unsigned int preferred_bpp)
Quoted 4 lines
Quoted 2 lines
The above function has been removed now in -next, but I believe we could have the same problem with
drm_fbdev_ttm_helper_fb_probe()?We'd turn a linker/modpost error into a compiler error. Likely makes no difference. And AFAICT every driver that selects TTM also selects
TTM_HELPER. Drivers without TTM should not use this header.
Yes I also noted that all the current drivers select TTM_HELPER and so we don't run into this. However, it still seems a bit odd that we don't expose a proper stub if TTM_HELPER is disabled (especially seeing as there is a stub defined).
Jon
Signature · 1 line
nvpublic
Thomas Zimmermann
maintainerRe: [PATCH 42/43] drm/fbdev-generic: Convert to fbdev-ttm
Hi
Am 22.10.24 um 17:36 schrieb Jon Hunter:
Quoted 5 lines
Quoted 2 lines
We'd turn a linker/modpost error into a compiler error. Likely makes no difference. And AFAICT every driver that selects TTM also selects
TTM_HELPER. Drivers without TTM should not use this header.Yes I also noted that all the current drivers select
TTM_HELPERand so we don't run into this. However, it still seems a bit odd that we don't expose a proper stub ifTTM_HELPERis disabled (especially seeing as there is a stub defined).
It's not different from other headers AFAICT. For example, the TTM headers don't guard any of their interfaces or provide stubs. The guards and stubs only make sense if an interface really is optional wrt some config token. That's not the case here wrt DRM_TTM_HELPER.
Best regards
Thomas
Quoted 3 lines
Jon
Signature · 7 lines
-- Thomas Zimmermann Graphics Driver Developer SUSE Software Solutions Germany GmbH Frankenstrasse 146, 90461 Nuernberg, Germany GF: Ivo Totev, Andrew Myers, Andrew McDonald, Boudien Moerman HRB 36809 (AG Nuernberg)
Jon Hunter
maintainerRe: [PATCH 42/43] drm/fbdev-generic: Convert to fbdev-ttm
Quoted 10 lines · Thomas Zimmermann
Hi
Am 22.10.24 um 17:36 schrieb Jon Hunter:
Quoted 5 lines
Quoted 2 lines
We'd turn a linker/modpost error into a compiler error. Likely makes no difference. And AFAICT every driver that selects TTM also selects
TTM_HELPER. Drivers without TTM should not use this header.Yes I also noted that all the current drivers select
TTM_HELPERand so we don't run into this. However, it still seems a bit odd that we don't expose a proper stub ifTTM_HELPERis disabled (especially seeing as there is a stub defined).It's not different from other headers AFAICT. For example, the TTM headers don't guard any of their interfaces or provide stubs. The guards and stubs only make sense if an interface really is optional wrt some config token. That's not the case here wrt
DRM_TTM_HELPER.
Just to be clear, there is a stub for this case which was added by this patch ...
#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
The point I am trying to make is that this stub is only defined if !CONFIG_DRM_FBDEV_EMULATION. However, the problem is that if CONFIG_DRM_FBDEV_EMULATION is enabled, but CONFIG_DRM_TTM_HELPER is not the stub is not defined, when it should be. Yes as we discussed this does not impact any current users and so may be that is fine, but it seems it would be better to have no stub at all, rather than one that is defined for some configurations but not all cases where the actual drm_fbdev_ttm_setup() function is not available. Again this whole thing could be moot anyway, because this is going away completely from looking at -next.
Cheers!
Jon
Signature · 1 line
nvpublic
Jon Hunter
maintainerRe: [PATCH 42/43] drm/fbdev-generic: Convert to fbdev-ttm
Quoted 24 lines · Jon Hunter
Quoted 10 lines · Thomas Zimmermann
Hi
Am 22.10.24 um 17:36 schrieb Jon Hunter:
Quoted 5 lines
Quoted 2 lines
We'd turn a linker/modpost error into a compiler error. Likely makes no difference. And AFAICT every driver that selects TTM also selects
TTM_HELPER. Drivers without TTM should not use this header.Yes I also noted that all the current drivers select
TTM_HELPERand so we don't run into this. However, it still seems a bit odd that we don't expose a proper stub ifTTM_HELPERis disabled (especially seeing as there is a stub defined).It's not different from other headers AFAICT. For example, the TTM headers don't guard any of their interfaces or provide stubs. The guards and stubs only make sense if an interface really is optional wrt some config token. That's not the case here wrt
DRM_TTM_HELPER.Just to be clear, there is a stub for this case which was added by this patch ...
#ifdef
CONFIG_DRM_FBDEV_EMULATION
voiddrm_fbdev_ttm_setup(struct drm_device *dev, unsigned int preferred_bpp); #else
static inline voiddrm_fbdev_ttm_setup(struct drm_device *dev, unsigned int preferred_bpp){ }
#endif
Quoted 10 lines
The point I am trying to make is that this stub is only defined if !CONFIG_DRM_FBDEV_EMULATION. However, the problem is that if
CONFIG_DRM_FBDEV_EMULATIONis enabled, butCONFIG_DRM_TTM_HELPERis not the stub is not defined, when it should be. Yes as we discussed this does not impact any current users and so may be that is fine, but it seems it would be better to have no stub at all, rather than one that is defined for some configurations but not all cases where the actualdrm_fbdev_ttm_setup()function is not available. Again this whole thing could be moot anyway, because this is going away completely from looking at -next.
Unless what you are saying is that this is deliberate to catch any users that don't enable CONFIG_DRM_TTM_HELPER where they should be?
Jon
Signature · 1 line
nvpublic