Skip to content

gfxstream: export a ColorBuffer's memory regardless of ExternalBlob - #178

Open
jvle wants to merge 1 commit into
google:mainfrom
jvle:externalblob-scanout-decouple
Open

gfxstream: export a ColorBuffer's memory regardless of ExternalBlob#178
jvle wants to merge 1 commit into
google:mainfrom
jvle:externalblob-scanout-decouple

Conversation

@jvle

@jvle jvle commented Aug 27, 2026

Copy link
Copy Markdown
Contributor

Addresses the point @gurchetansingh raised on the ARSP review: ExternalBlob was
doing two unrelated jobs — picking the map_blob transport (descriptor vs. host-visible
mapping) for ordinary memory, and gating whether a ColorBuffer's memory gets exported
for scanout at all. Those need to be independent.

The bug

With ExternalBlob off (we need it off so SystemBlob can carry host-visible memory —
VulkanAllocateHostVisibleAsUdmabuf fails on newer hosts, and plain ExternalBlob
exports as an AHardwareBuffer handle that crosvm's resource_map_blob() rejects),
vkGetBlobInternal never registered a ColorBuffer's descriptor, and
VirtioGpuResource::Create's blob path only knew how to look up a mapping. The
scanout blob had neither, so every frame failed:

virtio_gpu_resource.cpp: Failed to create blob: no external blob mapping.
virtio_gpu_frontend.cpp: Failed to transfer: failed to find resource 6.

Fix

  • vkGetBlobInternal: export+register the descriptor whenever the memory backs a
    ColorBuffer (info->boundColorBuffer), independent of the flag.
  • VirtioGpuResource::Create: probe for a registered descriptor first, then fall back
    to a mapping, instead of picking one or the other by the flag.

The blob_id==0 ring path and the guest-handle sub-branch are untouched — those are
real transport choices, not scanout.

Tested on Intel PTL (fatcat) both with ExternalBlob:disabled (the case this fixes —
Weston reaches its GL renderer, desktop composites via AHB-FLIP, no blob/resource
errors) and with the shipping SystemBlob:enabled;ExternalBlob:enabled config (no
regression).

ExternalBlob was gating two unrelated things: whether host-visible
memory travels as a descriptor vs. a mapping, and whether a
ColorBuffer's memory gets exported at all. With the flag off (needed
for SystemBlob on fatcat), vkGetBlobInternal never registered a
ColorBuffer's descriptor, and VirtioGpuResource::Create only knew how
to look up a mapping -- so the scanout blob had neither, and the guest
saw "no external blob mapping" / "unknown resource" for every frame.

Widen vkGetBlobInternal's export branch to also fire when the memory
backs a ColorBuffer (info->boundColorBuffer), independent of the flag.
Make VirtioGpuResource::Create probe for a registered descriptor
before falling back to a mapping, instead of picking one or the other
by the flag. The blob_id==0 ring path and the guest-handle sub-branch
are untouched -- those are real transport choices, not scanout.

Bug: 545345381
Test: fatcat, ExternalBlob:disabled -- Weston reaches its GL renderer,
      desktop and app windows composite correctly via AHB-FLIP, zero
      GFXSTREAM blob/resource errors in the boot log
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.

1 participant