Closed Bug 1809162 Opened 1 year ago Closed 1 year ago

Implement dmabuf VA-API surface copy

Categories

(Core :: Widget: Gtk, enhancement, P3)

enhancement

Tracking

()

RESOLVED FIXED
111 Branch
Tracking Status
firefox111 --- fixed

People

(Reporter: stransky, Assigned: stransky)

References

(Blocks 1 open bug)

Details

Attachments

(5 files, 3 obsolete files)

48 bytes, text/x-phabricator-request
Details | Review
48 bytes, text/x-phabricator-request
Details | Review
48 bytes, text/x-phabricator-request
Details | Review
48 bytes, text/x-phabricator-request
Details | Review
48 bytes, text/x-phabricator-request
Details | Review

Implement dmabuf VA-API surface copy so we don't need to block dmabuf ffmpeg frames recycle.

  • Move DMABufSurfaceYUV::CreateYUVPlane to DMABufSurfaceYUV::CreateLinearYUVPlane. That's used for debugging purposes only and may be removed later.
  • Implement ImportPRIMESurfaceDescriptor() which files DMABufSurfaceYUV with data from PRIMESurfaceDescriptor except dmabuf file descriptors.
  • Implement DMABufSurfaceYUV::CreateYUVPlane(int aPlane) which creates YUV surface plane according to data imported from PRIMESurfaceDescriptor.
  • Implement DMABufSurfaceYUV::UpdateYUVDataImpl(). That moves all dmabuf surface data from PRIMESurfaceDescriptor to DMABufSurfaceYUV,
    i.e. DMABufSurfaceYUV and PRIMESurfaceDescriptor points to the same GPU memory.
  • Implement DMABufSurfaceYUV::CopyYUVDataImpl(). That copies dmabuf surface from PRIMESurfaceDescriptor to DMABufSurfaceYUV,
    i.e. DMABufSurfaceYUV and PRIMESurfaceDescriptor points to different GPU memory parts with the same content.
  • DMABufSurfaceYUV::UpdateYUVData() now takes extra "copy" param to request dmabuf copy.

Depends on D166329

If we're asked to copy dmabuf surface, don't lock VA-API data. That enables ffmpeg to recycle VA-API surface faster and prevent rendering artifacts on some hardware.

Depends on D166331

Depends on: 1809167

D166328 does only basic config. Bug 1809167 is a follow up to extend it for multiple GPU scenario.

Pushed by stransky@redhat.com:
https://hg.mozilla.org/integration/autoland/rev/4692e64be33b
[Linux] Implement GetAndConfigureDMABufDevice() to configure dmabuf backend without gfxPlatform on RDD process r=emilio
https://hg.mozilla.org/integration/autoland/rev/84503cda04f3
[Linux] Fixed ClaimSnapshotGLContext() logs r=emilio
https://hg.mozilla.org/integration/autoland/rev/2d88d3f5c01f
[Linux] Implement dmabuf YUV surface copy r=emilio
https://hg.mozilla.org/integration/autoland/rev/bb0ff84365ad
[Linux] Add media.ffmpeg.vaapi.surface-copy.enabled to enable VA-API surface copy r=emilio
https://hg.mozilla.org/integration/autoland/rev/0034c0451d9b
[Linux] Utilize dmabuf surface copy in VideoFramePool r=alwu

Backed out 5 changesets (Bug 1809162) for causing bustages on FFmpegVideoFramePool.cpp.
Backout link
Push with failures <--> Bp-hybrid
Failure Log

Flags: needinfo?(stransky)
Attachment #9311341 - Attachment description: Bug 1809162 [Linux] Add media.ffmpeg.vaapi.surface-copy.enabled to enable VA-API surface copy r?emilio → Bug 1809162 [Linux] Add mmedia.ffmpeg.vaapi.zero-copy.enabled and media.ffmpeg.vaapi.zero-copy.force-enabled control VA-API surface copy r?emilio

Set FEATURE_HW_DECODED_VIDEO_ZERO_COPY on Linux and enable it for Intel hardware.

Depends on D166332

Flags: needinfo?(stransky)
Attachment #9312585 - Attachment is obsolete: true

I was wrong and surface copy does not fix the rendering artifacts (Bug 1802844), at least from my latest testing.
But we need surface copy for Bug 1809026 - upload dmabuf surfaces as textures to WebGL. WebGL rendering pipeline is too long and causes decoder frame exhaustion without surface copy.

No longer blocks: 1802844
Component: Audio/Video: Playback → Widget: Gtk
Depends on: 1809026
No longer depends on: 1809167
Priority: -- → P3
Attachment #9311341 - Attachment is obsolete: true

If we're asked to copy dmabuf surface, don't lock VA-API data. That enables ffmpeg to recycle VA-API surface faster and prevent rendering artifacts on some hardware.

Depends on D166330

Pushed by stransky@redhat.com:
https://hg.mozilla.org/integration/autoland/rev/82b73378753b
[Linux] Implement GetAndConfigureDMABufDevice() to configure dmabuf backend without gfxPlatform on RDD process r=emilio
https://hg.mozilla.org/integration/autoland/rev/1a21a0a52583
[Linux] Fixed ClaimSnapshotGLContext() logs r=emilio
https://hg.mozilla.org/integration/autoland/rev/1cb0dda1e2c0
[Linux] Implement dmabuf YUV surface copy r=emilio
https://hg.mozilla.org/integration/autoland/rev/a6db25087429
[Linux] Utilize dmabuf surface copy in VideoFramePool
Pushed by csabou@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/0df1e0ac058f
[Linux] Type DMABufSurfaceYUV* to RefPtr to avoid build bustage. a=bustage-fix CLOSED TREE
Attachment #9311342 - Attachment is obsolete: true
Regressions: 1811878
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: