Looking into accelerated GLX

  • Paul Bayley

    Paul Bayley - 2001-08-28

    I'm looking into implementing accelerated GLX in XDarwin rootless.

    I checked XTools and it doesn't implement remote acceletated GLX. If you run glxinfo in a remote session, it will report that the renderer is Mesa. I want accelerated remote GLX so this may be a handful. If anybody has any suggestions I'm all ears.

    • Greg Parker

      Greg Parker - 2001-08-30

      There are two ways to implement GLX. One ("indirect") sends the GL commands on the X11 bytestream along with the other X11 commands, and they're decoded at the server end. The other ("direct") routes the client's GL commands out-of-band directly to the GL library, and the X11 bytestream is only used for synchronization.

      Indirect mode is slower, but works for all clients. Direct mode is faster, but only works for local clients, because remote clients can't talk to the local OpenGL library. I'm guessing that Tenon has implemented a direct mode solution.

      In XFree86, direct mode GLX is only available when DRI (direct screen rendering) is present, which it is not in XDarwin. I don't know how difficult it would be to make DRI work, though I'm guessing it would be hard.

      I've made some progress toward an accelerated indirect mode. It probably won't be fast because of the bytestream overhead, but it would get us talking to OpenGL.

      Useful GLX files are in xc/lib/GL/, especially xc/lib/GL/include/GL/internal/glcore.h; Xserver/GL/; xc/doc/specs/GL/libGL.txt

      Tip: an NSOpenGLContext can be attached to any NSView, not just a special NSOpenGLView, with -[NSOpenGLContext setView:]. You can also draw GL outside of -[NSOpenGLView drawRect:]:
      [view lockFocus];
      [context makeCurrentContext];
      [context flush];
      [view unlockFocus];

      • Paul Bayley

        Paul Bayley - 2001-08-31

        Actually I was wrong before, Tenon does support indirect mode (albiet with crasher bugs). I managed to run glplanets in a remote machine rendering locally, accelerated (no Quartz update flashes). However it wasn't textured.

        Anyway the goal is still getting it to work in XDarwin.

        I'm not all that interested in DRI because it doesn't accelerate indirect mode (yet).

        If I try this, my first version will likely create another, separate window to show the GL. If that works I may leave it to somebody else to get it in the right view since I'm not all that familair with X11 region handling. A generalized way to do this may be useful for other XF4 extensions like that YUV video mode.

        BTW I hope XDarwin 1.0 rootless mode will sometime surpass XDarwin 0.5 rootless mode. I find 0.5 to be more reliable and compatible.

        • Greg Parker

          Greg Parker - 2001-08-31

          How is 0.5 more reliable? 0.5 had crashing bugs that are gone in 1.0. As far as I can tell 1.0 is better all around except for SHAPE and maybe speed.

          • Paul Bayley

            Paul Bayley - 2001-08-31

            Pretty stable for me |-\.

            Will resizing wmaker windows work once shape support is added? I'd say that's probably the main reason I prefer 0.5

            • Greg Parker

              Greg Parker - 2001-08-31

              SHAPE and root window drawing both need fb to play nice with the alpha channel, so they'll be done about the same time.

        • Greg Parker

          Greg Parker - 2001-09-01

          I've succeeded in getting glxgears to draw accelerated into a separate NSWindow. Unfortunately, this required huge hacks. In particular, allocating NSOpenGLContexts from the X server thread crashed and took gdb with it.

          Another issue: there's no way to use Mesa for fullscreen and hardware for rootless, unless we compile two different apps.

          • Paul Bayley

            Paul Bayley - 2001-09-01

            May I have a copy of the xc/lib/GL/ folder?

            • Greg Parker

              Greg Parker - 2001-09-10

              It's part of XFree86. You should be able to get it from their anon CVS.


Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:

No, thanks