Learning about Dolby Vision and CoreELEC development

Hi @doppingkoala You were right,
However correcting it still gave wrong colours.


Or do you mean the file has to be 4k?

No the file doesn’t need to be 4k - only the display mode as your second photo shows. Can you confirm that you didn’t do any of the changes I talked about wrt to 1080p?

What you are seeing is what happens when the TV doesn’t go into DV mode. Get to the stage of your second photo where you have entered all three commands.

Can you then look at your TV at the same time as entering the last command

 echo DV_enable > /sys/devices/virtual/amhdmitx/amhdmitx0/attr

again and see if your TV responds in any way / briefly flicks to DV mode?

@xmlcom As a troubleshooting step also try playing rise_of_gru_sample_10bit_embedded.mkv and using the below commands to trigger DV.

echo N > /sys/module/amvideo/parameters/inject_osd_metadata
echo Y > /sys/module/am_vecm/parameters/DV_vsif_send_in_hdmi_packet
echo DV_enable > /sys/devices/virtual/amhdmitx/amhdmitx0/attr

Difference is this doesn’t use the on-the-fly metadata injection. Make sure you don’t have the gui up at all testing this file

Hi i tried again & checked if DV was activated quickly but no dice, do you need debug logs or anything.

It really would need to be looking at the tv at the same time as running the DV_enable command again.


I haven’t really added logging so that wouldn’t really help.

There is actually very little that can go wrong when using that file at the heavy lifting is really done when making it. Your photos also shows the all but one thing is working.

I’m wondering if there are some difference between tv’s as that test works for both my Sony TV and @Kaan’s Phillip TV. @xmlcom What tv are you using?

I have a suspicion about what to change. I’ll let you know when I have new build

@xmlcom Try this new build https://mega.nz/file/sQwFVJ7J#oCc_vwU1JaRQgAAnP5QOYXrh7h63Zsy8QhpGP8WWAnU


Start with testing the rise_of_gru_sample_10bit_embedded.mkv test. When playing and no gui, run

echo N > /sys/module/amvideo/parameters/inject_osd_metadata
echo Y > /sys/module/am_vecm/parameters/DV_vsif_send_in_hdmi_packet
echo DV_enable > /sys/devices/virtual/amhdmitx/amhdmitx0/attr
echo Y > /sys/module/am_vecm/parameters/always_send_tvled_DV_vsif

to enable DV. No need to look at the tv at the same time anymore.

Disable commands (if needed)

echo N > /sys/module/am_vecm/parameters/always_send_tvled_DV_vsif
echo N > /sys/module/am_vecm/parameters/DV_vsif_send_in_hdmi_packet
echo DV_disable_vsif > /sys/devices/virtual/amhdmitx/amhdmitx0/attr

To try the newer on-the-fly metadata embedding again with any video file.

Enable commands

echo Y > /sys/module/amvideo/parameters/inject_osd_metadata
echo Y > /sys/module/am_vecm/parameters/DV_vsif_send_in_hdmi_packet
echo DV_enable > /sys/devices/virtual/amhdmitx/amhdmitx0/attr
echo Y > /sys/module/am_vecm/parameters/always_send_tvled_DV_vsif

Disable commands (if needed)

echo N > /sys/module/am_vecm/parameters/always_send_tvled_DV_vsif
echo N > /sys/module/am_vecm/parameters/DV_vsif_send_in_hdmi_packet
echo DV_disable_vsif > /sys/devices/virtual/amhdmitx/amhdmitx0/attr
echo N > /sys/module/amvideo/parameters/inject_osd_metadata

If it doesn’t work post a dmesg log

1 Like

Thanks for your endeavour.
But unfortunately still same wrong colours no DV. My Tv is LG C6, is really old so might be that.
dmesg:
https://paste.coreelec.org/AltarSkates

Do you have tv-led DV working on that tv with another CoreELEC device?

Yes fire cube 2nd gen on CE

Play a video in tv-led mode on that. Then post the outputs of

cat /sys/kernel/debug/amhdmitx/hdmi_pkt

and

cat /sys/devices/virtual/amhdmitx/amhdmitx0/config

while it is running.

While your at it also cat /sys/devices/virtual/amhdmitx/amhdmitx0/dv_cap just to check the supported modes.

Hi keep getting permission denied, any ideas? Thanks

No idea, those are standard commands that just print info. For all of them? Restart?

Yes i tried that , will look into it, @Vasco any ideas? Thanks.

Try

 cat /sys/class/amhdmitx/amhdmitx0/rawedid

If the problem is what I suspect, the other commands are preferable for fixing it, but this should at least check my suspicion.

This the outcome.

00ffffffffffff001e6d010001010101011a010380a05a780aee91a3544c99260f5054a108003140454061407140818001010101010108e80030f2705a80b0588a0040846300001e023a801871382d40582c450040846300001e000000fd003a3e1e883c000a202020202020000000fc004c472054560a20202020202020019f020367f1586160101f0413051403021220212215015d5e5f6566626364293d06c015075009570778030c002000b83c20c08a010203040140fff028103810263667d85dc401788003e200cfe305c000e3060d01e40f030018ee0146d00024180900ad5244a9230c662150b051001b304070360040846300001e00000000000006

Ok. So that at least nails down the source of the issue. I’ve hardcoded sending a packet that assumes newer version of Dolby support, but your TV only supports an older version.

I made a typo :rofl:(dropped the last letter) in the previous command that would have caused your permission problem, post the output of

cat /sys/kernel/debug/amhdmitx/hdmi_pkt

when tv-led DV is working and I’ll add an option to send the packet that suits the older version that you have.

1 Like

Whoa massive data:

---HDMITX packets--------
--------parsing ACR--------
ACR.enable: enable
[0x10003206]: 0x4
ifsfactor: 64xFs
N: 4459
ncts_atomic_write: 1
CTS: 234428
CTS_manual: 0
N_shift: 1
actual N = audN[19:0]/N_shift
--------parsing AudSample--------
AudSample.enable: enable
[0x10003100]: 0x21
i2s_select: I2S
I2S_in_en: 0x1
[0x10003101]: 0x18
I2S_width: 24 bit
I2S_mode: standard
[0x10003103]: 0x0
HBR mode enable: 0
NLPCM mode enable: 0
[0x10003301]: 0x18
SPDIF_width: 24 bit
SPDIF_HBR_MODE: 0
SPDIF_NLPCM_MODE: 0
[0x10001063]: 0x0
layout: 0
sample flat: 0
[0x10001064]: 0x1
sample present: 1
[0x10001065]: 0x0
audio sample validity flag
channel 0/1/2/3, Left: 0/0/0/0
channel 0/1/2/3, Right: 0/0/0/0
[0x10001066]: 0x0
audio sample user flag
channel 0/1/2/3, Left: 0/0/0/0
channel 0/1/2/3, Right: 0/0/0/0
--------parsing GCP--------
GCP.enable: enable
[0x10001018]: 0x0
clear_avmute: 0
set_avmute: 0
default_phase: 0
[0x10000800]: 0x0
packing_phase: 0
[0x10000801]: 0x0
color_depth: 24bit
[0x10000803]: 0x0
YCC 422 size: 16bit
[0x10000804]: 0x46
output selector: 8bit bypass
bypass select: 1
YCC 422 enable: 0
pixel repeater enable: 0
pixel packing enable: 0
bypass enable: 1
[0x100010b7]: 0x7
datauto mode: auto
--------parsing VSIF--------
VSIF.enable: disable
[0x10001029]: 0x3
[0x1000102a]: 0x18
[0x1000102b]: 0x0
[0x1000102c]: 0x0
[0x1000102d]: 0x0
[0x1000102e]: 0x0
[0x1000102f]: 0x0
[0x10001030]: 0xc
[0x10001031]: 0x0
[0x10001032]: 0x20
[0x10001033]: 0x3
[0x10001034]: 0x0
[0x10001035]: 0x0
[0x10001036]: 0x0
[0x10001037]: 0x0
[0x10001038]: 0x0
[0x10001039]: 0x0
[0x1000103a]: 0x0
[0x1000103b]: 0x0
[0x1000103c]: 0x0
[0x1000103d]: 0x0
[0x1000103e]: 0x0
[0x1000103f]: 0x0
[0x10001040]: 0x0
[0x10001041]: 0x0
[0x10001042]: 0x0
[0x10001043]: 0x0
[0x10001044]: 0x0
[0x10001045]: 0x0
[0x10001046]: 0x0
[0x10001047]: 0x0
[0x10001048]: 0x0
[0x10001049]: 0x0
size: 24
ieee_id: 0xc03
HDMI 4K hdmitx_parsing_vsifpkt[1303]
vic: 0x3
--------parsing AVIInfo--------
AVIInfo.enable: enable
[0x10001019]: 0x40
colorspace: RGB
active_format_present: enable
bar: disable
scan: disable
[0x1000101a]: 0xe8
colorimetry: Extended
picture_aspect: 16:9
active_aspect: Same as picture_aspect
[0x1000101b]: 0x68
itc: disable
extended_colorimetriy: BT.2020
quantization_range: full
nups: unknown
[0x1000101c]: 0x0
vic: 0
[0x10001017]: 0x0
ycc_quantization_range: limited
content_type: graphics
[0x100010e0]: 0x10
pixel_repetition: no
[0x100010b7]: 0x7
datauto: RDRB
[0x100010be]: 0x0
rdrb_interpolation: 0
[0x100010bf]: 0x1a
rdrb_perframe: 1
rdrb_linespace: 10
--------parsing SPDInfo--------
SPDInfo.enable: enable
[0x1000104a]: 0x41
[0x1000104b]: 0x6d
[0x1000104c]: 0x6c
[0x1000104d]: 0x6f
[0x1000104e]: 0x67
[0x1000104f]: 0x69
[0x10001050]: 0x63
[0x10001051]: 0x0
[0x10001052]: 0x4d
[0x10001053]: 0x42
[0x10001054]: 0x6f
[0x10001055]: 0x78
[0x10001056]: 0x20
[0x10001057]: 0x4d
[0x10001058]: 0x65
[0x10001059]: 0x73
[0x1000105a]: 0x6f
[0x1000105b]: 0x6e
[0x1000105c]: 0x20
[0x1000105d]: 0x52
[0x1000105e]: 0x65
[0x1000105f]: 0x66
[0x10001060]: 0x0
[0x10001061]: 0x0
[0x10001062]: 0x1
vendor name: Amlogic
product description: MBox Meson Ref
--------parsing AudioInfo--------
AudioInfo.enable: enable
[0x10001025]: 0x10
coding_type: refer to stream header
channel_count: 2 channels
[0x10001026]: 0x0
sample_frequency: refer to stream header
sample_size: refer to stream header
[0x10001027]: 0x0
channel_allocation: 0
[0x10001028]: 0x0
level_shift_value: 0
down_mix_enable: 0
LFE_playback_info: 0
[0x100010b7]: 0x7
datauto: auto
--------parsing AudChannelSt--------
[0x10001067]: 0x0
iec_copyright: 0
iec_cgmsa: 0
[0x10001068]: 0x0
iec_categorycode: 0
[0x10001069]: 0x0
iec_sourcenumber: 0
iec_pcmaudiomode: 0
[0x1000106a]: 0x42
iec_channelnumcr0: 2
iec_channelnumcr1: 4
iec_channelnumcr2: 6
iec_channelnumcr3: 8
[0x1000106c]: 0x31
iec_channelnumcl0: 1
iec_channelnumcl1: 3
[0x1000106d]: 0x75
iec_channelnumcl2: 5
iec_channelnumcl3: 7
[0x1000106e]: 0x0
iec_sampfreq: 44.1kHz
iec_clk: 0
iec_sampfreq_ext: 0
[0x1000106f]: 0xfb
iec_worldlength: 24bit
iec_origsamplefreq: 44.1kHz
--------parsing DRM/HDR--------
hdr_transfer_feature: 0x1
hdmi_current_hdr_mode: 0x0
hdmi_last_hdr_mode: 0x0
DRM.enable: disable
[0x10001168]: 0x0
version: 0
[0x10001169]: 0x0
size: 0
[0x1000116a]: 0x0
eotf: sdr
[0x1000116b]: 0x0
metadata_id: static metadata
primaries:
0, 0,
0, 0,
0, 0,
white_point: 0, 0,
luminance: 0, 0,
max_content: 0
max_frame_average: 0
1 Like

@xmlcom Try this build 248.12 MB file on MEGA

You will need to need to make sure the display mode matches that the data you posted, so 2160p 24Hz. So the 60Hz video you tried earlier won’t work.

After it boots, enter

 echo 0 > /sys/module/amvideo/parameters/toggle_metadata_count_limit

Then try instructions from Learning about Dolby Vision and CoreELEC development - #220 by doppingkoala.


Let me know if your tv goes into DV mode using the rise of gru sample I posted, if it doesn’t post outputs of each of

cat /sys/kernel/debug/amhdmitx/hdmi_pkt
cat /sys/devices/virtual/amhdmitx/amhdmitx0/config
cat /sys/devices/virtual/amhdmitx/amhdmitx0/dv_cap

and a dmesg log.


If that sample video works, but the second lot of commands that embed data on the fly don’t, I will explain some trial-and-error testing you will need to do that should get it going.


Either way, let me know the results of both the approaches.

1 Like

You are a genius, yes the gru sample works, for 2nd on any video, DV is activated but black screen with audio only, Thanks again ,i don’t how you achieve this but is insane to think this is possible.

1 Like

Great. Making progress.

Interesting differences in TV’s, when I have a problem with osd injection approach I get a picture but to DV mode.

So in the second approach, data is being injected into the osd layer, but before it goes through a color space conversion. I guessing this is slightly different (i.e., not bit identical) on your S922X-H chip compared to my S905X3 rev B. So we will need to find values for you to embed, such that, the values after the color space conversion are what is needed.

This problem is really why using the second gui layer over the top of the first, but without a color space conversion would be better. It would avoid this problem, but I haven’t worked out how to do it (yet).


Anyway, onto to the trial and error search to find numbers that work for you. Different values to embed can be controlled with /sys/module/amvideo/parameters/random_data_count. Can read with

cat /sys/module/amvideo/parameters/random_data_count

and write with, for example a value of 0, by

echo 0 > /sys/module/amvideo/parameters/random_data_count

valid values to use are are 0-255.

You will need to get to the stage for the 2nd approach you were at before and then test values until tv-led DV it starts working properly with a picture.


To make this process easier, enter

echo 0 > /sys/module/amvideo/parameters/random_data_count
echo 125 > /sys/module/amvideo/parameters/toggle_metadata_count_limit

and the value will increment from 0 automatically every ~5 seconds. Sit and watch you TV until DV mode works, you can check progress by reading random_data_count (command as above, at any time). As soon as a picture shows up with DV mode, do

cat /sys/module/amvideo/parameters/random_data_count

and a value will print out. By the time you do this, the value will probably have already changed (and the DV stopped working on your tv). So disable the auto increment with

echo 0 > /sys/module/amvideo/parameters/toggle_metadata_count_limit

From there, just manually work backwards from the value that was printed until tv-led DV starts working again using the commands to read/write to random_data_count at the top of the post, i.e., if 50 was printed try 50, 49,48, … So commands would be

echo 50 > /sys/module/amvideo/parameters/random_data_count

and so on.

Good luck.

This process may take some time, when I was playing around to get 10-bit mode working as well I got no results until about 60, so it may take you a while …

If you do find a value that works be sure to post it to save others with the same device the effort.

And thanks for all your testing

1 Like