Skip to content

host: vulkan: check YCbCr format features before creating samplers#164

Merged
jmacnak merged 1 commit into
google:mainfrom
InternetOfTofu:main
Jul 21, 2026
Merged

host: vulkan: check YCbCr format features before creating samplers#164
jmacnak merged 1 commit into
google:mainfrom
InternetOfTofu:main

Conversation

@InternetOfTofu

Copy link
Copy Markdown
Contributor

During YcbcrSamplerPool initialization, getOrCreateSamplerInfo called vkCreateSamplerYcbcrConversion and vkCreateSampler without checking if the host Vulkan driver supported YCbCr sampler conversion features for the given format. On host GPU drivers lacking YCbCr sampler support for prepopulated formats (e.g. Intel Gen12 Mesa driver), this triggered a null pointer dereference inside driver vkCreateSampler.

Check VK_FORMAT_FEATURE_MIDPOINT_CHROMA_SAMPLES_BIT, VK_FORMAT_FEATURE_COSITED_CHROMA_SAMPLES_BIT, and
VK_FORMAT_FEATURE_SAMPLED_IMAGE_YCBCR_CONVERSION_LINEAR_FILTER_BIT in getOrCreateSamplerInfo before sampler creation, and log a verbose message instead of failing pool init when prepopulation is skipped.

TEST: run crosvm on redrix with gfxstream vulkan

During YcbcrSamplerPool initialization, getOrCreateSamplerInfo called
vkCreateSamplerYcbcrConversion and vkCreateSampler without checking if
the host Vulkan driver supported YCbCr sampler conversion features for
the given format. On host GPU drivers lacking YCbCr sampler support for
prepopulated formats (e.g. Intel Gen12 Mesa driver), this triggered a
null pointer dereference inside driver vkCreateSampler.

Check VK_FORMAT_FEATURE_MIDPOINT_CHROMA_SAMPLES_BIT,
VK_FORMAT_FEATURE_COSITED_CHROMA_SAMPLES_BIT, and
VK_FORMAT_FEATURE_SAMPLED_IMAGE_YCBCR_CONVERSION_LINEAR_FILTER_BIT
in getOrCreateSamplerInfo before sampler creation, and log a verbose
message instead of failing pool init when prepopulation is skipped.

TEST: run crosvm on redrix with gfxstream vulkan
@jmacnak
jmacnak enabled auto-merge July 21, 2026 15:51
@jmacnak
jmacnak added this pull request to the merge queue Jul 21, 2026
Merged via the queue into google:main with commit e3b8c9a Jul 21, 2026
15 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants