HDMI output to Oculus DK2

Raspberry Pi cameras (V1, V2, wide angle etc), HDMI capture modules etc.
Post Reply
iPutBack
Posts: 1
Joined: Sat Jan 21, 2023 5:25 pm

HDMI output to Oculus DK2

Post by iPutBack »

Hi everyone,

I have been trying for several hours to display the output of the two cameras (or even a single camera in 2D mode) to an Oculus DK2. I have found configuration parameters for the headset that are supposed to work on raspbian (see for instance this and this).

My current config.txt file is the following:

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

config_hdmi_boost=4

max_framebuffer_width=1080
max_framebuffer_height=1920
display_rotate=3
hdmi_force_hotplug=1
#hdmi_ignore_edid=0xa5000080
hvs_priority=0x32ff
hdmi_pixel_freq_limit=400000000

dtparam=audio=on
disable_overscan=1

[pi4]
dtoverlay=vc4-fkms-v3d
max_framebuffers=2

[all]
gpu_mem=256
start_x=1
dtoverlay=pi3-disable-bt
dtoverlay=dwc2,dr_mode=host

The DK2 displays the stereopi logo for a few seconds, then black screen and LED is orange.

The TFT screen is working, preview option is on, 2D and 3D modes have been tried. Seems like the TFT screen is the one that has been resized by the parameters (it is more narrow and stretched than usual).
Taking a picture using raspistill in the console leads to an ENOSPC error (mmal: mmal_vc_component_enable: failed to enable component: ENOSPC).


I don't know what I am missing.

User avatar
Realizator
Site Admin
Posts: 900
Joined: Tue Apr 16, 2019 9:23 am
Contact:

Re: HDMI output to Oculus DK2

Post by Realizator »

Hi iPutBack,

I have no DK2 nearby to test, so I can't confirm the settings. Did you happen to try to test this config using regular Raspberry Pi 4? (Pi3 is not good, but RPi4 has the same CPU as CM4).

ENOSPC means insufficient video memory; you can try to increase GPU MEM in config.txt Also, did you stop SLP2 scripts over console before doing raspistill?

By the way, which StereoPi do you have? I guess it's V2 with CM4 (due to "dtoverlay=dwc2,dr_mode=host" in your config file).

A few notes on your settings:
NOTE 1:
hdmi_timings=1080 1 33 10 15 1920 1 1 1 13 0 0 0 75 0 165000000 3
If you look at hdmi_timings section here https://www.raspberrypi.com/documentati ... g_txt.html, you can find that in your case:

<h_active_pixels> = 1080 horizontal pixels (width)
<h_front_porch> = 33 horizontal forward padding from DE active edge
<h_back_porch> = 15 horizontal back padding from DE active edge
<v_active_lines> = 1920 vertical pixels height (lines)
<v_front_porch> = 1 vertical forward padding from DE active edge
<v_back_porch> = 13 vertical back padding from DE active edge
<frame_rate> = 75
<pixel_freq> = 165000000

So:
<pixel_freq> = (<h_active_pixels>+<h_front_porch>+<h_back_porch>) * (<v_active_lines>+<v_front_porch>+<v_back_porch>) * <frame_rate> =
(1080+33+15) * (1920 + 1 + 13) * 75 = 1128 * 1934 * 75 = 163616400
And you have 165000000. In my experiments with other custom HDMI screens, this parameter ruined the output if miscalculated.

If you are not sure which data to use, download EDID using
/opt/vc/bin/tvservice -d edid.dat; /opt/vc/bin/edidparser edid.dat (details). This trick helped me a lot with custom HDMI screens.

NOTE 2:
Looks like DK2 has not the 1920x1080, but 1080x1920 resolution. This mobile-like screen orientation ruined one of our first experiments. The screen rotation decreases FPS a lot. I see "display_rotate=3" in your settings, it means you try to rotate it. Technically it will work, but with artefacts and low FPS.
BTW "display_rotate" is deprecated...

NOTE 3:
Our search of horizontally oriented screen led us to this item. Yes, it's bulky and need a 3D printed case, as well as plastic gear with lenses like this one. But it finally works with custom settings and resolution 1440x1440 per eye, or 2880x1440 as the total HDMI output resolution.
IMG_6655.jpeg
IMG_6655.jpeg (2.81 MiB) Viewed 6301 times
Eugene a.k.a. Realizator

Post Reply