forge
Explore
Log in

Don't you dare go Hollow

edith_codecs

Clone
★ 0

0 watching0 forksRust370.3 MiB9b67700Tahinli3 days ago4021 commits

display.rs30 lines, 912 bytesHistoryRawDownload
1//! Opening a VA display on a DRM render node.
2
3use std::path::Path;
4use std::rc::Rc;
5
6use crate::error::{Error, Result};
7
8/// A VA display. An alias of cros-libva's type: displays are shared through
9/// `Rc`, and every config, context and surface keeps one alive.
10pub type Display = cros_libva::Display;
11
12/// Open the first usable `/dev/dri/renderD*` node.
13pub fn open() -> Result<Rc<Display>> {
14 Display::open().ok_or(Error::NoDevice)
15}
16
17/// Open a specific DRM render node.
18pub fn open_path(path: &Path) -> Result<Rc<Display>> {
19 Display::open_drm_display(path).map_err(|e| Error::Drm {
20 path: path.display().to_string(),
21 message: format!("{e:?}"),
22 })
23}
24
25/// The driver's vendor string (`vaQueryVendorString`).
26pub fn vendor(display: &Display) -> Result<String> {
27 display
28 .query_vendor_string()
29 .map_err(|m| Error::Protocol(format!("vaQueryVendorString: {m}")))
30}