mirror of
https://chromium.googlesource.com/crosvm/crosvm
synced 2025-02-10 20:19:07 +00:00
gpu_buffer: add ability to get backend name
This is useful for letting the guest know about host-specific features. BUG=chromium:924405 TEST=compile Change-Id: I0edc4280eec7235644c9ad8561dbe063276bb3bd Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/1650288 Reviewed-by: Zach Reizner <zachr@chromium.org> Tested-by: kokoro <noreply+kokoro@google.com> Tested-by: Gurchetan Singh <gurchetansingh@chromium.org> Commit-Queue: Gurchetan Singh <gurchetansingh@chromium.org>
This commit is contained in:
parent
44863792aa
commit
ab827ab177
1 changed files with 10 additions and 1 deletions
|
@ -35,10 +35,11 @@ mod raw;
|
|||
pub mod rendernode;
|
||||
|
||||
use std::cmp::min;
|
||||
use std::ffi::CStr;
|
||||
use std::fmt::{self, Display};
|
||||
use std::fs::File;
|
||||
use std::isize;
|
||||
use std::os::raw::c_void;
|
||||
use std::os::raw::{c_char, c_void};
|
||||
use std::os::unix::io::{AsRawFd, FromRawFd, RawFd};
|
||||
use std::ptr::null_mut;
|
||||
use std::rc::Rc;
|
||||
|
@ -379,6 +380,14 @@ impl Device {
|
|||
}
|
||||
}
|
||||
|
||||
/// Copies and returns name of GBM backend.
|
||||
pub fn get_backend_name(&self) -> String {
|
||||
let backend_name: *const c_char = unsafe { gbm_device_get_backend_name(self.0.gbm) };
|
||||
let c_str: &CStr = unsafe { CStr::from_ptr(backend_name) };
|
||||
let str_slice: &str = c_str.to_str().unwrap_or("");
|
||||
str_slice.to_owned()
|
||||
}
|
||||
|
||||
/// Creates a new buffer with the given metadata.
|
||||
pub fn create_buffer(
|
||||
&self,
|
||||
|
|
Loading…
Reference in a new issue