summaryrefslogtreecommitdiff
path: root/sys
diff options
context:
space:
mode:
authorJonathan Gray <jsg@cvs.openbsd.org>2024-07-08 02:13:37 +0000
committerJonathan Gray <jsg@cvs.openbsd.org>2024-07-08 02:13:37 +0000
commitba33eed495e54310413ec9a61fc38f7e5534d339 (patch)
tree01d0ce5044560109103f4a046a6c15da82f86f68 /sys
parentba280077977ed2f2f7ca4d7932cff9673a4a3718 (diff)
drm/fbdev-dma: Only set smem_start is enable per module option
From Thomas Zimmermann f29fcfbf6067c0d8c83f84a045da9276c08deac5 in linux-6.6.y/6.6.37 d92a7580392ad4681b1d4f9275d00b95375ebe01 in mainline linux
Diffstat (limited to 'sys')
-rw-r--r--sys/dev/pci/drm/drm_fb_helper.c6
-rw-r--r--sys/dev/pci/drm/drm_fbdev_dma.c5
2 files changed, 7 insertions, 4 deletions
diff --git a/sys/dev/pci/drm/drm_fb_helper.c b/sys/dev/pci/drm/drm_fb_helper.c
index 0911eb6cdfd..1a0be9cb24e 100644
--- a/sys/dev/pci/drm/drm_fb_helper.c
+++ b/sys/dev/pci/drm/drm_fb_helper.c
@@ -532,6 +532,9 @@ struct fb_info *drm_fb_helper_alloc_info(struct drm_fb_helper *fb_helper)
if (!info)
return ERR_PTR(-ENOMEM);
+ if (!drm_leak_fbdev_smem)
+ info->flags |= FBINFO_HIDE_SMEM_START;
+
#ifdef __linux__
ret = fb_alloc_cmap(&info->cmap, 256, 0);
if (ret)
@@ -1925,9 +1928,6 @@ __drm_fb_helper_initial_config_and_unlock(struct drm_fb_helper *fb_helper)
info = fb_helper->info;
info->var.pixclock = 0;
- if (!drm_leak_fbdev_smem)
- info->flags |= FBINFO_HIDE_SMEM_START;
-
/* Need to drop locks to avoid recursive deadlock in
* register_framebuffer. This is ok because the only thing left to do is
* register the fbdev emulation instance in kernel_fb_helper_list. */
diff --git a/sys/dev/pci/drm/drm_fbdev_dma.c b/sys/dev/pci/drm/drm_fbdev_dma.c
index 4ef5cbb3af2..64e81c320b5 100644
--- a/sys/dev/pci/drm/drm_fbdev_dma.c
+++ b/sys/dev/pci/drm/drm_fbdev_dma.c
@@ -138,7 +138,10 @@ static int drm_fbdev_dma_helper_fb_probe(struct drm_fb_helper *fb_helper,
info->flags |= FBINFO_READS_FAST; /* signal caching */
info->screen_size = sizes->surface_height * fb->pitches[0];
info->screen_buffer = map.vaddr;
- info->fix.smem_start = page_to_phys(virt_to_page(info->screen_buffer));
+ if (!(info->flags & FBINFO_HIDE_SMEM_START)) {
+ if (!drm_WARN_ON(dev, is_vmalloc_addr(info->screen_buffer)))
+ info->fix.smem_start = page_to_phys(virt_to_page(info->screen_buffer));
+ }
info->fix.smem_len = info->screen_size;
return 0;