libretro / RetroArch

Cross-platform, sophisticated frontend for the libretro API. Licensed GPLv3.
http://www.libretro.com
GNU General Public License v3.0
10.14k stars 1.82k forks source link

[BUG][FR] CRTSwitchRes v2.0: Non-working alignment of the screen #10475

Open joerg-knitter opened 4 years ago

joerg-knitter commented 4 years ago

Description

On my consumer JVC CRT TV, connected with a Raspberry Pi 2 via VGA666-to-Scart-RGB adapter with the horizontal resulution set to 1920px, the image is shifted to the right, so that a black border is visible on the left and content is cut on the right. This is not only visible in the menu, but also on all started cores. Using the crt_switch_center_adjust setting does not change anything. With the system menu of my CRT TV, I am also not able to shift the image thus far, furthermore, I would like to avoid to change such global TV settings. See feedback feedback from other users e.g. at https://forums.libretro.com/t/new-crtswitchres-v2-0-for-retroarch/20513/36 and https://forums.libretro.com/t/new-crtswitchres-v2-0-for-retroarch/20513/51. Tested with Lakka for Raspberry Pi 2-3.

Expected behavior

In RetroArch, the output TV image of a Raspberry Pi using a VGA-2-RGB adapter must be (kind of) centered or the positioning must be adjustable horizontally or vertically. This might also apply to other output drivers.

Actual behavior

The image is shifted to the right, horizontal adjustment via crt_switch_center_adjust parameter does not work, Also, a vertical alignment is not possible in case it is needed

Steps to reproduce the bug

  1. Connect your Raspberry Pi with a VGA666-2-RGB/Scart adapter to a CRT.
  2. Use the following RetroArch settings:
    • crt_switch_center_adjust = “0”
    • crt_switch_resolution = “1”
    • crt_switch_resolution_super = “1920”
    • crt_switch_resolution_use_custom_refresh_rate = “true”
    • crt_video_refresh_rate = “60.000000”
  3. Start RetroArch (e.g. with Lakka) and watch the results, also when using different cores.

Bisect Results

I played around with different emulators and roms from different regions, and they all had this shift to the right, because the horizontal front porch value always stays at 80 (see calculations in lines 324-328 in video_crt_switch.c), e.g.:

Using the values calculated for the RGUI, I played around with the crt_switch_center_adjust value (can´t tell, why the menu when testing this was at 50hz btw.):

As you might remember, only the horizontal sync signal length is modified by the crt_switch_center_adjust value, but this does not seem to alter anything regarding the horizontal positioning.

In fact, this approach in fact seems to be wrong, because in my opinion, the front porch and back porch would have to be changed instead. Therefore, I succeeded on a test where I changed the front porch and back porch as follows for my TV:

This also works for the vertical positioning btw.

For further tests and maybe as a proof that this is the right way to handle this, I found a link to a video timings generator script by Frank Skilton from 2017 at https://drive.google.com/file/d/0B10JEKHkXafmajlWbVcyTEVzdGM (linked e.g. from the Pi2Scart website; apparently, there is no repository available) - I attached the script here to this ticket. With this, you can show a test image (in this case, scale the included align.png e.g. to 1920x240px or alike) and move the output image by using the cursor keys. If you are satisfied with the positioning, you can save the adjusted modeline settings - this is how I found out the correct front-porch/back-porch settings for my TV.

Version/Commit

Environment information

Feature Request

LibretroAdmin commented 2 years ago

@alphanu1 Is this still relevant or can it be closed?

alphanu1 commented 2 years ago

This one possible still needs looking into. Again. I will get on to this soon