Skip to content

[Mos] Fix Xe media engine reset on 32-bit media-driver#2005

Open
matte-schwartz wants to merge 1 commit into
intel:masterfrom
matte-schwartz:matts/fix-32bit-reset
Open

[Mos] Fix Xe media engine reset on 32-bit media-driver#2005
matte-schwartz wants to merge 1 commit into
intel:masterfrom
matte-schwartz:matts/fix-32bit-reset

Conversation

@matte-schwartz

Copy link
Copy Markdown

batch_addrs[0] (uint64_t) was cast through uintptr_t before assignment to exec.address (__u64). On 32-bit builds this truncates GPU VAs above 4GB, causing the kernel to reject or fault the dispatch and reset the media engine.

Pass batch_addrs[0] directly. For the array pointer branch, use the standard (uint64_t)(uintptr_t) idiom.

batch_addrs[0] (uint64_t) was cast through uintptr_t before assignment
to exec.address (__u64). On 32-bit builds this truncates GPU VAs above
4GB, causing the kernel to reject or fault the dispatch and reset the
media engine.

Pass batch_addrs[0] directly. For the array pointer branch, use the
standard (uint64_t)(uintptr_t) idiom.

Signed-off-by: Matthew Schwartz <matthew.schwartz@linux.dev>
@matte-schwartz

Copy link
Copy Markdown
Author

Sorry, I was under the impression given some older merged PRs in this repo (#1493) that 32-bit was somewhat supported, but I see now I was mistaken and that you've stated 32-bit builds are not supported: #1989 (comment).

This was actually for a media engine reset I ran into while looking into the feature requested in that issue, so it probably makes more sense to continue discussions there.

@fviolence

Copy link
Copy Markdown

I tested this patch on an Intel Arc Pro B70 system using the xe kernel driver, and it fixes the 32-bit H.264 VAAPI encode failure I was seeing.

Test environment (32-bit VAAPI stack):

OS: Arch Linux x86_64
GPU: Intel Arc Pro B70
Kernel driver: xe
lib32-libva 2.23.0
lib32-intel-gmmlib 22.10.0
lib32-intel-media-driver 26.1.5

Before applying this PR, 32-bit VAAPI initialized successfully, but actual encode failed. A minimal 32-bit FFmpeg H.264 VAAPI test failed with:

Failed to map output buffers: 24 (internal encoding error)
Output failed: -5
Error encoding a frame: Input/output error

Steam Remote Play showed the same effective failure through its 32-bit VAAPI path:

CGameStreamVideoStageVAAPI: Error encoding: Input/output error

After applying this PR, the same 32-bit FFmpeg H.264 VAAPI test succeeds. Steam Remote Play H.264 hardware encoding also works after applying the patch. The stream now uses HW encode, video is visible, and I no longer see the previous slow-encode / black-screen behavior in a short test.

So from my testing, this PR fixes a real 32-bit VAAPI H.264 encode failure on Battlemage / xe, and it also fixes Steam Remote Play H.264 hardware encoding on this system.

Any plans on merging the PR?

@matte-schwartz

Copy link
Copy Markdown
Author

@fviolence fwiw, in case it doesn't get merged, using the SteamRT3 beta seems to work with just the 64-bit intel-media-driver needed.

@fviolence

Copy link
Copy Markdown

Yes, SteamRT3 indeed uses the 64-bit intel-media-driver. However, the feature itself is experimental, and the stream is barely usable because of occasional, but frequent image freezes.

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.

2 participants