master
itycodes 2 weeks ago
parent 360ddc4462
commit 55612ec953

@ -126,4 +126,12 @@ fn test_i915_gpu_gem_has_tiling() {
let device = i915::find_device().expect("Failed to find i915 device");
let gem = i915::GemHandle::new(&device.node, 4096).expect("Failed to create gem handle");
assert!(gem.has_tiling().unwrap());
}
#[test]
fn test_i915_gpu_fences() {
let device = i915::find_device().expect("Failed to find i915 device");
let num_fences = device.get_param(native::I915_PARAM_NUM_FENCES_AVAIL).expect("Failed to get fences");
println!("Number of fences: {}", num_fences);
assert!(num_fences > 0);
}

@ -1,6 +1,5 @@
use intel_gpu::*;
use std::ffi::c_void;
use std::ffi::CStr;
use nix::{self};
#[test]
@ -28,13 +27,6 @@ fn test_raw_drm_version() {
desc_len: 128,
};
assert!(libc::ioctl(fd, native::DRM_IOCTL_VERSION, &mut version) == 0);
println!("version_major: {}, version_minor: {}, version_patchlevel: {}, name: {:?}, date: {:?}, desc: {:?}",
version.version_major,
version.version_minor,
version.version_patchlevel,
CStr::from_ptr(version.name),
CStr::from_ptr(version.date),
CStr::from_ptr(version.desc));
}
}

@ -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");
});
}
Loading…
Cancel
Save