stackgl / headless-gl

🎃 Windowless WebGL for node.js
1.76k stars 170 forks source link

Getting a glimpse of the headless-gl rendering activities happening on Xvfb through xwud #226

Open lanceschi opened 2 years ago

lanceschi commented 2 years ago

Hello,

and thanks :100: for the awesome lib!

Is is possible to catch a glimpse of the headless-gl rendering activities happening on the Xvfb virtual frame buffer?

I'm launching Xvfb this way (script extract for simplicity sake):

#!/bin/sh

DISPLAY=${DISPLAY:-:105}
RESOLUTION=${RESOLUTION:-800x768x24}

nohup Xvfb $DISPLAY \
  -screen 0 $RESOLUTION -ac -reset \
  -pixdepths 3 27 \
  -fbdir ./out >/dev/null 2>&1 &

and I'm picking out correctly the output video feed with xwud:

xwud -in out/Xvfb_screen0 -noclick

The only issue is that the video feed remains pitch black even during headless-gl rendering activities. Here's a screenshot:

xwud-black-2022-01-12 11-06-48

The xwud video feed capture is working since if I start Xvfb with the -retro flag:

#!/bin/sh

DISPLAY=${DISPLAY:-:105}
RESOLUTION=${RESOLUTION:-800x768x24}

nohup Xvfb $DISPLAY \
  -screen 0 $RESOLUTION -ac -reset \
  -pixdepths 3 27 -retro \
  -fbdir ./out >/dev/null 2>&1 &

The video feed changes accordingly: xwud-2022-01-12 11-11-28

Any help appreciated. Thanks!

dhritzkiv commented 2 years ago

Hi @lanceschi. Thanks for the question – it taught me about a few tools / commands that I didn't know about. That being said, your guess is as good as mine as to what may not be working here.

A few questions:

lanceschi commented 2 years ago

Hello @dhritzkiv,

and thanks for the prompt answer!

are you able to produce a visual output with headless-gl and Xvfb (without xwud)

Yes, it operates successfully and as expected with gl.readPixels

can you inspect the frame buffer in any other means?

Yes, with the help of x11vnc and VNC Viewer. Same results as with xwud though

are you setting preserveDrawingBuffer to true ? what about trying false?

No noticeable difference

does calling gl.flush at the end of each expected step help?

Tried but it didn't influence the rendering

can you post the output of glxinfo? (this should also be run in the context of Xfvb)

Sure, glxinfo issued on Xvfb: glxinfo.txt