MiSTer Web Control demo

https://github.com/MiSTer-devel/Main_MiSTer/wiki

Moderators: Mug UK, Zorro 2, Greenious, spiny, Sorgelig, Moderator Team

Locutus73
Atari Super Hero
Atari Super Hero
Posts: 503
Joined: Wed Feb 07, 2018 6:13 pm

MiSTer Web Control demo

Postby Locutus73 » Sun May 19, 2019 2:49 pm

NGINX + CGI + MiSTer Web Control demo
https://github.com/MiSTer-devel/Scripts ... demo/nginx

This is a proof of concept demonstrating the use of NGINX Web server with CGI support on the MiSTer FPGA system through a simple MiSTer Web Control demo page.
Simply put nginx_start.sh in your SD and launch it through MiSTer main menu OSD (press F12 and then Scripts).
This demo uses the following open source projects (visit their Web sites for the source code and the license files)

- NGINX Open Source https://nginx.org
- fcgiwrap https://github.com/gnosek/fcgiwrap
- Screenshot_MiSTer by alanswx https://github.com/alanswx/Screenshot_MiSTer
- my personal fork vodik's uinput-injector of https://github.com/Locutus73/uinput-injector

I take no responsibility for any data loss or anything, if your DE10-Nano catches fire it’s up to you: use the script at your own risk.

Regards.

Locutus73

djsquare
Atari User
Atari User
Posts: 43
Joined: Thu Oct 18, 2018 2:01 am

Re: MiSTer Web Control demo

Postby djsquare » Sun May 19, 2019 10:11 pm

Really easy to setup but not really useful unless the game is paused. It is really really neat though. I really hope this gets developed enough to be able to play through a web browser without lag. Thanks posting this, I love new MiSTer tricks :cheers:

Locutus73
Atari Super Hero
Atari Super Hero
Posts: 503
Joined: Wed Feb 07, 2018 6:13 pm

Re: MiSTer Web Control demo

Postby Locutus73 » Mon May 20, 2019 9:23 am

djsquare wrote:I really hope this gets developed enough to be able to play through a web browser without lag.

I don't think you'll ever see that with this approach, the poor ARM isn't powerful enough (maybe with a powerful PC as external video encoder and sort of proxy, but that goes far beyond this demo, it would be something completely different).
It was a fun project, just for the pleasure of developing it and showing off how cool is MiSTer hybrid approach.
Anyway the NGINX+CGI can be useful for other stuff and this was just a showcase of a working MiSTer setup, you can put whatever you want under the html and cgi-bin directories, the Web Control demo is just a pre installed example, better than the default NGINX post install landing page.
The Web Control demo could be vaguely useful for remote developing/debug if it could capture the main menu and the cores OSD, but I think it's impossible in the current state: alanswx awesome screenshot utility grabs a scaler buffer in the DDR memory, while I think OSD uses BRAM or something else. Otherwise it can be vaguely useful as a networked keyboard, i.e. when developing something on MiSTer on a local PC and not wanting a second keyboard on the desk.

Regards.

Locutus73

djsquare
Atari User
Atari User
Posts: 43
Joined: Thu Oct 18, 2018 2:01 am

Re: MiSTer Web Control demo

Postby djsquare » Tue May 21, 2019 3:26 am

Alright so being able to use this as an alternative OSD keyboard makes this web control thing really cool. Would it be possible in the future, to be able to use this for any of the computer cores for typing, like for the C64 core?

Sorgelig
Ultimate Atarian
Ultimate Atarian
Posts: 5387
Joined: Mon Dec 14, 2015 10:51 am
Location: Russia/Taiwan

Re: MiSTer Web Control demo

Postby Sorgelig » Tue May 21, 2019 5:41 am

I have no plans to integrate this functionality to MiSTer as it's completely out of MiSTer usage. It also stresses the whole system by CPU load and network traffic so it may affect the work of the cores.
It can be kept as a 3rd-party add-on installed through script. Control probably can be added through input events injection or through uinput driver.

Locutus73
Atari Super Hero
Atari Super Hero
Posts: 503
Joined: Wed Feb 07, 2018 6:13 pm

Re: MiSTer Web Control demo

Postby Locutus73 » Tue May 21, 2019 7:15 am

djsquare wrote:Alright so being able to use this as an alternative OSD keyboard makes this web control thing really cool. Would it be possible in the future, to be able to use this for any of the computer cores for typing, like for the C64 core?

I noticed C64 typing doesn’t work, but probably it’s just a timing problem in the uinput-inject code. If you try Minimig, you can type in the Workbench.
Maybe I’ll take a look, but it’s just a demo/toy for me, nothing very important.

Sorgelig wrote:I have no plans to integrate this functionality to MiSTer as it's completely out of MiSTer usage. It also stresses the whole system by CPU load and network traffic so it may affect the work of the cores.
It can be kept as a 3rd-party add-on installed through script. Control probably can be added through input events injection or through uinput driver.

Although it’s surprisingly light on the CPU, I didn’t expect that, I was surprised... I agree with you. It’s a demo/toy I don’t even auto download with the updater. I put that in a demo subdirectory (not downloaded) of the Scripts_MiSTer repository: if users want to test it, they can manually download nginx_start.sh which will autodownload the rest. I almost forgot, uinput is already in the demo, I should tweak it a bit for making it work with C64 too.

BTW do you think is it possible and/or easy to make the main menu and the cores OSD screenshot friendly? That would be cool and make the demo somehow useful, but it’s not worth if it requires a big effort.

Regards.

Locutus73

jayp76
Atari freak
Atari freak
Posts: 54
Joined: Wed Oct 17, 2018 10:09 am

Re: MiSTer Web Control demo

Postby jayp76 » Tue May 21, 2019 7:22 am

I don't see this demo for controlling the cores, but how about file/rom transfer? For those who don't want to hassle/use scp and samba?
Or as GUI for the MiSTer.ini?

Locutus73
Atari Super Hero
Atari Super Hero
Posts: 503
Joined: Wed Feb 07, 2018 6:13 pm

Re: MiSTer Web Control demo

Postby Locutus73 » Tue May 21, 2019 7:35 am

jayp76 wrote:I don't see this demo for controlling the cores, but how about file/rom transfer? For those who don't want to hassle/use scp and samba?
Or as GUI for the MiSTer.ini?

All things which can be done without any MiSTer coding experience since this specific NGINX setup supports CGI. So just web developing skills (which are more common) are required. Actually the main goal of the demo wasn’t the Web Control per se, but showcasing the use of NGINX as a platform for interacting with MiSTer through Web, so anyone can use it: the html and cgi-bin directories can be emptied (there are just 4 or 5 files) and anyone can put their HTML+JavaScript+CGI code there.

Personally I don’t think web rom transfer or ini editing would be very useful, once you’re on a PC with a web browser, why not just accessing to MiSTer through Samba (or SCP or FTP)? It’s even shorter to type \\MiSTer than http://MiSTer :D
But anyone has his/her needs/taste so why not? It’s possible, think to this demo more as a platform than an application.
I personally think settings editing belongs to the main GUI, but that’s another story... maybe one day :wink:

Regards.

Locutus73

jayp76
Atari freak
Atari freak
Posts: 54
Joined: Wed Oct 17, 2018 10:09 am

Re: MiSTer Web Control demo

Postby jayp76 » Tue May 21, 2019 8:06 am

i thought is as like an equivalent of this.
https://github.com/recalbox/recalbox-os/wiki/recalbox-Manager-Web-Oberfl%C3%A4che-(DE)

But yeah, most of this can be done/shown via menu core. So no need for a WEB GUI. Then again. If you don't want / can't go CLI, this might be an alternative, without having much knownledge. It's all about how much user friendly you want the MiSTer platform to be. Personally i don't need this, but it is a nice side project for those who can develop CGI scripts.

Locutus73
Atari Super Hero
Atari Super Hero
Posts: 503
Joined: Wed Feb 07, 2018 6:13 pm

Re: MiSTer Web Control demo

Postby Locutus73 » Tue May 21, 2019 8:24 am

jayp76 wrote:But yeah, most of this can be done/shown via menu core. So no need for a WEB GUI. Then again. If you don't want / can't go CLI, this might be an alternative, without having much knownledge. It's all about how much user friendly you want the MiSTer platform to be.

I believe MiSTer main goal is to be fully managed by its GUI, possibly just using a joypad.

jayp76 wrote:Personally i don't need this, but it is a nice side project for those who can develop CGI scripts.

Yeah, it was really fun for me to fiddle with it and I think it can be great fun for anyone with some web skills. If it grows and people get interested, I may consider moving nginx_start.sh to the main scripts repository, so NGINX still won’t be automatically installed, but the script which installs it (but it won’t auto start at boot, so no resource taken from MiSTer) would be easily reachable for anyone... time will tell.

Regards.

Locutus73

Sorgelig
Ultimate Atarian
Ultimate Atarian
Posts: 5387
Joined: Mon Dec 14, 2015 10:51 am
Location: Russia/Taiwan

Re: MiSTer Web Control demo

Postby Sorgelig » Tue May 21, 2019 10:53 am

Locutus73 wrote:BTW do you think is it possible and/or easy to make the main menu and the cores OSD screenshot friendly? That would be cool and make the demo somehow useful, but it’s not worth if it requires a big effort.

OSD overlays on HDMI output. Screenshot made from core's output. They are two different places. If OSD will be overlayed on original core's video then it will be scaled together and will look awful.

Locutus73
Atari Super Hero
Atari Super Hero
Posts: 503
Joined: Wed Feb 07, 2018 6:13 pm

Re: MiSTer Web Control demo

Postby Locutus73 » Tue May 21, 2019 11:26 am

Sorgelig wrote:
Locutus73 wrote:BTW do you think is it possible and/or easy to make the main menu and the cores OSD screenshot friendly? That would be cool and make the demo somehow useful, but it’s not worth if it requires a big effort.

OSD overlays on HDMI output. Screenshot made from core's output. They are two different places. If OSD will be overlayed on original core's video then it will be scaled together and will look awful.

I see, and is this image which will be fetched to the HDMI somewhere in the DDR? Or would it be theoretically possible (if it's not a big effort and if it doesn't affect performance/latency) to put a copy of the image in the DDR memory for having an "HDMI screenshot"? So the screenshot util could have an option for capturing raw original core output or the processed and overlaid HDMI image (and main MiSTer GUI too).

Regards.

Locutus73

Sorgelig
Ultimate Atarian
Ultimate Atarian
Posts: 5387
Joined: Mon Dec 14, 2015 10:51 am
Location: Russia/Taiwan

Re: MiSTer Web Control demo

Postby Sorgelig » Tue May 21, 2019 11:31 am

It's overlaid directly to HDMI video data. It never goes to DDR, and it's very expensive to put it there.

Locutus73
Atari Super Hero
Atari Super Hero
Posts: 503
Joined: Wed Feb 07, 2018 6:13 pm

Re: MiSTer Web Control demo

Postby Locutus73 » Tue May 21, 2019 11:40 am

Sorgelig wrote:It's overlaid directly to HDMI video data. It never goes to DDR, and it's very expensive to put it there.

Ok, I understand.
Another curiosity (don't get me wrong, I'm not pushing you, I'm asking in order to understand): copying the whole HDMI video data would be complex/expensive, but what about just the OSD overlay? I mean: would be feasible (again if it's not a big effort and if it doesn't affect performance/latency) to copy only the generated overlay in a second DDR buffer? So the screenshot util could read both the core video out buffer and the overlay buffer and merge them (only when asked with a commandline argument).

Regards.

Locutus73

Sorgelig
Ultimate Atarian
Ultimate Atarian
Posts: 5387
Joined: Mon Dec 14, 2015 10:51 am
Location: Russia/Taiwan

Re: MiSTer Web Control demo

Postby Sorgelig » Tue May 21, 2019 11:45 am

My answer was about only OSD data.

Locutus73
Atari Super Hero
Atari Super Hero
Posts: 503
Joined: Wed Feb 07, 2018 6:13 pm

Re: MiSTer Web Control demo

Postby Locutus73 » Tue May 21, 2019 11:59 am

Sorgelig wrote:My answer was about only OSD data.

Ah, OK, I didn't understand that.
And when you said "expensive" did you mean "complex/expensive in terms of developing time and effort" or "expensive in terms of timings/latency" (or both)?

Thank you in advance.
Regards.

Locutus73

Sorgelig
Ultimate Atarian
Ultimate Atarian
Posts: 5387
Joined: Mon Dec 14, 2015 10:51 am
Location: Russia/Taiwan

Re: MiSTer Web Control demo

Postby Sorgelig » Tue May 21, 2019 12:59 pm

Working with memory in HDL is not as easy as in C write a[i] = 1. It needs interface so access the memory. DDR is very busy and has no free interface to access, so it will need to share with other DDR client. Doing it just to save OSD data is too expensive for pretty much useless data for 99.9% users.
Get RPi - it has all this. Streaming kills everything for which FPGA exists. So use RPi or PC if you need streaming or remote control.

Locutus73
Atari Super Hero
Atari Super Hero
Posts: 503
Joined: Wed Feb 07, 2018 6:13 pm

Re: MiSTer Web Control demo

Postby Locutus73 » Tue May 21, 2019 2:47 pm

Sorgelig wrote:Working with memory in HDL is not as easy as in C write a[i] = 1. It needs interface so access the memory. DDR is very busy and has no free interface to access, so it will need to share with other DDR client. Doing it just to save OSD data is too expensive for pretty much useless data for 99.9% users.
Get RPi - it has all this. Streaming kills everything for which FPGA exists. So use RPi or PC if you need streaming or remote control.


It was an intellectual curiousity, not a need. (I already have plenty of RPis and PCs).

Regards.

Locutus73

Sorgelig
Ultimate Atarian
Ultimate Atarian
Posts: 5387
Joined: Mon Dec 14, 2015 10:51 am
Location: Russia/Taiwan

Re: MiSTer Web Control demo

Postby Sorgelig » Tue May 21, 2019 3:33 pm

MiSTer needs pretty much similar but more useful task:
With frame buffer support it should be much easier to create terminal output application and get Linux command prompt right on MiSTer video.
What is now needed - some source of terminal with ability to work with graphics buffer. Probably getty/agetty sources can be adopted. It also must be able to connect to /dev/input to grab the keyboard(and mouse if needs) inputs as Linux is headless.

Probably scripts can be moved to normal Linux console then.

Locutus73
Atari Super Hero
Atari Super Hero
Posts: 503
Joined: Wed Feb 07, 2018 6:13 pm

Re: MiSTer Web Control demo

Postby Locutus73 » Tue May 21, 2019 4:46 pm

Sorgelig wrote:MiSTer needs pretty much similar but more useful task:
With frame buffer support it should be much easier to create terminal output application and get Linux command prompt right on MiSTer video.
What is now needed - some source of terminal with ability to work with graphics buffer. Probably getty/agetty sources can be adopted. It also must be able to connect to /dev/input to grab the keyboard(and mouse if needs) inputs as Linux is headless.

Probably scripts can be moved to normal Linux console then.


Interesting... very interesting... although I think whenever is possible, minimal joypad interaction is the best possible user experience, this would open to endless possibilities.
Do you mean something like this?
https://github.com/uobikiemukot/yaft (it's just an example)

Regards-

Locutus73

Sorgelig
Ultimate Atarian
Ultimate Atarian
Posts: 5387
Joined: Mon Dec 14, 2015 10:51 am
Location: Russia/Taiwan

Re: MiSTer Web Control demo

Postby Sorgelig » Tue May 21, 2019 5:10 pm

Yeah, something like this.
I still think what is the better way to implement the framebuffer.

As for joypad control - there are several ways. With fully automated script it's possible to start the same way from Menu core. Just output will be in normal text window instead of OSD window.

User avatar
kitrinx
Captain Atari
Captain Atari
Posts: 176
Joined: Wed Sep 26, 2018 6:03 am

Re: MiSTer Web Control demo

Postby kitrinx » Tue May 21, 2019 8:13 pm

Sorgelig wrote:Yeah, something like this.
I still think what is the better way to implement the framebuffer.

As for joypad control - there are several ways. With fully automated script it's possible to start the same way from Menu core. Just output will be in normal text window instead of OSD window.


I am pretty sure SDL2 can do software rendering directly to framebuffer in linux. If that's the case it would make it pretty easy to make most any simple app you want, maybe combined with a simple UI library that has SDL bindings, like maybe Dear ImGui. A nice little onboarding app to set up wifi, timezone, and etc would help new people a lot. Something that can render github readme would also be super useful so people could view them strait from cores. Lots of possibilities.

Sorgelig
Ultimate Atarian
Ultimate Atarian
Posts: 5387
Joined: Mon Dec 14, 2015 10:51 am
Location: Russia/Taiwan

Re: MiSTer Web Control demo

Postby Sorgelig » Tue May 21, 2019 9:20 pm

There is one problem - it will output to HDMI only.
Well, it's possible to do some switch between scaler output and core output on VGA, but it will make TV mad switching between resolutions.
So here we hit the point where VGA will be left behind with simple output from cores only. Actually i'm fine with it as MiSTer born with the primary task - output the video to HDMI. Otherwise probably i would still use MiST or similar VGA-only FPGA board.

User avatar
kitrinx
Captain Atari
Captain Atari
Posts: 176
Joined: Wed Sep 26, 2018 6:03 am

Re: MiSTer Web Control demo

Postby kitrinx » Tue May 21, 2019 11:35 pm

Sorgelig wrote:There is one problem - it will output to HDMI only.
Well, it's possible to do some switch between scaler output and core output on VGA, but it will make TV mad switching between resolutions.
So here we hit the point where VGA will be left behind with simple output from cores only. Actually i'm fine with it as MiSTer born with the primary task - output the video to HDMI. Otherwise probably i would still use MiST or similar VGA-only FPGA board.


I think the most important thing is that there is the potential to play games on CRT if needed, which is a big perk for the MiSTer over a lot of other things, but I agree with you that is OK to have some advanced features require the primary method of video out. I suppose for people who are crt only there are other ways to deliver some of the features, maybe somehow over the network as an alternative? Regardless, the pieces are in place for some cool things now. Stuff that seemed like it could only be done in software emulators is now in the realm of possibility for MiSTer:

https://www.youtube.com/watch?v=o0TOaxD9zcs

Sorgelig
Ultimate Atarian
Ultimate Atarian
Posts: 5387
Joined: Mon Dec 14, 2015 10:51 am
Location: Russia/Taiwan

Re: MiSTer Web Control demo

Postby Sorgelig » Wed May 22, 2019 4:56 am

Yeah, it's possible.
May be OCR translation can be sent to the phone.


Return to “MiSTer”

Who is online

Users browsing this forum: danielb and 12 guests