Closed gizmo98 closed 8 years ago
I haven't gotten around to updating the patch I sent to the SDL people, but according to them:
The value of the hint should not contain the "SDLHINT" (as documented at the top of SDL_hints.h :).
(https://bugzilla.libsdl.org/show_bug.cgi?id=3353#c15)
So for instance:
Please can you test this with a monitor in vertical mode - as it looks like it corrects the width, but no height correction ? (unless I am missing something). I had to adjust the SDL1 dispmanx code or else stuff would be badly stretched if the output screen was taller than wide - https://github.com/vanfanel/SDL-1.2.15-raspberrypi/pull/1
actually. looking again at the code, I think this is taken care of, just some slightly different scaling logic than I used.
Thanks for this - Will do some testing. It might be useful to allow adjustment of the ratio as I added to our SDL1 - https://github.com/vanfanel/SDL-1.2.15-raspberrypi/pull/2 which is useful for correcting - eg we use this now on C64 to make it 4:3 (as c64 pixels are not square).
@loganmc10 Oh. I will update the hint. ;-)
@joolswills To test this patch change "--fullscreen" into "--windowed --resolution 320x240" --> https://github.com/RetroPie/RetroPie-Setup/blob/master/scriptmodules/emulators/mupen64plus/mupen64plus.sh#L203. This patch shows no effect if application (like emulationstation or mupen64plus fullscreen mode) passes display resolution to SDL_CreateWindow(). I don't know if we need an aspect ratio option because mupen64plus video plugins and retroarch have own aspect ratio logic.
@loganmc10 Should i add a second hint like SDL_RPI_STRETCH_CONTENT? As i can see SDL2 guys insist you keep the old logic as well. My patch keeps src_rect and dst_rect aspect equal as long SDL_RPI_STRETCH_WINDOW is not set.
No Hint --> Keep aspect. Upscaling if possible SDL_RPI_STRETCH_CONTENT --> Upscaling if possible SDL_RPI_STRETCH_WINDOW --> No upscaling. dst_rect = desktop resolution
I believe "No Hint" should not do any upscaling, no? STRETCH_CONTENT should upscale and keep aspect ratio, and STRETCH_WINDOW should upscale and stretch the aspect ratio if needed, or am I misunderstanding?
I don't know how useful stretching the aspect ratio would be, most people are going to want the aspect ratio to stay the same, my original patch didn't include that because I am not a very good programmer and I am lazy.
I think the SDL people wanted the default behaviour to remain how it is, with an SDL "window" taking up the lower left hand portion of the screen using whatever resolution is specified. I don't know who that is useful for, but there are all kinds of people out there I suppose.
Some people dislike it if 4:3 content has black borders on their 16:9 TV screen. I dislike stretched 4:3 content but other people dislike black borders. ;-)
@loganmc10 What do you think of this? SDL_VIDEO_RPI_SCALE_MODE 0 = no upscaling (old mode) 1 = upscaling which respects aspect ratio 2 = upscaling which fills the whole screen
@joolswills Do you think it is better do enable this functionality with an environmental variable?
@gizmo98 Ya that seems like a pretty good way to do it.
@gizmo98 regarding aspect - it could be useful for other stuff. EG if we move dosbox over to sdl2 setting aspect would be useful (and other sdl2 emulators).
ENV variable would be useful so users can control it also.
I added the old output mode as default again. You can test mupen64plus with the new mode with this command line:
SDL_VIDEO_RPI_SCALE_MODE=1 "$rootdir/emulators/mupen64plus/bin/mupen64plus" --noosd --windowed --resolution 320x240 --gfx ${VIDEO_PLUGIN}.so --configdir "$configdir/n64" --datadir "$configdir/n64" "$ROM"
I have not added an aspect ratio hint yet. There should be no problem to replace srcAspect in 256 and line 261 with an user defined aspect ratio.
I added an aspect ratio option. SDL_VIDEO_RPI_RATIO can be used to set an custom aspect ratio. This option does only work if SDL_VIDEO_RPI_SCALE_MODE=1. This PR should be feature complete now.
Command line:
SDL_VIDEO_RPI_SCALE_MODE=1 SDL_VIDEO_RPI_RATIO=1.5 "$rootdir/emulators/mupen64plus/bin/mupen64plus" --noosd --windowed --resolution 320x240 --gfx ${VIDEO_PLUGIN}.so --configdir "$configdir/n64" --datadir "$configdir/n64" "$ROM"
Thanks - looks good. Will merge, then later on rebuild binaries / bump version number of our sdl packages
..and great job - much appreciation for implementing this.
Thanks!
Do you guys have any kind of system for submitting these patches upstream? This is obviously a lot more robust than the patch i submitted to SDL2
no system, but this should probably be submitted to the sdl bugtracker, perhaps on your existing ticket if you already did that.
Ok I updated the bug report with SDL2 with this patch: https://bugzilla.libsdl.org/show_bug.cgi?id=3353#c16
To get this to work we have to compile the current retropie from source?
Could someone upload the two files that are edited allready compiled and we can just copy them over?
If you update mupen64plus RetroPie-Setup should fetch the new sdl2 package as well.
@loganmc10 The sdl guys seem to be a little bit slow. There was no reaction since july 16. Could you push the topic again? Thanks!
Ok I replied to that thread
It's worth checking our branch. I think some changes were made since the patch. Might be just cosmetic though. I'm in mobile can link later if needed.
@gizmo98 perhaps you can comment on that SDL bug report? I haven't used my Raspberry Pi in months, they are asking some questions about the implementation that you created.
Thanks @loganmc10 for pushing the thread and thanks @joolswills for pointing it out. 👍
Inspired by @loganmc10's SDL2 patch https://bugzilla.libsdl.org/show_bug.cgi?id=3353 and this thread https://github.com/RetroPie/RetroPie-Setup/issues/1511 i have modified SDL_rpivideo.c.
The video driver upscale window resolution to desktop resolution if necessary. Video aspect will be kept. Window will be centered. Stretch window to fullscreen (ignore aspect) can be enabled with new SDL hint „SDL_HINT_RPI_STRETCH_WINDOW“.
This change allows graphics intensive applications like mupen64plus/GlideN64 to run at a lower resolution which leads to better performance. It is no longer necessary to switch display resolution to get better performance.
This modification was tested with emulationstation and mupen64plus. Mupen64plus module must be modified if this PR will be commited (set GlideN64 as default video plugin, force 320x240 render resolution, use windowed mode).