Compiling and debugging

Hello,

Sorry if it was already asked, but I didn’t find when doing a search.

I would like to know the best way to debug code in real-time (is this possible ?) like we can do when attaching VS2022 to C# solution for ex.

If not possible, the best way will be to adding logs to know what happens.

So I would like to understand why refresh rate is triggered on CE-NG when it’s the same FPS, this is ma y goal to try to follow why it happens mostly when doing DV to HDR etc.

I don’t want that the DEV to look on this specific issue, but I would like to try to look myself, but I’m not sure how did dev to do that the most efficacy.

When I disable DRC, it’s OK when enable it is not, so would like to find why :slight_smile:

I think it’s on the Kodi side but not sure, it seems that is I add log into kodi code, I just need to create a patch to copy into /projets/Amlogic/patches/Kodi

After that what is the best way to test if we can do it in live, need to create a tar and make an update ?

Thanks for any help on this.

What about the I think its called DMESG that CE creates.

Turn on debugging in kodi settings , in CE settings there is a tab to create a link you can open or post up here for the mods to read?

Thanks bazzle for your idea, it’s not really what I want but really nice to you to have take to answer me.

I can grab log from an SSH (WinSCP) to read kodi.log, I think for starting is enough.

My question is, how to correctly debug the code (adding logs seems to be the one to do) ?

But maybe it’s possible to do differently, I’m not sure if it’s possible to change code in live or debug the Kodi code step by step and look where it lies and try something to fix (the next step).

For now, I will try to apply a patch where I have added code to look to what the code does.
Happy to already be able to debug step by step windows Kodi, to already try to follow what happen but I need to reproduce on CE after.

Ok, maybe you are using GDB ?

Still I didn’t figure out after building from source, when I change something in code, with another build command, it keeps building the older code, it seems that there are some cache files somewhere to reinit to take the new code compiling.

Yes, very clear to make any useful comment.
If you change something in package.mk or something in package folder then everything is rebuild. And if you change something directly in build folder then again it will be rebuild if it needs to be.

I did add a patch in package folder, and the rebuild didn’t do anything new.
Maybe I didn’t use the correct command.

What I did :

Copy a patch here : CoreELEC/packages/mediacenter/kodi/patches

Start : DEVICE=Amlogic-ng make

But no change was done, it builds old code

Do I miss something ?

Thanks

Of course it was not picked if you put it in wrong folder.
Should be projects/Amlogic-ce/packages/mediacenter/kodi/patches or projects/Amlogic-ce/patches/kodi.

1 Like

Great thanks, putting there : projects/Amlogic-ce/patches/kodi.

And it uses the patch, I will try to debug now :slight_smile:

Hello :slight_smile:

I’m debugging an issue about DV that trigger an RRC (Refresh Rate Changer) when changing to a non DV video (HDR or SDR for ex).

I’m hoping it’s the right section of the forum, it’s related to Kodi but also for development :wink:

So :
When RRC is disabled, there is no RRC and no blank screen.

When RRC is enabled, even if the movie matches the same resolution and FPS and with DV it triggers an RRC where it should not (when going to DV to HDR or HDR to DV for ex)

I have found the part of code where changing it permit to avoid that, but it’s not a solution at 100% because, it will surely create regression.

It’s the commit (based on CE-NG) and I will test against CE-NO :

Revision: f83b4eb8e3aaa2c9868f0ba83d3adf3fd65ae554
Author: Portisch
Date: 12/03/2024 19:44:29
Message:
Rework Kodi force switch algorithms.
Forced mode switch detection by cd/cs is not 100% reliable.

Because of Dolby Vision it is possible resolution and frequency do not change.
But if colour subsampling or colour depth is changed a forced mode switch is required.
Force mode switch by set mode 'null'.
In special cases a hard mode reset is needed like 4k420 to 4kDV.
----
Modified: xbmc/cores/VideoPlayer/VideoRenderers/RenderManager.cpp
Modified: xbmc/windowing/GraphicContext.h
Modified: xbmc/windowing/amlogic/WinSystemAmlogicGLESContext.cpp
Modified: xbmc/windowing/amlogic/WinSystemAmlogicGLESContext.h

When I set “force_mode_switch_by_dv “ to false by changing the code, it’s ok :

C++:
  StreamHdrType hdrType = CServiceBroker::GetWinSystem()->GetGfxContext().GetHDRType();
  bool force_mode_switch_by_dv = false;
  if ((m_hdrType == StreamHdrType::HDR_TYPE_DOLBYVISION && hdrType != StreamHdrType::HDR_TYPE_DOLBYVISION) ||
      (m_hdrType != StreamHdrType::HDR_TYPE_DOLBYVISION && hdrType == StreamHdrType::HDR_TYPE_DOLBYVISION))
      force_mode_switch_by_dv = true;

to
      
  StreamHdrType hdrType = CServiceBroker::GetWinSystem()->GetGfxContext().GetHDRType();
  bool force_mode_switch_by_dv = false;
  if ((m_hdrType == StreamHdrType::HDR_TYPE_DOLBYVISION && hdrType != StreamHdrType::HDR_TYPE_DOLBYVISION) ||
      (m_hdrType != StreamHdrType::HDR_TYPE_DOLBYVISION && hdrType == StreamHdrType::HDR_TYPE_DOLBYVISION))
      force_mode_switch_by_dv = false;

It permits to not start RRC only when resolution and FPS match.
I think the root of this issue is because, when create a new DV window, somehow, the resolution and fps are lost, and the RRC is triggered.

It could be nice to polish the code to store current/previous value and restore it when the new window is created, this permit to avoid this, like this, RRC test the resolution and fps against it and don’t need to trigger the refresh.

I’m not sure if I’m clear on this :slight_smile:

It’s hard for me to test the code entirely, I was able to pin to that part and confirm that it’s related when testing on CE-NG, but don’t know how to debug it at 100% with some improvement.

So DV to DV movie, is OK, RRC not trigger (when same FPS), but DV to HDR/SDR or HDR/SDR to DV will trigger RRC (for same resolution and FPS).

If the FPS is different, it’s logic to do the RRC of course but not when it’s the same.

Thank you :slight_smile:

Your change will break the DV mechanism at all.

The mode change is not wrong, it’s need to correct trigger DV on a DV capable screen. It will not happen when using Samsung because it does not support DV at all. But when you fake the EDID like by using a Vertex it correct will trigger a mode change, even when it’s not need.

You just don’t see it on Android because the gui is already in DV so this DV trigger is not need. But this you could have checked already on the Vertex by yourself…

Change your setup to get a DV capable chain and don’t cheat and fake everything possible on every end. Thousands other users can tell you it just works how it should be.

Thank you for taking the time to answer me :flexed_biceps:

I will redo my testing on DV capable device like with my Hisense TV because I have seen the same (if I’m not wrong) and this is not on Samsung or Epson and like you give me another doubt, I need to confirming it.

When I have tested on DV capable device, it was done without Vertex2 in the chain, I don’t want to fake everything possible, but you are agreed that, if a refresh rate is triggered when it shouldn’t for the same resolution and same FPS, this is wrong right ? (even if it’s fast on TV DV capable device, but what about DV capable projector with a long delay ?)

Just to be sure that we understand together, 2 movies with the same resolution and FPS (but DV for one and HDR for the other):

  • When RRC is disabled, the trigger DV on a DV capable screen works without create a blank screen.
  • When RRC is enabled, the blank screen happens somehow.

I think, it’s because when DV trigger is started, the screen size or FPS quickly goes to “0” or something equivalent and back to the correct information, but in between, RRC was triggered somehow.

But I will redo my testing again on DV capable screen again :wink: because, you are right, doing this on no capable DV screen it not the best of course.

Some feedback :
I have done a fresh installation on CE-NO (dovi.ko, etc.) (I will test against CE-NG later).

All my testing are done on a capable DV screen (Hisense 55” DV), I will post log too in a next post, (I was on “info” type).

DV settings as following :
Dolby Vision Led mode : TV-Led (need to test as Player-Led) and nothing else checked.

  • With RRC enabled :

    • Playing DV movie (Dolby Vision Logo on screen) and all ok and playing another DV movie, no RRC and logo and all OK.
    • Playing HDR trigger RRC (blank screen, HDMI disconnected message and back) even if video resolution and FPS are the same has the DV movie.
  • With RRC disabled :

    • Playing DV lead to black screen and I can hear the sound fast or back forward does nothing.
    • Playing HDR/SDR is OK (and no RRC trigger, that’s logic)

Restarting OS or Kodi and doing the same sequences give the same.

Edit Logs :
RRC Disabled :
CoreELEC:~ # systemctl status kodi -l | paste

https://paste.coreelec.org/ShootAires

CoreELEC:~ # paste /storage/.kodi/temp/kodi.log

https://paste.coreelec.org/SuckingDress

RRC Enabled :
CoreELEC:~ # systemctl status kodi -l | paste

https://paste.coreelec.org/AddingTrial

CoreELEC:~ # paste /storage/.kodi/temp/kodi.log

https://paste.coreelec.org/SwimmingMemory

Still, this is a different issue, but I suppose that I’m the only one to have that.
So it’s not exactly what I have seen on CE-NG before, and I need to test against it for comparing even if EOL.

So I have done the same testing with :

DV settings as following :
Dolby Vision Led mode : Player-Led

And it acts the same when starting DV with RRC Disabled, except, that instead of the black screen without Dolby logo, I can see the Dolby logo and the whole image is purple.

With RRC Enabled, it acts like TV-Led, refresh is trigger when starting an HDR movie after a DV one that has the same resolution and FPS.

So I would like to test CE-NO because if all was OK, it can be related to DV capable device first and/or CE-NG, so for CE-NO, it seems that RRC is needed somehow.

Will test on fresh CE-NG later :wink:

Ok tested on CE-NG, it behaves quite the same

TV-Led :

  • With RRC OFF, DV doesn’t work well, instead of screen black, there is different color
  • With RRC ON, DV is ok

Player-Led :

  • With RRC OFF, DV doesn’t work well
  • With RRC ON, DV is ok except when returning to the GUI, wrong color like monochrome

So in final, RRC is needed and better TV-Led and with DV hardware capable screen.

You still don’t get it right.
What you are searching for is QMS.
What is not supported by many TVs nor by TVs below support HDMI 2.1a. There is also no Kodi implementation exists yet for it.

What you see is normal behaviour when mode switch will happen. Some TVs need 200ms, some others a few seconds. You can not change it except exchange your hardware.

1 Like

Ok :slight_smile:

I’m ok with switch mode, it’s fast generally, the longest is related to refresh rate change from what I can see or do you mean, the refresh rate change is the switch mode ?

Still, the best, for now, is CE-NO as TV-Led or Player-Led. (but no FEL, etc. of course)

Effectively on CE-NG, Player-Led has issue where TV-Led is ok and with FEL :slight_smile:

Thanks for your patience :folded_hands:

Hello,

This night (more while sleeping), I have the idea to test back on Ugoos OS / uPlayer on my DV capable device screen (Hisense, no Vertex2 etc.) and I just did that now :slight_smile:

RRC Disabled :

  • All DV sample and movie works, I can see the quick blank screen happen (mode switch) but it works without the need of RRC trigger (and no message like my HDMi3 input is disconnect) because it’s disable. Tests were made with mode : DV LLDV (Player-Led) or DV (TV-Led) with Adaptative HDR and not using the Always DV ON and FEL works correctly too with uPlayer.

RRC Enabled :

  • It works too :+1: like above

So the there is difference there compared to CE-NO/NG where RRC need to be active based on my yesterday testing.

Do you think the difference is related to CE code (Kernel) or CE-NO Kodi code ?

Like in CE-NG it acts the same as CE-NO (in TV-Led mode), it must be something on Kodi side, right ?

I didn’t try Kodi Android version from Ugoos OS, but I can do that too (to compare even if FEL will not work correctly).

How I can help to debug that ?

I can build CE-NO on Ubuntu and try some code around what I have seen earlier (in WinSystemAmlogicGLESContext).

I think that in CE-NO, we should have the same as Ugoos Player, right ? (even if kernel is older but like CE-NG acts the same as CE-NO, it should be ok for CE-NO for DV part).

Like I said, I have following your input, DV capable screen only, no DV always ON, so acts like on demand, like CE-NO/NG.

Thanks :folded_hands: