|
|
|
@ -1,9 +1,11 @@
|
|
|
|
|
#![allow(unused_imports)]
|
|
|
|
|
|
|
|
|
|
use gpu::i915::GemHandle;
|
|
|
|
|
use intel_gpu::*;
|
|
|
|
|
use uapi::i915;
|
|
|
|
|
use uapi::i915::{self, DrmGemHandle};
|
|
|
|
|
use std::fs;
|
|
|
|
|
use std::{fs::File, os::fd::{AsRawFd, RawFd}};
|
|
|
|
|
use std::thread;
|
|
|
|
|
|
|
|
|
|
#[test]
|
|
|
|
|
fn test_i915_uapi_get_version() {
|
|
|
|
@ -78,4 +80,26 @@ fn test_i915_uapi_gem_tiling() {
|
|
|
|
|
// TODO figure out which devices this holds for
|
|
|
|
|
assert!(i915::gem_has_tiling(node.fd.as_raw_fd(), &gem).is_ok_and(|e| e == true));
|
|
|
|
|
i915::close_gem(node.fd.as_raw_fd(), gem).expect("Failed to close gem");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
#[test]
|
|
|
|
|
fn test_i915_uapi_gem_caching() {
|
|
|
|
|
let node = i915::find_node().expect("Failed to find i915 fd");
|
|
|
|
|
let gem = i915::make_gem(node.fd.as_raw_fd(), 4096).expect("Failed to make gem");
|
|
|
|
|
let caching = i915::gem_get_caching(node.fd.as_raw_fd(), &gem).expect("Failed to get caching");
|
|
|
|
|
assert!(caching > 0);
|
|
|
|
|
i915::close_gem(node.fd.as_raw_fd(), gem).expect("Failed to close gem");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
#[test]
|
|
|
|
|
fn test_i915_uapi_gem_thread() {
|
|
|
|
|
let node = i915::find_node().expect("Failed to find i915 fd");
|
|
|
|
|
let gem = i915::make_gem(node.fd.as_raw_fd(), 4096).expect("Failed to make gem");
|
|
|
|
|
thread::scope(|s| {
|
|
|
|
|
let handle = s.spawn(|| {
|
|
|
|
|
assert!(i915::gem_is_valid(node.fd.as_raw_fd(), &gem).unwrap());
|
|
|
|
|
});
|
|
|
|
|
assert!(i915::gem_is_valid(node.fd.as_raw_fd(), &gem).unwrap());
|
|
|
|
|
handle.join().expect("Failed to join thread");
|
|
|
|
|
});
|
|
|
|
|
}
|