Skip to content
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

vGPU acceleration for Surface Pro X #474

Closed
Macmee opened this issue Sep 29, 2021 · 8 comments
Closed

vGPU acceleration for Surface Pro X #474

Macmee opened this issue Sep 29, 2021 · 8 comments
Labels
duplicate This issue or pull request already exists enhancement New feature or request

Comments

@Macmee
Copy link

Macmee commented Sep 29, 2021

Hello!

I apologize for making a ticket asking about this in case this is not appropriate.

I was curious if this project is aware of any plans for either Microsoft or Qualcomm to add driver support for vGPU acceleration for use with WSLg.

Thanks!

@Macmee Macmee added the enhancement New feature or request label Sep 29, 2021
@hideyukn88
Copy link
Member

@Macmee, thanks for filing request, this is requested by #143, and #260. We are working with Qualcomm to make that happen, thanks!

@hideyukn88 hideyukn88 added the duplicate This issue or pull request already exists label Oct 6, 2021
@mmichal3
Copy link

mmichal3 commented Sep 17, 2023

Try this. Its a unofficial hack, but it gets interesting results. Heres all of the what I did, even what didnt work.

I had screwed around with different video drivers and glxmark2 and glxmark2-es2 always read :

OpenGL Information
GL_VENDOR: Mesa
GL_RENDERER: llvmpipe (LLVM 15.0.7, 128 bits)
GL_VERSION: OpenGL ES 3.2 Mesa 23.0.4-0ubuntu1~23.04.1

which was totally expected. Then one day I checked after a Microsoft's latest update and it read:

GL_VENDOR: Microsoft Corporation
GL_RENDERER: D3D12 (Qualcomm(R) Adreno(TM) 680 GPU)
GL_VERSION: OpenGL ES 3.0 Mesa 23.0.4-0ubuntu1~23.04.1

Interesting, but I didn't have time to play with it. I assumed it was added in the last software update. Between then and now, I have reinstalled windows, and on another occasion actually restored the entire Surface Pro X to factory configuration using the recovery disk from Microsoft.

Today I decided to play with it and see if I was really getting hardware acceleration. I checked and it read:

OpenGL Information
GL_VENDOR: Mesa
GL_RENDERER: llvmpipe (LLVM 15.0.7, 128 bits)
GL_VERSION: OpenGL ES 3.2 Mesa 23.0.4-0ubuntu1~23.04.1

I updated everything and installed the very latest version of Ubuntu and still, it was set to llvmpipe. I have it some thought about why it might not be working the same way. It occurred to me that one of the things I had done was install the 8CX Gen 3 drivers for a Lenovo laptop. Lenovo claims the graphics adapter on the 8CX Gen 3 is an Adreno 690, the same as the SQ2 Surface Pro. Except the major version number on the Lenovo driver is 30 compared to the major number of 27 on the Microsoft driver, and thus should support hardware acceleration under WSLg. It turns out, no one using the Gen 3 but Lenovo claims that it has a Adreno 690, they just call it the 8CX Gen 3 graphics adapter. Unfortunately, the rest of the world seems to be right and Lenovo wrong, or at least there are enough differences that the Lenovo 8CX Gen 3 Adreno 690 driver wont work. It comes up with an explanation point next to it in the device manager. But,its usually worth giving it a try, so I had installed it, verified that it did not work, and reverted back to the original Microsoft supplied Adreno 690 driver, and not given it a second thought.

But what if it installed some missing piece that was needed for hardware acceleration. What if installing the Lenovo supplied driver for the wrong graphics adapter, then uninstalling it and reinstalling it magically enabled GPU acceleration in WSLg. And what if I could fix the problem that WSL has with the thread hanging by patting the top of my head, while rubbing my stomach and turning around three times in place. But why not give it a try. (the driver, not the other thing.)

So I reinstalled the Lenovo driver which can be found at :

https://support.lenovo.com/us/en/downloads/ds556222-qualcomm-graphics-driver-for-windows-11-arm-version-21h2-or-later-thinkpad-x13s-gen-1-types-21bx-21by

I used the following procedure:
I ran the installer. It installed it in a folder called C:\DRIVERS\WIN\QCVGA\20231209.20183510
image

I then went to the device manager ,double clicked on the adreno device, clicked the driver tab, then the UPDATE DRIVER button, selected "Browse My Computer" and then "Let me pick from a list of available drivers on my computer", then cleared the "Show Compatable Hardware" check box. It listed the existing Adreno 680 and 690 drivers that Microsoft had provided, and additionally various versions of a driver named Qualcomm Adreno(tm) 8CX Gen 3 and one named Qualcomm Adreno(tm) 8CX Gen3 GPU. I chose one named Qualcomm Adreno(tm) 8CX Gen3 GPU Version: 30.0.3564.4200 (8/26/22).
image

It of course did not work and came up with a yellow exclamation point in device manager. I then went back to the same page and selected the latest Adreno 690 driver from Microsoft again. The exclamation point went away and the graphics worked right again.

Then I went in and checked glxmark2 and ... nothing. You read this huge long winded post for nothing. I just like typing.....

J/K It worked! It now returns:

OpenGL Information
GL_VENDOR: Microsoft Corporation
GL_RENDERER: D3D12 (Qualcomm(R) Adreno(TM) 680 GPU)
GL_VERSION: OpenGL ES 3.0 Mesa 23.0.4-0ubuntu1~23.04.1

So that WAS what had made it work.Or at least somewhat work.

I then checked the task manager. The process "Virtual Machine Worker Process" was at about 16%
image

Then I set an environment variable to turn off hardware acceleration.
export LIBGL_ALWAYS_SOFTWARE=1

glmark2 then, as expected returned

OpenGL Information
GL_VENDOR: Mesa
GL_RENDERER: llvmpipe (LLVM 15.0.7, 128 bits)
GL_VERSION: OpenGL ES 3.2 Mesa 23.0.4-0ubuntu1~23.04.1

Furthermore, Virtual Machine Worker Process was no longer taking any GPU resources. Desktop Window Manager was using about 7-8% of the GPU now.
image

I then turned hardware acceleration back on with:
export LIBGL_ALWAYS_SOFTWARE=0

and reran gxmark2

As expected it returned:
OpenGL Information
GL_VENDOR: Microsoft Corporation
GL_RENDERER: D3D12 (Qualcomm(R) Adreno(TM) 680 GPU)
GL_VERSION: OpenGL ES 3.0 Mesa 23.0.4-0ubuntu1~23.04.1

The task manager showed that Desktop Window Manager was now taking no GPU and that Virtual Machine Worker Process was taking 18% again.

image

Oddly, glmark seems to run slower on hardware acceleration and give errors that its limited by the frame rate. Ive head people complain about similar things on NVIDIA cars. I cant say for certain that hardware acceleration works RIGHT, at least not without some more work. But it does look like its working.

EDIT:I just had a thought. Maybe the driver is changing a setting in the registry which enables a feature that was just never enabled in the original driver. When you uninstall it, it perhaps leaves that setting.

@mmichal3
Copy link

looking at the install file file, there are two files called

libqcdx12arm64wslum.so = 0,,
libqcdxarm64wslcompiler.so = 0,,

That seems to indicated that perhaps it DOES leave something behind that is needed for hardware acceleration.

@mmichal3
Copy link

mmichal3 commented Sep 17, 2023

I ran some further tests. If you set the screen resolution to 1920x1080 and set rendering to off screen you get somewhere around 4-6 times the speed with hardware acceleration. At 4096x4096 its 8-10x. So it looks like its working. At least somewhat. I used the command glmark2 --off-screen -s 1920x1080

@Gerdya
Copy link

Gerdya commented Sep 25, 2023

I can confirm, that it is working for me too on my Devkit 2023, which has an 8CX Gen 3 chipset (similar to SQ3).
I did also try Blender, which is now running much better as before - GUI interaction is much faster.

@mmichal3
Copy link

mmichal3 commented Feb 8, 2024

I now have some definite answers. First, it seems that under some circumstances,which Im not quite certain of, it loses the hardware acceleration. It may be reinstalling the video driver or reinstalling WSL2. I did both and afterwards glxinfo -B gave the following:
Extended renderer info (GLX_MESA_query_renderer):
Vendor: Mesa (0xffffffff)
Device: llvmpipe (LLVM 15.0.7, 128 bits) (0xffffffff)
Version: 23.2.1
Accelerated: no

I then reinstalled the 8cX gen 3 driver from Lenovo. I keep it unzipped in the root of the C drive. To install I go into device manager and update the driver and and choose the option to install from disk. Of course the driver came up with an exclamation point and did not work. I then went back into the driver and chose the Adreno 690 driver. When I opened ubuntu under WSLg and ran glxinfo -B it returned:

Extended renderer info (GLX_MESA_query_renderer):
Vendor: Microsoft Corporation (0xffffffff)
Device: D3D12 (Qualcomm(R) Adreno(TM) 680 GPU) (0xffffffff)
Version: 23.2.1
Accelerated: yes

When I ran glmark2 it gave a total score of 151.

I then ran
env __GLX_VENDOR_LIBRARY_NAME=mesa LIBGL_ALWAYS_SOFTWARE=1 glxinfo -B

which runs glxinfo -B with the environment variable set to force software rendering. As expected it returned:

Extended renderer info (GLX_MESA_query_renderer):
Vendor: Mesa (0xffffffff)
Device: llvmpipe (LLVM 15.0.7, 128 bits) (0xffffffff)
Version: 23.2.1
Accelerated: no

I then ran
env __GLX_VENDOR_LIBRARY_NAME=mesa LIBGL_ALWAYS_SOFTWARE=1 glmark2

it returned a total score of 211. That was confusing at first, but whats happening is clear if you look at the individual tests. The following chart shows the individual tests, under both sw and hw rendering. Just as Microsoft promised, the more complex tests
seem to benefit from the HW acceleration compared to the simpler tests where it actually gets worse results due to the overhead involved. The last two columns are the percent difference of the two tests calculated as 100*(HW-SW)/(0.5(HW+SW)). A negative value for FPS% indicates that SW rendering was faster while a positive value for FT% indicates the same.

<style> </style>
Test Settings HW_FPS HW_FrameTime (ms) SW_FPS SW_FrameTime (ms) FPS % FT%
buffer columns=200:interleave=false:update-dispersion=0.9:update-fraction=0.5:update-method=map 161 6.244 147 6.832 9.090909 -8.99358
buffer columns=200:interleave=false:update-dispersion=0.9:update-fraction=0.5:update-method=subdata 116 8.637 145 6.903 -22.2222 22.3166
buffer columns=200:interleave=true:update-dispersion=0.9:update-fraction=0.5:update-method=map 168 5.976 146 6.880 14.01274 -14.0635
build use-vbo=false 160 6.267 272 3.677 -51.8519 52.09171
build use-vbo=true 171 5.863 276 3.631 -46.9799 47.01917
bump bump-render=height 133 7.554 387 2.588 -97.6923 97.9294
bump bump-render=high-poly 158 6.334 88 11.429 56.91057 -57.3664
bump bump-render=normals 154 6.521 411 2.438 -90.9735 91.14857
conditionals fragment-steps=0 165 6.069 265 3.775 -46.5116 46.60707
conditionals fragment-steps=0 164 6.118 264 3.797 -46.729 46.81795
conditionals fragment-steps=5 168 5.980 248 4.040 -38.4615 38.72255
desktop blur-radius=5 161 6.224 47 21.363 109.6154 -109.755
desktop effect=shadow 145 6.943 116 8.669 22.22222 -22.1112
effect2d kernel=0,1,0;1,-4,1;0,1,0; 170 5.905 226 4.431 -28.2828 28.52167
effect2d kernel=1,1,1,1,1;1,1,1,1,1;1,1,1,1,1; 197 5.094 166 6.041 17.07989 -17.0094
function fragment-complexity=low 167 6.011 252 3.970 -40.5728 40.89771
function fragment-complexity=medium 162 6.173 237 4.234 -37.594 37.26338
ideas speed=duration 111 9.062 188 5.346 -51.505 51.58245
jellyfish 189 5.303 96 10.425 65.26316 -65.1322
loop fragment-loop=false 158 6.331 255 3.933 -46.9734 46.72642
loop fragment-steps=5 166 6.058 255 3.928 -42.2803 42.65972
loop fragment-steps=5 162 6.187 243 4.127 -40 39.9457
pulsar light=false 198 5.065 319 3.139 -46.8085 46.95271
refract 104 9.619 17 60.920 143.8017 -145.454
shading shading=blinn-phong-inf 157 6.372 184 5.451 -15.8358 15.5798
shading shading=cel 159 6.308 164 6.128 -3.09598 2.894821
shading shading=gouraud 156 6.414 197 5.080 -23.2295 23.21211
shading shading=phong 157 6.395 164 6.098 -4.36137 4.754663
shadow 142 7.085 130 7.709 8.823529 -8.43585
terrain 75 13.377 7 157.404 165.8537 -168.669
texture texture-filter=linear 92 10.912 379 2.640 -121.868 122.0779
texture texture-filter=mipmap 117 8.554 311 3.219 -90.6542 90.63111
texture texture-filter=nearest 159 6.305 410 2.442 -88.225 88.32743

@mmichal3
Copy link

mmichal3 commented Feb 8, 2024

With the resolution set to 1800x1800 sw rendering is about half the speed of hardware rendering.

@TsengSR
Copy link

TsengSR commented May 29, 2024

@mmichal3 For what is worth, with the latest Windows 11 updates and the Qualcomm 8cx gen 3 6.0 Drivers from their website it says

GL_VENDOR: Microsoft Corporation
GL_RENDERER: D3D12 (Qualcomm(R) Adreno(TM) 8cx Gen 3)
GL_VERSION: 4.1 (Compatibility Profile) Mesa 24.0.5-1ubuntu1

Still, clinfo doesn't recognize it

clinfo --list
Platform #0: Portable Computing Language
`-- Device #0: cpu--0xd4c

More interestingly, on the 8cx Gen 3 Geekbench I see GPU benchmarks popping up, which have high scores are recently new (only since May 6th)

image

Does this indicate that there's are proper drivers available for the 8cx gen 3 GPU in the wilds? Couldn't find any though extensive search.

There only GPU results prior to that were single-digit or low 3-digit.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
duplicate This issue or pull request already exists enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

5 participants