Azure-Kinect-Sensor-SDK icon indicating copy to clipboard operation
Azure-Kinect-Sensor-SDK copied to clipboard

Azure Kinect SDK should be usable in a headless environment on Linux

Open begillil opened this issue 7 years ago • 1 comments

Is your feature request related to a problem? Please describe.

Because of the libGL.so dependency in libdepthengine.so, I am required to be physically logged into a machine in order to use anything built on the Azure Kinect SDK. This is an artifact of the fact that libGL relies on the user's X session.

This may be fine for local development, or applications which render locally, but it makes it challenging to develop remotely (e.g. using xrdp with Remote Desktop), or to run in a headless environment (where there is no X session).

In my scenario, I am running a process inside of a Docker container (Azure IoT Edge) which receives frames from the K4A SDK and processes them locally without rendering them, generating events which are sent elsewhere for processing. To make this work right now, I need to physically login to the machine, allow the container to access the logged-in X session, then start the process in the container that uses the K4A SDK.

That process is not scalable to production, especially since it needs to be done every time the machine is restarted.

Describe the solution you'd like

Since I am not rendering anything, I wouldn't expect to be required to run in an environment where rendering is possible. I would like to consume frames from the camera in a headless environment, or in a remote environment (rdp/ssh).

Describe alternatives you've considered

Since the OpenGL dependency is in libdepthengine, which is proprietary, I don't have a way to understand specifically how OpenGL is being used, or what good alternatives would be for those uses.

Additional context

Issue https://github.com/microsoft/Azure-Kinect-Sensor-SDK/issues/503 exhibits the same problem, and one of the comments suggests this behavior is by design.

This issue is easily reproducible by sshing into a machine with a Kinect attached and running k4arecorder.

$ k4arecorder test.mkv
Device serial number: ############
Device version: Rel; C: 1.6.102; D: 1.6.75[6109.7]; A: 1.6.14
[2019-08-26 13:18:50.068] [error] [t=3614] /home/vsts/work/1/s/extern/Azure-Kinect-Sensor-SDK/src/dewrapper/dewrapper.c (154): depth_engine_start_helper(). Depth engine create and initialize failed with error code: 102.
[2019-08-26 13:18:50.068] [error] [t=3614] /home/vsts/work/1/s/extern/Azure-Kinect-Sensor-SDK/src/dewrapper/dewrapper.c (156): deresult == K4A_DEPTH_ENGINE_RESULT_SUCCEEDED returned failure in depth_engine_start_helper()
[2019-08-26 13:18:50.068] [error] [t=3614] /home/vsts/work/1/s/extern/Azure-Kinect-Sensor-SDK/src/dewrapper/dewrapper.c (190): depth_engine_start_helper(dewrapper, dewrapper->fps, dewrapper->depth_mode, &depth_engine_max_compute_time_ms, &depth_engine_output_buffer_size) returned failure in depth_engine_thread()
Segmentation fault

Or trying to run k4arecorder from within a Remote Desktop session:

$ k4arecorder test.mkv
Device serial number: ############
Device version: Rel; C: 1.6.102; D: 1.6.75[6109.7]; A: 1.6.14
X Error of failed request:  GLXBadFBConfig
  Major opcode of failed request:  154 (GLX)
  Minor opcode of failed request:  34 ()
  Serial number of failed request:  32
  Current serial number in output stream:  31

begillil avatar Aug 26 '19 20:08 begillil

@begillil OpenGL is used by the depth engine binary to run compute shaders that are necessary for taking raw camera outputs and turning them in to depth data. Unfortunately on Linux it is not possible to run OpenGL compute shaders without an X session. There are solutions such as XDummy which make it possible to have an X session in headless environments.

#562 has more data related to this issue.

cdedmonds avatar Aug 27 '19 15:08 cdedmonds