Lomax
Posts: 189
Joined: Wed May 20, 2015 9:43 pm

Oculus Rift CV1 compatibility

Wed May 01, 2019 11:42 pm

Somewhat naively I thought it would be pretty much a "plug'n'play" operation to at least get a picture displaying on an Oculus Rift CV1 VR headset. Hours later and I haven't managed to get a single pixel to light up. Haven't been able to find much info on the Internet either; I found some blog posts about using the DK1/2, but it seems no one has tried using the CV1 with a Pi?

I read somewhere that Oculus withdrew Linux support after being bought by faceboot, but there is the OpenHMD library which I've just compiled on a Pi 3 B+. When running the example provided the Rift was detected and I could see the gyro/accelerometer/magnetometer data in real time - a definite YES! moment, though the displays remained pitch black.

It seems likely that this is due to incorrect HDMI settings in /boot/config.txt but I'm not having much luck figuring out the right settings for the CV1. I'm using the following DK2 settings, copied from Wayne Keenan:

Code: Select all

hdmi_timings=1080 1 33 10 15 1920 1 1 1 13 0 0 0 75 0 165000000 3
hdmi_group=2
hdmi_mode=87
max_framebuffer_width=1080
max_framebuffer_height=1920
display_rotate=3
hdmi_ignore_edid=0xa5000080
hvs_priority=0x32ff
hdmi_pixel_freq_limit=400000000


This doesn't work of course, since the DK2 has completely different displays to the CV1. But interestingly, after adding this and rebooting, the previously always yellow "stand-by" LED indication turned into a white "active" when running the OpenHMD example. I took this to be a promising sign, and set about trying to read the EDID of the CV1 directly, but:

Code: Select all

$ get-edid
This is read-edid version 3.0.2. Prepare for some fun.
Attempting to use i2c interface
Looks like no busses have an EDID. Sorry!
I'm sorry nothing was successful. Maybe try some other arguments


I think I read somewhere that the Oculus Rift doesn't behave as a "normal" HDMI display, which might explain the get-edid fail - but I really need this data in order to generate my own hdmi_timings. Or maybe not? I'm hoping someone here might recognise the issue and point me in the right direction - because my compass is spinning somewhat helplessly at the moment...

Edit: I just had a flicker of life from the displays! For a brief moment I was able to see vertical lines of seemingly random colours across 2/3 of the field of view. It lasted no more than a few seconds, before the displays went black again. But it was great to see something, however buggy and brief. This reinforces my belief that all I'm missing are the correct hdmi_timings etc.

Lomax
Posts: 189
Joined: Wed May 20, 2015 9:43 pm

Re: Oculus Rift CV1 compatibility

Fri May 03, 2019 2:50 pm

I finally found some timing data on the Oculus Rift CV1:
Pixel Clock: 296.75MHz
Horizontal Active: 2160
Horizontal Blanking: 80
Vertical Active: 1200
Vertical Blanking: 272
Horizontal Sync Offset: 8
Horizontal Sync Pulse: 32
Vertical Sync Offset: 50
Vertical Sync Pulse: 2
Horizontal Display Size: 119
Vertical Display Size: 66
Horizontal Border: 0
Vertical Border: 0
Interlaced: false
Stereo Mode: 0
Sync Type: 3

That are 3.297.280 pixel @ 296.75 MHz which gives the 90 Hz refresh rate advertised by Oculus.


But how do I translate this into a RasPi hdmi_timings string?
hdmi_timings=<h_active_pixels> <h_sync_polarity> <h_front_porch> <h_sync_pulse> <h_back_porch> <v_active_lines> <v_sync_polarity> <v_front_porch> <v_sync_pulse> <v_back_porch> <v_sync_offset_a> <v_sync_offset_b> <pixel_rep> <frame_rate> <interlaced> <pixel_freq> <aspect_ratio>

6by9
Raspberry Pi Engineer & Forum Moderator
Raspberry Pi Engineer & Forum Moderator
Posts: 7568
Joined: Wed Dec 04, 2013 11:27 am
Location: ZZ9 Plural Z Alpha, aka just outside Cambridge.

Re: Oculus Rift CV1 compatibility

Fri May 03, 2019 3:38 pm

It's probably easier to post the EDID somewhere for analysis. Even if the display won't display the Pi output, then "tvservice -d edid.dat" should still save the relevant data to edid.dat.

From a bit of guesswork with your quoted timing info, I'd go for:

Code: Select all

hdmi_timings=2160 0 8 32 80 1200 0 50 2 272 0 0 0 90 0 29675000 1
Reference is viewtopic.php?f=29&t=24679

Note that the normal maximum resolution is 1920x1080 @ 60Hz. 2160x1200 @ 90Hz is therefore exceeding the normal maximum pixel rate that the Pi can produce (nominally 250MHz IIRC). The display may or may not accept a lower pixel rate, or there are ways to overclock the Pi HDMI block - results there can be mixed.
Software Engineer at Raspberry Pi Trading. Views expressed are still personal views.
I'm not interested in doing contracts for bespoke functionality - please don't ask.

Lomax
Posts: 189
Joined: Wed May 20, 2015 9:43 pm

Re: Oculus Rift CV1 compatibility

Sat May 04, 2019 11:10 am

Many thanks 6by9, I hadn't tried the tvservice command. Alas the output seems wildly incorrect:

Code: Select all

$ tvservice -d edid.dat
Written 256 bytes to edid.dat

$ parse-edid < edid.dat
Checksum Correct

Section "Monitor"
	Identifier "SyncMaster"
	ModelName "SyncMaster"
	VendorName "SAM"
	# Monitor Manufactured week 13 of 2009
	# EDID version 1.3
	# Digital Display
	DisplaySize 160 90
	Gamma 2.20
	Option "DPMS" "false"
	Horizsync 26-81
	VertRefresh 24-75
	# Maximum pixel clock is 230MHz
	#Not giving standard mode: 1152x864, 75Hz
	#Not giving standard mode: 1280x800, 60Hz
	#Not giving standard mode: 1280x960, 60Hz
	#Not giving standard mode: 1280x1024, 60Hz
	#Not giving standard mode: 1440x900, 60Hz
	#Not giving standard mode: 1440x900, 75Hz
	#Not giving standard mode: 1600x1200, 60Hz
	#Not giving standard mode: 1680x1050, 60Hz

	#Extension block found. Parsing...
	Modeline 	"Mode 13" +hsync +vsync interlace
	Modeline 	"Mode 0" +hsync +vsync 
	Modeline 	"Mode 1" +hsync +vsync 
	Modeline 	"Mode 2" 74.250 1280 1720 1760 1980 720 725 730 750 +hsync +vsync
	Modeline 	"Mode 3" 74.250 1280 1390 1420 1650 720 725 730 750 +hsync +vsync
	Modeline 	"Mode 4" 74.250 1920 2008 2052 2200 1080 1082 1087 1125 +hsync +vsync interlace
	Modeline 	"Mode 5" 74.250 1920 2448 2492 2640 1080 1082 1089 1125 +hsync +vsync interlace
	Modeline 	"Mode 6" 27.027 720 736 798 858 480 489 495 525 -hsync -vsync
	Modeline 	"Mode 7" 27.000 720 732 796 864 576 581 586 625 -hsync -vsync
	Modeline 	"Mode 8" 148.500 1920 2008 2052 2200 1080 1084 1089 1125 +hsync +vsync
	Modeline 	"Mode 9" 148.500 1920 2448 2492 2640 1080 1084 1089 1125 +hsync +vsync
	Modeline 	"Mode 10" 74.250 1920 2558 2602 2750 1080 1084 1089 1125 +hsync +vsync
	Modeline 	"Mode 11" 74.250 1920 2448 2492 2640 1080 1084 1089 1125 +hsync +vsync
	Modeline 	"Mode 12" 74.250 1920 2008 2052 2200 1080 1084 1089 1125 +hsync +vsync
	Modeline 	"Mode 14" +hsync +vsync interlace
	Modeline 	"Mode 15" +hsync +vsync 
	Modeline 	"Mode 16" -hsync -vsync 
	Option "PreferredMode" "Mode 13"
EndSection


It appears the Rift identifies itself as a "SyncMaster", with no 90Hz refresh or matching resolution listed? Odd. And using the hdmi_timings string you kindly provided doesn't work at all; I just get the orange "standby" LED, with no sign of the white "active" which I got with the DK2 string (1080 1 33 10 15 1920 1 1 1 13 0 0 0 75 0 165000000 3).

Here's what I have in boot.config:

Code: Select all

hdmi_timings=2160 0 8 32 80 1200 0 50 2 272 0 0 0 90 0 29675000 1
hdmi_group=2
hdmi_mode=87
max_framebuffer_width=2160
max_framebuffer_height=1200
hdmi_ignore_edid=0xa5000080
hvs_priority=0x32ff
hdmi_pixel_freq_limit=400000000
gpu_mem=256

Lomax
Posts: 189
Joined: Wed May 20, 2015 9:43 pm

Re: Oculus Rift CV1 compatibility

Sun May 05, 2019 3:28 pm

I am such an idiot sometimes... The weird SyncMaster EDID data likely appeared because I've explicitly told the Pi to ignore actual EDID data by having hdmi_ignore_edid=0xa5000080 in /boot/config.txt :lol:

I commented out all my HDMI related settings in the config and rebooted - but now tvservice doesn't see any EDID at all:

Code: Select all

$ tvservice -d edid.dat
Nothing written!


Annoying, but not all that surprising since the Oculus Rift doesn't behave like a normal monitor. I've subsequently done another trawl of the net, using both DuckDuckGo and Google, with a variety of related search terms, but still haven't been able to find any better information on the Rift's HDMI specs than what I posted above.

Lomax
Posts: 189
Joined: Wed May 20, 2015 9:43 pm

Re: Oculus Rift CV1 compatibility

Sun May 05, 2019 7:42 pm

Some further developments. I figured I'd try with some common display mode that the Rift might support and set /boot/config.txt to

Code: Select all

hdmi_drive=2
hdmi_force_hotplug=1
hdmi_group=1
hdmi_mode=16


which should mean [email protected] But while I do get a response from the Rift with this setting (the LED turns white) there's no sign of any actual picture. Then I had a brainwave and figured I'd check if the EDID is readable when the Rift is "active", and bingo, there it was! parse-edid was unable to parse the data though, complaining about no video blocks being present. I also tried edidparser which gave no errors but few details:

Code: Select all

$ tvservice -d edid.dat
Written 256 bytes to edid.dat

$ parse-edid < edid.dat 
Checksum Correct

Section "Monitor"
	Identifier "Rift"
	ModelName "Rift"
	VendorName "OVR"
	# Monitor Manufactured week 10 of 2015
	# EDID version 1.3
	# Digital Display
	# Display Physical Size not given. Normal for projectors.
	Gamma 2.20
	Option "DPMS" "true"
	Horizsync 30-150
	VertRefresh 56-120
	# Maximum pixel clock is 320MHz

	#Extension block found. Parsing...
extb[4]: 0x68 (0x60)
Hmm, you have data blocks, but not video ones... weird
Something strange happened. Please contact the author,
Matthew Kern at <[email protected]>

$ edidparser edid.dat 
Enabling fuzzy format match...
Parsing edid.dat...
HDMI:EDID version 1.3, 1 extensions, unknown aspect ratio
HDMI:EDID features - videodef 0x80 standby suspend active off; colour encoding:RGB444; sRGB is not default colourspace; preferred format is native; does not support GTF
HDMI:EDID found monitor name descriptor tag 0xfc
HDMI:EDID monitor name is Rift
HDMI:EDID found monitor S/N descriptor tag 0xff
HDMI:EDID found monitor range descriptor tag 0xfd
HDMI:EDID monitor range offsets: V min=0, V max=0, H min=0, H max=0
HDMI:EDID monitor range: vertical is 56-120 Hz, horizontal is 30-150 kHz, max pixel clock is 320 MHz
HDMI:EDID monitor range does not support GTF
HDMI:EDID failed to find a matching detail format for 2160x1200p hfp:8 hs:32 hbp:40 vfp:50 vs:2 vbp:220 pixel clock:296 MHz
HDMI:EDID calculated refresh rate is 90 Hz
HDMI:EDID guessing the format to be 2160x1200p @85 Hz
HDMI:EDID found unknown detail timing format: 2160x1200p hfp:8 hs:32 hbp:40 vfp:50 vs:2 vbp:220 pixel clock:296 MHz
HDMI:EDID established timing I/II bytes are 00 00 00
HDMI:EDID standard timings block x 8: 0x0101 0101 0101 0101 0101 0101 0101 0101 
HDMI:EDID parsing v3 CEA extension 0
HDMI:EDID monitor support - underscan IT formats:no, basic audio:no, yuv444:no, yuv422:no, #native DTD:0
HDMI:EDID found HDMI VSDB length 8
HDMI:EDID HDMI VSDB has physical address 1.0.0.0
HDMI:EDID HDMI VSDB supports AI:no, dual link DVI:no
HDMI:EDID HDMI VSDB deep colour support - 48-bit:no 36-bit:no 30-bit:no DC_yuv444:no
HDMI:EDID HDMI VSDB max TMDS clock 300 MHz
HDMI:EDID HDMI VSDB does not support content type
HDMI:EDID adding mandatory support for DMT (4) 640x480p @ 60Hz
HDMI:EDID adding mandatory support for CEA (1) 640x480p @ 60Hz
HDMI:EDID filtering formats with pixel clock > 162 MHz or h. blanking > 1023
HDMI:EDID no known preferred format has been set
HDMI:EDID filtering preferred group has been changed from Invalid to CEA
HDMI:EDID best score mode initialised to CEA (1) 640x480p @ 60 Hz with pixel clock 25 MHz (score 0)
HDMI:EDID best score mode is now CEA (1) 640x480p @ 60 Hz with pixel clock 25 MHz (score 61864)
HDMI:EDID DMT mode (4) 640x480p @ 60 Hz with pixel clock 25 MHz has a score of 18432
HDMI:EDID preferred mode is updated to CEA (1) 640x480p @ 60 Hz with pixel clock 25200000 Hz
HDMI:EDID has HDMI support and no audio support
edidparser exited with code 0


The raw EDID data file is attached, in case anyone wants to take a look
Attachments
cv1_edid.dat.zip
(285 Bytes) Downloaded 22 times

Lomax
Posts: 189
Joined: Wed May 20, 2015 9:43 pm

Re: Oculus Rift CV1 compatibility

Sun May 05, 2019 9:26 pm

Another update: Just to verify the basic approach to getting the Rift to work at all on Linux (i.e. using OpenHMD) I did a quick test with a Devuan live USB stick on a spare laptop. Sure enough, after downloading and building OpenHMD (and dependencies), the "simple" example they provide fired up the Rift's displays, showing a clone of the main display. So this should also work on the Pi, apart from the resolution/refresh rate/pixel clock limitation. Hmmm.

Lomax
Posts: 189
Joined: Wed May 20, 2015 9:43 pm

Re: Oculus Rift CV1 compatibility

Mon May 06, 2019 11:23 am

I'll have to give up on using a Pi for this. I'm guessing an Odroid C2 would be able to provide the required bandwidth? It does HDMI 2.0 [email protected] Hz. We're only going to use the Rift for stereoscopic 360° video playback, so 3D performance is pretty irrelevant.

Edit: I've now ordered an MSI "Cubi N" mini-PC with a Celeron N4000 CPU, which includes Intel's latest integrated "UHD 600" graphics. This should be quite good enough for our application. Cost £200 with 4Gb RAM and 32Gb SSD built in, so not too costly. Just a shame it couldn't be done on a Pi.
MSI Cubi N is equipped with a Intel® Gemini Lake processor which improves the decoding technology to support HEVC (H.265) decoding to provide substantially improved video quality and brings whole new ultra-realistic visuals. With Cubi N, you can experience the high quality of 4K UHD.

Return to “Graphics, sound and multimedia”