drm/tyr: add shmem backing for GEM objects

Add support for GEM buffer objects backed by shared memory.

This introduces the BoCreateArgs structure for passing creation parameters
including flags, and adds a flags field to BoData.

Co-developed-by: Boris Brezillon <boris.brezillon@collabora.com>
Signed-off-by: Boris Brezillon <boris.brezillon@collabora.com>
Signed-off-by: Deborah Brouwer <deborah.brouwer@collabora.com>
Link: https://patch.msgid.link/20260428-fw-boot-prerequisites-v1-5-c69af9abe1af@collabora.com
Signed-off-by: Alice Ryhl <aliceryhl@google.com>
This commit is contained in:
Deborah Brouwer 2026-04-28 12:19:32 -07:00 committed by Alice Ryhl
parent a9bc67761d
commit 610e892bdb

View File

@ -1,4 +1,8 @@
// SPDX-License-Identifier: GPL-2.0 or MIT
//! GEM buffer object management for the Tyr driver.
//!
//! This module provides buffer object (BO) management functionality using
//! DRM's GEM subsystem with shmem backing.
use kernel::{
drm::gem,
@ -10,15 +14,23 @@
TyrDrmDriver, //
};
/// GEM Object inner driver data
/// Tyr's DriverObject type for GEM objects.
#[pin_data]
pub(crate) struct BoData {}
pub(crate) struct BoData {
flags: u32,
}
/// Provides a way to pass arguments when creating BoData
/// as required by the gem::DriverObject trait.
pub(crate) struct BoCreateArgs {
flags: u32,
}
impl gem::DriverObject for BoData {
type Driver = TyrDrmDriver;
type Args = ();
type Args = BoCreateArgs;
fn new(_dev: &TyrDrmDevice, _size: usize, _args: ()) -> impl PinInit<Self, Error> {
try_pin_init!(BoData {})
fn new(_dev: &TyrDrmDevice, _size: usize, args: BoCreateArgs) -> impl PinInit<Self, Error> {
try_pin_init!(Self { flags: args.flags })
}
}