Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
22 commits
Select commit Hold shift + click to select a range
ea7db39
meson: fix -Dvulkan-dload=false builds
osy Apr 29, 2026
cfda42b
drm/amdgpu: Use inttypes.h format defines for *64_t types
OPNA2608 May 13, 2026
65b70fe
ci: Update trace checksums
Apr 22, 2026
b272a56
Uprev Mesa to 52d57d98a2948214a2d029f2f4e8b476bf39ada3
Apr 16, 2026
b2592b4
vrend/shader: Check image and ssbo index when setting memory qualifiers
gerddie May 5, 2026
9f1ca94
vrend/shader: check upper bounds of image and buffer index
gerddie May 5, 2026
2a671db
vrend:shader: Check image/buffer index when emitting atomics
gerddie May 5, 2026
17614ab
proxy: introduce thread rendering server mode
osy May 17, 2026
bb92bf5
proxy: misc fixes for same process render server
zzyiwei May 22, 2026
dcb531f
server: use virgl logging in thread mode
osy May 17, 2026
2048dfb
virgl_util: add new line to prefixed log when needed
osy Jan 2, 2026
f7259d9
vrend: Check box size sanity when transfering via IOV
gerddie Jun 2, 2026
d2357f2
amend missing line breaks
zzyiwei May 29, 2026
6ad044e
renderer: Check for successful do_readpixels operations
tintou Jun 5, 2026
b725556
renderer: Use calloc to allocate the temporary read buffer
tintou Jun 5, 2026
8cebba7
vkr: drop __APPLE__ guard for Metal shared memory
zzyiwei May 29, 2026
3b61c96
vkr: declare Metal device export at instance creation on macOS
lucaaamaral Jun 16, 2026
058959e
util/anon_file: do not pass O_CLOEXEC to shm_open() on macOS
lucaaamaral Jun 16, 2026
8cb58e4
drm: validate blob_size against container shmem struct size
zzyiwei Jun 11, 2026
9368c89
drm: Do not trust guest to select number of bytes to munmap()
DemiMarie Jun 17, 2026
1b4259c
drm: Always free response buffer before returning from dispatch
DemiMarie Jun 17, 2026
f849f8e
drm: Perform a bounds check immediately before copying to shmem
DemiMarie Jun 17, 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: 1646089
MESA_PIPELINE_ID: 1669832

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: cc4492204894c0488e96a93f51b546345ae32f88
ref: 52d57d98a2948214a2d029f2f4e8b476bf39ada3
file:
- '/.gitlab-ci/image-tags.yml'

Expand Down
2 changes: 1 addition & 1 deletion .gitlab-ci/expectations/virt/traces-virgl.yml
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ traces:
label: [crash]
godot/Material Testers.x86_64_2020.04.08_13.38_frame799.rdc:
gl-virgl:
checksum: 7ba4f0c52a719d94b805653d31ce22d7
checksum: 465410a06d966b377bc8c41e52b21b0f
ror/ror-default.trace:
gl-virgl:
label: [crash]
Expand Down
4 changes: 4 additions & 0 deletions .gitlab-ci/expectations/virt/venus-flakes.txt
Original file line number Diff line number Diff line change
Expand Up @@ -35,9 +35,12 @@ dEQP-VK.ray_query.acceleration_structures.operations.traditional_structures.comp
dEQP-VK.ray_tracing_pipeline.acceleration_structures.flags.sparse_binding_structures.gpu_built.aabbs.identical_instances.padded.fastbuild_update_0_0_bothgeneric
dEQP-VK.ray_tracing_pipeline.acceleration_structures.flags.traditional_structures.gpu_built.triangles.different_instances.padded.0_update_0_0_bothgeneric
dEQP-VK.ray_tracing_pipeline.shader_binding_table.indexing_hit.sbt_offset_0.no_shaderrecord.1_5_extraSBTRecordStrideBits
dEQP-VK.reconvergence.maximal.compute.nesting2.5.18
dEQP-VK.reconvergence.maximal.compute.nesting2.6.22
dEQP-VK.renderpasses.dynamic_rendering.primary_cmd_buff.random.seed88_geometry
dEQP-VK.renderpasses.renderpass2.suballocation.attachment_allocation.roll.56
dEQP-VK.robustness.robustness2.push.notemplate.r32ui.unroll.volatile.storage_texel_buffer.no_fmt_qual.len_36.samples_1.1d.comp
dEQP-VK.sparse_resources.buffer.ssbo.sparse_residency.buffer_size_2_24
dEQP-VK.sparse_resources.image_sparse_residency.mutable.2d_array.r16_unorm_r8g8_sint_r8g8_snorm
dEQP-VK.spirv_assembly.instruction.graphics.16bit_storage.uniform_float_16_to_32.uniform_buffer_block_vector_float_const_idx_6_tesse
dEQP-VK.spirv_assembly.instruction.graphics.16bit_storage.uniform_float_16_to_64.uniform_buffer_block_vector_float_geom
Expand All @@ -46,6 +49,7 @@ dEQP-VK.spirv_assembly.type.scalar.u8.bit_field_s_extract_offset64_count64_comp
dEQP-VK.synchronization.cross_instance.suballocated.write_clear_color_image_read_image_compute_indirect.image_64x64x8_r32_sfloat_timeline_semaphore_zircon_handle
dEQP-VK.synchronization.op.multi_queue.fence.write_draw_read_image_vertex.image_128x128_r16_uint_concurrent_maintenance9
dEQP-VK.texture.swizzle.component_mapping.color.r16_snorm_2d_pot_bbbb
dEQP-VK.wsi.direct_drm.swapchain.create.image_array_layers

dEQP-VK.api.info.image_format_properties2.2d.optimal.g16_b16r16_2plane_422_unorm
dEQP-VK.api.info.image_format_properties2.2d.optimal.g8_b8r8_2plane_420_unorm
1 change: 1 addition & 0 deletions config.h.meson
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@
#mesondefine ENABLE_DRM_I915
#mesondefine ENABLE_LIBDRM
#mesondefine ENABLE_RENDER_SERVER
#mesondefine ENABLE_SAME_PROCESS_RENDER_SERVER
#mesondefine ENABLE_RENDER_SERVER_WORKER_PROCESS
#mesondefine ENABLE_RENDER_SERVER_WORKER_THREAD
#mesondefine ENABLE_RENDER_SERVER_WORKER_MINIJAIL
Expand Down
22 changes: 18 additions & 4 deletions meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -346,8 +346,14 @@ if with_check_gl_errors
endif

with_venus = get_option('venus')
with_render_server = with_venus
with_render_server = ''
if with_venus
with_render_server = get_option('render-server-mode')
endif
with_render_server_worker = get_option('render-server-worker')
if with_render_server_worker == 'auto'
with_render_server_worker = with_render_server
endif
render_server_install_dir = get_option('prefix') / get_option('libexecdir')
if with_venus and with_host_darwin
add_languages('objc', required: true)
Expand All @@ -361,7 +367,7 @@ if with_venus
if get_option('vulkan-dload')
conf_data.set('ENABLE_VULKAN_DLOAD', 1)
else
venus_dep = dependency('vulkan')
venus_dep += dependency('vulkan')
endif

if host_machine.system() in ['freebsd', 'openbsd']
Expand Down Expand Up @@ -412,6 +418,13 @@ if with_venus
else
error('unknown render server worker ' + with_render_server_worker)
endif

if with_render_server == 'thread'
conf_data.set('ENABLE_SAME_PROCESS_RENDER_SERVER', 1)
if with_render_server_worker != 'thread'
error('render-server-worker must be \'thread\' if render-server-mode is \'thread\'')
endif
endif
endif

with_video = get_option('video')
Expand Down Expand Up @@ -455,7 +468,7 @@ if not with_host_windows
subdir('vtest')
endif

if with_render_server
if with_render_server == 'process'
subdir('server')
endif

Expand All @@ -477,7 +490,8 @@ summary({'c_args': (' ').join(get_option('c_args')),
'drm-i915': with_drm_i915,
'drm-panfrost': with_drm_panfrost,
'drm-msm': with_drm_msm,
'render server worker': with_render_server ? with_render_server_worker : 'none',
'render server mode': with_render_server == '' ? 'none' : with_render_server,
'render server worker': with_render_server == '' ? 'none' : with_render_server_worker,
'video': with_video,
'tests': with_tests,
'fuzzer': with_fuzzer,
Expand Down
12 changes: 10 additions & 2 deletions meson_options.txt
Original file line number Diff line number Diff line change
Expand Up @@ -86,10 +86,18 @@ option(
)

option(
'render-server-worker',
'render-server-mode',
type : 'combo',
value : 'process',
choices : ['process', 'thread', 'minijail'],
choices : ['process', 'thread'],
description : 'how render server itself is spawned'
)

option(
'render-server-worker',
type : 'combo',
value : 'auto',
choices : ['auto', 'process', 'thread', 'minijail'],
description : 'how a context in render server is serviced'
)

Expand Down
7 changes: 7 additions & 0 deletions server/render_common.c
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@
*/

#include "render_common.h"
#ifdef ENABLE_SAME_PROCESS_RENDER_SERVER
#include "virgl_util.h"
#endif

#include <stdarg.h>
#include <stdio.h>
Expand All @@ -21,6 +24,10 @@ render_log(const char *fmt, ...)
va_list va;

va_start(va, fmt);
#ifdef ENABLE_SAME_PROCESS_RENDER_SERVER
virgl_prefixed_logv("server", VIRGL_LOG_LEVEL_INFO, fmt, va);
#else
vsyslog(LOG_DEBUG, fmt, va);
#endif
va_end(va);
}
4 changes: 4 additions & 0 deletions server/render_state.c
Original file line number Diff line number Diff line change
Expand Up @@ -93,13 +93,15 @@ render_state_lookup_context(uint32_t ctx_id)
return ctx;
}

#ifndef ENABLE_SAME_PROCESS_RENDER_SERVER
static void
render_state_cb_debug_logger(UNUSED enum virgl_log_level_flags log_level,
const char *message,
UNUSED void* user_data)
{
render_log(message);
}
#endif

static void
render_state_cb_retire_fence(uint32_t ctx_id, uint32_t ring_idx, uint64_t fence_id)
Expand All @@ -112,7 +114,9 @@ render_state_cb_retire_fence(uint32_t ctx_id, uint32_t ring_idx, uint64_t fence_
}

static const struct vkr_renderer_callbacks render_state_cbs = {
#ifndef ENABLE_SAME_PROCESS_RENDER_SERVER
.debug_logger = render_state_cb_debug_logger,
#endif
.retire_fence = render_state_cb_retire_fence,
};

Expand Down
2 changes: 1 addition & 1 deletion server/render_worker.c
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
#include <sys/types.h>
#include <sys/wait.h>
#ifdef ENABLE_RENDER_SERVER_WORKER_THREAD
#include <threads.h>
#include "c11/threads.h"
#endif
#include <unistd.h>

Expand Down
56 changes: 32 additions & 24 deletions src/drm/amdgpu/amdgpu_renderer.c
Original file line number Diff line number Diff line change
Expand Up @@ -259,7 +259,7 @@ amdgpu_renderer_attach_resource(struct virgl_context *vctx, struct virgl_resourc
obj->bo = import.buf_handle;
amdgpu_bo_export(obj->bo, amdgpu_bo_handle_type_kms, &obj->base.handle);
amdgpu_object_set_res_id(ctx, obj, res->res_id);
print(1, "imported dmabuf -> res_id=%u" PRIx64, res->res_id);
print(1, "imported dmabuf -> res_id=%u", res->res_id);
} else {
print(2, "Ignored res_id: %d (fd_type = %d)", res->res_id, fd_type);
if (fd_type != VIRGL_RESOURCE_FD_INVALID)
Expand Down Expand Up @@ -411,7 +411,7 @@ amdgpu_renderer_get_blob(struct virgl_context *vctx, uint32_t res_id, uint64_t b

/* If GEM_NEW fails, we can end up here without a backing obj or if it's a dumb buffer. */
if (!obj) {
print(0, "No object with blob_id=%ld", blob_id);
print(0, "No object with blob_id=%" PRIu64, blob_id);
return -ENOENT;
}

Expand All @@ -424,7 +424,7 @@ amdgpu_renderer_get_blob(struct virgl_context *vctx, uint32_t res_id, uint64_t b
* to the same storage.
*/
if (obj->exported) {
print(0, "Already exported! blob_id:%ld", blob_id);
print(0, "Already exported! blob_id:%" PRIu64, blob_id);
return -EINVAL;
}

Expand All @@ -436,7 +436,7 @@ amdgpu_renderer_get_blob(struct virgl_context *vctx, uint32_t res_id, uint64_t b
ret = amdgpu_bo_export(obj->bo, amdgpu_bo_handle_type_dma_buf_fd, (uint32_t *)&fd);

if (ret) {
print(0, "Export to fd failed for blob_id:%ld r=%d (%s)", blob_id, ret, strerror(errno));
print(0, "Export to fd failed for blob_id:%" PRIu64 " r=%d (%s)", blob_id, ret, strerror(errno));
return ret;
}

Expand Down Expand Up @@ -470,7 +470,7 @@ amdgpu_ccmd_query_info(struct drm_context *dctx, struct vdrm_ccmd_req *hdr)
struct amdgpu_ccmd_query_info_rsp *rsp;
unsigned rsp_len;
if (__builtin_add_overflow(sizeof(*rsp), req->info.return_size, &rsp_len)) {
print(1, "%s: Request size overflow: %zu + %" PRIu32 " > %u",
print(1, "%s: Request size overflow: %zu + %u > %u",
__FUNCTION__, sizeof(*rsp), req->info.return_size, UINT_MAX);
return -EINVAL;
}
Expand Down Expand Up @@ -510,12 +510,12 @@ amdgpu_ccmd_gem_new(struct drm_context *dctx, struct vdrm_ccmd_req *hdr)

if (req->r.__pad) {
print(0, "Invalid value for struct %s_req::r::__pad: "
"0x%" PRIx32, __FUNCTION__, req->r.__pad);
"0x%x", __FUNCTION__, req->r.__pad);
ret = -EINVAL;
goto alloc_failed;
}
if (!drm_context_blob_id_valid(dctx, req->blob_id)) {
print(0, "Invalid blob_id %ld", req->blob_id);
print(0, "Invalid blob_id %" PRIu64, req->blob_id);
ret = -EINVAL;
goto alloc_failed;
}
Expand Down Expand Up @@ -553,7 +553,7 @@ amdgpu_ccmd_gem_new(struct drm_context *dctx, struct vdrm_ccmd_req *hdr)

drm_context_object_set_blob_id(dctx, &obj->base, req->blob_id);

print(2, "new object blob_id: %ld heap: %08x flags: %lx size: %ld",
print(2, "new object blob_id: %" PRIu64 " heap: %08x flags: %" PRIx64" size: %" PRIu64,
req->blob_id, req->r.preferred_heap, req->r.flags, req->r.alloc_size);

return 0;
Expand All @@ -562,7 +562,7 @@ amdgpu_ccmd_gem_new(struct drm_context *dctx, struct vdrm_ccmd_req *hdr)
amdgpu_bo_free(bo_handle);

alloc_failed:
print(2, "ERROR blob_id: %ld heap: %08x flags: %lx",
print(2, "ERROR blob_id: %" PRIu64 " heap: %08x flags: %" PRIx64,
req->blob_id, req->r.preferred_heap, req->r.flags);
if (ctx->shmem)
ctx->shmem->async_error++;
Expand Down Expand Up @@ -593,7 +593,10 @@ amdgpu_ccmd_bo_va_op(struct drm_context *dctx, struct vdrm_ccmd_req *hdr)
} else {
obj = amdgpu_get_object_from_res_id(ctx, req->res_id, __FUNCTION__);
if (!obj) {
print(0, "amdgpu_bo_va_op_raw failed: op: %d res_id: %d offset: 0x%lx size: 0x%lx va: %" PRIx64 " r=%d",
print(0,
"amdgpu_bo_va_op_raw failed: "
"op: %d res_id: %d offset: 0x%" PRIx64 " "
"size: 0x%" PRIx64 " va: %" PRIx64 " r=%d",
req->op, obj->base.res_id, req->offset, req->vm_map_size, req->va, rsp->ret);

/* This is ok. This means the guest closed the GEM already. */
Expand All @@ -609,11 +612,16 @@ amdgpu_ccmd_bo_va_op(struct drm_context *dctx, struct vdrm_ccmd_req *hdr)
if (ctx->shmem)
ctx->shmem->async_error++;

print(0, "amdgpu_bo_va_op_raw failed: op: %d res_id: %d offset: 0x%lx size: 0x%lx va: %" PRIx64 " r=%d",
print(0,
"amdgpu_bo_va_op_raw failed: "
"op: %d res_id: %d offset: 0x%" PRIx64 " "
"size: 0x%" PRIx64 " va: %" PRIx64 " r=%d",
req->op, req->res_id, req->offset, req->vm_map_size, req->va, rsp->ret);
} else {
print(2, "va_op %d res_id: %u va: [0x%" PRIx64 ", 0x%" PRIx64 "] @offset 0x%" PRIx64,
req->op, req->res_id, req->va, req->va + req->vm_map_size - 1, req->offset);
print(2,
"va_op %d res_id: %u "
"va: [0x%" PRIx64 ", 0x%" PRIx64 "] @offset 0x%" PRIx64,
req->op, req->res_id, req->va, req->va + req->vm_map_size - 1, req->offset);
}

return 0;
Expand Down Expand Up @@ -646,7 +654,7 @@ amdgpu_ccmd_set_metadata(struct drm_context *dctx, struct vdrm_ccmd_req *hdr)
metadata.size_metadata = req->size_metadata;
if (req->size_metadata) {
if (req->size_metadata > sizeof(metadata.umd_metadata)) {
print(0, "Metadata size is too large for target buffer: %" PRIu32 " > %zu",
print(0, "Metadata size is too large for target buffer: %u > %zu",
req->size_metadata, sizeof(metadata.umd_metadata));
rsp->ret = -EINVAL;
return -1;
Expand All @@ -655,7 +663,7 @@ amdgpu_ccmd_set_metadata(struct drm_context *dctx, struct vdrm_ccmd_req *hdr)
offsetof(struct amdgpu_ccmd_set_metadata_req,
umd_metadata));
if (requested_size > hdr->len) {
print(0, "Metadata size is too large for source buffer: %zu > %" PRIu32,
print(0, "Metadata size is too large for source buffer: %zu > %u",
requested_size, hdr->len);
rsp->ret = -EINVAL;
return -1;
Expand Down Expand Up @@ -736,7 +744,7 @@ amdgpu_ccmd_create_ctx(struct drm_context *dctx, struct vdrm_ccmd_req *hdr)
}

if (req->flags & ~AMDGPU_CCMD_CREATE_CTX_DESTROY) {
print(0, "Invalid flags 0x%" PRIu32, req->flags);
print(0, "Invalid flags 0x%u", req->flags);
rsp->hdr.ret = -EINVAL;
return -1;
}
Expand Down Expand Up @@ -827,7 +835,7 @@ amdgpu_ccmd_cs_submit(struct drm_context *dctx, struct vdrm_ccmd_req *hdr)
}
/* Do not allocate arbitrarily large buffer. */
if (req->num_chunks > AMDGPU_CCMD_CS_SUBMIT_MAX_NUM_CHUNKS) {
print(1, "%s: Invalid num_chunks: %" PRIu32 " > %d",
print(1, "%s: Invalid num_chunks: %u > %d",
__FUNCTION__, req->num_chunks, AMDGPU_CCMD_CS_SUBMIT_MAX_NUM_CHUNKS);
rsp->ret = -EINVAL;
return -1;
Expand All @@ -842,7 +850,7 @@ amdgpu_ccmd_cs_submit(struct drm_context *dctx, struct vdrm_ccmd_req *hdr)
chunks = malloc((req->num_chunks + 1 /* syncobj_in */ + 1 /* syncobj_out */) *
sizeof(*chunks));
if (chunks == NULL) {
print(0, "Failed to allocate %" PRIu32 " chunks", req->num_chunks + 2);
print(0, "Failed to allocate %u chunks", req->num_chunks + 2);
r = -EINVAL;
goto end;
}
Expand All @@ -858,7 +866,7 @@ amdgpu_ccmd_cs_submit(struct drm_context *dctx, struct vdrm_ccmd_req *hdr)
size_t descriptors_len = size_add(offsetof(struct amdgpu_ccmd_cs_submit_req, payload),
size_mul(req->num_chunks, sizeof(struct desc)));
if (descriptors_len > hdr->len) {
print(0, "Descriptors are out of bounds: %zu + %zu * %" PRIu32 " > %" PRIu32,
print(0, "Descriptors are out of bounds: %zu + %zu * %u > %u",
offsetof(struct amdgpu_ccmd_cs_submit_req, payload),
sizeof(struct desc), req->num_chunks, hdr->len);
r = -EINVAL;
Expand All @@ -875,7 +883,7 @@ amdgpu_ccmd_cs_submit(struct drm_context *dctx, struct vdrm_ccmd_req *hdr)
chunks[num_chunks].chunk_id = chunk_id;
/* Validate input. */
if (end > hdr->len) {
print(0, "Descriptors are out of bounds: %zu > %" PRIu32, end, hdr->len);
print(0, "Descriptors are out of bounds: %zu > %u", end, hdr->len);
r = -EINVAL;
goto end;
}
Expand Down Expand Up @@ -936,7 +944,7 @@ amdgpu_ccmd_cs_submit(struct drm_context *dctx, struct vdrm_ccmd_req *hdr)
}
in = input;
if (in->offset % sizeof(uint64_t)) {
print(0, "Invalid chunk offset %" PRIu32 " (not multiple of 8)", in->offset);
print(0, "Invalid chunk offset %u (not multiple of 8)", in->offset);
r = -EINVAL;
goto end;
}
Expand Down Expand Up @@ -1043,7 +1051,7 @@ amdgpu_ccmd_cs_submit(struct drm_context *dctx, struct vdrm_ccmd_req *hdr)

drmSyncobjDestroy(amdgpu_device_get_fd(ctx->dev), syncobj_out.handle);

print(3, "ctx: %d -> seqno={v=%d a=%ld} r=%d", req->ctx_id, hdr->seqno, seqno, r);
print(3, "ctx: %d -> seqno={v=%d a=%" PRIu64 "} r=%d", req->ctx_id, hdr->seqno, seqno, r);

end:
if (bo_list)
Expand Down Expand Up @@ -1158,7 +1166,7 @@ amdgpu_renderer_submit_fence(struct virgl_context *vctx, uint32_t flags,

/* timeline is ring_idx-1 (because ring_idx 0 is host CPU timeline) */
if (ring_idx > AMDGPU_HW_IP_NUM) {
print(0, "invalid ring_idx: %" PRIu32, ring_idx);
print(0, "invalid ring_idx: %u", ring_idx);
return -EINVAL;
}
/* ring_idx zero is used for the guest to synchronize with host CPU,
Expand All @@ -1170,7 +1178,7 @@ amdgpu_renderer_submit_fence(struct virgl_context *vctx, uint32_t flags,
return 0;
}

print(3, "ring_idx: %d fence_id: %lu", ring_idx, fence_id);
print(3, "ring_idx: %d fence_id: %" PRIu64, ring_idx, fence_id);
return drm_timeline_submit_fence(&ctx->timelines[ring_idx - 1], flags, fence_id);
}

Expand Down
Loading