├── .gitattributes
├── .gitignore
├── LICENSE.md
├── README.md
├── appveyor.yml
└── qutefan
├── Qutefan.pro
├── platforms
├── common
│ ├── common.pri
│ ├── control.cpp
│ └── control.h
├── qnvapi
│ ├── include
│ │ ├── NvApiDriverSettings.c
│ │ ├── NvApiDriverSettings.h
│ │ ├── nvapi.h
│ │ └── nvapi_interface.h
│ ├── nvapi_glue.cpp
│ ├── nvapi_glue.h
│ ├── qnvapi.cpp
│ ├── qnvapi.h
│ └── qnvapi.pri
├── qnvctrl
│ ├── qnvctrl.cpp
│ ├── qnvctrl.h
│ └── qnvctrl.pri
└── qnvml
│ ├── include
│ └── nvml.h
│ ├── qnvml.cpp
│ ├── qnvml.h
│ └── qnvml.pri
├── qutefan.qrc
├── qutefan.rc
├── qutefan
├── doublelabel.cpp
├── doublelabel.h
├── doublelabel.ui
├── gpuslider.cpp
├── gpuslider.h
├── gpuslider.ui
├── gputab.cpp
├── gputab.h
├── gputab.ui
├── gputab_nvapi.cpp
├── gputab_nvapi.h
├── gputab_nvctrl.cpp
├── gputab_nvctrl.h
├── gputab_nvml.cpp
├── gputab_nvml.h
├── main.cpp
├── qutefan.cpp
├── qutefan.h
├── qutefan.pri
├── qutefan.ui
├── trayicon.cpp
└── trayicon.h
└── resources
├── Qutefan.desktop.in
├── Qutefan.exe.manifest
├── Qutefan.ico
├── Qutefan.png
└── status
├── high.png
├── inactive.png
└── low.png
/.gitattributes:
--------------------------------------------------------------------------------
1 | # Auto detect text files and perform LF normalization
2 | * text=auto
3 |
4 | # Custom for Visual Studio
5 | *.cs diff=csharp
6 | *.sln merge=union
7 | *.csproj merge=union
8 | *.vbproj merge=union
9 | *.fsproj merge=union
10 | *.dbproj merge=union
11 |
12 | # Standard to msysgit
13 | *.doc diff=astextplain
14 | *.DOC diff=astextplain
15 | *.docx diff=astextplain
16 | *.DOCX diff=astextplain
17 | *.dot diff=astextplain
18 | *.DOT diff=astextplain
19 | *.pdf diff=astextplain
20 | *.PDF diff=astextplain
21 | *.rtf diff=astextplain
22 | *.RTF diff=astextplain
23 |
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | Thumbs.db
2 |
3 | # C++ objects and libs
4 | *.slo
5 | *.lo
6 | *.o
7 | *.a
8 | *.la
9 | *.lai
10 | *.so
11 | *.dll
12 | *.dylib
13 |
14 | # Qt-es
15 | object_script.*.Release
16 | object_script.*.Debug
17 | *_plugin_import.cpp
18 | /.qmake.cache
19 | /.qmake.stash
20 | *.pro.user
21 | *.pro.user.*
22 | *.qbs.user
23 | *.qbs.user.*
24 | *.moc
25 | moc_*.cpp
26 | moc_*.h
27 | qrc_*.cpp
28 | ui_*.h
29 | *.qmlc
30 | *.jsc
31 | Makefile*
32 | *build-*
33 |
34 | # Qt unit tests
35 | target_wrapper.*
36 |
37 | # QtCreator
38 | *.autosave
39 |
40 | # QtCtreator Qml
41 | *.qmlproject.user
42 | *.qmlproject.user.*
43 |
44 | # QtCtreator CMake
45 | CMakeLists.txt.user*
46 |
47 |
--------------------------------------------------------------------------------
/LICENSE.md:
--------------------------------------------------------------------------------
1 | GNU GENERAL PUBLIC LICENSE
2 | Version 3, 29 June 2007
3 |
4 | Copyright (C) 2007 Free Software Foundation, Inc.
5 | Everyone is permitted to copy and distribute verbatim copies
6 | of this license document, but changing it is not allowed.
7 |
8 | Preamble
9 |
10 | The GNU General Public License is a free, copyleft license for
11 | software and other kinds of works.
12 |
13 | The licenses for most software and other practical works are designed
14 | to take away your freedom to share and change the works. By contrast,
15 | the GNU General Public License is intended to guarantee your freedom to
16 | share and change all versions of a program--to make sure it remains free
17 | software for all its users. We, the Free Software Foundation, use the
18 | GNU General Public License for most of our software; it applies also to
19 | any other work released this way by its authors. You can apply it to
20 | your programs, too.
21 |
22 | When we speak of free software, we are referring to freedom, not
23 | price. Our General Public Licenses are designed to make sure that you
24 | have the freedom to distribute copies of free software (and charge for
25 | them if you wish), that you receive source code or can get it if you
26 | want it, that you can change the software or use pieces of it in new
27 | free programs, and that you know you can do these things.
28 |
29 | To protect your rights, we need to prevent others from denying you
30 | these rights or asking you to surrender the rights. Therefore, you have
31 | certain responsibilities if you distribute copies of the software, or if
32 | you modify it: responsibilities to respect the freedom of others.
33 |
34 | For example, if you distribute copies of such a program, whether
35 | gratis or for a fee, you must pass on to the recipients the same
36 | freedoms that you received. You must make sure that they, too, receive
37 | or can get the source code. And you must show them these terms so they
38 | know their rights.
39 |
40 | Developers that use the GNU GPL protect your rights with two steps:
41 | (1) assert copyright on the software, and (2) offer you this License
42 | giving you legal permission to copy, distribute and/or modify it.
43 |
44 | For the developers' and authors' protection, the GPL clearly explains
45 | that there is no warranty for this free software. For both users' and
46 | authors' sake, the GPL requires that modified versions be marked as
47 | changed, so that their problems will not be attributed erroneously to
48 | authors of previous versions.
49 |
50 | Some devices are designed to deny users access to install or run
51 | modified versions of the software inside them, although the manufacturer
52 | can do so. This is fundamentally incompatible with the aim of
53 | protecting users' freedom to change the software. The systematic
54 | pattern of such abuse occurs in the area of products for individuals to
55 | use, which is precisely where it is most unacceptable. Therefore, we
56 | have designed this version of the GPL to prohibit the practice for those
57 | products. If such problems arise substantially in other domains, we
58 | stand ready to extend this provision to those domains in future versions
59 | of the GPL, as needed to protect the freedom of users.
60 |
61 | Finally, every program is threatened constantly by software patents.
62 | States should not allow patents to restrict development and use of
63 | software on general-purpose computers, but in those that do, we wish to
64 | avoid the special danger that patents applied to a free program could
65 | make it effectively proprietary. To prevent this, the GPL assures that
66 | patents cannot be used to render the program non-free.
67 |
68 | The precise terms and conditions for copying, distribution and
69 | modification follow.
70 |
71 | TERMS AND CONDITIONS
72 |
73 | 0. Definitions.
74 |
75 | "This License" refers to version 3 of the GNU General Public License.
76 |
77 | "Copyright" also means copyright-like laws that apply to other kinds of
78 | works, such as semiconductor masks.
79 |
80 | "The Program" refers to any copyrightable work licensed under this
81 | License. Each licensee is addressed as "you". "Licensees" and
82 | "recipients" may be individuals or organizations.
83 |
84 | To "modify" a work means to copy from or adapt all or part of the work
85 | in a fashion requiring copyright permission, other than the making of an
86 | exact copy. The resulting work is called a "modified version" of the
87 | earlier work or a work "based on" the earlier work.
88 |
89 | A "covered work" means either the unmodified Program or a work based
90 | on the Program.
91 |
92 | To "propagate" a work means to do anything with it that, without
93 | permission, would make you directly or secondarily liable for
94 | infringement under applicable copyright law, except executing it on a
95 | computer or modifying a private copy. Propagation includes copying,
96 | distribution (with or without modification), making available to the
97 | public, and in some countries other activities as well.
98 |
99 | To "convey" a work means any kind of propagation that enables other
100 | parties to make or receive copies. Mere interaction with a user through
101 | a computer network, with no transfer of a copy, is not conveying.
102 |
103 | An interactive user interface displays "Appropriate Legal Notices"
104 | to the extent that it includes a convenient and prominently visible
105 | feature that (1) displays an appropriate copyright notice, and (2)
106 | tells the user that there is no warranty for the work (except to the
107 | extent that warranties are provided), that licensees may convey the
108 | work under this License, and how to view a copy of this License. If
109 | the interface presents a list of user commands or options, such as a
110 | menu, a prominent item in the list meets this criterion.
111 |
112 | 1. Source Code.
113 |
114 | The "source code" for a work means the preferred form of the work
115 | for making modifications to it. "Object code" means any non-source
116 | form of a work.
117 |
118 | A "Standard Interface" means an interface that either is an official
119 | standard defined by a recognized standards body, or, in the case of
120 | interfaces specified for a particular programming language, one that
121 | is widely used among developers working in that language.
122 |
123 | The "System Libraries" of an executable work include anything, other
124 | than the work as a whole, that (a) is included in the normal form of
125 | packaging a Major Component, but which is not part of that Major
126 | Component, and (b) serves only to enable use of the work with that
127 | Major Component, or to implement a Standard Interface for which an
128 | implementation is available to the public in source code form. A
129 | "Major Component", in this context, means a major essential component
130 | (kernel, window system, and so on) of the specific operating system
131 | (if any) on which the executable work runs, or a compiler used to
132 | produce the work, or an object code interpreter used to run it.
133 |
134 | The "Corresponding Source" for a work in object code form means all
135 | the source code needed to generate, install, and (for an executable
136 | work) run the object code and to modify the work, including scripts to
137 | control those activities. However, it does not include the work's
138 | System Libraries, or general-purpose tools or generally available free
139 | programs which are used unmodified in performing those activities but
140 | which are not part of the work. For example, Corresponding Source
141 | includes interface definition files associated with source files for
142 | the work, and the source code for shared libraries and dynamically
143 | linked subprograms that the work is specifically designed to require,
144 | such as by intimate data communication or control flow between those
145 | subprograms and other parts of the work.
146 |
147 | The Corresponding Source need not include anything that users
148 | can regenerate automatically from other parts of the Corresponding
149 | Source.
150 |
151 | The Corresponding Source for a work in source code form is that
152 | same work.
153 |
154 | 2. Basic Permissions.
155 |
156 | All rights granted under this License are granted for the term of
157 | copyright on the Program, and are irrevocable provided the stated
158 | conditions are met. This License explicitly affirms your unlimited
159 | permission to run the unmodified Program. The output from running a
160 | covered work is covered by this License only if the output, given its
161 | content, constitutes a covered work. This License acknowledges your
162 | rights of fair use or other equivalent, as provided by copyright law.
163 |
164 | You may make, run and propagate covered works that you do not
165 | convey, without conditions so long as your license otherwise remains
166 | in force. You may convey covered works to others for the sole purpose
167 | of having them make modifications exclusively for you, or provide you
168 | with facilities for running those works, provided that you comply with
169 | the terms of this License in conveying all material for which you do
170 | not control copyright. Those thus making or running the covered works
171 | for you must do so exclusively on your behalf, under your direction
172 | and control, on terms that prohibit them from making any copies of
173 | your copyrighted material outside their relationship with you.
174 |
175 | Conveying under any other circumstances is permitted solely under
176 | the conditions stated below. Sublicensing is not allowed; section 10
177 | makes it unnecessary.
178 |
179 | 3. Protecting Users' Legal Rights From Anti-Circumvention Law.
180 |
181 | No covered work shall be deemed part of an effective technological
182 | measure under any applicable law fulfilling obligations under article
183 | 11 of the WIPO copyright treaty adopted on 20 December 1996, or
184 | similar laws prohibiting or restricting circumvention of such
185 | measures.
186 |
187 | When you convey a covered work, you waive any legal power to forbid
188 | circumvention of technological measures to the extent such circumvention
189 | is effected by exercising rights under this License with respect to
190 | the covered work, and you disclaim any intention to limit operation or
191 | modification of the work as a means of enforcing, against the work's
192 | users, your or third parties' legal rights to forbid circumvention of
193 | technological measures.
194 |
195 | 4. Conveying Verbatim Copies.
196 |
197 | You may convey verbatim copies of the Program's source code as you
198 | receive it, in any medium, provided that you conspicuously and
199 | appropriately publish on each copy an appropriate copyright notice;
200 | keep intact all notices stating that this License and any
201 | non-permissive terms added in accord with section 7 apply to the code;
202 | keep intact all notices of the absence of any warranty; and give all
203 | recipients a copy of this License along with the Program.
204 |
205 | You may charge any price or no price for each copy that you convey,
206 | and you may offer support or warranty protection for a fee.
207 |
208 | 5. Conveying Modified Source Versions.
209 |
210 | You may convey a work based on the Program, or the modifications to
211 | produce it from the Program, in the form of source code under the
212 | terms of section 4, provided that you also meet all of these conditions:
213 |
214 | a) The work must carry prominent notices stating that you modified
215 | it, and giving a relevant date.
216 |
217 | b) The work must carry prominent notices stating that it is
218 | released under this License and any conditions added under section
219 | 7. This requirement modifies the requirement in section 4 to
220 | "keep intact all notices".
221 |
222 | c) You must license the entire work, as a whole, under this
223 | License to anyone who comes into possession of a copy. This
224 | License will therefore apply, along with any applicable section 7
225 | additional terms, to the whole of the work, and all its parts,
226 | regardless of how they are packaged. This License gives no
227 | permission to license the work in any other way, but it does not
228 | invalidate such permission if you have separately received it.
229 |
230 | d) If the work has interactive user interfaces, each must display
231 | Appropriate Legal Notices; however, if the Program has interactive
232 | interfaces that do not display Appropriate Legal Notices, your
233 | work need not make them do so.
234 |
235 | A compilation of a covered work with other separate and independent
236 | works, which are not by their nature extensions of the covered work,
237 | and which are not combined with it such as to form a larger program,
238 | in or on a volume of a storage or distribution medium, is called an
239 | "aggregate" if the compilation and its resulting copyright are not
240 | used to limit the access or legal rights of the compilation's users
241 | beyond what the individual works permit. Inclusion of a covered work
242 | in an aggregate does not cause this License to apply to the other
243 | parts of the aggregate.
244 |
245 | 6. Conveying Non-Source Forms.
246 |
247 | You may convey a covered work in object code form under the terms
248 | of sections 4 and 5, provided that you also convey the
249 | machine-readable Corresponding Source under the terms of this License,
250 | in one of these ways:
251 |
252 | a) Convey the object code in, or embodied in, a physical product
253 | (including a physical distribution medium), accompanied by the
254 | Corresponding Source fixed on a durable physical medium
255 | customarily used for software interchange.
256 |
257 | b) Convey the object code in, or embodied in, a physical product
258 | (including a physical distribution medium), accompanied by a
259 | written offer, valid for at least three years and valid for as
260 | long as you offer spare parts or customer support for that product
261 | model, to give anyone who possesses the object code either (1) a
262 | copy of the Corresponding Source for all the software in the
263 | product that is covered by this License, on a durable physical
264 | medium customarily used for software interchange, for a price no
265 | more than your reasonable cost of physically performing this
266 | conveying of source, or (2) access to copy the
267 | Corresponding Source from a network server at no charge.
268 |
269 | c) Convey individual copies of the object code with a copy of the
270 | written offer to provide the Corresponding Source. This
271 | alternative is allowed only occasionally and noncommercially, and
272 | only if you received the object code with such an offer, in accord
273 | with subsection 6b.
274 |
275 | d) Convey the object code by offering access from a designated
276 | place (gratis or for a charge), and offer equivalent access to the
277 | Corresponding Source in the same way through the same place at no
278 | further charge. You need not require recipients to copy the
279 | Corresponding Source along with the object code. If the place to
280 | copy the object code is a network server, the Corresponding Source
281 | may be on a different server (operated by you or a third party)
282 | that supports equivalent copying facilities, provided you maintain
283 | clear directions next to the object code saying where to find the
284 | Corresponding Source. Regardless of what server hosts the
285 | Corresponding Source, you remain obligated to ensure that it is
286 | available for as long as needed to satisfy these requirements.
287 |
288 | e) Convey the object code using peer-to-peer transmission, provided
289 | you inform other peers where the object code and Corresponding
290 | Source of the work are being offered to the general public at no
291 | charge under subsection 6d.
292 |
293 | A separable portion of the object code, whose source code is excluded
294 | from the Corresponding Source as a System Library, need not be
295 | included in conveying the object code work.
296 |
297 | A "User Product" is either (1) a "consumer product", which means any
298 | tangible personal property which is normally used for personal, family,
299 | or household purposes, or (2) anything designed or sold for incorporation
300 | into a dwelling. In determining whether a product is a consumer product,
301 | doubtful cases shall be resolved in favor of coverage. For a particular
302 | product received by a particular user, "normally used" refers to a
303 | typical or common use of that class of product, regardless of the status
304 | of the particular user or of the way in which the particular user
305 | actually uses, or expects or is expected to use, the product. A product
306 | is a consumer product regardless of whether the product has substantial
307 | commercial, industrial or non-consumer uses, unless such uses represent
308 | the only significant mode of use of the product.
309 |
310 | "Installation Information" for a User Product means any methods,
311 | procedures, authorization keys, or other information required to install
312 | and execute modified versions of a covered work in that User Product from
313 | a modified version of its Corresponding Source. The information must
314 | suffice to ensure that the continued functioning of the modified object
315 | code is in no case prevented or interfered with solely because
316 | modification has been made.
317 |
318 | If you convey an object code work under this section in, or with, or
319 | specifically for use in, a User Product, and the conveying occurs as
320 | part of a transaction in which the right of possession and use of the
321 | User Product is transferred to the recipient in perpetuity or for a
322 | fixed term (regardless of how the transaction is characterized), the
323 | Corresponding Source conveyed under this section must be accompanied
324 | by the Installation Information. But this requirement does not apply
325 | if neither you nor any third party retains the ability to install
326 | modified object code on the User Product (for example, the work has
327 | been installed in ROM).
328 |
329 | The requirement to provide Installation Information does not include a
330 | requirement to continue to provide support service, warranty, or updates
331 | for a work that has been modified or installed by the recipient, or for
332 | the User Product in which it has been modified or installed. Access to a
333 | network may be denied when the modification itself materially and
334 | adversely affects the operation of the network or violates the rules and
335 | protocols for communication across the network.
336 |
337 | Corresponding Source conveyed, and Installation Information provided,
338 | in accord with this section must be in a format that is publicly
339 | documented (and with an implementation available to the public in
340 | source code form), and must require no special password or key for
341 | unpacking, reading or copying.
342 |
343 | 7. Additional Terms.
344 |
345 | "Additional permissions" are terms that supplement the terms of this
346 | License by making exceptions from one or more of its conditions.
347 | Additional permissions that are applicable to the entire Program shall
348 | be treated as though they were included in this License, to the extent
349 | that they are valid under applicable law. If additional permissions
350 | apply only to part of the Program, that part may be used separately
351 | under those permissions, but the entire Program remains governed by
352 | this License without regard to the additional permissions.
353 |
354 | When you convey a copy of a covered work, you may at your option
355 | remove any additional permissions from that copy, or from any part of
356 | it. (Additional permissions may be written to require their own
357 | removal in certain cases when you modify the work.) You may place
358 | additional permissions on material, added by you to a covered work,
359 | for which you have or can give appropriate copyright permission.
360 |
361 | Notwithstanding any other provision of this License, for material you
362 | add to a covered work, you may (if authorized by the copyright holders of
363 | that material) supplement the terms of this License with terms:
364 |
365 | a) Disclaiming warranty or limiting liability differently from the
366 | terms of sections 15 and 16 of this License; or
367 |
368 | b) Requiring preservation of specified reasonable legal notices or
369 | author attributions in that material or in the Appropriate Legal
370 | Notices displayed by works containing it; or
371 |
372 | c) Prohibiting misrepresentation of the origin of that material, or
373 | requiring that modified versions of such material be marked in
374 | reasonable ways as different from the original version; or
375 |
376 | d) Limiting the use for publicity purposes of names of licensors or
377 | authors of the material; or
378 |
379 | e) Declining to grant rights under trademark law for use of some
380 | trade names, trademarks, or service marks; or
381 |
382 | f) Requiring indemnification of licensors and authors of that
383 | material by anyone who conveys the material (or modified versions of
384 | it) with contractual assumptions of liability to the recipient, for
385 | any liability that these contractual assumptions directly impose on
386 | those licensors and authors.
387 |
388 | All other non-permissive additional terms are considered "further
389 | restrictions" within the meaning of section 10. If the Program as you
390 | received it, or any part of it, contains a notice stating that it is
391 | governed by this License along with a term that is a further
392 | restriction, you may remove that term. If a license document contains
393 | a further restriction but permits relicensing or conveying under this
394 | License, you may add to a covered work material governed by the terms
395 | of that license document, provided that the further restriction does
396 | not survive such relicensing or conveying.
397 |
398 | If you add terms to a covered work in accord with this section, you
399 | must place, in the relevant source files, a statement of the
400 | additional terms that apply to those files, or a notice indicating
401 | where to find the applicable terms.
402 |
403 | Additional terms, permissive or non-permissive, may be stated in the
404 | form of a separately written license, or stated as exceptions;
405 | the above requirements apply either way.
406 |
407 | 8. Termination.
408 |
409 | You may not propagate or modify a covered work except as expressly
410 | provided under this License. Any attempt otherwise to propagate or
411 | modify it is void, and will automatically terminate your rights under
412 | this License (including any patent licenses granted under the third
413 | paragraph of section 11).
414 |
415 | However, if you cease all violation of this License, then your
416 | license from a particular copyright holder is reinstated (a)
417 | provisionally, unless and until the copyright holder explicitly and
418 | finally terminates your license, and (b) permanently, if the copyright
419 | holder fails to notify you of the violation by some reasonable means
420 | prior to 60 days after the cessation.
421 |
422 | Moreover, your license from a particular copyright holder is
423 | reinstated permanently if the copyright holder notifies you of the
424 | violation by some reasonable means, this is the first time you have
425 | received notice of violation of this License (for any work) from that
426 | copyright holder, and you cure the violation prior to 30 days after
427 | your receipt of the notice.
428 |
429 | Termination of your rights under this section does not terminate the
430 | licenses of parties who have received copies or rights from you under
431 | this License. If your rights have been terminated and not permanently
432 | reinstated, you do not qualify to receive new licenses for the same
433 | material under section 10.
434 |
435 | 9. Acceptance Not Required for Having Copies.
436 |
437 | You are not required to accept this License in order to receive or
438 | run a copy of the Program. Ancillary propagation of a covered work
439 | occurring solely as a consequence of using peer-to-peer transmission
440 | to receive a copy likewise does not require acceptance. However,
441 | nothing other than this License grants you permission to propagate or
442 | modify any covered work. These actions infringe copyright if you do
443 | not accept this License. Therefore, by modifying or propagating a
444 | covered work, you indicate your acceptance of this License to do so.
445 |
446 | 10. Automatic Licensing of Downstream Recipients.
447 |
448 | Each time you convey a covered work, the recipient automatically
449 | receives a license from the original licensors, to run, modify and
450 | propagate that work, subject to this License. You are not responsible
451 | for enforcing compliance by third parties with this License.
452 |
453 | An "entity transaction" is a transaction transferring control of an
454 | organization, or substantially all assets of one, or subdividing an
455 | organization, or merging organizations. If propagation of a covered
456 | work results from an entity transaction, each party to that
457 | transaction who receives a copy of the work also receives whatever
458 | licenses to the work the party's predecessor in interest had or could
459 | give under the previous paragraph, plus a right to possession of the
460 | Corresponding Source of the work from the predecessor in interest, if
461 | the predecessor has it or can get it with reasonable efforts.
462 |
463 | You may not impose any further restrictions on the exercise of the
464 | rights granted or affirmed under this License. For example, you may
465 | not impose a license fee, royalty, or other charge for exercise of
466 | rights granted under this License, and you may not initiate litigation
467 | (including a cross-claim or counterclaim in a lawsuit) alleging that
468 | any patent claim is infringed by making, using, selling, offering for
469 | sale, or importing the Program or any portion of it.
470 |
471 | 11. Patents.
472 |
473 | A "contributor" is a copyright holder who authorizes use under this
474 | License of the Program or a work on which the Program is based. The
475 | work thus licensed is called the contributor's "contributor version".
476 |
477 | A contributor's "essential patent claims" are all patent claims
478 | owned or controlled by the contributor, whether already acquired or
479 | hereafter acquired, that would be infringed by some manner, permitted
480 | by this License, of making, using, or selling its contributor version,
481 | but do not include claims that would be infringed only as a
482 | consequence of further modification of the contributor version. For
483 | purposes of this definition, "control" includes the right to grant
484 | patent sublicenses in a manner consistent with the requirements of
485 | this License.
486 |
487 | Each contributor grants you a non-exclusive, worldwide, royalty-free
488 | patent license under the contributor's essential patent claims, to
489 | make, use, sell, offer for sale, import and otherwise run, modify and
490 | propagate the contents of its contributor version.
491 |
492 | In the following three paragraphs, a "patent license" is any express
493 | agreement or commitment, however denominated, not to enforce a patent
494 | (such as an express permission to practice a patent or covenant not to
495 | sue for patent infringement). To "grant" such a patent license to a
496 | party means to make such an agreement or commitment not to enforce a
497 | patent against the party.
498 |
499 | If you convey a covered work, knowingly relying on a patent license,
500 | and the Corresponding Source of the work is not available for anyone
501 | to copy, free of charge and under the terms of this License, through a
502 | publicly available network server or other readily accessible means,
503 | then you must either (1) cause the Corresponding Source to be so
504 | available, or (2) arrange to deprive yourself of the benefit of the
505 | patent license for this particular work, or (3) arrange, in a manner
506 | consistent with the requirements of this License, to extend the patent
507 | license to downstream recipients. "Knowingly relying" means you have
508 | actual knowledge that, but for the patent license, your conveying the
509 | covered work in a country, or your recipient's use of the covered work
510 | in a country, would infringe one or more identifiable patents in that
511 | country that you have reason to believe are valid.
512 |
513 | If, pursuant to or in connection with a single transaction or
514 | arrangement, you convey, or propagate by procuring conveyance of, a
515 | covered work, and grant a patent license to some of the parties
516 | receiving the covered work authorizing them to use, propagate, modify
517 | or convey a specific copy of the covered work, then the patent license
518 | you grant is automatically extended to all recipients of the covered
519 | work and works based on it.
520 |
521 | A patent license is "discriminatory" if it does not include within
522 | the scope of its coverage, prohibits the exercise of, or is
523 | conditioned on the non-exercise of one or more of the rights that are
524 | specifically granted under this License. You may not convey a covered
525 | work if you are a party to an arrangement with a third party that is
526 | in the business of distributing software, under which you make payment
527 | to the third party based on the extent of your activity of conveying
528 | the work, and under which the third party grants, to any of the
529 | parties who would receive the covered work from you, a discriminatory
530 | patent license (a) in connection with copies of the covered work
531 | conveyed by you (or copies made from those copies), or (b) primarily
532 | for and in connection with specific products or compilations that
533 | contain the covered work, unless you entered into that arrangement,
534 | or that patent license was granted, prior to 28 March 2007.
535 |
536 | Nothing in this License shall be construed as excluding or limiting
537 | any implied license or other defenses to infringement that may
538 | otherwise be available to you under applicable patent law.
539 |
540 | 12. No Surrender of Others' Freedom.
541 |
542 | If conditions are imposed on you (whether by court order, agreement or
543 | otherwise) that contradict the conditions of this License, they do not
544 | excuse you from the conditions of this License. If you cannot convey a
545 | covered work so as to satisfy simultaneously your obligations under this
546 | License and any other pertinent obligations, then as a consequence you may
547 | not convey it at all. For example, if you agree to terms that obligate you
548 | to collect a royalty for further conveying from those to whom you convey
549 | the Program, the only way you could satisfy both those terms and this
550 | License would be to refrain entirely from conveying the Program.
551 |
552 | 13. Use with the GNU Affero General Public License.
553 |
554 | Notwithstanding any other provision of this License, you have
555 | permission to link or combine any covered work with a work licensed
556 | under version 3 of the GNU Affero General Public License into a single
557 | combined work, and to convey the resulting work. The terms of this
558 | License will continue to apply to the part which is the covered work,
559 | but the special requirements of the GNU Affero General Public License,
560 | section 13, concerning interaction through a network will apply to the
561 | combination as such.
562 |
563 | 14. Revised Versions of this License.
564 |
565 | The Free Software Foundation may publish revised and/or new versions of
566 | the GNU General Public License from time to time. Such new versions will
567 | be similar in spirit to the present version, but may differ in detail to
568 | address new problems or concerns.
569 |
570 | Each version is given a distinguishing version number. If the
571 | Program specifies that a certain numbered version of the GNU General
572 | Public License "or any later version" applies to it, you have the
573 | option of following the terms and conditions either of that numbered
574 | version or of any later version published by the Free Software
575 | Foundation. If the Program does not specify a version number of the
576 | GNU General Public License, you may choose any version ever published
577 | by the Free Software Foundation.
578 |
579 | If the Program specifies that a proxy can decide which future
580 | versions of the GNU General Public License can be used, that proxy's
581 | public statement of acceptance of a version permanently authorizes you
582 | to choose that version for the Program.
583 |
584 | Later license versions may give you additional or different
585 | permissions. However, no additional obligations are imposed on any
586 | author or copyright holder as a result of your choosing to follow a
587 | later version.
588 |
589 | 15. Disclaimer of Warranty.
590 |
591 | THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY
592 | APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT
593 | HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY
594 | OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,
595 | THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
596 | PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM
597 | IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF
598 | ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
599 |
600 | 16. Limitation of Liability.
601 |
602 | IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
603 | WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS
604 | THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY
605 | GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE
606 | USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF
607 | DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD
608 | PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS),
609 | EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF
610 | SUCH DAMAGES.
611 |
612 | 17. Interpretation of Sections 15 and 16.
613 |
614 | If the disclaimer of warranty and limitation of liability provided
615 | above cannot be given local legal effect according to their terms,
616 | reviewing courts shall apply local law that most closely approximates
617 | an absolute waiver of all civil liability in connection with the
618 | Program, unless a warranty or assumption of liability accompanies a
619 | copy of the Program in return for a fee.
620 |
621 | END OF TERMS AND CONDITIONS
622 |
623 | How to Apply These Terms to Your New Programs
624 |
625 | If you develop a new program, and you want it to be of the greatest
626 | possible use to the public, the best way to achieve this is to make it
627 | free software which everyone can redistribute and change under these terms.
628 |
629 | To do so, attach the following notices to the program. It is safest
630 | to attach them to the start of each source file to most effectively
631 | state the exclusion of warranty; and each file should have at least
632 | the "copyright" line and a pointer to where the full notice is found.
633 |
634 |
635 | Copyright (C)
636 |
637 | This program is free software: you can redistribute it and/or modify
638 | it under the terms of the GNU General Public License as published by
639 | the Free Software Foundation, either version 3 of the License, or
640 | (at your option) any later version.
641 |
642 | This program is distributed in the hope that it will be useful,
643 | but WITHOUT ANY WARRANTY; without even the implied warranty of
644 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
645 | GNU General Public License for more details.
646 |
647 | You should have received a copy of the GNU General Public License
648 | along with this program. If not, see .
649 |
650 | Also add information on how to contact you by electronic and paper mail.
651 |
652 | If the program does terminal interaction, make it output a short
653 | notice like this when it starts in an interactive mode:
654 |
655 | Copyright (C)
656 | This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
657 | This is free software, and you are welcome to redistribute it
658 | under certain conditions; type `show c' for details.
659 |
660 | The hypothetical commands `show w' and `show c' should show the appropriate
661 | parts of the General Public License. Of course, your program's commands
662 | might be different; for a GUI interface, you would use an "about box".
663 |
664 | You should also get your employer (if you work as a programmer) or school,
665 | if any, to sign a "copyright disclaimer" for the program, if necessary.
666 | For more information on this, and how to apply and follow the GNU GPL, see
667 | .
668 |
669 | The GNU General Public License does not permit incorporating your program
670 | into proprietary programs. If your program is a subroutine library, you
671 | may consider it more useful to permit linking proprietary applications with
672 | the library. If this is what you want to do, use the GNU Lesser General
673 | Public License instead of this License. But first, please read
674 | .
675 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | QuteFan
2 |
3 | Light utility to dynamically set GPU fan speed based on tempearture for Windows and Linux.
4 |
5 | On Windows it requires NVApi and on Linux NVCtrl libraries.
6 |
--------------------------------------------------------------------------------
/appveyor.yml:
--------------------------------------------------------------------------------
1 | version: 0.1.0.{branch}.{build}
2 | image: Visual Studio 2019
3 |
4 | environment:
5 | matrix:
6 | # MSVC x86
7 | - name: win32
8 | platform: x86
9 | qt: 5.15.2\msvc2019
10 | suffix: msvc2019
11 | spec: win32-msvc2019
12 |
13 | # MSVC x64
14 | - name: win64
15 | platform: amd64
16 | qt: 5.15.2\msvc2019_64
17 | suffix: msvc2019
18 | spec: win32-msvc2019
19 |
20 | # MinGW x86
21 | - name: win32
22 | platform: mingw
23 | qt: 5.15.2\mingw81_32
24 | suffix: mingw810_64
25 | spec: win32-g++
26 |
27 | # MinGW x64
28 | - name: win64
29 | platform: mingw
30 | qt: 5.15.2\mingw81_64
31 | suffix: mingw810_32
32 | spec: win32-g++
33 |
34 | init:
35 | - if %platform%==mingw set PATH=%PATH:C:\Program Files\Git\usr\bin;=%
36 | - if %platform%==mingw set PATH=C:\Qt\Tools\%suffix%\bin;%PATH%
37 | - set PATH=C:\Qt\%qt%\bin;%PATH%
38 | - if not %platform%==mingw call "C:\Program Files (x86)\Microsoft Visual Studio\2022\BuildTools\Common7\Tools\vsdevcmd\ext\vcvars\vcvars140.bat" %platform%
39 | - if not %platform%==mingw (set spec=%spec%) else (set spec=%spec%)
40 |
41 | before_build:
42 | - md build-%platform%
43 |
44 | build_script:
45 | - cd build-%platform%
46 | - qmake ..\qutefan\Qutefan.pro -spec %spec%
47 | - if not %platform%==mingw (nmake) else (mingw32-make)
48 |
49 | artifacts:
50 | - path: build-%platform%\release\Qutefan.exe
--------------------------------------------------------------------------------
/qutefan/Qutefan.pro:
--------------------------------------------------------------------------------
1 | #-------------------------------------------------
2 | #
3 | # Project created by QtCreator 2014-12-04T17:28:45
4 | #
5 | #-------------------------------------------------
6 |
7 | QT += core gui
8 |
9 | greaterThan(QT_MAJOR_VERSION, 4): QT += widgets
10 |
11 | TARGET = Qutefan
12 | TEMPLATE = app
13 |
14 | CONFIG(debug, debug|release) {
15 | CONFIG += console
16 | }
17 |
18 | QMAKE_CXXFLAGS += -std=c++17
19 |
20 | win32-g++ {
21 | QMAKE_LFLAGS += -static
22 | }
23 |
24 | win32 {
25 | RC_FILE += qutefan.rc
26 | }
27 |
28 | unix {
29 | isEmpty(PREFIX) {
30 | PREFIX=/usr/local
31 | }
32 | target.path = $$PREFIX/bin
33 |
34 | desktop.path = $$PREFIX/share/applications
35 | desktop.files = resources/Qutefan.desktop
36 |
37 | icons.path = $$PREFIX/share/icons/hicolor/128x128/apps/
38 | icons.files = resources/Qutefan.png
39 |
40 | QMAKE_SUBSTITUTES += resources/Qutefan.desktop.in
41 | INSTALLS += desktop icons
42 | }
43 |
44 | # CONFIG += use_nvml
45 |
46 | include(platforms/common/common.pri)
47 | !use_nvml: win32 {
48 | include(platforms/qnvapi/qnvapi.pri)
49 | }
50 | !use_nvml: unix {
51 | include(platforms/qnvctrl/qnvctrl.pri)
52 | }
53 | use_nvml {
54 | include(platforms/qnvml/qnvml.pri)
55 | DEFINES += USE_NVML
56 | }
57 | include(qutefan/qutefan.pri)
58 |
59 | !isEmpty(target.path): INSTALLS += target
60 |
61 | RESOURCES += \
62 | qutefan.qrc
63 |
--------------------------------------------------------------------------------
/qutefan/platforms/common/common.pri:
--------------------------------------------------------------------------------
1 | SOURCES += $$PWD/control.cpp
2 | HEADERS += $$PWD/control.h
3 | INCLUDEPATH += $$PWD
4 |
--------------------------------------------------------------------------------
/qutefan/platforms/common/control.cpp:
--------------------------------------------------------------------------------
1 | #include "control.h"
2 |
--------------------------------------------------------------------------------
/qutefan/platforms/common/control.h:
--------------------------------------------------------------------------------
1 | #pragma once
2 |
3 | #include
4 |
5 | class Control
6 | {
7 | public:
8 | Control() { }
9 | virtual ~Control() { }
10 |
11 | typedef struct _NvGPUBase {
12 | unsigned int cooler_count = 0;
13 | } NvGPUBase;
14 |
15 | virtual bool available() = 0;
16 | virtual void initialize() = 0;
17 |
18 | typedef struct _CoolerLevels {
19 | unsigned int count = 0;
20 | QVector current;
21 | } CoolerLevels;
22 |
23 | typedef struct _CoolerLimits {
24 | unsigned int minimum;
25 | unsigned int maximum;
26 | unsigned int current;
27 | } CoolerLimits;
28 |
29 | typedef struct _Temperature {
30 | unsigned int none;
31 | unsigned int gpu;
32 | unsigned int memory;
33 | unsigned int power_supply;
34 | unsigned int board;
35 | unsigned int unknown;
36 | } Temperatures;
37 |
38 | typedef struct _Frequency {
39 | unsigned int core;
40 | unsigned int memory;
41 | unsigned int shader;
42 | unsigned int video;
43 | unsigned int power;
44 | } Frequencies;
45 |
46 | enum LimitType {
47 | CONTROL_LIMIT_FREQUENCY = 1,
48 | CONTROL_LIMIT_WATTAGE = 2,
49 | CONTROL_LIMIT_RPM = 3,
50 | };
51 |
52 | typedef struct _Limits {
53 | unsigned int maximum;
54 | unsigned int minimum;
55 | unsigned int current;
56 | int denominator;
57 | LimitType type;
58 | } Limits;
59 | };
60 |
61 |
--------------------------------------------------------------------------------
/qutefan/platforms/qnvapi/include/nvapi_interface.h:
--------------------------------------------------------------------------------
1 | /*****************************************************************************\
2 | |* *|
3 | |* Copyright (c) 2019-2022, NVIDIA CORPORATION. All rights reserved. *|
4 | |* *|
5 | |* Permission is hereby granted, free of charge, to any person obtaining a *|
6 | |* copy of this software and associated documentation files (the "Software"), *|
7 | |* to deal in the Software without restriction, including without limitation *|
8 | |* the rights to use, copy, modify, merge, publish, distribute, sublicense, *|
9 | |* and/or sell copies of the Software, and to permit persons to whom the *|
10 | |* Software is furnished to do so, subject to the following conditions: *|
11 | |* *|
12 | |* The above copyright notice and this permission notice shall be included in *|
13 | |* all copies or substantial portions of the Software. *|
14 | |* *|
15 | |* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR *|
16 | |* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, *|
17 | |* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL *|
18 | |* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER *|
19 | |* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING *|
20 | |* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER *|
21 | |* DEALINGS IN THE SOFTWARE. *|
22 | |* *|
23 | |* *|
24 | \*****************************************************************************/
25 | #ifndef _NVAPI_INTERFACE_H
26 | #define _NVAPI_INTERFACE_H
27 |
28 | struct NVAPI_INTERFACE_TABLE { const char * func; unsigned int id; };
29 | struct NVAPI_INTERFACE_TABLE nvapi_interface_table[] =
30 | {
31 | { "NvAPI_Initialize", 0x0150e828 },
32 | { "NvAPI_Unload", 0xd22bdd7e },
33 | { "NvAPI_GetErrorMessage", 0x6c2d048c },
34 | { "NvAPI_GetInterfaceVersionString", 0x01053fa5 },
35 | { "NvAPI_GPU_GetEDID", 0x37d32e69 },
36 | { "NvAPI_SetView", 0x0957d7b6 },
37 | { "NvAPI_SetViewEx", 0x06b89e68 },
38 | { "NvAPI_GetDisplayDriverVersion", 0xf951a4d1 },
39 | { "NvAPI_SYS_GetDriverAndBranchVersion", 0x2926aaad },
40 | { "NvAPI_GPU_GetMemoryInfo", 0x07f9b368 },
41 | { "NvAPI_GPU_GetMemoryInfoEx", 0xc0599498 },
42 | { "NvAPI_OGL_ExpertModeSet", 0x3805ef7a },
43 | { "NvAPI_OGL_ExpertModeGet", 0x22ed9516 },
44 | { "NvAPI_OGL_ExpertModeDefaultsSet", 0xb47a657e },
45 | { "NvAPI_OGL_ExpertModeDefaultsGet", 0xae921f12 },
46 | { "NvAPI_EnumPhysicalGPUs", 0xe5ac921f },
47 | { "NvAPI_EnumTCCPhysicalGPUs", 0xd9930b07 },
48 | { "NvAPI_EnumLogicalGPUs", 0x48b3ea59 },
49 | { "NvAPI_GetPhysicalGPUsFromDisplay", 0x34ef9506 },
50 | { "NvAPI_GetPhysicalGPUFromUnAttachedDisplay", 0x5018ed61 },
51 | { "NvAPI_GetLogicalGPUFromDisplay", 0xee1370cf },
52 | { "NvAPI_GetLogicalGPUFromPhysicalGPU", 0xadd604d1 },
53 | { "NvAPI_GetPhysicalGPUsFromLogicalGPU", 0xaea3fa32 },
54 | { "NvAPI_GetPhysicalGPUFromGPUID", 0x5380ad1a },
55 | { "NvAPI_GetGPUIDfromPhysicalGPU", 0x6533ea3e },
56 | { "NvAPI_GPU_GetShaderSubPipeCount", 0x0be17923 },
57 | { "NvAPI_GPU_GetGpuCoreCount", 0xc7026a87 },
58 | { "NvAPI_GPU_GetAllOutputs", 0x7d554f8e },
59 | { "NvAPI_GPU_GetConnectedOutputs", 0x1730bfc9 },
60 | { "NvAPI_GPU_GetConnectedSLIOutputs", 0x0680de09 },
61 | { "NvAPI_GPU_GetConnectedDisplayIds", 0x0078dba2 },
62 | { "NvAPI_GPU_GetAllDisplayIds", 0x785210a2 },
63 | { "NvAPI_GPU_GetConnectedOutputsWithLidState", 0xcf8caf39 },
64 | { "NvAPI_GPU_GetConnectedSLIOutputsWithLidState", 0x96043cc7 },
65 | { "NvAPI_GPU_GetSystemType", 0xbaaabfcc },
66 | { "NvAPI_GPU_GetActiveOutputs", 0xe3e89b6f },
67 | { "NvAPI_GPU_SetEDID", 0xe83d6456 },
68 | { "NvAPI_GPU_GetOutputType", 0x40a505e4 },
69 | { "NvAPI_GPU_ValidateOutputCombination", 0x34c9c2d4 },
70 | { "NvAPI_GPU_GetFullName", 0xceee8e9f },
71 | { "NvAPI_GPU_GetPCIIdentifiers", 0x2ddfb66e },
72 | { "NvAPI_GPU_GetGPUType", 0xc33baeb1 },
73 | { "NvAPI_GPU_GetBusType", 0x1bb18724 },
74 | { "NvAPI_GPU_GetBusId", 0x1be0b8e5 },
75 | { "NvAPI_GPU_GetBusSlotId", 0x2a0a350f },
76 | { "NvAPI_GPU_GetIRQ", 0xe4715417 },
77 | { "NvAPI_GPU_GetVbiosRevision", 0xacc3da0a },
78 | { "NvAPI_GPU_GetVbiosOEMRevision", 0x2d43fb31 },
79 | { "NvAPI_GPU_GetVbiosVersionString", 0xa561fd7d },
80 | { "NvAPI_GPU_GetAGPAperture", 0x6e042794 },
81 | { "NvAPI_GPU_GetCurrentAGPRate", 0xc74925a0 },
82 | { "NvAPI_GPU_GetCurrentPCIEDownstreamWidth", 0xd048c3b1 },
83 | { "NvAPI_GPU_GetPhysicalFrameBufferSize", 0x46fbeb03 },
84 | { "NvAPI_GPU_GetVirtualFrameBufferSize", 0x5a04b644 },
85 | { "NvAPI_GPU_GetQuadroStatus", 0xe332fa47 },
86 | { "NvAPI_GPU_GetBoardInfo", 0x22d54523 },
87 | { "NvAPI_GPU_GetRamBusWidth", 0x7975c581 },
88 | { "NvAPI_GPU_GetArchInfo", 0xd8265d24 },
89 | { "NvAPI_I2CRead", 0x2fde12c5 },
90 | { "NvAPI_I2CWrite", 0xe812eb07 },
91 | { "NvAPI_GPU_WorkstationFeatureSetup", 0x6c1f3fe4 },
92 | { "NvAPI_GPU_WorkstationFeatureQuery", 0x004537df },
93 | { "NvAPI_GPU_GetHDCPSupportStatus", 0xf089eef5 },
94 | { "NvAPI_GPU_CudaEnumComputeCapableGpus", 0x5786cc6e },
95 | { "NvAPI_GPU_GetTachReading", 0x5f608315 },
96 | { "NvAPI_GPU_GetECCStatusInfo", 0xca1ddaf3 },
97 | { "NvAPI_GPU_GetECCErrorInfo", 0xc71f85a6 },
98 | { "NvAPI_GPU_ResetECCErrorInfo", 0xc02eec20 },
99 | { "NvAPI_GPU_GetECCConfigurationInfo", 0x77a796f3 },
100 | { "NvAPI_GPU_SetECCConfiguration", 0x1cf639d9 },
101 | { "NvAPI_GPU_QueryWorkstationFeatureSupport", 0x80b1abb9 },
102 | { "NvAPI_GPU_SetScanoutIntensity", 0xa57457a4 },
103 | { "NvAPI_GPU_GetScanoutIntensityState", 0xe81ce836 },
104 | { "NvAPI_GPU_SetScanoutWarping", 0xb34bab4f },
105 | { "NvAPI_GPU_GetScanoutWarpingState", 0x6f5435af },
106 | { "NvAPI_GPU_SetScanoutCompositionParameter", 0xf898247d },
107 | { "NvAPI_GPU_GetScanoutCompositionParameter", 0x58fe51e6 },
108 | { "NvAPI_GPU_GetScanoutConfiguration", 0x6a9f5b63 },
109 | { "NvAPI_GPU_GetScanoutConfigurationEx", 0xe2e1e6f0 },
110 | { "NvAPI_GPU_GetAdapterIdFromPhysicalGpu", 0x0ff07fde },
111 | { "NvAPI_GPU_GetVirtualizationInfo", 0x44e022a9 },
112 | { "NvAPI_GPU_GetLogicalGpuInfo", 0x842b066e },
113 | { "NvAPI_GPU_GetLicensableFeatures", 0x3fc596aa },
114 | { "NvAPI_GPU_GetVRReadyData", 0x81d629c5 },
115 | { "NvAPI_GPU_GetPerfDecreaseInfo", 0x7f7f4600 },
116 | { "NvAPI_GPU_GetPstatesInfoEx", 0x843c0256 },
117 | { "NvAPI_GPU_GetPstates20", 0x6ff81213 },
118 | { "NvAPI_GPU_GetCurrentPstate", 0x927da4f6 },
119 | { "NvAPI_GPU_GetDynamicPstatesInfoEx", 0x60ded2ed },
120 | { "NvAPI_GPU_GetThermalSettings", 0xe3640a56 },
121 | { "NvAPI_GPU_GetAllClockFrequencies", 0xdcb616c3 },
122 | { "NvAPI_GPU_QueryIlluminationSupport", 0xa629da31 },
123 | { "NvAPI_GPU_GetIllumination", 0x9a1b9365 },
124 | { "NvAPI_GPU_SetIllumination", 0x0254a187 },
125 | { "NvAPI_GPU_ClientIllumDevicesGetInfo", 0xd4100e58 },
126 | { "NvAPI_GPU_ClientIllumDevicesGetControl", 0x73c01d58 },
127 | { "NvAPI_GPU_ClientIllumDevicesSetControl", 0x57024c62 },
128 | { "NvAPI_GPU_ClientIllumZonesGetInfo", 0x4b81241b },
129 | { "NvAPI_GPU_ClientIllumZonesGetControl", 0x3dbf5764 },
130 | { "NvAPI_GPU_ClientIllumZonesSetControl", 0x197d065e },
131 | { "NvAPI_Event_RegisterCallback", 0xe6dbea69 },
132 | { "NvAPI_Event_UnregisterCallback", 0xde1f9b45 },
133 | { "NvAPI_EnumNvidiaDisplayHandle", 0x9abdd40d },
134 | { "NvAPI_EnumNvidiaUnAttachedDisplayHandle", 0x20de9260 },
135 | { "NvAPI_CreateDisplayFromUnAttachedDisplay", 0x63f9799e },
136 | { "NvAPI_GetAssociatedNvidiaDisplayHandle", 0x35c29134 },
137 | { "NvAPI_DISP_GetAssociatedUnAttachedNvidiaDisplayHandle", 0xa70503b2 },
138 | { "NvAPI_GetAssociatedNvidiaDisplayName", 0x22a78b05 },
139 | { "NvAPI_GetUnAttachedAssociatedDisplayName", 0x4888d790 },
140 | { "NvAPI_EnableHWCursor", 0x2863148d },
141 | { "NvAPI_DisableHWCursor", 0xab163097 },
142 | { "NvAPI_GetVBlankCounter", 0x67b5db55 },
143 | { "NvAPI_SetRefreshRateOverride", 0x3092ac32 },
144 | { "NvAPI_GetAssociatedDisplayOutputId", 0xd995937e },
145 | { "NvAPI_GetDisplayPortInfo", 0xc64ff367 },
146 | { "NvAPI_SetDisplayPort", 0xfa13e65a },
147 | { "NvAPI_GetHDMISupportInfo", 0x6ae16ec3 },
148 | { "NvAPI_Disp_InfoFrameControl", 0x6067af3f },
149 | { "NvAPI_Disp_ColorControl", 0x92f9d80d },
150 | { "NvAPI_Disp_GetHdrCapabilities", 0x84f2a8df },
151 | { "NvAPI_Disp_HdrColorControl", 0x351da224 },
152 | { "NvAPI_Disp_SetSourceColorSpace", 0x473b6caf },
153 | { "NvAPI_Disp_GetSourceColorSpace", 0xceedc85b },
154 | { "NvAPI_Disp_SetSourceHdrMetadata", 0x905eb63b },
155 | { "NvAPI_Disp_GetSourceHdrMetadata", 0x0d3f52da },
156 | { "NvAPI_Disp_SetOutputMode", 0x98e7661a },
157 | { "NvAPI_Disp_GetOutputMode", 0x81fed88d },
158 | { "NvAPI_Disp_SetHdrToneMapping", 0xdd6da362 },
159 | { "NvAPI_Disp_GetHdrToneMapping", 0xfbd36e71 },
160 | { "NvAPI_DISP_GetTiming", 0x175167e9 },
161 | { "NvAPI_DISP_GetMonitorCapabilities", 0x3b05c7e1 },
162 | { "NvAPI_DISP_GetMonitorColorCapabilities", 0x6ae4cfb5 },
163 | { "NvAPI_DISP_EnumCustomDisplay", 0xa2072d59 },
164 | { "NvAPI_DISP_TryCustomDisplay", 0x1f7db630 },
165 | { "NvAPI_DISP_DeleteCustomDisplay", 0x552e5b9b },
166 | { "NvAPI_DISP_SaveCustomDisplay", 0x49882876 },
167 | { "NvAPI_DISP_RevertCustomDisplayTrial", 0xcbbd40f0 },
168 | { "NvAPI_GetView", 0xd6b99d89 },
169 | { "NvAPI_GetViewEx", 0xdbbc0af4 },
170 | { "NvAPI_GetSupportedViews", 0x66fb7fc0 },
171 | { "NvAPI_DISP_GetDisplayIdByDisplayName", 0xae457190 },
172 | { "NvAPI_DISP_GetGDIPrimaryDisplayId", 0x1e9d8a31 },
173 | { "NvAPI_DISP_GetDisplayConfig", 0x11abccf8 },
174 | { "NvAPI_DISP_SetDisplayConfig", 0x5d8cf8de },
175 | { "NvAPI_DISP_GetAdaptiveSyncData", 0xb73d1ee9 },
176 | { "NvAPI_DISP_SetAdaptiveSyncData", 0x3eebba1d },
177 | { "NvAPI_DISP_GetVirtualRefreshRateData", 0x8c00429a },
178 | { "NvAPI_DISP_SetVirtualRefreshRateData", 0x5abbe6a3 },
179 | { "NvAPI_DISP_SetPreferredStereoDisplay", 0xc9d0e25f },
180 | { "NvAPI_DISP_GetPreferredStereoDisplay", 0x1f6b4666 },
181 | { "NvAPI_DISP_GetNvManagedDedicatedDisplays", 0xdbdf0cb2 },
182 | { "NvAPI_DISP_AcquireDedicatedDisplay", 0x47c917ba },
183 | { "NvAPI_DISP_ReleaseDedicatedDisplay", 0x1247825f },
184 | { "NvAPI_Mosaic_GetSupportedTopoInfo", 0xfdb63c81 },
185 | { "NvAPI_Mosaic_GetTopoGroup", 0xcb89381d },
186 | { "NvAPI_Mosaic_GetOverlapLimits", 0x989685f0 },
187 | { "NvAPI_Mosaic_SetCurrentTopo", 0x9b542831 },
188 | { "NvAPI_Mosaic_GetCurrentTopo", 0xec32944e },
189 | { "NvAPI_Mosaic_EnableCurrentTopo", 0x5f1aa66c },
190 | { "NvAPI_Mosaic_GetDisplayViewportsByResolution", 0xdc6dc8d3 },
191 | { "NvAPI_Mosaic_SetDisplayGrids", 0x4d959a89 },
192 | { "NvAPI_Mosaic_ValidateDisplayGrids", 0xcf43903d },
193 | { "NvAPI_Mosaic_EnumDisplayModes", 0x78db97d7 },
194 | { "NvAPI_Mosaic_EnumDisplayGrids", 0xdf2887af },
195 | { "NvAPI_GetSupportedMosaicTopologies", 0x410b5c25 },
196 | { "NvAPI_GetCurrentMosaicTopology", 0xf60852bd },
197 | { "NvAPI_SetCurrentMosaicTopology", 0xd54b8989 },
198 | { "NvAPI_EnableCurrentMosaicTopology", 0x74073cc9 },
199 | { "NvAPI_GSync_EnumSyncDevices", 0xd9639601 },
200 | { "NvAPI_GSync_QueryCapabilities", 0x44a3f1d1 },
201 | { "NvAPI_GSync_GetTopology", 0x4562bc38 },
202 | { "NvAPI_GSync_SetSyncStateSettings", 0x60acdfdd },
203 | { "NvAPI_GSync_GetControlParameters", 0x16de1c6a },
204 | { "NvAPI_GSync_SetControlParameters", 0x8bbff88b },
205 | { "NvAPI_GSync_AdjustSyncDelay", 0x2d11ff51 },
206 | { "NvAPI_GSync_GetSyncStatus", 0xf1f5b434 },
207 | { "NvAPI_GSync_GetStatusParameters", 0x70d404ec },
208 | { "NvAPI_D3D_GetCurrentSLIState", 0x4b708b54 },
209 | { "NvAPI_D3D9_RegisterResource", 0xa064bdfc },
210 | { "NvAPI_D3D9_UnregisterResource", 0xbb2b17aa },
211 | { "NvAPI_D3D9_AliasSurfaceAsTexture", 0xe5ceae41 },
212 | { "NvAPI_D3D9_StretchRectEx", 0x22de03aa },
213 | { "NvAPI_D3D9_ClearRT", 0x332d3942 },
214 | { "NvAPI_D3D_GetObjectHandleForResource", 0xfceac864 },
215 | { "NvAPI_D3D_SetResourceHint", 0x6c0ed98c },
216 | { "NvAPI_D3D_BeginResourceRendering", 0x91123d6a },
217 | { "NvAPI_D3D_EndResourceRendering", 0x37e7191c },
218 | { "NvAPI_D3D9_GetSurfaceHandle", 0x0f2dd3f2 },
219 | { "NvAPI_D3D9_VideoSetStereoInfo", 0xb852f4db },
220 | { "NvAPI_D3D10_SetDepthBoundsTest", 0x4eadf5d2 },
221 | { "NvAPI_D3D11_CreateDevice", 0x6a16d3a0 },
222 | { "NvAPI_D3D11_CreateDeviceAndSwapChain", 0xbb939ee5 },
223 | { "NvAPI_D3D11_SetDepthBoundsTest", 0x7aaf7a04 },
224 | { "NvAPI_D3D11_IsNvShaderExtnOpCodeSupported", 0x5f68da40 },
225 | { "NvAPI_D3D11_SetNvShaderExtnSlot", 0x8e90bb9f },
226 | { "NvAPI_D3D12_SetNvShaderExtnSlotSpace", 0xac2dfeb5 },
227 | { "NvAPI_D3D12_SetNvShaderExtnSlotSpaceLocalThread", 0x43d867c0 },
228 | { "NvAPI_D3D11_SetNvShaderExtnSlotLocalThread", 0x0e6482a0 },
229 | { "NvAPI_D3D11_BeginUAVOverlapEx", 0xba08208a },
230 | { "NvAPI_D3D11_BeginUAVOverlap", 0x65b93ca8 },
231 | { "NvAPI_D3D11_EndUAVOverlap", 0x2216a357 },
232 | { "NvAPI_D3D11_GetResourceHandle", 0x09d52986 },
233 | { "NvAPI_D3D_SetFPSIndicatorState", 0xa776e8db },
234 | { "NvAPI_D3D9_Present", 0x05650beb },
235 | { "NvAPI_D3D9_QueryFrameCount", 0x9083e53a },
236 | { "NvAPI_D3D9_ResetFrameCount", 0xfa6a0675 },
237 | { "NvAPI_D3D9_QueryMaxSwapGroup", 0x5995410d },
238 | { "NvAPI_D3D9_QuerySwapGroup", 0xeba4d232 },
239 | { "NvAPI_D3D9_JoinSwapGroup", 0x7d44bb54 },
240 | { "NvAPI_D3D9_BindSwapBarrier", 0x9c39c246 },
241 | { "NvAPI_D3D1x_Present", 0x03b845a1 },
242 | { "NvAPI_D3D1x_QueryFrameCount", 0x9152e055 },
243 | { "NvAPI_D3D1x_ResetFrameCount", 0xfbbb031a },
244 | { "NvAPI_D3D1x_QueryMaxSwapGroup", 0x9bb9d68f },
245 | { "NvAPI_D3D1x_QuerySwapGroup", 0x407f67aa },
246 | { "NvAPI_D3D1x_JoinSwapGroup", 0x14610cd7 },
247 | { "NvAPI_D3D1x_BindSwapBarrier", 0x9de8c729 },
248 | { "NvAPI_D3D12_QueryPresentBarrierSupport", 0xa15faef7 },
249 | { "NvAPI_D3D12_CreatePresentBarrierClient", 0x4d815de9 },
250 | { "NvAPI_D3D12_RegisterPresentBarrierResources", 0xd53c9ef0 },
251 | { "NvAPI_DestroyPresentBarrierClient", 0x3c5c351b },
252 | { "NvAPI_JoinPresentBarrier", 0x17f6bf82 },
253 | { "NvAPI_LeavePresentBarrier", 0xc3ec5a7f },
254 | { "NvAPI_QueryPresentBarrierFrameStatistics", 0x61b844a1 },
255 | { "NvAPI_D3D12_CreateDDisplayPresentBarrierClient", 0xb5a21987 },
256 | { "NvAPI_D3D11_CreateRasterizerState", 0xdb8d28af },
257 | { "NvAPI_D3D_ConfigureAnsel", 0x341c6c7f },
258 | { "NvAPI_D3D11_CreateTiledTexture2DArray", 0x7886981a },
259 | { "NvAPI_D3D11_CheckFeatureSupport", 0x106a487e },
260 | { "NvAPI_D3D11_CreateImplicitMSAATexture2D", 0xb8f79632 },
261 | { "NvAPI_D3D12_CreateCommittedImplicitMSAATexture2D", 0x24c6a07b },
262 | { "NvAPI_D3D11_ResolveSubresourceRegion", 0xe6bfedd6 },
263 | { "NvAPI_D3D12_ResolveSubresourceRegion", 0xc24a15bf },
264 | { "NvAPI_D3D11_TiledTexture2DArrayGetDesc", 0xf1a2b9d5 },
265 | { "NvAPI_D3D11_UpdateTileMappings", 0x9a06ea07 },
266 | { "NvAPI_D3D11_CopyTileMappings", 0xc09ee6bc },
267 | { "NvAPI_D3D11_TiledResourceBarrier", 0xd6839099 },
268 | { "NvAPI_D3D11_AliasMSAATexture2DAsNonMSAA", 0xf1c54fc9 },
269 | { "NvAPI_D3D11_CreateGeometryShaderEx_2", 0x99ed5c1c },
270 | { "NvAPI_D3D11_CreateVertexShaderEx", 0x0beaa0b2 },
271 | { "NvAPI_D3D11_CreateHullShaderEx", 0xb53cab00 },
272 | { "NvAPI_D3D11_CreateDomainShaderEx", 0xa0d7180d },
273 | { "NvAPI_D3D11_CreatePixelShaderEx_2", 0x4162822b },
274 | { "NvAPI_D3D11_CreateFastGeometryShaderExplicit", 0x71ab7c9c },
275 | { "NvAPI_D3D11_CreateFastGeometryShader", 0x525d43be },
276 | { "NvAPI_D3D11_DecompressView", 0x3a94e822 },
277 | { "NvAPI_D3D12_CreateGraphicsPipelineState", 0x2fc28856 },
278 | { "NvAPI_D3D12_CreateComputePipelineState", 0x2762deac },
279 | { "NvAPI_D3D12_SetDepthBoundsTestValues", 0xb9333fe9 },
280 | { "NvAPI_D3D12_CreateReservedResource", 0x2c85f101 },
281 | { "NvAPI_D3D12_CreateHeap", 0x5cb397cf },
282 | { "NvAPI_D3D12_CreateHeap2", 0x924be9d6 },
283 | { "NvAPI_D3D12_QueryCpuVisibleVidmem", 0x26322bc3 },
284 | { "NvAPI_D3D12_ReservedResourceGetDesc", 0x9aa2aabb },
285 | { "NvAPI_D3D12_UpdateTileMappings", 0xc6017a7d },
286 | { "NvAPI_D3D12_CopyTileMappings", 0x47f78194 },
287 | { "NvAPI_D3D12_ResourceAliasingBarrier", 0xb942bab7 },
288 | { "NvAPI_D3D12_CaptureUAVInfo", 0x6e5ea9db },
289 | { "NvAPI_D3D11_GetResourceGPUVirtualAddressEx", 0xaf6d14da },
290 | { "NvAPI_D3D11_EnumerateMetaCommands", 0xc7453ba8 },
291 | { "NvAPI_D3D11_CreateMetaCommand", 0xf505fba0 },
292 | { "NvAPI_D3D11_InitializeMetaCommand", 0xaec629e9 },
293 | { "NvAPI_D3D11_ExecuteMetaCommand", 0x82236c47 },
294 | { "NvAPI_D3D12_EnumerateMetaCommands", 0xcd9141d8 },
295 | { "NvAPI_D3D12_CreateMetaCommand", 0xeb29634b },
296 | { "NvAPI_D3D12_InitializeMetaCommand", 0xa4125399 },
297 | { "NvAPI_D3D12_ExecuteMetaCommand", 0xde24fc3d },
298 | { "NvAPI_D3D12_CreateCommittedResource", 0x027e98ae },
299 | { "NvAPI_D3D12_GetCopyableFootprints", 0xf6305eb5 },
300 | { "NvAPI_D3D12_CopyTextureRegion", 0x82b91b25 },
301 | { "NvAPI_D3D12_IsNvShaderExtnOpCodeSupported", 0x3dfacec8 },
302 | { "NvAPI_D3D12_GetOptimalThreadCountForMesh", 0xb43995cb },
303 | { "NvAPI_D3D_IsGSyncCapable", 0x9c1eed78 },
304 | { "NvAPI_D3D_IsGSyncActive", 0xe942b0ff },
305 | { "NvAPI_D3D1x_DisableShaderDiskCache", 0xd0cbca7d },
306 | { "NvAPI_D3D11_MultiGPU_GetCaps", 0xd2d25687 },
307 | { "NvAPI_D3D11_MultiGPU_Init", 0x017be49e },
308 | { "NvAPI_D3D11_CreateMultiGPUDevice", 0xbdb20007 },
309 | { "NvAPI_D3D_QuerySinglePassStereoSupport", 0x6f5f0a6d },
310 | { "NvAPI_D3D_SetSinglePassStereoMode", 0xa39e6e6e },
311 | { "NvAPI_D3D12_QuerySinglePassStereoSupport", 0x3b03791b },
312 | { "NvAPI_D3D12_SetSinglePassStereoMode", 0x83556d87 },
313 | { "NvAPI_D3D_QueryMultiViewSupport", 0xb6e0a41c },
314 | { "NvAPI_D3D_SetMultiViewMode", 0x8285c8da },
315 | { "NvAPI_D3D_QueryModifiedWSupport", 0xcbf9f4f5 },
316 | { "NvAPI_D3D_SetModifiedWMode", 0x06ea4bf4 },
317 | { "NvAPI_D3D12_QueryModifiedWSupport", 0x51235248 },
318 | { "NvAPI_D3D12_SetModifiedWMode", 0xe1fdaba7 },
319 | { "NvAPI_D3D_CreateLateLatchObject", 0x2db27d09 },
320 | { "NvAPI_D3D_QueryLateLatchSupport", 0x8ceca0ec },
321 | { "NvAPI_D3D_RegisterDevice", 0x8c02c4d0 },
322 | { "NvAPI_D3D11_MultiDrawInstancedIndirect", 0xd4e26bbf },
323 | { "NvAPI_D3D11_MultiDrawIndexedInstancedIndirect", 0x59e890f9 },
324 | { "NvAPI_D3D_ImplicitSLIControl", 0x2aede111 },
325 | { "NvAPI_D3D12_UseDriverHeapPriorities", 0xf0d978a8 },
326 | { "NvAPI_D3D12_Mosaic_GetCompanionAllocations", 0xa46022c7 },
327 | { "NvAPI_D3D12_Mosaic_GetViewportAndGpuPartitions", 0xb092b818 },
328 | { "NvAPI_D3D1x_GetGraphicsCapabilities", 0x52b1499a },
329 | { "NvAPI_D3D12_GetGraphicsCapabilities", 0x01e87354 },
330 | { "NvAPI_D3D11_RSSetExclusiveScissorRects", 0xae4d73ef },
331 | { "NvAPI_D3D11_RSSetViewportsPixelShadingRates", 0x34f7938f },
332 | { "NvAPI_D3D11_CreateShadingRateResourceView", 0x99ca2dff },
333 | { "NvAPI_D3D11_RSSetShadingRateResourceView", 0x1b0c2f83 },
334 | { "NvAPI_D3D11_RSGetPixelShadingRateSampleOrder", 0x092442a1 },
335 | { "NvAPI_D3D11_RSSetPixelShadingRateSampleOrder", 0xa942373a },
336 | { "NvAPI_D3D_InitializeVRSHelper", 0x4780d70b },
337 | { "NvAPI_D3D_InitializeNvGazeHandler", 0x5b3b7479 },
338 | { "NvAPI_D3D_InitializeSMPAssist", 0x42763d0c },
339 | { "NvAPI_D3D_QuerySMPAssistSupport", 0xc57921de },
340 | { "NvAPI_D3D_GetSleepStatus", 0xaef96ca1 },
341 | { "NvAPI_D3D_SetSleepMode", 0xac1ca9e0 },
342 | { "NvAPI_D3D_Sleep", 0x852cd1d2 },
343 | { "NvAPI_D3D_GetLatency", 0x1a587f9c },
344 | { "NvAPI_D3D_SetLatencyMarker", 0xd9984c05 },
345 | { "NvAPI_D3D12_SetAsyncFrameMarker", 0x13c98f73 },
346 | { "NvAPI_D3D12_NotifyOutOfBandCommandQueue", 0x03d6e8cb },
347 | { "NvAPI_D3D12_CreateCubinComputeShader", 0x2a2c79e8 },
348 | { "NvAPI_D3D12_CreateCubinComputeShaderEx", 0x3151211b },
349 | { "NvAPI_D3D12_CreateCubinComputeShaderWithName", 0x1dc7261f },
350 | { "NvAPI_D3D12_LaunchCubinShader", 0x5c52bb86 },
351 | { "NvAPI_D3D12_DestroyCubinComputeShader", 0x7fb785ba },
352 | { "NvAPI_D3D12_GetCudaTextureObject", 0x80403fc9 },
353 | { "NvAPI_D3D12_GetCudaSurfaceObject", 0x48f5b2ee },
354 | { "NvAPI_D3D12_IsFatbinPTXSupported", 0x70c07832 },
355 | { "NvAPI_D3D12_CreateCuModule", 0xad1a677d },
356 | { "NvAPI_D3D12_EnumFunctionsInModule", 0x7ab88d88 },
357 | { "NvAPI_D3D12_CreateCuFunction", 0xe2436e22 },
358 | { "NvAPI_D3D12_LaunchCuKernelChain", 0x24973538 },
359 | { "NvAPI_D3D12_DestroyCuModule", 0x41c65285 },
360 | { "NvAPI_D3D12_DestroyCuFunction", 0xdf295ea6 },
361 | { "NvAPI_D3D11_CreateCubinComputeShader", 0x0ed98181 },
362 | { "NvAPI_D3D11_CreateCubinComputeShaderEx", 0x32c2a0f6 },
363 | { "NvAPI_D3D11_CreateCubinComputeShaderWithName", 0xb672be19 },
364 | { "NvAPI_D3D11_LaunchCubinShader", 0x427e236d },
365 | { "NvAPI_D3D11_DestroyCubinComputeShader", 0x01682c86 },
366 | { "NvAPI_D3D11_IsFatbinPTXSupported", 0x6086bd93 },
367 | { "NvAPI_D3D11_CreateUnorderedAccessView", 0x74a497a1 },
368 | { "NvAPI_D3D11_CreateShaderResourceView", 0x65cb431e },
369 | { "NvAPI_D3D11_CreateSamplerState", 0x89eca416 },
370 | { "NvAPI_D3D11_GetCudaTextureObject", 0x9006fa68 },
371 | { "NvAPI_D3D11_GetResourceGPUVirtualAddress", 0x1819b423 },
372 | { "NvAPI_D3D12_GetRaytracingCaps", 0x85a6c2a0 },
373 | { "NvAPI_D3D12_GetRaytracingOpacityMicromapArrayPrebuildInfo", 0x4726d180 },
374 | { "NvAPI_D3D12_SetCreatePipelineStateOptions", 0x5c607a27 },
375 | { "NvAPI_D3D12_CheckDriverMatchingIdentifierEx", 0xafb237d4 },
376 | { "NvAPI_D3D12_GetRaytracingAccelerationStructurePrebuildInfoEx", 0x8d025b77 },
377 | { "NvAPI_D3D12_BuildRaytracingOpacityMicromapArray", 0x814f8d11 },
378 | { "NvAPI_D3D12_RelocateRaytracingOpacityMicromapArray", 0x0425c538 },
379 | { "NvAPI_D3D12_EmitRaytracingOpacityMicromapArrayPostbuildInfo", 0x1d9a39b6 },
380 | { "NvAPI_D3D12_BuildRaytracingAccelerationStructureEx", 0xe24ead45 },
381 | { "NvAPI_VIO_GetCapabilities", 0x1dc91303 },
382 | { "NvAPI_VIO_Open", 0x44ee4841 },
383 | { "NvAPI_VIO_Close", 0xd01bd237 },
384 | { "NvAPI_VIO_Status", 0x0e6ce4f1 },
385 | { "NvAPI_VIO_SyncFormatDetect", 0x118d48a3 },
386 | { "NvAPI_VIO_GetConfig", 0xd34a789b },
387 | { "NvAPI_VIO_SetConfig", 0x0e4eec07 },
388 | { "NvAPI_VIO_SetCSC", 0xa1ec8d74 },
389 | { "NvAPI_VIO_GetCSC", 0x7b0d72a3 },
390 | { "NvAPI_VIO_SetGamma", 0x964bf452 },
391 | { "NvAPI_VIO_GetGamma", 0x51d53d06 },
392 | { "NvAPI_VIO_SetSyncDelay", 0x2697a8d1 },
393 | { "NvAPI_VIO_GetSyncDelay", 0x462214a9 },
394 | { "NvAPI_VIO_GetPCIInfo", 0xb981d935 },
395 | { "NvAPI_VIO_IsRunning", 0x96bd040e },
396 | { "NvAPI_VIO_Start", 0xcde8e1a3 },
397 | { "NvAPI_VIO_Stop", 0x6ba2a5d6 },
398 | { "NvAPI_VIO_IsFrameLockModeCompatible", 0x7bf0a94d },
399 | { "NvAPI_VIO_EnumDevices", 0xfd7c5557 },
400 | { "NvAPI_VIO_QueryTopology", 0x869534e2 },
401 | { "NvAPI_VIO_EnumSignalFormats", 0xead72fe4 },
402 | { "NvAPI_VIO_EnumDataFormats", 0x221fa8e8 },
403 | { "NvAPI_Stereo_CreateConfigurationProfileRegistryKey", 0xbe7692ec },
404 | { "NvAPI_Stereo_DeleteConfigurationProfileRegistryKey", 0xf117b834 },
405 | { "NvAPI_Stereo_SetConfigurationProfileValue", 0x24409f48 },
406 | { "NvAPI_Stereo_DeleteConfigurationProfileValue", 0x49bceecf },
407 | { "NvAPI_Stereo_Enable", 0x239c4545 },
408 | { "NvAPI_Stereo_Disable", 0x2ec50c2b },
409 | { "NvAPI_Stereo_IsEnabled", 0x348ff8e1 },
410 | { "NvAPI_Stereo_GetStereoSupport", 0x296c434d },
411 | { "NvAPI_Stereo_CreateHandleFromIUnknown", 0xac7e37f4 },
412 | { "NvAPI_Stereo_DestroyHandle", 0x3a153134 },
413 | { "NvAPI_Stereo_Activate", 0xf6a1ad68 },
414 | { "NvAPI_Stereo_Deactivate", 0x2d68de96 },
415 | { "NvAPI_Stereo_IsActivated", 0x1fb0bc30 },
416 | { "NvAPI_Stereo_GetSeparation", 0x451f2134 },
417 | { "NvAPI_Stereo_SetSeparation", 0x5c069fa3 },
418 | { "NvAPI_Stereo_DecreaseSeparation", 0xda044458 },
419 | { "NvAPI_Stereo_IncreaseSeparation", 0xc9a8ecec },
420 | { "NvAPI_Stereo_GetConvergence", 0x4ab00934 },
421 | { "NvAPI_Stereo_SetConvergence", 0x3dd6b54b },
422 | { "NvAPI_Stereo_DecreaseConvergence", 0x4c87e317 },
423 | { "NvAPI_Stereo_IncreaseConvergence", 0xa17daabe },
424 | { "NvAPI_Stereo_GetFrustumAdjustMode", 0xe6839b43 },
425 | { "NvAPI_Stereo_SetFrustumAdjustMode", 0x7be27fa2 },
426 | { "NvAPI_Stereo_CaptureJpegImage", 0x932cb140 },
427 | { "NvAPI_Stereo_InitActivation", 0xc7177702 },
428 | { "NvAPI_Stereo_Trigger_Activation", 0x0d6c6cd2 },
429 | { "NvAPI_Stereo_CapturePngImage", 0x8b7e99b5 },
430 | { "NvAPI_Stereo_ReverseStereoBlitControl", 0x3cd58f89 },
431 | { "NvAPI_Stereo_SetNotificationMessage", 0x6b9b409e },
432 | { "NvAPI_Stereo_SetActiveEye", 0x96eea9f8 },
433 | { "NvAPI_Stereo_SetDriverMode", 0x5e8f0bec },
434 | { "NvAPI_Stereo_GetEyeSeparation", 0xce653127 },
435 | { "NvAPI_Stereo_IsWindowedModeSupported", 0x40c8ed5e },
436 | { "NvAPI_Stereo_SetSurfaceCreationMode", 0xf5dcfcba },
437 | { "NvAPI_Stereo_GetSurfaceCreationMode", 0x36f1c736 },
438 | { "NvAPI_Stereo_Debug_WasLastDrawStereoized", 0xed4416c5 },
439 | { "NvAPI_Stereo_SetDefaultProfile", 0x44f0ecd1 },
440 | { "NvAPI_Stereo_GetDefaultProfile", 0x624e21c2 },
441 | { "NvAPI_D3D1x_CreateSwapChain", 0x1bc21b66 },
442 | { "NvAPI_D3D9_CreateSwapChain", 0x1a131e09 },
443 | { "NvAPI_DRS_CreateSession", 0x0694d52e },
444 | { "NvAPI_DRS_DestroySession", 0xdad9cff8 },
445 | { "NvAPI_DRS_LoadSettings", 0x375dbd6b },
446 | { "NvAPI_DRS_SaveSettings", 0xfcbc7e14 },
447 | { "NvAPI_DRS_LoadSettingsFromFile", 0xd3ede889 },
448 | { "NvAPI_DRS_SaveSettingsToFile", 0x2be25df8 },
449 | { "NvAPI_DRS_CreateProfile", 0xcc176068 },
450 | { "NvAPI_DRS_DeleteProfile", 0x17093206 },
451 | { "NvAPI_DRS_SetCurrentGlobalProfile", 0x1c89c5df },
452 | { "NvAPI_DRS_GetCurrentGlobalProfile", 0x617bff9f },
453 | { "NvAPI_DRS_GetProfileInfo", 0x61cd6fd6 },
454 | { "NvAPI_DRS_SetProfileInfo", 0x16abd3a9 },
455 | { "NvAPI_DRS_FindProfileByName", 0x7e4a9a0b },
456 | { "NvAPI_DRS_EnumProfiles", 0xbc371ee0 },
457 | { "NvAPI_DRS_GetNumProfiles", 0x1dae4fbc },
458 | { "NvAPI_DRS_CreateApplication", 0x4347a9de },
459 | { "NvAPI_DRS_DeleteApplicationEx", 0xc5ea85a1 },
460 | { "NvAPI_DRS_DeleteApplication", 0x2c694bc6 },
461 | { "NvAPI_DRS_GetApplicationInfo", 0xed1f8c69 },
462 | { "NvAPI_DRS_EnumApplications", 0x7fa2173a },
463 | { "NvAPI_DRS_FindApplicationByName", 0xeee566b2 },
464 | { "NvAPI_DRS_SetSetting", 0x577dd202 },
465 | { "NvAPI_DRS_GetSetting", 0x73bf8338 },
466 | { "NvAPI_DRS_EnumSettings", 0xae3039da },
467 | { "NvAPI_DRS_EnumAvailableSettingIds", 0xf020614a },
468 | { "NvAPI_DRS_EnumAvailableSettingValues", 0x2ec39f90 },
469 | { "NvAPI_DRS_GetSettingIdFromName", 0xcb7309cd },
470 | { "NvAPI_DRS_GetSettingNameFromId", 0xd61cbe6e },
471 | { "NvAPI_DRS_DeleteProfileSetting", 0xe4a26362 },
472 | { "NvAPI_DRS_RestoreAllDefaults", 0x5927b094 },
473 | { "NvAPI_DRS_RestoreProfileDefault", 0xfa5f6134 },
474 | { "NvAPI_DRS_RestoreProfileDefaultSetting", 0x53f0381e },
475 | { "NvAPI_DRS_GetBaseProfile", 0xda8466a0 },
476 | { "NvAPI_SYS_GetChipSetInfo", 0x53dabbca },
477 | { "NvAPI_SYS_GetLidAndDockInfo", 0xcda14d8a },
478 | { "NvAPI_SYS_GetDisplayIdFromGpuAndOutputId", 0x08f2bab4 },
479 | { "NvAPI_SYS_GetGpuAndOutputIdFromDisplayId", 0x112ba1a5 },
480 | { "NvAPI_SYS_GetPhysicalGpuFromDisplayId", 0x9ea74659 },
481 | { "NvAPI_SYS_GetDisplayDriverInfo", 0x721faceb },
482 | { "NvAPI_GPU_ClientRegisterForUtilizationSampleUpdates", 0xadeeaf67 },
483 | };
484 |
485 | #endif // _NVAPI_INTERFACE_H
486 |
--------------------------------------------------------------------------------
/qutefan/platforms/qnvapi/nvapi_glue.cpp:
--------------------------------------------------------------------------------
1 | #include "nvapi_glue.h"
2 |
3 | #include
4 | //#include
5 |
6 | //static QMutex* nvapi_lock = new QMutex(QMutex::Recursive);
7 |
8 | #if defined(Q_PROCESSOR_X86_64)
9 | #define NVAPI_NAME "nvapi64.dll"
10 | #elif defined(Q_PROCESSOR_X86_32)
11 | #define NVAPI_NAME "nvapi.dll"
12 | #else
13 | #error "Uknown architecture"
14 | #endif
15 |
16 | QNvAPIGlue::QNvAPIGlue(QObject *parent) : QLibrary(parent)
17 | {
18 | // QMutexLocker locker(nvapi_lock);
19 |
20 | setFileName(NVAPI_NAME);
21 |
22 | nvapi_QueryInterface = reinterpret_cast(resolve("nvapi_QueryInterface"));
23 |
24 | if(!nvapi_QueryInterface) {
25 | NvAPI_Status status = NVAPI_LIBRARY_NOT_FOUND;
26 | qDebug("NvAPI_QueryInterface() failed with status %d", status);
27 | } else {
28 | nvapi_Initialize = reinterpret_cast (nvapi_QueryInterface(0x0150E828));
29 | nvapi_Unload = reinterpret_cast (nvapi_QueryInterface(0xD22BDD7E));
30 |
31 | nvapi_EnumNvidiaDisplayHandle = reinterpret_cast (nvapi_QueryInterface(0x9ABDD40D));
32 | nvapi_EnumPhysicalGPUs = reinterpret_cast (nvapi_QueryInterface(0xE5AC921F));
33 |
34 |
35 | nvapi_GetInterfaceVersionString = reinterpret_cast (nvapi_QueryInterface(0x01053FA5));
36 | nvapi_GetDisplayDriverVersion = reinterpret_cast (nvapi_QueryInterface(0xF951A4D1));
37 | nvapi_GetPhysicalGPUsFromDisplay = reinterpret_cast (nvapi_QueryInterface(0x34EF9506));
38 | nvapi_GetPhysicalGPUFromGPUID = reinterpret_cast (nvapi_QueryInterface(0x5380AD1A));
39 | nvapi_GetAssociatedNvidiaDisplayHandle = reinterpret_cast (nvapi_QueryInterface(0x35C29134));
40 | nvapi_GetAssociatedDisplayOutputId = reinterpret_cast (nvapi_QueryInterface(0xD995937E));
41 |
42 | nvapi_GetGPUIDFromPhysicalGPU = reinterpret_cast (nvapi_QueryInterface(0x6533EA3E));
43 |
44 | nvapi_GPU_GetThermalSettings = reinterpret_cast (nvapi_QueryInterface(0xE3640A56));
45 | nvapi_GPU_GetFullName = reinterpret_cast (nvapi_QueryInterface(0xCEEE8E9F));
46 | nvapi_GPU_GetEDID = reinterpret_cast (nvapi_QueryInterface(0x37D32E69));
47 | nvapi_GPU_GetTachReading = reinterpret_cast (nvapi_QueryInterface(0x5F608315));
48 | nvapi_GPU_GetAllClocks = reinterpret_cast (nvapi_QueryInterface(0x1BD69F49));
49 | nvapi_GPU_GetAllClockFrequencies = reinterpret_cast (nvapi_QueryInterface(0xDCB616C3));
50 | nvapi_GPU_GetDynamicPstatesInfoEx = reinterpret_cast (nvapi_QueryInterface(0x60DED2ED));
51 | nvapi_GPU_GetMemoryInfo = reinterpret_cast (nvapi_QueryInterface(0x774AA982));
52 | nvapi_GPU_GetPCIIdentifiers = reinterpret_cast (nvapi_QueryInterface(0x2DDFB66E));
53 |
54 | nvapi_GPU_GetUsages = reinterpret_cast (nvapi_QueryInterface(0x189A1FDF));
55 | // Non-RTX
56 | nvapi_GPU_GetCoolerSettings = reinterpret_cast (nvapi_QueryInterface(0xDA141340));
57 | nvapi_GPU_SetCoolerLevels = reinterpret_cast (nvapi_QueryInterface(0x891FA0AE));
58 | // RTX
59 | nvapi_GPU_GetClientFanCoolersInfo = reinterpret_cast (nvapi_QueryInterface(0xFB85B01E));
60 | nvapi_GPU_GetClientFanCoolersStatus = reinterpret_cast (nvapi_QueryInterface(0x35AED5E8));
61 | nvapi_GPU_GetClientFanCoolersControl = reinterpret_cast (nvapi_QueryInterface(0x814B209F));
62 | nvapi_GPU_SetClientFanCoolersControl = reinterpret_cast (nvapi_QueryInterface(0xA58971A5));
63 | }
64 | }
65 |
66 | QNvAPIGlue::~QNvAPIGlue()
67 | {
68 | unload();
69 | }
70 |
71 | bool QNvAPIGlue::unload()
72 | {
73 | NvAPI_Status status = Unload();
74 | return status == NVAPI_OK && QLibrary::unload();
75 | }
76 |
77 | NvAPI_Status QNvAPIGlue::Initialize(void)
78 | {
79 | NvAPI_Status status = nvapi_Initialize();
80 | if(status != NVAPI_OK)
81 | qDebug("%s failed with status %d", __PRETTY_FUNCTION__, status);
82 | return status;
83 | }
84 |
85 | NvAPI_Status QNvAPIGlue::Unload(void)
86 | {
87 | NvAPI_Status status = nvapi_Unload();
88 | if(status != NVAPI_OK)
89 | qDebug("%s failed with status %d", __PRETTY_FUNCTION__, status);
90 | return status;
91 | }
92 |
93 | NvAPI_Status QNvAPIGlue::EnumNvidiaDisplayHandle(NvU32 thisEnum, NvDisplayHandle* pNvDispHandle)
94 | {
95 | NvAPI_Status status = nvapi_EnumNvidiaDisplayHandle(thisEnum, pNvDispHandle);
96 | if(status != NVAPI_OK)
97 | qDebug("NvAPI_EnumNvidiaDisplayHandle() failed with status %d", status);
98 | return status;
99 | }
100 |
101 | NvAPI_Status QNvAPIGlue::EnumPhysicalGPUs(NvPhysicalGpuHandle nvGPUHandle[NVAPI_MAX_PHYSICAL_GPUS], NvU32* pGpuCount)
102 | {
103 | NvAPI_Status status = nvapi_EnumPhysicalGPUs(nvGPUHandle, pGpuCount);
104 | if(status != NVAPI_OK)
105 | qDebug("NvAPI_EnumPhysicalGPUs() failed with status %d", status);
106 | return status;
107 | }
108 |
109 | NvAPI_Status QNvAPIGlue::GetInterfaceVersionString(NvAPI_ShortString szDesc)
110 | {
111 | NvAPI_Status status = nvapi_GetInterfaceVersionString(szDesc);
112 | if(status != NVAPI_OK)
113 | qDebug("NvAPI_GetInterfaceVersionString() failed with status %d", status);
114 | return status;
115 | }
116 |
117 | NvAPI_Status QNvAPIGlue::GetDisplayDriverVersion(NvDisplayHandle hNvDisplay, NV_DISPLAY_DRIVER_VERSION* pVersion)
118 | {
119 | pVersion->version = NV_DISPLAY_DRIVER_VERSION_VER;
120 | NvAPI_Status status = nvapi_GetDisplayDriverVersion(hNvDisplay, pVersion);
121 | if(status != NVAPI_OK)
122 | qDebug("NvAPI_GetDisplayDriverVersion() failed with status %d", status);
123 | return status;
124 | }
125 |
126 | NvAPI_Status QNvAPIGlue::GetPhysicalGPUsFromDisplay(NvDisplayHandle hNvDisp, NvPhysicalGpuHandle nvGPUHandle[NVAPI_MAX_PHYSICAL_GPUS], NvU32* pGpuCount)
127 | {
128 | NvAPI_Status status = nvapi_GetPhysicalGPUsFromDisplay(hNvDisp, nvGPUHandle, pGpuCount);
129 | if(status != NVAPI_OK)
130 | qDebug("NvAPI_GetPhysicalGPUsFromDisplay() failed with status %d", status);
131 | return status;
132 | }
133 |
134 | NvAPI_Status QNvAPIGlue::GetPhysicalGPUFromGPUID(NvU32 gpuId, NvPhysicalGpuHandle* nvGPUHandle)
135 | {
136 | NvAPI_Status status = nvapi_GetPhysicalGPUFromGPUID(gpuId, nvGPUHandle);
137 | if(status != NVAPI_OK)
138 | qDebug("NvAPI_GetGetPhysicalGPUFromGPUID() failed with status %d", status);
139 | return status;
140 | }
141 |
142 | NvAPI_Status QNvAPIGlue::GetAssociatedNvidiaDisplayHandle(const char* szDisplayName, NvDisplayHandle* pNvDispHandle)
143 | {
144 | NvAPI_Status status = nvapi_GetAssociatedNvidiaDisplayHandle(szDisplayName, pNvDispHandle);
145 | if(status != NVAPI_OK)
146 | qDebug("NvAPI_GetAssociatedNvidiaDisplayHandle() failed with status %d", status);
147 | return status;
148 | }
149 |
150 | NvAPI_Status QNvAPIGlue::GetAssociatedDisplayOutputId(NvDisplayHandle hNvDisplay, NvU32* pOutputId)
151 | {
152 | NvAPI_Status status = nvapi_GetAssociatedDisplayOutputId(hNvDisplay, pOutputId);
153 | if(status != NVAPI_OK)
154 | qDebug("NvAPI_GetAssociatedDisplayOutputId() failed with status %d", status);
155 | return status;
156 | }
157 |
158 | NvAPI_Status QNvAPIGlue::GetGPUIDFromPhysicalGPU(NvPhysicalGpuHandle hPhysicalGpu, NvU32* gpuId)
159 | {
160 | NvAPI_Status status = nvapi_GetGPUIDFromPhysicalGPU(hPhysicalGpu, gpuId);
161 | if(status != NVAPI_OK)
162 | qDebug("NvAPI_GetGPUIDFromPhysicalGPU() failed with status %d", status);
163 | return status;
164 | }
165 |
166 | NvAPI_Status QNvAPIGlue::GPU_GetThermalSettings(NvPhysicalGpuHandle hPhysicalGpu, NvU32 sensorIndex, NV_GPU_THERMAL_SETTINGS* pThermalSettings)
167 | {
168 | pThermalSettings->version = NV_GPU_THERMAL_SETTINGS_VER;
169 | NvAPI_Status status = nvapi_GPU_GetThermalSettings(hPhysicalGpu, sensorIndex, pThermalSettings);
170 | if(status != NVAPI_OK)
171 | qDebug("NvAPI_GPU_GetThermalSettings() failed with status %d", status);
172 | return status;
173 | }
174 |
175 | NvAPI_Status QNvAPIGlue::GPU_GetFullName(NvPhysicalGpuHandle hPhysicalGpu, NvAPI_ShortString szName)
176 | {
177 | NvAPI_Status status = nvapi_GPU_GetFullName(hPhysicalGpu, szName);
178 | if(status != NVAPI_OK)
179 | qDebug("NvAPI_GPU_GetFullName() failed with status %d", status);
180 | return status;
181 | }
182 |
183 | NvAPI_Status QNvAPIGlue::GPU_GetEDID(NvPhysicalGpuHandle hPhysicalGpu, NvU32 displayOutputId, NV_EDID* pEDID)
184 | {
185 | NvAPI_Status status = nvapi_GPU_GetEDID(hPhysicalGpu, displayOutputId, pEDID);
186 | if(status != NVAPI_OK)
187 | qDebug("NvAPI_GPU_GetEDID() failed with status %d", status);
188 | return status;
189 | }
190 |
191 | NvAPI_Status QNvAPIGlue::GPU_GetTachReading(NvPhysicalGpuHandle hPhysicalGpu, NvU32* pValue)
192 | {
193 | NvAPI_Status status = nvapi_GPU_GetTachReading(hPhysicalGpu, pValue);
194 | if(status != NVAPI_OK)
195 | qDebug("NvAPI_GPU_GetTachReading() failed with status %d", status);
196 | return status;
197 | }
198 |
199 | NvAPI_Status QNvAPIGlue::GPU_GetAllClocks(__in NvPhysicalGpuHandle hPhysicalGpu, __inout NV_GPU_CLOCKS* pClocks)
200 | {
201 | pClocks->version = NV_GPU_CLOCKS_VER;
202 | NvAPI_Status status = nvapi_GPU_GetAllClocks(hPhysicalGpu, pClocks);
203 | if(status != NVAPI_OK)
204 | qDebug("NvAPI_GPU_GetAllClocks() failed with status %d", status);
205 | return status;
206 | }
207 |
208 | NvAPI_Status QNvAPIGlue::GPU_GetAllClockFrequencies(__in NvPhysicalGpuHandle hPhysicalGpu, __inout NV_GPU_CLOCK_FREQUENCIES* pClkFreqs)
209 | {
210 | pClkFreqs->version = NV_GPU_CLOCK_FREQUENCIES_VER;
211 | NvAPI_Status status = nvapi_GPU_GetAllClockFrequencies(hPhysicalGpu, pClkFreqs);
212 | if(status != NVAPI_OK)
213 | qDebug("NvAPI_GPU_GetAllClockFrequencies() failed with status %d", status);
214 | return status;
215 | }
216 |
217 | NvAPI_Status QNvAPIGlue::GPU_GetDynamicPstatesInfoEx(__in NvPhysicalGpuHandle hPhysicalGpu, __inout NV_GPU_DYNAMIC_PSTATES_INFO_EX* pDynamicPstatesInfoEx)
218 | {
219 | pDynamicPstatesInfoEx->version = NV_GPU_PERF_PSTATES20_INFO_VER;
220 | NvAPI_Status status = nvapi_GPU_GetDynamicPstatesInfoEx(hPhysicalGpu, pDynamicPstatesInfoEx);
221 | if(status != NVAPI_OK)
222 | qDebug("NvAPI_GPU_GetDynamicPstatesInfoEx() failed with status %d", status);
223 | return status;
224 | }
225 |
226 | NvAPI_Status QNvAPIGlue::GPU_GetMemoryInfo(NvPhysicalGpuHandle hPhysicalGpu, NV_DISPLAY_DRIVER_MEMORY_INFO* pMemoryInfo)
227 | {
228 | pMemoryInfo->version = NV_DISPLAY_DRIVER_MEMORY_INFO_VER;
229 | NvAPI_Status status = nvapi_GPU_GetMemoryInfo(hPhysicalGpu, pMemoryInfo);
230 | if(status != NVAPI_OK)
231 | qDebug("NvAPI_GPU_GetMemoryInfo() failed with status %d", status);
232 | return status;
233 | }
234 |
235 | NvAPI_Status QNvAPIGlue::GPU_GetPCIIdentifiers(NvPhysicalGpuHandle hPhysicalGpu, NvU32* pDeviceId, NvU32* pSubSystemId, NvU32* pRevisionId, NvU32* pExtDeviceId)
236 | {
237 | NvAPI_Status status = nvapi_GPU_GetPCIIdentifiers(hPhysicalGpu, pDeviceId, pSubSystemId, pRevisionId, pExtDeviceId);
238 | if(status != NVAPI_OK)
239 | qDebug("NvAPI_GPU_GetPCIIdentifiers() failed with status %d", status);
240 | return status;
241 | }
242 |
243 | NvAPI_Status QNvAPIGlue::GPU_GetUsages(NvPhysicalGpuHandle hPhysicalGpu, NV_GPU_USAGES* pGpuUsages)
244 | {
245 | pGpuUsages->version = NV_GPU_USAGES_VER;
246 | NvAPI_Status status = nvapi_GPU_GetUsages(hPhysicalGpu, pGpuUsages);
247 | if(status != NVAPI_OK)
248 | qDebug("NvAPI_GPU_GetUsages() failed with status %d", status);
249 | return status;
250 | }
251 |
252 | NvAPI_Status QNvAPIGlue::GPU_GetCoolerSettings(__in NvPhysicalGpuHandle hPhysicalGpu, __in NvU32 coolerIndex, __inout NV_GPU_COOLER_SETTINGS* pCoolerSettings)
253 | {
254 | pCoolerSettings->version = NV_GPU_COOLER_SETTINGS_VER;
255 | NvAPI_Status status = nvapi_GPU_GetCoolerSettings(hPhysicalGpu, coolerIndex, pCoolerSettings);
256 | if(status != NVAPI_OK)
257 | qDebug("%s failed with status %d", __PRETTY_FUNCTION__, status);
258 | return status;
259 | }
260 |
261 | NvAPI_Status QNvAPIGlue::GPU_SetCoolerLevels(NvPhysicalGpuHandle hPhysicalGpu, NvU32 coolerIndex, NV_GPU_COOLER_LEVELS* pCoolerLevels)
262 | {
263 | pCoolerLevels->version = NV_GPU_COOLER_LEVELS_VER;
264 | NvAPI_Status status = nvapi_GPU_SetCoolerLevels(hPhysicalGpu, coolerIndex, pCoolerLevels);
265 | if(status != NVAPI_OK)
266 | qDebug("NvAPI_GPU_SetCoolerLevels() failed with status %d", status);
267 | return status;
268 | }
269 |
270 | NvAPI_Status QNvAPIGlue::GPU_GetClientFanCoolersInfo(NvPhysicalGpuHandle hPhysicalGpu, NV_GPU_FAN_COOLERS_INFO *pCoolersInfo)
271 | {
272 | pCoolersInfo->version = NV_GPU_FAN_COOLERS_INFO_VER;
273 | NvAPI_Status status = nvapi_GPU_GetClientFanCoolersInfo(hPhysicalGpu, pCoolersInfo);
274 | if(status != NVAPI_OK)
275 | qDebug("%s failed with status %d", __PRETTY_FUNCTION__, status);
276 | return status;
277 | }
278 |
279 | NvAPI_Status QNvAPIGlue::GPU_GetClientFanCoolersStatus(NvPhysicalGpuHandle hPhysicalGpu, NV_GPU_FAN_COOLERS_STATUS *pCoolersStatus)
280 | {
281 | pCoolersStatus->version = NV_GPU_FAN_COOLERS_STATUS_VER;
282 | NvAPI_Status status = nvapi_GPU_GetClientFanCoolersStatus(hPhysicalGpu, pCoolersStatus);
283 | if(status != NVAPI_OK)
284 | qDebug("%s failed with status %d", __PRETTY_FUNCTION__, status);
285 | return status;
286 | }
287 |
288 | NvAPI_Status QNvAPIGlue::GPU_GetClientFanCoolersControl(NvPhysicalGpuHandle hPhysicalGpu, NV_GPU_FAN_COOLERS_CONTROL *pCoolersControl)
289 | {
290 | pCoolersControl->version = NV_GPU_FAN_COOLERS_CONTROL_VER;
291 | NvAPI_Status status = nvapi_GPU_GetClientFanCoolersControl(hPhysicalGpu, pCoolersControl);
292 | if(status != NVAPI_OK)
293 | qDebug("%s failed with status %d", __PRETTY_FUNCTION__, status);
294 | return status;
295 | }
296 |
297 | NvAPI_Status QNvAPIGlue::GPU_SetClientFanCoolersControl(NvPhysicalGpuHandle hPhysicalGpu, NV_GPU_FAN_COOLERS_CONTROL *pCoolersControl)
298 | {
299 | pCoolersControl->version = NV_GPU_FAN_COOLERS_CONTROL_VER;
300 | NvAPI_Status status = nvapi_GPU_SetClientFanCoolersControl(hPhysicalGpu, pCoolersControl);
301 | if(status != NVAPI_OK)
302 | qDebug("%s failed with status %d", __PRETTY_FUNCTION__, status);
303 | return status;
304 | }
305 |
306 | bool QNvAPIGlue::isAvailable(void)
307 | {
308 | return nvapi_QueryInterface &&
309 | nvapi_Initialize &&
310 | nvapi_Unload &&
311 | nvapi_EnumNvidiaDisplayHandle &&
312 | nvapi_EnumPhysicalGPUs &&
313 | nvapi_GetInterfaceVersionString &&
314 | nvapi_GetDisplayDriverVersion &&
315 | nvapi_GetPhysicalGPUsFromDisplay &&
316 | nvapi_GetPhysicalGPUFromGPUID &&
317 | nvapi_GetAssociatedNvidiaDisplayHandle &&
318 | nvapi_GetAssociatedDisplayOutputId &&
319 | nvapi_GetGPUIDFromPhysicalGPU &&
320 | nvapi_GPU_GetThermalSettings &&
321 | nvapi_GPU_GetFullName &&
322 | nvapi_GPU_GetEDID &&
323 | nvapi_GPU_GetTachReading &&
324 | nvapi_GPU_GetAllClocks &&
325 | nvapi_GPU_GetAllClockFrequencies &&
326 | nvapi_GPU_GetDynamicPstatesInfoEx &&
327 | nvapi_GPU_GetMemoryInfo &&
328 | nvapi_GPU_GetPCIIdentifiers &&
329 | nvapi_GPU_GetUsages &&
330 | nvapi_GPU_GetCoolerSettings &&
331 | nvapi_GPU_SetCoolerLevels &&
332 | nvapi_GPU_GetClientFanCoolersInfo &&
333 | nvapi_GPU_GetClientFanCoolersStatus &&
334 | nvapi_GPU_GetClientFanCoolersControl &&
335 | nvapi_GPU_SetClientFanCoolersControl
336 | ;
337 | }
338 |
339 | bool QNvAPIGlue::isRtx(NvPhysicalGpuHandle hPhysicalGpu)
340 | {
341 | NV_GPU_COOLER_SETTINGS settings;
342 | settings.version = NV_GPU_COOLER_SETTINGS_VER;
343 | NvAPI_Status status = nvapi_GPU_GetCoolerSettings(hPhysicalGpu, NV_COOLER_TARGET_ALL, &settings);
344 | if (status == NVAPI_OK) {
345 | qDebug("%s succeded with status %d, not an RTX card", __PRETTY_FUNCTION__, status);
346 | return false;
347 | } else {
348 | qDebug("%s failed with status %d, it's an RTX card", __PRETTY_FUNCTION__, status);
349 | return true;
350 | }
351 | }
352 |
--------------------------------------------------------------------------------
/qutefan/platforms/qnvapi/nvapi_glue.h:
--------------------------------------------------------------------------------
1 | #ifndef NVAPI_GLUE_H
2 | #define NVAPI_GLUE_H
3 |
4 | #include
5 |
6 | #include "include/nvapi.h"
7 |
8 | /*! \class QNvAPI
9 | * \brief A wrapper around the Nvidia NvAPI library.
10 | *
11 | * \note nvapi.dll does not directly export the required symbols so
12 | * we use the QueryInterface method with known function pointers. This
13 | * may break with future versions of the library.
14 | *
15 | */
16 |
17 | #define NVAPI_MAX_USAGES_PER_GPU 33
18 | typedef struct _NV_GPU_USAGES_V1 {
19 | NvU32 version;
20 | NvU32 usage[NVAPI_MAX_USAGES_PER_GPU] = {};
21 | } NV_GPU_USAGES_V1;
22 | #define NV_GPU_USAGES_VER_1 MAKE_NVAPI_VERSION(NV_GPU_USAGES_V1,1)
23 | typedef NV_GPU_USAGES_V1 NV_GPU_USAGES;
24 | #define NV_GPU_USAGES_VER NV_GPU_USAGES_VER_1
25 |
26 |
27 | typedef enum _NV_COOLER_TYPE : NvS32 {
28 | NV_COOLER_TYPE_NONE = 0,
29 | NV_COOLER_TYPE_FAN,
30 | NV_COOLER_TYPE_WATER,
31 | NV_COOLER_TYPE_LIQUID_NO2,
32 | } NV_COOLER_TYPE;
33 |
34 | typedef enum _NV_COOLER_CONTROLLER : NvS32 {
35 | NV_COOLER_CONTROLLER_NONE = 0,
36 | NV_COOLER_CONTROLLER_ADI,
37 | NV_COOLER_CONTROLLER_INTERNAL,
38 | } NV_COOLER_CONTROLLER;
39 |
40 | typedef enum _NV_COOLER_POLICY : NvS32 {
41 | NV_COOLER_POLICY_NONE = 0,
42 | NV_COOLER_POLICY_MANUAL = 1,
43 | NV_COOLER_POLICY_PERF = 2,
44 | NV_COOLER_POLICY_DISCRETE = 4,
45 | NV_COOLER_POLICY_CONTINUOUS_HW = 8,
46 | NV_COOLER_POLICY_CONTINUOUS_SW = 16,
47 | NV_COOLER_POLICY_DEFAULT = 32,
48 | } NV_COOLER_POLICY;
49 |
50 | typedef enum _NV_COOLER_TARGET : NvS32 {
51 | NV_COOLER_TARGET_NONE = 0,
52 | NV_COOLER_TARGET_GPU = 1,
53 | NV_COOLER_TARGET_MEMORY = 2,
54 | NV_COOLER_TARGET_POWER_SUPPLY = 4,
55 | NV_COOLER_TARGET_ALL = 7,
56 | } NV_COOLER_TARGET;
57 |
58 | typedef enum _NV_COOLER_CONTROL : NvS32 {
59 | NV_COOLER_CONTROL_NONE = 0,
60 | NV_COOLER_CONTROL_TOGGLE,
61 | NV_COOLER_CONTROL_VARIABLE,
62 | } NV_COOLER_CONTROL;
63 |
64 | typedef enum _NV_COOLER_ACTIVITY_LEVEL : NvS32 {
65 | NV_COOLER_ACTIVITY_LEVEL_INACTIVE = 0,
66 | NV_COOLER_ACTIVITY_LEVEL_ACTIVE = 1,
67 | } NV_COOLER_ACTIVITY_LEVEL;
68 |
69 | #define NVAPI_MAX_COOLERS_PER_GPU 3
70 | // NV_GPU_COOLER_SETTINGS_V2 version only changed the number of coolers
71 | //#define NVAPI_MAX_COOLERS_PER_GPU 20
72 |
73 | typedef struct _NV_GPU_COOLER_SETTINGS_V1 {
74 | NvU32 version;
75 | NvU32 count = 0;
76 | struct {
77 | NV_COOLER_TYPE type;
78 | NV_COOLER_CONTROLLER controller;
79 | NvS32 default_level_min;
80 | NvS32 default_level_max;
81 | NvS32 current_level_min;
82 | NvS32 current_level_max;
83 | NvS32 current_level;
84 | NV_COOLER_POLICY default_policy;
85 | NV_COOLER_POLICY current_policy;
86 | NV_COOLER_TARGET target;
87 | NV_COOLER_CONTROL control_type;
88 | NV_COOLER_ACTIVITY_LEVEL active;
89 | } cooler[NVAPI_MAX_COOLERS_PER_GPU] = {};
90 | } NV_GPU_COOLER_SETTINGS_V1;
91 | #define NV_GPU_COOLER_SETTINGS_VER_1 MAKE_NVAPI_VERSION(NV_GPU_COOLER_SETTINGS_V1,1)
92 | typedef NV_GPU_COOLER_SETTINGS_V1 NV_GPU_COOLER_SETTINGS;
93 | #define NV_GPU_COOLER_SETTINGS_VER NV_GPU_COOLER_SETTINGS_VER_1
94 |
95 | typedef struct _NV_GPU_COOLER_LEVELS_V1 {
96 | NvU32 version;
97 | struct {
98 | NvS32 level;
99 | NV_COOLER_POLICY policy;
100 | } cooler[NVAPI_MAX_COOLERS_PER_GPU] = {};
101 | } NV_GPU_COOLER_LEVELS_V1;
102 | #define NV_GPU_COOLER_LEVELS_VER_1 MAKE_NVAPI_VERSION(NV_GPU_COOLER_LEVELS_V1,1)
103 | typedef NV_GPU_COOLER_LEVELS_V1 NV_GPU_COOLER_LEVELS;
104 | #define NV_GPU_COOLER_LEVELS_VER NV_GPU_COOLER_LEVELS_VER_1
105 |
106 |
107 | #define NVAPI_CLIENT_MAX_COOLERS_PER_GPU 32
108 |
109 | typedef struct _NV_GPU_FAN_COOLERS_INFO_V1 {
110 | NvU32 version;
111 | NvU32 _reserved1;
112 | NvU32 count = 0;
113 | NvU32 _reserved2[8] = {};
114 | struct {
115 | NvU32 handle;
116 | NvU32 _reserved1;
117 | NvU32 _reserved2;
118 | NvU32 rpm_max;
119 | NvU32 _reserved3[8];
120 | } cooler[NVAPI_CLIENT_MAX_COOLERS_PER_GPU] = {};
121 | } NV_GPU_FAN_COOLERS_INFO_V1;
122 | #define NV_GPU_FAN_COOLERS_INFO_VER_1 MAKE_NVAPI_VERSION(NV_GPU_FAN_COOLERS_INFO_V1,1)
123 | typedef NV_GPU_FAN_COOLERS_INFO_V1 NV_GPU_FAN_COOLERS_INFO;
124 | #define NV_GPU_FAN_COOLERS_INFO_VER NV_GPU_FAN_COOLERS_INFO_VER_1
125 |
126 | typedef struct _NV_GPU_FAN_COOLERS_STATUS_V1 {
127 | NvU32 version;
128 | NvU32 count = 0;
129 | NvU32 _reserved1[8] = {};
130 | struct {
131 | NvU32 handle;
132 | NvU32 rpm;
133 | NvU32 minimum_level;
134 | NvU32 maximum_level;
135 | NvU32 current_level;
136 | NvU32 _reserved1[8];
137 | } cooler[NVAPI_CLIENT_MAX_COOLERS_PER_GPU] = {};
138 | } NV_GPU_FAN_COOLERS_STATUS_V1;
139 | #define NV_GPU_FAN_COOLERS_STATUS_VER_1 MAKE_NVAPI_VERSION(NV_GPU_FAN_COOLERS_STATUS_V1,1)
140 | typedef NV_GPU_FAN_COOLERS_STATUS_V1 NV_GPU_FAN_COOLERS_STATUS;
141 | #define NV_GPU_FAN_COOLERS_STATUS_VER NV_GPU_FAN_COOLERS_STATUS_VER_1
142 |
143 | typedef enum _NV_COOLER_CONTROL_MODE : NvU32 {
144 | NV_COOLER_CONTROL_MODE_AUTO = 0,
145 | NV_COOLER_CONTROL_MODE_MANUAL = 1,
146 | } NV_COOLER_CONTROL_MODE;
147 |
148 | typedef struct _NV_GPU_FAN_COOLERS_CONTROL_V1 {
149 | NvU32 version;
150 | NvU32 _reserved1 = 0;
151 | NvU32 count = 0;
152 | NvU32 _reserved2[8] = {};
153 | struct {
154 | NvU32 handle;
155 | NvU32 level;
156 | NV_COOLER_CONTROL_MODE mode;
157 | NvU32 _reserved1[8];
158 | } cooler[NVAPI_CLIENT_MAX_COOLERS_PER_GPU] = {};
159 | } NV_GPU_FAN_COOLERS_CONTROL_V1;
160 | #define NV_GPU_FAN_COOLERS_CONTROL_VER_1 MAKE_NVAPI_VERSION(NV_GPU_FAN_COOLERS_CONTROL_V1,1)
161 | typedef NV_GPU_FAN_COOLERS_CONTROL_V1 NV_GPU_FAN_COOLERS_CONTROL;
162 | #define NV_GPU_FAN_COOLERS_CONTROL_VER NV_GPU_FAN_COOLERS_CONTROL_VER_1
163 |
164 |
165 | typedef struct _NV_GPU_CLOCKS_V2 {
166 | NvU32 version;
167 | NvU32 clock[NVAPI_MAX_GPU_CLOCKS * 9] = {};
168 | } NV_GPU_CLOCKS_V2;
169 | #define NV_GPU_CLOCKS_VER_2 MAKE_NVAPI_VERSION(NV_GPU_CLOCKS_V2,2)
170 | typedef NV_GPU_CLOCKS_V2 NV_GPU_CLOCKS;
171 | #define NV_GPU_CLOCKS_VER NV_GPU_CLOCKS_VER_2
172 |
173 | class QNvAPIGlue : public QLibrary
174 | {
175 | public:
176 | QNvAPIGlue(QObject *parent = nullptr);
177 | ~QNvAPIGlue();
178 |
179 | bool unload(void);
180 |
181 | NvAPI_Status Initialize(void);
182 | NvAPI_Status Unload(void);
183 |
184 | NvAPI_Status EnumNvidiaDisplayHandle(NvU32, NvDisplayHandle*);
185 | NvAPI_Status EnumPhysicalGPUs(NvPhysicalGpuHandle[NVAPI_MAX_PHYSICAL_GPUS], NvU32*);
186 |
187 | NvAPI_Status GetInterfaceVersionString(NvAPI_ShortString);
188 | NvAPI_Status GetDisplayDriverVersion(NvDisplayHandle, NV_DISPLAY_DRIVER_VERSION*);
189 | NvAPI_Status GetPhysicalGPUsFromDisplay(NvDisplayHandle, NvPhysicalGpuHandle[NVAPI_MAX_PHYSICAL_GPUS], NvU32*);
190 | NvAPI_Status GetPhysicalGPUFromGPUID(NvU32, NvPhysicalGpuHandle*);
191 | NvAPI_Status GetAssociatedNvidiaDisplayHandle(const char*, NvDisplayHandle*);
192 | NvAPI_Status GetAssociatedDisplayOutputId(NvDisplayHandle, NvU32*);
193 |
194 | NvAPI_Status GetGPUIDFromPhysicalGPU(NvPhysicalGpuHandle, NvU32*);
195 |
196 | NvAPI_Status GPU_GetThermalSettings(NvPhysicalGpuHandle, NvU32, NV_GPU_THERMAL_SETTINGS*);
197 | NvAPI_Status GPU_GetFullName(NvPhysicalGpuHandle, NvAPI_ShortString);
198 | NvAPI_Status GPU_GetEDID(NvPhysicalGpuHandle, NvU32, NV_EDID*);
199 | NvAPI_Status GPU_GetTachReading(NvPhysicalGpuHandle, NvU32*);
200 | NvAPI_Status GPU_GetAllClocks(NvPhysicalGpuHandle, NV_GPU_CLOCKS*);
201 | NvAPI_Status GPU_GetAllClockFrequencies(NvPhysicalGpuHandle, NV_GPU_CLOCK_FREQUENCIES*);
202 | NvAPI_Status GPU_GetDynamicPstatesInfoEx(NvPhysicalGpuHandle, NV_GPU_DYNAMIC_PSTATES_INFO_EX*);
203 | NvAPI_Status GPU_GetMemoryInfo(NvPhysicalGpuHandle, NV_DISPLAY_DRIVER_MEMORY_INFO*);
204 | NvAPI_Status GPU_GetPCIIdentifiers(NvPhysicalGpuHandle, NvU32*, NvU32*, NvU32*, NvU32*);
205 |
206 | NvAPI_Status GPU_GetUsages(NvPhysicalGpuHandle, NV_GPU_USAGES*);
207 | // Non-RTX
208 | NvAPI_Status GPU_GetCoolerSettings(NvPhysicalGpuHandle, NvU32, NV_GPU_COOLER_SETTINGS*);
209 | NvAPI_Status GPU_SetCoolerLevels(NvPhysicalGpuHandle, NvU32, NV_GPU_COOLER_LEVELS*);
210 | //RTX
211 | NvAPI_Status GPU_GetClientFanCoolersInfo(NvPhysicalGpuHandle, NV_GPU_FAN_COOLERS_INFO*);
212 | NvAPI_Status GPU_GetClientFanCoolersStatus(NvPhysicalGpuHandle, NV_GPU_FAN_COOLERS_STATUS*);
213 | NvAPI_Status GPU_GetClientFanCoolersControl(NvPhysicalGpuHandle, NV_GPU_FAN_COOLERS_CONTROL*);
214 | NvAPI_Status GPU_SetClientFanCoolersControl(NvPhysicalGpuHandle, NV_GPU_FAN_COOLERS_CONTROL*);
215 |
216 | bool isAvailable(void);
217 | bool isRtx(NvPhysicalGpuHandle);
218 |
219 | private:
220 | typedef NvAPI_Status (__cdecl * QNVAPI_QUERYINTERFACE) (unsigned int);
221 |
222 | typedef NvAPI_Status (__cdecl * QNVAPI_INITIALIZE) (void);
223 | typedef NvAPI_Status (__cdecl * QNVAPI_UNLOAD) (void);
224 |
225 | typedef NvAPI_Status (__cdecl * QNVAPI_ENUMNVIDIADISPLAYHANDLE) (NvU32, NvDisplayHandle*);
226 | typedef NvAPI_Status (__cdecl * QNVAPI_ENUMPHYSICALGPUS) (NvPhysicalGpuHandle[NVAPI_MAX_PHYSICAL_GPUS], NvU32*);
227 |
228 | typedef NvAPI_Status (__cdecl * QNVAPI_GETINTERFACEVERSIONSTRING) (NvAPI_ShortString);
229 | typedef NvAPI_Status (__cdecl * QNVAPI_GETDISPLAYDRIVERVERSION) (NvDisplayHandle, NV_DISPLAY_DRIVER_VERSION*);
230 | typedef NvAPI_Status (__cdecl * QNVAPI_GETPHYSICALGPUSFROMDISPLAY) (NvDisplayHandle, NvPhysicalGpuHandle[NVAPI_MAX_PHYSICAL_GPUS], NvU32*);
231 | typedef NvAPI_Status (__cdecl * QNVAPI_GETPHYSICALGPUFROMGPUID) (NvU32, NvPhysicalGpuHandle*);
232 | typedef NvAPI_Status (__cdecl * QNVAPI_GETASSOCIATEDNVIDIADISPLAYHANDLE) (const char*, NvDisplayHandle*);
233 | typedef NvAPI_Status (__cdecl * QNVAPI_GETASSOCIATEDDISPLAYOUTPUTID) (NvDisplayHandle, NvU32*);
234 |
235 | typedef NvAPI_Status (__cdecl * QNVAPI_GETGPUIDFROMPHYSICALGPU) (NvPhysicalGpuHandle, NvU32*);
236 |
237 | typedef NvAPI_Status (__cdecl * QNVAPI_GPU_GETTHERMALSETTINGS) (NvPhysicalGpuHandle, NvU32, NV_GPU_THERMAL_SETTINGS*);
238 | typedef NvAPI_Status (__cdecl * QNVAPI_GPU_GETFULLNAME) (NvPhysicalGpuHandle, NvAPI_ShortString);
239 | typedef NvAPI_Status (__cdecl * QNVAPI_GPU_GETEDID) (NvPhysicalGpuHandle, NvU32, NV_EDID*);
240 | typedef NvAPI_Status (__cdecl * QNVAPI_GPU_GETTACHREADING) (NvPhysicalGpuHandle, NvU32*);
241 | typedef NvAPI_Status (__cdecl * QNVAPI_GPU_GETALLCLOCKS) (NvPhysicalGpuHandle, NV_GPU_CLOCKS*);
242 | typedef NvAPI_Status (__cdecl * QNVAPI_GPU_GETALLCLOCKFREQUENCIES) (NvPhysicalGpuHandle, NV_GPU_CLOCK_FREQUENCIES*);
243 | typedef NvAPI_Status (__cdecl * QNVAPI_GPU_GETDYNAMICPSTATESINFOEX) (NvPhysicalGpuHandle, NV_GPU_DYNAMIC_PSTATES_INFO_EX*);
244 | typedef NvAPI_Status (__cdecl * QNVAPI_GPU_GETMEMORYINFO) (NvPhysicalGpuHandle, NV_DISPLAY_DRIVER_MEMORY_INFO*);
245 | typedef NvAPI_Status (__cdecl * QNVAPI_GPU_GETPCIIDENTIFIERS) (NvPhysicalGpuHandle, NvU32*, NvU32*, NvU32*, NvU32*);
246 |
247 | typedef NvAPI_Status (__cdecl * QNVAPI_GPU_GETUSAGES) (NvPhysicalGpuHandle, NV_GPU_USAGES*);
248 | // Non-RTX
249 | typedef NvAPI_Status (__cdecl * QNVAPI_GPU_GETCOOLERSETTINGS) (NvPhysicalGpuHandle, NvU32, NV_GPU_COOLER_SETTINGS*);
250 | typedef NvAPI_Status (__cdecl * QNVAPI_GPU_SETCOOLERLEVELS) (NvPhysicalGpuHandle, NvU32, NV_GPU_COOLER_LEVELS*);
251 | // RTX
252 | typedef NvAPI_Status (__cdecl * QNVAPI_GPU_GETCLIENTFANCOOLERSINFO) (NvPhysicalGpuHandle, NV_GPU_FAN_COOLERS_INFO*);
253 | typedef NvAPI_Status (__cdecl * QNVAPI_GPU_GETCLIENTFANCOOLERSSTATUS) (NvPhysicalGpuHandle, NV_GPU_FAN_COOLERS_STATUS*);
254 | typedef NvAPI_Status (__cdecl * QNVAPI_GPU_GETCLIENTFANCOOLERSCONTROL) (NvPhysicalGpuHandle, NV_GPU_FAN_COOLERS_CONTROL*);
255 | typedef NvAPI_Status (__cdecl * QNVAPI_GPU_SETCLIENTFANCOOLERSCONTROL) (NvPhysicalGpuHandle, NV_GPU_FAN_COOLERS_CONTROL*);
256 |
257 | QNVAPI_QUERYINTERFACE nvapi_QueryInterface = nullptr;
258 |
259 | QNVAPI_INITIALIZE nvapi_Initialize = nullptr;
260 | QNVAPI_UNLOAD nvapi_Unload = nullptr;
261 |
262 | QNVAPI_ENUMNVIDIADISPLAYHANDLE nvapi_EnumNvidiaDisplayHandle = nullptr;
263 | QNVAPI_ENUMPHYSICALGPUS nvapi_EnumPhysicalGPUs = nullptr;
264 |
265 | QNVAPI_GETINTERFACEVERSIONSTRING nvapi_GetInterfaceVersionString = nullptr;
266 | QNVAPI_GETDISPLAYDRIVERVERSION nvapi_GetDisplayDriverVersion = nullptr;
267 | QNVAPI_GETPHYSICALGPUSFROMDISPLAY nvapi_GetPhysicalGPUsFromDisplay = nullptr;
268 | QNVAPI_GETPHYSICALGPUFROMGPUID nvapi_GetPhysicalGPUFromGPUID = nullptr;
269 | QNVAPI_GETASSOCIATEDNVIDIADISPLAYHANDLE nvapi_GetAssociatedNvidiaDisplayHandle = nullptr;
270 | QNVAPI_GETASSOCIATEDDISPLAYOUTPUTID nvapi_GetAssociatedDisplayOutputId = nullptr;
271 |
272 | QNVAPI_GETGPUIDFROMPHYSICALGPU nvapi_GetGPUIDFromPhysicalGPU = nullptr;
273 |
274 | QNVAPI_GPU_GETTHERMALSETTINGS nvapi_GPU_GetThermalSettings = nullptr;
275 | QNVAPI_GPU_GETFULLNAME nvapi_GPU_GetFullName = nullptr;
276 | QNVAPI_GPU_GETEDID nvapi_GPU_GetEDID = nullptr;
277 | QNVAPI_GPU_GETTACHREADING nvapi_GPU_GetTachReading = nullptr;
278 | QNVAPI_GPU_GETALLCLOCKS nvapi_GPU_GetAllClocks = nullptr;
279 | QNVAPI_GPU_GETALLCLOCKFREQUENCIES nvapi_GPU_GetAllClockFrequencies = nullptr;
280 | QNVAPI_GPU_GETDYNAMICPSTATESINFOEX nvapi_GPU_GetDynamicPstatesInfoEx = nullptr;
281 | QNVAPI_GPU_GETMEMORYINFO nvapi_GPU_GetMemoryInfo = nullptr;
282 | QNVAPI_GPU_GETPCIIDENTIFIERS nvapi_GPU_GetPCIIdentifiers = nullptr;
283 |
284 | QNVAPI_GPU_GETUSAGES nvapi_GPU_GetUsages = nullptr;
285 | // Non-RTX
286 | QNVAPI_GPU_GETCOOLERSETTINGS nvapi_GPU_GetCoolerSettings = nullptr;
287 | QNVAPI_GPU_SETCOOLERLEVELS nvapi_GPU_SetCoolerLevels = nullptr;
288 | // RTX
289 | QNVAPI_GPU_GETCLIENTFANCOOLERSINFO nvapi_GPU_GetClientFanCoolersInfo = nullptr;
290 | QNVAPI_GPU_GETCLIENTFANCOOLERSSTATUS nvapi_GPU_GetClientFanCoolersStatus = nullptr;
291 | QNVAPI_GPU_GETCLIENTFANCOOLERSCONTROL nvapi_GPU_GetClientFanCoolersControl = nullptr;
292 | QNVAPI_GPU_SETCLIENTFANCOOLERSCONTROL nvapi_GPU_SetClientFanCoolersControl = nullptr;
293 | };
294 |
295 | #endif // NVAPI_GLUE_H
296 |
--------------------------------------------------------------------------------
/qutefan/platforms/qnvapi/qnvapi.cpp:
--------------------------------------------------------------------------------
1 | #include "qnvapi.h"
2 |
3 | ControlNvAPI::ControlNvAPI()
4 | {
5 | m_nvapi = new QNvAPIGlue();
6 | }
7 |
8 | ControlNvAPI::~ControlNvAPI()
9 | {
10 | delete m_nvapi;
11 | }
12 |
13 | bool ControlNvAPI::available()
14 | {
15 | return m_nvapi->isAvailable();
16 | }
17 |
18 | void ControlNvAPI::initialize()
19 | {
20 | NvPhysicalGpuHandle handle[NVAPI_MAX_PHYSICAL_GPUS];
21 |
22 | m_nvapi->Initialize();
23 |
24 | m_nvapi->GetInterfaceVersionString(version);
25 | qDebug("NvAPI version: %s", version);
26 |
27 | m_nvapi->EnumPhysicalGPUs(handle, &gpu_count);
28 | for(unsigned long i = 0; i < gpu_count; i++) {
29 | NvGPU gpu = NvGPU();
30 | gpu.handle = handle[i];
31 | gpu.rtx = m_nvapi->isRtx(gpu.handle);
32 | if (gpu.rtx) {
33 | NV_GPU_FAN_COOLERS_INFO info = {};
34 | gpu.status = m_nvapi->GPU_GetClientFanCoolersInfo(gpu.handle, &info);
35 | gpu.cooler_count = info.count;
36 | } else {
37 | NV_GPU_COOLER_SETTINGS settings = {};
38 | gpu.status = m_nvapi->GPU_GetCoolerSettings(gpu.handle, NV_COOLER_TARGET_ALL, &settings);
39 | gpu.cooler_count = settings.count;
40 | }
41 | qDebug("GPU %lu: Number of coolers = %u", gpu_count, gpu.cooler_count);
42 | m_gpu.push_back(gpu);
43 | }
44 | qDebug("Number of GPUs = %lu", gpu_count);
45 | }
46 |
47 | const QString ControlNvAPI::name(NvGPU *gpu)
48 | {
49 | NvAPI_ShortString name;
50 | gpu->status = m_nvapi->GPU_GetFullName(gpu->handle, name);
51 | return QString(name);
52 | }
53 |
54 | const QString ControlNvAPI::uuid(NvGPU *gpu)
55 | {
56 | NvU32 device_id, sub_system_id, revision_id, ext_device_id;
57 | gpu->status = m_nvapi->GPU_GetPCIIdentifiers(gpu->handle, &device_id, &sub_system_id, &revision_id, &ext_device_id);
58 | QStringList id_list = {
59 | QStringLiteral("%1").arg(device_id, 8, 16, QLatin1Char('0')),
60 | QStringLiteral("%1").arg(sub_system_id, 8, 16, QLatin1Char('0')),
61 | QStringLiteral("%1").arg(revision_id, 8, 16, QLatin1Char('0')),
62 | QStringLiteral("%1").arg(ext_device_id, 8, 16, QLatin1Char('0'))
63 | };
64 | return id_list.join("-");
65 | }
66 |
67 | ControlNvAPI::NvGPU *ControlNvAPI::getGpuByIndex(int index)
68 | {
69 | return &m_gpu[index];
70 | }
71 |
72 | int ControlNvAPI::getCoolerCount(NvGPU *gpu)
73 | {
74 | return gpu->cooler_count;
75 | }
76 |
77 | Control::CoolerLimits ControlNvAPI::getCoolerLimits(NvGPU *gpu)
78 | {
79 | CoolerLimits limits = {};
80 | if (gpu->rtx) {
81 | NV_GPU_FAN_COOLERS_STATUS status = {};
82 | gpu->status = m_nvapi->GPU_GetClientFanCoolersStatus(gpu->handle, &status);
83 | limits.minimum = status.cooler[0].minimum_level;
84 | limits.maximum = status.cooler[0].maximum_level;
85 | limits.current = status.cooler[0].current_level;
86 | } else {
87 | NV_GPU_COOLER_SETTINGS settings = {};
88 | gpu->status = m_nvapi->GPU_GetCoolerSettings(gpu->handle, NV_COOLER_TARGET_ALL, &settings);
89 | limits.minimum = settings.cooler[0].default_level_min;
90 | limits.maximum = settings.cooler[0].default_level_max;
91 | limits.current = settings.cooler[0].current_level;
92 | }
93 | return limits;
94 | }
95 |
96 | void ControlNvAPI::setCoolerManualControl(NvGPU *gpu, bool enable)
97 | {
98 | if (gpu->rtx) {
99 | NV_GPU_FAN_COOLERS_CONTROL control;
100 | gpu->status = m_nvapi->GPU_GetClientFanCoolersControl(gpu->handle, &control);
101 | for (unsigned int c = 0; c < control.count; ++c) {
102 | control.cooler[c].mode = enable ? NV_COOLER_CONTROL_MODE_MANUAL : NV_COOLER_CONTROL_MODE_AUTO;
103 | }
104 | gpu->status = m_nvapi->GPU_SetClientFanCoolersControl(gpu->handle, &control);
105 | } else {
106 | NV_GPU_COOLER_LEVELS new_level;
107 | for (int c = 0; c < getCoolerCount(gpu); ++c) {
108 | new_level.cooler[c].policy = enable ? NV_COOLER_POLICY_MANUAL : NV_COOLER_POLICY_DEFAULT;
109 | }
110 | gpu->status = m_nvapi->GPU_SetCoolerLevels(gpu->handle, NV_COOLER_TARGET_ALL, &new_level);
111 | }
112 | }
113 |
114 | Control::CoolerLevels ControlNvAPI::getCoolerLevels(NvGPU *gpu)
115 | {
116 | CoolerLevels levels = {};
117 | if (gpu->rtx) {
118 | NV_GPU_FAN_COOLERS_STATUS status = {};
119 | gpu->status = m_nvapi->GPU_GetClientFanCoolersStatus(gpu->handle, &status);
120 | for (unsigned int c = 0; c < status.count; ++c)
121 | levels.current.append(status.cooler[c].current_level);
122 | levels.count = status.count;
123 | } else {
124 | NV_GPU_COOLER_SETTINGS settings = {};
125 | gpu->status = m_nvapi->GPU_GetCoolerSettings(gpu->handle, NV_COOLER_TARGET_ALL, &settings);
126 | for (unsigned int c = 0; c < settings.count; ++c)
127 | levels.current.append(settings.cooler[c].current_level);
128 | levels.count = settings.count;
129 | }
130 | return levels;
131 | }
132 |
133 | void ControlNvAPI::setCoolerLevels(NvGPU *gpu, int level)
134 | {
135 | if (gpu->rtx) {
136 | NV_GPU_FAN_COOLERS_CONTROL control;
137 | gpu->status = m_nvapi->GPU_GetClientFanCoolersControl(gpu->handle, &control);
138 | for (unsigned int c = 0; c < control.count; ++c) {
139 | control.cooler[c].level = level;
140 | }
141 | gpu->status = m_nvapi->GPU_SetClientFanCoolersControl(gpu->handle, &control);
142 | } else {
143 | NV_GPU_COOLER_LEVELS new_level;
144 | for (int c = 0; c < getCoolerCount(gpu); ++c) {
145 | new_level.cooler[c].level = level;
146 | }
147 | gpu->status = m_nvapi->GPU_SetCoolerLevels(gpu->handle, NV_COOLER_TARGET_ALL, &new_level);
148 | }
149 | }
150 |
151 | Control::Temperatures ControlNvAPI::getGpuTemperatures(NvGPU *gpu)
152 | {
153 | NV_GPU_THERMAL_SETTINGS nv_thermal_settings = {};
154 | gpu->status = m_nvapi->GPU_GetThermalSettings(gpu->handle, NVAPI_THERMAL_TARGET_ALL, &nv_thermal_settings);
155 |
156 | Temperatures temps = {};
157 | for (unsigned int t = 0; t < nv_thermal_settings.count; ++t) {
158 | switch(nv_thermal_settings.sensor[t].target) {
159 | case NVAPI_THERMAL_TARGET_GPU: {
160 | temps.gpu = nv_thermal_settings.sensor[t].currentTemp;
161 | break;
162 | }
163 | case NVAPI_THERMAL_TARGET_MEMORY: {
164 | temps.memory = nv_thermal_settings.sensor[t].currentTemp;
165 | break;
166 | }
167 | case NVAPI_THERMAL_TARGET_POWER_SUPPLY: {
168 | temps.power_supply = nv_thermal_settings.sensor[t].currentTemp;
169 | break;
170 | }
171 | case NVAPI_THERMAL_TARGET_BOARD: {
172 | temps.board = nv_thermal_settings.sensor[t].currentTemp;
173 | break;
174 | }
175 | default: {
176 | qDebug("%s uknown target %d", __PRETTY_FUNCTION__, nv_thermal_settings.sensor[t].target);
177 | break;
178 | }
179 | }
180 | }
181 | return temps;
182 | }
183 |
184 | Control::Frequencies ControlNvAPI::getCurrentClockFrequencies(NvGPU *gpu)
185 | {
186 | Frequencies freqs = {};
187 |
188 | if (gpu->rtx) {
189 | NV_GPU_CLOCK_FREQUENCIES nv_clock_frequencies = {};
190 | gpu->status = m_nvapi->GPU_GetAllClockFrequencies(gpu->handle, &nv_clock_frequencies);
191 | freqs.core = nv_clock_frequencies.domain[NVAPI_GPU_PUBLIC_CLOCK_GRAPHICS].frequency/1000;
192 | freqs.memory = nv_clock_frequencies.domain[NVAPI_GPU_PUBLIC_CLOCK_MEMORY].frequency/1000;
193 | freqs.shader = nv_clock_frequencies.domain[NVAPI_GPU_PUBLIC_CLOCK_PROCESSOR].frequency/1000;
194 | } else {
195 | NV_GPU_CLOCKS nv_clocks = {};
196 | gpu->status = m_nvapi->GPU_GetAllClocks(gpu->handle, &nv_clocks);
197 | if (freqs.core == 0)
198 | freqs.core = nv_clocks.clock[0] / 1000.0f;
199 | if (freqs.memory == 0)
200 | freqs.memory = nv_clocks.clock[1] / 1000.0f;
201 | if (freqs.shader == 0)
202 | freqs.shader = nv_clocks.clock[2] / 1000.0f;
203 |
204 | if(nv_clocks.clock[30] != 0) {
205 | if (freqs.core == 0)
206 | freqs.core = nv_clocks.clock[30] / 2000.0f;
207 | if (freqs.shader == 0)
208 | freqs.shader = nv_clocks.clock[30] / 1000.0f;
209 | }
210 | }
211 | return freqs;
212 | }
213 |
214 |
--------------------------------------------------------------------------------
/qutefan/platforms/qnvapi/qnvapi.h:
--------------------------------------------------------------------------------
1 | #pragma once
2 |
3 | #include
4 | #include
5 |
6 | #include "nvapi_glue.h"
7 | #include "control.h"
8 |
9 | class ControlNvAPI : public Control
10 | {
11 | public:
12 | NvDisplayHandle display_handle[NVAPI_MAX_PHYSICAL_GPUS*NVAPI_MAX_DISPLAY_HEADS] = {};
13 | NvU32 display_count = 0;
14 |
15 | NvAPI_Status status = NVAPI_OK;
16 | NvAPI_ShortString version = {};
17 | NV_DISPLAY_DRIVER_VERSION driver_version = {};
18 |
19 | long unsigned int gpu_count = 0;
20 | typedef struct _NvGPU : NvGPUBase {
21 | NvAPI_Status status;
22 | NvPhysicalGpuHandle handle;
23 | bool rtx;
24 | } NvGPU;
25 | QVector m_gpu;
26 |
27 | QNvAPIGlue *m_nvapi;
28 |
29 | ControlNvAPI();
30 | ~ControlNvAPI();
31 |
32 | bool available();
33 | void initialize();
34 |
35 | const QString name(NvGPU *);
36 | const QString uuid(NvGPU *);
37 |
38 | NvGPU *getGpuByIndex(int index);
39 | int getCoolerCount(NvGPU *);
40 | void setCoolerManualControl(NvGPU *, bool);
41 | void setCoolerLevels(NvGPU *, int);
42 |
43 | CoolerLimits getCoolerLimits(NvGPU *);
44 | CoolerLevels getCoolerLevels(NvGPU *);
45 | Temperatures getGpuTemperatures(NvGPU *);
46 | Frequencies getCurrentClockFrequencies(NvGPU *);
47 | };
48 |
49 |
--------------------------------------------------------------------------------
/qutefan/platforms/qnvapi/qnvapi.pri:
--------------------------------------------------------------------------------
1 | win32-g++ {
2 | DEFINES += __NVAPI_EMPTY_SAL
3 | }
4 |
5 | SOURCES += \
6 | $$PWD/nvapi_glue.cpp \
7 | $$PWD/qnvapi.cpp
8 |
9 | HEADERS += \
10 | $$PWD/include/nvapi.h \
11 | $$PWD/include/nvapi_interface.h \
12 | $$PWD/nvapi_glue.h \
13 | $$PWD/qnvapi.h
14 |
15 | INCLUDEPATH += $$PWD
16 |
--------------------------------------------------------------------------------
/qutefan/platforms/qnvctrl/qnvctrl.cpp:
--------------------------------------------------------------------------------
1 | #include
2 |
3 | #include "qnvctrl.h"
4 |
5 | ControlNVCtrl::ControlNVCtrl()
6 | {
7 |
8 | }
9 |
10 | ControlNVCtrl::~ControlNVCtrl()
11 | {
12 | if(dpy)
13 | XCloseDisplay(dpy);
14 | }
15 |
16 | bool ControlNVCtrl::available()
17 | {
18 | dpy = XOpenDisplay(nullptr);
19 | if (!dpy) {
20 | qDebug("Cannot open display '%s'", XDisplayName(nullptr));
21 | return false;
22 | }
23 |
24 | screen = getNvXScreen(dpy);
25 | if (screen < 0) {
26 | qDebug("Unable to find any NVIDIA X screens; aborting.");
27 | return false;
28 | }
29 |
30 | return true;
31 | }
32 |
33 | void ControlNVCtrl::initialize()
34 | {
35 | status = XNVCTRLQueryVersion(dpy, &(version.major), &(version.minor));
36 | if (!status) {
37 | qDebug("The NV-CONTROL X extension does not exist on '%s'.", XDisplayName(nullptr));
38 | return;
39 | }
40 |
41 | status = XNVCTRLQueryTargetCount(dpy, NV_CTRL_TARGET_TYPE_GPU, &gpu_count);
42 | if (!status) {
43 | qDebug("Failed to query number of gpus");
44 | return;
45 | }
46 |
47 | for(int i = 0; i < gpu_count; i++) {
48 | NvGPU gpu = NvGPU();
49 | gpu.handle = i;
50 |
51 | // Get general cooler information
52 | int len = 0;
53 | NV_COOLER_DATA *p_cooler_data;
54 | gpu.status = XNVCTRLQueryTargetBinaryData(
55 | dpy, NV_CTRL_TARGET_TYPE_GPU, gpu.handle,
56 | 0, NV_CTRL_BINARY_DATA_COOLERS_USED_BY_GPU, (unsigned char **)(&p_cooler_data), &len);
57 | gpu.cooler_count = p_cooler_data->count;
58 |
59 | // Get per cooler information
60 | for(int c = 0; c < gpu.cooler_count; ++c) {
61 | NvCooler cooler = NvCooler();
62 | cooler.handle = p_cooler_data->handle[c];
63 | gpu.cooler.push_back(cooler);
64 | }
65 | free((unsigned char *)p_cooler_data);
66 | qDebug("GPU %i: Number of coolers = %i", gpu_count, gpu.cooler_count);
67 | m_gpu.push_back(gpu);
68 | }
69 | qDebug("Number of GPUs = %i", gpu_count);
70 | }
71 |
72 | const QString ControlNVCtrl::name(NvGPU *gpu)
73 | {
74 | char *nv_name;
75 | gpu->status = XNVCTRLQueryTargetStringAttribute(
76 | dpy, NV_CTRL_TARGET_TYPE_GPU, gpu->handle,
77 | 0, NV_CTRL_STRING_PRODUCT_NAME, &nv_name);
78 | QString name(nv_name);
79 | free(nv_name);
80 | return name;
81 | }
82 |
83 | const QString ControlNVCtrl::uuid(NvGPU *gpu)
84 | {
85 | char *nv_uuid;
86 | gpu->status = XNVCTRLQueryTargetStringAttribute(
87 | dpy, NV_CTRL_TARGET_TYPE_GPU, gpu->handle,
88 | 0, NV_CTRL_STRING_GPU_UUID, &nv_uuid);
89 | QString uuid(nv_uuid);
90 | free(nv_uuid);
91 | return uuid;
92 | }
93 |
94 | ControlNVCtrl::NvGPU *ControlNVCtrl::getGpuByIndex(int index)
95 | {
96 | return &m_gpu[index];
97 | }
98 |
99 | int ControlNVCtrl::getCoolerCount(NvGPU *gpu)
100 | {
101 | return gpu->cooler_count;
102 | }
103 |
104 | Control::CoolerLimits ControlNVCtrl::getCoolerLimits(NvGPU *gpu)
105 | {
106 | CoolerLimits limits = {};
107 | limits.maximum = 100;
108 | limits.minimum = 30;
109 | // It seems there is no way to get the defaults for a cooler, so quickly reset it to
110 | // get some values
111 | setCoolerManualControl(gpu, false);
112 | gpu->status = XNVCTRLQueryTargetAttribute(
113 | dpy, NV_CTRL_TARGET_TYPE_COOLER, gpu->cooler[0].handle,
114 | 0, NV_CTRL_THERMAL_COOLER_LEVEL, reinterpret_cast(&limits.current));
115 | return limits;
116 | }
117 |
118 | void ControlNVCtrl::setCoolerManualControl(NvGPU *gpu, bool enable)
119 | {
120 | if (enable) {
121 | gpu->status = XNVCTRLSetTargetAttributeAndGetStatus(
122 | dpy, NV_CTRL_TARGET_TYPE_GPU, gpu->handle,
123 | 0, NV_CTRL_GPU_COOLER_MANUAL_CONTROL, NV_CTRL_GPU_COOLER_MANUAL_CONTROL_TRUE);
124 | } else {
125 | gpu->status = XNVCTRLSetTargetAttributeAndGetStatus(
126 | dpy, NV_CTRL_TARGET_TYPE_GPU, gpu->handle,
127 | 0, NV_CTRL_GPU_COOLER_MANUAL_CONTROL, NV_CTRL_GPU_COOLER_MANUAL_CONTROL_FALSE);
128 | }
129 | }
130 |
131 | Control::CoolerLevels ControlNVCtrl::getCoolerLevels(NvGPU *gpu)
132 | {
133 | CoolerLevels levels = {};
134 | for (int c = 0; c < gpu->cooler_count; ++c) {
135 | int level;
136 | gpu->status = XNVCTRLQueryTargetAttribute(
137 | dpy, NV_CTRL_TARGET_TYPE_COOLER, gpu->cooler[c].handle,
138 | 0, NV_CTRL_THERMAL_COOLER_CURRENT_LEVEL, &level);
139 | levels.current.append(level);
140 | }
141 | levels.count = gpu->cooler_count;
142 | return levels;
143 | }
144 |
145 | void ControlNVCtrl::setCoolerLevels(NvGPU *gpu, int level)
146 | {
147 | for (int c = 0; c < gpu->cooler_count; ++c) {
148 | gpu->status = XNVCTRLSetTargetAttributeAndGetStatus(
149 | dpy, NV_CTRL_TARGET_TYPE_COOLER, gpu->cooler[c].handle,
150 | 0, NV_CTRL_THERMAL_COOLER_LEVEL, level);
151 | }
152 | }
153 |
154 | Control::Temperatures ControlNVCtrl::getGpuTemperatures(NvGPU *gpu)
155 | {
156 | int len;
157 | NV_THERMAL_SENSOR_DATA *p_sensor_data;
158 | gpu->status = XNVCTRLQueryTargetBinaryData(
159 | dpy, NV_CTRL_TARGET_TYPE_GPU, gpu->handle,
160 | 0, NV_CTRL_BINARY_DATA_COOLERS_USED_BY_GPU, (unsigned char **)(&p_sensor_data), &len);
161 |
162 | Temperatures temps = {};
163 | for (int s = 0; s < p_sensor_data->count; ++s) {
164 |
165 | int target;
166 | gpu->status = XNVCTRLQueryTargetAttribute(
167 | dpy, NV_CTRL_TARGET_TYPE_THERMAL_SENSOR, p_sensor_data->handle[s],
168 | 0, NV_CTRL_THERMAL_SENSOR_TARGET, &target);
169 |
170 | int reading;
171 | gpu->status = XNVCTRLQueryTargetAttribute(
172 | dpy, NV_CTRL_TARGET_TYPE_THERMAL_SENSOR, p_sensor_data->handle[s],
173 | 0, NV_CTRL_THERMAL_SENSOR_READING, &reading);
174 |
175 | switch(target) {
176 | case NV_CTRL_THERMAL_SENSOR_TARGET_NONE: {
177 | temps.none = reading;
178 | break;
179 | }
180 | case NV_CTRL_THERMAL_SENSOR_TARGET_GPU: {
181 | temps.gpu = reading;
182 | break;
183 | }
184 | case NV_CTRL_THERMAL_SENSOR_TARGET_MEMORY: {
185 | temps.memory = reading;
186 | break;
187 | }
188 | case NV_CTRL_THERMAL_SENSOR_TARGET_POWER_SUPPLY: {
189 | temps.power_supply = reading;
190 | break;
191 | }
192 | case NV_CTRL_THERMAL_SENSOR_TARGET_BOARD: {
193 | temps.board = reading;
194 | break;
195 | }
196 | default: {
197 | // qDebug("%s uknown target %d [handle: %d, reading: %d]",
198 | // __PRETTY_FUNCTION__, target, p_sensor_data->handle[s], reading);
199 | break;
200 | }
201 | }
202 | }
203 | free((unsigned char *)p_sensor_data);
204 | return temps;
205 | }
206 |
207 | Control::Frequencies ControlNVCtrl::getCurrentClockFrequencies(NvGPU *gpu)
208 | {
209 | Frequencies freqs = {};
210 |
211 | NV_CLOCK_FREQS p_nv_clocks;
212 | gpu->status = XNVCTRLQueryTargetAttribute(
213 | dpy, NV_CTRL_TARGET_TYPE_GPU, gpu->handle,
214 | 0, NV_CTRL_GPU_CURRENT_CLOCK_FREQS, (int *)&p_nv_clocks);
215 | freqs.core = p_nv_clocks.core;
216 | freqs.memory = p_nv_clocks.memory;
217 | freqs.shader = 0;
218 | return freqs;
219 | }
220 |
221 | int ControlNVCtrl::getNvXScreen(Display *dpy)
222 | {
223 | int defaultScreen, screen;
224 |
225 | defaultScreen = DefaultScreen(dpy);
226 |
227 | if (XNVCTRLIsNvScreen(dpy, defaultScreen)) {
228 | return defaultScreen;
229 | }
230 |
231 | for (screen = 0; screen < ScreenCount(dpy); screen++) {
232 | if (XNVCTRLIsNvScreen(dpy, screen)) {
233 | qDebug("Default X screen %d is not an NVIDIA X screen. Using X screen %d instead.",
234 | defaultScreen, screen);
235 | return screen;
236 | }
237 | }
238 | return -1;
239 | }
240 |
241 |
--------------------------------------------------------------------------------
/qutefan/platforms/qnvctrl/qnvctrl.h:
--------------------------------------------------------------------------------
1 | #pragma once
2 |
3 | #include
4 | #include
5 |
6 | #include
7 | #include
8 | #include
9 |
10 | #include "control.h"
11 |
12 | class ControlNVCtrl : public Control
13 | {
14 | public:
15 | Display *dpy;
16 | int screen;
17 |
18 | bool status;
19 |
20 | typedef struct {
21 | int major;
22 | int minor;
23 | } NvVersion;
24 | NvVersion version;
25 |
26 | typedef struct {
27 | uint32_t handle;
28 | int default_level;
29 | int current_level;
30 | } NvCooler;
31 |
32 | int gpu_count = 0;
33 | typedef struct _NvGPU : NvGPUBase {
34 | bool status;
35 | uint32_t handle;
36 | int cooler_count;
37 | QVector cooler;
38 | int current_temp;
39 | int default_control;
40 | int current_control;
41 | } NvGPU;
42 | QVector m_gpu;
43 |
44 | ControlNVCtrl();
45 | ~ControlNVCtrl();
46 |
47 | bool available();
48 | void initialize();
49 |
50 | const QString name(NvGPU *);
51 | const QString uuid(NvGPU *);
52 |
53 | NvGPU *getGpuByIndex(int index);
54 | int getCoolerCount(NvGPU *);
55 | void setCoolerManualControl(NvGPU *, bool);
56 | void setCoolerLevels(NvGPU *, int);
57 |
58 | CoolerLimits getCoolerLimits(NvGPU *);
59 | CoolerLevels getCoolerLevels(NvGPU *);
60 | Temperatures getGpuTemperatures(NvGPU *);
61 | Frequencies getCurrentClockFrequencies(NvGPU *);
62 |
63 | private:
64 | typedef struct _NV_THERMAL_SENSOR_DATA {
65 | int count;
66 | int handle[8];
67 | } NV_THERMAL_SENSOR_DATA;
68 |
69 | typedef struct _NV_COOLER_DATA {
70 | int count;
71 | int handle[8];
72 | } NV_COOLER_DATA;
73 |
74 | typedef struct _NV_CLOCK_FREQS {
75 | int memory : 16;
76 | int core : 16;
77 | } NV_CLOCK_FREQS;
78 |
79 | int getNvXScreen(Display*);
80 | };
81 |
82 |
--------------------------------------------------------------------------------
/qutefan/platforms/qnvctrl/qnvctrl.pri:
--------------------------------------------------------------------------------
1 | SOURCES += $$PWD/qnvctrl.cpp
2 |
3 | HEADERS += $$PWD/qnvctrl.h
4 |
5 | INCLUDEPATH += $$PWD
6 |
7 | LIBS += -lXext -lX11 -lXNVCtrl
8 |
--------------------------------------------------------------------------------
/qutefan/platforms/qnvml/qnvml.cpp:
--------------------------------------------------------------------------------
1 | #include
2 |
3 | #include "qnvml.h"
4 |
5 | ControlNvml::ControlNvml()
6 | {
7 |
8 | }
9 |
10 | ControlNvml::~ControlNvml()
11 | {
12 | nvmlShutdown();
13 | }
14 |
15 | bool ControlNvml::available()
16 | {
17 | status = nvmlInit_v2();
18 | if(status != NVML_SUCCESS) {
19 | qDebug("Failed to initialize NVML; aborting");
20 | return false;
21 | }
22 |
23 | return true;
24 | }
25 |
26 | void ControlNvml::initialize()
27 | {
28 | status = nvmlSystemGetNVMLVersion(version, NVML_SYSTEM_NVML_VERSION_BUFFER_SIZE);
29 | if(status != NVML_SUCCESS) {
30 | qDebug("Failed to get NVML Version.");
31 | return;
32 | }
33 |
34 | status = nvmlDeviceGetCount_v2(&gpu_count);
35 | if (status != NVML_SUCCESS) {
36 | qDebug("Failed to query number of gpus");
37 | return;
38 | }
39 |
40 | for(unsigned int i = 0; i < gpu_count; i++) {
41 | NvGPU gpu = NvGPU();
42 | status = nvmlDeviceGetHandleByIndex_v2(i, &(gpu.handle));
43 | gpu.status = nvmlDeviceGetNumFans(gpu.handle, &(gpu.cooler_count));
44 | for(unsigned int c = 0; c < gpu.cooler_count; ++c) {
45 | NvCooler cooler = NvCooler();
46 | cooler.handle = c;
47 | gpu.cooler.push_back(cooler);
48 | }
49 | qDebug("GPU %i: Number of coolers = %i", gpu_count, gpu.cooler_count);
50 | m_gpu.push_back(gpu);
51 | }
52 | qDebug("Number of GPUs = %i", gpu_count);
53 | }
54 |
55 | const QString ControlNvml::name(NvGPU *gpu)
56 | {
57 | char nv_name[NVML_DEVICE_NAME_V2_BUFFER_SIZE];
58 | gpu->status = nvmlDeviceGetName(gpu->handle, nv_name, NVML_DEVICE_NAME_V2_BUFFER_SIZE);
59 | QString name(nv_name);
60 | return name;
61 | }
62 |
63 | const QString ControlNvml::uuid(NvGPU *gpu)
64 | {
65 | char nv_uuid[NVML_DEVICE_UUID_V2_BUFFER_SIZE];
66 | gpu->status = nvmlDeviceGetUUID(gpu->handle, nv_uuid, NVML_DEVICE_UUID_V2_BUFFER_SIZE);
67 | QString uuid(nv_uuid);
68 | return uuid;
69 | }
70 |
71 | ControlNvml::NvGPU *ControlNvml::getGpuByIndex(int index)
72 | {
73 | return &m_gpu[index];
74 | }
75 |
76 | int ControlNvml::getCoolerCount(NvGPU *gpu)
77 | {
78 | return gpu->cooler_count;
79 | }
80 |
81 | Control::CoolerLimits ControlNvml::getCoolerLimits(NvGPU *gpu)
82 | {
83 | CoolerLimits limits = {};
84 | gpu->status = nvmlDeviceGetMinMaxFanSpeed(
85 | gpu->handle, &(limits.minimum), &(limits.maximum));
86 | gpu->status = nvmlDeviceGetFanSpeed(
87 | gpu->handle, &(limits.current));
88 | return limits;
89 | }
90 |
91 | void ControlNvml::setCoolerManualControl(NvGPU *gpu, bool enable)
92 | {
93 | if (enable) {
94 | for (unsigned int c = 0; c < gpu->cooler_count; ++c) {
95 | unsigned int level;
96 | gpu->status = nvmlDeviceGetTargetFanSpeed(gpu->handle, gpu->cooler[c].handle, &level);
97 | gpu->status = nvmlDeviceSetFanSpeed_v2(gpu->handle, gpu->cooler[c].handle, level);
98 | }
99 | } else {
100 | for (unsigned int c = 0; c < gpu->cooler_count; ++c) {
101 | gpu->status = nvmlDeviceSetDefaultFanSpeed_v2(gpu->handle, gpu->cooler[c].handle);
102 | }
103 | }
104 | }
105 |
106 | Control::CoolerLevels ControlNvml::getCoolerLevels(NvGPU *gpu)
107 | {
108 | CoolerLevels levels = {};
109 | for (unsigned int c = 0; c < gpu->cooler_count; ++c) {
110 | unsigned int level;
111 | gpu->status = nvmlDeviceGetFanSpeed_v2(gpu->handle, gpu->cooler[c].handle, &level);
112 | levels.current.append(level);
113 | }
114 | levels.count = gpu->cooler_count;
115 | return levels;
116 | }
117 |
118 | void ControlNvml::setCoolerLevels(NvGPU *gpu, int level)
119 | {
120 | for (unsigned int c = 0; c < gpu->cooler_count; ++c) {
121 | gpu->status = nvmlDeviceSetFanSpeed_v2(gpu->handle, gpu->cooler[c].handle, level);
122 | }
123 | }
124 |
125 | void ControlNvml::setPowerLimit(NvGPU *gpu, int limit)
126 | {
127 | gpu->status = nvmlDeviceSetPowerManagementLimit(gpu->handle, limit);
128 | }
129 |
130 | Control::Temperatures ControlNvml::getGpuTemperatures(NvGPU *gpu)
131 | {
132 | Temperatures temps = {};
133 | gpu->status = nvmlDeviceGetTemperature(gpu->handle, NVML_TEMPERATURE_GPU, &(temps.gpu));
134 | return temps;
135 | }
136 |
137 | Control::Frequencies ControlNvml::getCurrentClockFrequencies(NvGPU *gpu)
138 | {
139 | Frequencies freqs = {};
140 | gpu->status = nvmlDeviceGetClockInfo(gpu->handle, NVML_CLOCK_GRAPHICS, &(freqs.core));
141 | gpu->status = nvmlDeviceGetClockInfo(gpu->handle, NVML_CLOCK_MEM, &(freqs.memory));
142 | gpu->status = nvmlDeviceGetClockInfo(gpu->handle, NVML_CLOCK_SM, &(freqs.shader));
143 | gpu->status = nvmlDeviceGetClockInfo(gpu->handle, NVML_CLOCK_VIDEO, &(freqs.video));
144 | gpu->status = nvmlDeviceGetClockInfo(gpu->handle, NVML_CLOCK_VIDEO, &(freqs.video));
145 | gpu->status = nvmlDeviceGetPowerUsage(gpu->handle, &(freqs.power));
146 | return freqs;
147 | }
148 |
149 | Control::Limits ControlNvml::getPowerLimits(NvGPU *gpu)
150 | {
151 | Limits limits = {};
152 | limits.denominator = 1000;
153 | limits.type = Control::LimitType::CONTROL_LIMIT_WATTAGE;
154 | gpu->status = nvmlDeviceGetPowerManagementLimitConstraints(gpu->handle, &(limits.minimum), &(limits.maximum));
155 | gpu->status = nvmlDeviceGetPowerManagementLimit(gpu->handle, &(limits.current));
156 | return limits;
157 | }
158 |
159 | Control::Limits ControlNvml::getCoreClockLimits(NvGPU *gpu)
160 | {
161 | Limits limits = {};
162 | limits.denominator = 1000;
163 | limits.type = Control::LimitType::CONTROL_LIMIT_FREQUENCY;
164 | // gpu->status = nvmlDeviceGetPowerManagementLimitConstraints(gpu->handle, &(limits.minimum), &(limits.maximum));
165 | // gpu->status = nvmlDeviceGetPowerManagementLimit(gpu->handle, &(limits.current));
166 | return limits;
167 | }
168 |
169 | Control::Limits ControlNvml::getMemClockLimits(NvGPU *gpu)
170 | {
171 | Limits limits = {};
172 | limits.denominator = 1000;
173 | limits.type = Control::LimitType::CONTROL_LIMIT_FREQUENCY;
174 | // gpu->status = nvmlDeviceGetPowerManagementLimitConstraints(gpu->handle, &(limits.minimum), &(limits.maximum));
175 | // gpu->status = nvmlDeviceGetPowerManagementLimit(gpu->handle, &(limits.current));
176 | return limits;
177 | }
178 |
--------------------------------------------------------------------------------
/qutefan/platforms/qnvml/qnvml.h:
--------------------------------------------------------------------------------
1 | #pragma once
2 |
3 | #include
4 | #include
5 |
6 | #include "control.h"
7 | #include "include/nvml.h"
8 |
9 | class ControlNvml : public Control
10 | {
11 | public:
12 | nvmlReturn_t status;
13 |
14 | char version[NVML_SYSTEM_NVML_VERSION_BUFFER_SIZE] = {};
15 | char driver_version[NVML_SYSTEM_DRIVER_VERSION_BUFFER_SIZE] = {};
16 |
17 | typedef struct {
18 | unsigned int handle;
19 | unsigned int default_level;
20 | unsigned int current_level;
21 | } NvCooler;
22 |
23 | unsigned int gpu_count = 0;
24 | typedef struct _NvGPU : NvGPUBase {
25 | nvmlReturn_t status;
26 | nvmlDevice_t handle;
27 | QVector cooler;
28 | } NvGPU;
29 | QVector m_gpu;
30 |
31 | ControlNvml();
32 | ~ControlNvml();
33 |
34 | bool available();
35 | void initialize();
36 |
37 | const QString name(NvGPU *);
38 | const QString uuid(NvGPU *);
39 |
40 | NvGPU *getGpuByIndex(int index);
41 | void setCoolerManualControl(NvGPU *, bool);
42 | void setCoolerLevels(NvGPU *, int);
43 | void setPowerLimit(NvGPU *, int);
44 |
45 | int getCoolerCount(NvGPU *);
46 | CoolerLimits getCoolerLimits(NvGPU *);
47 | CoolerLevels getCoolerLevels(NvGPU *);
48 | Temperatures getGpuTemperatures(NvGPU *);
49 | Frequencies getCurrentClockFrequencies(NvGPU *);
50 | Limits getPowerLimits(NvGPU *);
51 | Limits getCoreClockLimits(NvGPU *);
52 | Limits getMemClockLimits(NvGPU *);
53 | };
54 |
--------------------------------------------------------------------------------
/qutefan/platforms/qnvml/qnvml.pri:
--------------------------------------------------------------------------------
1 | SOURCES += \
2 | $$PWD/qnvml.cpp
3 |
4 | HEADERS += \
5 | $$PWD/include/nvml.h \
6 | $$PWD/qnvml.h
7 |
8 | INCLUDEPATH += $$PWD
9 |
10 | unix {
11 | LIBS += -lXext -lX11 -lnvidia-ml
12 | }
13 |
14 | win32 {
15 | LIBS += -L"%ProgramW6432%\NVIDIA Corporation\NVSMI"
16 | }
17 |
--------------------------------------------------------------------------------
/qutefan/qutefan.qrc:
--------------------------------------------------------------------------------
1 |
2 |
3 | resources/status/inactive.png
4 | resources/status/low.png
5 | resources/status/high.png
6 | resources/Qutefan.png
7 |
8 |
9 |
--------------------------------------------------------------------------------
/qutefan/qutefan.rc:
--------------------------------------------------------------------------------
1 | IDI_ICON1 ICON DISCARDABLE "resources/Qutefan.ico"
2 | #define MANIFEST_RESOURCE_ID 1
3 | #define RT_MANIFEST 24
4 | MANIFEST_RESOURCE_ID RT_MANIFEST "resources/Qutefan.exe.manifest"
5 |
--------------------------------------------------------------------------------
/qutefan/qutefan/doublelabel.cpp:
--------------------------------------------------------------------------------
1 | #include "doublelabel.h"
2 | #include "ui_doublelabel.h"
3 |
4 | DoubleLabel::DoubleLabel(QWidget *parent) : QWidget(parent), ui(new Ui::DoubleLabel)
5 | {
6 | ui->setupUi(this);
7 | }
8 |
9 | DoubleLabel::DoubleLabel(QWidget *parent, const QString &format) : DoubleLabel(parent)
10 | {
11 | setFormat(format);
12 | }
13 |
14 | DoubleLabel::DoubleLabel(QWidget *parent, const QString &format, int max) : DoubleLabel(parent)
15 | {
16 | setFormat(format, max);
17 | }
18 |
19 | DoubleLabel::~DoubleLabel()
20 | {
21 | delete ui;
22 | }
23 |
24 | void DoubleLabel::setFormat(const QString &format, int max)
25 | {
26 | m_format = format;
27 | QFont font = this->font();
28 | QFontMetrics fm = QFontMetrics(font);
29 | int width =
30 | fm.boundingRect(m_format.arg(max)).width() + (fm.horizontalAdvance(QLatin1Char('x')) * 2) +
31 | (ui->labelCurrent->contentsMargins().left() + ui->labelCurrent->contentsMargins().right());
32 |
33 | ui->labelCurrent->setMinimumWidth(width);
34 | ui->labelMaximum->setMinimumWidth(width);
35 | }
36 |
37 | void DoubleLabel::setValue(int value, bool reset)
38 | {
39 | if (value > m_maximum || reset)
40 | m_maximum = value;
41 | ui->labelCurrent->setText(m_format.arg(value));
42 | ui->labelMaximum->setText(m_format.arg(m_maximum));
43 | }
44 |
--------------------------------------------------------------------------------
/qutefan/qutefan/doublelabel.h:
--------------------------------------------------------------------------------
1 | #pragma once
2 |
3 | #include
4 |
5 | namespace Ui {
6 | class DoubleLabel;
7 | }
8 |
9 | class DoubleLabel : public QWidget
10 | {
11 | Q_OBJECT
12 |
13 | public:
14 | explicit DoubleLabel(QWidget *parent = nullptr);
15 | explicit DoubleLabel(QWidget *parent, const QString &);
16 | explicit DoubleLabel(QWidget *parent, const QString &, int);
17 | ~DoubleLabel();
18 |
19 | void setFormat(const QString &, int = 100);
20 | void setValue(int, bool = false);
21 |
22 | private:
23 | QString m_format = "%1";
24 | int m_maximum = 0;
25 | Ui::DoubleLabel *ui;
26 | };
27 |
28 |
--------------------------------------------------------------------------------
/qutefan/qutefan/doublelabel.ui:
--------------------------------------------------------------------------------
1 |
2 |
3 | DoubleLabel
4 |
5 |
6 |
7 | 0
8 | 0
9 | 60
10 | 18
11 |
12 |
13 |
14 |
15 | 0
16 | 0
17 |
18 |
19 |
20 | DoubleLabel
21 |
22 |
23 |
24 | 0
25 |
26 |
27 | 0
28 |
29 |
30 | 0
31 |
32 |
33 | 0
34 |
35 | -
36 |
37 |
38 | QFrame::StyledPanel
39 |
40 |
41 | QFrame::Sunken
42 |
43 |
44 | n/a
45 |
46 |
47 | Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter
48 |
49 |
50 |
51 | -
52 |
53 |
54 |
55 | true
56 |
57 |
58 |
59 | QFrame::StyledPanel
60 |
61 |
62 | QFrame::Sunken
63 |
64 |
65 | n/a
66 |
67 |
68 | Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter
69 |
70 |
71 |
72 |
73 |
74 |
75 |
76 |
77 |
--------------------------------------------------------------------------------
/qutefan/qutefan/gpuslider.cpp:
--------------------------------------------------------------------------------
1 | #include "gpuslider.h"
2 | #include "ui_gpuslider.h"
3 |
4 | GpuSlider::GpuSlider(QWidget *parent)
5 | : QWidget(parent)
6 | , ui(new Ui::GpuSlider)
7 | {
8 | ui->setupUi(this);
9 |
10 | connect(ui->slider, qOverload(&QSlider::valueChanged), ui->spinbox, &QSpinBox::setValue);
11 | connect(ui->spinbox, qOverload(&QSpinBox::valueChanged), ui->slider, &QSlider::setValue);
12 | }
13 |
14 | GpuSlider::~GpuSlider()
15 | {
16 | delete ui;
17 | }
18 |
19 | void GpuSlider::setLimits(Control::Limits limits)
20 | {
21 | QString suffix;
22 |
23 | switch (limits.type) {
24 | case Control::LimitType::CONTROL_LIMIT_FREQUENCY: {
25 | ui->spinbox->setSingleStep(1);
26 | suffix = "Mhz";
27 | break;
28 | }
29 | case Control::LimitType::CONTROL_LIMIT_WATTAGE: {
30 | ui->spinbox->setSingleStep(5);
31 | suffix = "W";
32 | break;
33 | }
34 | default: {
35 | suffix = "";
36 | }
37 | }
38 |
39 | m_minimum = limits.minimum;
40 | m_maximum = limits.maximum;
41 | m_denominator = limits.denominator;
42 |
43 | int minimum = limits.minimum/limits.denominator;
44 | int maximum = limits.maximum/limits.denominator;
45 | int current = limits.current/limits.denominator;
46 |
47 | ui->slider->setMinimum(minimum);
48 | ui->slider->setMaximum(maximum);
49 | ui->slider->setValue(current);
50 |
51 | ui->spinbox->setMinimum(minimum);
52 | ui->spinbox->setMaximum(maximum);
53 | ui->spinbox->setValue(current);
54 |
55 | ui->minLabel->setText(QString("%1").arg(minimum).append(suffix));
56 | ui->maxLabel->setText(QString("%1").arg(maximum).append(suffix));
57 | ui->limitLabel->setText(QString("%1").arg(current).append(suffix));
58 | }
59 |
60 | unsigned int GpuSlider::getValue()
61 | {
62 | unsigned int limit = ui->slider->value();
63 | limit = limit * m_denominator;
64 | if (limit < m_minimum ) limit = m_minimum;
65 | if (limit > m_maximum ) limit = m_maximum;
66 | return limit;
67 | }
68 |
--------------------------------------------------------------------------------
/qutefan/qutefan/gpuslider.h:
--------------------------------------------------------------------------------
1 | #pragma once
2 |
3 | #include
4 |
5 | #include "control.h"
6 |
7 | namespace Ui {
8 | class GpuSlider;
9 | }
10 |
11 | class GpuSlider : public QWidget
12 | {
13 | Q_OBJECT
14 |
15 | public:
16 | explicit GpuSlider(QWidget *parent = nullptr);
17 | ~GpuSlider();
18 |
19 | void setLimits(Control::Limits);
20 | unsigned int getValue();
21 |
22 | private:
23 | unsigned int m_maximum;
24 | unsigned int m_minimum;
25 | int m_denominator;
26 |
27 | Ui::GpuSlider *ui;
28 | };
29 |
--------------------------------------------------------------------------------
/qutefan/qutefan/gpuslider.ui:
--------------------------------------------------------------------------------
1 |
2 |
3 | GpuSlider
4 |
5 |
6 |
7 | 0
8 | 0
9 | 146
10 | 36
11 |
12 |
13 |
14 |
15 | 0
16 | 0
17 |
18 |
19 |
20 | Form
21 |
22 |
23 |
24 | 0
25 |
26 |
27 | 0
28 |
29 |
30 | 0
31 |
32 |
33 | 0
34 |
35 |
36 | 0
37 |
38 | -
39 |
40 |
41 |
42 | 0
43 | 0
44 |
45 |
46 |
47 | min
48 |
49 |
50 |
51 | -
52 |
53 |
54 |
55 | 0
56 | 0
57 |
58 |
59 |
60 | max
61 |
62 |
63 | Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter
64 |
65 |
66 |
67 | -
68 |
69 |
70 |
71 | 0
72 | 0
73 |
74 |
75 |
76 |
77 | true
78 |
79 |
80 |
81 | QFrame::StyledPanel
82 |
83 |
84 | QFrame::Sunken
85 |
86 |
87 | limit
88 |
89 |
90 | Qt::AlignCenter
91 |
92 |
93 |
94 | -
95 |
96 |
97 |
98 | 0
99 | 0
100 |
101 |
102 |
103 | Qt::Horizontal
104 |
105 |
106 | false
107 |
108 |
109 | false
110 |
111 |
112 | QSlider::NoTicks
113 |
114 |
115 | 5
116 |
117 |
118 |
119 | -
120 |
121 |
122 |
123 |
124 |
125 |
126 |
127 |
--------------------------------------------------------------------------------
/qutefan/qutefan/gputab.cpp:
--------------------------------------------------------------------------------
1 | #include "ui_gputab.h"
2 | #include "gputab.h"
3 |
4 | GpuTab::GpuTab(QSettings* settings, QWidget* parent) : QWidget(parent), ui(new Ui::GpuTab)
5 | {
6 | ui->setupUi(this);
7 |
8 | m_settings = settings;
9 |
10 | // Hide unfinished UI elements
11 | //ui->overclockGroup->hide();
12 | ui->radioButtonGraph->hide();
13 | ui->pushButtonGraph->hide();
14 | ui->pushButtonChart->hide();
15 |
16 | ui->groupBoxCharts->hide();
17 | ui->spinBoxFixedLevel->setSingleStep(5);
18 |
19 | m_temp_label = new QLabel("Temperature:", this);
20 | m_temp_info = new DoubleLabel(this, "%1°C", 100);
21 | ui->formLayoutStatus->insertRow(0, m_temp_label, m_temp_info);
22 |
23 | int row;
24 | QFormLayout::ItemRole role;
25 |
26 | m_core_slider = new GpuSlider(this);
27 | m_core_slider->setDisabled(true);
28 | ui->overclockLayout->getWidgetPosition(ui->coreClockCheck, &row, &role);
29 | ui->overclockLayout->setWidget(row, QFormLayout::FieldRole, m_core_slider);
30 | connect(ui->coreClockCheck, &QCheckBox::stateChanged, m_core_slider, &GpuSlider::setEnabled);
31 |
32 | m_mem_slider = new GpuSlider(this);
33 | m_mem_slider->setDisabled(true);
34 | ui->overclockLayout->getWidgetPosition(ui->memClockCheck, &row, &role);
35 | ui->overclockLayout->setWidget(row, QFormLayout::FieldRole, m_mem_slider);
36 | connect(ui->memClockCheck, &QCheckBox::stateChanged, m_mem_slider, &GpuSlider::setEnabled);
37 |
38 | m_power_slider = new GpuSlider(this);
39 | m_power_slider->setDisabled(true);
40 | ui->overclockLayout->getWidgetPosition(ui->powerLimitCheck, &row, &role);
41 | ui->overclockLayout->setWidget(row, QFormLayout::FieldRole, m_power_slider);
42 | connect(ui->powerLimitCheck, &QCheckBox::stateChanged, m_power_slider, &GpuSlider::setEnabled);
43 |
44 | #ifndef USE_NVML
45 | ui->overclockGroup->setHidden(true);
46 | #endif
47 |
48 | #if USE_CHARTS
49 | connect(ui->pushButtonChart, SIGNAL(pressed()), this, SLOT(showChart()));
50 | #endif
51 | connect(ui->pushButtonReset, &QPushButton::pressed, this, &GpuTab::resetMaximums);
52 | connect(ui->overclockApplyButton, &QPushButton::pressed, this, &GpuTab::applyOverclock);
53 |
54 | }
55 |
56 | GpuTab::~GpuTab()
57 | {
58 | m_temp_label->deleteLater();
59 | m_temp_info->deleteLater();
60 | for (int c = m_fan_label.size() - 1; c >= 0; --c)
61 | m_fan_label[c]->deleteLater();
62 | for (int c = m_fan_info.size() - 1; c >= 0; --c)
63 | m_fan_info[c]->deleteLater();
64 | delete ui;
65 | }
66 |
67 | GpuTab::FanMode GpuTab::getMode()
68 | {
69 | if(ui->radioButtonOff->isChecked()) return FanMode::Off;
70 | if(ui->radioButtonQuiet->isChecked()) return FanMode::Quiet;
71 | if(ui->radioButtonFixed->isChecked()) return FanMode::Fixed;
72 | if(ui->radioButtonLinear->isChecked()) return FanMode::Linear;
73 | if(ui->radioButtonGraph->isChecked()) return FanMode::Graph;
74 |
75 | return FanMode::Off;
76 | }
77 |
78 | void GpuTab::saveSettings(const QString &uuid)
79 | {
80 | m_settings->beginGroup(uuid);
81 | m_settings->setValue("mode", static_cast(getMode()));
82 | m_settings->setValue("fixed", ui->spinBoxFixedLevel->value());
83 | m_settings->setValue("linear", ui->spinBoxLinearOffset->value());
84 | m_settings->endGroup();
85 | }
86 |
87 | void GpuTab::loadSettings(const QString &uuid)
88 | {
89 | m_settings->beginGroup(uuid);
90 | int mode = m_settings->value("mode", 0).toInt();
91 | if (mode == static_cast(FanMode::Off)) ui->radioButtonOff->setChecked(true);
92 | if (mode == static_cast(FanMode::Quiet)) ui->radioButtonQuiet->setChecked(true);
93 | if (mode == static_cast(FanMode::Fixed)) ui->radioButtonFixed->setChecked(true);
94 | if (mode == static_cast(FanMode::Linear)) ui->radioButtonLinear->setChecked(true);
95 | if (mode == static_cast(FanMode::Graph)) ui->radioButtonGraph->setChecked(true);
96 | ui->spinBoxFixedLevel->setValue(m_settings->value("fixed", 0).toInt());
97 | ui->spinBoxLinearOffset->setValue(m_settings->value("linear", 0).toInt());
98 | m_settings->endGroup();
99 | }
100 |
101 | void GpuTab::addCoolers(Control::CoolerLevels levels)
102 | {
103 | for (unsigned int c = 0; c < levels.count; ++c) {
104 | QLabel* label = new QLabel(QString("Fan %1 level:").arg(c));
105 | DoubleLabel* info = new DoubleLabel(this, "%1%", 100);
106 | info->setValue(levels.current[c]);
107 | ui->formLayoutStatus->insertRow(c + 1, label, info);
108 | m_fan_label.push_back(label);
109 | m_fan_info.push_back(info);
110 | }
111 | }
112 |
113 | void GpuTab::setPowerLimits(Control::Limits limits)
114 | {
115 | m_power_slider->setLimits(limits);
116 | }
117 |
118 | #if USE_CHARTS
119 | void GpuTab::showChart()
120 | {
121 | if(ui->groupBoxCharts->isVisible()) {
122 | return;
123 | }
124 |
125 | QLineSeries *series = new QLineSeries();
126 | //TODO: fix this after testing
127 | for (unsigned long i = 0; i < 600; i++)
128 | if (history[i].level != 0)
129 | series->append(history[i].time.toMSecsSinceEpoch(), history[i].level);
130 |
131 | QChart *chart = new QChart();
132 | chart->legend()->hide();
133 | chart->addSeries(series);
134 | chart->setTitle("Fan Speed");
135 | chart->setMargins(QMargins(0,0,0,0));
136 | //chart->setBackgroundRoundness(0);
137 |
138 | QDateTimeAxis *axisX = new QDateTimeAxis;
139 | axisX->setRange(QDateTime::currentDateTime().addSecs(-300), QDateTime::currentDateTime());
140 | axisX->setTickCount(10);
141 | axisX->setFormat("HH:mm:ss");
142 | axisX->setTitleText("Time");
143 | chart->addAxis(axisX, Qt::AlignBottom);
144 | series->attachAxis(axisX);
145 |
146 | QValueAxis *axisY = new QValueAxis;
147 | axisY->setMax(max_level + 10);
148 | axisY->setLabelFormat("%i");
149 | axisY->setTitleText("Duty Cycle (%)");
150 | chart->addAxis(axisY, Qt::AlignLeft);
151 | series->attachAxis(axisY);
152 |
153 | QChartView *chartView = new QChartView(chart);
154 | chartView->setRenderHint(QPainter::Antialiasing);
155 |
156 | //popup->resize(820, 600);
157 | ui->groupBoxCharts->resize(640, 480);
158 | chartView->resize(ui->groupBoxCharts->size());
159 | ui->groupBoxCharts->layout()->addWidget(chartView);
160 | ui->groupBoxCharts->show();
161 | //popup->show();
162 | }
163 | #endif
164 |
--------------------------------------------------------------------------------
/qutefan/qutefan/gputab.h:
--------------------------------------------------------------------------------
1 | #pragma once
2 |
3 | #include
4 | #include
5 | #include
6 |
7 | #if USE_CHARTS
8 | #include
9 | #endif
10 |
11 | #include "control.h"
12 | #include "doublelabel.h"
13 | #include "gpuslider.h"
14 |
15 | namespace Ui {
16 | class GpuTab;
17 | }
18 |
19 | class GpuTab : public QWidget
20 | {
21 | Q_OBJECT
22 |
23 | public:
24 | explicit GpuTab(QSettings*, QWidget* parent = nullptr);
25 | ~GpuTab();
26 |
27 | enum class FanMode {
28 | Off = 0,
29 | Quiet,
30 | Fixed,
31 | Linear,
32 | Graph
33 | };
34 |
35 | GpuTab::FanMode getMode();
36 | GpuTab::FanMode last_mode = FanMode::Off;
37 |
38 | void saveSettings(const QString &);
39 | void loadSettings(const QString &);
40 |
41 | virtual void saveGpuSettings() = 0;
42 | virtual void setGPUDefaults() = 0;
43 | virtual void regulateFans() = 0;
44 | virtual void displayFrequencies() = 0;
45 |
46 | public slots:
47 | virtual void applyOverclock() = 0;
48 | virtual void resetOverclock() = 0;
49 | virtual void resetMaximums() = 0;
50 | #if USE_CHARTS
51 | virtual void showChart() = 0;
52 | #endif
53 |
54 | protected:
55 | void addCoolers(Control::CoolerLevels);
56 | void setPowerLimits(Control::Limits);
57 |
58 | QLabel* m_temp_label;
59 | DoubleLabel* m_temp_info;
60 |
61 | QVector m_fan_label;
62 | QVector m_fan_info;
63 |
64 | GpuSlider* m_core_slider;
65 | GpuSlider* m_mem_slider;
66 | GpuSlider* m_power_slider;
67 |
68 | #if USE_CHARTS
69 | typedef struct {
70 | QDateTime time;
71 | int level;
72 | int temp;
73 | } NvLogger;
74 | NvLogger history[600] = {};
75 | NvLogger* current_entry = history;
76 | # endif
77 |
78 | Ui::GpuTab* ui;
79 |
80 | private:
81 | QSettings* m_settings;
82 | };
83 |
--------------------------------------------------------------------------------
/qutefan/qutefan/gputab.ui:
--------------------------------------------------------------------------------
1 |
2 |
3 | GpuTab
4 |
5 |
6 |
7 | 0
8 | 0
9 | 459
10 | 368
11 |
12 |
13 |
14 | Form
15 |
16 |
17 |
18 | QLayout::SetFixedSize
19 |
20 | -
21 |
22 |
23 |
24 | 0
25 | 0
26 |
27 |
28 |
29 | Fan Control
30 |
31 |
32 |
-
33 |
34 |
35 |
36 | true
37 |
38 |
39 |
40 | Linear
41 |
42 |
43 |
44 | -
45 |
46 |
47 |
48 | true
49 |
50 |
51 |
52 | Graph
53 |
54 |
55 |
56 | -
57 |
58 |
59 | Level:
60 |
61 |
62 | Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter
63 |
64 |
65 |
66 | -
67 |
68 |
69 | Edit
70 |
71 |
72 |
73 | -
74 |
75 |
76 | -10
77 |
78 |
79 | 30
80 |
81 |
82 |
83 | -
84 |
85 |
86 |
87 | true
88 |
89 |
90 |
91 | Fixed
92 |
93 |
94 |
95 | -
96 |
97 |
98 |
99 | true
100 |
101 |
102 |
103 | Quiet
104 |
105 |
106 |
107 | -
108 |
109 |
110 | Offset:
111 |
112 |
113 | Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter
114 |
115 |
116 |
117 | -
118 |
119 |
120 |
121 | true
122 |
123 |
124 |
125 | Off
126 |
127 |
128 | true
129 |
130 |
131 |
132 | -
133 |
134 |
135 | -
136 |
137 |
138 | Qt::Vertical
139 |
140 |
141 |
142 | 0
143 | 0
144 |
145 |
146 |
147 |
148 |
149 |
150 |
151 | -
152 |
153 |
154 | Status
155 |
156 |
157 |
158 | Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter
159 |
160 |
-
161 |
162 |
163 |
164 | 78
165 | 0
166 |
167 |
168 |
169 | Core:
170 |
171 |
172 | Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter
173 |
174 |
175 |
176 | -
177 |
178 |
179 |
180 | 0
181 | 0
182 |
183 |
184 |
185 | QFrame::StyledPanel
186 |
187 |
188 | QFrame::Sunken
189 |
190 |
191 | 0Mhz
192 |
193 |
194 | Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter
195 |
196 |
197 |
198 | -
199 |
200 |
201 |
202 | 78
203 | 0
204 |
205 |
206 |
207 | Memory:
208 |
209 |
210 | Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter
211 |
212 |
213 |
214 | -
215 |
216 |
217 |
218 | 0
219 | 0
220 |
221 |
222 |
223 | QFrame::StyledPanel
224 |
225 |
226 | QFrame::Sunken
227 |
228 |
229 | 0Mhz
230 |
231 |
232 | Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter
233 |
234 |
235 |
236 | -
237 |
238 |
239 |
240 | 78
241 | 0
242 |
243 |
244 |
245 | Shader:
246 |
247 |
248 | Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter
249 |
250 |
251 |
252 | -
253 |
254 |
255 |
256 | 0
257 | 0
258 |
259 |
260 |
261 | QFrame::StyledPanel
262 |
263 |
264 | QFrame::Sunken
265 |
266 |
267 | 0Mhz
268 |
269 |
270 | Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter
271 |
272 |
273 |
274 | -
275 |
276 |
277 |
278 | 78
279 | 0
280 |
281 |
282 |
283 | Power:
284 |
285 |
286 | Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter
287 |
288 |
289 |
290 | -
291 |
292 |
293 |
294 | 0
295 | 0
296 |
297 |
298 |
299 | QFrame::StyledPanel
300 |
301 |
302 | QFrame::Sunken
303 |
304 |
305 | 0W
306 |
307 |
308 | Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter
309 |
310 |
311 |
312 | -
313 |
314 |
-
315 |
316 |
317 | Show History
318 |
319 |
320 |
321 | -
322 |
323 |
324 | Reset Max
325 |
326 |
327 |
328 |
329 |
330 |
331 |
332 |
333 | -
334 |
335 |
336 |
337 | 0
338 | 0
339 |
340 |
341 |
342 | Overclock
343 |
344 |
345 | Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop
346 |
347 |
348 |
349 | Qt::AlignBottom|Qt::AlignLeading|Qt::AlignLeft
350 |
351 |
352 | Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter
353 |
354 |
-
355 |
356 |
357 |
358 | 0
359 | 0
360 |
361 |
362 |
363 |
364 | true
365 |
366 |
367 |
368 | Power:
369 |
370 |
371 |
372 | -
373 |
374 |
375 |
376 | 0
377 | 0
378 |
379 |
380 |
381 |
382 | true
383 |
384 |
385 |
386 | Core:
387 |
388 |
389 |
390 | -
391 |
392 |
393 |
394 | 0
395 | 0
396 |
397 |
398 |
399 |
400 | true
401 |
402 |
403 |
404 | Memory:
405 |
406 |
407 |
408 | -
409 |
410 |
-
411 |
412 |
413 | Reset
414 |
415 |
416 |
417 | -
418 |
419 |
420 | Apply
421 |
422 |
423 |
424 |
425 |
426 |
427 |
428 |
429 | -
430 |
431 |
432 | Charts
433 |
434 |
435 |
436 |
437 |
438 |
439 |
440 |
441 |
442 |
--------------------------------------------------------------------------------
/qutefan/qutefan/gputab_nvapi.cpp:
--------------------------------------------------------------------------------
1 | #include "ui_gputab.h"
2 | #include "gputab_nvapi.h"
3 |
4 | GpuTabNvAPI::GpuTabNvAPI(ControlNvAPI* api,
5 | ControlNvAPI::NvGPU* gpu,
6 | QSettings* settings,
7 | QWidget* parent) : GpuTab(settings, parent)
8 | {
9 | m_api = api;
10 | m_gpu = gpu;
11 |
12 | Control::CoolerLimits limits = m_api->getCoolerLimits(m_gpu);
13 | ui->spinBoxFixedLevel->setMinimum(limits.minimum);
14 | ui->spinBoxFixedLevel->setMaximum(limits.maximum);
15 | ui->spinBoxFixedLevel->setValue(limits.current);
16 |
17 | Control::CoolerLevels levels = m_api->getCoolerLevels(m_gpu);
18 | addCoolers(levels);
19 | loadSettings(QString(m_api->uuid(m_gpu)));
20 | }
21 |
22 | GpuTabNvAPI::~GpuTabNvAPI()
23 | {
24 |
25 | }
26 |
27 | void GpuTabNvAPI::saveGpuSettings()
28 | {
29 | saveSettings(QString(m_api->uuid(m_gpu)));
30 | }
31 |
32 | void GpuTabNvAPI::setGPUDefaults()
33 | {
34 | Control::CoolerLimits limits = m_api->getCoolerLimits(m_gpu);
35 | m_api->setCoolerLevels(m_gpu, limits.minimum);
36 | m_api->setCoolerManualControl(m_gpu, false);
37 | qDebug("Restored defaults for GPU");
38 | }
39 |
40 | void GpuTabNvAPI::regulateFans()
41 | {
42 | Control::Temperatures temps = m_api->getGpuTemperatures(m_gpu);
43 | m_temp_info->setValue(temps.gpu);
44 |
45 | GpuTab::FanMode mode = getMode();
46 | if(mode == GpuTab::FanMode::Off) {
47 | if(mode != last_mode)
48 | setGPUDefaults();
49 | } else {
50 | int level = 0;
51 | m_api->setCoolerManualControl(m_gpu, true);
52 | switch (mode) {
53 | case GpuTab::FanMode::Off:
54 | case GpuTab::FanMode::Graph:
55 | case GpuTab::FanMode::Quiet:
56 | default: {
57 | Control::CoolerLimits limits = m_api->getCoolerLimits(m_gpu);
58 | level = limits.minimum;
59 | break;
60 | }
61 | case GpuTab::FanMode::Fixed: {
62 | level = ui->spinBoxFixedLevel->text().toInt();
63 | break;
64 | }
65 | case GpuTab::FanMode::Linear: {
66 | level = temps.gpu + ui->spinBoxLinearOffset->text().toInt();
67 | break;
68 | }
69 | }
70 | m_api->setCoolerLevels(m_gpu, level);
71 | }
72 | last_mode = mode;
73 |
74 | Control::CoolerLevels levels = m_api->getCoolerLevels(m_gpu);
75 | for (unsigned int c = 0; c < levels.count; ++c) {
76 | m_fan_info[c]->setValue(levels.current[c]);
77 | }
78 | #if USE_CHARTS
79 | current_entry->time = QDateTime::currentDateTime();
80 | current_entry->level = level;
81 | current_entry->temp = temp;
82 | current_entry++;
83 | if(current_entry > &history[599]) current_entry = history;
84 | # endif
85 | }
86 |
87 | void GpuTabNvAPI::displayFrequencies()
88 | {
89 | Control::Frequencies frequency = m_api->getCurrentClockFrequencies(m_gpu);
90 | ui->labelStatusCoreCur->setText(QString("%1Mhz").arg(frequency.core));
91 | ui->labelStatusMemCur->setText(QString("%1Mhz").arg(frequency.memory));
92 | ui->labelStatusShaderCur->setText(QString("%1Mhz").arg(frequency.shader));
93 | }
94 |
95 | void GpuTabNvAPI::resetMaximums()
96 | {
97 | Control::Temperatures temps = m_api->getGpuTemperatures(m_gpu);
98 | m_temp_info->setValue(temps.gpu, true);
99 | Control::CoolerLevels levels = m_api->getCoolerLevels(m_gpu);
100 | for (unsigned int c = 0; c < levels.count; ++c) {
101 | m_fan_info[c]->setValue(levels.current[c], true);
102 | }
103 | }
104 |
105 |
--------------------------------------------------------------------------------
/qutefan/qutefan/gputab_nvapi.h:
--------------------------------------------------------------------------------
1 | #pragma once
2 |
3 | #include
4 |
5 | #include "gputab.h"
6 | #include "qnvapi.h"
7 |
8 | namespace Ui {
9 | class GpuTabNvAPI;
10 | }
11 |
12 | class GpuTabNvAPI : public GpuTab
13 | {
14 | public:
15 | explicit GpuTabNvAPI(ControlNvAPI*, ControlNvAPI::NvGPU*, QSettings*, QWidget* parent = nullptr);
16 | ~GpuTabNvAPI();
17 |
18 | void saveGpuSettings();
19 | void setGPUDefaults();
20 | void regulateFans();
21 | void displayFrequencies();
22 |
23 | private slots:
24 | void applyOverclock() { return; }
25 | void resetOverclock() { return; }
26 | void resetMaximums();
27 |
28 | private:
29 | ControlNvAPI *m_api;
30 | ControlNvAPI::NvGPU *m_gpu;
31 | };
32 |
--------------------------------------------------------------------------------
/qutefan/qutefan/gputab_nvctrl.cpp:
--------------------------------------------------------------------------------
1 | #include "ui_gputab.h"
2 | #include "gputab_nvctrl.h"
3 |
4 | GpuTabNVCtrl::GpuTabNVCtrl(ControlNVCtrl* api,
5 | ControlNVCtrl::NvGPU* gpu,
6 | QSettings* settings,
7 | QWidget* parent) : GpuTab(settings, parent)
8 | {
9 | m_api = api;
10 | m_gpu = gpu;
11 |
12 | Control::CoolerLimits limits = m_api->getCoolerLimits(m_gpu);
13 | ui->spinBoxFixedLevel->setMinimum(limits.minimum);
14 | ui->spinBoxFixedLevel->setMaximum(limits.maximum);
15 | ui->spinBoxFixedLevel->setValue(limits.current);
16 |
17 | Control::CoolerLevels levels = m_api->getCoolerLevels(m_gpu);
18 | addCoolers(levels);
19 | loadSettings(QString(m_api->uuid(m_gpu)));
20 | }
21 |
22 | GpuTabNVCtrl::~GpuTabNVCtrl()
23 | {
24 |
25 | }
26 |
27 | void GpuTabNVCtrl::saveGpuSettings()
28 | {
29 | saveSettings(QString(m_api->uuid(m_gpu)));
30 | }
31 |
32 | void GpuTabNVCtrl::setGPUDefaults()
33 | {
34 | Control::CoolerLimits limits = m_api->getCoolerLimits(m_gpu);
35 | m_api->setCoolerLevels(m_gpu, limits.minimum);
36 | m_api->setCoolerManualControl(m_gpu, false);
37 | qDebug("Restored defaults for GPU");
38 | }
39 |
40 | void GpuTabNVCtrl::regulateFans()
41 | {
42 | Control::Temperatures temps = m_api->getGpuTemperatures(m_gpu);
43 | m_temp_info->setValue(temps.gpu);
44 |
45 | GpuTab::FanMode mode = getMode();
46 | if(mode == GpuTab::FanMode::Off) {
47 | if(mode != last_mode)
48 | setGPUDefaults();
49 | } else {
50 | int level = 0;
51 | m_api->setCoolerManualControl(m_gpu, true);
52 | switch (mode) {
53 | case GpuTab::FanMode::Off:
54 | case GpuTab::FanMode::Graph:
55 | case GpuTab::FanMode::Quiet:
56 | default: {
57 | Control::CoolerLimits limits = m_api->getCoolerLimits(m_gpu);
58 | level = limits.minimum;
59 | break;
60 | }
61 | case GpuTab::FanMode::Fixed: {
62 | level = ui->spinBoxFixedLevel->text().toInt();
63 | break;
64 | }
65 | case GpuTab::FanMode::Linear: {
66 | level = temps.gpu + ui->spinBoxLinearOffset->text().toInt();
67 | break;
68 | }
69 | }
70 | m_api->setCoolerLevels(m_gpu, level);
71 | }
72 | last_mode = mode;
73 |
74 | Control::CoolerLevels levels = m_api->getCoolerLevels(m_gpu);
75 | for (unsigned int c = 0; c < levels.count; ++c) {
76 | m_fan_info[c]->setValue(levels.current[c]);
77 | }
78 | #if USE_CHARTS
79 | current_entry->time = QDateTime::currentDateTime();
80 | current_entry->level = level;
81 | current_entry->temp = temp;
82 | current_entry++;
83 | if(current_entry > &history[599]) current_entry = history;
84 | # endif
85 | }
86 |
87 | void GpuTabNVCtrl::displayFrequencies()
88 | {
89 | Control::Frequencies frequency = m_api->getCurrentClockFrequencies(m_gpu);
90 | ui->labelStatusCoreCur->setText(QString("%1Mhz").arg(frequency.core));
91 | ui->labelStatusMemCur->setText(QString("%1Mhz").arg(frequency.memory));
92 | ui->labelStatusShaderCur->setText(QString("%1Mhz").arg(frequency.shader));
93 | ui->labelStatusPowerCur->setText(QString("%1W").arg(frequency.power/1000));
94 | }
95 |
96 | void GpuTabNVCtrl::resetMaximums()
97 | {
98 | Control::Temperatures temps = m_api->getGpuTemperatures(m_gpu);
99 | m_temp_info->setValue(temps.gpu, true);
100 | Control::CoolerLevels levels = m_api->getCoolerLevels(m_gpu);
101 | for (unsigned int c = 0; c < levels.count; ++c) {
102 | m_fan_info[c]->setValue(levels.current[c], true);
103 | }
104 | }
105 |
106 |
--------------------------------------------------------------------------------
/qutefan/qutefan/gputab_nvctrl.h:
--------------------------------------------------------------------------------
1 | #pragma once
2 |
3 | #include
4 |
5 | #include "gputab.h"
6 | #include "qnvctrl.h"
7 |
8 | namespace Ui {
9 | class GpuTabNVCtrl;
10 | }
11 |
12 | class GpuTabNVCtrl : public GpuTab
13 | {
14 | public:
15 | explicit GpuTabNVCtrl(ControlNVCtrl*, ControlNVCtrl::NvGPU*, QSettings*, QWidget* parent = nullptr);
16 | ~GpuTabNVCtrl();
17 |
18 | void saveGpuSettings();
19 | void setGPUDefaults();
20 | void regulateFans();
21 | void displayFrequencies();
22 |
23 | private slots:
24 | void applyOverclock() { return; }
25 | void resetOverclock() { return; }
26 | void resetMaximums();
27 |
28 | private:
29 | ControlNVCtrl *m_api;
30 | ControlNVCtrl::NvGPU *m_gpu;
31 | };
32 |
--------------------------------------------------------------------------------
/qutefan/qutefan/gputab_nvml.cpp:
--------------------------------------------------------------------------------
1 | #include "ui_gputab.h"
2 | #include "gputab_nvml.h"
3 |
4 | GpuTabNvml::GpuTabNvml(ControlNvml* api,
5 | ControlNvml::NvGPU* gpu,
6 | QSettings* settings,
7 | QWidget* parent) : GpuTab(settings, parent)
8 | {
9 | m_api = api;
10 | m_gpu = gpu;
11 |
12 | Control::CoolerLimits limits = m_api->getCoolerLimits(m_gpu);
13 | ui->spinBoxFixedLevel->setMinimum(limits.minimum);
14 | ui->spinBoxFixedLevel->setMaximum(limits.maximum);
15 | ui->spinBoxFixedLevel->setValue(limits.current);
16 |
17 | Control::CoolerLevels levels = m_api->getCoolerLevels(m_gpu);
18 | addCoolers(levels);
19 |
20 | Control::Limits power = m_api->getPowerLimits(m_gpu);
21 | setPowerLimits(power);
22 |
23 | loadSettings(QString(m_api->uuid(m_gpu)));
24 | }
25 |
26 | GpuTabNvml::~GpuTabNvml()
27 | {
28 |
29 | }
30 |
31 | void GpuTabNvml::saveGpuSettings()
32 | {
33 | saveSettings(QString(m_api->uuid(m_gpu)));
34 | }
35 |
36 | void GpuTabNvml::setGPUDefaults()
37 | {
38 | Control::CoolerLimits limits = m_api->getCoolerLimits(m_gpu);
39 | m_api->setCoolerLevels(m_gpu, limits.minimum);
40 | m_api->setCoolerManualControl(m_gpu, false);
41 | qDebug("Restored defaults for GPU");
42 | }
43 |
44 | void GpuTabNvml::regulateFans()
45 | {
46 | Control::Temperatures temps = m_api->getGpuTemperatures(m_gpu);
47 | m_temp_info->setValue(temps.gpu);
48 |
49 | GpuTab::FanMode mode = getMode();
50 | if(mode == GpuTab::FanMode::Off) {
51 | if(mode != last_mode)
52 | setGPUDefaults();
53 | } else {
54 | int level = 0;
55 | m_api->setCoolerManualControl(m_gpu, true);
56 | switch (mode) {
57 | case GpuTab::FanMode::Off:
58 | case GpuTab::FanMode::Graph:
59 | case GpuTab::FanMode::Quiet:
60 | default: {
61 | Control::CoolerLimits limits = m_api->getCoolerLimits(m_gpu);
62 | level = limits.minimum;
63 | break;
64 | }
65 | case GpuTab::FanMode::Fixed: {
66 | level = ui->spinBoxFixedLevel->text().toInt();
67 | break;
68 | }
69 | case GpuTab::FanMode::Linear: {
70 | level = temps.gpu + ui->spinBoxLinearOffset->text().toInt();
71 | break;
72 | }
73 | }
74 | m_api->setCoolerLevels(m_gpu, level);
75 | }
76 | last_mode = mode;
77 |
78 | Control::CoolerLevels levels = m_api->getCoolerLevels(m_gpu);
79 | for (unsigned int c = 0; c < levels.count; ++c) {
80 | m_fan_info[c]->setValue(levels.current[c]);
81 | }
82 | #if USE_CHARTS
83 | current_entry->time = QDateTime::currentDateTime();
84 | current_entry->level = level;
85 | current_entry->temp = temp;
86 | current_entry++;
87 | if(current_entry > &history[599]) current_entry = history;
88 | # endif
89 | }
90 |
91 | void GpuTabNvml::displayFrequencies()
92 | {
93 | Control::Frequencies frequency = m_api->getCurrentClockFrequencies(m_gpu);
94 | ui->labelStatusCoreCur->setText(QString("%1Mhz").arg(frequency.core));
95 | ui->labelStatusMemCur->setText(QString("%1Mhz").arg(frequency.memory));
96 | ui->labelStatusShaderCur->setText(QString("%1Mhz").arg(frequency.shader));
97 | ui->labelStatusPowerCur->setText(QString("%1W").arg(frequency.power/1000));
98 | }
99 |
100 | void GpuTabNvml::applyOverclock()
101 | {
102 | if (ui->powerLimitCheck->isChecked())
103 | m_api->setPowerLimit(m_gpu, m_power_slider->getValue());
104 |
105 | Control::Limits power = m_api->getPowerLimits(m_gpu);
106 | setPowerLimits(power);
107 | }
108 |
109 | void GpuTabNvml::resetMaximums()
110 | {
111 | Control::Temperatures temps = m_api->getGpuTemperatures(m_gpu);
112 | m_temp_info->setValue(temps.gpu, true);
113 | Control::CoolerLevels levels = m_api->getCoolerLevels(m_gpu);
114 | for (unsigned int c = 0; c < levels.count; ++c) {
115 | m_fan_info[c]->setValue(levels.current[c], true);
116 | }
117 | }
118 |
119 |
--------------------------------------------------------------------------------
/qutefan/qutefan/gputab_nvml.h:
--------------------------------------------------------------------------------
1 | #pragma once
2 |
3 | #include
4 |
5 | #include "gputab.h"
6 | #include "qnvml.h"
7 |
8 | namespace Ui {
9 | class GpuTabNvml;
10 | }
11 |
12 | class GpuTabNvml : public GpuTab
13 | {
14 | public:
15 | GpuTabNvml(ControlNvml*, ControlNvml::NvGPU*, QSettings*, QWidget* parent = nullptr);
16 | ~GpuTabNvml();
17 |
18 | void saveGpuSettings();
19 | void setGPUDefaults();
20 | void regulateFans();
21 | void displayFrequencies();
22 |
23 | private slots:
24 | void applyOverclock();
25 | void resetOverclock() { return; }
26 | void resetMaximums();
27 |
28 | private:
29 | ControlNvml *m_api;
30 | ControlNvml::NvGPU *m_gpu;
31 | };
32 |
--------------------------------------------------------------------------------
/qutefan/qutefan/main.cpp:
--------------------------------------------------------------------------------
1 | #include "qutefan.h"
2 | #include
3 | #include
4 |
5 | int main(int argc, char *argv[])
6 | {
7 | QApplication a(argc, argv);
8 |
9 | a.setOrganizationName("Qutefan");
10 | a.setApplicationName("Qutefan");
11 | a.setApplicationVersion("0.1.1");
12 |
13 | QFont f;
14 | f.setHintingPreference(QFont::PreferFullHinting);
15 | a.setFont(f);
16 |
17 | QuteFan w;
18 | w.show();
19 |
20 | return a.exec();
21 | }
22 |
--------------------------------------------------------------------------------
/qutefan/qutefan/qutefan.cpp:
--------------------------------------------------------------------------------
1 | #include "qutefan.h"
2 | #include "ui_qutefan.h"
3 |
4 |
5 | QuteFan::QuteFan(QWidget *parent) : QMainWindow(parent), ui(new Ui::QuteFan)
6 | {
7 | ui->setupUi(this);
8 | setWindowTitle(qApp->applicationName());
9 |
10 | timer = new QTimer(this);
11 | tray_icon = new QuteFanTrayIcon(this);
12 |
13 | settings = new QSettings(
14 | QSettings::IniFormat,
15 | QSettings::UserScope,
16 | qApp->organizationName(),
17 | qApp->applicationName(),
18 | this);
19 |
20 | #if defined(USE_NVML)
21 | m_control_nvml = new ControlNvml();
22 |
23 | if(m_control_nvml->available()) {
24 | m_control_nvml->initialize();
25 |
26 | for(unsigned int g = 0; g < m_control_nvml->gpu_count; ++g) {
27 | ControlNvml::NvGPU *gpu = m_control_nvml->getGpuByIndex(g);
28 | GpuTabNvml *tab = new GpuTabNvml(m_control_nvml, gpu, settings, this);
29 | m_gpu_tab.append(tab);
30 | ui->tabWidgetGpu->addTab(
31 | m_gpu_tab[g], QString("%1").arg(m_control_nvml->name(gpu))
32 | );
33 | }
34 | }
35 | #elif defined(Q_OS_WIN) // Windows fallback
36 | m_control_nvapi = new ControlNvAPI();
37 |
38 | if(m_control_nvapi->available()) {
39 | m_control_nvapi->initialize();
40 |
41 | for(unsigned int g = 0; g < m_control_nvapi->gpu_count; ++g) {
42 | ControlNvAPI::NvGPU *gpu = m_control_nvapi->getGpuByIndex(g);
43 | GpuTabNvAPI *tab = new GpuTabNvAPI(m_control_nvapi, gpu, settings, this);
44 | m_gpu_tab.append(tab);
45 | ui->tabWidgetGpu->addTab(
46 | m_gpu_tab[g], QString("%1").arg(m_control_nvapi->name(gpu))
47 | );
48 | }
49 | }
50 | #elif defined(Q_OS_LINUX) // Linux fallback
51 | m_control_nvctrl = new ControlNVCtrl();
52 |
53 | if(m_control_nvctrl->available()) {
54 | m_control_nvctrl->initialize();
55 |
56 | for(int g = 0; g < m_control_nvctrl->gpu_count; ++g) {
57 | ControlNVCtrl::NvGPU *gpu = m_control_nvctrl->getGpuByIndex(g);
58 | GpuTabNVCtrl *tab = new GpuTabNVCtrl(m_control_nvctrl, gpu, settings, this);
59 | m_gpu_tab.append(tab);
60 | ui->tabWidgetGpu->addTab(
61 | m_gpu_tab[g], QString("%1").arg(m_control_nvctrl->name(gpu)));
62 | }
63 | }
64 | #endif
65 | else {
66 | QMessageBox::critical(this, "Error", "No supported hardware found.");
67 | qApp->quit();
68 | }
69 |
70 | // Resize window to the minimum possible and don't let it be resized.
71 | this->resize(minimumSizeHint());
72 | this->setFixedSize(this->size());
73 |
74 | // Signals and slots
75 | connect(timer, SIGNAL(timeout()), this, SLOT(regulateFan()));
76 | connect(ui->actionQuit, SIGNAL(triggered()), qApp, SLOT(quit()));
77 | connect(ui->actionAbout, SIGNAL(triggered()), this, SLOT(onActionAboutTriggered()));
78 | connect(ui->actionAboutQt, SIGNAL(triggered()), this, SLOT(onActionAboutQtTriggered()));
79 | connect(ui->spinBoxInterval, SIGNAL(valueChanged(int)), this, SLOT(intervalChanged(int)));
80 |
81 | loadSettings();
82 |
83 | timer->start(ui->spinBoxInterval->value() * 1000);
84 | tray_icon->show();
85 | }
86 |
87 | QuteFan::~QuteFan()
88 | {
89 | foreach(GpuTab* tab, m_gpu_tab) {
90 | tab->saveGpuSettings();
91 | tab->setGPUDefaults();
92 | }
93 | for (int t = m_gpu_tab.size() - 1; t >= 0; --t)
94 | delete m_gpu_tab[t];
95 | saveSettings();
96 | #if defined(USE_NVML)
97 | delete m_control_nvml;
98 | #elif defined(Q_OS_WIN)
99 | delete m_control_nvapi;
100 | #elif defined(Q_OS_LINUX)
101 | delete m_control_nvctrl;
102 | #endif
103 | delete ui;
104 | }
105 |
106 | void QuteFan::loadSettings()
107 | {
108 | settings->beginGroup("Application");
109 | ui->spinBoxInterval->setValue(settings->value("interval", 1).toInt());
110 | settings->endGroup();
111 | }
112 |
113 | void QuteFan::saveSettings()
114 | {
115 | settings->beginGroup("Application");
116 | settings->setValue("interval", ui->spinBoxInterval->value());
117 | settings->endGroup();
118 | }
119 |
120 | void QuteFan::closeEvent(QCloseEvent* event)
121 | {
122 | if (tray_icon->isVisible()) {
123 | if(first_close_to_tray) {
124 | tray_icon->showMessage(tr("Qutefan"), tr("Qutefan will now keep on running in the tray"));
125 | first_close_to_tray = false;
126 | }
127 | this->hide();
128 | tray_icon->updateMenu();
129 | event->ignore();
130 | }
131 | }
132 |
133 | void QuteFan::onActionAboutTriggered()
134 | {
135 | QString format =
136 | "%1
"
137 | "Version: %2
"
138 | "Author: %3
"
139 | "Github: Qutefan";
140 |
141 | QString txt = format.arg(qApp->applicationName(),
142 | qApp->applicationVersion(),
143 | qApp->organizationName());
144 |
145 | QMessageBox::about(this, ui->actionAbout->text(), txt);
146 | }
147 |
148 | void QuteFan::onActionAboutQtTriggered()
149 | {
150 | QMessageBox::aboutQt(this);
151 | }
152 |
153 | void QuteFan::regulateFan()
154 | {
155 | foreach(GpuTab* tab, m_gpu_tab) {
156 | tab->regulateFans();
157 | tab->displayFrequencies();
158 | }
159 | }
160 |
161 | void QuteFan::intervalChanged(int value)
162 | {
163 | timer->stop();
164 | timer->start(value * 1000);
165 | }
166 |
--------------------------------------------------------------------------------
/qutefan/qutefan/qutefan.h:
--------------------------------------------------------------------------------
1 | #ifndef QUTEFAN_H
2 | #define QUTEFAN_H
3 |
4 | #include
5 | #include
6 | #include
7 | #include
8 | #include
9 | #include
10 | #include
11 |
12 | #include "trayicon.h"
13 |
14 | #if defined(USE_NVML)
15 | #include "qnvml.h"
16 | #include "gputab_nvml.h"
17 | #elif defined(Q_OS_WIN)
18 | #include "qnvapi.h"
19 | #include "gputab_nvapi.h"
20 | #elif defined(Q_OS_LINUX)
21 | #include "qnvctrl.h"
22 | #include "gputab_nvctrl.h"
23 | #endif
24 |
25 | namespace Ui {
26 | class QuteFan;
27 | }
28 |
29 | class QuteFan : public QMainWindow
30 | {
31 | Q_OBJECT
32 |
33 | public:
34 | explicit QuteFan(QWidget* parent = nullptr);
35 | ~QuteFan();
36 |
37 | protected:
38 | void closeEvent(QCloseEvent* event);
39 |
40 | private slots:
41 | void onActionAboutTriggered();
42 | void onActionAboutQtTriggered();
43 |
44 | void regulateFan();
45 | void intervalChanged(int);
46 |
47 | private:
48 | void saveSettings();
49 | void loadSettings();
50 |
51 | void getGpuDefaults();
52 | void setGpuDefaults(unsigned int);
53 |
54 | QSettings* settings;
55 |
56 | #if defined(USE_NVML)
57 | ControlNvml* m_control_nvml;
58 | #elif defined(Q_OS_WIN)
59 | ControlNvAPI* m_control_nvapi;
60 | #elif defined(Q_OS_LINUX)
61 | ControlNVCtrl* m_control_nvctrl;
62 | #endif
63 |
64 | QList m_gpu_tab;
65 |
66 | QTimer* timer;
67 | int interval;
68 |
69 | QuteFanTrayIcon* tray_icon;
70 | bool first_close_to_tray = true;
71 |
72 | Ui::QuteFan* ui;
73 | };
74 |
75 | #endif // QUTEFAN_H
76 |
--------------------------------------------------------------------------------
/qutefan/qutefan/qutefan.pri:
--------------------------------------------------------------------------------
1 | SOURCES += \
2 | $$PWD/doublelabel.cpp \
3 | $$PWD/gpuslider.cpp \
4 | $$PWD/main.cpp \
5 | $$PWD/qutefan.cpp \
6 | $$PWD/gputab.cpp \
7 | $$PWD/trayicon.cpp
8 | HEADERS += \
9 | $$PWD/doublelabel.h \
10 | $$PWD/gpuslider.h \
11 | $$PWD/qutefan.h \
12 | $$PWD/gputab.h \
13 | $$PWD/trayicon.h
14 | FORMS += \
15 | $$PWD/doublelabel.ui \
16 | $$PWD/gpuslider.ui \
17 | $$PWD/qutefan.ui \
18 | $$PWD/gputab.ui
19 |
20 | use_nvml {
21 | SOURCES += \
22 | $$PWD/gputab_nvml.cpp
23 | HEADERS += \
24 | $$PWD/gputab_nvml.h
25 | }
26 |
27 | !use_nvml: win32 {
28 | SOURCES += \
29 | $$PWD/gputab_nvapi.cpp
30 | HEADERS += \
31 | $$PWD/gputab_nvapi.h
32 | }
33 |
34 | !use_nvml: unix {
35 | SOURCES += \
36 | $$PWD/gputab_nvctrl.cpp
37 | HEADERS += \
38 | $$PWD/gputab_nvctrl.h
39 | }
40 |
41 |
--------------------------------------------------------------------------------
/qutefan/qutefan/qutefan.ui:
--------------------------------------------------------------------------------
1 |
2 |
3 | QuteFan
4 |
5 |
6 |
7 | 0
8 | 0
9 |
10 |
11 |
12 |
13 | :/resources/Qutefan.png:/resources/Qutefan.png
14 |
15 |
16 |
17 |
18 | QLayout::SizeConstraint::SetFixedSize
19 |
20 | -
21 |
22 |
23 | true
24 |
25 |
26 | -1
27 |
28 |
29 |
30 | -
31 |
32 |
33 | QLayout::SizeConstraint::SetFixedSize
34 |
35 |
-
36 |
37 |
38 | Update inteval:
39 |
40 |
41 |
42 | -
43 |
44 |
45 | 1
46 |
47 |
48 | 20
49 |
50 |
51 |
52 | -
53 |
54 |
55 | sec
56 |
57 |
58 |
59 | -
60 |
61 |
62 | Qt::Orientation::Horizontal
63 |
64 |
65 |
66 | 0
67 | 0
68 |
69 |
70 |
71 |
72 |
73 |
74 |
75 |
76 |
106 |
107 |
108 |
109 | Quit
110 |
111 |
112 | Ctrl+Q
113 |
114 |
115 |
116 |
117 | About Qutefan
118 |
119 |
120 |
121 |
122 | About Qt
123 |
124 |
125 |
126 |
127 |
128 |
129 |
130 |
131 |
132 |
--------------------------------------------------------------------------------
/qutefan/qutefan/trayicon.cpp:
--------------------------------------------------------------------------------
1 | #include "trayicon.h"
2 |
3 | QuteFanTrayIcon::QuteFanTrayIcon(QMainWindow *parent) : QSystemTrayIcon(parent)
4 | {
5 | main = parent;
6 |
7 | actionShow = new QAction(tr("&Show"), this);
8 | connect(actionShow, SIGNAL(triggered()), this, SLOT(showWindow()));
9 |
10 | actionHide = new QAction(tr("&Hide"), this);
11 | connect(actionHide, SIGNAL(triggered()), this, SLOT(hideWindow()));
12 |
13 | actionQuit = new QAction(tr("&Quit"), this);
14 | connect(actionQuit, SIGNAL(triggered()), qApp, SLOT(quit()));
15 |
16 | menu = new QMenu();
17 | menu->addAction(actionShow);
18 | menu->addAction(actionHide);
19 | menu->addSeparator();
20 | menu->addAction(actionQuit);
21 |
22 | setContextMenu(menu);
23 | setIcon(parent->windowIcon());
24 | setToolTip(parent->windowTitle());
25 |
26 | connect(this, SIGNAL(activated(QSystemTrayIcon::ActivationReason)),
27 | this, SLOT(activated(QSystemTrayIcon::ActivationReason)));
28 |
29 | QTimer::singleShot(0, this, SLOT(updateMenu()));
30 | }
31 |
32 | QuteFanTrayIcon::~QuteFanTrayIcon()
33 | {
34 |
35 | }
36 |
37 | void QuteFanTrayIcon::updateMenu()
38 | {
39 | actionShow->setVisible(!main->isVisible());
40 | actionHide->setVisible(main->isVisible());
41 | }
42 |
43 | void QuteFanTrayIcon::updateTooltip(QString append)
44 | {
45 | setToolTip(main->windowTitle() + " " + append);
46 | }
47 |
48 | void QuteFanTrayIcon::showWindow()
49 | {
50 | actionShow->setVisible(false);
51 | actionHide->setVisible(true);
52 | main->show();
53 | }
54 |
55 | void QuteFanTrayIcon::hideWindow()
56 | {
57 | actionHide->setVisible(false);
58 | actionShow->setVisible(true);
59 | main->hide();
60 | }
61 |
62 | void QuteFanTrayIcon::activated(QSystemTrayIcon::ActivationReason reason)
63 | {
64 | switch (reason) {
65 | case QSystemTrayIcon::Trigger:
66 | if(main->isMinimized()) main->showNormal();
67 | break;
68 | case QSystemTrayIcon::DoubleClick:
69 | if(main->isVisible()) hideWindow();
70 | else showWindow();
71 | break;
72 | default:
73 | break;
74 | }
75 |
76 | }
77 |
78 |
--------------------------------------------------------------------------------
/qutefan/qutefan/trayicon.h:
--------------------------------------------------------------------------------
1 | #ifndef TRAYICON_H
2 | #define TRAYICON_H
3 |
4 | #include
5 | #include
6 | #include
7 | #include
8 | #include
9 | #include
10 | #include
11 |
12 | class QuteFanTrayIcon : public QSystemTrayIcon
13 | {
14 | Q_OBJECT
15 | public:
16 | explicit QuteFanTrayIcon(QMainWindow *parent = nullptr);
17 | ~QuteFanTrayIcon();
18 |
19 | public slots:
20 | void updateMenu();
21 | void updateTooltip(QString);
22 |
23 | private slots:
24 | void showWindow();
25 | void hideWindow();
26 |
27 | void activated(QSystemTrayIcon::ActivationReason);
28 |
29 | private:
30 | QAction* actionShow;
31 | QAction* actionHide;
32 | QAction* actionQuit;
33 | QMenu* menu;
34 |
35 | QMainWindow* main;
36 | };
37 |
38 | #endif // TRAYICON_H
39 |
--------------------------------------------------------------------------------
/qutefan/resources/Qutefan.desktop.in:
--------------------------------------------------------------------------------
1 | [Desktop Entry]
2 | Type=Application
3 | Name=Qutefan
4 | Comment=GPU fan control that does one job
5 | Exec=$$target.path/Qutefan
6 | Icon=Qutefan
7 | Categories=System;
8 |
--------------------------------------------------------------------------------
/qutefan/resources/Qutefan.exe.manifest:
--------------------------------------------------------------------------------
1 |
2 |
3 |
7 | Control NVidia fans
8 |
9 |
10 |
11 |
12 |
15 |
16 |
17 |
18 |
19 |
--------------------------------------------------------------------------------
/qutefan/resources/Qutefan.ico:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/loathingKernel/Qutefan/681cbf391d454e4dd019c12a29796af1d3f6b63f/qutefan/resources/Qutefan.ico
--------------------------------------------------------------------------------
/qutefan/resources/Qutefan.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/loathingKernel/Qutefan/681cbf391d454e4dd019c12a29796af1d3f6b63f/qutefan/resources/Qutefan.png
--------------------------------------------------------------------------------
/qutefan/resources/status/high.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/loathingKernel/Qutefan/681cbf391d454e4dd019c12a29796af1d3f6b63f/qutefan/resources/status/high.png
--------------------------------------------------------------------------------
/qutefan/resources/status/inactive.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/loathingKernel/Qutefan/681cbf391d454e4dd019c12a29796af1d3f6b63f/qutefan/resources/status/inactive.png
--------------------------------------------------------------------------------
/qutefan/resources/status/low.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/loathingKernel/Qutefan/681cbf391d454e4dd019c12a29796af1d3f6b63f/qutefan/resources/status/low.png
--------------------------------------------------------------------------------