Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
43 commits
Select commit Hold shift + click to select a range
986b5fc
fix: build with glibc 2.43
maxiicodes Feb 26, 2026
d37dc80
vkr: add a gbm allocation path without assuming minigbm
zzyiwei Mar 12, 2026
efeb207
vkr: add a debug option to force GBM import
zzyiwei Mar 11, 2026
d1e17bc
proxy/server: SOCK_CLOEXEC and MSG_CMSG_CLOEXEC are optional
zzyiwei Mar 11, 2026
21cf02c
ci: Update trace checksums
Mar 3, 2026
6edfc8b
Uprev Mesa to 7fc6af99ea4ef86e96b098dcd29a52d33fdd915f
Feb 25, 2026
cbdff5f
server: add support for building on macOS
osy Nov 29, 2025
f9788a0
vkr: use nanosleep() on macOS
osy Nov 29, 2025
ce062a0
proxy: support SOCK_STREAM sockets
osy Dec 20, 2025
96bc0cf
proxy: detect socket disconnect on SOCK_STREAM
lucaaamaral Mar 9, 2026
04ed113
server: fix kqueue non-blocking mode on macOS
lucaaamaral Mar 7, 2026
5d4ba45
proxy/server: rename is_seqpacket to is_valid with platform checks
lucaaamaral Mar 17, 2026
a09222f
server: udpate docs for main for Linux specifics
zzyiwei Mar 19, 2026
bbe178b
server: supports parsing worker context args
zzyiwei Mar 19, 2026
2bef09b
server: allow cleanly spawn subprocess
zzyiwei Mar 20, 2026
7a6d61a
vkr: roll metal vulkan header
zzyiwei Mar 20, 2026
0c3fa5b
vtest: avoid leaking workers on threadpool fini
zzyiwei Mar 26, 2026
cdcfb72
vtest: threadpool to robustly handle spurious wakeups
zzyiwei Mar 26, 2026
485c018
vkr: handle spurious wakeups in ring notify cnd_wait
zzyiwei Mar 26, 2026
be2b86c
vkr: handle spurious wakeups in ring monitor thread
zzyiwei Mar 26, 2026
79ed6bb
server: posix_spawn worker process for macOS Metal
lucaaamaral Mar 7, 2026
be2ace7
ci: Update trace checksums
Mar 23, 2026
5cfd01b
Uprev Mesa to cc4492204894c0488e96a93f51b546345ae32f88
Mar 23, 2026
4e19e99
renderer: fix cases of wrong cursor orientation
Apr 14, 2026
23d4e31
vrend: free sync thread before fences on init failure
julizhan Apr 17, 2026
d4ffc44
virglrenderer: check for NULL resource before dereferencing it
Apr 21, 2026
85dd6cb
vkr: add macOS Vulkan library loading
lucaaamaral Mar 7, 2026
161e9fd
build: add Objective-C, Metal framework, and helper wrappers for macOS
lucaaamaral Mar 7, 2026
7812c37
vkr: detect and inject Metal extensions on macOS
lucaaamaral Apr 8, 2026
15f1669
proxy: use fstat for SHM fd size validation
lucaaamaral Mar 9, 2026
5488b9c
anon_file: add macOS shm_open() path
lucaaamaral Apr 8, 2026
e526766
vkr: implement Metal shared memory allocation on macOS
lucaaamaral Apr 8, 2026
8263ab2
vkr: assign vkr_allocator.instance when instance creation succeeds
zzyiwei Apr 24, 2026
05e5338
vrend/shader: Don't emit precise/invariant TCS predefined block outputs
gerddie Apr 29, 2026
b52cbef
ci: Update virgl expectations
digetx Apr 29, 2026
1161d28
venus: use __APPLE__ guard for consistency
zzyiwei Apr 27, 2026
3ca4a77
vulkan: add vulkan_beta.h header
osy Nov 29, 2025
a2d0553
vkr: add vkr_allocator_global_proc_table_init helper
zzyiwei Apr 29, 2026
fbc3fe4
vkr: support portability enumeration
osy Nov 29, 2025
f8a0903
vkr: refactor to drop __APPLE__ guard for extension enablement
zzyiwei Apr 29, 2026
51b9a7c
vkr: use portability subset extension if available
osy Nov 29, 2025
3716881
vrend: Ensure sampler view and framebuffer attachment swizzle conditi…
aaron-ruby Apr 30, 2026
ba1d711
Merge branch 'main' into upstream
DreamConnected May 21, 2026
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
4 changes: 2 additions & 2 deletions .gitlab-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ variables:
#
# Pick a pipeline on https://gitlab.freedesktop.org/mesa/mesa/-/pipelines/
#
MESA_PIPELINE_ID: 1622883
MESA_PIPELINE_ID: 1646089

MESA_PROJECT_PATH: mesa/mesa
S3_JWT_FILE: /s3_jwt
Expand Down Expand Up @@ -59,7 +59,7 @@ include:
# IMPORTANT: Use a recent Mesa Git revision
# The commit ref must be in sync with the pipeline picked above
# It can be found on the pipeline page below the commit message
ref: 7fc6af99ea4ef86e96b098dcd29a52d33fdd915f
ref: cc4492204894c0488e96a93f51b546345ae32f88
file:
- '/.gitlab-ci/image-tags.yml'

Expand Down
16 changes: 8 additions & 8 deletions .gitlab-ci/expectations/virt/traces-virgl.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ traces:
checksum: 7691e87a06e5c8baf9e0c0ca6381775b
0ad/0ad-v2.trace:
gl-virgl:
checksum: 6379222413b517861b70e2550337795e
checksum: 9c91dc2a05e140f8233e7f5f3a4b4f11
gputest/gimark-v2.trace:
gl-virgl:
label: [crash]
Expand All @@ -30,7 +30,7 @@ traces:
checksum: 837b834310e2e6bd784e3202c6c0bed7
gputest/pixmark-volplosion-v2.trace:
gl-virgl:
checksum: d006b8b713db2dc0a968d95dd4ff10b7
checksum: bcaa3938ca6cdc3a6ac0f4da518ff9a9
gputest/plot3d-v2.trace:
gl-virgl:
checksum: c4a35b0635bbe3fd6693c33814ff5059
Expand All @@ -45,7 +45,7 @@ traces:
checksum: fd4fadc9c537e0f10f82c767fc95ff5e
humus/DynamicBranching3-v2.trace:
gl-virgl:
checksum: b96191174fc9487a8b399fad734cd2e7
checksum: 401178849862615598c7962f0d497e20
humus/HDR-v2.trace:
gl-virgl:
checksum: a81ae5282a5d2612f05fc4da2c84e7a0
Expand Down Expand Up @@ -81,10 +81,10 @@ traces:
checksum: 67161dca3527e5769bc02d84bb9a7bce
supertuxkart/supertuxkart-mansion-egl-gles-v2.trace:
gl-virgl:
checksum: 1f3b873a320587256d7392ddc8162ae2
checksum: 0809d2721da25b08f71ab361dac75a7d
xonotic/xonotic-keybench-high-v2.trace:
gl-virgl:
checksum: 2d2f319615062eb7cc10dfa8d7a66333
checksum: dc84733cd92584b50dcb7f6b9e57ccce
valve/counterstrike-v2.trace:
gl-virgl:
checksum: 0d32696d18e2cea024a11c252e059002
Expand All @@ -94,10 +94,10 @@ traces:
label: [skip, flakes]
valve/half-life-2-v2.trace:
gl-virgl:
checksum: 4299337c370be2523421d17cab387778
checksum: f88af44c333473dd37661a3da0708226
valve/portal-2-v2.trace:
gl-virgl:
checksum: 8974f30da49259a3e5f9ff268e366787
checksum: 6a793fde53b7d43e28805cfbd48996fa
supertuxkart/supertuxkart-antediluvian-abyss.rdc:
gl-virgl:
label: [crash]
Expand All @@ -109,7 +109,7 @@ traces:
label: [crash]
godot/Material Testers.x86_64_2020.04.08_13.38_frame799.rdc:
gl-virgl:
checksum: 9855a7ccdab2cd66a59964aba43bf7df
checksum: 7ba4f0c52a719d94b805653d31ce22d7
ror/ror-default.trace:
gl-virgl:
label: [crash]
Expand Down
2 changes: 2 additions & 0 deletions .gitlab-ci/expectations/virt/virgl-gles-fails.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3097,6 +3097,8 @@ KHR-GL30.framebuffer_blit.framebuffer_blit_functionality_multisampled_to_singles
KHR-GL30.texture_lod_bias.texture_lod_bias_all,Fail
KHR-GL31.framebuffer_blit.framebuffer_blit_functionality_multisampled_to_singlesampled_blit,Fail
KHR-GL32.framebuffer_blit.framebuffer_blit_functionality_multisampled_to_singlesampled_blit,Fail
KHR-GL32.packed_depth_stencil.blit.depth24_stencil8,Fail
KHR-GL32.packed_depth_stencil.blit.depth32f_stencil8,Fail
KHR-GL32.texture_lod_bias.texture_lod_bias_all,Fail
spec@!opengl 1.1@depthstencil-default_fb-blit samples=6,Fail
spec@!opengl 1.1@depthstencil-default_fb-blit samples=8,Fail
Expand Down
23 changes: 19 additions & 4 deletions meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,9 @@ if cc.get_id() == 'gcc' and cc.version().version_compare('< 4.1')
error('When using GCC, version 4.1 or later is required.')
endif

with_host_windows = host_machine.system() == 'windows'
with_host_darwin = host_machine.system() == 'darwin'

warnings = [
'-Werror=enum-int-mismatch',
'-Werror=implicit-function-declaration',
Expand All @@ -79,9 +82,6 @@ add_project_arguments(cc.get_supported_arguments(flags), language : 'c')

prog_python = import('python').find_installation('python3')

with_host_windows = host_machine.system() == 'windows'
with_host_darwin = host_machine.system() == 'darwin'

not_found = dependency('', required: false)
gbm_dep = not_found
thread_dep = dependency('threads')
Expand Down Expand Up @@ -362,6 +362,13 @@ with_venus = get_option('venus')
with_render_server = with_venus
with_render_server_worker = get_option('render-server-worker')
render_server_install_dir = get_option('prefix') / get_option('libexecdir')
if with_venus and with_host_darwin
add_languages('objc', required: true)
objcc = meson.get_compiler('objc')
add_project_arguments(objcc.get_supported_arguments(warnings), language : 'objc')
add_project_arguments(objcc.get_supported_arguments(flags), language : 'objc')
endif

if with_venus
venus_dep = []
if get_option('vulkan-dload')
Expand All @@ -380,7 +387,11 @@ if with_venus

if with_host_darwin
venus_dep += declare_dependency(
compile_args : ['-DVK_USE_PLATFORM_METAL_EXT'],
compile_args : ['-DVK_USE_PLATFORM_METAL_EXT', '-DVK_ENABLE_BETA_EXTENSIONS'],
dependencies : [
dependency('appleframeworks', modules: ['Metal'], required: true),
dependency('appleframeworks', modules: ['Foundation'], required: true),
],
)
endif

Expand Down Expand Up @@ -437,6 +448,10 @@ configure_file(input : 'config.h.meson',

add_project_arguments('-imacros', meson.current_build_dir() / 'config.h', language : 'c')
add_project_arguments('-DHAVE_CONFIG_H=1', language : 'c')
if with_venus and with_host_darwin
add_project_arguments('-imacros', meson.current_build_dir() / 'config.h', language : 'objc')
add_project_arguments('-DHAVE_CONFIG_H=1', language : 'objc')
endif

inc_configuration = include_directories(['.', 'src'])

Expand Down
3 changes: 3 additions & 0 deletions server/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,9 @@
* When a worker is a process,
* - On Linux, it's a subprocess forked from the server process. It returns
* from render_server_main and enters render_context_main.
* - On macOS, the worker is posix_spawn'd with --worker-context-* args.
* render_server_main parses these, skips the server loop, and returns
* with ctx_args.valid set for render_context_main.
*/
int
main(int argc, char **argv)
Expand Down
3 changes: 2 additions & 1 deletion server/render_client.c
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,8 @@ render_client_create_context(struct render_client *client,
if (rec->worker)
ctx_fd = -1; /* ownership transferred */
#else
rec->worker = render_worker_create(srv->worker_jail, NULL, NULL, 0);
rec->worker = render_worker_create(srv->worker_jail, NULL,
&ctx_args, sizeof(ctx_args));
#endif
if (!rec->worker) {
render_log("failed to create a context worker");
Expand Down
86 changes: 86 additions & 0 deletions server/render_worker.c
Original file line number Diff line number Diff line change
Expand Up @@ -432,6 +432,83 @@ render_worker_jail_detach_workers(struct render_worker_jail *jail)
render_worker_jail_remove_worker(jail, worker);
}

#if defined(ENABLE_RENDER_SERVER_WORKER_PROCESS) && defined(__APPLE__)

#include <crt_externs.h>
#include <spawn.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>

#include "render_context.h"

/* On macOS, fork() without exec() inherits stale XPC connections
* (Mach port based), breaking Metal shader compilation in worker
* subprocesses. posix_spawn() atomically creates a fresh process
* image without an intermediate forked state.
*
* POSIX_SPAWN_CLOEXEC_DEFAULT closes all fds by default in the child;
* only ctx_fd is explicitly inherited via addinherit_np.
*/

static pid_t
render_worker_spawn(const struct render_context_args *ctx_args)
{
/* for devenv without installing server */
char *const server_path = getenv("RENDER_SERVER_EXEC_PATH");
const char *exec_path = server_path ? server_path : RENDER_SERVER_EXEC_PATH;

char fd_str[16];
char id_str[16];
char flags_str[16];
snprintf(fd_str, sizeof(fd_str), "%d", ctx_args->ctx_fd);
snprintf(id_str, sizeof(id_str), "%u", ctx_args->ctx_id);
snprintf(flags_str, sizeof(flags_str), "%u", ctx_args->init_flags);

char *const argv[] = {
(char *)exec_path,
"--worker-context-fd",
fd_str,
"--worker-context-id",
id_str,
"--worker-context-init-flags",
flags_str,
"--worker-context-name",
(char *)ctx_args->ctx_name,
NULL,
};

posix_spawnattr_t attr;
if (posix_spawnattr_init(&attr) != 0)
return -1;
posix_spawnattr_setflags(&attr, POSIX_SPAWN_CLOEXEC_DEFAULT);

posix_spawn_file_actions_t file_actions;
if (posix_spawn_file_actions_init(&file_actions) != 0) {
posix_spawnattr_destroy(&attr);
return -1;
}
posix_spawn_file_actions_addinherit_np(&file_actions, STDIN_FILENO);
posix_spawn_file_actions_addinherit_np(&file_actions, STDOUT_FILENO);
posix_spawn_file_actions_addinherit_np(&file_actions, STDERR_FILENO);
posix_spawn_file_actions_addinherit_np(&file_actions, ctx_args->ctx_fd);

pid_t pid;
int ret = posix_spawn(&pid, exec_path, &file_actions, &attr, argv, *_NSGetEnviron());

posix_spawn_file_actions_destroy(&file_actions);
posix_spawnattr_destroy(&attr);

if (ret != 0) {
render_log("posix_spawn failed: %s", strerror(ret));
return -1;
}

return pid;
}

#endif /* ENABLE_RENDER_SERVER_WORKER_PROCESS && __APPLE__ */

struct render_worker *
render_worker_create(struct render_worker_jail *jail,
int (*thread_func)(void *thread_data),
Expand All @@ -451,8 +528,17 @@ render_worker_create(struct render_worker_jail *jail,

bool ok;
#if defined(ENABLE_RENDER_SERVER_WORKER_PROCESS)
#ifdef __APPLE__
{
const struct render_context_args *ctx_args =
(const struct render_context_args *)worker->thread_data;
worker->pid = render_worker_spawn(ctx_args);
ok = worker->pid >= 0;
}
#else
worker->pid = fork();
ok = worker->pid >= 0;
#endif
(void)thread_func;
#elif defined(ENABLE_RENDER_SERVER_WORKER_THREAD)
ok = thrd_create(&worker->thread, thread_func, worker->thread_data) == thrd_success;
Expand Down
30 changes: 25 additions & 5 deletions src/mesa/util/anon_file.c
Original file line number Diff line number Diff line change
Expand Up @@ -29,12 +29,14 @@

#include "anon_file.h"

#include <unistd.h>
#include <fcntl.h>
#include <errno.h>
#include <fcntl.h>
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>

#if defined(HAVE_MEMFD_CREATE) || defined(__FreeBSD__) || defined(__OpenBSD__)
#if defined(HAVE_MEMFD_CREATE) || defined(__FreeBSD__) || \
defined(__OpenBSD__) || defined(__APPLE__)
#include <sys/mman.h>
#elif defined(__ANDROID__)
#include <sys/syscall.h>
Expand All @@ -43,7 +45,8 @@
#include <stdio.h>
#endif

#if !(defined(__FreeBSD__) || defined(HAVE_MEMFD_CREATE) || defined(HAVE_MKOSTEMP) || defined(__ANDROID__))
#if !(defined(__FreeBSD__) || defined(HAVE_MEMFD_CREATE) || \
defined(HAVE_MKOSTEMP) || defined(__ANDROID__) || defined(__APPLE__))
static int
set_cloexec_or_close(int fd)
{
Expand All @@ -67,7 +70,8 @@ set_cloexec_or_close(int fd)
}
#endif

#if !(defined(__FreeBSD__) || defined(HAVE_MEMFD_CREATE) || defined(__ANDROID__))
#if !(defined(__FreeBSD__) || defined(HAVE_MEMFD_CREATE) || \
defined(__ANDROID__) || defined(__APPLE__))
static int
create_tmpfile_cloexec(char *tmpname)
{
Expand Down Expand Up @@ -124,6 +128,22 @@ os_create_anonymous_file(off_t size, const char *debug_name)
fd = syscall(SYS_memfd_create, debug_name, MFD_CLOEXEC | MFD_ALLOW_SEALING);
#elif defined(__FreeBSD__)
fd = shm_open(SHM_ANON, O_CREAT | O_RDWR | O_CLOEXEC, 0600);
#elif defined(__APPLE__)
const char *tag = (debug_name && debug_name[0]) ? debug_name : "mesa";
const unsigned int nonce = arc4random();
for (unsigned int i = 0; i < 32; i++) {
char shm_name[64];
snprintf(shm_name, sizeof(shm_name), "/%s-%d-%x-%x", tag, getpid(), nonce,
i);
fd = shm_open(shm_name, O_CREAT | O_EXCL | O_RDWR | O_CLOEXEC, 0600);
if (fd >= 0) {
shm_unlink(shm_name);
break;
}

if (errno != EEXIST)
break;
}
#elif defined(__OpenBSD__)
char template[] = "/tmp/mesa-XXXXXXXXXX";
fd = shm_mkstemp(template);
Expand Down
4 changes: 4 additions & 0 deletions src/meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -205,6 +205,9 @@ if with_venus
virgl_sources += venus_sources
virgl_sources += venus_codegen
virgl_depends += [venus_dep]
if with_host_darwin
virgl_sources += ['venus/vkr_metal_helpers.m']
endif
endif

if with_drm_renderers
Expand Down Expand Up @@ -250,6 +253,7 @@ libvirgl = static_library(
virgl_sources,
include_directories: [inc_gallium, inc_configuration, 'venus', 'drm'],
dependencies : [virgl_depends, drm_uapi_dep],
objc_args : ['-fno-objc-arc'],
)

libvirgl_inc = [
Expand Down
13 changes: 9 additions & 4 deletions src/proxy/proxy_context.c
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
#include <fcntl.h>
#include <poll.h>
#include <sys/mman.h>
#include <sys/stat.h>
#include <unistd.h>

#include "server/render_protocol.h"
Expand Down Expand Up @@ -310,10 +311,14 @@ validate_resource_fd_shm(int fd, uint64_t expected_size)
}
#endif

const uint64_t size = lseek(fd, 0, SEEK_END);
if (size != expected_size) {
proxy_log("failed to validate shm size(%" PRIu64 ") expected(%" PRIu64 ")", size,
expected_size);
struct stat st;
if (fstat(fd, &st) < 0) {
proxy_log("failed to fstat shm fd");
return false;
}
if ((uint64_t)st.st_size < expected_size) {
proxy_log("shm size(%" PRIu64 ") smaller than expected(%" PRIu64 ")",
(uint64_t)st.st_size, expected_size);
return false;
}

Expand Down
Loading