TinyPPI - Universal PlayerProcessInfo for CE 22

A new TinyPPI update is now available for download from the repository, together with a new version of the TinyPPI Mobile app.

TinyPPI 2.9.3

:television: TV Series & Episodes

  • Added full TV Series, seasons and episode support.
  • Added episode playback, search and improved library handling.
  • Added series and fanart artwork support.

:star: Ratings & Runtime

  • Added IMDb / TMDb ratings.
  • Added runtime and watched/unseen information.

:framed_picture: Artwork & Performance

  • Improved Kodi texture caching and artwork handling.
  • Improved idle dashboard performance.
  • Added better cache invalidation.

:television: Dolby Vision

  • Improved TV-LED Dolby Vision display-reset handling when changing DV modes.

TinyPPI Mobile 1.4.3

:television: TV Series & Episodes

  • Added TV Series, seasons and episodes.
  • Added episode playback, search and artwork support.

:clapper_board: Library

  • Added dedicated Films and Series library screens.
  • Improved library navigation and organization.

:star: Ratings & Runtime

  • Added IMDb / TMDb ratings.
  • Added runtime and watched/unseen information.

:compass: Navigation

  • Reordered and improved the top-level navigation.
  • Improved handling of library and Series availability.

:test_tube: Testing

  • Added tests for Series, library, runtime and artwork handling.

Thank you so much!

@jamal2367 its awesome adding. :victory_hand:

But, I removed those new lines from mode_select.py, what portisch forced.

The old one worked without issue by me in any mode, back and forth in TV-LED mode.
With the new, when I switch once one SDR source file > DV , and then wanted switch to HDR10, its not possible, it set just to SDR
And not possible too, when the the source HDR10, then once set to DV, and wanted back to HDR10. it set just to SDR.
But its minor thing. I will just simple delete those lines in the future.
Thanks again :slight_smile:

@frodo19
I hope you like the new feature for TV shows. :smiling_face:

I have the exact same problem. I reverted it. Update to the new version from the repository.

I did not test the change but I guess it’s same item I had with dv_mode. Will check it tomorrow.

Did some testing now and at least this fix SDR/DV VS10 and back in DV-Std and DV-LL mode:

diff --git a/resources/lib/ui/mode_select.py b/resources/lib/ui/mode_select.py
index f30819a..6b3b4ee 100644
--- a/resources/lib/ui/mode_select.py
+++ b/resources/lib/ui/mode_select.py
@@ -33,6 +33,15 @@ _DVMODE  = "/sys/class/amdolby_vision/dv_mode"
 # for that playback and not for an HDR10 one -- see ``_player_led_mode``.
 _LL_POLICY = "/sys/module/aml_media/parameters/dolby_vision_ll_policy"
 
+_DOLBY_VISION_LL_DISABLE = "0"
+_DOLBY_VISION_LL_YUV422  = "1"
+
+_DV_STATUS = "/sys/module/aml_media/parameters/dolby_vision_status"
+
+_DV_STATUS_OFF = "0"
+_DV_STATUS_ON  = "1"
+
+
 # dolby_vision_policy: AMDV_FOLLOW_SINK, AMDV_FOLLOW_SOURCE and
 # AMDV_FORCE_OUTPUT_MODE.  Forcing is what a VS10 mode is; follow-source is what
 # Kodi leaves behind when it turns Dolby Vision off, and so what a mode that
@@ -120,6 +129,22 @@ def _dv_output_active() -> bool:
     return _read(_DV_OUTPUT) in _DV_OUTPUT_MODES
 
 
+def _dv_status_off() -> bool:
+    """Poll if Dolby Vision is on."""
+    return _read(_DV_STATUS) == _DV_STATUS_OFF
+
+
+def _wait_for_dv_status_off(timeout_ms: int = 500, step_ms: int = 50) -> bool:
+    """Poll the DV driver state, returning True when DV status goes off."""
+    waited = 0
+    while waited < timeout_ms:
+        _delay(step_ms)
+        waited += step_ms
+        if _dv_status_off():
+            return True
+    return True
+
+
 def _wait_for_dv_output_change(
     before: bool,
     timeout_ms: int = _DV_OUTPUT_TIMEOUT_MS,
@@ -183,14 +208,6 @@ def _reset_display_on_dv_change(name: str, dv_before: bool) -> None:
     if (name in _DV_MODES) == dv_before:
         return
 
-    if not _player_led_mode():
-        xbmc.log(
-            f"TinyPPI: '{name}' crossed the Dolby Vision line, but this box is "
-            "TV-LED and signals that itself -> no display reset",
-            xbmc.LOGINFO,
-        )
-        return
-
     if not _wait_for_dv_output_change(dv_before):
         xbmc.log(
             f"TinyPPI: '{name}' did not move the driver's output mode "
@@ -216,14 +233,31 @@ def _write_sequence(
 
 def _set_passthrough_mode(dv_mode: str, delay_ms: int = 100) -> None:
     """Set the CoreELEC policy and enable Dolby Vision in the requested mode."""
-    _write_sequence(
-        (
-            (_POLICY, _POLICY_FORCE_OUTPUT),
-            (_ENABLE, "Y"),
-            (_DVMODE, dv_mode),
-        ),
-        delay_ms=delay_ms,
-    )
+    steps = []
+
+    if dv_mode != _MODE_BYPASS:
+        steps.append((_ENABLE, "Y"))
+        steps.append((_POLICY, _POLICY_FORCE_OUTPUT))
+    else:
+        steps.append((_POLICY, _POLICY_FOLLOW_SOURCE))
+
+    if dv_mode == _MODE_DV_TUNNEL:
+        steps.append((_LL_POLICY, _DOLBY_VISION_LL_DISABLE))
+    elif dv_mode == _MODE_DV_IPT:
+        steps.append((_LL_POLICY, _DOLBY_VISION_LL_YUV422))
+
+    steps.append((_DVMODE, dv_mode))
+
+    _write_sequence(tuple(steps), delay_ms=delay_ms)
+
+    _wait_for_dv_status_off()
+
+    if dv_mode == _MODE_BYPASS:
+        _write_sequence(
+            (
+                (_ENABLE, "N"),
+            )
+        )
 
 
 def _set_sdr_conversion_mode(dv_mode: str) -> None:

A second issue is you can’t just swap from HDR10 to DV or vise versa.
You need to reset to SDR first to get correct display parameter.
But the switch to SDR, then to HDR in one call does not work. It must be splited thread calls.
So a interlock matrix like:

            if control_id == 1003:
                self.getControl(1004).setEnabled(False)
            elif control_id == 1004:
                self.getControl(1003).setEnabled(False)
            elif control_id == 1002:
                self.getControl(1003).setEnabled(True)
                self.getControl(1004).setEnabled(True)

and same for the 2 others should somehow work.
Then user must go back to SDR first before he can go to HDR when he was on DV.
Then this diff is also need to:

diff --git a/resources/lib/ui/mode_select.py b/resources/lib/ui/mode_select.py
index 6b3b4ee..5ff78e8 100644
--- a/resources/lib/ui/mode_select.py
+++ b/resources/lib/ui/mode_select.py
@@ -261,12 +261,11 @@ def _set_passthrough_mode(dv_mode: str, delay_ms: int = 100) -> None:
 
 
 def _set_sdr_conversion_mode(dv_mode: str) -> None:
-    """Reset to SDR first, then enable the requested conversion mode."""
+    """Enable the requested conversion mode."""
     _write_sequence(
         (
-            (_POLICY, _POLICY_FORCE_OUTPUT),
-            (_DVMODE, _MODE_BYPASS),
             (_ENABLE, "Y"),
+            (_POLICY, _POLICY_FORCE_OUTPUT),
             (_DVMODE, dv_mode),
         )
     )

Thanks for the fix.

I’d appreciate it if you could submit this fix as a pull request. Since I’ve been busy with other things for quite some time, I don’t have time to do this myself or test it thoroughly. I won’t have access to the computer for quite some time.

Thanks! :+1:

@Portisch , @frodo19

I haven’t tested it myself. Please try out the new VS10 and let me know if you run into any problems with it.
script.tinyppi-vs10.zip (986,7 KB)

You still will need to make a display reset on VS10 → HDR10 like with DV to non DV or non DV to DV.

Otherwise the last display CD and CS will stay same and wrong. Like when going from DV to HDR10 it stay at 8bit or 12bit 422 when DV-LL is used. CE do also perform a display reset on any SDR to HDR/DV or HDR/DV to SDR switch so the display can correct be setup.

The SDR to DV-Std or DV-LL and back does work properly now!

Not work.
DV to SDR and back working.
HDR10 to DV working, back to HDR10 not.
SDR to HDR10 working once, when first switching SDR to DV than not working anymore.

Thanks both for testing it.

Sorry, @Portisch, but I don’t have the time or the desire to work on VS10 anymore.
I won’t make any more changes unless someone submits a pull request.
If someone wants a change, they should contribute to it.

I can’t as I have no idea how to handle the web interface ot interlock the VS10 options.

You always need to return to SDR first before go to HDR10 or DV.

Tryed, not worked with this version.
The Github one works fine, without any other interaction.

I maintain a fork of TinyPPI for CE 21, so I’m fairly familiar with it. I took a crack at the changes @Portisch suggested. I think I’ve made progress, but I hit a roadblock.

I added the SDR-first interlock and display resets for both TV-LED and Player-LED. Returning to Original HDR10 now stops VS10 before resetting HDMI.

Tested on a Fire Cube 3 running CE 22 with SDR, HDR10 and DV Profile 8.1 content in both LED modes. HDR10 → SDR → DV → SDR → Original HDR10 now restores the original 10-bit 4:4:4 output.

What remains:

  • SDR → HDR10 can stay SDR, depending on the previous mode.

  • DV-LL → SDR can retain 12-bit 4:2:2.

@Portisch, the HDMI reset appears to select DV color attributes whenever the DV engine is enabled - even for SDR/HDR10 output. Resetting with the core stopped helped individual cases but broke another transition. Is there a recommended sequence here?

The attached build is a partial fix for testing. I also have dialog/PPI screenshots and HDMI readings for the failures.

Source: Commits · signde/script.tinyppi · GitHub

script.tinyppi-2.9.5+vs10.test2.zip (972.2 KB)

It’s just too time-consuming and too sensitive.
As I’ve already suggested, this would be the ultimate solution: TinyPPI - Universal PlayerProcessInfo for CE 22 - #270 by jamal2367

This could significantly reduce the amount of code in TinyPPI. Instead, there are several thousand lines of code just for this buggy and stupid sysfs/drm implementation, which doesn’t make much sense in an addon like this.

@signde
Thank you for your efforts. I’m glad you’re taking a look at the VS10 implementation.
Please make sure you don’t remove the native vs10 actions support, these are for SamuriHL’s his CE 22 build. SamuriHL doesn’t require sysfs/drm. Only Stock CE 22 needs this…

I’ll make sure to support the native actions too.

I found something in CE that may explain the remaining failures.

and

In meson_hdmitx_decide_color_attr(), both the color-space and bit-depth overrides check is_amdv_enable(). But VS10 can keep the DV engine enabled while outputting HDR10 or SDR, so a display reset can reapply DV attributes to non-DV output. The TV-LED 8-bit result can then cause HDR10 to fall back to SDR.

Would it make sense to use get_amdv_target_mode() in those two checks, skipping the DV overrides for AMDV_OUTPUT_MODE_HDR10, SDR10 and SDR8? That would let normal HDMI color selection run for those outputs while preserving the existing handling for DV and bypass.

This matches our observed failures, but I haven’t tested that kernel change.

I’ve submitted a PR that fixes the above issue.

Well, let’s hope this finally puts an end to the discussion about VS10. Thanks for your contribution so far. :sweat_smile:

Tested the patch and it works better. But can’t finish as DV is broken now. User setting is DV-Std it switch to 10bit 444. When user setting is DV-LL it switch to 8bit, RGB.

So there is now something else broken again in the addon I guess.

@Portisch
Have you tried it with this test version from here?