diff --git a/.github/workflows/build-macos.yaml b/.github/workflows/build-macos.yaml new file mode 100644 index 000000000..01d6b551a --- /dev/null +++ b/.github/workflows/build-macos.yaml @@ -0,0 +1,17 @@ +name: Gfxstream macOS Build + +on: + pull_request: + push: + branches-ignore: + - main + +jobs: + build-macos: + runs-on: macos-latest + steps: + - uses: actions/checkout@v4 + - run: brew install meson ninja molten-vk vulkan-loader + - run: | + meson setup -Ddefault_library=static -Dgfxstream-build=host build + meson compile -C build diff --git a/common/base/SharedMemory_posix.cpp b/common/base/SharedMemory_posix.cpp index 638751a07..efd971c4a 100644 --- a/common/base/SharedMemory_posix.cpp +++ b/common/base/SharedMemory_posix.cpp @@ -55,7 +55,10 @@ SharedMemory::SharedMemory(const std::string& name, size_t size) { mName = PathUtils::recompose(PathUtils::decompose(std::move(path))); } else { mShareType = ShareType::SHARED_MEMORY; - mName = name; + // POSIX.1-2017 (System Interfaces) requires shm_open() names to begin + // with a '/' character to avoid implementation-defined behavior. + // Normalize unconditionally so callers don't need to care about it. + mName = (!name.empty() && name[0] != '/') ? ("/" + name) : name; } } @@ -111,7 +114,9 @@ int SharedMemory::openInternal(int oflag, int mode, bool doMapping) { int err = 0; struct stat sb; if (mShareType == ShareType::SHARED_MEMORY) { -#if defined(HAVE_MEMFD_CREATE) +#if defined(__APPLE__) + mFd = ::shm_open(mName.c_str(), oflag, mode); +#elif defined(HAVE_MEMFD_CREATE) mFd = memfd_create(mName.c_str(), MFD_CLOEXEC | MFD_ALLOW_SEALING); #else mFd = syscall(__NR_memfd_create, mName.c_str(), FD_CLOEXEC); diff --git a/host/virtio_gpu_gfxstream_renderer.cpp b/host/virtio_gpu_gfxstream_renderer.cpp index b6dac07bf..3c587865f 100644 --- a/host/virtio_gpu_gfxstream_renderer.cpp +++ b/host/virtio_gpu_gfxstream_renderer.cpp @@ -450,8 +450,7 @@ VG_EXPORT int stream_renderer_create_blob(uint32_t ctx_id, uint32_t res_handle, GFXSTREAM_TRACE_EVENT(GFXSTREAM_TRACE_STREAM_RENDERER_CATEGORY, "stream_renderer_create_blob()"); - sFrontend()->createBlob(ctx_id, res_handle, create_blob, handle); - return 0; + return sFrontend()->createBlob(ctx_id, res_handle, create_blob, handle); } VG_EXPORT int stream_renderer_export_blob(uint32_t res_handle,