ss7m / paleofetch

neofetch, but written in C
MIT License
167 stars 49 forks source link

Add support for two GPUs #32

Closed dwzg closed 4 years ago

dwzg commented 4 years ago

Some notebooks have hybrid graphics and therefore multiple GPUs. This adds a function to find GPUs in the pci device list. An index is passed to determine which GPU should be returned. If no GPU can be found for a given index, an empty string is returned. Similiar to color1 and color2, two functions called get_gpu1 and get_gpu2 are added. The configuration now has two GPU entries, but if the seconds entry contains an empty string, it is not printed to the terminal. Another pci class name had to be added for identification of GPUs, as my Toshiba notebook reports his NVIDIA GPU as a "3D controller" and not as a "VGA compatible controller".

Fixes issue #19

two_gpus

ss7m commented 4 years ago

Can you make sure that this still works to detect the second GPU (you'll have to change config.h). I only have the integrated graphics on my machine so I can't properly test that.

dwzg commented 4 years ago

There is still a problem with caching. paleofetch will show both GPUs with the name of the first GPU, as this is the first match when searching in the cache file. A possible workaround is to disable caching for the second GPU.

ss7m commented 4 years ago

If you only have one GPU set to display, or label them GPU1 and GPU2, then it should be fine. I would rather not mess with how caching works, but also want to continue caching the GPU. Getting the GPU is probably the slowest operation, and was the reason I implemented caching in the first place.

dwzg commented 4 years ago

I agree. A different name for each GPU does not break caching and people who want the original neofetch feeling can still turn off caching for the second GPU and give them the same name. A mention in the readme about multiple GPUs would be good for this.