SveSop / nvapi_standalone

Standalone meson compile of nVidia's nvapi.
Other
14 stars 2 forks source link

Feature Question: Can this be used to control RGB on a Nvidia GPU? #2

Open ghost opened 4 years ago

ghost commented 4 years ago

As the question asks, I was wondering if this can be used to control RGB on a Nvidia GPU on Linux?

SveSop commented 4 years ago

@David-Frick Hi. Sorry i have not noticed this post until today, so i apologize for the late reply. What would you need this function for? If you provide a windows app that would use this for something meaningful, i am willing to test for functions.

First i need to find if doing this is actually used as a nvapi call in windows, then i must see if nvctrl for Linux have the same function.. and if so + given a test program, it could be made to work :)

sizzlesloth commented 4 years ago

Sorry for bumping, but I came across this and I might be able to help a bit.

I would also like to be able to control RGB on my EVGA 1070 FTW in Linux. I came across a GitHub repo under https://github.com/iamdroppy/EvgaI2C

He found that the EVGA Precision X OC software sets RGB through i2c, using nvapi. You can compile his .sln file in Visual Studio and his example sets the RGB to green. I modified his program to allow you to choose each value for the R, G, and B LEDs. I can send the compiled .exe over if you still want to have a look at it! It would be very much appreciated and I'm sure many would find it useful. While his repo is for EVGA Pascal cards, I believe pretty much all Nvidia GPUs use nvapi to set their RGB colors. I'll be happy to help where necessary if you want to take a look at it as it would be great to be able to run his program through WINE.

SveSop commented 4 years ago

I am not really sure if this is some vendor specific thing, or if this is something that nvAPI actually can do for all card with the proper support?

I mean, some vendors have a massive amount of extra stuff on their cards, using a multitude of various software(bloatware) to set this. If it is a EVGA vendor thing, i have no way of testing this, and it would probably be just random guesswork of back and forth testing.

Ill look into it, but i do not think i will implement any i2c things anytime soon, as i do not really work much with this thing anymore.

SveSop commented 4 years ago

It looks like there is some functions in nvAPI that could do stuff with "illumination" (The logo and whatnot). If other stuff is more vendor specific, i have no clue.

    { "NvAPI_GPU_QueryIlluminationSupport", 0xa629da31 },
    { "NvAPI_GPU_GetIllumination", 0x9a1b9365 },
    { "NvAPI_GPU_SetIllumination", 0x0254a187 },
    { "NvAPI_GPU_ClientIllumDevicesGetInfo", 0xd4100e58 },
    { "NvAPI_GPU_ClientIllumDevicesGetControl", 0x73c01d58 },
    { "NvAPI_GPU_ClientIllumDevicesSetControl", 0x57024c62 },
    { "NvAPI_GPU_ClientIllumZonesGetInfo", 0x4b81241b },
    { "NvAPI_GPU_ClientIllumZonesGetControl", 0x3dbf5764 },
    { "NvAPI_GPU_ClientIllumZonesSetControl", 0x197d065e },

However, i have no clue where to start to actually set this "illumination" in Linux, cos the nvml library does not seem to contain anything of that sort?

From the wee bit of looking at that link you posted above, it seems as he have made a "easier and lighter" method of setting the lights in Windows with this code.. So, setting this illumination by using a different program than the bloatware that many vendors use to customize their "amazing stuff", is not the same as getting it to work in Linux.

As i said, it has been a while since i fiddled with this code tbh, but what happens is basically this: Windows app -> Wine -> loads nvapi.dll -> nvapi.dll communicates with nvml (closest to nvapi that Linux has). So, what i need to do is to make the custom nvapi.dll do functions in nvml. If there is no function for X in nvml, then i cannot do it. So far mostly what i have done is to make a sort of "proof of concept" thing where i read stuff from nvml and let nvapi send this to whatever windows app running in wine (eg. GPU Caps Viewer displaying fan speed or whatnot). I can "fake" information, but there is no point in faking color settings without actually setting the colors :)

If you find a linux binary setting these RGB/Led colors of sort (preferably opensource), please let me know :)

EDIT: Even this project seems to miss RGB control in Linux https://github.com/NVIDIA/nvidia-settings/issues/48

Alokin-ITA commented 4 years ago

I use OpenRGB to change the GPU LED color and brightness and it works with my Gigabyte RTX 2070

https://gitlab.com/CalcProgrammer1/OpenRGB

ghost commented 3 years ago

@Alokin-ITA but is that on Linux or Windows? Thanks for the feedback guys. There was an issue raised in nvidia-settings about RGB light control on linux and it seems to be going nowhere but it seems some people are able to..? Seems to be pretty random at this point.

ghost commented 3 years ago

@SveSop Thanks for all the feedback. I think what you said about wine and nvapi is an interesting idea. I have seen some people discussing that method as well. How hacky would something like that be?

SveSop commented 3 years ago

@Frick-David My problem is that for any "hacks" to be done, i need the following:

  1. A windows program that uses nvapi to set colors (Not sure any does, and IF they do, it MAY be a combination of using nvapi + whatever proprietary stuff)
  2. A way to replicate that function in Linux. Implementing loads of stuff as a non-programmer is not too easy. Cant just throw snippits from things like the OpenRGB project linked into nvapi and compile.
  3. A positive way to actually test this (Not sure my GTX970 that is in my Windows box has much light controls on it.. MSI GTX970)

I think the OpenRGB thingy looks promising, and it would be unlimited times better to use that, than for me to try to invent the wheel for these functions if the sole reason for RGB control is to... well.. control the RGB as a Linux user.

Alokin-ITA commented 3 years ago

@Alokin-ITA but is that on Linux or Windows? Thanks for the feedback guys. There was an issue raised in nvidia-settings about RGB light control on linux and it seems to be going nowhere but it seems some people are able to..? Seems to be pretty random at this point.

On Linux.

sizzlesloth commented 3 years ago

Just to let you all know, I used the research from https://github.com/iamdroppy/EVGAI2C and worked with CalcProgrammer1 to get the 1070 FTW supported on OpenRGB for Windows and Linux. See here: https://gitlab.com/CalcProgrammer1/OpenRGB/-/wikis/EVGA-GPU

I found the memory address and values for the different modes as well. It works well on Windows but if you build from source right now for Linux, you need to add this line back in which was removed in this commit: https://gitlab.com/CalcProgrammer1/OpenRGB/-/commit/973dce9d80cd3fa6d23228b29ad96132894915a3

ghost commented 3 years ago

@brittle-bones how hard would it be to get support for new GPUs?