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/presubmit.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,23 @@ jobs:
run: |
meson compile -C build

run-gfxstream-meson-build-macos:
runs-on: macos-latest
steps:
- name: Checkout repository
uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1
- name: Install toolchain dependencies
run: brew install meson ninja molten-vk vulkan-loader
- name: Configure Build
run: |
meson setup \
-Ddefault_library=static \
-Dgfxstream-build=host \
build
- name: Build
run: |
meson compile -C build

run-gfxstream-meson-build-windows:
runs-on: windows-latest
defaults:
Expand Down
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;
}
Comment thread
jovemexausto marked this conversation as resolved.
}

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
6 changes: 6 additions & 0 deletions host/color_buffer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,9 @@ namespace gfxstream {
namespace host {
namespace {

#if GFXSTREAM_ENABLE_HOST_GLES
using gl::ColorBufferGl;
#endif
using vk::ColorBufferVk;

// ColorBufferVk natively supports YUV images. However, ColorBufferGl
Expand Down Expand Up @@ -158,7 +160,11 @@ std::unique_ptr<ColorBuffer::Impl> ColorBuffer::Impl::create(
#endif

if (emulationVk) {
#if GFXSTREAM_ENABLE_HOST_GLES
const bool vulkanOnly = colorBuffer->mColorBufferGl == nullptr;
#else
const bool vulkanOnly = true;
#endif
const uint32_t memoryProperty = VK_MEMORY_PROPERTY_DEVICE_LOCAL_BIT;
const uint32_t mipLevels = 1;
colorBuffer->mColorBufferVk = vk::ColorBufferVk::create(
Expand Down
2 changes: 1 addition & 1 deletion host/frame_buffer.h
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
#include <GLES2/gl2.h>
#include <GLES2/gl2ext.h>
#else
#include "GlesCompat.h"
#include "gles_compat.h"
#endif // GFXSTREAM_ENABLE_HOST_GLES
#include <vulkan/vulkan.h>

Expand Down
6 changes: 0 additions & 6 deletions host/gl/meson.build
Original file line number Diff line number Diff line change
@@ -1,12 +1,6 @@
# Copyright 2023 Android Open Source Project
# SPDX-License-Identifier: Apache-2.0

inc_gl_server = include_directories('.')
inc_gl_snapshot = include_directories('glsnapshot')

# Needs forward declaration.
inc_gl_openglesdispatch = include_directories('OpenGLESDispatch/include')

# GLES translator
subdir('glestranslator')

Expand Down
5 changes: 4 additions & 1 deletion host/gles_compat.h
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,10 @@

typedef unsigned int GLenum;
typedef int32_t EGLint;
typedef unsigned int EGLNativeWindowType;
// Must stay ABI-compatible with the real EGLNativeWindowType from
// <EGL/eglplatform.h>, which is pointer-sized on 64-bit platforms
// (e.g. `void*` on Apple); a 32-bit integer here truncates pointers.
typedef void* EGLNativeWindowType;

namespace gfxstream {
namespace gl {
Expand Down
2 changes: 2 additions & 0 deletions host/iostream/iostream_stub.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
// Intentionally empty: macOS ar(1) refuses to create an archive with no
// members, so Darwin builds need at least one translation unit here.
4 changes: 4 additions & 0 deletions host/iostream/meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,10 @@ inc_host_iostream = include_directories('include')

files_lib_host_iostream = files(
)
if host_machine.system() == 'darwin'
# macOS ar requires at least one member per static archive.
files_lib_host_iostream += files('iostream_stub.cpp')
endif

lib_host_iostream = static_library(
'host_iostream',
Expand Down
7 changes: 7 additions & 0 deletions host/meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,13 @@ if use_gles or use_vulkan
]
endif

# GL include paths are needed even in Vulkan-only builds: the Vulkan server
# includes the GLES dispatch headers (e.g. for interop declarations), so keep
# them visible regardless of which decoders are enabled.
inc_gl_server = include_directories('gl')
inc_gl_snapshot = include_directories('gl/glsnapshot')
inc_gl_openglesdispatch = include_directories('gl/OpenGLESDispatch/include')

if use_gles
subdir('gl')

Expand Down
2 changes: 1 addition & 1 deletion host/native_sub_window.h
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
#if GFXSTREAM_ENABLE_HOST_GLES
#include <EGL/egl.h>
#else
#include "GlesCompat.h"
#include "gles_compat.h"
#endif

#ifdef __cplusplus
Expand Down
4 changes: 4 additions & 0 deletions host/snapshot/meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,10 @@
inc_host_snapshot = include_directories('include')

files_lib_host_snapshot = files()
if host_machine.system() == 'darwin'
# macOS ar requires at least one member per static archive.
files_lib_host_snapshot += files('snapshot_stub.cpp')
endif

lib_host_snapshot = static_library(
'host_snapshot',
Expand Down
2 changes: 2 additions & 0 deletions host/snapshot/snapshot_stub.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
// Intentionally empty: macOS ar(1) refuses to create an archive with no
// members, so Darwin builds need at least one translation unit here.
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
2 changes: 1 addition & 1 deletion meson.build
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# Copyright 2023 Android Open Source Project
# SPDX-License-Identifier: Apache-2.0

project('gfxstream', 'cpp', 'c',
project('gfxstream', 'cpp', 'c', 'objc', 'objcpp',

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.

Causes CI failures on Windows/Linux: you need to add_languages(..) selectively based on the host OS.

version : '0.1.2',
license : 'Apache-2.0',
default_options : ['cpp_std=gnu++17',
Expand Down
Loading