public inbox for linux-fbdev@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH v1 v1 0/4] [RUST] Framebuffer driver support
@ 2026-01-26  8:17 pengfuyuan
  2026-01-26  8:17 ` [PATCH v1 v1 1/4] rust: io: mem: add ioremap_wc support pengfuyuan
                   ` (6 more replies)
  0 siblings, 7 replies; 19+ messages in thread
From: pengfuyuan @ 2026-01-26  8:17 UTC (permalink / raw)
  To: Danilo Krummrich, Alice Ryhl, Daniel Almeida, Miguel Ojeda
  Cc: Boqun Feng, Gary Guo, Björn Roy Baron, Benno Lossin,
	Andreas Hindborg, Trevor Gross, Greg Kroah-Hartman,
	Rafael J . Wysocki, David Airlie, Simona Vetter, Helge Deller,
	Hans de Goede, Thomas Zimmermann, Lee Jones, Sam Ravnborg,
	Zsolt Kajtar, Ville Syrjälä, rust-for-linux,
	linux-kernel, dri-devel, linux-fbdev, pengfuyuan

This patch series adds Rust bindings and safe abstractions for the Linux
framebuffer subsystem, enabling framebuffer drivers to be implemented in Rust.

The series consists of 4 patches:

1. rust: io: mem: add ioremap_wc support
   Adds write-combining memory mapping support to the Rust iomem abstraction,
   which is essential for framebuffer memory regions that benefit from
   write-combining semantics.

2. rust: device: add platdata accessors
   Implements generic accessors for platform data, enabling drivers to access
   platform-provided configuration. This is needed for framebuffer drivers
   that use platform data for configuration.

3. rust: fb: add framebuffer driver support
   Adds the core framebuffer framework abstraction, including:
   - Device abstraction (`fb::Device`) with reference counting via `AlwaysRefCounted`
   - Driver and Operations traits (`fb::Driver`, `fb::Operations`)
   - Screen information wrappers (`fb::FixScreenInfo`, `fb::VarScreenInfo`)
   - I/O operation helpers (`fb_io_read`, `fb_io_write`, `fb_io_mmap`)
   - Blit operation helpers (`cfb_fillrect`, `cfb_copyarea`, `cfb_imageblit`)

4. rust: fb: add simplefb test driver
   Adds a test driver that validates the framebuffer framework by porting
   the C simplefb driver to Rust. This driver serves as both a validation
   tool and a reference implementation for future Rust framebuffer drivers.

The implementation follows the same patterns established in the DRM subsystem
and maintains full compatibility with the existing C framebuffer subsystem.
All C callbacks are properly bridged to Rust trait methods via the `Operations`
trait, memory safety is ensured through proper use of `Opaque<fb_info>`, `ARef`,
and `AlwaysRefCounted` for reference counting, type invariants are documented
and enforced through the type system, and resource cleanup is handled via RAII
with proper cleanup order.

Testing:
--------
This series has been tested on:
- ARM64 platforms with various display configurations
- AMD RX550 graphics card
- Moore Threads S30 graphics card
- Multiple other graphics cards

All tested configurations show normal display functionality with proper
framebuffer initialization, rendering operations (including I/O, color register
management, and blitting), memory mapping, and resource cleanup. The simplefb
test driver successfully demonstrates the usage of all framebuffer framework
APIs and validates the abstraction's correctness.

The simplefb test driver serves as both a validation tool and a reference
implementation for future Rust framebuffer drivers.


pengfuyuan (4):
  rust: io: mem: add ioremap_wc support
  rust: device: add platdata accessors
  rust: fb: add framebuffer driver support
  rust: fb: add simplefb test driver

 drivers/video/fbdev/Kconfig          |  21 +
 drivers/video/fbdev/Makefile         |   1 +
 drivers/video/fbdev/simplefb_rust.rs | 653 +++++++++++++++++++++++++++
 rust/bindings/bindings_helper.h      |   2 +
 rust/helpers/device.c                |   5 +
 rust/helpers/io.c                    |   5 +
 rust/kernel/device.rs                |  31 ++
 rust/kernel/fb/blit.rs               | 106 +++++
 rust/kernel/fb/device.rs             | 463 +++++++++++++++++++
 rust/kernel/fb/driver.rs             | 169 +++++++
 rust/kernel/fb/io.rs                 |  76 ++++
 rust/kernel/fb/mod.rs                |  23 +
 rust/kernel/fb/screeninfo.rs         | 318 +++++++++++++
 rust/kernel/io/mem.rs                |  71 +++
 rust/kernel/lib.rs                   |   2 +
 15 files changed, 1946 insertions(+)
 create mode 100644 drivers/video/fbdev/simplefb_rust.rs
 create mode 100644 rust/kernel/fb/blit.rs
 create mode 100644 rust/kernel/fb/device.rs
 create mode 100644 rust/kernel/fb/driver.rs
 create mode 100644 rust/kernel/fb/io.rs
 create mode 100644 rust/kernel/fb/mod.rs
 create mode 100644 rust/kernel/fb/screeninfo.rs

-- 
2.25.1


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

end of thread, other threads:[~2026-01-28 14:55 UTC | newest]

Thread overview: 19+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-01-26  8:17 [PATCH v1 v1 0/4] [RUST] Framebuffer driver support pengfuyuan
2026-01-26  8:17 ` [PATCH v1 v1 1/4] rust: io: mem: add ioremap_wc support pengfuyuan
2026-01-26  8:17 ` [PATCH v1 v1 2/4] rust: device: add platdata accessors pengfuyuan
2026-01-26  8:17 ` [PATCH v1 v1 3/4] rust: fb: add framebuffer driver support pengfuyuan
2026-01-26 22:29   ` kernel test robot
2026-01-26  8:17 ` [PATCH v1 v1 4/4] rust: fb: add simplefb test driver pengfuyuan
2026-01-26 10:01 ` [PATCH v1 v1 0/4] [RUST] Framebuffer driver support Thomas Zimmermann
2026-01-26 10:28   ` Alexandre Courbot
2026-01-26 11:46     ` Miguel Ojeda
2026-01-27  8:30       ` pengfuyuan
2026-01-27  8:04     ` pengfuyuan
2026-01-27  8:16       ` Helge Deller
2026-01-27  8:58         ` pengfuyuan
2026-01-27  9:35           ` Greg Kroah-Hartman
2026-01-27  9:38           ` Helge Deller
2026-01-28 14:55       ` Alexandre Courbot
2026-01-26 12:27   ` Helge Deller
2026-01-26 10:32 ` Greg Kroah-Hartman
2026-01-26 12:15 ` Miguel Ojeda

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox