rusticl/device: report mesas version for CL_DRIVER_VERSION

Signed-off-by: Karol Herbst <kherbst@redhat.com>
Acked-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/15439>
This commit is contained in:
Karol Herbst 2022-05-06 00:27:32 +02:00 committed by Marge Bot
parent a438533181
commit cad2b6c4bc
4 changed files with 12 additions and 1 deletions

View file

@ -3,10 +3,12 @@ use crate::api::platform::*;
use crate::api::util::*;
use crate::core::device::*;
use mesa_rust_gen::*;
use mesa_rust_util::ptr::*;
use rusticl_opencl_gen::*;
use std::cmp::min;
use std::ffi::CStr;
use std::mem::size_of;
use std::ptr;
use std::sync::Arc;
@ -185,7 +187,7 @@ impl CLInfo<cl_device_info> for cl_device_id {
CL_DEVICE_VENDOR => cl_prop(dev.screen().device_vendor()),
CL_DEVICE_VENDOR_ID => cl_prop::<cl_uint>(dev.vendor_id()),
CL_DEVICE_VERSION => cl_prop::<String>(format!("OpenCL {}", dev.cl_version.api_str())),
CL_DRIVER_VERSION => cl_prop("0.1"),
CL_DRIVER_VERSION => cl_prop::<&CStr>(unsafe { CStr::from_ptr(mesa_version_string()) }),
CL_DEVICE_WORK_GROUP_COLLECTIVE_FUNCTIONS_SUPPORT => cl_prop::<bool>(false),
// CL_INVALID_VALUE if param_name is not one of the supported values
// CL_INVALID_VALUE [...] if param_name is a value that is available as an extension and the corresponding extension is not supported by the device.

View file

@ -204,6 +204,7 @@ rusticl_mesa_bindings_rs = rust.bindgen(
'--whitelist-function', 'free',
'--whitelist-function', 'glsl_.*',
'--whitelist-function', 'malloc',
'--whitelist-function', 'mesa_.*',
'--whitelist-function', 'nir_.*',
'--whitelist-function', 'pipe_.*',
'--whitelist-function', 'rusticl_.*',

View file

@ -1,4 +1,5 @@
#include "rusticl_mesa_inline_bindings_wrapper.h"
#include "git_sha1.h"
nir_function_impl *
nir_shader_get_entrypoint(const nir_shader *shader)
@ -17,3 +18,9 @@ util_format_pack_rgba(enum pipe_format format, void *dst, const void *src, unsig
{
return __util_format_pack_rgba(format, dst, src, w);
}
const char*
mesa_version_string(void)
{
return PACKAGE_VERSION MESA_GIT_SHA1;
}

View file

@ -8,6 +8,7 @@
#undef pipe_resource_reference
#undef util_format_pack_rgba
const char* mesa_version_string(void);
nir_function_impl *nir_shader_get_entrypoint(const nir_shader *shader);
void pipe_resource_reference(struct pipe_resource **dst, struct pipe_resource *src);
void util_format_pack_rgba(enum pipe_format format, void *dst, const void *src, unsigned w);