Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 17 additions & 0 deletions .github/workflows/build-macos.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
name: Gfxstream macOS Build

on:
pull_request:

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you add this presubmit.yml instead of it's own file?

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
9 changes: 7 additions & 2 deletions common/base/SharedMemory_posix.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I guess you can make this slash universal, even on linux. Also, cite the POSIX standard that requires a slash in a comment.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks! Made the shm_open() name normalization universal, not macOS-only, and added an inline POSIX.1-2017 citation.

}

Expand Down Expand Up @@ -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);
Expand Down
3 changes: 1 addition & 2 deletions host/virtio_gpu_gfxstream_renderer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
Loading