xref: /linux/drivers/gpu/drm/tyr/gem.rs (revision 82b78182eacf82c1847c6f1fd93d91c15efb69cf)
1 // SPDX-License-Identifier: GPL-2.0 or MIT
2 //! GEM buffer object management for the Tyr driver.
3 //!
4 //! This module provides buffer object (BO) management functionality using
5 //! DRM's GEM subsystem with shmem backing.
6 
7 use kernel::{
8     drm::gem,
9     prelude::*, //
10 };
11 
12 use crate::driver::{
13     TyrDrmDevice,
14     TyrDrmDriver, //
15 };
16 
17 /// Tyr's DriverObject type for GEM objects.
18 #[pin_data]
19 pub(crate) struct BoData {
20     flags: u32,
21 }
22 
23 /// Provides a way to pass arguments when creating BoData
24 /// as required by the gem::DriverObject trait.
25 pub(crate) struct BoCreateArgs {
26     flags: u32,
27 }
28 
29 impl gem::DriverObject for BoData {
30     type Driver = TyrDrmDriver;
31     type Args = BoCreateArgs;
32 
33     fn new(_dev: &TyrDrmDevice, _size: usize, args: BoCreateArgs) -> impl PinInit<Self, Error> {
34         try_pin_init!(Self { flags: args.flags })
35     }
36 }
37