Giter Site home page Giter Site logo

Comments (9)

i-rinat avatar i-rinat commented on July 17, 2024

GL_NV_vdpau_interop is an OpenGL extension. It helps to connect VDPAU surfaces to GL textures. An application may want to avoid downloading data from video surface just to upload it to GL texture, and that extension adds functions which helps to avoid unnecessary data transfers. Since it's GL-related, libGL is the library which implements the extension.

When Nvidia's, or Mesa's [1] VDPAU drivers are used, it's possible, since they have control of both libGL.so and libvdpau_drivername.so.1. But with libvdpau-va-gl it's close to impossible, since it has no access to libGL internals.

I thought about hacking into libGL to intercept calls to glGetProcAddress, but never tried to implement it.

[1] Mesa also have that extension implemented for some Gallium3D-based drivers

from libvdpau-va-gl.

Queuecumber avatar Queuecumber commented on July 17, 2024

Interesting, do you know how hard the intercept call is expected to be to implement?

from libvdpau-va-gl.

i-rinat avatar i-rinat commented on July 17, 2024

Now when I thought about it more, none of the dynamic tricks seems to be feasible. Memory hotpatching will fail due to memory protection. Even if it's possible to make executable memory writable, VDPAU driver can be loaded after application asks libGL for entry points. Creating a wrapper for libGL must proxy all libGL exports, which is insane. There could be also issues with duplicated symbols.

The only viable way is to patch Mesa for "hookbacks", i.e., if application ask any of VDPAU interop extensions, load libvdpau and return one of its predefined entries. libvdpau must be patched too.

Looks fragile.

from libvdpau-va-gl.

Queuecumber avatar Queuecumber commented on July 17, 2024

What about replacing the function pointer for glGetProcAddress when the vdpau library is loaded? I used something similar on windows several years ago to force an application to go through one of my functions whenever it tried to load a dll with the LoadLibrary function, no idea if Linux would allow such a thing.

from libvdpau-va-gl.

i-rinat avatar i-rinat commented on July 17, 2024

What about replacing the function pointer for glGetProcAddress when the vdpau library is loaded?

Application can try to acquire GL extension functions before it even tries to load libvdpau.

from libvdpau-va-gl.

Queuecumber avatar Queuecumber commented on July 17, 2024

And I'm assuming that function call will fail reporting that the extension is unavailable at that point right?

from libvdpau-va-gl.

i-rinat avatar i-rinat commented on July 17, 2024

that the extension is unavailable at that point right?

Right.

from libvdpau-va-gl.

i-rinat avatar i-rinat commented on July 17, 2024

By the way, why do you want that extension? The only application requiring it I know, is Kodi (XBMC). But it have native VA-API support.

from libvdpau-va-gl.

Queuecumber avatar Queuecumber commented on July 17, 2024

Steam in-home streaming but I just got it working with VA-API anyway. It seems you're right that almost everything is supporting both apis at this point so it is probably not necessary

from libvdpau-va-gl.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.