Repository navigation
hk: honor plane offsets from VkImageDrmFormatModifierExplicitCreateInfoEXT (port of #10) - #34
Merged
Merged
Conversation
DjDeveloperr
force-pushed
the
aurora/hk-explicit-plane-offsets
branch
from
October 22, 2026 23:07
2732e91 to
0f875a9
Compare
Author
|
Rebased onto aurora-wip c363804; no conflicts. Neo (A18 Pro, G17P) results: the explicit-layout test passes 25/25 with this branch and fails on the base. |
…foEXT Only rowPitch was taken from pPlaneLayouts; the offset was ignored, so every plane was bound at the memory binding offset (packed sequentially for multi-plane images). Importing a dma-buf plane that does not start at offset 0, e.g. the CbCr plane of a single-buffer NV12 frame imported by libplacebo as its own image, therefore sampled the luma plane. Store the explicit per-plane offset and use it when binding memory, computing memory requirements and reporting the subresource layout. Per the spec it is relative to the image's memory binding, or to the plane's binding for disjoint images. Seen with mpv --hwdec=v4l2request --vo=gpu (Vulkan) decoding H.264 with the Apple AVD V4L2 stateless decoder: chroma showed luma data (green/magenta picture). The OpenGL/EGL dma-buf import path was fine. Assisted-by: Claude:claude-opus-5-5 Signed-off-by: Thomas Glanzmann <thomas@glanzmann.de> [DjDeveloperr: adapted to aurora-wip, whose precomputed plane offsets already take the explicit offset for placement, memory requirements, binding and subresource layouts; what remains lets disjoint planes share offsets] (cherry picked from commit ba289e6)
vkBindImageMemory2 checked each plane, at the binding offset plus its (possibly explicit) plane offset, against the size of the BO behind the memory object. That BO is page-rounded and may come from the BO cache larger still, so a plane could be bound past the end of the memory object. Check against the memory object's allocation size where it has one.
hk-vulkan-explicit-plane-layout creates LINEAR-modifier images through VkImageDrmFormatModifierExplicitCreateInfoEXT whose planes do not start at offset 0: an RGBA8 plane at 0x1000, NV12 with its CbCr plane at 0x1000 in one binding, and disjoint NV12 whose planes both start at 0 (or 0x80) of their own bindings. It checks that the memory requirements cover each plane's offset and size, that vkGetImageSubresourceLayout reports the explicit offset, that binding succeeds at a nonzero memory offset and fails on memory ending before a plane, and that misaligned offsets and overlapping planes of one binding are refused. For the GPU-tiled modifiers, compressed ones included, an explicit offset must grow the requirements by exactly that offset, the subresource layout must report it, and a compressed memory plane must be larger than a plain one by its metadata. It runs under the no-op DRM shim for G13 and G17P as hk-g13g-explicit-plane-layout and hk-g17p-explicit-plane-layout.
DjDeveloperr
force-pushed
the
aurora/hk-explicit-plane-offsets
branch
from
October 23, 2026 00:05
0f875a9 to
85d846e
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This ports @sithglan's #10 (Thomas Glanzmann) to aurora-wip, keeping his authorship, message and trailers.
aurora-wip already takes
pPlaneLayouts[].offsetas the plane offset (a2c4676). What was still missing from #10 is that disjoint images were refused when planes in separate bindings share an offset, for example two dma-bufs whose planes both start at 0. The commit is reduced to that change, with a port note.Two follow-ups:
Hardware, M2 Pro (AGX2):
drm_format_modifiers.*,ycbcr.*disjoint*(format, plane_view, query, 8-bit 4:2:0 copy) andapi.external.memory.dma_buf.*: 5,878 cases, identical to base (3,142 pass, 2,736 not supported, 0 fail).Note: aurora-wip requires explicit plane offsets to be 128-byte aligned; #10 as written accepted any offset. 1080p and 720p NV12 chroma offsets satisfy it.
Supersedes #10 for aurora-wip.