AeolusUX / R36S-DTB

RetroBox Console / Game Station / Game Console R33S/R35S/R36S/PowKiddy RGB20S with Functional Function (FN) Button
119 stars 21 forks source link

Panel 4 77Hz issue #6

Closed gurrgur closed 2 months ago

gurrgur commented 2 months ago

I got an r36s with panel 4 in the mail today and sadly it runs at 77Hz by default, leading to intense stutter for basically everything I'm trying to emulate.

Apparently the panel timings are screwed up in the stock dtb file. Thanks to this I was able to figure out timings that achieve 60Hz. I heard 60Hz might cause problems with usb devices, e.g. Wifi, but for me it worked without causing any issues.

Could you please add this to your repository somehow? It was quite annoying to figure out and others dealing with this issue might appreciate my solution.

Method

  1. Create a device tree overlay file called 60hz_overlay.dts with the following contents:
/dts-v1/;
/plugin/;

/ {
    fragment@0 {
        target-path = "/dsi@ff450000/panel@0/display-timings/60Hz";
        __overlay__ {
            clock-frequency = <0x1ba8140>;
            hactive = <0x280>;
            vactive = <0x1e0>;
            hfront-porch = <0x2e>;
            hsync-len = <0x02>;
            hback-porch = <0x2c>;
            vfront-porch = <0xa5>;
            vsync-len = <0x02>;
            vback-porch = <0x0e>;
            hsync-active = <0x00>;
            vsync-active = <0x00>;
            de-active = <0x00>;
            pixelclk-active = <0x01>;
            phandle = <0xa0>;
        };
    };
};
  1. Compile it: dtc -I dts -O dtb -o ./60hz_overlay.dtbo ./60hz_overlay.dts
  2. Merge with the device tree: fdtoverlay -i rk3326-r35s-linux.dtb -o rk3326-r35s-linux.dtb.60 60hz_overlay.dtbo
  3. Copy rk3326-r35s-linux.dtb.60 to ArkOS BOOT partition and rename to rk3326-r35s-linux.dtb

Attachments:

rk3326-r35s-linux.dtb.zip

AeolusUX commented 2 months ago

Hi! This is very helpful I would add this to my repo for sure. Question, can you share any games/titles I could try and check if these work? I have a couple of usb devices I could try too. I'd like to add a warning or a note that they could affect usb devices.

gurrgur commented 2 months ago

I cant really answer the question regarding which games to test. I tested many different panel timings, some with lower clock frequency and some with higher clock (e.g. for a 120Hz mode). For some clock frequencies on both ends, the screen turned grey when exiting retroarch. That happend regardless of which game was playing and happend also when starting and exiting retroarch without running any game. I have no idea what happens there. Maybe something crashes, though I verified via SSH/Htop that Retroarch exits gracefully. I didn't experience any other issues with specific games or emulators.

What you could test are games which run at a native 60fps and verify that there is no "judder" as seen with non-60Hz refresh rate. I used Metroid Fusion and Chrono Trigger. The smoothness (or lack thereof) is quite apparent when running around in these games.

Now the thing with the supposed WIFI issues with a 60Hz mode. This is something I read on discord but have yet to see for myself. With the proposed 60Hz mode timings, this is (hopefully) unlikely to occur, since the clock frequency (29MHz) is kept identical to the 77Hz mode that (some or all?) panel 4 devices ship with. Therefore in terms of electromagnetic interference there shouldnt be much difference between both.

So rather than adding a note that a specific failure is expected, I'd add a note that the 60Hz variant is experimental and that we're happy to hear from any issues that it causes compared to the stock 77Hz mode.