@ -6,13 +6,16 @@ use nix::{self};
#[ test ]
fn test_raw_drm_version ( ) {
// TODO more robust render node detection
let fd = nix ::fcntl ::open ( "/dev/dri/renderD12 9 ", nix ::fcntl ::OFlag ::O_RDWR | nix ::fcntl ::OFlag ::O_CLOEXEC , nix ::sys ::stat ::Mode ::empty ( ) )
. expect ( "Failed to open /dev/dri/renderD12 9 ") ;
let fd = nix ::fcntl ::open ( "/dev/dri/renderD12 8 ", nix ::fcntl ::OFlag ::O_RDWR | nix ::fcntl ::OFlag ::O_CLOEXEC , nix ::sys ::stat ::Mode ::empty ( ) )
. expect ( "Failed to open /dev/dri/renderD12 8 ") ;
unsafe {
let name_vec = libc ::malloc ( 128 ) ;
libc ::memset ( name_vec , 0 , 128 ) ;
let date_vec = libc ::malloc ( 128 ) ;
libc ::memset ( date_vec , 0 , 128 ) ;
let desc_vec = libc ::malloc ( 128 ) ;
libc ::memset ( desc_vec , 0 , 128 ) ;
let mut version = native ::drm_version {
version_major : 0 ,
version_minor : 0 ,
@ -37,8 +40,8 @@ fn test_raw_drm_version() {
#[ test ]
fn test_i915_raw_query ( ) {
let fd = nix ::fcntl ::open ( "/dev/dri/renderD12 9 ", nix ::fcntl ::OFlag ::O_RDWR | nix ::fcntl ::OFlag ::O_CLOEXEC , nix ::sys ::stat ::Mode ::empty ( ) )
. expect ( "Failed to open /dev/dri/renderD12 9 ") ;
let fd = nix ::fcntl ::open ( "/dev/dri/renderD12 8 ", nix ::fcntl ::OFlag ::O_RDWR | nix ::fcntl ::OFlag ::O_CLOEXEC , nix ::sys ::stat ::Mode ::empty ( ) )
. expect ( "Failed to open /dev/dri/renderD12 8 ") ;
unsafe {
let mut query_item = native ::drm_i915_query_item {
query_id : native ::DRM_I915_QUERY_ENGINE_INFO as u64 ,
@ -54,13 +57,13 @@ fn test_i915_raw_query() {
assert! ( libc ::ioctl ( fd , native ::DRM_IOCTL_I915_QUERY , & mut query ) = = 0 ) ;
let engine_info = libc ::malloc ( query_item . length as usize )
as * mut native ::drm_i915_query_engine_info ;
libc ::memset ( engine_info as * mut c_void , 0 , query_item . length as usize ) ;
query_item . data_ptr = engine_info as u64 ;
assert! ( libc ::ioctl ( fd , native ::DRM_IOCTL_I915_QUERY , & mut query ) = = 0 ) ;
println! ( "engine_info: {:?}" , * engine_info ) ;
let engine_data = engine_info . as_mut ( ) . unwrap ( ) ;
let engines = engine_data . engines . as_mut_slice ( engine_data . num_engines as usize ) ;
for engine in engines {
println!( "engine: {:?}" , engine ) ;
assert!( engine . engine . engine_class ! = uapi ::i915 ::EngineClass ::Invalid as u16 ) ;
}
}
}