libretro / RetroArch

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

Receiving wrong resolution when using overscan on RPi/RetroPie? #4362

Open MrBrax opened 7 years ago

MrBrax commented 7 years ago

Sorry if it's been brought up already, but i can't find anything with my search terms.

So these are the overscan settings:

disable_overscan=1 # this is a weird one, if it's set to zero then the initial size is 656x512
overscan_left=50
overscan_right=30
overscan_top=40
overscan_bottom=56
sdtv_mode=2 # pal, size is 720x576
sdtv_aspect=1

So the overscan subtracted from 720x576 results in a 640x480 image, provided over composite. This command confirms this:

pi@retropie:~ $ cat /sys/class/graphics/fb0/virtual_size
640,480

Okay! So i put this in the config file for RetroArch:

video_fullscreen_x = 640
video_fullscreen_y = 480

This should result in a 640x480 render resolution, right? Not really.

tv_cam_device_20170104_170144 617 This is what i get with max expansion before hitting the edges, 600x480 doesn't seem right.

If i put the output resolution as "video output" in "runcommand", this happens: tv_cam_device_20170104_170048 242 It doesn't seem to read from the framebuffer? I guess that kinda make sense due to the whole multi-system aspect, but still - where is it getting it from then? I mean, it's getting the height correctly.

And when you throw _video_cropoverscan in the mix it gets even worse.


This is me spending the whole evening yesterday getting NES to look correctly:

realnes (Original NES, composite)

scale0 (Raspberry Pi, composite)

nes_gif (Comparison)

And these are the settings for that:

video_fullscreen_x = 640
video_fullscreen_y = 480
custom_viewport_width = "608"
custom_viewport_height = "448"
custom_viewport_x = "-4"
custom_viewport_y = "16"
aspect_ratio_index = "22"

Running with the lr-nestopia core, others have differing cropping.


I'd love to turn overscan off and do it manually in retroarch (which looks great!), but then emulationstation flows outside the edges and you can't read the text.

Am i just missing something? I don't think this is the problem to my long lasting issue, the resolution is messed up already since the RPi doesn't support native 240p on the composite output, and getting non-square pixels to work without shimmering and looking real bad when trying to make it 1:1 to original hardware, i have ordered a VGA adapter to test out other methods.

I have been fighting getting video output looking as close as possible to the original systems since october, and the final "deadline" is tomorrow (when i'm bringing the project to an event), so this is pretty much me waving the white flag and just putting auto aspect ratio and blur filters on everything.

And of course this became an essay, i'm not really expecting anyone to read all this, i'm just a perfectionist with ADHD meds.

--- Want to back this issue? **[Post a bounty on it!](https://www.bountysource.com/issues/40619477-recieving-wrong-resolution-when-using-overscan-on-rpi-retropie?utm_campaign=plugin&utm_content=tracker%2F296058&utm_medium=issues&utm_source=github)** We accept bounties via [Bountysource](https://www.bountysource.com/?utm_campaign=plugin&utm_content=tracker%2F296058&utm_medium=issues&utm_source=github).
hizzlekizzle commented 7 years ago

You're always going to have problems going from the composite-out because it's confined to 480i/576i no matter what else you try to feed it. You can get 240p output from Gert's VGA adapter or an HDMI-to-VGA adapter but if you're trying to put it onto a regular NTSC/PAL TV, you're still going to have to put another adapter into the mix.

For using a regular TV, I usually recommend people use RetroArch on a hacked Wii, since it natively handles 15 khz output with "240p"/doublestrike.

MrBrax commented 7 years ago

@hizzlekizzle probably gonna go with a hdmi-vga solution, but regardless, the weird resolution stuff i talked about is still applying, the os should always have a defined resolution shouldn't it?

hizzlekizzle commented 7 years ago

That's where the composite-out comes into play. No matter what resolution the OS is sending, the composite out will always expand/contract it up/down to 480i/576i. So, even if your OS reports 800x600 or 1024x768 or 320x240, you're still getting 480i/576i out to the TV.

MrBrax commented 7 years ago

@hizzlekizzle i know, that's where the overscan stuff sets in, i get a 640x480 picture in the center of the 720x576 canvas. But why does RetroArch fit the image to 600x480?

hizzlekizzle commented 7 years ago

Dunno. RetroArch just takes what the OS hands it. So the issue lies somewhere between your OS' reported resolution and the 480i/576i composite output.

MrBrax commented 7 years ago

hmm well alright, i guess the method retroarch uses to get the resolution is faulty then (since that command i posted returns 640x480), isn't that an issue in a way? can't really decide on whose end the fault lies, but i suppose that's on raspbian

hizzlekizzle commented 7 years ago

Have you tried setting any other sdtv_aspect modes?

MrBrax commented 7 years ago

just tried them out, some images like the boot raspberries and image viewer are affected, and the console text, but neither emulationstation or retroarch look different. still 600x480 with 640x480 output res set

retroarch only seem to care about video_fullscreen_y anyway, width doesn't matter

joolswills commented 7 years ago

you can set overscan_scale=1 if you want dispmanx layers to respect overscan etc.

MrBrax commented 7 years ago

@joolswills seems like i set that a long time ago. removed it and now overscan isn't applying at all to emulationstation & retroarch, leaving parts outside the screen on crt's.

joolswills commented 7 years ago

also regarding your initial post, it looks correct -

note: https://github.com/libretro/RetroArch/pull/1308

joolswills commented 7 years ago

regarding initial post - 600x480 seems correct taking aspect ratio into account etc.

joolswills commented 7 years ago

without overscan_scale=1 things like ES will ignore any overscan you have set - that only affects the framebuffer. overscan_scale will make dispmanx layers scale also - so it's set by default in retropie for example, although the firmware devs have recommended against it - but without it ES would need some overscan handling of its own.

MrBrax commented 7 years ago

kinda deceiving that it's not using 640x480 when told to though, but alright. if emulationstation had overscan built in, none of this would have been a problem :/ just gonna have to continue blurring the pixels

i eagerly await the day someone hacks in 240p mode via composite

thanks anyway, for the clarification

MrBrax commented 7 years ago

But the fact that video_fullscreen_x doesn't do anything has to be a bug, right? video_fullscreen_y changes the whole resolution.

andres-asm commented 7 years ago

both values need to be different than 0 for it to do anything

MrBrax commented 7 years ago

@fr500 yes, if i set x to 1280 for example, nothing happens. if i set it to 320 nothing happens. if i set y to 720 then the whole thing gets set to (probably 1200)x720, if i set y to 480, it becomes 600x480 x never gets taken into consideration at all

been thinking it has to do with aspect ratio forcing but i've tried turning it off

andres-asm commented 7 years ago

RGUI always follows the core aspect ratio. I really don't know though. I don't use retropie

disable_overscan=1 # this is a weird one, if it's set to zero then the initial size is 656x512
overscan_left=50
overscan_right=30
overscan_top=40
overscan_bottom=56
sdtv_mode=2 # pal, size is 720x576
sdtv_aspect=1

These are not RA options AFAIK. It's really difficult to assist you with stuff that deviates from mainline RetroArch.

MrBrax commented 7 years ago

@fr500 that's /boot/config.txt in raspberry pi, it shouldn't affect this.

tv_cam_device_20170104_233426 155

video_fullscreen_x = "640"
video_fullscreen_y = "160"
custom_viewport_width = "640"
custom_viewport_height = "160"

shouldn't this fill the whole screen? since it's not taking x into consideration it just stretches everything and spills out (only on the width), and i don't think this is intented behavior?

MrBrax commented 7 years ago

yep, it seems that the aspect ratio is locked to 5:4, and video_fullscreen_y is the only thing that can modify the resolution, width is automatically set and depends on the aspect ratio.

hizzlekizzle commented 7 years ago

video_fullscreen_x/y won't create new modelines. Custom_viewport_width/height only do anything when the aspect ratio is set to 'custom'.

EDIT: if it's stuck at 5:4 and your y-resolution is 576, I would assume that's the fault of the composite-out forcing PAL resolution and aspect.

MrBrax commented 7 years ago

but that's the weird thing though, framebuffer is 640x480, it shouldn't have anything to do with 576. render resolution can be set to anything anyway, so why would it need to create modelines? it should always scale everything to 640x480, i don't see where 600 comes from.. i just want to work within the 640x480 framebuffer, it's black and unrendered outside of it anyway, where the overscan is.

i had custom aspect ratio on there, it's been enabled on all of the pictures

andres-asm commented 7 years ago

Is this a bug? RetroArch bug? RetroPie bug?

MrBrax commented 7 years ago

@fr500 retropi hardware/firmware limitation

alterdbeast397 commented 6 years ago

what emulator are you using

MrBrax commented 6 years ago

@alterdbeast397 i used fceumm, nestopia, quicknes, and i think snes9x2010, while testing.

as this was over a year ago, i cannot remember fully, however.