On Wed, Dec 26, 2018 at 4:54 AM Zhiyi Zhang zzhang@codeweavers.com wrote:
On 12/20/18 6:02 AM, Józef Kucia wrote:
On Tue, Dec 18, 2018 at 5:21 PM Zhiyi Zhang zzhang@codeweavers.com wrote:
Signed-off-by: Zhiyi Zhang zzhang@codeweavers.com
dlls/dxgi/tests/dxgi.c | 4 +-- dlls/wined3d/Makefile.in | 2 +- dlls/wined3d/directx.c | 66 +++++++++++++++++++++++++++------- dlls/wined3d/wined3d_main.c | 2 +- dlls/wined3d/wined3d_private.h | 2 +- 5 files changed, 58 insertions(+), 18 deletions(-)
In my opinion, we shouldn't use SetupAPI directly in wined3d. Wined3d should get LUIDs from OpenGL. Device UUIDs, driver UUIDs and LUIDs are also exposed by OpenGL, see EXT_external_objects and EXT_external_objects_win32. If it's problematic to implement those extensions, we could also consider extending WGL_WINE_query_renderer.
Please correct me if I am wrong. It seems to me that OpenGL doesn't support enumerating the adapters. Yes, OpenGL can get the device UUIDs if the extensions exist. But it binds to current OpenGL context. Since we don't have a way to correlate DISPLAYs to adapters, I don't see a way to enumerate adapters via OpenGL.
Sorry for jumping into the discussion late. Correct OpenGL doesn't have easy ways to do the enumeration and you are out of luck on older drivers not supporting the right extensions (though you could assume 1 card there).
There are various parts of Wine not well aware of adapters and monitors (e.g. user32). There will be applications (hopefully edge cases) which would be confused if different APIs report different devices.
Conceptually I would think all the adapter enumeration would have to live at the graphics driver level (winex11). Perhaps including the WineD3D OpenGL logic which "guesses" the adapter. (We need a way to share this logic with the Mac driver and wined3d on Windows) On systems with the right OpenGL / Vulkan extensions we may be able to do a better job. We would then have a nice unified view up to higher layers. Though easier said than done.
For inspiration you can look at MSDN about WDDM and the user mode driver model. Microsoft provides some clear information on how things work on Windows. Maybe some of these concepts make sense for us as well e.g. registry keys to locate drivers, features. E.g. https://docs.microsoft.com/en-us/windows-hardware/drivers/display/loading-an...
Thanks, Roderick