Compare commits

...
Sign in to create a new pull request.

2 commits

Author SHA1 Message Date
fed6ed3ab7 Build fixes for vmsilo 2026-03-23 13:52:04 +00:00
fc5f045e1c virgl: query host layout for render-target and scanout resources
The virgl driver only queried the host resource layout (which includes
the real modifier) for PIPE_BIND_SHARED resources. Resources created
via gbm_bo_create() with GBM_BO_USE_RENDERING have PIPE_BIND_RENDER_TARGET
but not PIPE_BIND_SHARED, so the layout query never fired and
gbm_bo_get_modifier() always returned LINEAR (0). When the host GPU
allocates with non-linear tiling (e.g. NVIDIA block-linear), this
caused the host compositor to receive the wrong modifier in Wayland
dmabuf add() calls, producing GL_INVALID_OPERATION.

Broaden the trigger for virgl_resource_async_query_gbm_layout() to also
fire for PIPE_BIND_SCANOUT and PIPE_BIND_RENDER_TARGET resources. The
existing async query and sync mechanisms are unchanged.

Also relax virgl_resource_create_with_modifiers() to accept modifier
lists that don't include LINEAR, since the host always decides the
actual layout. This prevents resource creation failures when clients
request host-native modifiers from the compositor's format table.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-23 13:32:22 +00:00
4 changed files with 11 additions and 5 deletions

View file

@ -1990,7 +1990,7 @@ endif
dep_clang = null_dep
if with_clc
llvm_libdir = dep_llvm.get_variable(cmake : 'LLVM_LIBRARY_DIR', configtool: 'libdir')
llvm_libdir = get_option('clang-libdir')
dep_clang = cpp.find_library('clang-cpp', dirs : llvm_libdir, required : false)

View file

@ -879,3 +879,10 @@ option(
value : false,
description : 'use experimental virtio backend for intel driver',
)
option(
'clang-libdir',
type : 'string',
value : '',
description : 'Locations to search for clang libraries.'
)

View file

@ -680,7 +680,7 @@ virgl_resource_async_query_gbm_layout(struct pipe_screen *screen,
struct virgl_context *vctx;
struct pipe_context *ctx;
if (!(bind & PIPE_BIND_SHARED))
if (!(bind & (PIPE_BIND_SHARED | PIPE_BIND_SCANOUT | PIPE_BIND_RENDER_TARGET)))
return;
if (!(vs->caps.caps.v2.capability_bits_v2 & VIRGL_CAP_V2_RESOURCE_LAYOUT))
@ -807,8 +807,7 @@ virgl_resource_create_with_modifiers(struct pipe_screen *screen,
int count)
{
if (!drm_find_modifier(DRM_FORMAT_MOD_LINEAR, modifiers, count)) {
mesa_loge("unsupported modifier requested\n");
return NULL;
mesa_logd("non-linear modifiers requested; host will decide actual layout\n");
}
return virgl_resource_create_front(screen, templ, NULL);

View file

@ -64,7 +64,7 @@ configure_file(
configuration : _config,
input : 'rusticl.icd.in',
output : 'rusticl.icd',
install : true,
install : false,
install_tag : 'runtime',
install_dir : join_paths(get_option('sysconfdir'), 'OpenCL', 'vendors'),
)