git: 9e4dfe63a77a - main - LinuxKPI: Add PCI method for transferring framebuffer parameters
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Fri, 20 Nov 2026 18:19:34 UTC
The branch main has been updated by wulf:
URL: https://cgit.FreeBSD.org/src/commit/?id=9e4dfe63a77a57727c7be14eb9513e8b308cdf07
commit 9e4dfe63a77a57727c7be14eb9513e8b308cdf07
Author: Vladimir Kondratyev <wulf@FreeBSD.org>
AuthorDate: 2026-11-20 18:17:58 +0000
Commit: Vladimir Kondratyev <wulf@FreeBSD.org>
CommitDate: 2026-11-20 18:17:58 +0000
LinuxKPI: Add PCI method for transferring framebuffer parameters
from LKPI video driver to FreeBSD native framebuffer driver.
This makes possible to attach framebuffer driver in traditional way
using newbus interface rather than direct calls into vt internals.
It is required to make LKPI framebuffer driver compatible with
fbd/vt_fb. As a consequence that allows us to switch back to vt_fb on
radeon driver where vt_drmfb regressions have been reported [1].
The method expects fbd device ivars pointed to FreeBSD fb_info
structure embedded in to Linux fb_info structure. See linux/fb.h.
Note that some out-of-tree non-PCI drm drivers may require similar
changes in parent bus drivers.
[1] https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=285088
PR: 285088
Differential Revision: https://reviews.freebsd.org/D60038
---
sys/compat/linuxkpi/common/src/linux_pci.c | 23 +++++++++++++++++++++++
sys/modules/linuxkpi/Makefile | 2 +-
2 files changed, 24 insertions(+), 1 deletion(-)
diff --git a/sys/compat/linuxkpi/common/src/linux_pci.c b/sys/compat/linuxkpi/common/src/linux_pci.c
index 365bd2c020b2..d095b5be8ba9 100644
--- a/sys/compat/linuxkpi/common/src/linux_pci.c
+++ b/sys/compat/linuxkpi/common/src/linux_pci.c
@@ -44,6 +44,7 @@
#include <sys/sysctl.h>
#include <sys/lock.h>
#include <sys/mutex.h>
+#include <sys/fbio.h>
#include <sys/fcntl.h>
#include <sys/file.h>
#include <sys/filio.h>
@@ -82,6 +83,7 @@
#include <linux/backlight.h>
#include "backlight_if.h"
+#include "fb_if.h"
#include "pcib_if.h"
/* -------------------------------------------------------------------------- */
@@ -2551,6 +2553,23 @@ linux_backlight_device_unregister(struct backlight_device *bd)
free(bd, M_DEVBUF);
}
+static struct fb_info *
+lkpi_fb_helper_getinfo(device_t dev)
+{
+ struct pci_dev *pdev;
+ device_t fbd;
+
+ pdev = device_get_softc(dev);
+ if (pdev->pdrv == NULL || !pdev->pdrv->isdrm)
+ return (NULL);
+
+ fbd = device_find_child(dev, "fbd", -1);
+ if (fbd == NULL)
+ return (NULL);
+
+ return (device_get_ivars(fbd));
+}
+
/* -------------------------------------------------------------------------- */
/* Native bus attachment glue. */
@@ -2573,5 +2592,9 @@ static device_method_t pci_methods[] = {
DEVMETHOD(backlight_update_status, lkpi_backlight_update_status),
DEVMETHOD(backlight_get_status, lkpi_backlight_get_status),
DEVMETHOD(backlight_get_info, lkpi_backlight_get_info),
+
+ /* Framebuffer service methods */
+ DEVMETHOD(fb_getinfo, lkpi_fb_helper_getinfo),
+
DEVMETHOD_END
};
diff --git a/sys/modules/linuxkpi/Makefile b/sys/modules/linuxkpi/Makefile
index 97319194946e..c0e248099115 100644
--- a/sys/modules/linuxkpi/Makefile
+++ b/sys/modules/linuxkpi/Makefile
@@ -50,7 +50,7 @@ SRCS+= opt_acpi.h acpi_if.h linux_acpi.c
SRCS+= opt_apic.h
.endif
-SRCS+= opt_ddb.h
+SRCS+= fb_if.h opt_ddb.h
SRCS+= ${LINUXKPI_GENSRCS}
CFLAGS+= ${LINUXKPI_INCLUDES}