gallium: Add a 'name' field to winsys_handle
authorJesse Natalie <jenatali@microsoft.com>
Sun, 10 Jul 2022 02:19:10 +0000 (19:19 -0700)
committerMarge Bot <emma+marge@anholt.net>
Thu, 14 Jul 2022 03:45:16 +0000 (03:45 +0000)
Win32 memory objects can be imported by name (const void *
that will be interpreted as const wchar_t *)

Reviewed-By: Mike Blumenkrantz <michael.blumenkrantz@gmail.com>
Acked-by: Marek Ol\9aák <marek.olsak@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/17446>

src/gallium/include/frontend/winsys_handle.h

index 1ebe45e..e3a94c8 100644 (file)
@@ -17,6 +17,7 @@ extern "C" {
 #define WINSYS_HANDLE_TYPE_WIN32_HANDLE WINSYS_HANDLE_TYPE_FD
 #define WINSYS_HANDLE_TYPE_SHMID   3
 #define WINSYS_HANDLE_TYPE_D3D12_RES 4
+#define WINSYS_HANDLE_TYPE_WIN32_NAME 5
 
 /**
  * For use with pipe_screen::{resource_from_handle|resource_get_handle}.
@@ -72,11 +73,20 @@ struct winsys_handle
     */
    uint64_t modifier;
 
-   /**
-    * Input to resource_from_handle.
-    * Output for resource_get_handle.
-    */
-   void *com_obj;
+   union
+   {
+      /**
+       * Input to resource_from_handle.
+       * Output for resource_get_handle.
+       */
+      void *com_obj;
+
+      /**
+       * String name for an object.
+       * Input to resource_from_handle.
+       */
+      const void *name;
+   };
 
    /**
     * Total size of the object.