[x86-64] No MPEG2 hw acceleration with AMD GPU

  • Hi!

    As the title states, there is no hw accleration of mpeg2 content on AMD GPUs, even though it's supported by the GPU silicon. For newer (RX7000+) chips, it does not matter as they do not support hw decoding mpeg2 (and vc-1) content, but for older generations? (in my case, Vega 8 and RX6600)

    Is there a reason why it's disabled/missing in the Mesa package.mk?

    => https://github.com/LibreELEC/Libr…package.mk#L106


    I compiled myself an LE version with mpeg2 enabled and it works fine...

  • Is there a reason why it's disabled/missing in the Mesa package.mk?

    There's no reason that I'm aware of, although for context I haven't paid much attention to x86_64 matters for about a decade. You are welcome to send a pull request. We'll leave it open for a bit and see what comments it attracts.

  • It might be better to enable the capability in code and allow people to disable through Kodi VAAPI settings if there are issues rather than the current block in code?

  • Looks like it should changed to -Dvideo-codecs=all to enable all codecs rather than list them individually.

    Our preference has always been to be explicit about what we build and support rather than use catch-all configs.

  • Our preference has always been to be explicit

    In this case "all" is the correct option for LE. This is the "video codec support option" PR in Mesa that was the reason for this change. "all" option didn't exist back then, so it was needed to set codecs explicitly.

    This Mesa PR introduced the "all" option, so "-Dvideo-codecs=all" would restore the old behaviour.

  • Thanks, guys!


    If it's okay, I will draft a PR with the -Dvideo-codecs=all option?

    In any case, vaapi-mpeg2 is problematic on AMD, image quality-wise. At least that's how it was a few years ago but I don't think anything changed.

    I thought of something like this as an explanation why it wasn't enabled in the first place. Do you have sample media that exhibits those problems or a link to a thread discussion such? Would like to test such media on my rx 6600...

  • Our general preference with packages is to always be explicit in what we enable. That way package featuresets never magically change because some upstream maintainer changed the scope of "all" without us noticing.

  • Our general preference with packages is to always be explicit in what we enable.

    I don't see how this is relevant to this particular case. The only use case for setting codecs explicitly is to disable non-free codecs. That was the only reason for the 2022 Mesa change.

    In 2022 codecs were set explicitly in LE only because there was no other choice due to that questionable Mesa change. It already caused MPEG2 breakage (unnoticed for years), then it caused av1 and vp9 breakage, it would cause more breakage in the future when new codecs will arrive.

    In 2023 PR Mesa tried to fix their mess by introducing "all" and "all_free" options. "all" is the safest option, it simply brings back the old behaviour (pre-2022 changes).

    Do you have sample media that exhibits those problems or a link to a thread discussion such? Would like to test such media on my rx 6600

    That was in circa 2020 when I still had Vega 3 APU. I don't remember which MPEG2 videos caused issues. Try some random DVDs with vaapi on and off. I remember there was a discussion about this but I can't find it.

  • I don't see how this is relevant to this particular case.

    It's relevant because explicit configuration of things is a general design objective for the buildsystem. Whether that was/wasn't an option in the past is irrelevant because what's possible today takes prescedence.

    I plan to leave the PR open for a while for people to show up with comments on the state of MPEG2 decoding.