-
Notifications
You must be signed in to change notification settings - Fork 306
[Abandoned for new PR] win32/driver loader: Allow backends to load drivers from registry path #684
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
@evelikov as you pointed out, these code changes will collide a bit with #682 I think that I can still make these changes following the new model you proposed, making |
@sivileri if possible I would opt
The above should be fairly clear and non-intrusive. Bonus point of having both code-paths compile tested but DCE from the binary when built with basic optimisations. |
driver_path, init_func_s); | ||
dlclose(handle); | ||
} else { | ||
struct VADriverVTable *vtable = ctx->vtable; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Side note: moving this massive else statement (or portion of it) to it's own function has merit in itself.
6fac5ca
to
ce549ca
Compare
@evelikov Makes sense to keep it simpler, I removed the new Once your changes go in, I can also apply the va_win32 changes here onto the new |
ce549ca
to
254e11c
Compare
@sivileri I'm having trouble following the updated code. The refactor commit does too many things at once - your bullet points are a giveaway, the introduction of The |
Apologies @evelikov, I squashed the change and pushed a couple times to fix the build checks after the -WError addition to master. The latest update to the va core commit just removes the new function in the va_backend.h interface and rollbacks the associated changes to
I can also attempt with and without the prefix inside the This is to allow existing VAAPI apps which may expect the
In WSL, the GPU vendor names cannot be queried via DRM to then load the vendor driver name directly. Initializing DRM with the d3d12 gallium driver does later load the appropriate vendor driver via d3d12 which are at /lib/wsl/lib and /lib/wsl/drivers.
The |
ae715b5
to
278b763
Compare
b086760
to
0e1502e
Compare
As mentioned earlier the commit message is a giveaway that the changes belong to separate patches. More importantly this approach is overly complex IMHO. Instead I would suggest (4 commits as below):
This should result in way better experience - less and simpler code, smaller binary, zero extra overhead Wrt WSL - does it provide some unique define or _WIN32? In case it's only WIN32, you might a uname check in |
Thanks for clarifying @evelikov , I'll take another stab at it and the other key points and report back next week.
To further clarify as I think I introduced some confusion with the WSL commit in the PR before:
|
suppose will be conflict with #682 |
@XinfengZhang that's correct. If #682 is approved and merged, I'll rebase this one after that to use the fixed/refactored new driver API. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Big change and I afraid I can't decipher the behavior for multiple different scenarios we have on Windows. So, let me try to list my concerns here one by one to start understanding the propose change from replies:
-
Will
LIBVA_DRIVER_NAME
have different behavior on Windows after this change, i.e. you will need to setLIBVA_DRIVER_NAME=vaon12_drv_video.dll
while on LinuxLIBVA_DRIVER_NAME=iHD
? -
Do you anticipate that some vendors will have VAAPI drivers registered on windows for LUIDs? Do we have evidence that there is work being done on that? Or you consider having vaon12 mesa gallium registered? Basically I am trying to ask - do we really to take care of such use case?
-
What's proposed behavior to handle a case when there is driver registered for LUID and vaon12 is also available? What should be the preference? /as of now default is vaon12..../
-
If there is no driver registered for LUID, then what will be the default (vaon12?) and how it will be searched for?
In general these seems to be usages we need to consider:
- On Windows we have multiple cases:
- Running under WSL
- Running on Windows from MSYS2 which has mesa packages (https://packages.msys2.org/base/mingw-w64-mesa)
- Running of self-built libva (build w/ or w/o MSYS2)
In a meanwhile, my 2 cents to improve current user experience working with vaon12 would be this: #713. On Linux we have dedicated libva drivers location such as /usr/lib/dri with minor libdir differences depending on the OS type, Debian, Fedora, etc. On Windows driver for default build lands to the same location as applications and ddls. For example consider existing https://packages.msys2.org/package/mingw-w64-x86_64-mesa?repo=mingw64 (below will be relative to
|
I wrote some libva-utils tests to cover this intel/libva-utils@master...sivileri:libva-utils:vainitialize_tests, and we can add more as needed to cover all the driver loading process in general. Since it's a big change I'm okay to merge this only having passing tests to protect against regressions.
Enabling vendors to associate the driver to the LUID is the Windows equivalent of the DRM backend loading the vendor VA driver for different /dev/dri/* GPUs. Without this, vendor drivers would have to use name overriding with
The adapter registered driver name as always the first/preferred option, if there isn't one for that LUID (or
WSL is the exact same scenario as running on linux (it loads VGEM with DRM or can be connected to X11).
Did you notice any difference in these two points above? |
As of now - no. But I wonder whether this is getting preserved after your change. For example, with MSYS2 packages my intent would be that user:
From my side, I also would like to preserve on Windows same designation for LIBVA_DRIVER_NAME as on Linux, i.e. that |
…loading - Split va_OpenDriver into va_OpenDriverFromPath and va_OpenDriverFromName to allow for absolute path driver loading and separate the dlopen logic from the possible paths calculation and iteration - Add new backend function vaGetDriverPathByIndex for driver candidate loading by absolute path - Rename va_getDriverNameByIndex to va_getDriverCandidateByIndex which will now get the driver name or path from the backend. - Rewrite va_openDriver which will now attempt to load the driver from the usual previous driver name and path construction process or use the new absolute path loading mechanism with or without LIBVA_DRIVERS_PATH env variable override. - Add extra attempt to load driver in va_OpenDriver without the drv_video suffix (win32 backend will need this) The two ways with/without suffix is for apps backward compatibility Signed-off-by: Sil Vilerino <sivileri@microsoft.com>
- Implement vaGetDriverPathByIndex instead of vaGetDriverNameByIndex - Provide a default driver name to avoid having to always set LIBVA_DRIVERS_PATH on Windows Signed-off-by: Sil Vilerino <sivileri@microsoft.com>
No breaking changes should happen from this MR. Since LIBVA_DRIVER_NAME and LIBVA_DRIVERS_PATH take precedence (like they do without this PR) over the automatic loading from the backends, I don't expect any issues. We can also add to that list using nuget pre-built libva, mesa DLLs.
In this case, Win32 backend will return
In this case, Win32 backend will return
|
A rework like #684 (comment) would be the more scalable/stable approach. Simple rebase won't cut it IMHO. |
When va-win32 loads the registered driver for a given device LUID passed in vaGetDisplayWin32, it's currently treating it merely as a driver name, but the installable client drivers in the registry are required to be absolute paths, so we made some changes to support this:
Related previous discussion at #681
VA changes
Win32 changes: