2 * Copyright (c) 2008 NVIDIA, Corporation
4 * Permission is hereby granted, free of charge, to any person obtaining a copy
5 * of this software and associated documentation files (the "Software"), to deal
6 * in the Software without restriction, including without limitation the rights
7 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
8 * copies of the Software, and to permit persons to whom the Software is
9 * furnished to do so, subject to the following conditions:
11 * The above copyright notice and this permission notice (including the next
12 * paragraph) shall be included in all copies or substantial portions of the
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 THE
18 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
29 #if defined __cplusplus
34 * XNVCTRLQueryExtension -
36 * Returns True if the extension exists, returns False otherwise.
37 * event_basep and error_basep are the extension event and error
38 * bases. Currently, no extension specific errors or events are
42 Bool
XNVCTRLQueryExtension (
50 * XNVCTRLQueryVersion -
52 * Returns True if the extension exists, returns False otherwise.
53 * major and minor are the extension's major and minor version
57 Bool
XNVCTRLQueryVersion (
67 * Returns True is the specified screen is controlled by the NVIDIA
68 * driver. Returns False otherwise.
71 Bool
XNVCTRLIsNvScreen (
78 * XNVCTRLQueryTargetCount -
80 * Returns True if the target type exists. Returns False otherwise.
81 * If XNVCTRLQueryTargetCount returns True, value will contain the
82 * count of existing targets on the server of the specified target
85 * Please see "Attribute Targets" in NVCtrl.h for the list of valid
89 * BadValue - The target doesn't exist.
92 Bool
XNVCTRLQueryTargetCount (
100 * XNVCTRLSetAttribute -
102 * Sets the attribute to the given value. The attributes and their
103 * possible values are listed in NVCtrl.h.
105 * Not all attributes require the display_mask parameter; see
106 * NVCtrl.h for details.
108 * Calling this function is equivalent to calling XNVCTRLSetTargetAttribute()
109 * with the target_type set to NV_CTRL_TARGET_TYPE_X_SCREEN and
110 * target_id set to 'screen'.
113 * BadValue - The screen or attribute doesn't exist.
114 * BadMatch - The NVIDIA driver is not present on that screen.
117 void XNVCTRLSetAttribute (
120 unsigned int display_mask
,
121 unsigned int attribute
,
127 * XNVCTRLSetTargetAttribute -
129 * Sets the attribute to the given value. The attributes and their
130 * possible values are listed in NVCtrl.h.
132 * Not all attributes require the display_mask parameter; see
133 * NVCtrl.h for details.
136 * BadValue - The target or attribute doesn't exist.
137 * BadMatch - The NVIDIA driver is not present on that target.
140 void XNVCTRLSetTargetAttribute (
144 unsigned int display_mask
,
145 unsigned int attribute
,
151 * XNVCTRLSetAttributeAndGetStatus -
153 * Same as XNVCTRLSetAttribute().
154 * In addition, XNVCTRLSetAttributeAndGetStatus() returns
155 * True if the operation succeeds, False otherwise.
159 Bool
XNVCTRLSetAttributeAndGetStatus (
162 unsigned int display_mask
,
163 unsigned int attribute
,
169 * XNVCTRLSetTargetAttributeAndGetStatus -
171 * Same as XNVCTRLSetTargetAttribute().
172 * In addition, XNVCTRLSetTargetAttributeAndGetStatus() returns
173 * True if the operation succeeds, False otherwise.
177 Bool
XNVCTRLSetTargetAttributeAndGetStatus (
181 unsigned int display_mask
,
182 unsigned int attribute
,
188 * XNVCTRLQueryAttribute -
190 * Returns True if the attribute exists. Returns False otherwise.
191 * If XNVCTRLQueryAttribute returns True, value will contain the
192 * value of the specified attribute.
194 * Not all attributes require the display_mask parameter; see
195 * NVCtrl.h for details.
197 * Calling this function is equivalent to calling
198 * XNVCTRLQueryTargetAttribute() with the target_type set to
199 * NV_CTRL_TARGET_TYPE_X_SCREEN and target_id set to 'screen'.
202 * BadValue - The screen doesn't exist.
203 * BadMatch - The NVIDIA driver is not present on that screen.
206 Bool
XNVCTRLQueryAttribute (
209 unsigned int display_mask
,
210 unsigned int attribute
,
216 * XNVCTRLQueryTargetAttribute -
218 * Returns True if the attribute exists. Returns False otherwise.
219 * If XNVCTRLQueryTargetAttribute returns True, value will contain the
220 * value of the specified attribute.
222 * Not all attributes require the display_mask parameter; see
223 * NVCtrl.h for details.
226 * BadValue - The target doesn't exist.
227 * BadMatch - The NVIDIA driver does not control the target.
230 Bool
XNVCTRLQueryTargetAttribute (
234 unsigned int display_mask
,
235 unsigned int attribute
,
241 * XNVCTRLQueryTargetAttribute64 -
243 * Returns True if the attribute exists. Returns False otherwise.
244 * If XNVCTRLQueryTargetAttribute returns True, value will contain the
245 * value of the specified attribute.
247 * Not all attributes require the display_mask parameter; see
248 * NVCtrl.h for details.
250 * Note: this function behaves like XNVCTRLQueryTargetAttribute(),
251 * but supports 64-bit integer attributes.
254 * BadValue - The target doesn't exist.
255 * BadMatch - The NVIDIA driver does not control the target.
258 Bool
XNVCTRLQueryTargetAttribute64 (
262 unsigned int display_mask
,
263 unsigned int attribute
,
269 * XNVCTRLQueryStringAttribute -
271 * Returns True if the attribute exists. Returns False otherwise.
272 * If XNVCTRLQueryStringAttribute returns True, *ptr will point to an
273 * allocated string containing the string attribute requested. It is
274 * the caller's responsibility to free the string when done.
276 * Calling this function is equivalent to calling
277 * XNVCTRLQueryTargetStringAttribute() with the target_type set to
278 * NV_CTRL_TARGET_TYPE_X_SCREEN and target_id set to 'screen'.
281 * BadValue - The screen doesn't exist.
282 * BadMatch - The NVIDIA driver is not present on that screen.
283 * BadAlloc - Insufficient resources to fulfill the request.
286 Bool
XNVCTRLQueryStringAttribute (
289 unsigned int display_mask
,
290 unsigned int attribute
,
296 * XNVCTRLQueryTargetStringAttribute -
298 * Returns True if the attribute exists. Returns False otherwise.
299 * If XNVCTRLQueryTargetStringAttribute returns True, *ptr will point
300 * to an allocated string containing the string attribute requested.
301 * It is the caller's responsibility to free the string when done.
304 * BadValue - The target doesn't exist.
305 * BadMatch - The NVIDIA driver does not control the target.
306 * BadAlloc - Insufficient resources to fulfill the request.
309 Bool
XNVCTRLQueryTargetStringAttribute (
313 unsigned int display_mask
,
314 unsigned int attribute
,
320 * XNVCTRLSetStringAttribute -
322 * Returns True if the operation succeded. Returns False otherwise.
325 * BadValue - The screen doesn't exist.
326 * BadMatch - The NVIDIA driver is not present on that screen.
327 * BadAlloc - Insufficient resources to fulfill the request.
330 Bool
XNVCTRLSetStringAttribute (
333 unsigned int display_mask
,
334 unsigned int attribute
,
340 * XNVCTRLSetTargetStringAttribute -
342 * Returns True if the operation succeded. Returns False otherwise.
345 * BadValue - The screen doesn't exist.
346 * BadMatch - The NVIDIA driver is not present on that screen.
347 * BadAlloc - Insufficient resources to fulfill the request.
350 Bool
XNVCTRLSetTargetStringAttribute (
354 unsigned int display_mask
,
355 unsigned int attribute
,
361 * XNVCTRLQueryValidAttributeValues -
363 * Returns True if the attribute exists. Returns False otherwise. If
364 * XNVCTRLQueryValidAttributeValues returns True, values will indicate
365 * the valid values for the specified attribute; see the description
366 * of NVCTRLAttributeValidValues in NVCtrl.h.
368 * Calling this function is equivalent to calling
369 * XNVCTRLQueryValidTargetAttributeValues() with the target_type set to
370 * NV_CTRL_TARGET_TYPE_X_SCREEN and target_id set to 'screen'.
373 Bool
XNVCTRLQueryValidAttributeValues (
376 unsigned int display_mask
,
377 unsigned int attribute
,
378 NVCTRLAttributeValidValuesRec
*values
384 * XNVCTRLQueryValidTargetAttributeValues -
386 * Returns True if the attribute exists. Returns False otherwise. If
387 * XNVCTRLQueryValidTargetAttributeValues returns True, values will indicate
388 * the valid values for the specified attribute.
391 Bool
XNVCTRLQueryValidTargetAttributeValues (
395 unsigned int display_mask
,
396 unsigned int attribute
,
397 NVCTRLAttributeValidValuesRec
*values
402 * XNVCTRLQueryValidTargetStringAttributeValues -
404 * Returns True if the attribute exists. Returns False otherwise. If
405 * XNVCTRLQueryValidTargetStringAttributeValues returns True, values will
406 * indicate the valid values for the specified attribute.
409 Bool
XNVCTRLQueryValidTargetStringAttributeValues (
413 unsigned int display_mask
,
414 unsigned int attribute
,
415 NVCTRLAttributeValidValuesRec
*values
420 * XNVCTRLQueryAttributePermissions -
422 * Returns True if the attribute exists. Returns False otherwise. If
423 * XNVCTRLQueryAttributePermissions returns True, permissions will
424 * indicate the permission flags for the attribute.
427 Bool
XNVCTRLQueryAttributePermissions (
429 unsigned int attribute
,
430 NVCTRLAttributePermissionsRec
*permissions
435 * XNVCTRLQueryStringAttributePermissions -
437 * Returns True if the attribute exists. Returns False otherwise. If
438 * XNVCTRLQueryStringAttributePermissions returns True, permissions will
439 * indicate the permission flags for the attribute.
442 Bool
XNVCTRLQueryStringAttributePermissions (
444 unsigned int attribute
,
445 NVCTRLAttributePermissionsRec
*permissions
450 * XNVCTRLQueryBinaryDataAttributePermissions -
452 * Returns True if the attribute exists. Returns False otherwise. If
453 * XNVCTRLQueryBinaryDataAttributePermissions returns True, permissions
454 * will indicate the permission flags for the attribute.
457 Bool
XNVCTRLQueryBinaryDataAttributePermissions (
459 unsigned int attribute
,
460 NVCTRLAttributePermissionsRec
*permissions
465 * XNVCTRLQueryStringOperationAttributePermissions -
467 * Returns True if the attribute exists. Returns False otherwise. If
468 * XNVCTRLQueryStringOperationAttributePermissions returns True,
469 * permissions will indicate the permission flags for the attribute.
472 Bool
XNVCTRLQueryStringOperationAttributePermissions (
474 unsigned int attribute
,
475 NVCTRLAttributePermissionsRec
*permissions
480 * XNVCTRLSetGvoColorConversion -
482 * Sets the color conversion matrix, offset, and scale that should be
483 * used for GVO (Graphic to Video Out).
485 * The Color Space Conversion data is ordered like this:
487 * colorMatrix[0][0] // r.Y
488 * colorMatrix[0][1] // g.Y
489 * colorMatrix[0][2] // b.Y
491 * colorMatrix[1][0] // r.Cr
492 * colorMatrix[1][1] // g.Cr
493 * colorMatrix[1][2] // b.Cr
495 * colorMatrix[2][0] // r.Cb
496 * colorMatrix[2][1] // g.Cb
497 * colorMatrix[2][2] // b.Cb
499 * colorOffset[0] // Y
500 * colorOffset[1] // Cr
501 * colorOffset[2] // Cb
504 * colorScale[1] // Cr
505 * colorScale[2] // Cb
507 * where the data is used according to the following formulae:
509 * Y = colorOffset[0] + colorScale[0] *
510 * (R * colorMatrix[0][0] +
511 * G * colorMatrix[0][1] +
512 * B * colorMatrix[0][2]);
514 * Cr = colorOffset[1] + colorScale[1] *
515 * (R * colorMatrix[1][0] +
516 * G * colorMatrix[1][1] +
517 * B * colorMatrix[1][2]);
519 * Cb = colorOffset[2] + colorScale[2] *
520 * (R * colorMatrix[2][0] +
521 * G * colorMatrix[2][1] +
522 * B * colorMatrix[2][2]);
525 * BadMatch - The NVIDIA driver is not present on that screen.
526 * BadImplementation - GVO is not available on that screen.
529 void XNVCTRLSetGvoColorConversion (
532 float colorMatrix
[3][3],
533 float colorOffset
[3],
540 * XNVCTRLQueryGvoColorConversion -
542 * Retrieves the color conversion matrix and color offset
543 * that are currently being used for GVO (Graphic to Video Out).
545 * The values are ordered within the arrays according to the comments
546 * for XNVCTRLSetGvoColorConversion().
549 * BadMatch - The NVIDIA driver is not present on that screen.
550 * BadImplementation - GVO is not available on that screen.
553 Bool
XNVCTRLQueryGvoColorConversion (
556 float colorMatrix
[3][3],
557 float colorOffset
[3],
563 * XNVCTRLQueryBinaryData -
565 * Returns True if the attribute exists. Returns False otherwise.
566 * If XNVCTRLQueryBinaryData returns True, *ptr will point to an
567 * allocated block of memory containing the binary data attribute
568 * requested. It is the caller's responsibility to free the data
569 * when done. len will list the length of the binary data.
571 * Calling this function is equivalent to calling
572 * XNVCTRLQueryTargetBinaryData() with the target_type set to
573 * NV_CTRL_TARGET_TYPE_X_SCREEN and target_id set to 'screen'.
576 * BadValue - The screen doesn't exist.
577 * BadMatch - The NVIDIA driver is not present on that screen.
578 * BadAlloc - Insufficient resources to fulfill the request.
581 Bool
XNVCTRLQueryBinaryData (
584 unsigned int display_mask
,
585 unsigned int attribute
,
592 * XNVCTRLQueryTargetBinaryData -
594 * Returns True if the attribute exists. Returns False otherwise.
595 * If XNVCTRLQueryTargetBinaryData returns True, *ptr will point to an
596 * allocated block of memory containing the binary data attribute
597 * requested. It is the caller's responsibility to free the data
598 * when done. len will list the length of the binary data.
601 * BadValue - The target doesn't exist.
602 * BadMatch - The NVIDIA driver does not control the target.
603 * BadAlloc - Insufficient resources to fulfill the request.
606 Bool
XNVCTRLQueryTargetBinaryData (
610 unsigned int display_mask
,
611 unsigned int attribute
,
618 * XNVCTRLStringOperation -
620 * Takes a string as input and returns a Xmalloc'ed string as output.
621 * Returns True on success and False on failure.
624 Bool
XNVCTRLStringOperation (
628 unsigned int display_mask
,
629 unsigned int attribute
,
637 * XNVCtrlSelectNotify -
639 * This enables/disables receiving of NV-CONTROL events. The type
640 * specifies the type of event to enable (currently, the only
641 * type that can be requested per-screen with XNVCtrlSelectNotify()
642 * is ATTRIBUTE_CHANGED_EVENT); onoff controls whether receiving this
643 * type of event should be enabled (True) or disabled (False).
645 * Returns True if successful, or False if the screen is not
646 * controlled by the NVIDIA driver.
649 Bool
XNVCtrlSelectNotify (
658 * XNVCtrlSelectTargetNotify -
660 * This enables/disables receiving of NV-CONTROL events that happen on
661 * the specified target. The notify_type specifies the type of event to
662 * enable (currently, the only type that can be requested per-target with
663 * XNVCtrlSelectTargetNotify() is TARGET_ATTRIBUTE_CHANGED_EVENT); onoff
664 * controls whether receiving this type of event should be enabled (True)
665 * or disabled (False).
667 * Returns True if successful, or False if the target is not
668 * controlled by the NVIDIA driver.
671 Bool
XNVCtrlSelectTargetNotify (
681 * XNVCtrlEvent structure
686 unsigned long serial
;
687 Bool send_event
; /* always FALSE, we don't allow send_events */
691 unsigned int display_mask
;
692 unsigned int attribute
;
694 } XNVCtrlAttributeChangedEvent
;
698 XNVCtrlAttributeChangedEvent attribute_changed
;
704 * XNVCtrlEventTarget structure
709 unsigned long serial
;
710 Bool send_event
; /* always FALSE, we don't allow send_events */
715 unsigned int display_mask
;
716 unsigned int attribute
;
718 } XNVCtrlAttributeChangedEventTarget
;
722 XNVCtrlAttributeChangedEventTarget attribute_changed
;
724 } XNVCtrlEventTarget
;
728 * XNVCtrlEventTargetAvailability structure
733 unsigned long serial
;
734 Bool send_event
; /* always FALSE, we don't allow send_events */
739 unsigned int display_mask
;
740 unsigned int attribute
;
743 } XNVCtrlAttributeChangedEventTargetAvailability
;
747 XNVCtrlAttributeChangedEventTargetAvailability attribute_changed
;
749 } XNVCtrlEventTargetAvailability
;
753 * XNVCtrlStringEventTarget structure
758 unsigned long serial
;
759 Bool send_event
; /* always FALSE, we don't allow send_events */
764 unsigned int display_mask
;
765 unsigned int attribute
;
766 } XNVCtrlStringAttributeChangedEventTarget
;
770 XNVCtrlStringAttributeChangedEventTarget attribute_changed
;
772 } XNVCtrlStringEventTarget
;
777 * XNVCtrlBinaryEventTarget structure
782 unsigned long serial
;
783 Bool send_event
; /* always FALSE, we don't allow send_events */
788 unsigned int display_mask
;
789 unsigned int attribute
;
790 } XNVCtrlBinaryAttributeChangedEventTarget
;
794 XNVCtrlBinaryAttributeChangedEventTarget attribute_changed
;
796 } XNVCtrlBinaryEventTarget
;
798 #if defined __cplusplus
802 #endif /* __NVCTRLLIB_H */