Slow down of Hyperion.ng

#151

Unfortunately, I faced frame jumps and following slow down with ge2d too about hour ago :frowning:

#152

Here is the latest version including the latest commits for the Hyperion patch. Also the latest binary is included. With this binary you can choose your preferred amlogic grabber. This version will not fix the “slow down” issue for 100% but it is a start…



Take a look to the pull request to find the new parameters “amlogic_grabber” and “ge2d_mode”.

Compiled images and binary:
[S912/S905 Image and addon]

4 Likes
#153

Thanks for your hard work @Portisch :slight_smile:

#154

I am not 100% shure if I do things right - i´ve read your advices on github but I still have to ask how to use the new “single ioctl call method”:

  • I have to choose “amlogic” as Type (as before)
  • and put “/dev/ge2d_mode” as device
    right?
#155

amlogic_grabber: amvideocap0 or ge2d
ge2d_mode: 0 or 1 (only for ge2d grabber)

"framegrabber": {
    "amlogic_grabber": "amvideocap0/ge2d",
    "ge2d_mode": 0/1
},

Another hint:

mount -o rw,remount /flash && fdtput -t i /flash/dtb.img /amvideocap max_size 64 && sync && reboot

Open a SSH connection and enter this command. The default value is 8 (8MB) and this command will change it to 64MB. I did not have any slowdown yet after 1-2h.

You will need to execute the above again if you apply an update ie nightly.

EDIT: Increase the buffer by the hint does not solve the problem. I still have some modifications on the kernel what are getting tested right now. So please wait…

2 Likes
S912+Hyperion.ng: Strange RGB order switching between video and menu
#156

Another try what I am right now testing: change the freerun_mode. I think it doesn’t matter if amvideocap or ge2d is used. I did not see any slow down yet with a value of 3.

Read the parameter:
cat /sys/module/amlvideodri/parameters/freerun_mode

Set the parameter to 3:
echo “3” > /sys/module/amlvideodri/parameters/freerun_mode

Remember: after a power down or reboot you have to set the parameter again.

1 Like
#157

I just checked my KIII Pro S912 with your build from this thread - CoreELEC (community): devel-1547795802 (S912.arm)

And after executing : cat /sys/module/amlvideodri/parameters/freerun_mode i get 3

I haven’t modified the freerun_mode in any way so this means that 3 was always the default value for me.

The only thing I added to my autostart is :

echo 3 | tee /sys/module/amvdec_h265/parameters/double_write_mode

I did it to fix the hyperion with 4K H265 content.

Unfortunately I still get the slowdowns occasionally.

#158

Hmmm, you are right. The default value is ‘3’…

#159

I found another hardcoded frame buffer in the source. I increased it from 16MB to 64MB and got no slow down yet. You will get slow downs when you have video running and handling the OSD. But no slow down when only video get played.

[Images.tar]

It is right now a modified 8.95.7. Tomorrow I will add more versions.

EDIT:
Added S905/S912 image to Mega.nz: State of the image: https://github.com/CoreELEC/CoreELEC/tree/da286d043054e10c844c18fb8d433cb31df9e1d3
Ay you try amvideocap0 as grabber as I did not get any slow down after 4h.

3 Likes
#160

Ive managed to get your framegrabber-thing running:
amlogic_grabber: amvideocap0 or ge2d
ge2d_mode: 0 or 1 (only for ge2d grabber)

"framegrabber": {
    "amlogic_grabber": "amvideocap0/ge2d",
    "ge2d_mode": 0/1
},

what do we have to install to test your latest fixes?
just update via .tar and update hyperion? what about the config? back to “default” or shall i try it with the grabber above?

#161

To try ge2d you can use the .1 version from repository. amvideocap0 is the default. So if you want to use ge2d you have to modify the hyperion.json.config.

For the slow down you can use my compiled images.tar and update the system as normal.

#162

My original config file looks like this:

	"framegrabber": {
		"cropBottom": 0,
		"cropLeft": 0,
		"cropRight": 0,
		"cropTop": 0,
		"device": "/dev/ge2d",
		"enable": true,
		"frequency_Hz": 10,
		"height": 45,
		"horizontalPixelDecimation": 8,
		"priority": 250,
		"type": "amlogic",
		"useXGetImage": false,
		"verticalPixelDecimation": 8,
		"width": 80
	},

I’m a bit confused here: do I need to insert the above two value (amlogic_grabber, ge2d_mode) here, replace some lines with the two, or remove all the lines and insert only the two?

#163

Did any of your fixes work in the end? This crap got even worse in Kodi 18 - Leia. I’m now getting like 3-4 slodowns during an episode of Game Of Thrones.

#164

I never have seen an slow down since upgrade to 8.99.2.
Addon from repository, 9.0.100.1, amvideocap0 used.

#165

Hmmm, can anyone else confirm this? I’m currently on Librelec on my hyperion box, but will switch to Corelec if there are no slowdowns.

#166

I still get the slowdowns on S912 and latest CE 8.99.2 + Hyperion.ng from repo.

#167

Do you mean that You used type amlogic and device /dev/amvideocap0 ?
Give us more details.

#168

I played around and installed Boblight from the official repository, uploaded my sketch on Arduino (controlling lights) and it works. I didn’t notice any slowdowns either, though I can’t say for sure there wouldn’t be any in the long run.

The problem however is that performance of Boblight is way worse than Hyperion. While Hyperion provides super smooth transitions and uses less cpu, Boblight looks choppy/flickery and uses more cpu. The choppiness of transitions bothered me so much, I went back to Hyperion.

So it might be there’s indeed something in Hyperion that doesn’t play well with amlogic. I’m rooting and really hoping someone knowledgeable and smart enough figures this out as Hyperion is just perfect except for the bloody slowdowns.

#169

I still testing new things.
I getting slow downs on h264 material so I modified the codec for h264 and right now I am testing the modifications. But I am sure the slow downs are related to the Linux kernel.
Something is wrong in driver/amlogic/video_dev/amlogic.c or driver/amlogic/amports/vh264.c

Here a log. You see a long time nothing, than it is starting vidio qbuf skip:

[ 2206.118035@0] codec:invalid h264pts1, reset
[ 2296.354837@0] vidioc_qbuf skip: index:110835:110834
[ 2296.390041@0] vidioc_qbuf skip: index:110838:110837
[ 2296.428950@0] vidioc_qbuf skip: index:110841:110840
[ 2296.467746@0] vidioc_qbuf skip: index:110844:110843
[ 2296.507704@0] vidioc_qbuf skip: index:110848:110847
[ 2296.548036@0] vidioc_qbuf skip: index:110852:110851
[ 2296.588300@0] vidioc_qbuf skip: index:110855:110854
[ 2296.628007@0] vidioc_qbuf skip: index:110859:110858
[ 2296.660833@0] vidioc_qbuf skip: index:110863:110862
[ 2296.681001@0] vidioc_qbuf skip: index:110867:110866
[ 2296.701094@0] vidioc_qbuf skip: index:110869:110868
[ 2296.720929@0] vidioc_qbuf skip: index:110872:110871
[ 2296.740927@0] vidioc_qbuf skip: index:110875:110874
[ 2297.084939@0] vidioc_qbuf skip: index:110890:110889
[ 2297.128282@0] vidioc_qbuf skip: index:110892:110891
[ 2297.167801@0] vidioc_qbuf skip: index:110896:110895
[ 2297.287558@0] vidioc_qbuf skip: index:110900:110899
[ 2297.327866@0] vidioc_qbuf skip: index:110902:110901
[ 2297.368717@7] vidioc_qbuf skip: index:110905:110904
[ 2297.408407@5] vidioc_qbuf skip: index:110908:110907
[ 2297.527909@0] vidioc_qbuf skip: index:110912:110911
[ 2297.567669@0] vidioc_qbuf skip: index:110914:110913
[ 2297.607656@0] vidioc_qbuf skip: index:110917:110916
[ 2297.637998@0] vidioc_qbuf skip: index:110920:110919
[ 2297.672721@7] codec:video_blackout_policy_store(0)
[ 2297.672780@7] [tsync_avevent]event:1, param 1
[ 2297.672782@7] video pause!
[ 2297.680988@4] DI: di_receiver_event_fun , is_bypass() 1 trick_mode 0 bypass_all 0
[ 2297.680990@4] di_receiver_event_fun: vf_notify_receiver unreg
[ 2297.681004@7] DI: di_unreg_process unreg start 1.
[ 2297.681017@7] codec_mm:NULL mem_handle for keeper!!
[ 2297.688970@7] codec:alloced keep buffer yaddr=0000000068200000,u_addr=0000000067700000,v_addr=0000000067800000
[ 2297.688978@7] codec:vf_keep_current keep_y_addr=0000000068200000 65cae800
[ 2297.688983@7] codec:ge2d_store_frame_NV21 cur_index:s:0x626160
[ 2297.688990@7] codec:ge2d_store_frame d:0xd9d8
[ 2297.692499@7] codec:vf_keep_current: VIDTYPE_VIU_NV21
[ 2297.692501@7] codec:vf_keep_current: keep video on with keep
[ 2297.692507@7] [tsync_avevent]event:2, param 0
[ 2297.692512@7] codec:video first pts = 0
[ 2297.692528@7] DI: di_unreg_process vf unreg cost 10 ms.
[ 2297.692531@7] DI: di_unreg_process unreg stop 0.
[ 2297.701110@7] codec:vdec1 video changed to 0 x 0 0 fps clk->200MHZ
[ 2297.702171@7] codec:vdec_create instance ffffff8004948000, total 1
[ 2297.702226@7] codec:Video stbuf alloced at 0000000063700000, size = 10485760
[ 2297.702241@7] codec:vdec_init, dev_name:amvdec_h264, vdec_type=VDEC_TYPE_SINGLE
[ 2297.702247@7] codec:vdec_init set vfm decoder ffffff8004948000
[ 2297.702253@7] codec:vdec_dev_reg.mem[0x64100000 -- 0x670fffff]
[ 2297.703531@7] codec:H264 sysinfo: 1280x720 duration=1920, pts_outside=1,
[ 2297.704236@7] codec:vdec_request_irq ffffffc001547df8, vh264-irq
[ 2297.704281@7] DI: di_receiver_event_fun: vframe provider reg
[ 2297.714331@7] set run_early_proc_fun_flag to 1
[ 2297.714540@7] codec:vdec_init, vf_provider_name =
[ 2297.715047@7] codec:video first pts = 0
[ 2297.715059@7] codec:vdec_request_irq ffffffc001538900, parser
[ 2297.722660@7] codec:video_blackout_policy_store(1)
[ 2298.128526@0] aml_spdif_dai: aiu 958 playback disable
[ 2298.128589@7] aml_spdif_dai: aml_hw_iec958_init,runtime->rate=48000, runtime->channels=2, same source mode(0)
[ 2298.128610@7] aml_spdif_dai: set normal 512 fs /4 fs
[ 2298.128619@7] aml_audio_hw: IEC958 16bit
[ 2298.128624@7] hdmitx: audio: aout notify rate 48000
[ 2298.128626@7] hdmitx: audio: aout notify size 16
[ 2298.128628@7] hdmitx: audio: no update
[ 2299.318500@4] codec:DisableVideoLayer()
[ 2299.331083@4] DI: di_receiver_event_fun , is_bypass() 0 trick_mode 0 bypass_all 0
[ 2299.331085@4] di_receiver_event_fun: vf_notify_receiver unreg
[ 2299.331098@7] DI: di_unreg_process unreg start 1.
[ 2299.331108@7] codec:DisableVideoLayer()
[ 2299.331110@7] codec:disbled keep video before free keep buffer.
[ 2299.331112@7] codec:disbled video for next before free keep buffer!
[ 2299.331113@7] codec:DisableVideoLayer()
[ 2299.331117@7] codec:free_alloced_keep_buffer 0000000068200000.0000000067700000.0000000067800000
[ 2299.331461@7] codec:free_alloced_keep_buffer           (null).          (null).          (null)
[ 2299.331464@7] [tsync_avevent]event:2, param 0
[ 2299.331469@7] codec:video first pts = 0
[ 2299.331478@7] DI: di_unreg_process vf unreg cost 0 ms.
[ 2299.331481@7] DI: di_unreg_process unreg stop 0.
[ 2299.334035@0] codec:VsyncDisableVideoLayer
[ 2299.334037@0] codec:AFBC off now.
[ 2299.341589@6] codec:video_disable_store(1)
[ 2299.341604@6] codec:DisableVideoLayer()
[ 2299.341612@6] codec:free_alloced_keep_buffer           (null).          (null).          (null)
[ 2299.341665@6] vfm_map_store:rm default
[ 2299.341704@6] vfm_map_store:add default  decoder ppmgr deinterlace amvideo
[ 2299.354043@0] codec:VsyncDisableVideoLayer
[ 2299.354046@0] codec:AFBC off now.
[ 2300.157031@1] vfm_map_store:rm default
[ 2300.157073@1] vfm_map_store:add default decoder ppmgr deinterlace amlvideo amvideo
[ 2300.157323@1] codec:vdec_create instance ffffff8004979000, total 1
[ 2300.157366@1] codec:Video stbuf alloced at 0000000063700000, size = 10485760
[ 2300.157381@1] codec:vdec_init, dev_name:amvdec_h264, vdec_type=VDEC_TYPE_SINGLE
[ 2300.157387@1] codec:vdec_init set vfm decoder ffffff8004979000
[ 2300.157392@1] codec:vdec_dev_reg.mem[0x0 -- 0x0]
[ 2300.157401@1] codec:vdec base memory alloced [0000000064100000 -- 00000000670fffff]
[ 2300.159321@1] codec:H264 sysinfo: 1440x1080 duration=1920, pts_outside=1,
[ 2300.159900@1] codec:vdec_request_irq ffffffc001547df8, vh264-irq
[ 2300.159939@1] DI: di_receiver_event_fun: vframe provider reg
[ 2300.169983@1] set run_early_proc_fun_flag to 1
[ 2300.170200@1] codec:vdec_init, vf_provider_name =
[ 2300.170689@1] codec:video first pts = 0
[ 2300.170700@1] codec:vdec_request_irq ffffffc001538900, parser
[ 2300.178528@1] [tsync_avevent]event:1, param 1
[ 2300.178531@1] video pause!
[ 2300.179160@1] codec:video_freerun_mode_store(1)
[ 2300.179403@1] codec:video first checkin pts = 3a4e
[ 2300.179405@1] codec:first check in vpts <0x30:0x3a4e> ok!
[ 2300.179569@0] codec:Enter set parameter cmd1.
[ 2300.179602@0] codec:vdec1 video changed to 3840 x 2160 60 fps clk->667MHZ
[ 2300.179607@0] codec:actual_dpb_size 20 max_dpb_size 3
[ 2300.179663@0] codec:start alloc for 19
[ 2300.182152@0] codec:CMA malloc ok  19
[ 2300.182197@0] codec:video first pts = 3a4e
[ 2300.611035@0] pre_de_buf_config: source change: 0x0/0/0/0=>0x8009/1440/1080/0
[ 2300.701580@6] codec:video_disable_store(0)
[ 2300.714054@0] vpts to scr, apts = 0x0, vpts = 0x3a4e
[ 2300.714088@0] codec:[video4osd] first  picture {1440,1080} pts:485e,
[ 2300.729505@7] aml_spdif_dai: aiu 958 playback enable
[ 2300.734160@0] codec:VsyncEnableVideoLayer
[ 2302.314094@0] codec:[video4osd] first  picture {1440,1080} pts:0,
[ 2302.334192@0] codec:VsyncEnableVideoLayer
[ 2302.573540@0] codec:restart correct frame duration
[ 2302.573541@0] codec:new=3840,old_duration=1920,cnt=25
[ 2303.593661@0] codec:restart correct frame duration
[ 2303.593677@0] codec:new=3840,old_duration=1920,cnt=25
[ 2304.553681@0] codec:finished correct frame dur
[ 2304.553698@0] codec: new=3840,old_duration=3840,cnt=25
[ 2334.595570@0] codec:invalid h264pts1, reset
[ 2997.134475@4] codec:video_blackout_policy_store(0)
[ 2997.134547@4] [tsync_avevent]event:1, param 1
[ 2997.134554@4] video pause!
[ 2997.154528@4] DI: di_receiver_event_fun , is_bypass() 0 trick_mode 0 bypass_all 0
[ 2997.154540@4] di_receiver_event_fun: vf_notify_receiver unreg
[ 2997.164208@5] DI: di_unreg_process unreg start 1.
[ 2997.164237@5] codec:keep exit is di
[ 2997.164244@5] [tsync_avevent]event:2, param 0
[ 2997.164250@5] codec:video first pts = 0
[ 2997.164263@5] DI: di_unreg_process vf unreg cost 0 ms.
[ 2997.164268@5] DI: di_unreg_process unreg stop 0.
[ 2997.164289@0] di_uninit_buf keep cur di_buf 11 (4 8 2)
[ 2997.164783@5] codec:vdec1 video changed to 0 x 0 0 fps clk->200MHZ
[ 2997.165212@5] codec:vdec_create instance ffffff80049aa000, total 1
[ 2997.165264@5] codec:Video stbuf alloced at 0000000063700000, size = 10485760
[ 2997.165279@5] codec:vdec_init, dev_name:amvdec_h264, vdec_type=VDEC_TYPE_SINGLE
[ 2997.165284@5] codec:vdec_init set vfm decoder ffffff80049aa000
[ 2997.165291@5] codec:vdec_dev_reg.mem[0x64100000 -- 0x670fffff]
[ 2997.167367@5] codec:H264 sysinfo: 1440x1080 duration=1920, pts_outside=1,
[ 2997.167735@5] codec:vdec_request_irq ffffffc001547df8, vh264-irq
[ 2997.167772@5] DI: di_receiver_event_fun: vframe provider reg
[ 2997.177828@5] set run_early_proc_fun_flag to 1
[ 2997.178024@5] codec:vdec_init, vf_provider_name =
[ 2997.178542@5] codec:video first pts = 0
[ 2997.178552@5] codec:vdec_request_irq ffffffc001538900, parser
[ 2997.179511@5] codec:video_blackout_policy_store(1)
[ 2997.227324@5] codec:video first checkin pts = 3bcb28e
[ 2997.227337@5] codec:first check in vpts <0x30:0x3bcb28e> ok!
[ 2997.227593@0] codec:Enter set parameter cmd1.
[ 2997.227740@0] codec:vdec1 video changed to 3840 x 2160 60 fps clk->667MHZ
[ 2997.227752@0] codec:actual_dpb_size 20 max_dpb_size 3
[ 2997.227822@0] codec:start alloc for 19
[ 2997.230214@0] codec:CMA malloc ok  19
[ 2997.230297@0] codec:video first pts = 3bcb28e
[ 2997.284337@0] pre_de_buf_config: source change: 0x0/0/0/0=>0x8009/1440/1080/0
[ 2997.354301@0] vpts to scr, apts = 0x0, vpts = 0x3bcb28e
[ 2997.354352@0] codec:[video4osd] first  picture {1440,1080} pts:3bcc09e,
[ 2997.374371@0] codec:VsyncEnableVideoLayer
[ 2997.580793@0] aml_spdif_dai: aiu 958 playback disable
[ 2997.580865@7] aml_spdif_dai: aml_hw_iec958_init,runtime->rate=48000, runtime->channels=2, same source mode(0)
[ 2997.580894@7] aml_spdif_dai: set normal 512 fs /4 fs
[ 2997.580905@7] aml_audio_hw: IEC958 16bit
[ 2997.580914@7] hdmitx: audio: aout notify rate 48000
[ 2997.580919@7] hdmitx: audio: aout notify size 16
[ 2997.580923@7] hdmitx: audio: no update
[ 2997.581142@5] aml_spdif_dai: aiu 958 playback enable
[ 2999.714294@0] DI: recycle_keep_buffer recycle keep cur di_buf 11 (
[ 2999.714307@0] DI:  4 DI:  8
[ 2999.714320@0] DI:  2 <7>[ 2999.714324@0] DI: )
[ 2999.926891@0] codec:restart correct frame duration
[ 2999.926907@0] codec:new=3840,old_duration=1920,cnt=25
[ 3000.926875@0] codec:restart correct frame duration
[ 3000.926891@0] codec:new=3840,old_duration=1920,cnt=25
[ 3001.966863@0] codec:finished correct frame dur
[ 3001.966880@0] codec: new=3840,old_duration=3840,cnt=25
[ 3012.767059@0] codec:invalid h264pts1, reset
1 Like
#170

Does the qbuf skip start when the slowdown occurs?

Still it makes me wonder why Boblight on the same linux kernel wouldn’t cause slowdowns…