Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
4947a25
vt_drmfb: drop dependency on struct drm_fb_helper
wulf7 Oct 13, 2024
9995b16
Move skip_ddb global from drm to vt_drmfb
wulf7 Oct 13, 2024
a30d08d
Move registration of fictitious page ranges back to framebufer
wulf7 Oct 14, 2024
9361e49
drivers/gpu/drm/drm_os_freebsd.[ch]: Minor cleanup
wulf7 Oct 14, 2024
1c5706e
linux/fb.h: Simplify deferred I/O - related macros
wulf7 Dec 2, 2024
4b11f95
Move sys_ functions from linux_fb.c to BSD linux/fb.h
wulf7 Dec 2, 2024
b1e27a0
Move remnants of GPL-licensed linux/fb.h to BSD-licensed one
wulf7 Feb 21, 2026
9f5303c
Delete GPL-licensed linux/fb.h
wulf7 Feb 21, 2026
6890b2e
linux_fb.c: Add linuxkpi prefix to all exportable functions
wulf7 Mar 3, 2026
0bd7ff0
Move linux_fb.c and vt_drmfb.[ch] from drm.ko to linux_video.ko
wulf7 Mar 3, 2026
8a629af
linux_fb.c: Fix build after moving linux_fb.c to linux_video
wulf7 Mar 3, 2026
6366809
linuxkpi_video: Use aperture_remove_conflicting_(pci_)devices from li…
wulf7 Mar 3, 2026
1c6c6bb
vt_drmfb.c: Make all vt_driver members static
wulf7 Mar 4, 2026
1c9b720
vt_drmfb: Do not use wrappers to call vt_suspend and vt_resume
wulf7 Mar 6, 2026
dab767d
Move skip_ddb declaration from vt_drmfb.h to linux/fb.h
wulf7 Mar 6, 2026
5753b0b
Do not panic if aperture_base or aperture_size is not defined
wulf7 Mar 6, 2026
459db94
linux/fb.h: Remove extraneous porting from struct fb_fix_screeninfo
wulf7 Mar 7, 2026
0904752
vt_drmfb: Convert to kernel module compatible with system fbd
wulf7 May 31, 2026
a192bd1
vt_drmfb: Convert to generic postswitch handler
wulf7 May 31, 2026
a7ad4b3
linux_fb.c: Remove PCI_STD_NUM_BARS definition
wulf7 May 31, 2026
9f586e3
linux/fb.h: Add dummy fb_deferred_io_cleanup() implementation
wulf7 May 31, 2026
36741ab
linux_fb: do not truncate bitmap in vt_drmfb bitblt
wulf7 May 31, 2026
58a257c
vt_drmfb: Inherit vt_fb init and fini methods
wulf7 Jun 1, 2026
a001457
linux_fb: allocate fbd unit number automaticaly with DEVICE_UNIT_ANY
wulf7 Jun 1, 2026
c50479b
vt_drmfb: sort #includes
wulf7 Jun 2, 2026
5840c30
linuxkpi_video: rename files to match LinuxKPI
wulf7 Jun 2, 2026
929169d
linux_hdmi.c: Drop remnants of drm dependency
wulf7 Jun 2, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 5 additions & 8 deletions drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
Original file line number Diff line number Diff line change
Expand Up @@ -4387,11 +4387,12 @@ int amdgpu_device_init(struct amdgpu_device *adev,
* stopped setting them when it got rid of its specific framebuffer
* initialization to use the generic drm_fb_helper code.
*
* We can't do this in register_framebuffer() anymore because the
* values passed to register_fictitious_range() below are unavailable
* from a generic structure set by both drivers.
* To keep doing this in register_framebuffer() the values are passed
* to register_fictitious_range() in additional FreeBSD-specific fields
* of drm_driver structure.
*/
register_fictitious_range(ddev, adev->gmc.aper_base, adev->gmc.aper_size);
adev_to_drm(adev)->aperture_base = adev->gmc.aper_base;
adev_to_drm(adev)->aperture_size = adev->gmc.aper_size;
#endif

amdgpu_fence_driver_hw_init(adev);
Expand Down Expand Up @@ -4604,10 +4605,6 @@ void amdgpu_device_fini_hw(struct amdgpu_device *adev)
/* disable ras feature must before hw fini */
amdgpu_ras_pre_fini(adev);

#ifdef __FreeBSD__
unregister_fictitious_range(adev_to_drm(adev), adev->gmc.aper_base, adev->gmc.aper_size);
#endif

amdgpu_ttm_set_buffer_funcs_status(adev, false);

amdgpu_device_ip_fini_early(adev);
Expand Down
13 changes: 5 additions & 8 deletions drivers/gpu/drm/drm_fb_helper.c
Original file line number Diff line number Diff line change
Expand Up @@ -46,11 +46,6 @@
#include "drm_internal.h"
#include "drm_crtc_internal.h"

#ifdef __FreeBSD__
#define register_framebuffer linux_register_framebuffer
#define unregister_framebuffer linux_unregister_framebuffer
#endif

static bool drm_fbdev_emulation = true;
module_param_named(fbdev_emulation, drm_fbdev_emulation, bool, 0600);
MODULE_PARM_DESC(fbdev_emulation,
Expand Down Expand Up @@ -1900,15 +1895,17 @@ __drm_fb_helper_initial_config_and_unlock(struct drm_fb_helper *fb_helper)
info = fb_helper->info;
info->var.pixclock = 0;

#ifdef __FreeBSD__
info->fbio.fb_priv = fb_helper;
#endif

/* 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. */
mutex_unlock(&fb_helper->lock);

#ifdef __FreeBSD__
info->fb_bsddev = dev->dev->bsddev;
info->aperture_base = dev->aperture_base;
info->aperture_size = dev->aperture_size;
#endif
ret = register_framebuffer(info);
if (ret < 0)
return ret;
Expand Down
2 changes: 0 additions & 2 deletions drivers/gpu/drm/drm_fbdev_ttm.c
Original file line number Diff line number Diff line change
Expand Up @@ -46,9 +46,7 @@ static void drm_fbdev_ttm_fb_destroy(struct fb_info *info)
if (!fb_helper->dev)
return;

#ifdef __linux__
fb_deferred_io_cleanup(info);
#endif
drm_fb_helper_fini(fb_helper);
vfree(shadow);
drm_client_framebuffer_delete(fb_helper->buffer);
Expand Down
76 changes: 8 additions & 68 deletions drivers/gpu/drm/drm_os_freebsd.c
Original file line number Diff line number Diff line change
@@ -1,40 +1,25 @@
#include <sys/types.h>
#include <sys/bus.h>
#include <sys/reboot.h>

#include <sys/cdefs.h>
__FBSDID("$FreeBSD$");
#include <linux/cdev.h>
#undef cdev
#include <linux/fb.h> /* linuxkpi_skip_ddb */

#include <drm/drm_device.h>
#include <drm/drm_file.h>
#include <drm/drm_ioctl.h>
#include <drm/drm_print.h>
#include <drm/drm_fb_helper.h>
#include <drm/drm_os_freebsd.h>

#include <sys/types.h>
#include <sys/bus.h>
#include <dev/agp/agpreg.h>
#include <dev/pci/pcireg.h>
#include <sys/reboot.h>
#include <sys/fbio.h>
#include <dev/vt/vt.h>
#include <dev/iicbus/iicbus.h>
#include <dev/iicbus/iiconf.h>

#include <vm/vm_phys.h>

#include <linux/cdev.h>
#include <linux/fb.h>
#undef fb_info
#undef cdev

MALLOC_DEFINE(DRM_MEM_DRIVER, "drm_driver", "DRM DRIVER Data Structures");

SYSCTL_NODE(_dev, OID_AUTO, drm, CTLFLAG_RW, 0, "DRM args (compat)");
SYSCTL_LONG(_dev_drm, OID_AUTO, __drm_debug, CTLFLAG_RWTUN, &__drm_debug, 0, "drm debug flags (compat)");
SYSCTL_NODE(_hw, OID_AUTO, dri, CTLFLAG_RW, 0, "DRI args");
SYSCTL_LONG(_hw_dri, OID_AUTO, __drm_debug, CTLFLAG_RWTUN, &__drm_debug, 0, "drm debug flags");
int skip_ddb;
SYSCTL_INT(_dev_drm, OID_AUTO, skip_ddb, CTLFLAG_RWTUN, &skip_ddb, 0, "go straight to dumping core (compat)");
SYSCTL_INT(_hw_dri, OID_AUTO, skip_ddb, CTLFLAG_RWTUN, &skip_ddb, 0, "go straight to dumping core");
SYSCTL_INT(_dev_drm, OID_AUTO, skip_ddb, CTLFLAG_RWTUN, &linuxkpi_skip_ddb, 0, "go straight to dumping core (compat)");
SYSCTL_INT(_hw_dri, OID_AUTO, skip_ddb, CTLFLAG_RWTUN, &linuxkpi_skip_ddb, 0, "go straight to dumping core");
#if defined(DRM_DEBUG_LOG_ALL)
int drm_debug_persist = 1;
#else
Expand Down Expand Up @@ -78,44 +63,6 @@ sysctl_pci_id(SYSCTL_HANDLER_ARGS)
return (sysctl_handle_string(oidp, buf, sizeof(buf), req));
}

int
register_fictitious_range(struct drm_device *ddev, vm_paddr_t base, size_t size)
{
int ret;
struct apertures_struct *ap;

MPASS(base != 0);
MPASS(size != 0);

ap = alloc_apertures(1);
ap->ranges[0].base = base;
ap->ranges[0].size = size;
vt_freeze_main_vd(ap);
kfree(ap);

ret = vm_phys_fictitious_reg_range(base, base + size,
#ifdef VM_MEMATTR_WRITE_COMBINING
VM_MEMATTR_WRITE_COMBINING
#else
VM_MEMATTR_UNCACHEABLE
#endif
);
MPASS(ret == 0);

ddev->fictitious_range_registered = true;

return (ret);
}

void
unregister_fictitious_range(struct drm_device *ddev, vm_paddr_t base, size_t size)
{
if (ddev->fictitious_range_registered) {
vm_phys_fictitious_unreg_range(base, base + size);
vt_unfreeze_main_vd();
}
}

/* Framebuffer related code */

int
Expand Down Expand Up @@ -182,13 +129,6 @@ MODULE_VERSION(drmn, 2);
#ifdef CONFIG_AGP
MODULE_DEPEND(drmn, agp, 1, 1, 1);
#endif
DRIVER_MODULE(iicbus, drmn, iicbus_driver, NULL, NULL);
DRIVER_MODULE(acpi_iicbus, drmn, acpi_iicbus_driver, NULL, NULL);
MODULE_DEPEND(drmn, iicbus, IICBUS_MINVER, IICBUS_PREFVER, IICBUS_MAXVER);
MODULE_DEPEND(drmn, iic, 1, 1, 1);
MODULE_DEPEND(drmn, iicbb, IICBB_MINVER, IICBB_PREFVER, IICBB_MAXVER);
MODULE_DEPEND(drmn, pci, 1, 1, 1);
MODULE_DEPEND(drmn, mem, 1, 1, 1);
MODULE_DEPEND(drmn, linuxkpi, 1, 1, 1);
MODULE_DEPEND(drmn, linuxkpi_video, 1, 1, 1);
MODULE_DEPEND(drmn, dmabuf, 1, 1, 1);
Expand Down
37 changes: 5 additions & 32 deletions drivers/gpu/drm/drm_os_freebsd.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,11 @@
* OS abstraction macros.
*/

#include <sys/cdefs.h>
__FBSDID("$FreeBSD$");

#ifndef _DRM_OS_FREEBSD_H_
#define _DRM_OS_FREEBSD_H_

#include <sys/fbio.h>
#include <sys/priv.h>
#include <sys/smp.h>
#include <sys/param.h>
#include <sys/bus.h>

#include <linux/mod_devicetable.h>
#include <linux/fb.h>
Expand All @@ -25,36 +21,13 @@ __FBSDID("$FreeBSD$");
#define EREMOTEIO EIO

#define KTR_DRM KTR_DEV
#define KTR_DRM_REG KTR_SPARE3

MALLOC_DECLARE(DRM_MEM_DRIVER);
struct drm_minor;
struct device;

extern int skip_ddb;
MALLOC_DECLARE(DRM_MEM_DRIVER);

struct drm_minor;
int drm_dev_alias(struct device *dev, struct drm_minor *minor, const char *minor_str);
void cancel_reset_debug_log(void);

void vt_freeze_main_vd(struct apertures_struct *a);
void vt_unfreeze_main_vd(void);

struct drm_device;
int register_fictitious_range(struct drm_device *ddev, vm_paddr_t start, vm_paddr_t end);
void unregister_fictitious_range(struct drm_device *ddev, vm_paddr_t start, vm_paddr_t end);

#if 0
struct linux_fb_info;
static inline void vga_switcheroo_unregister_client(struct pci_dev *pdev) {}
static inline int vga_switcheroo_register_client(struct pci_dev *pdev,
const struct vga_switcheroo_client_ops *ops) { return 0; }
static inline void vga_switcheroo_client_fb_set(struct pci_dev *pdev, struct linux_fb_info *info) {}
static inline int vga_switcheroo_register_handler(struct vga_switcheroo_handler *handler) { return 0; }
static inline int vga_switcheroo_register_audio_client(struct pci_dev *pdev,
const struct vga_switcheroo_client_ops *ops,
int id, bool active) { return 0; }
static inline void vga_switcheroo_unregister_handler(void) {}
static inline int vga_switcheroo_process_delayed_switch(void) { return 0; }
static inline int vga_switcheroo_get_client_state(struct pci_dev *pdev) { return VGA_SWITCHEROO_ON; }
#endif

#endif /* _DRM_OS_FREEBSD_H_ */
16 changes: 5 additions & 11 deletions drivers/gpu/drm/i915/display/intel_fbdev.c
Original file line number Diff line number Diff line change
Expand Up @@ -140,13 +140,6 @@ static void intel_fbdev_fb_destroy(struct fb_info *info)
struct drm_fb_helper *fb_helper = info->par;
struct intel_fbdev *ifbdev = container_of(fb_helper, struct intel_fbdev, helper);

#ifdef __FreeBSD__
unregister_fictitious_range(
fb_helper->dev,
ifbdev->helper.info->fix.smem_start,
ifbdev->helper.info->fix.smem_len);
#endif

drm_fb_helper_fini(&ifbdev->helper);

/*
Expand Down Expand Up @@ -270,11 +263,12 @@ static int intelfb_create(struct drm_fb_helper *helper,
* driver stopped setting them when it got rid of its specific
* framebuffer initialization to use the generic drm_fb_helper code.
*
* We can't do this in register_framebuffer() anymore because the
* values passed to register_fictitious_range() below are unavailable
* from a generic structure set by both drivers.
* To keep doing this in register_framebuffer() the values are passed
* to register_fictitious_range() in additional FreeBSD-specific fields
* of drm_driver structure.
*/
register_fictitious_range(dev, info->fix.smem_start, info->fix.smem_len);
dev->aperture_base = info->fix.smem_start;
dev->aperture_size = info->fix.smem_len;
#endif

drm_fb_helper_fill_info(info, &ifbdev->helper, sizes);
Expand Down
14 changes: 5 additions & 9 deletions drivers/gpu/drm/radeon/radeon_fbdev.c
Original file line number Diff line number Diff line change
Expand Up @@ -177,11 +177,6 @@ static void radeon_fbdev_fb_destroy(struct fb_info *info)
struct drm_framebuffer *fb = fb_helper->fb;
struct drm_gem_object *gobj = drm_gem_fb_get_obj(fb, 0);

#ifdef __FreeBSD__
struct radeon_device *rdev = fb_helper->dev->dev_private;
unregister_fictitious_range(fb_helper->dev, rdev->mc.aper_base, rdev->mc.aper_size);
#endif

drm_fb_helper_fini(fb_helper);

drm_framebuffer_unregister_private(fb);
Expand Down Expand Up @@ -284,11 +279,12 @@ static int radeon_fbdev_fb_helper_fb_probe(struct drm_fb_helper *fb_helper,
* driver stopped setting them when it got rid of its specific
* framebuffer initialization to use the generic drm_fb_helper code.
*
* We can't do this in register_framebuffer() anymore because the
* values passed to register_fictitious_range() below are unavailable
* from a generic structure set by both drivers.
* To keep doing this in register_framebuffer() the values are passed
* to register_fictitious_range() in additional FreeBSD-specific fields
* of drm_driver structure.
*/
register_fictitious_range(fb_helper->dev, rdev->mc.aper_base, rdev->mc.aper_size);
rdev->ddev.aperture_base = rdev->mc.aper_base;
rdev->ddev.aperture_size = rdev->mc.aper_size;
#endif

/* Use default scratch pixmap (info->pixmap.flags = FB_PIXMAP_SYSTEM) */
Expand Down
44 changes: 0 additions & 44 deletions drivers/gpu/drm/vt_drmfb.h

This file was deleted.

10 changes: 2 additions & 8 deletions drivers/video/aperture.c → drivers/video/linux_aperture.c
Original file line number Diff line number Diff line change
Expand Up @@ -244,6 +244,7 @@ int devm_aperture_acquire_for_platform_device(struct platform_device *pdev,
}
EXPORT_SYMBOL(devm_aperture_acquire_for_platform_device);

#ifdef __linux__
static void aperture_detach_devices(resource_size_t base, resource_size_t size)
{
resource_size_t end = base + size;
Expand Down Expand Up @@ -293,9 +294,7 @@ int aperture_remove_conflicting_devices(resource_size_t base, resource_size_t si
* ask for this, so let's assume that a real driver for the display
* was already probed and prevent sysfb to register devices later.
*/
#ifdef __linux__
sysfb_disable(NULL);
#endif

aperture_detach_devices(base, size);

Expand Down Expand Up @@ -330,11 +329,7 @@ int __aperture_remove_legacy_vga_devices(struct pci_dev *pdev)
aperture_detach_devices(VGA_FB_PHYS_BASE, VGA_FB_PHYS_SIZE);

/* VGA textmode console */
#ifdef __linux__
return vga_remove_vgacon(pdev);
#elif defined(__FreeBSD__)
return 0;
#endif
}
EXPORT_SYMBOL(__aperture_remove_legacy_vga_devices);

Expand All @@ -355,9 +350,7 @@ int aperture_remove_conflicting_pci_devices(struct pci_dev *pdev, const char *na
resource_size_t base, size;
int bar, ret = 0;

#ifdef __linux__
sysfb_disable(&pdev->dev);
#endif

for (bar = 0; bar < PCI_STD_NUM_BARS; ++bar) {
if (!(pci_resource_flags(pdev, bar) & IORESOURCE_MEM))
Expand All @@ -379,4 +372,5 @@ int aperture_remove_conflicting_pci_devices(struct pci_dev *pdev, const char *na
return ret;

}
#endif
EXPORT_SYMBOL(aperture_remove_conflicting_pci_devices);
File renamed without changes.
Loading