Module: Mesa Branch: main Commit: df0623e51a80d9d14afe7648cd74554cd91b3547 URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=df0623e51a80d9d14afe7648cd74554cd91b3547
Author: Antonio Gomes <antoniospg...@gmail.com> Date: Sat Apr 22 18:25:21 2023 -0300 rusticl, meson: Add gl/egl/glx bindings Reviewed-by: Karol Herbst <kher...@redhat.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/21305> --- src/gallium/frontends/rusticl/meson.build | 15 ++++++++++++++- src/gallium/frontends/rusticl/rusticl_libc_bindings.h | 2 ++ src/gallium/frontends/rusticl/rusticl_opencl_bindings.h | 4 ++++ 3 files changed, 20 insertions(+), 1 deletion(-) diff --git a/src/gallium/frontends/rusticl/meson.build b/src/gallium/frontends/rusticl/meson.build index eff9aef6803..4b179ec4433 100644 --- a/src/gallium/frontends/rusticl/meson.build +++ b/src/gallium/frontends/rusticl/meson.build @@ -162,10 +162,18 @@ rusticl_opencl_bindings_rs = rust.bindgen( '--raw-line', 'unsafe impl std::marker::Sync for _cl_image_desc {}', '--allowlist-type', 'cl_.*', '--allowlist-var', 'CL_.*', + # needed for gl_sharing extension + '--allowlist-var', 'GL_.*', + '--allowlist-var', 'MESA_GLINTEROP_.*', + '--allowlist-type', 'PFNEGLGETPROCADDRESSPROC', + '--allowlist-type', 'PFNGLXGETPROCADDRESSPROC', + '--allowlist-type', 'PFNMESAGLINTEROP.*', # some info types need to be strongly typed so we can implement various get_infos - '--new-type-alias-deref', 'cl_(mem|image|pipe)_info', + '--new-type-alias-deref', 'cl_(mem|image|pipe|gl_texture)_info', '--new-type-alias-deref', 'cl_kernel_(arg|work_group)_info', '--new-type-alias-deref', 'cl_(event|profiling)_info', + # turn gl interop enums into constfields so we can compare with rust types + '--constified-enum', 'MESA_GLINTEROP_.*', ], ) @@ -233,6 +241,8 @@ rusticl_libc_bindings_rs = rust.bindgen( ], args : [ rusticl_bindgen_args, + '--allowlist-function', 'close', + '--allowlist-function', 'dlsym', '--allowlist-function', 'free', '--allowlist-function', 'malloc', ] @@ -312,6 +322,9 @@ rusticl_mesa_bindings_rs = rust.bindgen( # rusticl C functions '--allowlist-function', 'rusticl_.*', '--allowlist-function', 'std(err|out)_ptr', + + # winsys + '--allowlist-var', 'WINSYS_HANDLE_TYPE_.*', ], ) diff --git a/src/gallium/frontends/rusticl/rusticl_libc_bindings.h b/src/gallium/frontends/rusticl/rusticl_libc_bindings.h index c8b49f26d17..3c1504b6a4f 100644 --- a/src/gallium/frontends/rusticl/rusticl_libc_bindings.h +++ b/src/gallium/frontends/rusticl/rusticl_libc_bindings.h @@ -1 +1,3 @@ +#include <dlfcn.h> +#include <unistd.h> #include <stdlib.h> diff --git a/src/gallium/frontends/rusticl/rusticl_opencl_bindings.h b/src/gallium/frontends/rusticl/rusticl_opencl_bindings.h index 27e0498ff9d..279534e4f01 100644 --- a/src/gallium/frontends/rusticl/rusticl_opencl_bindings.h +++ b/src/gallium/frontends/rusticl/rusticl_opencl_bindings.h @@ -1,4 +1,8 @@ #include <CL/cl_icd.h> +#include <EGL/egl.h> +#include <GL/gl.h> +#include <GL/glx.h> +#include "GL/mesa_glinterop.h" #define DECL_CL_STRUCT(name) struct name { const cl_icd_dispatch *dispatch; } DECL_CL_STRUCT(_cl_command_queue);