dom
Raspberry Pi Engineer & Forum Moderator
Raspberry Pi Engineer & Forum Moderator
Posts: 5317
Joined: Wed Aug 17, 2011 7:41 pm
Location: Cambridge

Re: Dispmanx VNC Server

Fri Jul 26, 2013 3:42 pm

AndyD wrote:
AndyD wrote:... I may just be able to get a VC_IMAGE_YUV420 snapshot. ...
Sorry for the delay. I have tried calling vc_dispmanx_snapshot() using a resource handle created with type VC_IMAGE_YUV420. I can run the code once, and vc_dispmanx_snapshot() returns -1. If I try and run it again the code hangs in vc_dispmanx_snapshot() and requires a reboot.
YUV formats are not supported by the composition hardware used by vc_dispmanx_snapshot. Ideally it shouldn't crash, but this will never work dierctly.

User avatar
AndyD
Posts: 2331
Joined: Sat Jan 21, 2012 8:13 am
Location: Melbourne, Australia
Contact: Website

Re: Dispmanx VNC Server

Sun Jul 28, 2013 12:05 am

dom wrote:YUV formats are not supported by the composition hardware used by vc_dispmanx_snapshot. Ideally it shouldn't crash, but this will never work dierctly.
Thanks Dom. I can get vc_dispmanx_snapshot() to work using VC_IMAGE_RGB565, VC_IMAGE_RGB888, VC_IMAGE_RGBA32.

I have also tried changing the the hello_encode example to encode using OMX_COLOR_Format16bitRGB565 instead of OMX_COLOR_FormatYUV420PackedPlanar, but that didn't work. I will next just do the conversion myself from RGB to YUV420. It should be easy enough. I will create some lookup table, as the calculation are floating point.

dom
Raspberry Pi Engineer & Forum Moderator
Raspberry Pi Engineer & Forum Moderator
Posts: 5317
Joined: Wed Aug 17, 2011 7:41 pm
Location: Cambridge

Re: Dispmanx VNC Server

Sun Jul 28, 2013 10:28 am

AndyD wrote:
dom wrote:YUV formats are not supported by the composition hardware used by vc_dispmanx_snapshot. Ideally it shouldn't crash, but this will never work dierctly.
Thanks Dom. I can get vc_dispmanx_snapshot() to work using VC_IMAGE_RGB565, VC_IMAGE_RGB888, VC_IMAGE_RGBA32.

I have also tried changing the the hello_encode example to encode using OMX_COLOR_Format16bitRGB565 instead of OMX_COLOR_FormatYUV420PackedPlanar, but that didn't work. I will next just do the conversion myself from RGB to YUV420. It should be easy enough. I will create some lookup table, as the calculation are floating point.
Fom here:
https://github.com/raspberrypi/firmware ... components

video_encode does support OMX_COLOR_Format16bitRGB565 (and the code seems to agree), so it may be worth persevering with that.

User avatar
AndyD
Posts: 2331
Joined: Sat Jan 21, 2012 8:13 am
Location: Melbourne, Australia
Contact: Website

Re: Dispmanx VNC Server

Sun Jul 28, 2013 1:42 pm

dom wrote: Fom here:
https://github.com/raspberrypi/firmware ... components

video_encode does support OMX_COLOR_Format16bitRGB565 (and the code seems to agree), so it may be worth persevering with that.
Thanks Dom. Yes it was woth persevering! I have managed to hack hello_encode to call dispmanx_snapshot() and save a video. I was then able to replay it using hello_video. It was just a very small mistake.

User avatar
AndyD
Posts: 2331
Joined: Sat Jan 21, 2012 8:13 am
Location: Melbourne, Australia
Contact: Website

Re: Dispmanx VNC Server

Tue Jul 30, 2013 12:47 am

The is a fork of libvncserver here that appears to have H.264 encoding on the client side. I will have a bit of a dig around.

Saboti
Posts: 5
Joined: Fri Aug 16, 2013 6:17 am

Re: Dispmanx VNC Server

Fri Aug 16, 2013 7:32 am

Hello,

i have a litte Problem with the vnc Server on archlinuxarm.
I Installed the Package "libvncserver 0.9.9-1" and i was able to compile the Server.
I can start it, but if i try to connect it dumps an shows following error message:

Open display[0]...
Display is 1024 x 768
Server bpp:16
Server bigEndian:0
Server redShift:0
Server blueShift:10
Server greeShift:5
16/08/2013 09:31:14 Listening for VNC connections on TCP port 5900
16/08/2013 09:31:14 rfbListenOnTCP6Port: error in bind IPv6 socket: Address family not supported by protocol
open /dev/uinput returned 5.
First write returned 1116.
ioctl UI_DEV_CREATE returned 0.
*** buffer overflow detected ***: ./dispman_vncserver terminated
Abgebrochen (Speicherabzug geschrieben)

any ideas?

User avatar
hanzelpeter
Posts: 72
Joined: Mon Jul 09, 2012 11:56 am

Re: Dispmanx VNC Server

Fri Aug 16, 2013 2:32 pm

I can try it. Did you download the ARCH arm from raspberrypi.org downloads? What version is it?

Saboti
Posts: 5
Joined: Fri Aug 16, 2013 6:17 am

Re: Dispmanx VNC Server

Fri Aug 16, 2013 4:18 pm

hanzelpeter wrote:I can try it. Did you download the ARCH arm from raspberrypi.org downloads? What version is it?
Yes it's the Image from raspberrypi.org

Linux alarmpi 3.6.11-15-ARCH+ #1 PREEMPT Wed Aug 14 17:15:38 CDT 2013 armv6l GNU/Linux

Saboti
Posts: 5
Joined: Fri Aug 16, 2013 6:17 am

Re: Dispmanx VNC Server

Thu Aug 22, 2013 10:44 am

@hanzelpeter, any news regarding your vnc server in use with archlinuxarm?

User avatar
hanzelpeter
Posts: 72
Joined: Mon Jul 09, 2012 11:56 am

Re: Dispmanx VNC Server

Fri Aug 23, 2013 5:14 pm

Hello.

Sorry for being late. I was on business trip. So far I have downloaded Arch Linux ARM and tried to compile and run dispmanx_vnc.
It run as you described. So I have also buffer overflow.
Then I tried to debug it via GDB. And a problem appears.
See this: http://lists.opensuse.org/opensuse-arm/ ... 00087.html

Know someone how to continue?

User avatar
hanzelpeter
Posts: 72
Joined: Mon Jul 09, 2012 11:56 am

Re: Dispmanx VNC Server

Fri Aug 23, 2013 5:28 pm

Also first try on google found this:
https://bugs.gentoo.org/show_bug.cgi?id=425698

So it look like problem of libvncserver 0.9.9.
We can try downgrade to libvncserver 0.9.8

Saboti
Posts: 5
Joined: Fri Aug 16, 2013 6:17 am

Re: Dispmanx VNC Server

Sun Aug 25, 2013 8:13 am

hanzelpeter wrote:Also first try on google found this:
https://bugs.gentoo.org/show_bug.cgi?id=425698

So it look like problem of libvncserver 0.9.9.
We can try downgrade to libvncserver 0.9.8
Hi hanzelpeter,

i compiled and installed the libvncserver 0.9.8.
You were right, with this Version everything is working :-)

Thank you,

Saboti

akoehler
Posts: 1
Joined: Tue Oct 01, 2013 7:20 pm

Re: Dispmanx VNC Server

Tue Oct 01, 2013 7:25 pm

Hi Peter,
i´ve activated the vnc server in xbmc. connecting to the xbmc via vnc is possible, but no input is possible, no keystrokes or mouse input works.
Can you give me a hint? I´ve tried it with tight vnc viewer and an android vnc tool.
Any idea?
How can analyze this?

My System is in Version
3.10.13#2

User avatar
hanzelpeter
Posts: 72
Joined: Mon Jul 09, 2012 11:56 am

Re: Dispmanx VNC Server

Wed Oct 02, 2013 7:35 am

Hello.

I have some issue when evdev kernel module is not loaded. So you need to somehow try:

Code: Select all

sudo modprobe evdev

yozh
Posts: 10
Joined: Sun Oct 20, 2013 7:31 pm

Re: Dispmanx VNC Server

Sun Oct 20, 2013 7:35 pm

Hi,

I have a need to run VNC server on my openelec install. I tried doing everything in this tread and got this while running on the openelec box.

penELECrpi:~/vnc # ./dispman_vncserver
Open display[0]...
Display is 1920 x 1080
Server bpp:16
Server bigEndian:0
Server redShift:0
Server blueShift:10
Server greeShift:5
20/10/2013 15:34:13 Listening for VNC connections on TCP port 5900
20/10/2013 15:34:13 Listening for VNC connections on TCP6 port 5900
open /dev/uinput returned -1.
First write returned -1.
ioctl UI_DEV_CREATE returned -1.
Error create uinput device -1.
OpenELECrpi:~/vnc #


Can some one help me please ?

User avatar
hanzelpeter
Posts: 72
Joined: Mon Jul 09, 2012 11:56 am

Re: Dispmanx VNC Server

Mon Oct 21, 2013 8:31 am

Hello.

Look for file /dev/uinput. When it is present try to run dispmanx_vcnserver with

Code: Select all

sudo dispmanx_vncserver

If not present try

Code: Select all

modprobe uinput.
.

You can also check in /dev/uinput is not in /dev/misc/uinput or somewhere else in /dev folder.

User avatar
michaelm
Posts: 8
Joined: Sat Feb 28, 2015 6:41 pm
Location: UK

Re: Dispmanx VNC Server

Sat Feb 28, 2015 7:20 pm

hanzelpeter wrote:Hello.

I have created github project on it.
Check this: https://github.com/hanzelpeter/dispmanx_vnc
We can start on collaborate. In this version also first mouse draft is done.
hanzelpeter, I created an account here just to say thanks for this project - it's exactly what I was looking for! I'm only able to manage 1-3fps for the opengl teapot on a B+, but if I find any issues or performance improvements I'll re-post here.

Thanks again,
Michael.
General tech enthusiast

Naiw
Posts: 5
Joined: Sun Mar 08, 2015 12:44 am

Re: Dispmanx VNC Server

Sun Mar 08, 2015 12:53 am

I just discovered this as well kind of ironic considering the time I had the RPI, but before the RPI had it's own keyboard and monitor, and due to some recent purchases of other mini board computers it been dispatched into the darkest of closets.

And while i haven't been using it a lot since, the part I missed was playing around with video core and in particular GLES.
So when I begun looking around I found this and decided to try it out...

And it did exactly what I needed although some what slow, so I spent some hour to optimise the "TakeScreenShot" method somewhat (I still haven't really bothered change the bounding box code other than rewriting it to use 32 bit moves) as I rewrote the actual "blit" loop to use 32 bit as well, so far I got it to be about 2-4 fps faster depending on circumstance.

Still playing around with optimisations though....

Oh and btw there is no need to repackage the pixels for the 555 format, just set the redShift/blueShift/greenShift accordingly on the serverInfo.

This is an recording I did of my tweaked version (I also wrote a sysvinit script that launches the VNC server at boot time), should probably modify it some to not use CPU unless there is a client attached etc too, but right now its just been quite low hanging changes.

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

User avatar
AndyD
Posts: 2331
Joined: Sat Jan 21, 2012 8:13 am
Location: Melbourne, Australia
Contact: Website

Re: Dispmanx VNC Server

Sun Mar 08, 2015 3:00 am

Naiw wrote:I just discovered this as well kind of ironic considering the time I had the RPI, but before the RPI had it's own keyboard and monitor, and due to some recent purchases of other mini board computers it been dispatched into the darkest of closets.

And while i haven't been using it a lot since, the part I missed was playing around with video core and in particular GLES.
So when I begun looking around I found this and decided to try it out...

And it did exactly what I needed although some what slow, so I spent some hour to optimise the "TakeScreenShot" method somewhat (I still haven't really bothered change the bounding box code other than rewriting it to use 32 bit moves) as I rewrote the actual "blit" loop to use 32 bit as well, so far I got it to be about 2-4 fps faster depending on circumstance.

Still playing around with optimisations though....

Oh and btw there is no need to repackage the pixels for the 555 format, just set the redShift/blueShift/greenShift accordingly on the serverInfo.

This is an recording I did of my tweaked version (I also wrote a sysvinit script that launches the VNC server at boot time), should probably modify it some to not use CPU unless there is a client attached etc too, but right now its just been quite low hanging changes.

https://www.youtube.com/watch?v=yrUoAZ6AlCo
Are you willing and/or able to put your changes online somewhere?

Naiw
Posts: 5
Joined: Sun Mar 08, 2015 12:44 am

Re: Dispmanx VNC Server

Sun Mar 08, 2015 6:34 am

AndyD wrote: Are you willing and/or able to put your changes online somewhere?
Of course, I still modify and experiment around this heavily.

It's important to use hextile encoding (and a good network connection) to get some decent performance the others tax the CPU too heavily.

I branched hanzelpeter's repository here.

https://github.com/Na1w/dispmanx_vnc.git

User avatar
AndyD
Posts: 2331
Joined: Sat Jan 21, 2012 8:13 am
Location: Melbourne, Australia
Contact: Website

Re: Dispmanx VNC Server

Sun Mar 08, 2015 12:18 pm


Naiw
Posts: 5
Joined: Sun Mar 08, 2015 12:44 am

Re: Dispmanx VNC Server

Tue Mar 31, 2015 9:00 am

Just writing a short message to notify that lots are happening on this project at the moment.

Patrik Olausson refactored and cleaned up a significant amount of the code, added support for resolution changing and tons of other things.
Personally my RPi got damaged when I transported it (the SD card holder got severely damaged and is unable to hold a SD card in place any more) so I hadn't done a lot in the recent weeks, however as I got several pull requests all of sudden I bought a RPi 2 and began collaborating again. (So far I've just done minor stuff though compared to the amount of work Patrik did), that will change soon though- I promise :)
The downside is as it appears non of us got any old RPi still, it's probably a question of time before compatibility is lost with the old RPi.

If anyone missed the repo it's still at https://github.com/Na1w/dispmanx_vnc or https://github.com/patrikolausson/dispmanx_vnc if you want to use Patrik's repo.

User avatar
AndyD
Posts: 2331
Joined: Sat Jan 21, 2012 8:13 am
Location: Melbourne, Australia
Contact: Website

Re: Dispmanx VNC Server

Tue Mar 31, 2015 3:00 pm

Thanks for the update Naiw.

FYI I still have original Raspberry Pi Bs (rev 1 and rev 2) in my working collection. I can confirm your code is still working on my Model B rev 2 (Revision 000f). I compiled it up using g++4.8

I don't like using update-alternatives, but it is easy enough to compile using:-

Code: Select all

make CC=g++-4.8
(P.S. The C++ compiler should really be CXX rather than CC).

Naiw
Posts: 5
Joined: Sun Mar 08, 2015 12:44 am

Re: Dispmanx VNC Server

Tue Mar 31, 2015 9:47 pm

AndyD, of course you're right it should be CXX by convention (I forgot to change when I modified the Makefile for c++).

Yes, I assumed it would work on the old RPis now, I'm rewriting some stuff to use assembly however and that's what worries me could cause compatibility issues with the old RPi- I really want to change the change detection/Blitting to use Neon but that would really be a no go on the old RPi, so currently I'm experimenting with regular ARM assembly and attempt using the barrel shifter in an efficient way.

Speaking of which it's too bad valgrind/callgrind doesn't work any good on the RPi due to some god damned reason they decided to use bigendian in libconfi_rpi, I haven't decided if time is best spent attempting to rewrite that or keep on using gprof.

User avatar
AndyD
Posts: 2331
Joined: Sat Jan 21, 2012 8:13 am
Location: Melbourne, Australia
Contact: Website

Re: Dispmanx VNC Server

Tue Mar 31, 2015 10:10 pm

Naiw wrote:Yes, I assumed it would work on the old RPis now, I'm rewriting some stuff to use assembly however and that's what worries me could cause compatibility issues with the old RPi- I really want to change the detection/Blitting to use Neon but that would really be a no go on the old RPi, so currently I'm experimenting with regular ARM assembly and attempt using the barrel shifter in an efficient way.
You could always load different code based on the model. Obviously it is up to you if you want to maintain compatibility or not.
Naiw wrote:Speaking of which it's too bad valgrind/callgrind doesn't work any good on the RPi due to some god damned reason they decided to use bigendian in libconfi_rpi, I haven't decided if time is best spent attempting to rewrite that or keep on using gprof.
That is interesting to know. I haven't tried valgrind on the Raspberry Pi (not seriously at least). I didn't know hat was the problem.

Return to “Graphics programming”