From 94c8af5ecf11758288ce825120e22ff51301e6d5 Mon Sep 17 00:00:00 2001 From: foreman Date: Fri, 22 Jun 2018 18:00:13 -0400 Subject: [PATCH] P4 to Git Change 1571962 by skeely@skeely_HSA_linux on 2018/06/22 17:51:21 SWDEV-157321 - Mesa interop interface update. Interop in/out structs and header updated to match version at git://anongit.freedesktop.org/mesa/mesa Mostly minor changes, cleans up include structure avoiding GLX on Windows. Larger change is version tracking (now by numbers rather than struct size), added a field to mesa_glinterop_export_out giving the size of data written to out_driver_data, and corrected spelling of mesa_glinterop_export_out::internal_format. Affected files ... ... //depot/stg/opencl/drivers/opencl/runtime/device/rocm/mesa_glinterop.h#5 edit ... //depot/stg/opencl/drivers/opencl/runtime/device/rocm/rocdevice.cpp#90 edit ... //depot/stg/opencl/drivers/opencl/runtime/device/rocm/rocglinterop.cpp#6 edit ... //depot/stg/opencl/drivers/opencl/runtime/device/rocm/rocglinterop.hpp#6 edit ... //depot/stg/opencl/drivers/opencl/runtime/device/rocm/rocmemory.cpp#36 edit [ROCm/clr commit: 75b68a5dac8b087db1f745c0c95ae93690cb7c49] --- .../runtime/device/rocm/mesa_glinterop.h | 307 ++++++++++-------- .../rocclr/runtime/device/rocm/rocdevice.cpp | 2 +- .../runtime/device/rocm/rocglinterop.cpp | 44 ++- .../runtime/device/rocm/rocglinterop.hpp | 19 +- .../rocclr/runtime/device/rocm/rocmemory.cpp | 4 +- 5 files changed, 207 insertions(+), 169 deletions(-) diff --git a/projects/clr/rocclr/runtime/device/rocm/mesa_glinterop.h b/projects/clr/rocclr/runtime/device/rocm/mesa_glinterop.h index aee7d60f96..45fda93ca2 100644 --- a/projects/clr/rocclr/runtime/device/rocm/mesa_glinterop.h +++ b/projects/clr/rocclr/runtime/device/rocm/mesa_glinterop.h @@ -50,154 +50,196 @@ #ifndef MESA_GLINTEROP_H #define MESA_GLINTEROP_H +#include #include -#if !defined(MESA_GLINTEROP_NO_GLX) -#include -#include -#else -#include -#include -#endif - #ifdef __cplusplus extern "C" { #endif -#define MESA_GLINTEROP_VERSION 1 +/* Forward declarations to avoid inclusion of GL/glx.h */ +#ifndef GLX_H +struct _XDisplay; +struct __GLXcontextRec; +#endif + +/* Forward declarations to avoid inclusion of EGL/egl.h */ +#ifndef __egl_h_ +typedef void *EGLDisplay; +typedef void *EGLContext; +#endif /** Returned error codes. */ enum { - MESA_GLINTEROP_SUCCESS = 0, - MESA_GLINTEROP_OUT_OF_RESOURCES, - MESA_GLINTEROP_OUT_OF_HOST_MEMORY, - MESA_GLINTEROP_INVALID_OPERATION, - MESA_GLINTEROP_INVALID_VALUE, - MESA_GLINTEROP_INVALID_DISPLAY, - MESA_GLINTEROP_INVALID_CONTEXT, - MESA_GLINTEROP_INVALID_TARGET, - MESA_GLINTEROP_INVALID_OBJECT, - MESA_GLINTEROP_INVALID_MIP_LEVEL, - MESA_GLINTEROP_UNSUPPORTED + MESA_GLINTEROP_SUCCESS = 0, + MESA_GLINTEROP_OUT_OF_RESOURCES, + MESA_GLINTEROP_OUT_OF_HOST_MEMORY, + MESA_GLINTEROP_INVALID_OPERATION, + MESA_GLINTEROP_INVALID_VERSION, + MESA_GLINTEROP_INVALID_DISPLAY, + MESA_GLINTEROP_INVALID_CONTEXT, + MESA_GLINTEROP_INVALID_TARGET, + MESA_GLINTEROP_INVALID_OBJECT, + MESA_GLINTEROP_INVALID_MIP_LEVEL, + MESA_GLINTEROP_UNSUPPORTED }; /** Access flags. */ enum { - MESA_GLINTEROP_ACCESS_READ_WRITE = 0, - MESA_GLINTEROP_ACCESS_READ_ONLY, - MESA_GLINTEROP_ACCESS_WRITE_ONLY + MESA_GLINTEROP_ACCESS_READ_WRITE = 0, + MESA_GLINTEROP_ACCESS_READ_ONLY, + MESA_GLINTEROP_ACCESS_WRITE_ONLY }; +#define MESA_GLINTEROP_DEVICE_INFO_VERSION 1 /** * Device information returned by Mesa. */ -typedef struct _mesa_glinterop_device_info { - uint32_t size; /* size of this structure */ +struct mesa_glinterop_device_info { + /* The caller should set this to the version of the struct they support */ + /* The callee will overwrite it if it supports a lower version. + * + * The caller should check the value and access up-to the version supported + * by the callee. + */ + /* NOTE: Do not use the MESA_GLINTEROP_DEVICE_INFO_VERSION macro */ + uint32_t version; - /* PCI location */ - uint32_t pci_segment_group; - uint32_t pci_bus; - uint32_t pci_device; - uint32_t pci_function; + /* PCI location */ + uint32_t pci_segment_group; + uint32_t pci_bus; + uint32_t pci_device; + uint32_t pci_function; - /* Device identification */ - uint32_t vendor_id; - uint32_t device_id; -} mesa_glinterop_device_info; + /* Device identification */ + uint32_t vendor_id; + uint32_t device_id; + /* Structure version 1 ends here. */ +}; + +#define MESA_GLINTEROP_EXPORT_IN_VERSION 1 /** * Input parameters to Mesa interop export functions. */ -typedef struct _mesa_glinterop_export_in { - uint32_t size; /* size of this structure */ +struct mesa_glinterop_export_in { + /* The caller should set this to the version of the struct they support */ + /* The callee will overwrite it if it supports a lower version. + * + * The caller should check the value and access up-to the version supported + * by the callee. + */ + /* NOTE: Do not use the MESA_GLINTEROP_EXPORT_IN_VERSION macro */ + uint32_t version; - /* One of the following: - * - GL_TEXTURE_BUFFER - * - GL_TEXTURE_1D - * - GL_TEXTURE_2D - * - GL_TEXTURE_3D - * - GL_TEXTURE_RECTANGLE - * - GL_TEXTURE_1D_ARRAY - * - GL_TEXTURE_2D_ARRAY - * - GL_TEXTURE_CUBE_MAP_ARRAY - * - GL_TEXTURE_CUBE_MAP - * - GL_TEXTURE_CUBE_MAP_POSITIVE_X - * - GL_TEXTURE_CUBE_MAP_NEGATIVE_X - * - GL_TEXTURE_CUBE_MAP_POSITIVE_Y - * - GL_TEXTURE_CUBE_MAP_NEGATIVE_Y - * - GL_TEXTURE_CUBE_MAP_POSITIVE_Z - * - GL_TEXTURE_CUBE_MAP_NEGATIVE_Z - * - GL_TEXTURE_2D_MULTISAMPLE - * - GL_TEXTURE_2D_MULTISAMPLE_ARRAY - * - GL_TEXTURE_EXTERNAL_OES - * - GL_RENDERBUFFER - * - GL_ARRAY_BUFFER - */ - GLenum target; + /* One of the following: + * - GL_TEXTURE_BUFFER + * - GL_TEXTURE_1D + * - GL_TEXTURE_2D + * - GL_TEXTURE_3D + * - GL_TEXTURE_RECTANGLE + * - GL_TEXTURE_1D_ARRAY + * - GL_TEXTURE_2D_ARRAY + * - GL_TEXTURE_CUBE_MAP_ARRAY + * - GL_TEXTURE_CUBE_MAP + * - GL_TEXTURE_CUBE_MAP_POSITIVE_X + * - GL_TEXTURE_CUBE_MAP_NEGATIVE_X + * - GL_TEXTURE_CUBE_MAP_POSITIVE_Y + * - GL_TEXTURE_CUBE_MAP_NEGATIVE_Y + * - GL_TEXTURE_CUBE_MAP_POSITIVE_Z + * - GL_TEXTURE_CUBE_MAP_NEGATIVE_Z + * - GL_TEXTURE_2D_MULTISAMPLE + * - GL_TEXTURE_2D_MULTISAMPLE_ARRAY + * - GL_TEXTURE_EXTERNAL_OES + * - GL_RENDERBUFFER + * - GL_ARRAY_BUFFER + */ + unsigned target; - /* If target is GL_ARRAY_BUFFER, it's a buffer object. - * If target is GL_RENDERBUFFER, it's a renderbuffer object. - * If target is GL_TEXTURE_*, it's a texture object. - */ - GLuint obj; + /* If target is GL_ARRAY_BUFFER, it's a buffer object. + * If target is GL_RENDERBUFFER, it's a renderbuffer object. + * If target is GL_TEXTURE_*, it's a texture object. + */ + unsigned obj; - /* Mipmap level. Ignored for non-texture objects. */ - GLuint miplevel; + /* Mipmap level. Ignored for non-texture objects. */ + unsigned miplevel; - /* One of MESA_GLINTEROP_ACCESS_* flags. This describes how the exported - * object is going to be used. - */ - uint32_t access; + /* One of MESA_GLINTEROP_ACCESS_* flags. This describes how the exported + * object is going to be used. + */ + uint32_t access; - /* Size of memory pointed to by out_driver_data. */ - uint32_t out_driver_data_size; + /* Size of memory pointed to by out_driver_data. */ + uint32_t out_driver_data_size; - /* If the caller wants to query driver-specific data about the OpenGL - * object, this should point to the memory where that data will be stored. - */ - void* out_driver_data; -} mesa_glinterop_export_in; + /* If the caller wants to query driver-specific data about the OpenGL + * object, this should point to the memory where that data will be stored. + * This is expected to be a temporary staging memory. The pointer is not + * allowed to be saved for later use by Mesa. + */ + void *out_driver_data; + /* Structure version 1 ends here. */ +}; +#define MESA_GLINTEROP_EXPORT_OUT_VERSION 1 /** * Outputs of Mesa interop export functions. */ -typedef struct _mesa_glinterop_export_out { - uint32_t size; /* size of this structure */ +struct mesa_glinterop_export_out { + /* The caller should set this to the version of the struct they support */ + /* The callee will overwrite it if it supports a lower version. + * + * The caller should check the value and access up-to the version supported + * by the callee. + */ + /* NOTE: Do not use the MESA_GLINTEROP_EXPORT_OUT_VERSION macro */ + uint32_t version; - /* The DMABUF handle. It must be closed by the caller using the POSIX - * close() function when it's not needed anymore. Mesa is not responsible - * for closing the handle. - * - * Not closing the handle by the caller will lead to a resource leak, - * prevents releasing the GPU buffer, and may prevent creating new DMABUF - * handles until the process termination. - */ - int dmabuf_fd; + /* The DMABUF handle. It must be closed by the caller using the POSIX + * close() function when it's not needed anymore. Mesa is not responsible + * for closing the handle. + * + * Not closing the handle by the caller will lead to a resource leak, + * will prevent releasing the GPU buffer, and may prevent creating new + * DMABUF handles within the process. + */ + int dmabuf_fd; - /* The mutable OpenGL internal format specified by glTextureView or - * glTexBuffer. If the object is not one of those, the original internal - * format specified by glTexStorage, glTexImage, or glRenderbufferStorage - * will be returned. - */ - GLenum internalformat; + /* The mutable OpenGL internal format specified by glTextureView or + * glTexBuffer. If the object is not one of those, the original internal + * format specified by glTexStorage, glTexImage, or glRenderbufferStorage + * will be returned. + */ + unsigned internal_format; - /* Parameters specified by glTexBufferRange for GL_TEXTURE_BUFFER. */ - GLintptr buf_offset; - GLsizeiptr buf_size; + /* Buffer offset and size for GL_ARRAY_BUFFER and GL_TEXTURE_BUFFER. + * This allows interop with suballocations (a buffer allocated within + * a larger buffer). + * + * Parameters specified by glTexBufferRange for GL_TEXTURE_BUFFER are + * applied to these and can shrink the range further. + */ + ptrdiff_t buf_offset; + ptrdiff_t buf_size; + + /* Parameters specified by glTextureView. If the object is not a texture + * view, default parameters covering the whole texture will be returned. + */ + unsigned view_minlevel; + unsigned view_numlevels; + unsigned view_minlayer; + unsigned view_numlayers; + + /* The number of bytes written to out_driver_data. */ + uint32_t out_driver_data_written; + /* Structure version 1 ends here. */ +}; - /* Parameters specified by glTextureView. If the object is not a texture - * view, default parameters covering the whole texture will be returned. - */ - GLuint view_minlevel; - GLuint view_numlevels; - GLuint view_minlayer; - GLuint view_numlayers; -} mesa_glinterop_export_out; -#if !defined(MESA_GLINTEROP_NO_GLX) /** * Query device information. * @@ -207,19 +249,20 @@ typedef struct _mesa_glinterop_export_out { * * \return MESA_GLINTEROP_SUCCESS or MESA_GLINTEROP_* != 0 on error */ -GLAPI int GLAPIENTRY MesaGLInteropGLXQueryDeviceInfo(Display* dpy, GLXContext context, - mesa_glinterop_device_info* out); -#endif +int +MesaGLInteropGLXQueryDeviceInfo(struct _XDisplay *dpy, struct __GLXcontextRec *context, + struct mesa_glinterop_device_info *out); + /** * Same as MesaGLInteropGLXQueryDeviceInfo except that it accepts EGLDisplay * and EGLContext. */ -GLAPI int GLAPIENTRY MesaGLInteropEGLQueryDeviceInfo(EGLDisplay dpy, EGLContext context, - mesa_glinterop_device_info* out); +int +MesaGLInteropEGLQueryDeviceInfo(EGLDisplay dpy, EGLContext context, + struct mesa_glinterop_device_info *out); -#if !defined(MESA_GLINTEROP_NO_GLX) /** * Create and return a DMABUF handle corresponding to the given OpenGL * object, and return other parameters about the OpenGL object. @@ -231,34 +274,32 @@ GLAPI int GLAPIENTRY MesaGLInteropEGLQueryDeviceInfo(EGLDisplay dpy, EGLContext * * \return MESA_GLINTEROP_SUCCESS or MESA_GLINTEROP_* != 0 on error */ -GLAPI int GLAPIENTRY MesaGLInteropGLXExportObject(Display* dpy, GLXContext context, - mesa_glinterop_export_in* in, - mesa_glinterop_export_out* out); -#endif +int +MesaGLInteropGLXExportObject(struct _XDisplay *dpy, struct __GLXcontextRec *context, + struct mesa_glinterop_export_in *in, + struct mesa_glinterop_export_out *out); + /** * Same as MesaGLInteropGLXExportObject except that it accepts * EGLDisplay and EGLContext. */ -GLAPI int GLAPIENTRY MesaGLInteropEGLExportObject(EGLDisplay dpy, EGLContext context, - mesa_glinterop_export_in* in, - mesa_glinterop_export_out* out); +int +MesaGLInteropEGLExportObject(EGLDisplay dpy, EGLContext context, + struct mesa_glinterop_export_in *in, + struct mesa_glinterop_export_out *out); -#if !defined(MESA_GLINTEROP_NO_GLX) -typedef int(APIENTRYP PFNMESAGLINTEROPGLXQUERYDEVICEINFOPROC)(Display* dpy, GLXContext context, - mesa_glinterop_device_info* out); -#endif -typedef int(APIENTRYP PFNMESAGLINTEROPEGLQUERYDEVICEINFOPROC)(EGLDisplay dpy, EGLContext context, - mesa_glinterop_device_info* out); -#if !defined(MESA_GLINTEROP_NO_GLX) -typedef int(APIENTRYP PFNMESAGLINTEROPGLXEXPORTOBJECTPROC)(Display* dpy, GLXContext context, - mesa_glinterop_export_in* in, - mesa_glinterop_export_out* out); -#endif -typedef int(APIENTRYP PFNMESAGLINTEROPEGLEXPORTOBJECTPROC)(EGLDisplay dpy, EGLContext context, - mesa_glinterop_export_in* in, - mesa_glinterop_export_out* out); +typedef int (PFNMESAGLINTEROPGLXQUERYDEVICEINFOPROC)(struct _XDisplay *dpy, struct __GLXcontextRec *context, + struct mesa_glinterop_device_info *out); +typedef int (PFNMESAGLINTEROPEGLQUERYDEVICEINFOPROC)(EGLDisplay dpy, EGLContext context, + struct mesa_glinterop_device_info *out); +typedef int (PFNMESAGLINTEROPGLXEXPORTOBJECTPROC)(struct _XDisplay *dpy, struct __GLXcontextRec *context, + struct mesa_glinterop_export_in *in, + struct mesa_glinterop_export_out *out); +typedef int (PFNMESAGLINTEROPEGLEXPORTOBJECTPROC)(EGLDisplay dpy, EGLContext context, + struct mesa_glinterop_export_in *in, + struct mesa_glinterop_export_out *out); #ifdef __cplusplus } diff --git a/projects/clr/rocclr/runtime/device/rocm/rocdevice.cpp b/projects/clr/rocclr/runtime/device/rocm/rocdevice.cpp index 80882a5061..38f8394767 100644 --- a/projects/clr/rocclr/runtime/device/rocm/rocdevice.cpp +++ b/projects/clr/rocclr/runtime/device/rocm/rocdevice.cpp @@ -1267,7 +1267,7 @@ bool Device::bindExternalDevice(uint flags, void* const gfxDevice[], void* gfxCo } mesa_glinterop_device_info info; - info.size = sizeof(mesa_glinterop_device_info); + info.version = MESA_GLINTEROP_DEVICE_INFO_VERSION; if (!MesaInterop::Init(kind)) { return false; } diff --git a/projects/clr/rocclr/runtime/device/rocm/rocglinterop.cpp b/projects/clr/rocclr/runtime/device/rocm/rocglinterop.cpp index fd6a730fcc..24103219bc 100644 --- a/projects/clr/rocclr/runtime/device/rocm/rocglinterop.cpp +++ b/projects/clr/rocclr/runtime/device/rocm/rocglinterop.cpp @@ -18,10 +18,10 @@ namespace roc { namespace MesaInterop { #if !defined(_WIN32) -static PFNMESAGLINTEROPGLXQUERYDEVICEINFOPROC GlxInfo = nullptr; -static PFNMESAGLINTEROPGLXEXPORTOBJECTPROC GlxExport = nullptr; -static PFNMESAGLINTEROPEGLQUERYDEVICEINFOPROC EglInfo = nullptr; -static PFNMESAGLINTEROPEGLEXPORTOBJECTPROC EglExport = nullptr; +static PFNMESAGLINTEROPGLXQUERYDEVICEINFOPROC* GlxInfo = nullptr; +static PFNMESAGLINTEROPGLXEXPORTOBJECTPROC* GlxExport = nullptr; +static PFNMESAGLINTEROPEGLQUERYDEVICEINFOPROC* EglInfo = nullptr; +static PFNMESAGLINTEROPEGLEXPORTOBJECTPROC* EglExport = nullptr; static MESA_INTEROP_KIND loadedGLAPITypes(MESA_INTEROP_NONE); #endif @@ -29,7 +29,7 @@ static const char* errorStrings[] = {"MESA_GLINTEROP_SUCCESS", "MESA_GLINTEROP_OUT_OF_RESOURCES", "MESA_GLINTEROP_OUT_OF_HOST_MEMORY", "MESA_GLINTEROP_INVALID_OPERATION", - "MESA_GLINTEROP_INVALID_VALUE", + "MESA_GLINTEROP_INVALID_VERSION", "MESA_GLINTEROP_INVALID_DISPLAY", "MESA_GLINTEROP_INVALID_CONTEXT", "MESA_GLINTEROP_INVALID_TARGET", @@ -52,18 +52,16 @@ bool Init(MESA_INTEROP_KIND Kind) { return false; #else if (loadedGLAPITypes == MESA_INTEROP_NONE) { - void* glxinfo = dlsym(RTLD_DEFAULT, "MesaGLInteropGLXQueryDeviceInfo"); - void* eglinfo = dlsym(RTLD_DEFAULT, "MesaGLInteropEGLQueryDeviceInfo"); + void* glxinfo=dlsym(RTLD_DEFAULT, "MesaGLInteropGLXQueryDeviceInfo"); + void* eglinfo=dlsym(RTLD_DEFAULT, "MesaGLInteropEGLQueryDeviceInfo"); + + GlxInfo=(PFNMESAGLINTEROPGLXQUERYDEVICEINFOPROC*)glxinfo; + EglInfo=(PFNMESAGLINTEROPEGLQUERYDEVICEINFOPROC*)eglinfo; - GlxInfo = (PFNMESAGLINTEROPGLXQUERYDEVICEINFOPROC)glxinfo; - EglInfo = (PFNMESAGLINTEROPEGLQUERYDEVICEINFOPROC)eglinfo; + GlxExport=(PFNMESAGLINTEROPGLXEXPORTOBJECTPROC*)dlsym(RTLD_DEFAULT, "MesaGLInteropGLXExportObject"); + EglExport=(PFNMESAGLINTEROPEGLEXPORTOBJECTPROC*)dlsym(RTLD_DEFAULT, "MesaGLInteropEGLExportObject"); - GlxExport = - (PFNMESAGLINTEROPGLXEXPORTOBJECTPROC)dlsym(RTLD_DEFAULT, "MesaGLInteropGLXExportObject"); - EglExport = - (PFNMESAGLINTEROPEGLEXPORTOBJECTPROC)dlsym(RTLD_DEFAULT, "MesaGLInteropEGLExportObject"); - - uint32_t ret = MESA_INTEROP_NONE; + uint32_t ret=MESA_INTEROP_NONE; if (GlxInfo && GlxExport) ret |= MESA_INTEROP_GLX; if (EglInfo && EglExport) ret |= MESA_INTEROP_EGL; loadedGLAPITypes = MESA_INTEROP_KIND(ret); @@ -81,15 +79,15 @@ bool GetInfo(mesa_glinterop_device_info& info, MESA_INTEROP_KIND Kind, const Dis assert((loadedGLAPITypes & Kind) == Kind && "Requested interop API is not currently loaded."); int ret; switch (Kind) { - case MESA_INTEROP_GLX: + case MESA_INTEROP_GLX: ret = GlxInfo(display.glxDisplay, context.glxContext, &info); break; - case MESA_INTEROP_EGL: + case MESA_INTEROP_EGL: ret = EglInfo(display.eglDisplay, context.eglContext, &info); break; - default: + default: assert(false && "Invalid interop kind."); - return false; + return false; } if (ret == MESA_GLINTEROP_SUCCESS) return true; if (ret < int(sizeof(errorStrings) / sizeof(errorStrings[0]))) @@ -108,15 +106,15 @@ bool Export(mesa_glinterop_export_in& in, mesa_glinterop_export_out& out, MESA_I assert((loadedGLAPITypes & Kind) == Kind && "Requested interop API is not currently loaded."); int ret; switch (Kind) { - case MESA_INTEROP_GLX: + case MESA_INTEROP_GLX: ret = GlxExport(display.glxDisplay, context.glxContext, &in, &out); break; - case MESA_INTEROP_EGL: + case MESA_INTEROP_EGL: ret = EglExport(display.eglDisplay, context.eglContext, &in, &out); break; - default: + default: assert(false && "Invalid interop kind."); - return false; + return false; } if (ret == MESA_GLINTEROP_SUCCESS) return true; if (ret < int(sizeof(errorStrings) / sizeof(errorStrings[0]))) diff --git a/projects/clr/rocclr/runtime/device/rocm/rocglinterop.hpp b/projects/clr/rocclr/runtime/device/rocm/rocglinterop.hpp index 9d82d0fb14..a7e78b285f 100644 --- a/projects/clr/rocclr/runtime/device/rocm/rocglinterop.hpp +++ b/projects/clr/rocclr/runtime/device/rocm/rocglinterop.hpp @@ -5,18 +5,17 @@ #ifndef WITHOUT_HSA_BACKEND -#ifdef _WIN32 -// GLX header cannot be included in Windows due to X11 header dependency -#define MESA_GLINTEROP_NO_GLX -#include "device/rocm/mesa_glinterop.h" -// Give GLX parameters void* size -typedef void Display; -typedef void* GLXContext; -#undef MESA_GLINTEROP_NO_GLX -#else -#include "device/rocm/mesa_glinterop.h" +#ifndef _WIN32 +#include +#include +#else +#include +#include +typedef _XDisplay Display; +typedef __GLXcontextRec* GLXContext; #endif +#include "device/rocm/mesa_glinterop.h" #include "device/rocm/rocregisters.hpp" #include "hsa_ext_amd.h" diff --git a/projects/clr/rocclr/runtime/device/rocm/rocmemory.cpp b/projects/clr/rocclr/runtime/device/rocm/rocmemory.cpp index 48bbfee444..fab34ad063 100644 --- a/projects/clr/rocclr/runtime/device/rocm/rocmemory.cpp +++ b/projects/clr/rocclr/runtime/device/rocm/rocmemory.cpp @@ -184,8 +184,8 @@ bool Memory::createInteropBuffer(GLenum targetType, int miplevel) { mesa_glinterop_export_in in = {0}; mesa_glinterop_export_out out = {0}; - in.size = sizeof(mesa_glinterop_export_in); - out.size = sizeof(mesa_glinterop_export_out); + in.version = MESA_GLINTEROP_EXPORT_IN_VERSION; + out.version = MESA_GLINTEROP_EXPORT_OUT_VERSION; if (owner()->getMemFlags() & CL_MEM_READ_ONLY) in.access = MESA_GLINTEROP_ACCESS_READ_ONLY;