mirror of
https://github.com/elwrcl/intel-hard-graphics.git
synced 2026-11-01 03:18:02 +03:00
wip: crocus/rusticl/elk/hasvk local changes before h264 cherry-pick
This commit is contained in:
35 files changed
+1177
-191
No files matched your search
@@ -20,6 +20,14 @@ use std::ffi::c_void;
|
||||
use std::ptr;
|
||||
use std::slice;
|
||||
|
||||
fn rusticl_dbg(msg: &str) {
|
||||
use std::io::Write;
|
||||
if let Ok(mut f) = std::fs::OpenOptions::new().create(true).append(true).open("/tmp/rusticl_debug.log") {
|
||||
let _ = writeln!(f, "{}", msg);
|
||||
let _ = f.flush();
|
||||
}
|
||||
}
|
||||
|
||||
#[cl_info_entrypoint(clGetContextInfo)]
|
||||
unsafe impl CLInfo<cl_context_info> for cl_context {
|
||||
fn query(&self, q: cl_context_info, v: CLInfoValue) -> CLResult<CLInfoRes> {
|
||||
@@ -99,7 +107,9 @@ pub fn get_gl_context_info_khr(
|
||||
}
|
||||
}
|
||||
|
||||
rusticl_dbg(&format!("RUSTICL_DBG: gl_context={:?} glx_display={:?} egl_display={:?}", gl_context, glx_display, egl_display));
|
||||
let gl_ctx_manager = GLCtxManager::new(gl_context, glx_display, egl_display)?;
|
||||
rusticl_dbg(&format!("RUSTICL_DBG: GLCtxManager::new result is_some={}", gl_ctx_manager.is_some()));
|
||||
unsafe {
|
||||
gl_ctx_manager
|
||||
.ok_or(CL_INVALID_GL_SHAREGROUP_REFERENCE_KHR)?
|
||||
@@ -175,28 +185,24 @@ fn create_context(
|
||||
|
||||
let gl_ctx_manager = GLCtxManager::new(gl_context, glx_display, egl_display)?;
|
||||
if let Some(gl_ctx_manager) = &gl_ctx_manager {
|
||||
// errcode_ret returns CL_INVALID_OPERATION if a context was specified as described above
|
||||
// and any of the following conditions hold:
|
||||
// ...
|
||||
// Any of the devices specified in the devices argument cannot support OpenCL objects which
|
||||
// share the data store of an OpenGL object.
|
||||
|
||||
let [dev] = devs.as_slice() else {
|
||||
rusticl_dbg(&format!("RUSTICL_DBG: create_context fail at (B) - multiple devices with gl sharing"));
|
||||
return Err(CL_INVALID_OPERATION);
|
||||
};
|
||||
|
||||
if !dev.is_gl_sharing_supported() {
|
||||
rusticl_dbg(&format!("RUSTICL_DBG: create_context fail at (C) - gl sharing not supported on this device"));
|
||||
return Err(CL_INVALID_OPERATION);
|
||||
}
|
||||
|
||||
// gl sharing is only supported on devices with an UUID, so we can simply unwrap it
|
||||
let dev_uuid: [c_char; UUID_SIZE] = dev
|
||||
.screen()
|
||||
.device_uuid()
|
||||
.unwrap_or_default()
|
||||
.map(|val| val as c_char);
|
||||
if gl_ctx_manager.interop_dev_info.device_uuid != dev_uuid {
|
||||
// we only support gl_sharing on the same device
|
||||
eprintln!("RUSTICL_DBG: create_context fail at (D) - uuid mismatch: gl_ctx={:?} dev={:?}",
|
||||
gl_ctx_manager.interop_dev_info.device_uuid, dev_uuid);
|
||||
return Err(CL_INVALID_OPERATION);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -165,8 +165,14 @@ unsafe impl CLInfo<cl_device_info> for cl_device_id {
|
||||
}
|
||||
CL_DEVICE_LINKER_AVAILABLE => v.write::<bool>(true),
|
||||
CL_DEVICE_LOCAL_MEM_SIZE => v.write::<cl_ulong>(dev.local_mem_size()),
|
||||
// TODO add query for CL_LOCAL vs CL_GLOBAL
|
||||
CL_DEVICE_LOCAL_MEM_TYPE => v.write::<cl_device_local_mem_type>(CL_GLOBAL),
|
||||
CL_DEVICE_LOCAL_MEM_TYPE => {
|
||||
let local_type = if dev.screen().compute_caps().has_dedicated_local_mem {
|
||||
CL_LOCAL
|
||||
} else {
|
||||
CL_GLOBAL
|
||||
};
|
||||
v.write::<cl_device_local_mem_type>(local_type)
|
||||
}
|
||||
CL_DEVICE_LUID => v.write::<[cl_uchar; CL_LUID_SIZE as usize]>(
|
||||
dev.screen().device_luid().unwrap_or_default(),
|
||||
),
|
||||
|
||||
@@ -916,6 +916,23 @@ fn create_image_with_properties(
|
||||
)?;
|
||||
|
||||
let filtered_flags = filter_image_access_flags(flags);
|
||||
{
|
||||
use std::io::Write;
|
||||
if let Ok(mut dbgf) = std::fs::OpenOptions::new().create(true).append(true).open("/tmp/rusticl_debug.log") {
|
||||
let img_fmt = unsafe { *image_format };
|
||||
let _ = writeln!(dbgf, "RUSTICL_DBG: create_image format={:?} channel_order={} channel_data_type={} image_type={} filtered_flags={:#x}",
|
||||
format, img_fmt.image_channel_order, img_fmt.image_channel_data_type, desc.image_type, filtered_flags);
|
||||
for d in &c.devs {
|
||||
match d.formats.get(format) {
|
||||
None => { let _ = writeln!(dbgf, "RUSTICL_DBG: device has NO entry for this pipe_format at all"); }
|
||||
Some(f) => {
|
||||
let _ = writeln!(dbgf, "RUSTICL_DBG: device format map: {:?}", f);
|
||||
}
|
||||
}
|
||||
}
|
||||
let _ = dbgf.flush();
|
||||
}
|
||||
}
|
||||
// CL_IMAGE_FORMAT_NOT_SUPPORTED if there are no devices in context that support image_format.
|
||||
c.devs
|
||||
.iter()
|
||||
|
||||
Reference in new issue
Block a user