alvr-org / ALVR

Stream VR games from your PC to your headset via Wi-Fi
MIT License
5.17k stars 470 forks source link

Pico 4/Linux: flashing gray lines #1579

Closed rhaamo closed 6 months ago

rhaamo commented 1 year ago

Description

Cannot get video, only flashing gray lines/screen. SteamVR always ask for room calibration on every launch, after it is done, the VR View shows something, but headset continues to show garbage. The headset and controller tracking is however properly transmitted, if I launch VRChat for example, they can be used for control, but no video on headset only on computer.

ALVR is default config except logging to disk, log: alvr_session_log.txt

General Troubleshooting

Environment

Hardware

hw-probe: https://linux-hardware.org/?probe=2d599510b8 CPU: Ryzen 7 5700X GPU: Intel Arc A770 Audio: pipewire

Installation

ALVR Version: v20.0.0-dev10+nightly.2023.04.12 on both computer and headset Still happens with v20.0.0-dev11+nightly.2023.04.14

SteamVR Version: 1.25.7

Install Type:

OS Name and Version: Manjaro with mesa-freeworld, same issue under Archlinux

Vixea commented 1 year ago

can you run vainfo for me

rhaamo commented 1 year ago
Trying display: wayland
Trying display: x11
vainfo: VA-API version: 1.18 (libva 2.17.1)
vainfo: Driver version: Intel iHD driver for Intel(R) Gen Graphics - 23.1.0 ()
vainfo: Supported profile and entrypoints
      VAProfileNone                   : VAEntrypointVideoProc
      VAProfileNone                   : VAEntrypointStats
      VAProfileMPEG2Simple            : VAEntrypointVLD
      VAProfileMPEG2Main              : VAEntrypointVLD
      VAProfileH264Main               : VAEntrypointVLD
      VAProfileH264Main               : VAEntrypointEncSliceLP
      VAProfileH264High               : VAEntrypointVLD
      VAProfileH264High               : VAEntrypointEncSliceLP
      VAProfileJPEGBaseline           : VAEntrypointVLD
      VAProfileJPEGBaseline           : VAEntrypointEncPicture
      VAProfileH264ConstrainedBaseline: VAEntrypointVLD
      VAProfileH264ConstrainedBaseline: VAEntrypointEncSliceLP
      VAProfileHEVCMain               : VAEntrypointVLD
      VAProfileHEVCMain               : VAEntrypointEncSliceLP
      VAProfileHEVCMain10             : VAEntrypointVLD
      VAProfileHEVCMain10             : VAEntrypointEncSliceLP
      VAProfileVP9Profile0            : VAEntrypointVLD
      VAProfileVP9Profile0            : VAEntrypointEncSliceLP
      VAProfileVP9Profile1            : VAEntrypointVLD
      VAProfileVP9Profile1            : VAEntrypointEncSliceLP
      VAProfileVP9Profile2            : VAEntrypointVLD
      VAProfileVP9Profile2            : VAEntrypointEncSliceLP
      VAProfileVP9Profile3            : VAEntrypointVLD
      VAProfileVP9Profile3            : VAEntrypointEncSliceLP
      VAProfileHEVCMain12             : VAEntrypointVLD
      VAProfileHEVCMain422_10         : VAEntrypointVLD
      VAProfileHEVCMain422_12         : VAEntrypointVLD
      VAProfileHEVCMain444            : VAEntrypointVLD
      VAProfileHEVCMain444            : VAEntrypointEncSliceLP
      VAProfileHEVCMain444_10         : VAEntrypointVLD
      VAProfileHEVCMain444_10         : VAEntrypointEncSliceLP
      VAProfileHEVCMain444_12         : VAEntrypointVLD
      VAProfileHEVCSccMain            : VAEntrypointVLD
      VAProfileHEVCSccMain            : VAEntrypointEncSliceLP
      VAProfileHEVCSccMain10          : VAEntrypointVLD
      VAProfileHEVCSccMain10          : VAEntrypointEncSliceLP
      VAProfileHEVCSccMain444         : VAEntrypointVLD
      VAProfileHEVCSccMain444         : VAEntrypointEncSliceLP
      VAProfileAV1Profile0            : VAEntrypointVLD
      VAProfileAV1Profile0            : VAEntrypointEncSliceLP
      VAProfileHEVCSccMain444_10      : VAEntrypointVLD
      VAProfileHEVCSccMain444_10      : VAEntrypointEncSliceLP
Vixea commented 1 year ago

ah, intel we don't exactly support intel but why not try.

Vixea commented 1 year ago

can I see you settings json?

rhaamo commented 1 year ago
{
  "server_version": "20.0.0-dev11+nightly.2023.04.14",
  "drivers_backup": null,
  "openvr_config": {
    "eye_resolution_width": 2144,
    "eye_resolution_height": 2336,
    "target_eye_resolution_width": 2144,
    "target_eye_resolution_height": 2336,
    "tracking_ref_only": false,
    "enable_vive_tracker_proxy": false,
    "aggressive_keyframe_resend": false,
    "adapter_index": 0,
    "codec": 0,
    "refresh_rate": 72,
    "use_10bit_encoder": false,
    "enable_vbaq": false,
    "use_preproc": false,
    "preproc_sigma": 4,
    "preproc_tor": 7,
    "amd_encoder_quality_preset": 2,
    "rate_control_mode": 0,
    "filler_data": false,
    "entropy_coding": 1,
    "force_sw_encoding": false,
    "sw_thread_count": 0,
    "controllers_mode_idx": 7,
    "controllers_enabled": true,
    "override_trigger_threshold": false,
    "trigger_threshold": 0.0,
    "override_grip_threshold": false,
    "grip_threshold": 0.0,
    "enable_foveated_rendering": true,
    "foveation_center_size_x": 0.4,
    "foveation_center_size_y": 0.35,
    "foveation_center_shift_x": 0.4,
    "foveation_center_shift_y": 0.1,
    "foveation_edge_ratio_x": 4.0,
    "foveation_edge_ratio_y": 5.0,
    "enable_color_correction": true,
    "brightness": 0.0,
    "contrast": 0.0,
    "saturation": 0.5,
    "gamma": 1.0,
    "sharpening": 0.0,
    "linux_async_reprojection": false,
    "nvenc_quality_preset": 1,
    "nvenc_tuning_preset": 2,
    "nvenc_multi_pass": 1,
    "nvenc_adaptive_quantization_mode": 1,
    "nvenc_low_delay_key_frame_scale": -1,
    "nvenc_refresh_rate": -1,
    "enable_intra_refresh": false,
    "intra_refresh_period": -1,
    "intra_refresh_count": -1,
    "max_num_ref_frames": -1,
    "gop_length": -1,
    "p_frame_strategy": -1,
    "nvenc_rate_control_mode": -1,
    "rc_buffer_size": -1,
    "rc_initial_delay": -1,
    "rc_max_bitrate": -1,
    "rc_average_bitrate": -1,
    "nvenc_enable_weighted_prediction": false,
    "capture_frame_dir": ""
  },
  "client_connections": {
    "3369.client.alvr": {
      "display_name": "A8150",
      "current_ip": "192.168.10.71",
      "manual_ips": [],
      "trusted": true
    }
  },
  "session_settings": {
    "video": {
      "adapter_index": 0,
      "transcoding_view_resolution": {
        "Scale": 1.0,
        "Absolute": {
          "width": 2144,
          "height": {
            "set": false,
            "content": 1072
          }
        },
        "variant": "Absolute"
      },
      "emulated_headset_view_resolution": {
        "Scale": 1.0,
        "Absolute": {
          "width": 2144,
          "height": {
            "set": false,
            "content": 1072
          }
        },
        "variant": "Absolute"
      },
      "preferred_fps": 72.0,
      "max_buffering_frames": 1.5,
      "buffering_history_weight": 0.9,
      "bitrate": {
        "mode": {
          "ConstantMbps": 30,
          "Adaptive": {
            "saturation_multiplier": 0.95,
            "max_bitrate_mbps": {
              "enabled": false,
              "content": 100
            },
            "min_bitrate_mbps": {
              "enabled": false,
              "content": 5
            },
            "max_network_latency_ms": {
              "enabled": false,
              "content": 8
            },
            "decoder_latency_fixer": {
              "enabled": true,
              "content": {
                "max_decoder_latency_ms": 20,
                "latency_overstep_frames": 30,
                "latency_overstep_multiplier": 0.99
              }
            }
          },
          "variant": "Adaptive"
        },
        "adapt_to_framerate": {
          "enabled": true,
          "content": {
            "framerate_reset_threshold_multiplier": 2.0
          }
        }
      },
      "preferred_codec": {
        "variant": "H264"
      },
      "encoder_config": {
        "rate_control_mode": {
          "variant": "Cbr"
        },
        "filler_data": false,
        "entropy_coding": {
          "variant": "Cavlc"
        },
        "use_10bit": false,
        "nvenc": {
          "quality_preset": {
            "variant": "P1"
          },
          "tuning_preset": {
            "variant": "LowLatency"
          },
          "multi_pass": {
            "variant": "QuarterResolution"
          },
          "adaptive_quantization_mode": {
            "variant": "Spatial"
          },
          "low_delay_key_frame_scale": -1,
          "refresh_rate": -1,
          "enable_intra_refresh": false,
          "intra_refresh_period": -1,
          "intra_refresh_count": -1,
          "max_num_ref_frames": -1,
          "gop_length": -1,
          "p_frame_strategy": -1,
          "rate_control_mode": -1,
          "rc_buffer_size": -1,
          "rc_initial_delay": -1,
          "rc_max_bitrate": -1,
          "rc_average_bitrate": -1,
          "enable_weighted_prediction": false
        },
        "amf": {
          "quality_preset": {
            "variant": "Speed"
          },
          "enable_vbaq": false,
          "use_preproc": false,
          "preproc_sigma": 4,
          "preproc_tor": 7
        },
        "software": {
          "force_software_encoding": false,
          "thread_count": 0
        }
      },
      "mediacodec_extra_options": {
        "key": "",
        "value": {
          "Float": 0.0,
          "Int32": 0,
          "Int64": 0,
          "String": "",
          "variant": "Int32"
        },
        "content": [
          [
            "operating-rate",
            {
              "Float": 0.0,
              "Int32": 2147483647,
              "Int64": 0,
              "String": "",
              "variant": "Int32"
            }
          ],
          [
            "priority",
            {
              "Float": 0.0,
              "Int32": 0,
              "Int64": 0,
              "String": "",
              "variant": "Int32"
            }
          ],
          [
            "low-latency",
            {
              "Float": 0.0,
              "Int32": 1,
              "Int64": 0,
              "String": "",
              "variant": "Int32"
            }
          ],
          [
            "vendor.qti-ext-dec-low-latency.enable",
            {
              "Float": 0.0,
              "Int32": 1,
              "Int64": 0,
              "String": "",
              "variant": "Int32"
            }
          ]
        ]
      },
      "foveated_rendering": {
        "enabled": true,
        "content": {
          "center_size_x": 0.4,
          "center_size_y": 0.35,
          "center_shift_x": 0.4,
          "center_shift_y": 0.1,
          "edge_ratio_x": 4.0,
          "edge_ratio_y": 5.0
        }
      },
      "oculus_foveation_level": {
        "variant": "HighTop"
      },
      "dynamic_oculus_foveation": true,
      "color_correction": {
        "enabled": true,
        "content": {
          "brightness": 0.0,
          "contrast": 0.0,
          "saturation": 0.5,
          "gamma": 1.0,
          "sharpening": 0.0
        }
      }
    },
    "audio": {
      "linux_backend": {
        "variant": "Alsa"
      },
      "game_audio": {
        "enabled": false,
        "content": {
          "device": {
            "set": false,
            "content": {
              "NameSubstring": "",
              "Index": 0,
              "variant": "NameSubstring"
            }
          },
          "mute_when_streaming": true,
          "buffering": {
            "average_buffering_ms": 50,
            "batch_ms": 10
          }
        }
      },
      "microphone": {
        "enabled": false,
        "content": {
          "devices": {
            "Custom": {
              "sink": {
                "NameSubstring": "",
                "Index": 0,
                "variant": "NameSubstring"
              },
              "source": {
                "NameSubstring": "",
                "Index": 0,
                "variant": "NameSubstring"
              }
            },
            "variant": "Automatic"
          },
          "buffering": {
            "average_buffering_ms": 50,
            "batch_ms": 10
          }
        }
      }
    },
    "headset": {
      "emulation_mode": {
        "Custom": {
          "serial_number": "Unknown",
          "props": {
            "element": {
              "key": {
                "variant": "TrackingSystemName"
              },
              "value": {
                "Bool": false,
                "Float": 0.0,
                "Int32": 0,
                "Uint64": 0,
                "Vector3": [
                  0.0,
                  0.0,
                  0.0
                ],
                "Double": 0.0,
                "String": "",
                "variant": "String"
              }
            },
            "content": []
          }
        },
        "variant": "Quest2"
      },
      "extra_openvr_props": {
        "element": {
          "key": {
            "variant": "TrackingSystemName"
          },
          "value": {
            "Bool": false,
            "Float": 0.0,
            "Int32": 0,
            "Uint64": 0,
            "Vector3": [
              0.0,
              0.0,
              0.0
            ],
            "Double": 0.0,
            "String": "",
            "variant": "String"
          }
        },
        "content": []
      },
      "tracking_ref_only": false,
      "enable_vive_tracker_proxy": false,
      "eye_tracking_fb": false,
      "face_tracking_fb": false,
      "eye_expressions_htc": false,
      "lip_expressions_htc": false,
      "controllers": {
        "enabled": true,
        "content": {
          "emulation_mode": {
            "variant": "Quest2Touch"
          },
          "extra_openvr_props": {
            "element": {
              "key": {
                "variant": "TrackingSystemName"
              },
              "value": {
                "Bool": false,
                "Float": 0.0,
                "Int32": 0,
                "Uint64": 0,
                "Vector3": [
                  0.0,
                  0.0,
                  0.0
                ],
                "Double": 0.0,
                "String": "",
                "variant": "String"
              }
            },
            "content": []
          },
          "steamvr_pipeline_frames": 3.0,
          "linear_velocity_cutoff": 0.05,
          "angular_velocity_cutoff": 10.0,
          "left_controller_position_offset": [
            0.0,
            0.0,
            -0.11
          ],
          "left_controller_rotation_offset": [
            -20.0,
            0.0,
            0.0
          ],
          "left_hand_tracking_position_offset": [
            0.04,
            -0.02,
            -0.13
          ],
          "left_hand_tracking_rotation_offset": [
            0.0,
            -45.0,
            -90.0
          ],
          "trigger_threshold_override": {
            "enabled": false,
            "content": 0.1
          },
          "grip_threshold_override": {
            "enabled": false,
            "content": 0.1
          },
          "haptics": {
            "enabled": true,
            "content": {
              "intensity_multiplier": 1.0,
              "amplitude_curve": 1.0,
              "min_duration_s": 0.01
            }
          }
        }
      },
      "position_recentering_mode": {
        "Local": {
          "view_height": 1.5
        },
        "variant": "LocalFloor"
      },
      "rotation_recentering_mode": {
        "variant": "Yaw"
      }
    },
    "connection": {
      "client_discovery": {
        "enabled": true,
        "content": {
          "auto_trust_clients": false
        }
      },
      "web_server_port": 8082,
      "stream_protocol": {
        "variant": "Udp"
      },
      "server_send_buffer_bytes": {
        "Custom": 100000,
        "variant": "Maximum"
      },
      "server_recv_buffer_bytes": {
        "Custom": 100000,
        "variant": "Maximum"
      },
      "client_send_buffer_bytes": {
        "Custom": 100000,
        "variant": "Maximum"
      },
      "client_recv_buffer_bytes": {
        "Custom": 100000,
        "variant": "Maximum"
      },
      "stream_port": 9944,
      "aggressive_keyframe_resend": false,
      "on_connect_script": "",
      "on_disconnect_script": "",
      "packet_size": 1400,
      "statistics_history_size": 256,
      "disconnection_criteria": {
        "enabled": false,
        "content": {
          "latency_threshold_ms": 150,
          "sustain_duration_s": 3
        }
      }
    },
    "logging": {
      "log_to_disk": true,
      "log_tracking": false,
      "log_button_presses": false,
      "log_haptics": false,
      "notification_level": {
        "variant": "Debug"
      },
      "show_raw_events": true
    },
    "steamvr_launcher": {
      "driver_launch_action": {
        "variant": "UnregisterOtherDriversAtStartup"
      },
      "open_close_steamvr_with_dashboard": false
    },
    "capture": {
      "save_video_stream": false,
      "capture_frame_dir": ""
    },
    "patches": {
      "linux_async_reprojection": false
    },
    "open_setup_wizard": false
  }
}
rhaamo commented 1 year ago

My main concern is that the VA-API seems to find the right profile:

"Encoder: Initialised VAAPI connection: version 1.18"
"Encoder: VAAPI driver: Intel iHD driver for Intel(R) Gen Graphics - 23.1.0 ()."
"Encoder: Driver not found in known nonstandard list, using standard behaviour."
"Encoder: Input surface format is nv12."
"Encoder: Using VAAPI profile VAProfileH264Main (6)."

But somehow there is this weird error:

"Encoder: Failed to create surface from DRM object: 2 (resource allocation failed)."
"Encoder: Unable to parse option value \"0x0\" as image size"
"Encoder: Error setting option video_size to value 0x0."
"Encoder: Error applying generic filter options."
"failed to create VAAPI encoder: filter_in creation failed: Invalid argument"
"using SW encoder"

Which fallbacks to SW encoder which seems to don't really work here.

It is to be noted, the same happens with HEVC:

"Encoder: Using VAAPI profile VAProfileHEVCMain (17)."
"Encoder: Failed to create surface from DRM object: 2 (resource allocation failed)."
"Encoder: Unable to parse option value \"0x0\" as image size"
"Encoder: Error setting option video_size to value 0x0."
"error in encoder thread: HEVC is not supported by SW encoder"

But in that case, IIRC, since there is no SW encoder there was just a plain black with nothing flashing in the headset.

rhaamo commented 1 year ago

Is there anything I could try to help getting that issue progress ?

Vixea commented 1 year ago

ask nowrep if you're in the discord otherwise or here if you want, otherwise your out of luck

rhaamo commented 1 year ago

To update on the issue, patch tried from nowrep and associated log. Only got flashing grey lines.

diff --git a/alvr/server/cpp/platform/linux/EncodePipelineSW.cpp b/alvr/server/cpp/platform/linux/EncodePipelineSW.cpp
index 09fb36de..30fd8b59 100644
--- a/alvr/server/cpp/platform/linux/EncodePipelineSW.cpp
+++ b/alvr/server/cpp/platform/linux/EncodePipelineSW.cpp
@@ -105,6 +105,7 @@ bool alvr::EncodePipelineSW::GetEncoded(FramePacket &packet)
   packet.size = nal_size;
   packet.data = nal[0].p_payload;
   packet.pts = pts;
+  packet.flags = picture_out.b_keyframe;
   return packet.size > 0;
 }

diff --git a/alvr/server/cpp/platform/linux/Renderer.cpp b/alvr/server/cpp/platform/linux/Renderer.cpp
index 0918d65a..c744db57 100644
--- a/alvr/server/cpp/platform/linux/Renderer.cpp
+++ b/alvr/server/cpp/platform/linux/Renderer.cpp
@@ -361,7 +361,7 @@ void Renderer::CreateOutput(uint32_t width, uint32_t height)
     memi.sType = VK_STRUCTURE_TYPE_MEMORY_ALLOCATE_INFO;
     memi.pNext = &memory_dedicated_info;
     memi.allocationSize = memoryReqs.memoryRequirements.size;
-    memi.memoryTypeIndex = memoryTypeIndex(VK_MEMORY_PROPERTY_DEVICE_LOCAL_BIT, memoryReqs.memoryRequirements.memoryTypeBits);
+    memi.memoryTypeIndex = memoryTypeIndex(VK_MEMORY_PROPERTY_HOST_VISIBLE_BIT, memoryReqs.memoryRequirements.memoryTypeBits);
     VK_CHECK(vkAllocateMemory(m_dev, &memi, nullptr, &m_output.memory));

     VkBindImageMemoryInfo bimi = {};
diff --git a/alvr/server/cpp/platform/linux/ffmpeg_helper.cpp b/alvr/server/cpp/platform/linux/ffmpeg_helper.cpp
index 1e41b260..227d9aff 100644
--- a/alvr/server/cpp/platform/linux/ffmpeg_helper.cpp
+++ b/alvr/server/cpp/platform/linux/ffmpeg_helper.cpp
@@ -9,6 +9,8 @@
 #include "alvr_server/bindings.h"
 #include "alvr_server/Logger.h"

+#include <inttypes.h>
+
 extern "C" {
   #include <libavcodec/avcodec.h>
   #include <libavfilter/avfilter.h>
@@ -302,6 +304,10 @@ alvr::VkFrame::VkFrame(
       av_drmframe->layers[0].planes[i].pitch = drm.strides[i];
       av_drmframe->layers[0].planes[i].offset = drm.offsets[i];
   }
+  Info("dmabuf: fd=%d format=%u modifier=%"PRIu64 " planes=%u strides=[%u,%u,%u,%u] offsets=[%u,%u,%u,%u] ",
+          drm.fd, drm.format, drm.modifier, drm.planes,
+          drm.strides[0], drm.strides[1], drm.strides[2], drm.strides[3],
+          drm.offsets[0], drm.offsets[1], drm.offsets[2], drm.offsets[3]);

   av_vkframe = av_vk_frame_alloc();
   av_vkframe->img[0] = image;

alvr_session_logbuildpatch_gist.txt

stale[bot] commented 1 year ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

rhaamo commented 1 year ago

sadly still happens with latest (as of a few hours ago) daily.

Minionflo commented 1 year ago

same issue here

stale[bot] commented 11 months ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

primenumber commented 10 months ago

still happen

Vixea commented 6 months ago

It's resolved in #1981

Vixea commented 6 months ago

Please retest with this pr

rhaamo commented 6 months ago

Sadly I don't have anymore an Intel ARC GPU in use, so I will let someone else be able to retest.

Vixea commented 6 months ago

Alright I'll just close this as people have already tested in discord