gfxstream: update magma
This adds magma_import_semaphore2(..), needed by Fuchsia Mesa.
BUG=326101772
TEST=compile
Change-Id: I9def232ed8e662f2fc84e0ca5bf787edfd699343
diff --git a/guest/magma/magma_enc/magma_stubs.cpp b/guest/magma/magma_enc/magma_stubs.cpp
new file mode 100644
index 0000000..5e1b616
--- /dev/null
+++ b/guest/magma/magma_enc/magma_stubs.cpp
@@ -0,0 +1,25 @@
+// Copyright (C) 2024 Te Android Open Source Project
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+#include <lib/magma/magma_common_defs.h>
+#include <lib/magma/magma.h>
+
+MAGMA_EXPORT magma_status_t magma_connection_import_semaphore2(
+ magma_connection_t connection,
+ magma_handle_t semaphore_handle,
+ uint64_t flags,
+ magma_semaphore_t* semaphore_out,
+ magma_semaphore_id_t* id_out) {
+ return MAGMA_STATUS_UNIMPLEMENTED;
+}
diff --git a/guest/magma/meson.build b/guest/magma/meson.build
index 7ebea70..ef37f03 100644
--- a/guest/magma/meson.build
+++ b/guest/magma/meson.build
@@ -6,6 +6,7 @@
'magma_enc_util.cpp',
'magma_enc/magma_enc.cpp',
'magma_enc/magma_entry.cpp',
+ 'magma_enc/magma_stubs.cpp',
'magma_enc/magma_client_context.cpp',
)
diff --git a/third-party/fuchsia/magma/include/lib/magma/magma.h b/third-party/fuchsia/magma/include/lib/magma/magma.h
index 9bda320..f89732d 100644
--- a/third-party/fuchsia/magma/include/lib/magma/magma.h
+++ b/third-party/fuchsia/magma/include/lib/magma/magma.h
@@ -32,10 +32,10 @@
// clang-format off
-#ifndef LIB_MAGMA_CLIENT_INCLUDE_LIB_MAGMA_MAGMA_H_
-#define LIB_MAGMA_CLIENT_INCLUDE_LIB_MAGMA_MAGMA_H_
+#ifndef LIB_MAGMA_MAGMA_H_
+#define LIB_MAGMA_MAGMA_H_
-#include <lib/magma/magma_common_defs.h>
+#include <lib/magma/magma_common_defs.h> // IWYU pragma: export
#include <stdint.h>
// LINT.IfChange
@@ -44,7 +44,8 @@
#endif
///
-/// \brief Imports and takes ownership of a channel to a device.
+/// \brief Imports and takes ownership of a channel to a device. Takes ownership of |device_channel|
+/// on both success and failure.
/// \param device_channel A channel connecting to a gpu class device.
/// \param device_out Returned device.
///
@@ -91,9 +92,9 @@
magma_connection_t connection);
///
-/// \brief When a system driver error occurs, the connection will be closed, and interfaces can
-/// return MAGMA_STATUS_CONNECTION_LOST. In that case, this returns the system driver error.
-/// This may incur a round-trip sync.
+/// \brief If a system driver error occurs, the connection will be closed, and this interface will
+/// eventually return the error. This interface does not flush messages that may be pending
+/// (see magma_connection_flush).
/// \param connection An open connection.
///
MAGMA_EXPORT magma_status_t magma_connection_get_error(
@@ -142,7 +143,8 @@
magma_buffer_t buffer);
///
-/// \brief Imports and takes ownership of the buffer referred to by the given handle.
+/// \brief Imports and takes ownership of the buffer referred to by the given handle. Takes
+/// ownership of |buffer_handle| on both success and failure.
/// \param connection An open connection.
/// \param buffer_handle A valid handle.
/// \param size_out The size of the buffer in bytes.
@@ -177,15 +179,18 @@
magma_semaphore_t semaphore);
///
-/// \brief Imports and takes ownership of the semaphore referred to by the given handle.
+/// \brief Imports and takes ownership of the semaphore referred to by the given handle. Takes
+/// ownership of |semaphore_handle| on both success and failure.
/// \param connection An open connection.
/// \param semaphore_handle A valid semaphore handle.
+/// \param flags Pass MAGMA_IMPORT_SEMAPHORE_ONESHOT to prevent auto-reset after wait.
/// \param semaphore_out The returned semaphore.
/// \param id_out The id of the semaphore.
///
-MAGMA_EXPORT magma_status_t magma_connection_import_semaphore(
+MAGMA_EXPORT magma_status_t magma_connection_import_semaphore2(
magma_connection_t connection,
magma_handle_t semaphore_handle,
+ uint64_t flags,
magma_semaphore_t* semaphore_out,
magma_semaphore_id_t* id_out);
@@ -260,7 +265,8 @@
///
/// \brief Incurs a round-trip to the system driver, used to ensure all previous messages have been
-/// observed, but not necessarily completed.
+/// observed, but not necessarily completed. If a system driver error occurs, the connection
+/// will be closed, and this interface will return the error.
/// \param connection An open connection.
///
MAGMA_EXPORT magma_status_t magma_connection_flush(
@@ -390,7 +396,10 @@
///
/// \brief Waits for at least one of the given items to meet a condition. Does not reset any
-/// semaphores. Results are returned in the items array.
+/// semaphores. When MAGMA_STATUS_OK is returned, results are returned in the items array.
+/// MAGMA_STATUS_TIMED_OUT is returned if no conditions are met before the given timeout
+/// expires. If the notification channel handle is included in the item list, and the magma
+/// connection is closed, then MAGMA_STATUS_CONNECTION_LOST is returned.
/// \param items Array of poll items. Type should be either MAGMA_POLL_TYPE_SEMAPHORE or
/// MAGMA_POLL_TYPE_HANDLE. Condition may be set to MAGMA_POLL_CONDITION_SIGNALED OR
/// MAGMA_POLL_CONDITION_READABLE. If condition is 0 the item is ignored. Item results are
@@ -584,4 +593,4 @@
#endif
// LINT.ThenChange(magma_common_defs.h:version)
-#endif // LIB_MAGMA_CLIENT_INCLUDE_LIB_MAGMA_MAGMA_H_
+#endif // LIB_MAGMA_MAGMA_H_