ArcticaProject / nx-libs

nx-libs
Other
121 stars 39 forks source link

running nxagent in remote , how can i render 3d app on my local pc by local gpu? #739

Open JohnCaiJun opened 5 years ago

JohnCaiJun commented 5 years ago

when i run openGL app , nxagent take a lot of cpu , so i want use local gpu to render 3d application, please help me , thanks . (my english not good, don't mind...)

this is stacktrace when i run glxgears on nxagent:

0 0x00007ffff529dc53 in __select_nocancel () from /usr/lib64/libc.so.6

1 0x00007ffff7adf444 in _XSelect (maxfds=10,

readfds=readfds@entry=0x7fffffffbf40,
writefds=writefds@entry=0x7fffffffbfc0, exceptfds=exceptfds@entry=0x0,
timeout=0x7ffff7dd9900 <retry>) at XlibInt.c:314

2 0x00007ffff7ae15d5 in _XWaitForWritable (dpy=dpy@entry=0xb52ca0,

cv=cv@entry=0x0) at XlibInt.c:458

3 0x00007ffff7ae1964 in _XWaitForWritable (cv=0x0, dpy=0xb52ca0)

at XlibInt.c:355

4 _XFlushInt (dpy=0xb52ca0, cv=cv@entry=0x0) at XlibInt.c:1052

5 0x00007ffff7ae19c7 in _XFlushInt (cv=0x0, dpy=dpy@entry=0xb52ca0)

at XlibInt.c:979

6 _XFlush (dpy=dpy@entry=0xb52ca0) at XlibInt.c:944

7 0x00007ffff7ac21fa in XFlush (dpy=dpy@entry=0xb52ca0) at Flush.c:39

8 0x000000000044be5f in NXFlushDisplay (dpy=0xb52ca0, what=1)

at Compext.c:673

9 0x000000000049ffed in nxagentBlockHandler (data=,

timeout=0x7fffffffe220, mask=<optimized out>) at Handlers.c:487

10 0x000000000045dcfa in BlockHandler (

pTimeout=pTimeout@entry=0x7fffffffe220,
pReadmask=0xb3e180 <LastSelectMask>) at dixutils.c:403

11 0x0000000000470dc9 in WaitForSomething (

pClientsReady=pClientsReady@entry=0xc59480) at WaitFor.c:244

---Type to continue, or q to quit---

12 0x0000000000430478 in Dispatch () at NXdispatch.c:360

13 0x000000000040e745 in main (argc=6, argv=0x7fffffffe478,

envp=<optimized out>) at main.c:353

i want trace openGL function, but i haven't find gl glx function .....

uli42 commented 5 years ago

The nxagent is using indirect rendering via the X protocol to perform drawing operations.

https://en.wikipedia.org/wiki/GLX#/media/File:Linux_graphics_drivers_Utah_GLX.svg shows how this works (X server in this pic is the nxagent). Instead of accessing the kernel or the graphics hardware the GLX (OpenGL) commands are sent to the software renderer (mesa) included in nxagent (doing the stuff the graphics hardware would normally do, but in software only). This results in 2D drawing operations that are done via X protocol calls. And these are sent to the nxproxy side on your local X server like any other (2D) X protocol calls.

What would be needed is a way to pass the OpenGL commands to the graphics hardware on the nxproxy side.

As this is a complex area we have collected lots of links describing how this is supposed to work in a local X server. You may want to get an overview under https://github.com/ArcticaProject/nx-libs/issues/549 . We do not have anything in code we could offer.