mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2026-02-16 18:55:32 -05:00
As per [1], we need one "use" item per line, in order to reduce merge conflicts. Furthermore, we need a trailing ", //" in order to tell rustfmt(1) to leave it alone. This does that for the entire nova-core driver. [1] https://docs.kernel.org/rust/coding-guidelines.html#imports Acked-by: Danilo Krummrich <dakr@kernel.org> Signed-off-by: John Hubbard <jhubbard@nvidia.com> [acourbot@nvidia.com: remove imports already in prelude as pointed out by Danilo.] [acourbot@nvidia.com: remove a few unneeded trailing `//`.] Signed-off-by: Alexandre Courbot <acourbot@nvidia.com> Message-ID: <20251107021006.434109-1-jhubbard@nvidia.com>
42 lines
1.1 KiB
Rust
42 lines
1.1 KiB
Rust
// SPDX-License-Identifier: GPL-2.0
|
|
|
|
use kernel::prelude::*;
|
|
|
|
use crate::{
|
|
driver::Bar0,
|
|
gpu::Chipset, //
|
|
};
|
|
|
|
mod ga100;
|
|
mod ga102;
|
|
mod tu102;
|
|
|
|
pub(crate) trait FbHal {
|
|
/// Returns the address of the currently-registered sysmem flush page.
|
|
fn read_sysmem_flush_page(&self, bar: &Bar0) -> u64;
|
|
|
|
/// Register `addr` as the address of the sysmem flush page.
|
|
///
|
|
/// This might fail if the address is too large for the receiving register.
|
|
fn write_sysmem_flush_page(&self, bar: &Bar0, addr: u64) -> Result;
|
|
|
|
/// Returns `true` is display is supported.
|
|
fn supports_display(&self, bar: &Bar0) -> bool;
|
|
|
|
/// Returns the VRAM size, in bytes.
|
|
fn vidmem_size(&self, bar: &Bar0) -> u64;
|
|
}
|
|
|
|
/// Returns the HAL corresponding to `chipset`.
|
|
pub(super) fn fb_hal(chipset: Chipset) -> &'static dyn FbHal {
|
|
use Chipset::*;
|
|
|
|
match chipset {
|
|
TU102 | TU104 | TU106 | TU117 | TU116 => tu102::TU102_HAL,
|
|
GA100 => ga100::GA100_HAL,
|
|
GA102 | GA103 | GA104 | GA106 | GA107 | AD102 | AD103 | AD104 | AD106 | AD107 => {
|
|
ga102::GA102_HAL
|
|
}
|
|
}
|
|
}
|